X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fworld.cpp;fp=src%2Fworld%2Fworld.cpp;h=893285ec2ac90d6fedf369bb12ca4e9433abb48a;hb=f506afdcb23fed22f2c7f345b94cb411487f89c9;hp=28e419552829262d33c4a74a4716b24bb3f859a1;hpb=261062e0b34e1f4c187d2e60de792ee9aabd06b8;p=blank.git diff --git a/src/world/world.cpp b/src/world/world.cpp index 28e4195..893285e 100644 --- a/src/world/world.cpp +++ b/src/world/world.cpp @@ -768,23 +768,23 @@ void World::GetLight( glm::vec3 &col, glm::vec3 &amb ) { - Chunk *chunk = chunks.Get(e.ChunkCoords()); - if (!chunk) { + BlockLookup center(chunks.Get(e.ChunkCoords()), e.Position()); + if (!center) { // chunk unavailable, so make it really dark and from // some arbitrary direction dir = glm::vec3(1.0f, 2.0f, 3.0f); col = glm::vec3(0.025f); // ~0.8^15 return; } - glm::ivec3 base(e.Position()); - int base_light = chunk->GetLight(base); + glm::ivec3 base(center.GetBlockPos()); + int base_light = center.GetLight(); int max_light = 0; int min_light = 15; glm::ivec3 acc(0, 0, 0); for (glm::ivec3 offset(-1, -1, -1); offset.z < 2; ++offset.z) { for (offset.y = -1; offset.y < 2; ++offset.y) { for (offset.x = -1; offset.x < 2; ++offset.x) { - BlockLookup block(chunk, base + offset); + BlockLookup block(¢er.GetChunk(), center.GetBlockPos() + offset); if (!block) { // missing, just ignore it continue;