X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgenerator.cpp;h=3d61b75a748f1d793f4e61048978f47cc35b9cce;hb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;hp=dc83b89b7c681a541aef9374595967501592f8f7;hpb=7ef94f4e55a0b798eecbcc7166a80b8364b21ea4;p=blank.git diff --git a/src/generator.cpp b/src/generator.cpp index dc83b89..3d61b75 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -5,7 +5,7 @@ namespace blank { -Generator::Generator(const Config &config) +Generator::Generator(const Config &config) noexcept : solidNoise(config.solid_seed) , typeNoise(config.type_seed) , stretch(1.0f/config.stretch) @@ -17,13 +17,12 @@ Generator::Generator(const Config &config) } -void Generator::operator ()(Chunk &chunk) const { - chunk.Allocate(); +void Generator::operator ()(Chunk &chunk) const noexcept { Chunk::Pos pos(chunk.Position()); glm::vec3 coords(pos * Chunk::Extent()); - for (int z = 0; z < Chunk::Depth(); ++z) { - for (int y = 0; y < Chunk::Height(); ++y) { - for (int x = 0; x < Chunk::Width(); ++x) { + for (int z = 0; z < Chunk::depth; ++z) { + for (int y = 0; y < Chunk::height; ++y) { + for (int x = 0; x < Chunk::width; ++x) { Block::Pos block_pos(x, y, z); glm::vec3 gen_pos = (coords + block_pos) * stretch; float val = OctaveNoise(solidNoise, coords + block_pos, 3, 0.5f, stretch, 2.0f); @@ -37,7 +36,7 @@ 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) { + for (int index = 0; index < Chunk::size; ++index) { if (chunk.IsSurface(index)) { random = random * 666649 + 7778777; if ((random % 32) == 0) {