Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10359 in orxonox.OLD for branches/ODE/src/world_entities/space_ships


Ignore:
Timestamp:
Jan 24, 2007, 9:01:50 PM (18 years ago)
Author:
bottac
Message:
 
File:
1 copied

Legend:

Unmodified
Added
Removed
  • branches/ODE/src/world_entities/space_ships/hover.cc

    r10353 r10359  
    402402  this->getModel(5)->draw();
    403403  glPopMatrix ();
     404  // ****************************************************************************************
     405  // SHADOW
     406  // ****************************************************************************************
     407       
     408glPushMatrix();
     409
     410        glTranslatef (this->getAbsCoor ().x,
     411                  this->getAbsCoor ().y-2.0,
     412                  this->getAbsCoor ().z);
     413        Vector a = Vector(0.0,0.0,-10.0);
     414
     415        //drawDebugCube( &a);
     416
     417        glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT );
     418        glDepthMask(GL_FALSE);
     419        glDepthFunc( GL_LEQUAL );
     420
     421        glEnable(GL_STENCIL_TEST);
     422        glDisable(GL_LIGHTING);
     423
     424//PART ONE
     425        glColorMask(0, 0, 0, 0);
     426        glStencilFunc(GL_ALWAYS, 1, 0xffffffff);
     427
     428        glEnable(GL_CULL_FACE);
     429        glFrontFace( GL_CCW );
     430        glStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
     431        drawDebugCube( &a);
     432
     433//PART TWO
     434
     435        glFrontFace( GL_CW );
     436        glStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
     437        drawDebugCube( &a);
     438
     439
     440glPopMatrix();
     441
     442// RENDER THE WHOLE STUFF
     443        glDisable(GL_TEXTURE_2D);
     444        glFrontFace( GL_CCW );
     445        glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
     446        glColor4f( 0.0f, 0.1f, 0.0f, 0.4f );
     447        glEnable( GL_BLEND );
     448        glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
     449        glStencilFunc( GL_NOTEQUAL, 0, 0xffffffff );
     450        glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
     451        glPushMatrix();
     452        glLoadIdentity();
     453        glBegin( GL_TRIANGLE_STRIP );
     454                glVertex3f( -1.1f,  1.1f, -.5f );
     455                glVertex3f( -1.1f, -1.1f, -.5f );
     456                glVertex3f(  1.1f,  1.1f, -.5f );
     457                glVertex3f(  1.1f, -1.1f, -.5f );
     458        glEnd();
     459        glPopMatrix();
     460
     461        glDisable(GL_BLEND);
     462        glEnable(GL_LIGHTING);
     463        glDisable(GL_STENCIL_TEST);
     464        glDisable(GL_CULL_FACE);
     465        glDepthMask(GL_TRUE);
     466
    404467}
    405468
     
    441504  }
    442505}
     506
     507 void drawDebugCube(const Vector* cam)
     508{
     509glBegin(GL_QUADS);
     510 // Front Face
     511                glNormal3f( 0.0f, 0.0f, 1.0f);                                  // Normal Pointing Towards Viewer
     512                glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -10.0f,  1.0f);     // Point 1 (Front)
     513                glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -10.0f,  1.0f);     // Point 2 (Front)
     514                glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  10.0f,  1.0f);     // Point 3 (Front)
     515                glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  10.0f,  1.0f);     // Point 4 (Front)
     516                // Back Face
     517                glNormal3f( 0.0f, 0.0f,-1.0f);                                  // Normal Pointing Away From Viewer
     518                glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f, -1.0f);     // Point 1 (Back)
     519                glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  10.0f, -1.0f);     // Point 2 (Back)
     520                glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  10.0f, -1.0f);     // Point 3 (Back)
     521                glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f, -1.0f);     // Point 4 (Back)
     522                // Top Face
     523                glNormal3f( 0.0f, 1.0f, 0.0f);                                  // Normal Pointing Up
     524                glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  10.0f, -1.0f);     // Point 1 (Top)
     525                glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  10.0f,  1.0f);     // Point 2 (Top)
     526                glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  10.0f,  1.0f);     // Point 3 (Top)
     527                glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  10.0f, -1.0f);     // Point 4 (Top)
     528                // Bottom Face
     529                glNormal3f( 0.0f,-1.0f, 0.0f);                                  // Normal Pointing Down
     530                glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -10.0f, -1.0f);     // Point 1 (Bottom)
     531                glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -10.0f, -1.0f);     // Point 2 (Bottom)
     532                glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f,  1.0f);     // Point 3 (Bottom)
     533                glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f,  1.0f);     // Point 4 (Bottom)
     534                // Right face
     535                glNormal3f( 1.0f, 0.0f, 0.0f);                                  // Normal Pointing Right
     536                glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -10.0f, -1.0f);     // Point 1 (Right)
     537                glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  10.0f, -1.0f);     // Point 2 (Right)
     538                glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  10.0f,  1.0f);     // Point 3 (Right)
     539                glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f,  1.0f);     // Point 4 (Right)
     540                // Left Face
     541                glNormal3f(-1.0f, 0.0f, 0.0f);                                  // Normal Pointing Left
     542                glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -10.0f, -1.0f);     // Point 1 (Left)
     543                glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f,  1.0f);     // Point 2 (Left)
     544                glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  10.0f,  1.0f);     // Point 3 (Left)
     545                glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  10.0f, -1.0f);     // Point 4 (Left)
     546        glEnd();                                                                // Done Drawing Quads
     547return;
     548
     549  glBegin(GL_QUADS);
     550
     551
     552  // Bottom Face.  Red, 75% opaque, magnified texture
     553
     554  //glNormal3f( 0.0f, -1.0f, 0.0f); // Needed for lighting
     555 // glColor4f(0.9,0.2,0.2,.75); // Basic polygon color
     556
     557  //glTexCoord2f(0.800f, 0.800f);
     558glVertex3f(cam->x-5.0f, cam->y-100.0f,cam->z -5.0f);
     559 // glTexCoord2f(0.200f, 0.800f);
     560glVertex3f(cam->x+5.0f, cam->y-100.0f,cam->z -5.0f);
     561  //glTexCoord2f(0.200f, 0.200f);
     562glVertex3f(cam->x+ 5.0f,cam->y -100.0f,cam->z +  5.0f);
     563  //glTexCoord2f(0.800f, 0.200f);
     564glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z + 5.0f); //OK
     565
     566
     567  // Top face; offset.  White, 50% opaque.
     568
     569 // glNormal3f( 0.0f, 5.0f, 0.0f);  glColor4f(0.5,0.5,0.5,.5);
     570
     571  //glTexCoord2f(0.005f, 5.995f);
     572glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f);
     573  //glTexCoord2f(0.005f, 0.005f);
     574glVertex3f(cam->x-5.0f, cam->y+ 100.0f,  cam->z +5.0f);
     575  //glTexCoord2f(5.995f, 0.005f);
     576glVertex3f(cam->x+ 5.0f,  cam->y+100.0f,  cam->z +5.0f);
     577  //glTexCoord2f(5.995f, 5.995f);
     578glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z -5.0f); //OKQUAD_STRI
     579
     580
     581  // Far face.  Green, 50% opaque, non-uniform texture cooridinates.
     582
     583  //glNormal3f( 0.0f, 0.0f,-5.0f);  glColor4f(0.2,0.9,0.2,.5);
     584
     585 // glTexCoord2f(0.995f, 0.005f);
     586glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z -5.0f);
     587 // glTexCoord2f(2.995f, 2.995f);
     588glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f);
     589 // glTexCoord2f(0.005f, 0.995f);
     590glVertex3f(cam->x+ 5.0f,cam->y+  100.0f, cam->z -5.0f);
     591  //glTexCoord2f(0.005f, 0.005f);
     592glVertex3f( cam->x+5.0f,cam->y -100.0f, cam->z -5.0f);
     593
     594
     595  // Right face.  Blue; 25% opaque
     596
     597 // glNormal3f( 5.0f, 0.0f, 0.0f);  glColor4f(0.2,0.2,0.9,.25);
     598
     599 // glTexCoord2f(0.995f, 0.005f);
     600glVertex3f(cam->x+ 5.0f, cam->y -100.0f, cam->z -5.0f);
     601 // glTexCoord2f(0.995f, 0.995f);
     602glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z -5.0f);
     603 // glTexCoord2f(0.005f, 0.995f);
     604glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z + 5.0f);
     605 // glTexCoord2f(0.005f, 0.005f);
     606glVertex3f(cam->x+ 5.0f, cam->y-100.0f,  cam->z +5.0f);
     607
     608
     609  // Front face; offset.  Multi-colored, 50% opaque.
     610
     611 // glNormal3f( 0.0f, 0.0f, 5.0f);
     612
     613//  glColor4f( 0.9f, 0.2f, 0.2f, 0.5f);
     614//  glTexCoord2f( 0.005f, 0.005f);
     615glVertex3f(cam->x-5.0f, cam->y-100.0f,  cam->z +5.0f);
     616//  glColor4f( 0.2f, 0.9f, 0.2f, 0.5f);
     617//  glTexCoord2f( 0.995f, 0.005f);
     618glVertex3f(cam->x+ 5.0f, cam->y-100.0f,  cam->z +5.0f);
     619 // glColor4f( 0.2f, 0.2f, 0.9f, 0.5f);
     620//  glTexCoord2f( 0.995f, 0.995f);
     621glVertex3f( cam->x+5.0f,  cam->y+100.0f,  cam->z +5.0f);
     622//  glColor4f( 0.5f, 0.5f, 0.5f, 0.5f);
     623//  glTexCoord2f( 0.005f, 0.995f); g
     624glVertex3f(cam->x-5.0f, cam->y+ 100.0f,  cam->z +5.0f);
     625
     626
     627  // Left Face; offset.  Yellow, varying levels of opaque.
     628
     629//  glNormal3f(-5.0f, 0.0f, 0.0f);
     630
     631//  glColor4f(0.9,0.9,0.2,0.0);
     632 // glTexCoord2f(0.005f, 0.005f);
     633glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z -5.0f);
     634  //glColor4f(0.9,0.9,0.2,0.66);
     635// glTexCoord2f(0.995f, 0.005f);
     636glVertex3f(cam->x-5.0f,cam->y -100.0f,  cam->z +5.0f);
     637//  glColor4f(0.9,0.9,0.2,5.0);
     638//  glTexCoord2f(0.995f, 0.995f);
     639glVertex3f(cam->x-5.0f, cam->y+ 100.0f,  cam->z +5.0f);
     640//  glColor4f(0.9,0.9,0.2,0.33);
     641//  glTexCoord2f(0.005f, 0.995f);
     642glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f);
     643
     644  glEnd();
     645}
     646
Note: See TracChangeset for help on using the changeset viewer.