Exposed another glut method (the demos really require cleanup soon!)

First steps for a raycast-vehicle demo (far from finished)
This commit is contained in:
ejcoumans
2006-09-05 07:36:55 +00:00
parent e84716482d
commit fa96109cd9
22 changed files with 319 additions and 63 deletions

View File

@@ -192,21 +192,23 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
int upAxis = cylinder->GetUpAxis();
GLUquadricObj *quadObj = gluNewQuadric();
float radius = cylinder->GetRadius();
float halfHeight = cylinder->GetHalfExtents()[upAxis];
glPushMatrix();
switch (upAxis)
{
case 0:
glRotatef(-90.0, 0.0, 1.0, 0.0);
glTranslatef(0.0, 0.0, -1.0);
glTranslatef(0.0, 0.0, -halfHeight);
break;
case 1:
glRotatef(-90.0, 1.0, 0.0, 0.0);
glTranslatef(0.0, 0.0, -1.0);
glTranslatef(0.0, 0.0, -halfHeight);
break;
case 2:
glTranslatef(0.0, 0.0, -1.0);
glTranslatef(0.0, 0.0, -halfHeight);
break;
default:
{
@@ -221,9 +223,9 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
gluQuadricDrawStyle(quadObj, (GLenum)GLU_FILL);
gluQuadricNormals(quadObj, (GLenum)GLU_SMOOTH);
float radius = cylinder->GetHalfExtents().getX();
float height = 2.f*cylinder->GetHalfExtents().getY();
gluCylinder(quadObj, radius, radius, height, 15, 10);
gluCylinder(quadObj, radius, radius, 2.f*halfHeight, 15, 10);
glPopMatrix();
glEndList();

View File

@@ -136,6 +136,10 @@ void setCamera() {
eyePos[gForwardAxis] = -DISTANCE;
SimdVector3 forward(eyePos[0],eyePos[1],eyePos[2]);
if (forward.length2() < SIMD_EPSILON)
{
forward.setValue(1.f,0.f,0.f);
}
SimdVector3 right = gCameraUp.cross(forward);
SimdQuaternion roll(right,-rele);
@@ -289,7 +293,8 @@ void defaultKeyboard(unsigned char key, int x, int y)
}
void mySpecial(int key, int x, int y)
void defaultSpecialKeyboard(int key, int x, int y)
{
switch (key)
{
@@ -372,7 +377,7 @@ int glutmain(int argc, char **argv,int width,int height,const char* title) {
myinit();
glutKeyboardFunc(clientKeyboard);
glutSpecialFunc(mySpecial);
glutSpecialFunc(clientSpecialKeyboard);
glutReshapeFunc(myReshape);
//createMenu();
glutIdleFunc(clientMoveAndDisplay);

View File

@@ -30,6 +30,9 @@ void setDebugMode(int mode);
void defaultKeyboard(unsigned char key, int x, int y);
void clientKeyboard(unsigned char key, int x, int y);
void defaultSpecialKeyboard(int key, int x, int y);
void clientSpecialKeyboard(int key, int x, int y);
void clientMouseFunc(int button, int state, int x, int y);
void clientMotionFunc(int x,int y);
#endif //GLUT_STUFF_H