From cf647ebf504eb523d822fa79622cb59d009680da Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 13 Mar 2018 19:30:05 +0500 Subject: Implemented basic lighting --- src/Section.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Section.cpp') diff --git a/src/Section.cpp b/src/Section.cpp index 71937e2..1f60471 100644 --- a/src/Section.cpp +++ b/src/Section.cpp @@ -46,7 +46,7 @@ Section::Section(Vector pos, unsigned char bitsPerBlock, std::vectorworldPosition = pos; this->block = std::move(blockData); this->palette = std::move(palette); - this->light = std::move(lightData); + this->light = std::move(lightData); this->sky = std::move(skyData); hash = -1; @@ -99,12 +99,12 @@ BlockId Section::GetBlockId(Vector pos) const { unsigned char Section::GetBlockLight(Vector pos) const { - if (light.empty()) - return 0; + if (light.empty()) + return 0; - int blockNumber = pos.y * 256 + pos.z * 16 + pos.x; - unsigned char lightValue = this->light[blockNumber / 2]; - return (blockNumber % 2 == 0) ? (lightValue & 0xF) : (lightValue >> 4); + int blockNumber = pos.y * 256 + pos.z * 16 + pos.x; + unsigned char lightValue = this->light[blockNumber / 2]; + return (blockNumber % 2 == 0) ? (lightValue & 0xF) : (lightValue >> 4); } unsigned char Section::GetBlockSkyLight(Vector pos) const -- cgit v1.2.3