X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FGenerator.hpp;fp=src%2Fworld%2FGenerator.hpp;h=a2ae18a3e99fa56450f57c88abd8e4deea8d2f33;hb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;hp=0000000000000000000000000000000000000000;hpb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;p=blank.git diff --git a/src/world/Generator.hpp b/src/world/Generator.hpp new file mode 100644 index 0000000..a2ae18a --- /dev/null +++ b/src/world/Generator.hpp @@ -0,0 +1,48 @@ +#ifndef BLANK_WORLD_GENERATOR_HPP_ +#define BLANK_WORLD_GENERATOR_HPP_ + +#include "Block.hpp" +#include "../rand/SimplexNoise.hpp" +#include "../rand/WorleyNoise.hpp" + +#include + + +namespace blank { + +class Chunk; + +class Generator { + +public: + struct Config { + unsigned int solid_seed = 0; + unsigned int type_seed = 0; + float stretch = 64.0f; + float solid_threshold = 0.5f; + }; + + explicit Generator(const Config &) noexcept; + + void operator ()(Chunk &) const noexcept; + + void Space(Block::Type t) noexcept { space = t; } + void Light(Block::Type t) noexcept { light = t; } + void Solids(const std::vector &s) { solids = s; } + +private: + SimplexNoise solidNoise; + WorleyNoise typeNoise; + + float stretch; + float solid_threshold; + + Block::Type space; + Block::Type light; + std::vector solids; + +}; + +} + +#endif