From 7e8990269eb23d016fd496ce479d2a9fad59b421 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Mon, 29 Jan 2007 11:42:45 +0000 Subject: [PATCH] First pass at integrating ODE into Panda. Using ODE v0.7 --- dtool/Config.pp | 5 +++++ dtool/LocalSetup.pp | 8 +++++++ dtool/Package.pp | 5 +++++ dtool/pptempl/Global.pp | 7 ++++++ dtool/src/parser-inc/Sources.pp | 3 ++- dtool/src/parser-inc/common.h | 39 +++++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 1 deletion(-) diff --git a/dtool/Config.pp b/dtool/Config.pp index c80403beeb..8a36dfec1e 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -619,6 +619,11 @@ #define FFMPEG_LIBS $[if $[WINDOWS_PLATFORM],libavcodec.lib libavformat.lib libavutil.lib libgcc.lib,avcodec avformat avutil] #defer HAVE_FFMPEG $[libtest $[FFMPEG_LPATH],$[FFMPEG_LIBS]] +// Is ODE installed, and where? +#define ODE_IPATH +#define ODE_LPATH +#define ODE_LIBS $[if $[WINDOWS_PLATFORM],libode.lib,libode] +#defer HAVE_ODE $[libtest $[ODE_LPATH],$[ODE_LIBS]] // Do you want to build the DirectD tools for starting Panda clients // remotely? This only affects the direct tree. Enabling this may diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index d7837f6023..4cd82cd1f7 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -116,6 +116,11 @@ #else #print - Did not find FFMPEG #endif +#if $[HAVE_ODE] +#print + ODE +#else +#print - Did not find ODE +#endif #if $[HAVE_MAYA] #print + OpenMaya #else @@ -223,6 +228,9 @@ $[cdefine HAVE_OPENCV] /* Define if we have FFMPEG installed and want to build for FFMPEG. */ $[cdefine HAVE_FFMPEG] +/* Define if we have ODE installed and want to build for ODE. */ +$[cdefine HAVE_ODE] + /* Define if we have Mesa installed and want to build mesadisplay. */ $[cdefine HAVE_MESA] $[cdefine MESA_MGL] diff --git a/dtool/Package.pp b/dtool/Package.pp index c5967c45b3..78c1c11f04 100644 --- a/dtool/Package.pp +++ b/dtool/Package.pp @@ -224,6 +224,11 @@ #set FFMPEG_LIBS $[FFMPEG_LIBS] #set HAVE_FFMPEG $[HAVE_FFMPEG] +#set ODE_IPATH $[unixfilename $[ODE_IPATH]] +#set ODE_LPATH $[unixfilename $[ODE_LPATH]] +#set ODE_LIBS $[ODE_LIBS] +#set HAVE_ODE $[HAVE_ODE] + #set HAVE_THREADS $[HAVE_THREADS] #set DEBUG_THREADS $[DEBUG_THREADS] #set MUTEX_SPINLOCK $[MUTEX_SPINLOCK] diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index 5e467b6852..061371bcb9 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -176,6 +176,13 @@ #define ffmpeg_libs $[FFMPEG_LIBS] #endif +#if $[HAVE_ODE] + #define ode_ipath $[wildcard $[ODE_IPATH]] + #define ode_lpath $[wildcard $[ODE_LPATH]] + #define ode_cflags $[ODE_CFLAGS] + #define ode_libs $[ODE_LIBS] +#endif + #if $[HAVE_JPEG] #define jpeg_ipath $[wildcard $[JPEG_IPATH]] #define jpeg_lpath $[wildcard $[JPEG_LPATH]] diff --git a/dtool/src/parser-inc/Sources.pp b/dtool/src/parser-inc/Sources.pp index 1a6884049c..6046032534 100644 --- a/dtool/src/parser-inc/Sources.pp +++ b/dtool/src/parser-inc/Sources.pp @@ -10,4 +10,5 @@ cv.h cvtypes.h cxcore.h cxerror.h cxtypes.h highgui.h \ avcodec.h avformat.h avio.h avutil.h common.h integer.h \ intfloat_readwrite.h mathematics.h rational.h rtp.h \ - rtsp.h rtspcodes.h winsock2.h + rtsp.h rtspcodes.h winsock2.h \ + ode/common.h diff --git a/dtool/src/parser-inc/common.h b/dtool/src/parser-inc/common.h index b51ddf6923..43e9b8946c 100644 --- a/dtool/src/parser-inc/common.h +++ b/dtool/src/parser-inc/common.h @@ -6,4 +6,43 @@ #ifndef COMMON_H #define COMMON_H +# ODE header stuff + +#if defined(dSINGLE) +typedef float dReal; +#elif defined(dDOUBLE) +typedef double dReal; +#else +#error You must #define dSINGLE or dDOUBLE +#endif + +typedef dReal dVector3[4]; +typedef dReal dVector4[4]; +typedef dReal dMatrix3[4*3]; +typedef dReal dMatrix4[4*4]; +typedef dReal dMatrix6[8*6]; +typedef dReal dQuaternion[4]; + +struct dxWorld; /* dynamics world */ +struct dxSpace; /* collision space */ +struct dxBody; /* rigid body (dynamics object) */ +struct dxGeom; /* geometry (collision object) */ +struct dxJoint; +struct dxJointNode; +struct dxJointGroup; + +typedef struct dxWorld *dWorldID; +typedef struct dxSpace *dSpaceID; +typedef struct dxBody *dBodyID; +typedef struct dxGeom *dGeomID; +typedef struct dxJoint *dJointID; +typedef struct dxJointGroup *dJointGroupID; + +typedef struct dJointFeedback { + dVector3 f1; /* force applied to body 1 */ + dVector3 t1; /* torque applied to body 1 */ + dVector3 f2; /* force applied to body 2 */ + dVector3 t2; /* torque applied to body 2 */ +} dJointFeedback; + #endif /* COMMON_H */