cmake+premake disable OpenGL 3 demos on Mac OSX versions below 10.9

See also http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=10073
Move ConstraintPhysicsSetup to Demos3/bullet3/ConstraintDemo
This commit is contained in:
Erwin Coumans
2014-08-22 14:41:21 -07:00
parent ade897c132
commit 954d488756
10 changed files with 59 additions and 109 deletions

View File

@@ -231,18 +231,30 @@ IF (APPLE)
ENDIF()
OPTION(BUILD_BULLET3 "Set when you want to build Bullet 3" ON)
IF(BUILD_BULLET3)
OPTION(BUILD_BULLET3_DEMOS "Set when you want to build the Bullet 3 demos" ON)
IF(APPLE)
MESSAGE("Mac OSX Version is ${_CURRENT_OSX_VERSION}")
IF(_CURRENT_OSX_VERSION VERSION_LESS 10.10)
MESSAGE("Mac OSX below 10.9 has no OpenGL 3 support so please disable the BUILD_OPENGL3_DEMOS option")
#unset(BUILD_OPENGL3_DEMOS CACHE)
OPTION(BUILD_OPENGL3_DEMOS "Set when you want to build the OpenGL3+ demos" OFF)
ELSE()
OPTION(BUILD_OPENGL3_DEMOS "Set when you want to build the OpenGL3+ demos" ON)
ENDIF()
ELSE()
OPTION(BUILD_OPENGL3_DEMOS "Set when you want to build Bullet 3 OpenGL3+ demos" ON)
ENDIF()
ELSE(BUILD_BULLET3)
unset(BUILD_BULLET3_DEMOS CACHE)
OPTION(BUILD_BULLET3_DEMOS "Set when you want to build the Bullet 3 demos" OFF)
unset(BUILD_OPENGL3_DEMOS CACHE)
OPTION(BUILD_OPENGL3_DEMOS "Set when you want to build Bullet 3 OpenGL3+ demos" OFF)
ENDIF(BUILD_BULLET3)
IF(BUILD_BULLET3_DEMOS)
IF(BUILD_OPENGL3_DEMOS)
IF(EXISTS ${BULLET_PHYSICS_SOURCE_DIR}/Demos3 AND IS_DIRECTORY ${BULLET_PHYSICS_SOURCE_DIR}/Demos3)
SUBDIRS(Demos3)
SUBDIRS(btgui)
ENDIF()
ENDIF(BUILD_BULLET3_DEMOS)
ENDIF(BUILD_OPENGL3_DEMOS)
OPTION(BUILD_EXTRAS "Set when you want to build the extras" ON)
IF(BUILD_EXTRAS)

View File

