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.cpp (1 of 3 files). Show all

Unified · Split

interface/src/ParticleSystem.cpp+8−6
@@ -11,10 +11,11 @@ · 10 unmodified lines
1111 #include "ParticleSystem.h"
1212 #include "Application.h"
1313
14−const float DEFAULT_PARTICLE_RADIUS = 0.01f;
15−const float DEFAULT_PARTICLE_BOUNCE = 1.0f;
16−const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;
17−const float DEFAULT_PARTICLE_LIFESPAN = 1.0f;
14+const float DEFAULT_PARTICLE_RADIUS = 0.01f;
15+const float DEFAULT_PARTICLE_BOUNCE = 1.0f;
16+const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;
17+const float DEFAULT_PARTICLE_LIFESPAN = 1.0f;
18+const int DEFAULT_PARTICLE_SPHERE_RESOLUTION = 6;
1819
1920 ParticleSystem::ParticleSystem() {
2021
@@ -27,6 +28,7 @@ ParticleSystem::ParticleSystem() { · 6 unmodified lines
2728 _emitter[emitterIndex].position = glm::vec3(0.0f, 0.0f, 0.0f);
2829 _emitter[emitterIndex].direction = glm::vec3(0.0f, 1.0f, 0.0f);
2930 _emitter[emitterIndex].visible = false;
31+ _emitter[emitterIndex].particleResolution = DEFAULT_PARTICLE_SPHERE_RESOLUTION;
3032 _emitter[emitterIndex].particleLifespan = DEFAULT_PARTICLE_LIFESPAN;
3133 _emitter[emitterIndex].baseParticle.alive = false;
3234 _emitter[emitterIndex].baseParticle.age = 0.0f;
@@ -279,7 +281,7 @@ void ParticleSystem::render() { · 246 unmodified lines
279281 glColor4f(_emitter[e].baseParticle.color.r, _emitter[e].baseParticle.color.g, _emitter[e].baseParticle.color.b, _emitter[e].baseParticle.color.a );
280282 glPushMatrix();
281283 glTranslatef(_emitter[e].position.x, _emitter[e].position.y, _emitter[e].position.z);
282− glutSolidSphere(_emitter[e].baseParticle.radius, 6, 6);
284+ glutSolidSphere(_emitter[e].baseParticle.radius, _emitter[e].particleResolution, _emitter[e].particleResolution);
283285 glPopMatrix();
284286 }
285287
@@ -330,7 +332,7 @@ void ParticleSystem::renderParticle(int p) { · 44 unmodified lines
330332 } else {
331333 glPushMatrix();
332334 glTranslatef(_particle[p].position.x, _particle[p].position.y, _particle[p].position.z);
333− glutSolidSphere(_particle[p].radius, 6, 6);
335+ glutSolidSphere(_particle[p].radius, _emitter[_particle[p].emitterIndex].particleResolution, _emitter[_particle[p].emitterIndex].particleResolution);
334336 glPopMatrix();
335337
336338 if (SHOW_VELOCITY_TAILS) {