]> git.localhorst.tv Git - blank.git/blob - src/ai/Spawner.hpp
store shapes in models rather than meshes
[blank.git] / src / ai / Spawner.hpp
1 #ifndef BLANK_AI_SPAWNER_HPP_
2 #define BLANK_AI_SPAWNER_HPP_
3
4 #include "../app/IntervalTimer.hpp"
5
6 #include <vector>
7 #include <glm/glm.hpp>
8
9
10 namespace blank {
11
12 class Controller;
13 class Entity;
14 class GaloisLFSR;
15 class Model;
16 class Skeletons;
17 class TextureIndex;
18 class World;
19
20 class Spawner {
21
22 public:
23         Spawner(World &, Skeletons &, GaloisLFSR &);
24         ~Spawner();
25
26         void LimitSkeletons(std::size_t begin, std::size_t end);
27         void LoadTextures(TextureIndex &);
28
29         void Update(int dt);
30
31 private:
32         void CheckDespawn() noexcept;
33         void TrySpawn();
34         void Spawn(Entity &reference, const glm::ivec3 &, const glm::vec3 &);
35
36         Model &RandomSkeleton() noexcept;
37
38 private:
39         World &world;
40         Skeletons &skeletons;
41         std::vector<Controller *> controllers;
42
43         GaloisLFSR &random;
44
45         IntervalTimer timer;
46         float despawn_range;
47         float spawn_distance;
48         unsigned int max_entities;
49         int chunk_range;
50
51         std::size_t skeletons_offset;
52         std::size_t skeletons_length;
53
54         std::vector<float> tex_map;
55
56 };
57
58 }
59
60 #endif