X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgenerator.cpp;h=c1a7a0801198de34e3a4b8b3d0bdddd70f334ba4;hb=bd6bd2c875f4b6baef913e5315aa9f7e7cd7da7a;hp=f701230de014a4fee02e0ea372e810c4e694d149;hpb=3072e2cd49ad1614100d1a1c73afe6a4888fb875;p=blank.git diff --git a/src/generator.cpp b/src/generator.cpp index f701230..c1a7a08 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -11,6 +11,7 @@ Generator::Generator(unsigned int seed) , stretch(64.0f) , solid_threshold(0.8f) , space(0) +, light(0) , solids() { } @@ -35,6 +36,15 @@ void Generator::operator ()(Chunk &chunk) const { } } } + unsigned int random = 263167 * pos.x + 2097593 * pos.y + 426389 * pos.z; + for (int index = 0; index < Chunk::Size(); ++index) { + if (chunk.IsSurface(index)) { + random = random * 666649 + 7778777; + if ((random % 32) == 0) { + chunk.SetBlock(index, Block(light)); + } + } + } chunk.Invalidate(); chunk.CheckUpdate(); }