Changeset 4190 in orxonox.OLD for orxonox/branches/physics/src/lib/graphics
- Timestamp:
- May 15, 2005, 11:20:53 PM (20 years ago)
- File:
-
- 1 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:
Note: See TracChangeset
for help on using the changeset viewer.