]> git.localhorst.tv Git - blank.git/blobdiff - src/generator.cpp
add chunk inspect button (C)
[blank.git] / src / generator.cpp
index f701230de014a4fee02e0ea372e810c4e694d149..43d932cceae421473bc391820370c36dccc1fac7 100644 (file)
@@ -5,12 +5,13 @@
 
 namespace blank {
 
-Generator::Generator(unsigned int seed)
-: solidNoise(seed)
-, typeNoise(seed + 1)
-, stretch(64.0f)
-, solid_threshold(0.8f)
+Generator::Generator(const Config &config)
+: solidNoise(config.solid_seed)
+, typeNoise(config.type_seed)
+, stretch(config.stretch)
+, solid_threshold(config.solid_threshold)
 , 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();
 }