Showing the changes to interface/src/ParticleSystem.h (1 of 4 files). Show all
Unified · Split
| @@ -20,6 +20,7 @@ class ParticleSystem { · 19 unmodified lines | |||
| 20 | public: | 20 | public: |
| 21 | 21 | ||
| 22 | struct ParticleAttributes { | 22 | struct ParticleAttributes { |
| 23 | float radius; | ||
| 23 | float bounce; | 24 | float bounce; |
| 24 | float gravity; | 25 | float gravity; |
| 25 | float airFriction; | 26 | float airFriction; |
| @@ -39,6 +40,8 @@ public: · 13 unmodified lines | |||
| 39 | void emitParticlesNow(int emitterIndex, int numParticles, float radius, glm::vec4 color, glm::vec3 velocity, float lifespan); | 40 | void emitParticlesNow(int emitterIndex, int numParticles, float radius, glm::vec4 color, glm::vec3 velocity, float lifespan); |
| 40 | void simulate(float deltaTime); | 41 | void simulate(float deltaTime); |
| 41 | void render(); | 42 | void render(); |
| 43 | void setEmitterParticle(int emitterIndex, bool showing ); | ||
| 44 | void setEmitterParticle(int emitterIndex, bool showing, float radius, glm::vec4 color ); | ||
| 42 | 45 | ||
| 43 | void setOrangeBlueColorPalette(); // apply a nice preset color palette to the particles | 46 | void setOrangeBlueColorPalette(); // apply a nice preset color palette to the particles |
| 44 | void setUpDirection(glm::vec3 upDirection) {_upDirection = upDirection;} // tell particle system which direction is up | 47 | void setUpDirection(glm::vec3 upDirection) {_upDirection = upDirection;} // tell particle system which direction is up |
| @@ -51,16 +54,6 @@ public: · 6 unmodified lines | |||
| 51 | 54 | ||
| 52 | private: | 55 | private: |
| 53 | 56 | ||
| 54 | struct Emitter { | ||
| 55 | glm::vec3 position; | ||
| 56 | glm::quat rotation; | ||
| 57 | glm::vec3 right; // derived from rotation | ||
| 58 | glm::vec3 up; // derived from rotation | ||
| 59 | glm::vec3 front; // derived from rotation | ||
| 60 | bool visible; | ||
| 61 | ParticleAttributes particleAttributes[NUM_PARTICLE_LIFE_STAGES]; // the attributes of particles emitted from this emitter | ||
| 62 | }; | ||
| 63 | |||
| 64 | struct Particle { | 57 | struct Particle { |
| 65 | bool alive; // is the particle active? | 58 | bool alive; // is the particle active? |
| 66 | glm::vec3 position; // position | 59 | glm::vec3 position; // position |
| @@ -72,6 +65,17 @@ private: · 5 unmodified lines | |||
| 72 | int emitterIndex; // which emitter created this particle? | 65 | int emitterIndex; // which emitter created this particle? |
| 73 | }; | 66 | }; |
| 74 | 67 | ||
| 68 | struct Emitter { | ||
| 69 | glm::vec3 position; | ||
| 70 | glm::quat rotation; | ||
| 71 | glm::vec3 right; // derived from rotation | ||
| 72 | glm::vec3 up; // derived from rotation | ||
| 73 | glm::vec3 front; // derived from rotation | ||
| 74 | bool visible; | ||
| 75 | Particle baseParticle; // a non-physical particle at the emitter position | ||
| 76 | ParticleAttributes particleAttributes[NUM_PARTICLE_LIFE_STAGES]; // the attributes of particles emitted from this emitter | ||
| 77 | }; | ||
| 78 | |||
| 75 | glm::vec3 _upDirection; | 79 | glm::vec3 _upDirection; |
| 76 | Emitter _emitter[MAX_EMITTERS]; | 80 | Emitter _emitter[MAX_EMITTERS]; |
| 77 | Particle _particle[MAX_PARTICLES]; | 81 | Particle _particle[MAX_PARTICLES]; |