Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
voxelparticleremover.h
1 #pragma once
2 
3 #include <memory>
4 #include <list>
5 
6 #include "property/property.h"
7 
8 
9 template<typename T>
10 class ThreadPool;
11 
12 class Player;
13 struct VoxelParticleData;
16 
17 /*
18  Check that is guaranteed to be performed on every particle once in a
19  specific interval. If check() returns true the particle is marked as dead
20  and the space in the buffer may be used again for a new particle
21 */
23 public:
26 
27  void addCheck(std::shared_ptr<VoxelParticleRemoveCheck> checker);
28 
29  void setPlayer(Player& player);
30 
31  float interval() const;
32  void setInterval(float interval);
33 
34  virtual void update(float deltaSec);
35 
36 
37 protected:
38  VoxelParticleEngine* m_particleEngine;
39  std::vector<std::shared_ptr<VoxelParticleRemoveCheck>> m_checker;
40  std::unique_ptr<ThreadPool<VoxelParticleData>> m_threadPool;
41 
42  Property<float> m_interval;
43  Property<bool> m_multithreaded;
44 
45  int m_currentIndex;
46 
47  void performChecks(int checkCount);
48  bool isDead(VoxelParticleData& particle);
49  void beforeCheck();
50 };
51 
Definition: voxelparticledata.h:7
Definition: voxelparticleremovecheck.h:6
Definition: voxelparticleengine.h:23
Definition: voxelparticleremover.h:22
Definition: threadpool.h:16
Definition: player.h:22