History

adding rave glove modes and changing API of particle system to accommodate

Jeffrey Ventrella committed 13 years ago

Commit 05039b41 parent ed278005 files · +203 −65Browse files

Showing the changes to interface/src/ParticleSystem.h (1 of 5 files). Show all

Unified · Split

interface/src/ParticleSystem.h+16−12
@@ -11,10 +11,10 @@ · 10 unmodified lines
11#include <glm/gtc/quaternion.hpp>11#include <glm/gtc/quaternion.hpp>
12 12
13const int MAX_PARTICLES = 5000;13const int MAX_PARTICLES = 5000;
14const int MAX_EMITTERS = 20;14const int MAX_EMITTERS = 20;
15const int NUM_PARTICLE_LIFE_STAGES = 4;15const int NUM_PARTICLE_LIFE_STAGES = 4;
16const bool USE_BILLBOARD_RENDERING = false;16const bool USE_BILLBOARD_RENDERING = false;
17const bool SHOW_VELOCITY_TAILS = false;17const bool SHOW_VELOCITY_TAILS = false;
18 18
19class ParticleSystem {19class ParticleSystem {
20public:20public:
@@ -38,18 +38,21 @@ public: · 17 unmodified lines
38 ParticleSystem();38 ParticleSystem();
39 39
40 int addEmitter(); // add (create new) emitter and get its unique id40 int addEmitter(); // add (create new) emitter and get its unique id
41 void emitParticlesNow(int emitterIndex, int numParticles, float thrust, float lifespan);41 void emitParticlesNow(int emitterIndex, int numParticles, float thrust);
42 void simulate(float deltaTime);42 void simulate(float deltaTime);
43 void killAllParticles();
43 void render();44 void render();
44 45
45 void setUpDirection(glm::vec3 upDirection) {_upDirection = upDirection;} // tell particle system which direction is up46 void setUpDirection(glm::vec3 upDirection) {_upDirection = upDirection;} // tell particle system which direction is up
46 void setEmitterBaseParticle(int emitterIndex, bool showing );47 void setEmitterBaseParticle (int emitterIndex, bool showing );
47 void setEmitterBaseParticle(int emitterIndex, bool showing, float radius, glm::vec4 color );48 void setParticleAttributes (int emitterIndex, ParticleAttributes attributes); // set attributes for whole life of particles
48 void setParticleAttributes (int emitterIndex, ParticleAttributes attributes);49 void setParticleAttributes (int emitterIndex, int lifeStage, ParticleAttributes attributes); // set attributes for this life stage of particles
49 void setParticleAttributes (int emitterIndex, int lifeStage, ParticleAttributes attributes);50 void setEmitterBaseParticleColor (int emitterIndex, glm::vec4 color ) {_emitter[emitterIndex].baseParticle.color = color; }
50 void setEmitterPosition (int emitterIndex, glm::vec3 position) { _emitter[emitterIndex].position = position; } // set position of emitter51 void setEmitterBaseParticleRadius(int emitterIndex, float radius ) {_emitter[emitterIndex].baseParticle.radius = radius; }
51 void setEmitterDirection (int emitterIndex, glm::vec3 direction) { _emitter[emitterIndex].direction = direction; } // set directional axis (normal) 52 void setEmitterPosition (int emitterIndex, glm::vec3 position ) {_emitter[emitterIndex].position = position; }
52 void setShowingEmitter (int emitterIndex, bool showing ) { _emitter[emitterIndex].visible = showing; } // set its visibiity53 void setEmitterDirection (int emitterIndex, glm::vec3 direction) {_emitter[emitterIndex].direction = direction; }
54 void setShowingEmitter (int emitterIndex, bool showing ) {_emitter[emitterIndex].visible = showing; }
55 void setEmitterParticleLifespan (int emitterIndex, float lifespan ) {_emitter[emitterIndex].particleLifespan = lifespan; }
53 56
54private:57private:
55 58
@@ -68,6 +71,7 @@ private: · 12 unmodified lines
68 glm::vec3 position;71 glm::vec3 position;
69 glm::vec3 direction;72 glm::vec3 direction;
70 bool visible;73 bool visible;
74 float particleLifespan;
71 Particle baseParticle; // a non-physical particle at the emitter position75 Particle baseParticle; // a non-physical particle at the emitter position
72 ParticleAttributes particleAttributes[NUM_PARTICLE_LIFE_STAGES]; // the attributes of particles emitted from this emitter76 ParticleAttributes particleAttributes[NUM_PARTICLE_LIFE_STAGES]; // the attributes of particles emitted from this emitter
73 }; 77 };
@@ -80,7 +84,7 @@ private: · 6 unmodified lines
80 84
81 // private methods85 // private methods
82 void updateParticle(int index, float deltaTime);86 void updateParticle(int index, float deltaTime);
83 void createParticle(int e, glm::vec3 velocity, float lifespan);87 void createParticle(int e, glm::vec3 velocity);
84 void killParticle(int p);88 void killParticle(int p);
85 void renderEmitter(int emitterIndex, float size);89 void renderEmitter(int emitterIndex, float size);
86 void renderParticle(int p);90 void renderParticle(int p);