@@ -1,72 +0,0 @@
#include "ConstraintPhysicsSetup.h"
ConstraintPhysicsSetup::ConstraintPhysicsSetup()
{
}
ConstraintPhysicsSetup::~ConstraintPhysicsSetup()
{
}
btScalar val;
btHingeAccumulatedAngleConstraint* spDoorHinge=0;
void ConstraintPhysicsSetup::stepSimulation(float deltaTime)
{
val=spDoorHinge->getAccumulatedHingeAngle()*SIMD_DEGS_PER_RAD;// spDoorHinge->getHingeAngle()*SIMD_DEGS_PER_RAD;
if (m_dynamicsWorld)
{
m_dynamicsWorld->stepSimulation(deltaTime);
}
}
void ConstraintPhysicsSetup::initPhysics(GraphicsPhysicsBridge& gfxBridge)
{
gfxBridge.setUpAxis(1);
createEmptyDynamicsWorld();
gfxBridge.createPhysicsDebugDrawer(m_dynamicsWorld);
int mode = btIDebugDraw::DBG_DrawWireframe
+btIDebugDraw::DBG_DrawConstraints
+btIDebugDraw::DBG_DrawConstraintLimits;
m_dynamicsWorld->getDebugDrawer()->setDebugMode(mode);
val=1.f;
SliderParams slider("hinge angle",&val);
slider.m_minVal=-720;
slider.m_maxVal=720;
gfxBridge.getParameterInterface()->registerSliderFloatParameter(slider);
{ // create a door using hinge constraint attached to the world
btCollisionShape* pDoorShape = new btBoxShape(btVector3(2.0f, 5.0f, 0.2f));
m_collisionShapes.push_back(pDoorShape);
btTransform doorTrans;
doorTrans.setIdentity();
doorTrans.setOrigin(btVector3(-5.0f, -2.0f, 0.0f));
btRigidBody* pDoorBody = createRigidBody( 1.0, doorTrans, pDoorShape);
pDoorBody->setActivationState(DISABLE_DEACTIVATION);
const btVector3 btPivotA(10.f + 2.1f, -2.0f, 0.0f ); // right next to the door slightly outside
btVector3 btAxisA( 0.0f, 1.0f, 0.0f ); // pointing upwards, aka Y-axis
spDoorHinge = new btHingeAccumulatedAngleConstraint( *pDoorBody, btPivotA, btAxisA );
// spDoorHinge->setLimit( 0.0f, SIMD_PI_2 );
// test problem values
// spDoorHinge->setLimit( -SIMD_PI, SIMD_PI*0.8f);
// spDoorHinge->setLimit( 1.f, -1.f);
// spDoorHinge->setLimit( -SIMD_PI*0.8f, SIMD_PI);
// spDoorHinge->setLimit( -SIMD_PI*0.8f, SIMD_PI, 0.9f, 0.3f, 0.0f);
// spDoorHinge->setLimit( -SIMD_PI*0.8f, SIMD_PI, 0.9f, 0.01f, 0.0f); // "sticky limits"
// spDoorHinge->setLimit( -SIMD_PI * 0.25f, SIMD_PI * 0.25f );
// spDoorHinge->setLimit( 0.0f, 0.0f );
m_dynamicsWorld->addConstraint(spDoorHinge);
spDoorHinge->setDbgDrawSize(btScalar(5.f));
//doorTrans.setOrigin(btVector3(-5.0f, 2.0f, 0.0f));
//btRigidBody* pDropBody = localCreateRigidBody( 10.0, doorTrans, shape);
}
}

View File

@@ -1,16 +0,0 @@
#ifndef CONSTAINT_PHYSICS_SETUP_H
#define CONSTAINT_PHYSICS_SETUP_H
#include "../CommonRigidBodySetup.h"
struct ConstraintPhysicsSetup : public CommonRigidBodySetup
{
ConstraintPhysicsSetup();
virtual ~ConstraintPhysicsSetup();
virtual void initPhysics(GraphicsPhysicsBridge& gfxBridge);
virtual void stepSimulation(float deltaTime);
};
#endif //CONSTAINT_PHYSICS_SETUP_H

View File

@@ -14,7 +14,7 @@
#include "../bullet2/LuaDemo/LuaPhysicsSetup.h"
#include "../bullet2/ChainDemo/ChainDemo.h"
#include "../../Demos/CcdPhysicsDemo/CcdPhysicsSetup.h"
#include "../../Demos/ConstraintDemo/ConstraintPhysicsSetup.h"
#include "../bullet2/ConstraintDemo/ConstraintPhysicsSetup.h"
#include "../ImportURDFDemo/ImportURDFSetup.h"
#include "../ImportObjDemo/ImportObjSetup.h"
#include "../ImportSTLDemo/ImportSTLSetup.h"

View File

