]> git.localhorst.tv Git - blank.git/blob - src/world/Generator.hpp
some code reorganization
[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 <vector>
9
10
11 namespace blank {
12
13 class Chunk;
14
15 class Generator {
16
17 public:
18         struct Config {
19                 unsigned int solid_seed = 0;
20                 unsigned int type_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