diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-10 11:01:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-10 11:01:56 +0400 |
commit | f49fc58df63d42ab451380ea92e55b1265d14e4e (patch) | |
tree | 026f338d863a838844ba443f39056c01aa3be004 /source/gameengine/Ketsji | |
parent | d420d09da982e1a874ffe2b0612b8fdd0afc980e (diff) |
enable building the game engine without bullet for scons & cmake
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/CMakeLists.txt | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BulletPhysicsController.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BulletPhysicsController.h | 5 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ConvertPhysicsObject.h | 13 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Light.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 25 | ||||
-rw-r--r-- | source/gameengine/Ketsji/SConscript | 6 |
9 files changed, 42 insertions, 27 deletions
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index eaead261b2c..b128f33c6e4 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -51,13 +51,11 @@ SET(INC ../../../source/gameengine/Network ../../../source/gameengine/SceneGraph ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet ../../../source/gameengine/Network/LoopBackNetwork ../../../intern/audaspace/intern ../../../source/blender/misc ../../../source/blender/blenloader ../../../source/blender/gpu - ../../../extern/bullet2/src ../../../extern/glew/include ) @@ -79,4 +77,10 @@ IF(WITH_FFMPEG) ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) + LIST(APPEND INC ../../../extern/bullet2/src) + LIST(APPEND INC ../../../source/gameengine/Physics/Bullet ) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_ketsji "${SRC}" "${INC}") diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index 1b2ceae6560..c2fb21bf31a 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time) // return false; } -#endif //#ifdef USE_BULLET +#endif // USE_BULLET diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 48a3c98ff81..a3e8fafec1d 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -3,7 +3,9 @@ #include "KX_IPhysicsController.h" +#ifdef USE_BULLET #include "CcdPhysicsController.h" +#endif class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController { @@ -18,9 +20,10 @@ private: btCollisionShape* m_bulletChildShape; public: +#ifdef USE_BULLET KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound); virtual ~KX_BulletPhysicsController (); - +#endif /////////////////////////////////// // KX_IPhysicsController interface //////////////////////////////////// diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index ca20aa6b618..2bb3534bde7 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -29,19 +29,6 @@ #ifndef KX_CONVERTPHYSICSOBJECTS #define KX_CONVERTPHYSICSOBJECTS -/* These are defined by the build system... */ -//but the build system is broken, because it doesn't allow for 2 or more defines at once. -//Please leave Sumo _AND_ Bullet enabled -#define USE_BULLET - -//on visual studio 7/8, always enable BULLET for now -//you can have multiple physics engines running anyway, and -//the scons build system doesn't really support this at the moment. -//if you got troubles, just comment out USE_BULLET -#if 1300 <= _MSC_VER -#define USE_BULLET -#endif - class RAS_MeshObject; class KX_Scene; struct DerivedMesh; diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 061220ce0c1..1888e7cf7b8 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -38,7 +38,6 @@ #include "RAS_MeshObject.h" #include "KX_Scene.h" #include "SYS_System.h" -#include "BulletSoftBody/btSoftBody.h" #include "PHY_Pro.h" //todo cleanup #include "KX_ClientObjectInfo.h" @@ -56,6 +55,7 @@ extern "C"{ } #ifdef USE_BULLET +#include "BulletSoftBody/btSoftBody.h" #include "CcdPhysicsEnvironment.h" #include "CcdPhysicsController.h" @@ -561,4 +561,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro spc->ReplaceControllerShape(bm); return true; } -#endif +#endif // USE_BULLET diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 764691c379f..6d83284379e 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1574,11 +1574,11 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args) ) { return NULL; } - +#ifdef USE_BULLET /* gameobj and mesh can be NULL */ if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh)) Py_RETURN_TRUE; - +#endif Py_RETURN_FALSE; } diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index e282d7ac375..fdd325c46a1 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -180,7 +180,7 @@ GPULamp *KX_LightObject::GetGPULamp() if(m_glsl) return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject()); else - return false; + return NULL; } void KX_LightObject::Update() diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 863b73adc96..9e2545f41cc 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -82,7 +82,10 @@ #include "BL_ModifierDeformer.h" #include "BL_ShapeDeformer.h" #include "BL_DeformableGameObject.h" + +#ifdef USE_BULLET #include "KX_SoftBodyDeformer.h" +#endif // to get USE_BULLET! #include "KX_ConvertPhysicsObject.h" @@ -1163,11 +1166,13 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u ); newobj->SetDeformer(meshdeformer); } +#ifdef USE_BULLET else if (bHasSoftBody) { KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj); newobj->SetDeformer(softdeformer); } +#endif // release parent reference if its not being used if( releaseParent && parentobj) @@ -1177,10 +1182,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u gameobj->AddMeshUser(); } - + +#ifdef USE_BULLET if(use_phys) { /* update the new assigned mesh with the physics mesh */ KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh); } +#endif } KX_Camera* KX_Scene::FindCamera(KX_Camera* cam) @@ -1629,7 +1636,9 @@ double KX_Scene::getSuspendedDelta() return m_suspendeddelta; } +#ifdef USE_BULLET #include "KX_BulletPhysicsController.h" +#endif static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) { @@ -1644,16 +1653,19 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) } /* near sensors have physics controllers */ +#ifdef USE_BULLET KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick); if(touch_sensor) { touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } +#endif } +#ifdef USE_BULLET #include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); #include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); #include "KX_BulletPhysicsController.h" - +#endif static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from) { @@ -1713,7 +1725,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene if(sg->GetSGClientInfo() == from) { sg->SetSGClientInfo(to); } - +#ifdef USE_BULLET SGControllerList::iterator contit; SGControllerList& controllers = sg->GetSGControllerList(); for (contit = controllers.begin();contit!=controllers.end();++contit) @@ -1722,6 +1734,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene if (phys_ctrl) phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } +#endif // USE_BULLET } /* If the object is a light, update it's scene */ if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) @@ -1737,6 +1750,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene bool KX_Scene::MergeScene(KX_Scene *other) { +#ifdef USE_BULLET CcdPhysicsEnvironment *env= dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment()); CcdPhysicsEnvironment *env_other= dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment()); @@ -1746,6 +1760,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL)); return false; } +#endif // USE_BULLET if(GetSceneConverter() != other->GetSceneConverter()) { printf("KX_Scene::MergeScene: converters differ, aborting\n"); @@ -1788,9 +1803,11 @@ bool KX_Scene::MergeScene(KX_Scene *other) GetLightList()->MergeList(other->GetLightList()); other->GetLightList()->ReleaseAndRemoveAll(); +#ifdef USE_BULLET if(env) /* bullet scene? - dummy scenes dont need touching */ env->MergeEnvironment(env_other); - +#endif + /* merge logic */ { SCA_LogicManager *logicmgr= GetLogicManager(); diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 49e4528594f..6f06d0ff19c 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -16,7 +16,7 @@ incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/ incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include' incs += ' #source/blender/makesdna #source/blender/python #source/gameengine/Rasterizer' incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions #source/gameengine/Network' -incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #source/gameengine/Physics/Bullet' +incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common' incs += ' #source/gameengine/Physics/Dummy' incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu' @@ -43,4 +43,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + incs += ' #source/gameengine/Physics/Bullet' + env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS']) |