@@ -25,8 +25,8 @@ SET(App_AllBullet2Demos_SRCS
../../Demos/BasicDemo/BasicDemoPhysicsSetup.h
../../Demos/CcdPhysicsDemo/CcdPhysicsSetup.cpp
../../Demos/CcdPhysicsDemo/CcdPhysicsSetup.h
../../Demos/ConstraintDemo/ConstraintPhysicsSetup.cpp
../../Demos/ConstraintDemo/ConstraintPhysicsSetup.h
../bullet2/ConstraintDemo/ConstraintPhysicsSetup.cpp
../bullet2/ConstraintDemo/ConstraintPhysicsSetup.h
../bullet2/FeatherstoneMultiBodyDemo/BulletMultiBodyDemos.cpp
../bullet2/FeatherstoneMultiBodyDemo/BulletMultiBodyDemos.h
../bullet2/FeatherstoneMultiBodyDemo/MultiDofDemo.cpp

View File

@@ -50,8 +50,8 @@
"../../Demos/BasicDemo/BasicDemoPhysicsSetup.h",
"../../Demos/CcdPhysicsDemo/CcdPhysicsSetup.cpp",
"../../Demos/CcdPhysicsDemo/CcdPhysicsSetup.h",
"../../Demos/ConstraintDemo/ConstraintPhysicsSetup.cpp",
"../../Demos/ConstraintDemo/ConstraintPhysicsSetup.h",
"../bullet2/ConstraintDemo/ConstraintPhysicsSetup.cpp",
"../bullet2/ConstraintDemo/ConstraintPhysicsSetup.h",
"../ImportURDFDemo/ImportURDFSetup.cpp",
"../ImportObjDemo/ImportObjSetup.cpp",
"../ImportSTLDemo/ImportSTLSetup.cpp",

View File

@@ -1,5 +1,5 @@
if (OPENGL_FOUND)
if (BUILD_BULLET3_DEMOS)
if (BUILD_OPENGL3_DEMOS)
SUBDIRS( AllBullet2Demos GpuDemos SimpleOpenGL3 )
endif(BUILD_BULLET3_DEMOS)
endif(BUILD_OPENGL3_DEMOS)
endif(OPENGL_FOUND)

View File

@@ -1,3 +1,4 @@
function findOpenGL()
configuration{}
if os.is("Linux") then
@@ -7,6 +8,22 @@
return true
end
function findOpenGL3()
configuration{}
if os.is("MacOSX") then
local osversion = os.getversion()
--Mac OSX 10.9 and above supports OpenGL 3, below doesn't, so ...
if osversion.majorversion > 10 or (osversion.majorversion == 10 and osversion.minorversion >=9) then
return findOpenGL()
else
return false
end
else
return findOpenGL()
end
end
function initOpenGL()
configuration {}
configuration {"Windows"}

View File

@@ -1,6 +1,12 @@
solution "0_Bullet3Solution"
local osversion = os.getversion()
print(string.format(" %d.%d.%d (%s)",
osversion.majorversion, osversion.minorversion, osversion.revision,
osversion.description))
-- Multithreaded compiling
if _ACTION == "vs2010" or _ACTION=="vs2008" then
buildoptions { "/MP" }
@@ -35,8 +41,8 @@
newoption
{
trigger = "bullet2gpu",
description = "Enable Bullet 2.x GPU using b3GpuDynamicsWorld bridge to Bullet 3.x"
trigger = "bullet2demos",
description = "Compile the Bullet 2 demos (Demo/Extra folder)"
}
newoption
@@ -113,13 +119,12 @@
include "../test/TestBullet3OpenCL"
end
if findOpenGL() then
if findOpenGL3() then
include "../Demos3/AllBullet2Demos"
include "../Demos3/GpuDemos"
include"../Demos3/BasicDemoConsole"
include"../Demos3/BasicDemoCustomOpenGL2"
include "../btgui/OpenGLTrueTypeFont"
-- include "../Demos3/CpuDemos"
-- include "../Demos3/Wavefront"
@@ -137,6 +142,7 @@ if findOpenGL() then
include "../btgui/GwenOpenGLTest"
end
-- include "../demo/gpudemo"
if _OPTIONS["midi"] then
include "../btgui/MidiTest"
@@ -169,7 +175,7 @@ end
-- include "../demo/gpu_initialize"
-- include "../opencl/lds_bank_conflict"
-- include "../opencl/reduce"
include "../btgui/OpenGLTrueTypeFont"
-- include "../btgui/OpenGLTrueTypeFont"
-- include "../btgui/OpenGLWindow"
-- include "../demo/ObjLoader"
-- include "../test/b3DynamicBvhBroadphase"
@@ -180,7 +186,10 @@ end
include "../test/enet/client"
end
if _OPTIONS["bullet2gpu"] then
if _OPTIONS["bullet2demos"] then
include "../Extras"
if findOpenGL() then
include "../Demos"
end
end