Changeset 3942 in orxonox.OLD for orxonox/branches
- Timestamp:
- Apr 23, 2005, 1:28:24 PM (20 years ago)
- Location:
- orxonox/branches/particleEngine/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/defs/debug.h
r3934 r3942 63 63 #define DEBUG_MODULE_LOAD 0 64 64 65 #define DEBUG_MODULE_IMPORTER 165 #define DEBUG_MODULE_IMPORTER 3 66 66 #define DEBUG_MODULE_TRACK_MANAGER 0 67 67 #define DEBUG_MODULE_GARBAGE_COLLECTOR 0 -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc
r3938 r3942 21 21 #include "particle_engine.h" 22 22 #include "compiler.h" 23 #include "material.h" 23 24 24 25 using namespace std; 25 26 26 27 27 /** … … 43 43 this->setLifeSpan(.1); 44 44 this->setInheritSpeed(0); 45 45 this->glID = NULL; 46 this->setRadius(1.0, 1.0, 0.0); 47 this->setType(PARTICLE_SPRITE, 1); 46 48 ParticleEngine::getInstance()->addSystem(this); 47 49 } … … 58 60 } 59 61 62 63 void ParticleSystem::setType(PARTICLE_TYPE particleType, int count) 64 { 65 this->particleType = particleType; 66 this->dialectCount = count; 67 if (glID != NULL) 68 delete glID; 69 70 glID = new GLuint[count]; 71 for (int i = 0; i< count; i++) 72 glID[i] = 0; 73 74 glID[0] = glGenLists(count); 75 76 material = new Material("transperencyMap"); 77 material->setDiffuseMap("pictures/radialTransparency.jpg"); 78 79 glNewList(glID[0], GL_COMPILE); 80 glBegin(GL_TRIANGLE_STRIP); 81 glTexCoord2f(1, 1); 82 glVertex3f(0.0, 1.0, 1.0); 83 glTexCoord2f(1, 0); 84 glVertex3f(0.0, 1.0, 0.0); 85 glTexCoord2f(0, 1); 86 glVertex3f(0.0, 0.0, 1.0); 87 glTexCoord2f(0, 0); 88 glVertex3f(0.0, 0.0, 0.0); 89 glEnd(); 90 glEndList(); 91 92 93 94 } 95 60 96 // setting properties 61 97 void ParticleSystem::setMaterial(Material* material) … … 63 99 this->material = material; 64 100 } 101 65 102 66 103 … … 90 127 } 91 128 92 void ParticleSystem::setRadius(float startRadius, float endRadius, float random Radius)129 void ParticleSystem::setRadius(float startRadius, float endRadius, float randomStartRadius, float randomEndRadius) 93 130 { 94 131 this->startRadius = startRadius; 95 132 this->endRadius = endRadius; 96 this->randomRadius = randomRadius; 133 this->randomStartRadius = randomStartRadius; 134 this->randomEndRadius = randomEndRadius; 97 135 } 98 136 … … 117 155 118 156 tickPart->position = tickPart->position + tickPart->velocity; 119 tickPart->radius + tickPart->radiusIt * dt; 157 tickPart->radius += tickPart->radiusIt * dt; 158 120 159 // many more to come 121 160 … … 153 192 void ParticleSystem::draw(void) 154 193 { 194 // material->select(); 195 196 197 glMatrixMode(GL_MODELVIEW); 198 155 199 Particle* drawPart = particles; 156 200 if (likely(drawPart != NULL)) … … 160 204 { 161 205 // draw in DOT mode 162 glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 206 glPushMatrix(); 207 glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z); 208 glScalef(drawPart->radius, drawPart->radius, drawPart->radius); 209 glCallList(*this->glID); 163 210 164 211 // glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 165 212 drawPart = drawPart->next; 213 glPopMatrix(); 166 214 } 167 215 glEnd(); … … 193 241 // particle->rotation = ; //! \todo rotation is once again something to be done. 194 242 particles->mass = this->initialMass + (random()/RAND_MAX -.5)* this->randomInitialMass; 195 particles->radius = this->startRadius + (random()/RAND_MAX-.5)*this->random Radius;243 particles->radius = this->startRadius + (random()/RAND_MAX-.5)*this->randomStartRadius; 196 244 197 particles->radiusIt = (this->endRadius + (random()/RAND_MAX-.5)*this->random Radius - particles->radius) / particles->timeToLive;245 particles->radiusIt = (this->endRadius + (random()/RAND_MAX-.5)*this->randomEndRadius - particles->radius) / particles->timeToLive; 198 246 199 247 ++this->count; -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h
r3938 r3942 18 18 PARTICLE_PRIMITIVE}; 19 19 20 #define PARTICLE_DEFAULT_MAX_COUNT 200//!< a default count of particles in the system.21 #define PARTICLE_DEFAULT_TYPE PARTICLE_SPRITE//!< A default type of the system.20 #define PARTICLE_DEFAULT_MAX_COUNT 200 //!< a default count of particles in the system. 21 #define PARTICLE_DEFAULT_TYPE PARTICLE_SPRITE //!< A default type of the system. 22 22 23 23 // FORWARD DEFINITION … … 48 48 virtual ~ParticleSystem(); 49 49 50 void setType(PARTICLE_TYPE particleType, int count = 0); 50 51 void setMaterial(Material* material); 51 52 void setInheritSpeed(float value); 52 53 void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0); 53 void setRadius(float startRadius, float endRadius, float random Radius = 0.0);54 void setRadius(float startRadius, float endRadius, float randomStartRadius = 0.0, float randomEndRadius = 0.0); 54 55 void setConserve(float conserve); 55 56 void setMass(float mass, float randomMass); … … 64 65 float startRadius; 65 66 float endRadius; 66 float randomRadius; 67 float randomStartRadius; 68 float randomEndRadius; 67 69 float initialMass; 68 70 float randomInitialMass; … … 76 78 Particle* particles; //!< A list of particles of this System. 77 79 80 GLuint* glID; //!< A List of different gl-List-ID's 81 GLuint dialectCount; //!< How many different types of particles are there in the Particle System 78 82 79 83 void addParticle(Vector position, Vector velocity, unsigned int data = 0); -
orxonox/branches/particleEngine/src/story_entities/world.cc
r3938 r3942 379 379 ParticleEmitter* testEmitter,* testEmitter2; 380 380 ParticleSystem* testSystem; 381 testEmitter = new ParticleEmitter(Vector(-1,0,0), M_PI_2, 1200.0, 1);381 testEmitter = new ParticleEmitter(Vector(-1,0,0), M_PI_2, 1200.0, .5); 382 382 testEmitter->setParent(localPlayer); 383 testEmitter2 = new ParticleEmitter(Vector(-1,0,0), .1, 1200, 1); 384 testEmitter2->setParent(tn); 383 testEmitter->setRelCoor(Vector(-3, 0, 0)); 385 384 386 385 testSystem = new ParticleSystem(100000); 387 testSystem->setLifeSpan(3); 386 testSystem->setLifeSpan(1, .8); 387 testSystem->setRadius(1.0, 0.0, .5); 388 388 testSystem->setConserve(.8); 389 389 testSystem->setInheritSpeed(1); 390 390 391 391 ParticleEngine::getInstance()->addConnection(testEmitter, testSystem); 392 ParticleEngine::getInstance()->addConnection(testEmitter2, testSystem);393 392 394 393 break;
Note: See TracChangeset
for help on using the changeset viewer.