|
|
|
|
@@ -118,12 +118,12 @@ void DemoApplication::overrideGLShapeDrawer (GL_ShapeDrawer* shapeDrawer)
|
|
|
|
|
void DemoApplication::myinit(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GLfloat light_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
|
|
|
|
|
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
|
|
|
|
|
GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
|
|
|
|
|
GLfloat light_ambient[] = { btScalar(0.2), btScalar(0.2), btScalar(0.2), btScalar(1.0) };
|
|
|
|
|
GLfloat light_diffuse[] = { btScalar(1.0), btScalar(1.0), btScalar(1.0), btScalar(1.0) };
|
|
|
|
|
GLfloat light_specular[] = { btScalar(1.0), btScalar(1.0), btScalar(1.0), btScalar(1.0 )};
|
|
|
|
|
/* light_position is NOT default value */
|
|
|
|
|
GLfloat light_position0[] = { 1.0, 10.0, 1.0, 0.0 };
|
|
|
|
|
GLfloat light_position1[] = { -1.0, -10.0, -1.0, 0.0 };
|
|
|
|
|
GLfloat light_position0[] = { btScalar(1.0), btScalar(10.0), btScalar(1.0), btScalar(0.0 )};
|
|
|
|
|
GLfloat light_position1[] = { btScalar(-1.0), btScalar(-10.0), btScalar(-1.0), btScalar(0.0) };
|
|
|
|
|
|
|
|
|
|
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
|
|
|
|
|
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
|
|
|
|
|
@@ -144,7 +144,7 @@ void DemoApplication::myinit(void)
|
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
glDepthFunc(GL_LESS);
|
|
|
|
|
|
|
|
|
|
glClearColor(0.7,0.7,0.7,0);
|
|
|
|
|
glClearColor(btScalar(0.7),btScalar(0.7),btScalar(0.7),btScalar(0));
|
|
|
|
|
|
|
|
|
|
// glEnable(GL_CULL_FACE);
|
|
|
|
|
// glCullFace(GL_BACK);
|
|
|
|
|
@@ -180,8 +180,8 @@ void DemoApplication::updateCamera() {
|
|
|
|
|
|
|
|
|
|
glMatrixMode(GL_PROJECTION);
|
|
|
|
|
glLoadIdentity();
|
|
|
|
|
float rele = m_ele * 0.01745329251994329547;// rads per deg
|
|
|
|
|
float razi = m_azi * 0.01745329251994329547;// rads per deg
|
|
|
|
|
btScalar rele = m_ele * btScalar(0.01745329251994329547);// rads per deg
|
|
|
|
|
btScalar razi = m_azi * btScalar(0.01745329251994329547);// rads per deg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btQuaternion rot(m_cameraUp,razi);
|
|
|
|
|
@@ -277,14 +277,14 @@ void DemoApplication::stepBack()
|
|
|
|
|
}
|
|
|
|
|
void DemoApplication::zoomIn()
|
|
|
|
|
{
|
|
|
|
|
m_cameraDistance -= 0.4; updateCamera();
|
|
|
|
|
if (m_cameraDistance < 0.1)
|
|
|
|
|
m_cameraDistance = 0.1;
|
|
|
|
|
m_cameraDistance -= btScalar(0.4); updateCamera();
|
|
|
|
|
if (m_cameraDistance < btScalar(0.1))
|
|
|
|
|
m_cameraDistance = btScalar(0.1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void DemoApplication::zoomOut()
|
|
|
|
|
{
|
|
|
|
|
m_cameraDistance += 0.4; updateCamera();
|
|
|
|
|
m_cameraDistance += btScalar(0.4); updateCamera();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -596,7 +596,7 @@ btVector3 DemoApplication::getRayTo(int x,int y)
|
|
|
|
|
float bottom = -1.f;
|
|
|
|
|
float nearPlane = 1.f;
|
|
|
|
|
float tanFov = (top-bottom)*0.5f / nearPlane;
|
|
|
|
|
float fov = 2.0 * atanf (tanFov);
|
|
|
|
|
float fov = btScalar(2.0) * btAtan(tanFov);
|
|
|
|
|
|
|
|
|
|
btVector3 rayFrom = getCameraPosition();
|
|
|
|
|
btVector3 rayForward = (getCameraTargetPosition()-getCameraPosition());
|
|
|
|
|
@@ -639,8 +639,8 @@ btVector3 DemoApplication::getRayTo(int x,int y)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btVector3 rayTo = rayToCenter - 0.5f * hor + 0.5f * vertical;
|
|
|
|
|
rayTo += x * dHor;
|
|
|
|
|
rayTo -= y * dVert;
|
|
|
|
|
rayTo += btScalar(x) * dHor;
|
|
|
|
|
rayTo -= btScalar(y) * dVert;
|
|
|
|
|
return rayTo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -847,8 +847,8 @@ void DemoApplication::mouseMotionFunc(int x,int y)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float dx, dy;
|
|
|
|
|
dx = x - m_mouseOldX;
|
|
|
|
|
dy = y - m_mouseOldY;
|
|
|
|
|
dx = btScalar(x) - m_mouseOldX;
|
|
|
|
|
dy = btScalar(y) - m_mouseOldY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///only if ALT key is pressed (Maya style)
|
|
|
|
|
@@ -858,8 +858,8 @@ void DemoApplication::mouseMotionFunc(int x,int y)
|
|
|
|
|
{
|
|
|
|
|
btVector3 hor = getRayTo(0,0)-getRayTo(1,0);
|
|
|
|
|
btVector3 vert = getRayTo(0,0)-getRayTo(0,1);
|
|
|
|
|
btScalar multiplierX = 0.01;
|
|
|
|
|
btScalar multiplierY = 0.01;
|
|
|
|
|
btScalar multiplierX = btScalar(0.01);
|
|
|
|
|
btScalar multiplierY = btScalar(0.01);
|
|
|
|
|
if (m_ortho)
|
|
|
|
|
{
|
|
|
|
|
multiplierX = 1;
|
|
|
|
|
@@ -876,16 +876,16 @@ void DemoApplication::mouseMotionFunc(int x,int y)
|
|
|
|
|
}
|
|
|
|
|
else if(m_mouseButtons & 1)
|
|
|
|
|
{
|
|
|
|
|
m_azi += dx * 0.2;
|
|
|
|
|
m_azi = fmodf(m_azi, 360.f);
|
|
|
|
|
m_ele += dy * 0.2;
|
|
|
|
|
m_ele = fmodf(m_ele, 180.f);
|
|
|
|
|
m_azi += dx * btScalar(0.2);
|
|
|
|
|
m_azi = fmodf(m_azi, btScalar(360.f));
|
|
|
|
|
m_ele += dy * btScalar(0.2);
|
|
|
|
|
m_ele = fmodf(m_ele, btScalar(180.f));
|
|
|
|
|
}
|
|
|
|
|
else if(m_mouseButtons & 4)
|
|
|
|
|
{
|
|
|
|
|
m_cameraDistance -= dy * 0.2f;
|
|
|
|
|
if (m_cameraDistance<0.1)
|
|
|
|
|
m_cameraDistance = 0.1;
|
|
|
|
|
m_cameraDistance -= dy * btScalar(0.2f);
|
|
|
|
|
if (m_cameraDistance<btScalar(0.1))
|
|
|
|
|
m_cameraDistance = btScalar(0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -953,7 +953,7 @@ void DemoApplication::setOrthographicProjection()
|
|
|
|
|
glScalef(1, -1, 1);
|
|
|
|
|
// mover the origin from the bottom left corner
|
|
|
|
|
// to the upper left corner
|
|
|
|
|
glTranslatef(0, -m_glutScreenHeight, 0);
|
|
|
|
|
glTranslatef(btScalar(0), btScalar(-m_glutScreenHeight), btScalar(0));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -973,7 +973,7 @@ extern CProfileIterator * m_profileIterator;
|
|
|
|
|
|
|
|
|
|
void DemoApplication::displayProfileString(int xOffset,int yStart,char* message)
|
|
|
|
|
{
|
|
|
|
|
glRasterPos3f(xOffset,yStart,0);
|
|
|
|
|
glRasterPos3f(btScalar(xOffset),btScalar(yStart),btScalar(0));
|
|
|
|
|
GLDebugDrawString(xOffset,yStart,message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1113,7 +1113,7 @@ void DemoApplication::renderscene(int pass)
|
|
|
|
|
{
|
|
|
|
|
case 0: m_shapeDrawer->drawOpenGL(m,colObj->getCollisionShape(),wireColor,getDebugMode(),aabbMin,aabbMax);break;
|
|
|
|
|
case 1: m_shapeDrawer->drawShadow(m,m_sundirection*rot,colObj->getCollisionShape(),aabbMin,aabbMax);break;
|
|
|
|
|
case 2: m_shapeDrawer->drawOpenGL(m,colObj->getCollisionShape(),wireColor*0.3,0,aabbMin,aabbMax);break;
|
|
|
|
|
case 2: m_shapeDrawer->drawOpenGL(m,colObj->getCollisionShape(),wireColor*btScalar(0.3),0,aabbMin,aabbMax);break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1178,7 +1178,7 @@ void DemoApplication::renderme()
|
|
|
|
|
int xOffset = 10;
|
|
|
|
|
int yStart = 20;
|
|
|
|
|
int yIncr = 20;
|
|
|
|
|
char buf[124];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
|
glColor3f(0, 0, 0);
|
|
|
|
|
|