enable building the game engine without bullet for scons & cmake

This commit is contained in:
Campbell Barton 2010-10-10 07:01:56 +00:00
parent d420d09da9
commit f49fc58df6
19 changed files with 68 additions and 34 deletions

View File

@ -126,9 +126,6 @@ IF(APPLE)
OPTION(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF)
ENDIF(APPLE)
IF(NOT WITH_BULLET AND WITH_GAMEENGINE)
MESSAGE("WARNING: WITH_GAMEENGINE needs WITH_BULLET")
ENDIF(NOT WITH_BULLET AND WITH_GAMEENGINE)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")

View File

@ -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 */

View File

@ -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)

View File

@ -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);

View File

@ -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}")

View File

@ -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'])

View File

@ -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()";

View File

@ -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}")

View File

@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time)
// return false;
}
#endif //#ifdef USE_BULLET
#endif // USE_BULLET

View File

@ -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
////////////////////////////////////

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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()

View File

@ -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();

View File

@ -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'])

View File

@ -46,4 +46,8 @@ SET(INC
${PYTHON_INC}
)
IF(WITH_BULLET)
ADD_DEFINITIONS(-DUSE_BULLET)
ENDIF(WITH_BULLET)
BLENDERLIB(bf_bullet "${SRC}" "${INC}")

View File

@ -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'])

View File

@ -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'])