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
1111 #include <glm/gtc/quaternion.hpp>
1212
1313 const int MAX_PARTICLES = 5000;
14−const int MAX_EMITTERS = 20;
14+const int MAX_EMITTERS = 20;
1515 const int NUM_PARTICLE_LIFE_STAGES = 4;
1616 const bool USE_BILLBOARD_RENDERING = false;
17−const bool SHOW_VELOCITY_TAILS = false;
17+const bool SHOW_VELOCITY_TAILS = false;
1818
1919 class ParticleSystem {
2020 public:
@@ -38,18 +38,21 @@ public: · 17 unmodified lines
3838 ParticleSystem();
3939
4040 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);
4242 void simulate(float deltaTime);
43+ void killAllParticles();
4344 void render();
44−
45+
4546 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, float radius, glm::vec4 color );
48− void setParticleAttributes (int emitterIndex, ParticleAttributes attributes);
49− void setParticleAttributes (int emitterIndex, int lifeStage, ParticleAttributes attributes);
50− void setEmitterPosition (int emitterIndex, glm::vec3 position) { _emitter[emitterIndex].position = position; } // set position of emitter
51− void setEmitterDirection (int emitterIndex, glm::vec3 direction) { _emitter[emitterIndex].direction = direction; } // set directional axis (normal)
52− void setShowingEmitter (int emitterIndex, bool showing ) { _emitter[emitterIndex].visible = showing; } // set its visibiity
47+ void setEmitterBaseParticle (int emitterIndex, bool showing );
48+ void setParticleAttributes (int emitterIndex, ParticleAttributes attributes); // set attributes for whole life of particles
49+ void setParticleAttributes (int emitterIndex, int lifeStage, ParticleAttributes attributes); // set attributes for this life stage of particles
50+ void setEmitterBaseParticleColor (int emitterIndex, glm::vec4 color ) {_emitter[emitterIndex].baseParticle.color = color; }
51+ void setEmitterBaseParticleRadius(int emitterIndex, float radius ) {_emitter[emitterIndex].baseParticle.radius = radius; }
52+ void setEmitterPosition (int emitterIndex, glm::vec3 position ) {_emitter[emitterIndex].position = position; }
53+ 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; }
5356
5457 private:
5558
@@ -68,6 +71,7 @@ private: · 12 unmodified lines
6871 glm::vec3 position;
6972 glm::vec3 direction;
7073 bool visible;
74+ float particleLifespan;
7175 Particle baseParticle; // a non-physical particle at the emitter position
7276 ParticleAttributes particleAttributes[NUM_PARTICLE_LIFE_STAGES]; // the attributes of particles emitted from this emitter
7377 };
@@ -80,7 +84,7 @@ private: · 6 unmodified lines
8084
8185 // private methods
8286 void updateParticle(int index, float deltaTime);
83− void createParticle(int e, glm::vec3 velocity, float lifespan);
87+ void createParticle(int e, glm::vec3 velocity);
8488 void killParticle(int p);
8589 void renderEmitter(int emitterIndex, float size);
8690 void renderParticle(int p);