]> git.localhorst.tv Git - blank.git/blob - src/world/Generator.hpp
sky box model & shader
[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 seed = 0;
20                 float stretch = 64.0f;
21                 float solid_threshold = 0.5f;
22         };
23
24         explicit Generator(const Config &) noexcept;
25
26         void operator ()(Chunk &) const noexcept;
27
28         void Space(Block::Type t) noexcept { space = t; }
29         void Light(Block::Type t) noexcept { light = t; }
30         void Solids(const std::vector<Block::Type> &s) { solids = s; }
31
32 private:
33         SimplexNoise solidNoise;
34         WorleyNoise typeNoise;
35
36         float stretch;
37         float solid_threshold;
38
39         Block::Type space;
40         Block::Type light;
41         std::vector<Block::Type> solids;
42
43 };
44
45 }
46
47 #endif