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 | 21 | NUM_PARTICLE_RENDER_STYLES |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | − | |
| 25 | 24 | enum ColorModulationStyle |
| 26 | 25 | { |
| 27 | 26 | COLOR_MODULATION_STYLE_NULL = -1, |
| @@ -30,7 +29,6 @@ enum ColorModulationStyle · 2 unmodified lines | ||
| 30 | 29 | NUM_COLOR_MODULATION_STYLES |
| 31 | 30 | }; |
| 32 | 31 | |
| 33 | − | |
| 34 | 32 | enum ParticleLifeStage |
| 35 | 33 | { |
| 36 | 34 | PARTICLE_LIFESTAGE_0 = 0, |
| @@ -40,9 +38,6 @@ enum ParticleLifeStage · 3 unmodified lines | ||
| 40 | 38 | NUM_PARTICLE_LIFE_STAGES |
| 41 | 39 | }; |
| 42 | 40 | |
| 43 | − | |
| 44 | − | |
| 45 | − | |
| 46 | 41 | class ParticleSystem { |
| 47 | 42 | public: |
| 48 | 43 | |
| @@ -80,7 +75,7 @@ public: · 31 unmodified lines | ||
| 80 | 75 | void setParticleAttributesToDefault(ParticleAttributes * attributes); // set these attributes to their default values |
| 81 | 76 | void setParticleAttributes (int emitterIndex, ParticleAttributes attributes); // set attributes for whole life of particles |
| 82 | 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 | 79 | void setEmitterParticleResolution (int emitterIndex, int resolution ) {_emitter[emitterIndex].particleResolution = resolution; } |
| 85 | 80 | void setEmitterDirection (int emitterIndex, glm::vec3 direction ) {_emitter[emitterIndex].direction = direction; } |
| 86 | 81 | void setShowingEmitter (int emitterIndex, bool showing ) {_emitter[emitterIndex].visible = showing; } |
| @@ -105,11 +100,13 @@ private: · 18 unmodified lines | ||
| 105 | 100 | |
| 106 | 101 | struct Emitter { |
| 107 | 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 | 104 | glm::vec3 direction; // a normalized vector used as an axis for particle emission and other effects |
| 109 | 105 | bool visible; // whether or not a line is shown indicating the emitter (indicating its direction) |
| 110 | 106 | float particleLifespan; // how long the particle shall live, in seconds |
| 111 | 107 | int particleResolution; // for sphere-based particles |
| 112 | 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 | 110 | float thrust; // the initial velocity upon emitting along the emitter direction |
| 114 | 111 | float rate; // currently, how many particles emitted during a simulation time step |
| 115 | 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 | 125 | // private methods |
| 129 | 126 | void updateParticle(int index, float deltaTime); |
| 130 | − void createParticle(int e); | |
| 127 | + void createParticle(int e, float timeFraction); | |
| 131 | 128 | void killParticle(int p); |
| 132 | 129 | void renderEmitter(int emitterIndex, float size); |
| 133 | 130 | void renderParticle(int p); |