From de9bd65c19d678707bcc1cd62c3ff00fe5c28d5e Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 26 May 2016 19:22:26 -0700 Subject: [PATCH] fix compile issues --- build3/premake4.lua | 11 +++++++++++ .../ExtendedTutorials/RigidBodyFromObj.cpp | 19 ++++++++++++------- examples/ExtendedTutorials/premake4.lua | 2 +- .../main_sw_tinyrenderer_single_example.cpp | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/build3/premake4.lua b/build3/premake4.lua index 45e3241bc..ae83944d4 100644 --- a/build3/premake4.lua +++ b/build3/premake4.lua @@ -105,6 +105,17 @@ description = "Do not build bullet3 libs" } + newoption + { + trigger = "double", + description = "Double precision version of Bullet" + } + + if _OPTIONS["double"] then + defines {"BT_USE_DOUBLE_PRECISION"} + end + + configurations {"Release", "Debug"} configuration "Release" flags { "Optimize", "EnableSSE2","StaticRuntime", "NoMinimalRebuild", "FloatFast"} diff --git a/examples/ExtendedTutorials/RigidBodyFromObj.cpp b/examples/ExtendedTutorials/RigidBodyFromObj.cpp index 8b86a0759..64d52793d 100644 --- a/examples/ExtendedTutorials/RigidBodyFromObj.cpp +++ b/examples/ExtendedTutorials/RigidBodyFromObj.cpp @@ -74,7 +74,7 @@ void RigidBodyFromObjExample::initPhysics() } //load our obj mesh - const char* fileName = "textured_sphere_smooth.obj";//teddy.obj";//sphere8.obj";//sponza_closed.obj";//sphere8.obj"; + const char* fileName = "teddy.obj";//sphere8.obj";//sponza_closed.obj";//sphere8.obj"; char relativeFileName[1024]; if (b3ResourcePath::findResourcePath(fileName, relativeFileName, 1024)) { @@ -87,8 +87,10 @@ void RigidBodyFromObjExample::initPhysics() const GLInstanceVertex& v = glmesh->m_vertices->at(0); btConvexHullShape* shape = new btConvexHullShape((const btScalar*)(&(v.xyzw[0])), glmesh->m_numvertices, sizeof(GLInstanceVertex)); + + float scaling[4] = {0.1,0.1,0.1,1}; - btVector3 localScaling(2,2,2);//0.1,0.1,0.1); + btVector3 localScaling(scaling[0],scaling[1],scaling[2]); shape->setLocalScaling(localScaling); if (m_options & OptimizeConvexObj) @@ -115,11 +117,14 @@ void RigidBodyFromObjExample::initPhysics() if (isDynamic) shape->calculateLocalInertia(mass,localInertia); - btVector3 position(0,3,0); + float color[4] = {1,1,1,1}; + float orn[4] = {0,0,0,1}; + float pos[4] = {0,3,0,0}; + btVector3 position(pos[0],pos[1],pos[2]); startTransform.setOrigin(position); - btRigidBody* body = createRigidBody(mass,startTransform,shape); - - btVector3 color(1,1,1); + btRigidBody* body = createRigidBody(mass,startTransform,shape); + + bool useConvexHullForRendering = ((m_options & ObjUseConvexHullForRendering)!=0); @@ -131,7 +136,7 @@ void RigidBodyFromObjExample::initPhysics() &glmesh->m_indices->at(0), glmesh->m_numIndices); shape->setUserIndex(shapeId); - int renderInstance = m_guiHelper->registerGraphicsInstance(shapeId,position,startTransform.getRotation(),color,localScaling); + int renderInstance = m_guiHelper->registerGraphicsInstance(shapeId,pos,orn,color,scaling); body->setUserIndex(renderInstance); } diff --git a/examples/ExtendedTutorials/premake4.lua b/examples/ExtendedTutorials/premake4.lua index 204f2a291..160affa9d 100644 --- a/examples/ExtendedTutorials/premake4.lua +++ b/examples/ExtendedTutorials/premake4.lua @@ -176,7 +176,7 @@ else end defines {"B3_USE_STANDALONE_EXAMPLE"} -includedirs {"../../bsrc"} +includedirs {"../../src"} links { "BulletInverseDynamicsUtils", "BulletInverseDynamics","BulletDynamics","BulletCollision", "LinearMath", "Bullet3Common" diff --git a/examples/StandaloneMain/main_sw_tinyrenderer_single_example.cpp b/examples/StandaloneMain/main_sw_tinyrenderer_single_example.cpp index ce8bd0a2c..69c3b7db5 100644 --- a/examples/StandaloneMain/main_sw_tinyrenderer_single_example.cpp +++ b/examples/StandaloneMain/main_sw_tinyrenderer_single_example.cpp @@ -148,7 +148,7 @@ public: clearBuffers(clearColor); - ATTRIBUTE_ALIGNED16(float modelMat[16]); + ATTRIBUTE_ALIGNED16(btScalar modelMat[16]); ATTRIBUTE_ALIGNED16(float viewMat[16]); ATTRIBUTE_ALIGNED16(float projMat[16]);