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
11#include "ParticleSystem.h"11#include "ParticleSystem.h"
12#include "Application.h"12#include "Application.h"
13 13
14const float DEFAULT_PARTICLE_RADIUS = 0.01f;14const float DEFAULT_PARTICLE_RADIUS = 0.01f;
15const float DEFAULT_PARTICLE_BOUNCE = 1.0f;15const float DEFAULT_PARTICLE_BOUNCE = 1.0f;
16const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;16const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;
17const float DEFAULT_PARTICLE_LIFESPAN = 1.0f;17const float DEFAULT_PARTICLE_LIFESPAN = 1.0f;
18const int DEFAULT_PARTICLE_SPHERE_RESOLUTION = 6;
18 19
19ParticleSystem::ParticleSystem() {20ParticleSystem::ParticleSystem() {
20 21
@@ -27,6 +28,7 @@ ParticleSystem::ParticleSystem() { · 6 unmodified lines
27 _emitter[emitterIndex].position = glm::vec3(0.0f, 0.0f, 0.0f);28 _emitter[emitterIndex].position = glm::vec3(0.0f, 0.0f, 0.0f);
28 _emitter[emitterIndex].direction = glm::vec3(0.0f, 1.0f, 0.0f);29 _emitter[emitterIndex].direction = glm::vec3(0.0f, 1.0f, 0.0f);
29 _emitter[emitterIndex].visible = false;30 _emitter[emitterIndex].visible = false;
31 _emitter[emitterIndex].particleResolution = DEFAULT_PARTICLE_SPHERE_RESOLUTION;
30 _emitter[emitterIndex].particleLifespan = DEFAULT_PARTICLE_LIFESPAN;32 _emitter[emitterIndex].particleLifespan = DEFAULT_PARTICLE_LIFESPAN;
31 _emitter[emitterIndex].baseParticle.alive = false;33 _emitter[emitterIndex].baseParticle.alive = false;
32 _emitter[emitterIndex].baseParticle.age = 0.0f;34 _emitter[emitterIndex].baseParticle.age = 0.0f;
@@ -279,7 +281,7 @@ void ParticleSystem::render() { · 246 unmodified lines
279 glColor4f(_emitter[e].baseParticle.color.r, _emitter[e].baseParticle.color.g, _emitter[e].baseParticle.color.b, _emitter[e].baseParticle.color.a );281 glColor4f(_emitter[e].baseParticle.color.r, _emitter[e].baseParticle.color.g, _emitter[e].baseParticle.color.b, _emitter[e].baseParticle.color.a );
280 glPushMatrix();282 glPushMatrix();
281 glTranslatef(_emitter[e].position.x, _emitter[e].position.y, _emitter[e].position.z);283 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);
283 glPopMatrix();285 glPopMatrix();
284 }286 }
285 287
@@ -330,7 +332,7 @@ void ParticleSystem::renderParticle(int p) { · 44 unmodified lines
330 } else {332 } else {
331 glPushMatrix();333 glPushMatrix();
332 glTranslatef(_particle[p].position.x, _particle[p].position.y, _particle[p].position.z);334 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);
334 glPopMatrix();336 glPopMatrix();
335 337
336 if (SHOW_VELOCITY_TAILS) {338 if (SHOW_VELOCITY_TAILS) {