History

added emitter particle

Jeffrey Ventrella committed 13 years ago

Commit d0dffb41 parent 202fb954 files · +93 −14Browse files

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

Unified · Split

interface/src/ParticleSystem.h+14−10
@@ -20,6 +20,7 @@ class ParticleSystem { · 19 unmodified lines
2020 public:
2121
2222 struct ParticleAttributes {
23+ float radius;
2324 float bounce;
2425 float gravity;
2526 float airFriction;
@@ -39,6 +40,8 @@ public: · 13 unmodified lines
3940 void emitParticlesNow(int emitterIndex, int numParticles, float radius, glm::vec4 color, glm::vec3 velocity, float lifespan);
4041 void simulate(float deltaTime);
4142 void render();
43+ void setEmitterParticle(int emitterIndex, bool showing );
44+ void setEmitterParticle(int emitterIndex, bool showing, float radius, glm::vec4 color );
4245
4346 void setOrangeBlueColorPalette(); // apply a nice preset color palette to the particles
4447 void setUpDirection(glm::vec3 upDirection) {_upDirection = upDirection;} // tell particle system which direction is up
@@ -51,16 +54,6 @@ public: · 6 unmodified lines
5154
5255 private:
5356
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−
6457 struct Particle {
6558 bool alive; // is the particle active?
6659 glm::vec3 position; // position
@@ -72,6 +65,17 @@ private: · 5 unmodified lines
7265 int emitterIndex; // which emitter created this particle?
7366 };
7467
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+
7579 glm::vec3 _upDirection;
7680 Emitter _emitter[MAX_EMITTERS];
7781 Particle _particle[MAX_PARTICLES];