From 1b1596178640ac4b0b75fd4b97ff08399a4c075d Mon Sep 17 00:00:00 2001 From: Norman Lin Date: Fri, 18 Oct 2002 14:36:34 +0000 Subject: First checkin of core ODE functionality. See OdePhysicsController.cpp for a todo list. --- source/Makefile | 16 ++++++++++++- source/blender/src/buttons.c | 6 ++--- .../Converter/BL_BlenderDataConversion.cpp | 1 + .../Converter/KX_BlenderSceneConverter.cpp | 26 +++++++++++++--------- source/gameengine/Converter/Makefile | 2 +- source/gameengine/Ketsji/KX_ConvertPhysicsObject.h | 3 +-- .../gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 7 +++--- source/gameengine/Ketsji/Makefile | 1 + source/gameengine/Physics/Makefile | 2 +- source/nan_definitions.mk | 1 + source/nan_link.mk | 1 + 11 files changed, 45 insertions(+), 21 deletions(-) diff --git a/source/Makefile b/source/Makefile index ef7a2aa73c1..51aa0234f8b 100644 --- a/source/Makefile +++ b/source/Makefile @@ -38,7 +38,7 @@ endif include nan_definitions.mk -DIRS = creator blender kernel sumo gameengine +DIRS = ode creator blender kernel sumo gameengine ifeq ($(OS),windows) DIRS += icons @@ -114,6 +114,11 @@ PYPLAYERLIB ?= $(PYLIB) GRPLIB += $(OCGDIR)/blender/bpython/$(DEBUG_DIR)libbpython.a GRPLIB += $(NAN_PYTHON)/frozen/libfrozen.a +# nlin: the reason that some libraries appear more than once below is +# to handle circular dependencies in linking among libraries... some +# linkers (e.g. under Linux) need libs to be specified multiple times +# to properly resolve circular dependencies. ugly, but it works... +# the repeat entries could probably be trimmed down. COMLIB = $(OCGDIR)/blender/blenkernel/$(DEBUG_DIR)libblenkernel.a COMLIB += $(OCGDIR)/blender/blenloader/$(DEBUG_DIR)libblenloader.a COMLIB += $(OCGDIR)/blender/blenpluginapi/$(DEBUG_DIR)libblenpluginapi.a @@ -124,6 +129,15 @@ PYPLAYERLIB ?= $(PYLIB) COMLIB += $(OCGDIR)/gameengine/bloutines/$(DEBUG_DIR)libbloutines.a COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a + COMLIB += $(OCGDIR)/gameengine/blphys/blode/$(DEBUG_DIR)libblode.a + COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a + COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a + COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a + COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a + COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a + COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a + COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a + COMLIB += $(OCGDIR)/gameengine/blphys/blode/$(DEBUG_DIR)libblode.a COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a diff --git a/source/blender/src/buttons.c b/source/blender/src/buttons.c index 85aeb92d959..6aa26548926 100644 --- a/source/blender/src/buttons.c +++ b/source/blender/src/buttons.c @@ -559,9 +559,9 @@ enum { static char *physics_pup(void) { - /* the number needs to match defines in game.h */ - return "Physics %t|Sumo %x0|" - "ODE %x4 |None %x7|"; + /* the number needs to match defines in KX_PhysicsBlenderSceneConverter.cpp */ + return "Physics %t|None %x1|Sumo %x2|" + "ODE %x3 |Dynamo %x4|"; } diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 68d45044fff..2343c372f1b 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -139,6 +139,7 @@ #include "SG_Node.h" +// defines USE_ODE to choose physics engine #include "KX_ConvertPhysicsObject.h" diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index fdba851b7a3..a043291c5d5 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -43,12 +43,13 @@ #include "DummyPhysicsEnvironment.h" +//to decide to use sumo/ode or dummy physics - defines USE_ODE +#include "KX_ConvertPhysicsObject.h" + #ifdef USE_ODE #include "OdePhysicsEnvironment.h" #endif //USE_ODE -//to decide to use sumo/ode or dummy physics -#include "KX_ConvertPhysicsObject.h" #ifdef USE_SUMO_SOLID #include "SumoPhysicsEnvironment.h" #endif @@ -181,24 +182,29 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename, switch (blenderscene->world->pad1) { - case 4: + case 1: { - physics_engine = UseODE; + physics_engine = UseNone; + break; + }; + case 2: + { + physics_engine = UseSumo; break; } - case 5: + case 3: { - physics_engine = UseDynamo; + physics_engine = UseODE; break; } - case 7: + case 4: { - physics_engine = UseNone; + physics_engine = UseDynamo; break; - }; + } default: { - physics_engine = UseSumo; + physics_engine = UseODE; } } } diff --git a/source/gameengine/Converter/Makefile b/source/gameengine/Converter/Makefile index 8f85e4c1a58..ffcdf8a0693 100644 --- a/source/gameengine/Converter/Makefile +++ b/source/gameengine/Converter/Makefile @@ -57,4 +57,4 @@ CPPFLAGS += -I../../kernel/gen_system CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer CPPFLAGS += -I../Network -I../Ketsji/KXNetwork CPPFLAGS += -I../Physics/common -I../Physics/Dummy - +CPPFLAGS += -I../Physics/BlOde diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index f74349a3e1a..931b9e3d400 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -38,8 +38,7 @@ //#define USE_SUMO_SOLID //solid is not available yet -//#define USE_ODE -//ode is not available yet +#define USE_ODE class RAS_MeshObject; diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 01d02b58132..97828b618f8 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -31,6 +31,7 @@ */ #pragma warning (disable : 4786) +// defines USE_ODE to choose physics engine #include "KX_ConvertPhysicsObject.h" #include "KX_GameObject.h" #include "RAS_MeshObject.h" @@ -50,11 +51,11 @@ #ifdef USE_ODE #include "KX_OdePhysicsController.h" -#include "odephysicsenvironment.h" +#include "OdePhysicsEnvironment.h" #endif //USE_ODE -// USE_SUMO_SOLID is defined in headerfile KX_ConvertPhysicsObjects.h +// USE_SUMO_SOLID is defined in headerfile KX_ConvertPhysicsObject.h #ifdef USE_SUMO_SOLID @@ -235,7 +236,7 @@ void KX_ConvertSumoObject( class KX_GameObject* gameobj, // physics object get updated here ! - // lazy evaluation because Havok doesn't support scaling !gameobj->UpdateTransform(); + // lazy evaluation because we might not support scaling !gameobj->UpdateTransform(); if (objprop->m_in_active_layer && sumoObj) { diff --git a/source/gameengine/Ketsji/Makefile b/source/gameengine/Ketsji/Makefile index 4e0ee06fe1a..1c11d7ca4c5 100644 --- a/source/gameengine/Ketsji/Makefile +++ b/source/gameengine/Ketsji/Makefile @@ -49,6 +49,7 @@ CPPFLAGS += -I../Network -IKXNetwork CPPFLAGS += -I../Physics/common CPPFLAGS += -I../Physics/Dummy CPPFLAGS += -I../Physics/Sumo +CPPFLAGS += -I../Physics/BlOde CPPFLAGS += -I. ########################### diff --git a/source/gameengine/Physics/Makefile b/source/gameengine/Physics/Makefile index c04ccb175aa..349c225e7ee 100644 --- a/source/gameengine/Physics/Makefile +++ b/source/gameengine/Physics/Makefile @@ -35,6 +35,6 @@ include nan_definitions.mk SOURCEDIR = source/gameengine/Physics DIR = $(OCGDIR)/gameengine/blphys -DIRS = common Sumo Dummy +DIRS = common Sumo Dummy BlOde include nan_subdirs.mk diff --git a/source/nan_definitions.mk b/source/nan_definitions.mk index 1034d3253c7..d084ce972f5 100644 --- a/source/nan_definitions.mk +++ b/source/nan_definitions.mk @@ -57,6 +57,7 @@ all debug:: export NAN_SOLID ?= $(SRCHOME)/sumo/SOLID-3.0 export NAN_SUMO ?= $(SRCHOME)/sumo export NAN_FUZZICS ?= $(SRCHOME)/sumo/Fuzzics + export NAN_ODE ?= $(SRCHOME)/ode export NAN_OPENSSL ?= $(LCGDIR)/openssl export NAN_BLENKEY ?= $(LCGDIR)/blenkey export NAN_DECIMATION ?= $(LCGDIR)/decimation diff --git a/source/nan_link.mk b/source/nan_link.mk index 2b8395badeb..6a9ebded017 100644 --- a/source/nan_link.mk +++ b/source/nan_link.mk @@ -91,6 +91,7 @@ ifeq ($(OS),linux) COMMENT = "MESA 3.1" LLIBS = -L$(NAN_MESA)/lib -L/usr/X11R6/lib -lXmu -lXext -lX11 -lXi LLIBS += -lutil -lc -lm -ldl -lpthread + LLIBS += -L$(NAN_ODE)/lib -lode LOPTS = -export-dynamic DADD = -lGL -lGLU SADD = $(NAN_MESA)/lib/libGL.a $(NAN_MESA)/lib/libGLU.a -- cgit v1.2.3