Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-10 11:01:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-10 11:01:56 +0400
commitf49fc58df63d42ab451380ea92e55b1265d14e4e (patch)
tree026f338d863a838844ba443f39056c01aa3be004 /source
parentd420d09da982e1a874ffe2b0612b8fdd0afc980e (diff)
enable building the game engine without bullet for scons & cmake
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/object.c3
-rw-r--r--source/gameengine/CMakeLists.txt5
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp2
-rw-r--r--source/gameengine/Converter/CMakeLists.txt4
-rw-r--r--source/gameengine/Converter/SConscript3
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt8
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.h5
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObject.h13
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp25
-rw-r--r--source/gameengine/Ketsji/SConscript6
-rw-r--r--source/gameengine/Physics/Bullet/CMakeLists.txt4
-rw-r--r--source/gameengine/Physics/Bullet/SConscript3
-rw-r--r--source/gameengine/SConscript4
18 files changed, 68 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 0c437db335b..541e8e2b00e 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1743,7 +1743,7 @@ int enable_cu_speed= 1;
static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
{
Curve *cu;
- float q[4], vec[4], dir[3], quat[4], radius, x1, ctime;
+ float vec[4], dir[3], quat[4], radius, ctime;
float timeoffs = 0.0, sf_orig = 0.0;
unit_m4(mat);
@@ -1795,6 +1795,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
if(cu->flag & CU_FOLLOW) {
#if 0
+ float x1, q[4];
vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
/* the tilt */
diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt
index 7b58a2a6875..eea600cb0cb 100644
--- a/source/gameengine/CMakeLists.txt
+++ b/source/gameengine/CMakeLists.txt
@@ -37,7 +37,10 @@ ADD_SUBDIRECTORY(Physics/Dummy)
ADD_SUBDIRECTORY(Rasterizer)
ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer)
ADD_SUBDIRECTORY(SceneGraph)
-ADD_SUBDIRECTORY(Physics/Bullet)
+
+IF(WITH_BULLET)
+ ADD_SUBDIRECTORY(Physics/Bullet)
+ENDIF(WITH_BULLET)
IF(WITH_PYTHON)
ADD_SUBDIRECTORY(VideoTexture)
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index f9bca9a2cdd..69483aed1ec 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1766,9 +1766,11 @@ static KX_GameObject *gameobject_from_blenderobject(
BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj,
ob, meshobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#ifdef USE_BULLET
} else if (bHasSoftBody) {
KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#endif
}
MT_Point3 min = MT_Point3(center) - MT_Vector3(extents);
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index c5b8128903b..87e413c3a44 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -69,4 +69,8 @@ ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)
ENDIF(WITH_PYTHON)
+IF(WITH_BULLET)
+ ADD_DEFINITIONS(-DUSE_BULLET)
+ENDIF(WITH_BULLET)
+
BLENDERLIB(bf_converter "${SRC}" "${INC}")
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index 7701d27730b..a276d1623df 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -35,4 +35,7 @@ else:
if env['WITH_BF_CXX_GUARDEDALLOC']:
defs.append('WITH_CXX_GUARDEDALLOC')
+if env['WITH_BF_BULLET']:
+ defs.append('USE_BULLET')
+
env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 1f05846abe4..45f0684c02f 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -214,7 +214,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
Py_DECREF(value_str);
- return false;
+ return NULL;
}
const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()";
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'])
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt
index 95888967b78..ba6f3bef0db 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -46,4 +46,8 @@ SET(INC
${PYTHON_INC}
)
+IF(WITH_BULLET)
+ ADD_DEFINITIONS(-DUSE_BULLET)
+ENDIF(WITH_BULLET)
+
BLENDERLIB(bf_bullet "${SRC}" "${INC}")
diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript
index 6beb044671c..6cebe0638b0 100644
--- a/source/gameengine/Physics/Bullet/SConscript
+++ b/source/gameengine/Physics/Bullet/SConscript
@@ -30,4 +30,7 @@ else:
if env['WITH_BF_CXX_GUARDEDALLOC']:
defs.append('WITH_CXX_GUARDEDALLOC')
+if env['WITH_BF_BULLET']:
+ defs.append('USE_BULLET')
+
env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/SConscript b/source/gameengine/SConscript
index e7c9328688f..aebbf4d9fcf 100644
--- a/source/gameengine/SConscript
+++ b/source/gameengine/SConscript
@@ -14,7 +14,6 @@ SConscript(['BlenderRoutines/SConscript',
'Rasterizer/SConscript',
'Rasterizer/RAS_OpenGLRasterizer/SConscript',
'SceneGraph/SConscript',
- 'Physics/Bullet/SConscript'
])
if env['WITH_BF_PYTHON']:
@@ -22,3 +21,6 @@ if env['WITH_BF_PYTHON']:
if env['WITH_BF_PLAYER']:
SConscript(['GamePlayer/SConscript'])
+
+if env['WITH_BF_BULLET']:
+ SConscript(['Physics/Bullet/SConscript'])