Did a bit more Collada physics importing work.

Also did a quick workaround to allow different camera UP. This demo stuff really needs to be cleaned up now!
This commit is contained in:
ejcoumans
2006-06-03 02:13:59 +00:00
parent 9414d46266
commit ac11a0c06b
11 changed files with 1608 additions and 990 deletions

View File

@@ -170,6 +170,8 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
}
if (useWireframeFallback)
{
/// for polyhedral shapes
@@ -195,16 +197,10 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
glEnd();
if (debugMode==IDebugDraw::DBG_DrawText)
{
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),polyshape->GetName());
}
if (debugMode==IDebugDraw::DBG_DrawFeaturesText)
{
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),polyshape->GetExtraDebugInfo());
glColor3f(1.f, 1.f, 1.f);
for (i=0;i<polyshape->GetNumVertices();i++)
{
@@ -230,6 +226,8 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
}
}
}
}
@@ -262,6 +260,17 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
}
glDisable(GL_DEPTH_BUFFER_BIT);
if (debugMode==IDebugDraw::DBG_DrawText)
{
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetName());
}
if (debugMode==IDebugDraw::DBG_DrawFeaturesText)
{
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetExtraDebugInfo());
}
glEnable(GL_DEPTH_BUFFER_BIT);
glPopMatrix();
glPopMatrix();

View File

@@ -105,22 +105,40 @@ void toggleIdle() {
}
}
#include "SimdMatrix3x3.h"
SimdVector3 gCameraUp(0,1,0);
int gForwardAxis = 2;
void setCamera() {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float rele = ele * 0.01745329251994329547;// rads per deg
float razi = azi * 0.01745329251994329547;// rads per deg
eye[0] = DISTANCE * sin(razi) * cos(rele);
eye[1] = DISTANCE * sin(rele);
eye[2] = DISTANCE * cos(razi) * cos(rele);
SimdQuaternion rot(gCameraUp,razi);
SimdVector3 eyePos(0,0,0);
eyePos[gForwardAxis] = -DISTANCE;
SimdVector3 forward(eyePos[0],eyePos[1],eyePos[2]);
SimdVector3 right = gCameraUp.cross(forward);
SimdQuaternion roll(right,-rele);
eyePos = SimdMatrix3x3(rot) * SimdMatrix3x3(roll) * eyePos;
eye[0] = eyePos.getX();
eye[1] = eyePos.getY();
eye[2] = eyePos.getZ();
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0);
gluLookAt(eye[0], eye[1], eye[2],
center[0], center[1], center[2],
0, 1, 0);
gCameraUp.getX(),gCameraUp.getY(),gCameraUp.getZ());
glMatrixMode(GL_MODELVIEW);
}