- Timestamp:
- May 29, 2005, 2:02:56 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/particles/particle_system.cc
r4377 r4378 56 56 this->setType(type, 1); 57 57 this->setColor(1.0,1.0,1.0,1.0, .5,.5,.5,.5, .0,.0,.0,.0); 58 this->setMass(1.0, 0.0); 58 59 ParticleEngine::getInstance()->addSystem(this); 59 60 } … … 182 183 183 184 /** 185 \brief sets the initial mass of any particle 186 */ 187 void ParticleSystem::setMass(float mass, float randomMass) 188 { 189 this->initialMass = mass; 190 this->randomInitialMass = randomMass; 191 } 192 193 /** 184 194 \brief sets the conserve Factor of newly created particles 185 195 */ … … 231 241 while (likely(tickPart != NULL)) 232 242 { 243 // applying force to the System. 244 tickPart->velocity += tickPart->extForce * tickPart->mass; 245 246 // rendering new position. 233 247 tickPart->position = tickPart->position + tickPart->velocity * dt; 234 248 tickPart->radius += tickPart->radiusIt * dt; 235 236 // applying force to the System. 237 tickPart->velocity += tickPart->extForce * tickPart->mass; 249 238 250 tickPart->extForce = Vector(0,0,0); 239 251 -
orxonox/trunk/src/lib/graphics/particles/particle_system.h
r4377 r4378 74 74 float randomStartRadius = 0.0, float randomEndRadius = 0.0); 75 75 void setConserve(float conserve); 76 void setMass(float mass, float randomMass );76 void setMass(float mass, float randomMass = 0.0); 77 77 78 78 void setColor(GLfloat br, GLfloat bg, GLfloat bb, GLfloat ba, … … 97 97 inline float getMass(void) const { return this->initialMass; }; 98 98 99 v oid applyField(Field* field, float dt);99 virtual void applyField(Field* field, float dt); 100 100 101 101 void tick(float dt); -
orxonox/trunk/src/lib/physics/physics_connection.cc
r4377 r4378 26 26 using namespace std; 27 27 28 29 30 28 PhysicsConnection::PhysicsConnection(PhysicsInterface* subject, Field* field) 31 29 { … … 53 51 void PhysicsConnection::apply(const float& dt) const 54 52 { 55 switch(this->type) 56 { 57 case PCON_PhysIField: 58 59 break; 60 61 case PCON_PhysIPhysI: 53 if (likely(this->type == PCON_PhysIField)) 62 54 this->subject->applyField(this->field, dt); 63 break; 64 } 55 else ; 65 56 } -
orxonox/trunk/src/lib/physics/physics_engine.cc
r4338 r4378 100 100 delete iterator; 101 101 } 102 103 104 105 /** 106 \brief print out interesting debug information of this class 107 */ 108 void PhysicsEngine::debug(void) const 109 { 110 PRINT(0)("====================================\n"); 111 PRINT(0)("= Physics-Engine debug information =\n"); 112 PRINT(0)("====================================\n"); 113 PRINT(0)(" reference: %p\n", this); 114 PRINT(0)(" numbers of Connections: %d\n", this->connections->getSize()); 115 116 PRINT(0)("==============================PHYS==\n"); 117 } -
orxonox/trunk/src/lib/physics/physics_engine.h
r4375 r4378 29 29 void tick(float dt); 30 30 31 void debug(void) const; 32 31 33 private: 32 34 PhysicsEngine(void); … … 34 36 35 37 tList<PhysicsConnection>* connections; 36 37 38 38 }; 39 39 -
orxonox/trunk/src/subprojects/particles/particle_fun.cc
r4370 r4378 20 20 #include "physics_engine.h" 21 21 #include "particle_engine.h" 22 #include "fields.h" 22 23 23 24 #define PINIT_EMISSION_RATE 50 … … 32 33 #define PINIT_PARTICLE_TYPE PARTICLE_SPRITE 33 34 #define PINIT_INHERIT_SPEED 0.0 34 35 #define PINIT_PARTICLE_MASS 1.0 35 36 36 37 void Framework::moduleInit(int argc, char** argv) 37 38 { 38 39 verbose = 5; 40 ParticleEngine::getInstance(); 41 PhysicsEngine::getInstance(); 42 39 43 40 44 // Creating a Test Particle System … … 53 57 // Add the Flow from the Emitter into the System 54 58 ParticleEngine::getInstance()->addConnection(emitter, system); 59 60 61 Field* twirl = new Twirl(); 62 twirl->setMagnitude(.1); 63 new PhysicsConnection(system, twirl); 55 64 } 56 65 … … 71 80 void Framework::moduleTick(float dt) 72 81 { 82 PhysicsEngine::getInstance()->tick(dt); 73 83 ParticleEngine::getInstance()->tick(dt); 74 84 } … … 85 95 PRINT(0)("i - Particle-state Information\n\n"); 86 96 PRINT(0)("\n"); 87 88 97 } 89 98
Note: See TracChangeset
for help on using the changeset viewer.