Changeset 4190 in orxonox.OLD for orxonox/branches/physics/src
- Timestamp:
- May 15, 2005, 11:20:53 PM (20 years ago)
- Location:
- orxonox/branches/physics/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/lib/graphics/particles/particle_system.cc
r4186 r4190 24 24 25 25 #include "field.h" 26 27 // needed to find the Position of the Camera 28 #include "world.h" 29 #include "camera.h" 26 30 27 31 using namespace std; … … 273 277 { 274 278 case PARTICLE_SPRITE: 279 GLdouble projMat[16]; 280 GLfloat drawPartPos[4]; 281 glGetDoublev(GL_PROJECTION_MATRIX, projMat); 282 275 283 glMatrixMode(GL_MODELVIEW); 276 // glDisable(GL_LIGHTING);277 material->select();278 284 glDisable(GL_DEPTH_TEST); 285 glDisable(GL_LIGHTING); 286 material->select(); 287 288 279 289 while (likely(drawPart != NULL)) 280 290 { 281 glPushMatrix(); 282 glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z); 283 glScalef(drawPart->radius, drawPart->radius, drawPart->radius); 284 glCallList(*this->glID); 285 286 //glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 291 //! \todo implement a faster code for the look-at Camera algorithm. 292 293 Camera* camera = WorldInterface::getInstance()->getCurrentWorld()->getLocalCamera(); 294 Vector cameraPos = camera->getAbsCoor(); 295 Vector cameraTargetPos = camera->getTarget()->getAbsCoor(); 296 Vector view = cameraTargetPos - cameraPos; 297 Vector up = Vector(0, 1, 0); 298 up = camera->getAbsDir().apply(up); 299 Vector h = up.cross(view); 300 Vector v = h.cross(view); 301 h.normalize(); 302 v.normalize(); 303 v *= .5 * drawPart->radius; 304 h *= .5 * drawPart->radius; 305 306 glBegin(GL_TRIANGLE_STRIP); 307 glTexCoord2i(1, 1); 308 glVertex3f(drawPart->position.x - h.x - v.x, 309 drawPart->position.y - h.y - v.y, 310 drawPart->position.z - h.z - v.z); 311 glTexCoord2i(0, 1); 312 glVertex3f(drawPart->position.x - h.x + v.x, 313 drawPart->position.y - h.y + v.y, 314 drawPart->position.z - h.z + v.z); 315 glTexCoord2i(1, 0); 316 glVertex3f(drawPart->position.x + h.x - v.x, 317 drawPart->position.y + h.y - v.y, 318 drawPart->position.z + h.z - v.z); 319 glTexCoord2i(0, 0); 320 glVertex3f(drawPart->position.x + h.x + v.x, 321 drawPart->position.y + h.y + v.y, 322 drawPart->position.z + h.z + v.z); 323 324 glEnd(); 325 287 326 drawPart = drawPart->next; 288 glPopMatrix(); 289 } 290 // glEnd(); 291 292 // glEnable(GL_LIGHTING); 293 327 } 328 glEnable(GL_LIGHTING); 294 329 glEnable(GL_DEPTH_TEST); 330 331 295 332 break; 296 333 default: -
orxonox/branches/physics/src/story_entities/world.cc
r4186 r4190 492 492 493 493 494 ParticleSystem* system = new ParticleSystem(10000 , PARTICLE_SPARK);495 system->setLifeSpan( 5);494 ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE); 495 system->setLifeSpan(3); 496 496 system->setConserve(.9); 497 497 system->setRadius(2, 0, 2, 0); 498 498 499 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 1000, 0);499 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 400, .5); 500 500 emitter->setParent(this->localPlayer); 501 501 502 502 Field* twirl = new Twirl(); 503 twirl->setMagnitude( -.1);503 twirl->setMagnitude(.1); 504 504 Field* gravity = new PointGravity(); 505 gravity->setMagnitude( 0);506 new PhysicsConnection(system, twirl);507 //new PhysicsConnection(system, gravity);508 twirl->setParent(this->localCamera->getTarget());509 gravity->setParent(this->localCamera->getTarget());510 particleEngine->addConnection(emitter, system);505 gravity->setMagnitude(.5); 506 new PhysicsConnection(system, twirl); 507 // new PhysicsConnection(system, gravity); 508 twirl->setParent(this->localCamera->getTarget()); 509 gravity->setParent(this->localCamera->getTarget()); 510 particleEngine->addConnection(emitter, system); 511 511 } 512 512 -
orxonox/branches/physics/src/story_entities/world.h
r4178 r4190 36 36 static WorldInterface* getInstance(); 37 37 void init(World* world); 38 inline World* getCurrentWorld(void) {return this->worldReference;} 38 39 tList<WorldEntity>* getEntityList(); 39 40 … … 90 91 void setPath( const char* name); 91 92 93 inline Camera* getLocalCamera(void) {return this->localCamera;} 94 92 95 private: 93 96 void constuctorInit(char* name, int worldID);
Note: See TracChangeset
for help on using the changeset viewer.