ComputerGraphik TU WIEN
particleSystemGPU.hpp
Go to the documentation of this file.
1 #ifndef PARTICLESYSTEMGPU_HPP
2 #define PARTICLESYSTEMGPU_HPP
3 
4 #include <glm/vec2.hpp>
5 #include "tessellation.hpp"
6 
8 
27 public:
29  struct NewParticle {
30  glm::vec3 pos;
31  glm::vec3 dir;
32  glm::vec3 atr;//power, angle, dummy
33  };
34 
35 public:
36  ParticleSystemGPU(const std::string& name, Scene* scene = 0, Model* model = 0, const glm::mat4& modelMatrix = glm::mat4(1.0f));
37  virtual ~ParticleSystemGPU();
38 
40 
43  void push(const NewParticle& pos);
44 
45  GLuint getActiveCount() const { return counters[0]; }
46  GLuint getParticlePosVBO() const { return particlesPosVBO; }
47 
48  void draw() const;
49  bool animate(double time);
50  void update(double deltaT);
51  void setShader(Shader* val);
52 
53 private:
54  double lastUpdate;
55  double lastAnimate;
57 
58  GLuint countersVBO;
59  GLuint particlesVBO;
61  std::vector<GLuint> counters;
62  std::vector<NewParticle> newParticles;
63 };
64 
65 #endif //PARTICLESYSTEMGPU_HPP
Encapsulates a graphical object model in the GPU.
Definition: model.hpp:14
double lastAnimate
Definition: particleSystemGPU.hpp:55
glm::vec3 pos
Definition: particleSystemGPU.hpp:30
glm::vec3 dir
Definition: particleSystemGPU.hpp:31
GLuint particlesVBO
Definition: particleSystemGPU.hpp:59
Model * model
Definition: sceneObject.hpp:69
Implementation of tessellation, abstract class.
Definition: tessellation.hpp:34
void update(double deltaT)
Definition: particleSystemGPU.cpp:56
Implementation of GPU particle system.
Definition: particleSystemGPU.hpp:26
double lastUpdate
Definition: particleSystemGPU.hpp:54
Shader * computeShader
Definition: particleSystemGPU.hpp:56
std::vector< NewParticle > newParticles
Definition: particleSystemGPU.hpp:62
virtual ~ParticleSystemGPU()
Definition: particleSystemGPU.cpp:49
GLuint particlesPosVBO
Definition: particleSystemGPU.hpp:60
void setShader(Shader *val)
Definition: particleSystemGPU.cpp:185
GLuint getActiveCount() const
Definition: particleSystemGPU.hpp:45
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
Scene * scene
Definition: sceneObject.hpp:68
void push(const NewParticle &pos)
Add a new particle to upload in next frame.
Definition: particleSystemGPU.cpp:168
std::string name
Definition: sceneObject.hpp:73
glm::mat4 modelMatrix
Definition: sceneObject.hpp:71
Encapsulates a shader program.
Definition: shader.hpp:9
glm::vec3 atr
Definition: particleSystemGPU.hpp:32
GLuint countersVBO
Definition: particleSystemGPU.hpp:58
GLuint getParticlePosVBO() const
Definition: particleSystemGPU.hpp:46
void draw() const
Definition: particleSystemGPU.cpp:97
ParticleSystemGPU(const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1.0f))
Definition: particleSystemGPU.cpp:20
std::vector< GLuint > counters
Definition: particleSystemGPU.hpp:61
Helper class to upload new particles.
Definition: particleSystemGPU.hpp:29
bool animate(double time)
Definition: particleSystemGPU.cpp:176