summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-03-13 17:55:58 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-03-13 17:55:58 +0100
commit8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f (patch)
treed7fea08c83a928fcc08c787b93e594d2d7999622 /src/World.cpp
parentImplemented basic lighting (diff)
downloadAltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.tar
AltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.tar.gz
AltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.tar.bz2
AltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.tar.lz
AltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.tar.xz
AltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.tar.zst
AltCraft-8616ce6a0bfd4a6c31d4f6dded4137ad9eb2ba2f.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 75e0b3f..f9eb560 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -416,7 +416,12 @@ unsigned char World::GetBlockLight(Vector pos)
if (!section)
return 0;
- Vector directions[] = {
+ return GetBlockLight(blockPos, section, xp, xn, yp, yn, zp, zn);
+}
+
+unsigned char World::GetBlockLight(const Vector &blockPos, const Section *section, const Section *xp, const Section *xn, const Section *yp, const Section *yn, const Section *zp, const Section *zn)
+{
+ const Vector directions[] = {
Vector(0,0,0),
Vector(1,0,0),
Vector(-1,0,0),
@@ -447,7 +452,7 @@ unsigned char World::GetBlockLight(Vector pos)
dirValue = zp->GetBlockLight(Vector(vec.x, vec.y, 0));
} else
dirValue = section->GetBlockLight(vec);
-
+
value = _max(value, dirValue);
}
return value;
@@ -472,7 +477,12 @@ unsigned char World::GetBlockSkyLight(Vector pos)
if (!section)
return 0;
- Vector directions[] = {
+ return GetBlockSkyLight(blockPos, section, xp, xn, yp, yn, zp, zn);
+}
+
+unsigned char World::GetBlockSkyLight(const Vector &blockPos, const Section *section, const Section *xp, const Section *xn, const Section *yp, const Section *yn, const Section *zp, const Section *zn)
+{
+ const Vector directions[] = {
Vector(0,0,0),
Vector(1,0,0),
Vector(-1,0,0),
@@ -508,4 +518,4 @@ unsigned char World::GetBlockSkyLight(Vector pos)
value = _max(value, dirValue);
}
return value;
-} \ No newline at end of file
+}