]> git.localhorst.tv Git - blank.git/blob - src/world/Generator.hpp
basic message state
[blank.git] / src / world / Generator.hpp
1 #ifndef BLANK_WORLD_GENERATOR_HPP_
2 #define BLANK_WORLD_GENERATOR_HPP_
3
4 #include "Block.hpp"
5 #include "../rand/SimplexNoise.hpp"
6 #include "../rand/WorleyNoise.hpp"
7
8 #include <cstdint>
9 #include <vector>
10
11
12 namespace blank {
13
14 class Chunk;
15
16 class Generator {
17
18 public:
19         struct Config {
20                 std::uint64_t seed = 0;
21                 float stretch = 64.0f;
22                 float solid_threshold = 0.5f;
23         };
24
25         explicit Generator(const Config &) noexcept;
26
27         void operator ()(Chunk &) const noexcept;
28
29         void Space(Block::Type t) noexcept { space = t; }
30         void Light(Block::Type t) noexcept { light = t; }
31         void Solids(const std::vector<Block::Type> &s) { solids = s; }
32
33 private:
34         SimplexNoise solidNoise;
35         WorleyNoise typeNoise;
36
37         float stretch;
38         float solid_threshold;
39
40         Block::Type space;
41         Block::Type light;
42         std::vector<Block::Type> solids;
43
44 };
45
46 }
47
48 #endif