History

added sphere resolution to emitter attributes

Jeffrey Ventrella committed 13 years ago

Commit 13e6f2e1 parent ad0ca743 files · +59 −49Browse files

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

Unified · Split

interface/src/ParticleSystem.h+35−32
@@ -10,31 +10,32 @@ · 9 unmodified lines
1010
1111 #include <glm/gtc/quaternion.hpp>
1212
13−const int MAX_PARTICLES = 5000;
14−const int MAX_EMITTERS = 20;
13+const int MAX_PARTICLES = 5000;
14+const int MAX_EMITTERS = 20;
1515 const int NUM_PARTICLE_LIFE_STAGES = 4;
16−const bool USE_BILLBOARD_RENDERING = false;
17−const bool SHOW_VELOCITY_TAILS = false;
16+const bool USE_BILLBOARD_RENDERING = false;
17+const bool SHOW_VELOCITY_TAILS = false;
1818
1919 class ParticleSystem {
2020 public:
2121
2222 struct ParticleAttributes {
23− float radius;
24− glm::vec4 color;
25− float bounce;
26− float gravity;
27− float airFriction;
28− float jitter;
29− float emitterAttraction;
30− float tornadoForce;
31− float neighborAttraction;
32− float neighborRepulsion;
33− bool usingCollisionSphere;
34− glm::vec3 collisionSpherePosition;
35− float collisionSphereRadius;
23+ float radius; // radius of the particle
24+ glm::vec4 color; // color (rgba) of the particle
25+ float bounce; // how much reflection when the particle collides with floor/ground
26+ float gravity; // force opposite of up direction
27+ float airFriction; // continual dampening of velocity
28+ float jitter; // random forces on velocity
29+ float emitterAttraction; // an attraction to the emitter position
30+ float tornadoForce; // force perpendicular to direction axis
31+ float neighborAttraction; // causes particle to be pulled towards next particle in list
32+ float neighborRepulsion; // causes particle to be repelled by previous particle in list
33+ bool usingCollisionSphere; // set to true to allow collision with a sphere
34+ glm::vec3 collisionSpherePosition; // position of the collision sphere
35+ float collisionSphereRadius; // radius of the collision sphere
3636 };
3737
38+ // public methods...
3839 ParticleSystem();
3940
4041 int addEmitter(); // add (create new) emitter and get its unique id
@@ -47,14 +48,15 @@ public: · 6 unmodified lines
4748 void setShowingEmitterBaseParticle(int emitterIndex, bool showing );
4849 void setParticleAttributes (int emitterIndex, ParticleAttributes attributes); // set attributes for whole life of particles
4950 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; }
56− void setEmitterThrust (int emitterIndex, float thrust ) {_emitter[emitterIndex].thrust = thrust; }
57− void setEmitterRate (int emitterIndex, float rate ) {_emitter[emitterIndex].rate = rate; }
51+ void setEmitterBaseParticleColor (int emitterIndex, glm::vec4 color ) {_emitter[emitterIndex].baseParticle.color = color; }
52+ void setEmitterBaseParticleRadius (int emitterIndex, float radius ) {_emitter[emitterIndex].baseParticle.radius = radius; }
53+ void setEmitterPosition (int emitterIndex, glm::vec3 position ) {_emitter[emitterIndex].position = position; }
54+ void setEmitterParticleResolution (int emitterIndex, int resolution) {_emitter[emitterIndex].particleResolution = resolution; }
55+ void setEmitterDirection (int emitterIndex, glm::vec3 direction ) {_emitter[emitterIndex].direction = direction; }
56+ void setShowingEmitter (int emitterIndex, bool showing ) {_emitter[emitterIndex].visible = showing; }
57+ void setEmitterParticleLifespan (int emitterIndex, float lifespan ) {_emitter[emitterIndex].particleLifespan = lifespan; }
58+ void setEmitterThrust (int emitterIndex, float thrust ) {_emitter[emitterIndex].thrust = thrust; }
59+ void setEmitterRate (int emitterIndex, float rate ) {_emitter[emitterIndex].rate = rate; }
5860
5961 private:
6062
@@ -69,13 +71,14 @@ private: · 8 unmodified lines
6971 };
7072
7173 struct Emitter {
72− glm::vec3 position;
73− glm::vec3 direction;
74− bool visible;
75− float particleLifespan;
76− float thrust;
77− float rate;
78− Particle baseParticle; // a non-physical particle at the emitter position
74+ glm::vec3 position; // teh position of the emitter in world coordinates
75+ glm::vec3 direction; // a normalized vector used as an axis for particle emission and other effects
76+ bool visible; // whether or not a line is shown indicating the emitter (indicating its direction)
77+ float particleLifespan; // how long the particle shall live, in seconds
78+ int particleResolution; // for sphere-based particles
79+ float thrust; // the initial velocity upon emitting along the emitter direction
80+ float rate; // currently, how many particles emitted during a simulation time step
81+ Particle baseParticle; // a non-physical particle at the emitter position
7982 ParticleAttributes particleAttributes[NUM_PARTICLE_LIFE_STAGES]; // the attributes of particles emitted from this emitter
8083 };
8184

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t