diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bfc5aac8..d5cca857a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,10 @@ ENDIF (NOT CMAKE_BUILD_TYPE) IF (WIN32) OPTION(USE_GLUT "Use Glut" OFF) +ADD_DEFINITIONS( -D_IRR_STATIC_LIB_ ) +ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) +ADD_DEFINITIONS( -D_CRT_SECURE_NO_DEPRECATE ) + ELSE(WIN32) OPTION(USE_GLUT "Use Glut" ON) ENDIF(WIN32) diff --git a/Demos/CMakeLists.txt b/Demos/CMakeLists.txt index ba0588b79..7cd472fd3 100644 --- a/Demos/CMakeLists.txt +++ b/Demos/CMakeLists.txt @@ -1,4 +1,4 @@ -SUBDIRS( OpenGL BasicDemo ) +SUBDIRS( OpenGL BasicDemo Benchmarks) #todo: re-enable the rest of the demos again diff --git a/Demos/OpenGL/DemoApplication.cpp b/Demos/OpenGL/DemoApplication.cpp index bf15d6183..6008e313d 100644 --- a/Demos/OpenGL/DemoApplication.cpp +++ b/Demos/OpenGL/DemoApplication.cpp @@ -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_cameraDistancedrawOpenGL(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); @@ -1191,7 +1191,7 @@ void DemoApplication::renderme() #ifdef USE_QUICKPROF - + if ( getDebugMode() & btIDebugDraw::DBG_ProfileTimings) { static int counter = 0; diff --git a/Demos/OpenGL/DemoApplication.h b/Demos/OpenGL/DemoApplication.h index 7300e5256..3115de88a 100644 --- a/Demos/OpenGL/DemoApplication.h +++ b/Demos/OpenGL/DemoApplication.h @@ -169,7 +169,7 @@ public: btScalar getDeltaTimeMicroseconds() { #ifdef USE_BT_CLOCK - btScalar dt = m_clock.getTimeMicroseconds(); + btScalar dt = (btScalar)m_clock.getTimeMicroseconds(); m_clock.reset(); return dt; #else diff --git a/Demos/OpenGL/GLDebugFont.cpp b/Demos/OpenGL/GLDebugFont.cpp index e6a7ab4ce..e54e3346b 100644 --- a/Demos/OpenGL/GLDebugFont.cpp +++ b/Demos/OpenGL/GLDebugFont.cpp @@ -118,7 +118,7 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - glTranslatef(x,sScreenHeight - y,0); + glTranslatef(btScalar(x),btScalar(sScreenHeight - y),btScalar(0)); #if USE_ARRAYS @@ -151,13 +151,13 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& char ch = string[i]-32; if (ch>=0) { - cx=float(ch%16) * 1./16.f; - cy=float(ch/16) * 1./16.f; + cx=float(ch%16) * btScalar(1./16.f); + cy=float(ch/16) * btScalar(1./16.f); - uv_texcoords[0] = cx; uv_texcoords[1] = 1-cy-1./16.f; - uv_texcoords[2] = cx+1./16.f; uv_texcoords[3] = 1-cy-1./16.f; - uv_texcoords[4] = cx+1./16.f; uv_texcoords[5] = 1-cy; - uv_texcoords[6] = cx; uv_texcoords[7] = 1-cy; + uv_texcoords[0] = cx; uv_texcoords[1] = btScalar(1-cy-1./16.f); + uv_texcoords[2] = btScalar(cx+1./16.f); uv_texcoords[3] = btScalar(1-cy-1./16.f); + uv_texcoords[4] = btScalar(cx+1./16.f); uv_texcoords[5] = btScalar(1-cy); + uv_texcoords[6] = cx; uv_texcoords[7] = btScalar(1-cy); #if USE_ARRAYS glTexCoordPointer(2,GL_FLOAT,0,uv_texcoords); glVertexPointer(3, GL_FLOAT, 0, verts); @@ -196,7 +196,7 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& glMatrixMode(GL_TEXTURE); glLoadIdentity(); - glScalef(0.025,0.025,0.025); + glScalef(btScalar(0.025),btScalar(0.025),btScalar(0.025)); #endif glMatrixMode(GL_MODELVIEW); #if USE_ARRAYS