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