]> git.lizzy.rs Git - dragonblocks3d.git/blob - src/dragonblocks/mesh_gen_thread.hpp
7a1809eb986923e060f08b7847bbe2a6f0b442ff
[dragonblocks3d.git] / src / dragonblocks / mesh_gen_thread.hpp
1 #pragma once
2
3 #include <map>
4 #include <vector>
5
6 namespace dragonblocks
7 {
8         class MeshGenThread                                                                                             // TODO: extend std::thread or something
9         {
10                 public:
11                 class MeshGenerator
12                 {
13                         public:
14                         virtual void updateMesh();
15                 };
16                 
17                 void addTask(MeshGenerator *);
18                 void step();
19                 
20                 private:                
21                 void generateJobList();
22                 bool runJob();
23                 
24                 std::map<MeshGenerator *, bool> queued_jobs;                                    // This sucks i should use std::queue instead but i need to somehow make sure that a task isnt in there twice
25                 std::vector<MeshGenerator *> active_jobs;
26                 
27         };
28 }