Showing the changes to interface/src/ParticleSystem.h (1 of 3 files). Show all
Unified · Split
| @@ -21,7 +21,6 @@ enum ParticleRenderStyle · 20 unmodified lines | |||
| 21 | NUM_PARTICLE_RENDER_STYLES | 21 | NUM_PARTICLE_RENDER_STYLES |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | |||
| 25 | enum ColorModulationStyle | 24 | enum ColorModulationStyle |
| 26 | { | 25 | { |
| 27 | COLOR_MODULATION_STYLE_NULL = -1, | 26 | COLOR_MODULATION_STYLE_NULL = -1, |
| @@ -30,7 +29,6 @@ enum ColorModulationStyle · 2 unmodified lines | |||
| 30 | NUM_COLOR_MODULATION_STYLES | 29 | NUM_COLOR_MODULATION_STYLES |
| 31 | }; | 30 | }; |
| 32 | 31 | ||
| 33 | |||
| 34 | enum ParticleLifeStage | 32 | enum ParticleLifeStage |
| 35 | { | 33 | { |
| 36 | PARTICLE_LIFESTAGE_0 = 0, | 34 | PARTICLE_LIFESTAGE_0 = 0, |
| @@ -40,9 +38,6 @@ enum ParticleLifeStage · 3 unmodified lines | |||
| 40 | NUM_PARTICLE_LIFE_STAGES | 38 | NUM_PARTICLE_LIFE_STAGES |
| 41 | }; | 39 | }; |
| 42 | 40 | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | class ParticleSystem { | 41 | class ParticleSystem { |
| 47 | public: | 42 | public: |
| 48 | 43 | ||
| @@ -80,7 +75,7 @@ public: · 31 unmodified lines | |||
| 80 | void setParticleAttributesToDefault(ParticleAttributes * attributes); // set these attributes to their default values | 75 | void setParticleAttributesToDefault(ParticleAttributes * attributes); // set these attributes to their default values |
| 81 | void setParticleAttributes (int emitterIndex, ParticleAttributes attributes); // set attributes for whole life of particles | 76 | void setParticleAttributes (int emitterIndex, ParticleAttributes attributes); // set attributes for whole life of particles |
| 82 | void setParticleAttributes (int emitterIndex, ParticleLifeStage lifeStage, ParticleAttributes attributes); // set attributes for this life stage | 77 | void setParticleAttributes (int emitterIndex, ParticleLifeStage lifeStage, ParticleAttributes attributes); // set attributes for this life stage |
| 83 | void setEmitterPosition (int emitterIndex, glm::vec3 position ) {_emitter[emitterIndex].position = position; } | 78 | void setEmitterPosition (int emitterIndex, glm::vec3 position ); |
| 84 | void setEmitterParticleResolution (int emitterIndex, int resolution ) {_emitter[emitterIndex].particleResolution = resolution; } | 79 | void setEmitterParticleResolution (int emitterIndex, int resolution ) {_emitter[emitterIndex].particleResolution = resolution; } |
| 85 | void setEmitterDirection (int emitterIndex, glm::vec3 direction ) {_emitter[emitterIndex].direction = direction; } | 80 | void setEmitterDirection (int emitterIndex, glm::vec3 direction ) {_emitter[emitterIndex].direction = direction; } |
| 86 | void setShowingEmitter (int emitterIndex, bool showing ) {_emitter[emitterIndex].visible = showing; } | 81 | void setShowingEmitter (int emitterIndex, bool showing ) {_emitter[emitterIndex].visible = showing; } |
| @@ -105,11 +100,13 @@ private: · 18 unmodified lines | |||
| 105 | 100 | ||
| 106 | struct Emitter { | 101 | struct Emitter { |
| 107 | glm::vec3 position; // the position of the emitter in world coordinates | 102 | glm::vec3 position; // the position of the emitter in world coordinates |
| 103 | glm::vec3 previousPosition; // the position of the emitter in the previous time step | ||
| 108 | glm::vec3 direction; // a normalized vector used as an axis for particle emission and other effects | 104 | glm::vec3 direction; // a normalized vector used as an axis for particle emission and other effects |
| 109 | bool visible; // whether or not a line is shown indicating the emitter (indicating its direction) | 105 | bool visible; // whether or not a line is shown indicating the emitter (indicating its direction) |
| 110 | float particleLifespan; // how long the particle shall live, in seconds | 106 | float particleLifespan; // how long the particle shall live, in seconds |
| 111 | int particleResolution; // for sphere-based particles | 107 | int particleResolution; // for sphere-based particles |
| 112 | float emitReserve; // baed on 'rate', this is the number of particles that need to be emitted at a given time step | 108 | float emitReserve; // baed on 'rate', this is the number of particles that need to be emitted at a given time step |
| 109 | int numParticlesEmittedThisTime; //the integer number of particles to emit at the preent time step | ||
| 113 | float thrust; // the initial velocity upon emitting along the emitter direction | 110 | float thrust; // the initial velocity upon emitting along the emitter direction |
| 114 | float rate; // currently, how many particles emitted during a simulation time step | 111 | float rate; // currently, how many particles emitted during a simulation time step |
| 115 | bool showingBaseParticle; // if true, a copy of particle 0 is shown on the emitter position | 112 | bool showingBaseParticle; // if true, a copy of particle 0 is shown on the emitter position |
| @@ -127,7 +124,7 @@ private: · 11 unmodified lines | |||
| 127 | 124 | ||
| 128 | // private methods | 125 | // private methods |
| 129 | void updateParticle(int index, float deltaTime); | 126 | void updateParticle(int index, float deltaTime); |
| 130 | void createParticle(int e); | 127 | void createParticle(int e, float timeFraction); |
| 131 | void killParticle(int p); | 128 | void killParticle(int p); |
| 132 | void renderEmitter(int emitterIndex, float size); | 129 | void renderEmitter(int emitterIndex, float size); |
| 133 | void renderParticle(int p); | 130 | void renderParticle(int p); |