first pass at integrating ODE v0.7

This commit is contained in:
Josh Wilson 2007-01-29 21:30:34 +00:00
parent 67be8fcef0
commit fd6808e765
112 changed files with 7041 additions and 0 deletions

View File

@ -0,0 +1,26 @@
// DIR_TYPE "metalib" indicates we are building a shared library that
// consists mostly of references to other shared libraries. Under
// Windows, this directly produces a DLL (as opposed to the regular
// src libraries, which don't produce anything but a pile of OBJ files
// under Windows).
#define DIR_TYPE metalib
#define BUILD_DIRECTORY $[HAVE_ODE]
#define BUILDING_DLL BUILDING_PANDAODE
#define COMPONENT_LIBS \
pode
#define LOCAL_LIBS pgraph
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
dtoolutil:c dtoolbase:c dtool:m prc:c
#begin metalib_target
#define TARGET pandaode
#define SOURCES pandaode.cxx pandaode.h
#define INSTALL_HEADERS pandaode.h
#end metalib_target

View File

@ -0,0 +1,26 @@
// Filename: pandaode.cxx
// Created by: drose (16May00)
//
////////////////////////////////////////////////////////////////////
#include "pandaode.h"
#include "config_ode.h"
// By including checkPandaVersion.h, we guarantee that runtime
// attempts to load libpandaode.so/.dll will fail if they
// inadvertently link with the wrong version of libdtool.so/.dll.
#include "checkPandaVersion.h"
////////////////////////////////////////////////////////////////////
// Function: init_libpandaode
// Description: Initializes the library. This must be called at
// least once before any of the functions or classes in
// this library can be used. Normally it will be
// called by the static initializers and need not be
// called explicitly, but special cases exist.
////////////////////////////////////////////////////////////////////
void
init_libpandaode() {
init_libode();
}

View File

@ -0,0 +1,13 @@
// Filename: pandaode.h
// Created by: drose (2Jan01)
//
////////////////////////////////////////////////////////////////////
#ifndef PANDAODE_H
#define PANDAODE_H
#include "pandabase.h"
EXPCL_PANDAODE void init_libpandaode();
#endif

115
panda/src/ode/Sources.pp Executable file
View File

@ -0,0 +1,115 @@
#define BUILD_DIRECTORY $[HAVE_ODE]
#define BUILDING_DLL BUILDING_PANDAODE
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
dtoolutil:c dtoolbase:c dtool:m prc:c
#begin lib_target
#define TARGET pode
#define LOCAL_LIBS \
pgraph physics
#define USE_PACKAGES ode
#define COMBINED_SOURCES $[TARGET]_composite1.cxx \
$[TARGET]_composite2.cxx $[TARGET]_composite3.cxx
#define SOURCES \
config_ode.h \
odeWorld.I odeWorld.h \
odeMass.I odeMass.h \
odeBody.I odeBody.h \
odeJointGroup.I odeJointGroup.h \
odeJoint.I odeJoint.h \
odeUtil.h \
odeSpace.I odeSpace.h \
odeGeom.I odeGeom.h \
odeSurfaceParameters.I odeSurfaceParameters.h \
odeContactGeom.I odeContactGeom.h \
odeContact.I odeContact.h \
odeAMotorJoint.I odeAMotorJoint.h \
odeBallJoint.I odeBallJoint.h \
odeContactJoint.I odeContactJoint.h \
odeFixedJoint.I odeFixedJoint.h \
odeHingeJoint.I odeHingeJoint.h \
odeHinge2Joint.I odeHinge2Joint.h \
odeLMotorJoint.I odeLMotorJoint.h \
odeNullJoint.I odeNullJoint.h \
odePlane2dJoint.I odePlane2dJoint.h \
odeSliderJoint.I odeSliderJoint.h \
odeUniversalJoint.I odeUniversalJoint.h \
odeSimpleSpace.I odeSimpleSpace.h \
odeHashSpace.I odeHashSpace.h \
odeQuadTreeSpace.I odeQuadTreeSpace.h \
odeSphereGeom.I odeSphereGeom.h \
odeBoxGeom.I odeBoxGeom.h \
odePlaneGeom.I odePlaneGeom.h \
odeCappedCylinderGeom.I odeCappedCylinderGeom.h \
odeCylinderGeom.I odeCylinderGeom.h \
odeRayGeom.I odeRayGeom.h \
odeTriMeshData.I odeTriMeshData.h \
odeTriMeshGeom.I odeTriMeshGeom.h
#define INCLUDED_SOURCES \
config_ode.cxx \
odeWorld.cxx odeMass.cxx odeBody.cxx \
odeJointGroup.cxx odeJoint.cxx \
odeUtil.cxx \
odeSpace.cxx \
odeGeom.cxx \
odeSurfaceParameters.cxx \
odeContactGeom.cxx odeContact.cxx \
odeAMotorJoint.cxx odeBallJoint.cxx \
odeContactJoint.cxx odeFixedJoint.cxx \
odeHingeJoint.cxx odeHinge2Joint.cxx \
odeLMotorJoint.cxx odeNullJoint.cxx \
odePlane2dJoint.cxx odeSliderJoint.cxx \
odeUniversalJoint.cxx \
odeSimpleSpace.cxx \
odeHashSpace.cxx odeQuadTreeSpace.cxx \
odeSphereGeom.cxx odeBoxGeom.cxx \
odePlaneGeom.cxx odeCappedCylinderGeom.cxx \
odeCylinderGeom.cxx odeRayGeom.cxx \
odeTriMeshData.cxx odeTriMeshGeom.cxx
#define INSTALL_HEADERS \
config_ode.h \
odeWorld.I odeWorld.h \
odeMass.I odeMass.h \
odeBody.I odeBody.h \
odeJointGroup.I odeJointGroup.h \
odeJoint.I odeJoint.h \
odeUtil.h \
odeSpace.I odeSpace.h \
odeGeom.I odeGeom.h \
odeSurfaceParameters.I odeSurfaceParameters.h \
odeContactGeom.I odeContactGeom.h \
odeContact.I odeContact.h \
odeAMotorJoint.I odeAMotorJoint.h \
odeBallJoint.I odeBallJoint.h \
odeContactJoint.I odeContactJoint.h \
odeFixedJoint.I odeFixedJoint.h \
odeHingeJoint.I odeHingeJoint.h \
odeHinge2Joint.I odeHinge2Joint.h \
odeLMotorJoint.I odeLMotorJoint.h \
odeNullJoint.I odeNullJoint.h \
odePlane2dJoint.I odePlane2dJoint.h \
odeSliderJoint.I odeSliderJoint.h \
odeUniversalJoint.I odeUniversalJoint.h \
odeSimpleSpace.I odeSimpleSpace.h \
odeHashSpace.I odeHashSpace.h \
odeQuadTreeSpace.I odeQuadTreeSpace.h \
odeSphereGeom.I odeSphereGeom.h \
odeBoxGeom.I odeBoxGeom.h \
odePlaneGeom.I odePlaneGeom.h \
odeCappedCylinderGeom.I odeCappedCylinderGeom.h \
odeCylinderGeom.I odeCylinderGeom.h \
odeRayGeom.I odeRayGeom.h \
odeTriMeshData.I odeTriMeshData.h \
odeTriMeshGeom.I odeTriMeshGeom.h
#define IGATESCAN all
#end lib_target

115
panda/src/ode/config_ode.cxx Executable file
View File

@ -0,0 +1,115 @@
// Filename: config_effects.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeWorld.h"
#include "odeMass.h"
#include "odeBody.h"
#include "odeJointGroup.h"
#include "odeJoint.h"
#include "odeSpace.h"
#include "odeGeom.h"
#include "odeSurfaceParameters.h"
#include "odeContactGeom.h"
#include "odeContact.h"
#include "odeAMotorJoint.h"
#include "odeBallJoint.h"
#include "odeContactJoint.h"
#include "odeFixedJoint.h"
#include "odeHingeJoint.h"
#include "odeHinge2Joint.h"
#include "odeLMotorJoint.h"
#include "odeNullJoint.h"
#include "odePlane2dJoint.h"
#include "odeSliderJoint.h"
#include "odeUniversalJoint.h"
#include "odeSimpleSpace.h"
#include "odeHashSpace.h"
#include "odeQuadTreeSpace.h"
#include "odeSphereGeom.h"
#include "odeBoxGeom.h"
#include "odePlaneGeom.h"
#include "odeCappedCylinderGeom.h"
#include "odeCylinderGeom.h"
#include "odeRayGeom.h"
#include "odeTriMeshData.h"
#include "odeTriMeshGeom.h"
#include "dconfig.h"
Configure(config_ode);
NotifyCategoryDef(ode, "");
NotifyCategoryDef(odeworld, "");
NotifyCategoryDef(odebody, "");
NotifyCategoryDef(odejoint, "");
NotifyCategoryDef(odespace, "");
NotifyCategoryDef(odegeom, "");
NotifyCategoryDef(odetrimeshdata, "");
ConfigureFn(config_ode) {
init_libode();
}
////////////////////////////////////////////////////////////////////
// Function: init_libode
// Description: Initializes the library. This must be called at
// least once before any of the functions or classes in
// this library can be used. Normally it will be
// called by the static initializers and need not be
// called explicitly, but special cases exist.
////////////////////////////////////////////////////////////////////
void
init_libode() {
static bool initialized = false;
if (initialized) {
return;
}
initialized = true;
OdeWorld::init_type();
OdeMass::init_type();
OdeBody::init_type();
OdeJointGroup::init_type();
OdeJoint::init_type();
OdeSpace::init_type();
OdeGeom::init_type();
OdeSurfaceParameters::init_type();
OdeContactGeom::init_type();
OdeContact::init_type();
OdeAMotorJoint::init_type();
OdeBallJoint::init_type();
OdeContactJoint::init_type();
OdeFixedJoint::init_type();
OdeHingeJoint::init_type();
OdeHinge2Joint::init_type();
OdeLMotorJoint::init_type();
OdeNullJoint::init_type();
OdePlane2dJoint::init_type();
OdeSliderJoint::init_type();
OdeUniversalJoint::init_type();
OdeSimpleSpace::init_type();
OdeHashSpace::init_type();
OdeQuadTreeSpace::init_type();
OdeSphereGeom::init_type();
OdeBoxGeom::init_type();
OdePlaneGeom::init_type();
OdeCappedCylinderGeom::init_type();
OdeCylinderGeom::init_type();
OdeRayGeom::init_type();
OdeTriMeshData::init_type();
OdeTriMeshGeom::init_type();
}

37
panda/src/ode/config_ode.h Executable file
View File

@ -0,0 +1,37 @@
// Filename: config_effects.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef CONFIG_ODE_H
#define CONFIG_ODE_H
#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "dconfig.h"
NotifyCategoryDecl(ode, EXPCL_PANDAODE, EXPTP_PANDAODE);
NotifyCategoryDecl(odeworld, EXPCL_PANDAODE, EXPTP_PANDAODE);
NotifyCategoryDecl(odebody, EXPCL_PANDAODE, EXPTP_PANDAODE);
NotifyCategoryDecl(odejoint, EXPCL_PANDAODE, EXPTP_PANDAODE);
NotifyCategoryDecl(odespace, EXPCL_PANDAODE, EXPTP_PANDAODE);
NotifyCategoryDecl(odegeom, EXPCL_PANDAODE, EXPTP_PANDAODE);
NotifyCategoryDecl(odetrimeshdata, EXPCL_PANDAODE, EXPTP_PANDAODE);
extern EXPCL_PANDAODE void init_libode();
#endif /* CONFIG_ODE_H */

82
panda/src/ode/odeAMotorJoint.I Executable file
View File

@ -0,0 +1,82 @@
// Filename: odeAMotorJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeAMotorJoint::
set_a_motor_num_axes(int num) {
dJointSetAMotorNumAxes(_id, num);
}
INLINE void OdeAMotorJoint::
set_a_motor_axis(int anum, int rel, dReal x, dReal y, dReal z) {
dJointSetAMotorAxis(_id, anum, rel, x, y, z);
}
INLINE void OdeAMotorJoint::
set_a_motor_angle(int anum, dReal angle) {
dJointSetAMotorAngle(_id, anum, angle);
}
INLINE void OdeAMotorJoint::
set_a_motor_param(int parameter, dReal value) {
dJointSetAMotorParam(_id, parameter, value);
}
INLINE void OdeAMotorJoint::
set_a_motor_mode(int mode) {
dJointSetAMotorMode(_id, mode);
}
INLINE void OdeAMotorJoint::
add_a_motor_torques(dReal torque1, dReal torque2, dReal torque3) {
dJointAddAMotorTorques(_id, torque1, torque2, torque3);
}
INLINE int OdeAMotorJoint::
get_a_motor_num_axes() const {
return dJointGetAMotorNumAxes(_id);
}
INLINE void OdeAMotorJoint::
get_a_motor_axis(int anum, dVector3 result) const {
return dJointGetAMotorAxis(_id, anum, result);
}
INLINE int OdeAMotorJoint::
get_a_motor_axis_rel(int anum) const {
return dJointGetAMotorAxisRel(_id, anum);
}
INLINE dReal OdeAMotorJoint::
get_a_motor_angle(int anum) const {
return dJointGetAMotorAngle(_id, anum);
}
INLINE dReal OdeAMotorJoint::
get_a_motor_angle_rate(int anum) const {
return dJointGetAMotorAngleRate(_id, anum);
}
INLINE dReal OdeAMotorJoint::
get_a_motor_param(int parameter) const {
return dJointGetAMotorParam(_id, parameter);
}
INLINE int OdeAMotorJoint::
get_a_motor_mode() const {
return dJointGetAMotorMode(_id);
}

View File

@ -0,0 +1,36 @@
// Filename: odeAMotorJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeAMotorJoint.h"
TypeHandle OdeAMotorJoint::_type_handle;
OdeAMotorJoint::
OdeAMotorJoint(OdeWorld &world) :
OdeJoint(dJointCreateAMotor(world.get_id(), 0)) {
}
OdeAMotorJoint::
OdeAMotorJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateAMotor(world.get_id(), joint_group.get_id())) {
}
OdeAMotorJoint::
~OdeAMotorJoint() {
}

View File

@ -0,0 +1,57 @@
#ifndef ODEAMOTORJOINT_H
#define ODEAMOTORJOINT_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeAMotorJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeAMotorJoint : public OdeJoint {
PUBLISHED:
OdeAMotorJoint(OdeWorld &world);
OdeAMotorJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeAMotorJoint();
INLINE void set_a_motor_num_axes(int num);
INLINE void set_a_motor_axis(int anum, int rel, dReal x, dReal y, dReal z);
INLINE void set_a_motor_angle(int anum, dReal angle);
INLINE void set_a_motor_param(int parameter, dReal value);
INLINE void set_a_motor_mode(int mode);
INLINE void add_a_motor_torques(dReal torque1, dReal torque2, dReal torque3);
INLINE int get_a_motor_num_axes() const;
INLINE void get_a_motor_axis(int anum, dVector3 result) const;
INLINE int get_a_motor_axis_rel(int anum) const;
INLINE dReal get_a_motor_angle(int anum) const;
INLINE dReal get_a_motor_angle_rate(int anum) const;
INLINE dReal get_a_motor_param(int parameter) const;
INLINE int get_a_motor_mode() const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeAMotorJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeAMotorJoint.I"
#endif

37
panda/src/ode/odeBallJoint.I Executable file
View File

@ -0,0 +1,37 @@
// Filename: odeBallJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeBallJoint::
set_ball_anchor(dReal x, dReal y, dReal z) {
dJointSetBallAnchor(_id, x, y, z);
}
INLINE void OdeBallJoint::
set_ball_anchor2(dReal x, dReal y, dReal z) {
dJointSetBallAnchor2(_id, x, y, z);
}
INLINE void OdeBallJoint::
get_ball_anchor(dVector3 result) const {
return dJointGetBallAnchor(_id, result);
}
INLINE void OdeBallJoint::
get_ball_anchor2(dVector3 result) const {
return dJointGetBallAnchor2(_id, result);
}

36
panda/src/ode/odeBallJoint.cxx Executable file
View File

@ -0,0 +1,36 @@
// Filename: odeBallJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeBallJoint.h"
TypeHandle OdeBallJoint::_type_handle;
OdeBallJoint::
OdeBallJoint(OdeWorld &world) :
OdeJoint(dJointCreateBall(world.get_id(), 0)) {
}
OdeBallJoint::
OdeBallJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateBall(world.get_id(), joint_group.get_id())) {
}
OdeBallJoint::
~OdeBallJoint() {
}

View File

@ -0,0 +1,48 @@
#ifndef ODEBALLJOINT_H
#define ODEBALLJOINT_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeBallJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeBallJoint : public OdeJoint {
PUBLISHED:
OdeBallJoint(OdeWorld &world);
OdeBallJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeBallJoint();
INLINE void set_ball_anchor(dReal x, dReal y, dReal z);
INLINE void set_ball_anchor2(dReal x, dReal y, dReal z);
INLINE void get_ball_anchor(dVector3 result) const;
INLINE void get_ball_anchor2(dVector3 result) const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeBallJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeBallJoint.I"
#endif

306
panda/src/ode/odeBody.I Executable file
View File

@ -0,0 +1,306 @@
// Filename: odeBody.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE dBodyID OdeBody::
get_id() const {
return _id;
}
INLINE dReal OdeBody::
get_auto_disable_linear_threshold() const {
return dBodyGetAutoDisableLinearThreshold(_id);
}
INLINE void OdeBody::
set_auto_disable_linear_threshold(dReal linear_threshold) {
dBodySetAutoDisableLinearThreshold(_id, linear_threshold);
}
INLINE dReal OdeBody::
get_auto_disable_angular_threshold() const {
return dBodyGetAutoDisableAngularThreshold(_id);
}
INLINE void OdeBody::
set_auto_disable_angular_threshold(dReal angular_threshold) {
dBodySetAutoDisableAngularThreshold(_id, angular_threshold);
}
INLINE int OdeBody::
get_auto_disable_steps() const {
return dBodyGetAutoDisableSteps(_id);
}
INLINE void OdeBody::
set_auto_disable_steps(int steps) {
dBodySetAutoDisableSteps(_id, steps);
}
INLINE dReal OdeBody::
get_auto_disable_time() const {
return dBodyGetAutoDisableTime(_id);
}
INLINE void OdeBody::
set_auto_disable_time(dReal time) {
dBodySetAutoDisableTime(_id, time);
}
INLINE int OdeBody::
get_auto_disable_flag() const {
return dBodyGetAutoDisableFlag(_id);
}
INLINE void OdeBody::
set_auto_disable_flag(int do_auto_disable) {
dBodySetAutoDisableFlag(_id, do_auto_disable);
}
INLINE void OdeBody::
set_auto_disable_defaults() {
dBodySetAutoDisableDefaults(_id);
}
INLINE void OdeBody::
set_data(void *data) {
dBodySetData(_id, data);
}
INLINE void* OdeBody::
get_data() const {
return dBodyGetData(_id);
}
INLINE void OdeBody::
set_position(dReal x, dReal y, dReal z) {
dBodySetPosition(_id, x, y, z);
}
INLINE void OdeBody::
set_rotation(const LMatrix3f r) {
dMatrix3 mat3 = {r._m.data[0], r._m.data[1], r._m.data[2], 0,
r._m.data[3], r._m.data[4], r._m.data[5], 0,
r._m.data[6], r._m.data[7], r._m.data[8], 0};
dBodySetRotation(_id, mat3);
}
INLINE void OdeBody::
set_quaternion(const LQuaternionf q) {
dQuaternion quat = {q._v.data[0],
q._v.data[1],
q._v.data[2],
q._v.data[3]};
dBodySetQuaternion(_id, quat);
}
INLINE void OdeBody::
set_linear_vel(dReal x, dReal y, dReal z) {
dBodySetLinearVel(_id, x, y, z);
}
INLINE void OdeBody::
set_angular_vel(dReal x, dReal y, dReal z) {
dBodySetAngularVel(_id, x, y, z);
}
INLINE LVecBase3f OdeBody::
get_position() const {
const dReal *res = dBodyGetPosition(_id);
return LVecBase3f(res[0], res[1], res[2]);
}
INLINE LVecBase3f OdeBody::
get_rotation() const {
const dReal *res = dBodyGetRotation(_id);
return LVecBase3f(res[0], res[1], res[2]);
}
INLINE LVecBase4f OdeBody::
get_quaternion() const {
const dReal *res = dBodyGetQuaternion(_id);
return LVecBase4f(res[0], res[1], res[2], res[3]);
}
INLINE LVecBase3f OdeBody::
get_linear_vel() const {
const dReal *res = dBodyGetLinearVel(_id);
return LVecBase3f(res[0], res[1], res[2]);
}
INLINE LVecBase3f OdeBody::
get_angular_vel() const {
const dReal *res = dBodyGetAngularVel(_id);
return LVecBase3f(res[0], res[1], res[2]);
}
INLINE void OdeBody::
set_mass(OdeMass &mass) {
dBodySetMass(_id, mass.get_mass_ptr());
}
INLINE OdeMass OdeBody::
get_mass() const {
OdeMass mass;
dBodyGetMass(_id, mass.get_mass_ptr());
return mass;
}
INLINE void OdeBody::
add_force(dReal fx, dReal fy, dReal fz) {
dBodyAddForce(_id, fx, fy, fz);
}
INLINE void OdeBody::
add_torque(dReal fx, dReal fy, dReal fz) {
dBodyAddTorque(_id, fx, fy, fz);
}
INLINE void OdeBody::
add_rel_force(dReal fx, dReal fy, dReal fz) {
dBodyAddRelForce(_id, fx, fy, fz);
}
INLINE void OdeBody::
add_rel_torque(dReal fx, dReal fy, dReal fz) {
dBodyAddRelTorque(_id, fx, fy, fz);
}
INLINE void OdeBody::
add_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
dBodyAddForceAtPos(_id, fx, fy, fz, px, py, pz);
}
INLINE void OdeBody::
add_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
dBodyAddForceAtRelPos(_id, fx, fy, fz, px, py, pz);
}
INLINE void OdeBody::
add_rel_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
dBodyAddRelForceAtPos(_id, fx, fy, fz, px, py, pz);
}
INLINE void OdeBody::
add_rel_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
dBodyAddRelForceAtRelPos(_id, fx, fy, fz, px, py, pz);
}
INLINE void OdeBody::
set_force(dReal x, dReal y, dReal z) {
dBodySetForce(_id, x, y, z);
}
INLINE void OdeBody::
set_torque(dReal x, dReal y, dReal z) {
dBodySetTorque(_id, x, y, z);
}
INLINE LPoint3f OdeBody::
get_rel_point_pos(dReal px, dReal py, dReal pz) const {
dVector3 result;
dBodyGetRelPointPos(_id, px, py, pz, result);
return LPoint3f(result[0], result[1], result[2]);
}
INLINE LPoint3f OdeBody::
get_rel_point_vel(dReal px, dReal py, dReal pz) const {
dVector3 result;
dBodyGetRelPointVel(_id, px, py, pz, result);
return LPoint3f(result[0], result[1], result[2]);
}
INLINE LPoint3f OdeBody::
get_point_vel(dReal px, dReal py, dReal pz) const {
dVector3 result;
dBodyGetPointVel(_id, px, py, pz, result);
return LPoint3f(result[0], result[1], result[2]);
}
INLINE LPoint3f OdeBody::
get_pos_rel_point(dReal px, dReal py, dReal pz) const {
dVector3 result;
dBodyGetPosRelPoint(_id, px, py, pz, result);
return LPoint3f(result[0], result[1], result[2]);
}
INLINE LVecBase3f OdeBody::
vector_to_world(dReal px, dReal py, dReal pz) const {
dVector3 result;
dBodyVectorToWorld(_id, px, py, pz, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE LVecBase3f OdeBody::
vector_from_world(dReal px, dReal py, dReal pz) const {
dVector3 result;
dBodyVectorFromWorld(_id, px, py, pz, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeBody::
set_finite_rotation_mode(int mode) {
dBodySetFiniteRotationMode(_id, mode);
}
INLINE void OdeBody::
set_finite_rotation_axis(dReal x, dReal y, dReal z) {
dBodySetFiniteRotationAxis(_id, x, y, z);
}
INLINE int OdeBody::
get_finite_rotation_mode() const {
return dBodyGetFiniteRotationMode(_id);
}
INLINE LVecBase3f OdeBody::
get_finite_rotation_axis() const {
dVector3 result;
dBodyGetFiniteRotationAxis(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE int OdeBody::
get_num_joints() const {
return dBodyGetNumJoints(_id);
}
INLINE void OdeBody::
enable() {
dBodyEnable(_id);
}
INLINE void OdeBody::
disable() {
dBodyDisable(_id);
}
INLINE int OdeBody::
is_enabled() const {
return dBodyIsEnabled(_id);
}
INLINE void OdeBody::
set_gravity_mode(int mode) {
dBodySetGravityMode(_id, mode);
}
INLINE int OdeBody::
get_gravity_mode() const {
return dBodyGetGravityMode(_id);
}

60
panda/src/ode/odeBody.cxx Executable file
View File

@ -0,0 +1,60 @@
// Filename: odeBody.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeBody.h"
TypeHandle OdeBody::_type_handle;
OdeBody::
OdeBody() :
_id(0) {
}
OdeBody::
OdeBody(dBodyID id) :
_id(id) {
}
OdeBody::
OdeBody(OdeWorld &world) :
_id(dBodyCreate(world.get_id())) {
}
OdeBody::
~OdeBody() {
}
void OdeBody::
destroy() {
dBodyDestroy(_id);
}
void OdeBody::
get_joint(int index, OdeJoint &joint) const {
joint._id = dBodyGetJoint(_id, index);
}
void OdeBody::
write(ostream &out, unsigned int indent) const {
#ifndef NDEBUG //[
out.width(indent); out << "" << get_type() \
<< "(id = " << _id \
<< ")";
#endif //] NDEBUG
}

142
panda/src/ode/odeBody.h Executable file
View File

@ -0,0 +1,142 @@
// Filename: odeBody.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEBODY_H
#define ODEBODY_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeWorld.h"
#include "odeMass.h"
class OdeJoint;
class OdeGeom;
////////////////////////////////////////////////////////////////////
// Class : OdeBody
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeBody : public TypedObject {
friend class OdeJoint;
friend class OdeGeom;
protected:
OdeBody(dBodyID id);
PUBLISHED:
OdeBody();
OdeBody(OdeWorld &world);
virtual ~OdeBody();
void destroy();
INLINE void set_auto_disable_linear_threshold(dReal linear_threshold);
INLINE void set_auto_disable_angular_threshold(dReal angular_threshold);
INLINE void set_auto_disable_steps(int steps);
INLINE void set_auto_disable_time(dReal time);
INLINE void set_auto_disable_flag(int do_auto_disable);
INLINE void set_auto_disable_defaults();
INLINE void set_data(void *data);
INLINE void set_position(dReal x, dReal y, dReal z);
INLINE void set_rotation(const LMatrix3f r);
INLINE void set_quaternion(const LQuaternionf q);
INLINE void set_linear_vel(dReal x, dReal y, dReal z);
INLINE void set_angular_vel(dReal x, dReal y, dReal z);
INLINE void set_mass(OdeMass &mass);
INLINE dReal get_auto_disable_linear_threshold() const;
INLINE dReal get_auto_disable_angular_threshold() const;
INLINE int get_auto_disable_steps() const;
INLINE dReal get_auto_disable_time() const;
INLINE int get_auto_disable_flag() const;
INLINE void* get_data() const;
INLINE LVecBase3f get_position() const;
INLINE LVecBase3f get_rotation() const;
INLINE LVecBase4f get_quaternion() const;
INLINE LVecBase3f get_linear_vel() const;
INLINE LVecBase3f get_angular_vel() const;
INLINE OdeMass get_mass() const;
INLINE void add_force(dReal fx, dReal fy, dReal fz);
INLINE void add_torque(dReal fx, dReal fy, dReal fz);
INLINE void add_rel_force(dReal fx, dReal fy, dReal fz);
INLINE void add_rel_torque(dReal fx, dReal fy, dReal fz);
INLINE void add_force_at_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_force_at_rel_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_rel_force_at_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_rel_force_at_rel_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void set_force(dReal x, dReal y, dReal z);
INLINE void set_torque(dReal x, dReal y, dReal z);
INLINE LPoint3f get_rel_point_pos(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_rel_point_vel(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_point_vel(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_pos_rel_point(dReal px, dReal py, dReal pz) const;
INLINE LVecBase3f vector_to_world(dReal px, dReal py, dReal pz) const;
INLINE LVecBase3f vector_from_world(dReal px, dReal py, dReal pz) const;
INLINE void set_finite_rotation_mode(int mode);
INLINE void set_finite_rotation_axis(dReal x, dReal y, dReal z);
INLINE int get_finite_rotation_mode() const;
INLINE LVecBase3f get_finite_rotation_axis() const;
INLINE int get_num_joints() const;
void get_joint(int index, OdeJoint &joint) const;
INLINE void enable();
INLINE void disable();
INLINE int is_enabled() const;
INLINE void set_gravity_mode(int mode);
INLINE int get_gravity_mode() const;
virtual void write(ostream &out = cout, unsigned int indent=0) const;
public:
INLINE dBodyID get_id() const;
private:
dBodyID _id;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeBody",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeBody.I"
#endif

35
panda/src/ode/odeBoxGeom.I Executable file
View File

@ -0,0 +1,35 @@
// Filename: odeBoxGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeBoxGeom::
set_lengths(dReal lx, dReal ly, dReal lz) {
dGeomBoxSetLengths(_id, lx, ly, lz);
}
INLINE LVecBase3f OdeBoxGeom::
get_lengths() {
dVector3 res;
dGeomBoxGetLengths(_id, res);
return LVecBase3f(res[0], res[1], res[2]);
}
INLINE dReal OdeBoxGeom::
get_point_depth(dReal x, dReal y, dReal z) {
return dGeomBoxPointDepth(_id, x, y, z);
}

View File

@ -0,0 +1,36 @@
// Filename: odeBoxGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeBoxGeom.h"
TypeHandle OdeBoxGeom::_type_handle;
OdeBoxGeom::
OdeBoxGeom(dReal lx, dReal ly, dReal lz) :
OdeGeom(dCreateBox(0, lx, ly, lz)) {
}
OdeBoxGeom::
OdeBoxGeom(OdeSpace &space, dReal lx, dReal ly, dReal lz) :
OdeGeom(dCreateBox(space.get_id(), lx, ly, lz)) {
}
OdeBoxGeom::
~OdeBoxGeom() {
}

View File

@ -0,0 +1,66 @@
// Filename: odeBoxGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEBOXGEOM_H
#define ODEBOXGEOM_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeBoxGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeBoxGeom : public OdeGeom {
PUBLISHED:
OdeBoxGeom(dReal lx, dReal ly, dReal lz);
OdeBoxGeom(OdeSpace &space, dReal lx, dReal ly, dReal lz);
virtual ~OdeBoxGeom();
INLINE void set_lengths(dReal lx, dReal ly, dReal lz);
INLINE LVecBase3f get_lengths();
INLINE dReal get_point_depth(dReal x, dReal y, dReal z);
public:
INLINE static int get_geom_class() { return dBoxClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeBoxGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeBoxGeom.I"
#endif

View File

@ -0,0 +1,46 @@
// Filename: odeCappedCylinderGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeCappedCylinderGeom::
set_params(dReal radius, dReal length) {
dGeomCapsuleSetParams(_id, radius, length);
}
INLINE void OdeCappedCylinderGeom::
get_params(dReal *radius, dReal *length) const {
dGeomCapsuleGetParams(_id, radius, length);
}
INLINE dReal OdeCappedCylinderGeom::
get_radius() const {
dReal radius, length;
dGeomCapsuleGetParams(_id, &radius, &length);
return radius;
}
INLINE dReal OdeCappedCylinderGeom::
get_length() const {
dReal radius, length;
dGeomCapsuleGetParams(_id, &radius, &length);
return length;
}
INLINE dReal OdeCappedCylinderGeom::
get_point_depth(dReal x, dReal y, dReal z) const {
return dGeomCapsulePointDepth(_id, x, y, z);
}

View File

@ -0,0 +1,36 @@
// Filename: odeCappedCylinderGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeCappedCylinderGeom.h"
TypeHandle OdeCappedCylinderGeom::_type_handle;
OdeCappedCylinderGeom::
OdeCappedCylinderGeom(dReal radius, dReal length) :
OdeGeom(dCreateCapsule(0, radius, length)) {
}
OdeCappedCylinderGeom::
OdeCappedCylinderGeom(OdeSpace &space, dReal radius, dReal length) :
OdeGeom(dCreateCapsule(space.get_id(), radius, length)) {
}
OdeCappedCylinderGeom::
~OdeCappedCylinderGeom() {
}

View File

@ -0,0 +1,68 @@
// Filename: odeCappedCylinderGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODECAPPEDCYLINDERGEOM_H
#define ODECAPPEDCYLINDERGEOM_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeCappedCylinderGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeCappedCylinderGeom : public OdeGeom {
PUBLISHED:
OdeCappedCylinderGeom(dReal radius, dReal length);
OdeCappedCylinderGeom(OdeSpace &space, dReal radius, dReal length);
virtual ~OdeCappedCylinderGeom();
INLINE void set_params(dReal radius, dReal length);
INLINE void get_params(dReal *radius, dReal *length) const;
INLINE dReal get_radius() const;
INLINE dReal get_length() const;
INLINE dReal get_point_depth(dReal x, dReal y, dReal z) const;
public:
INLINE static int get_geom_class() { return dCapsuleClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeCappedCylinderGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeCappedCylinderGeom.I"
#endif

54
panda/src/ode/odeContact.I Executable file
View File

@ -0,0 +1,54 @@
// Filename: odeContact.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE OdeSurfaceParameters OdeContact::
get_surface() const {
return OdeSurfaceParameters(_contact.surface);
}
INLINE OdeContactGeom OdeContact::
get_geom() {
return OdeContactGeom(_contact.geom);
}
INLINE LVecBase3f OdeContact::
get_fdir1() const {
return LVecBase3f(_contact.fdir1[0],
_contact.fdir1[1],
_contact.fdir1[2]);
}
INLINE void OdeContact::
set_surface(const OdeSurfaceParameters &surface_parameters) {
_contact.surface = *(surface_parameters.get_surface_parameters_ptr());
}
INLINE void OdeContact::
set_geom(const OdeContactGeom &contact_geom) {
_contact.geom = *(contact_geom.get_contact_geom_ptr());
}
INLINE void OdeContact::
set_fdir1(const LVecBase3f &fdir1) {
_contact.fdir1[0] = fdir1[0];
_contact.fdir1[1] = fdir1[1];
_contact.fdir1[2] = fdir1[2];
}

41
panda/src/ode/odeContact.cxx Executable file
View File

@ -0,0 +1,41 @@
// Filename: odeContact.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeContact.h"
TypeHandle OdeContact::_type_handle;
OdeContact::
OdeContact() :
_contact() {
}
OdeContact::
OdeContact(const dContact &contact) :
_contact(contact) {
}
OdeContact::
~OdeContact() {
}
const dContact* OdeContact::
get_contact_ptr() const {
return &_contact;
}

77
panda/src/ode/odeContact.h Executable file
View File

@ -0,0 +1,77 @@
// Filename: odeContact.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODECONTACT_H
#define ODECONTACT_H
#include "pandabase.h"
#include "typedReferenceCount.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeSurfaceParameters.h"
#include "odeContactGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeContact
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeContact : public TypedReferenceCount {
PUBLISHED:
OdeContact();
// OdeContact(const OdeContact &copy);
OdeContact(const dContact &contact);
virtual ~OdeContact();
INLINE OdeSurfaceParameters get_surface() const;
INLINE OdeContactGeom get_geom();
INLINE LVecBase3f get_fdir1() const;
INLINE void set_surface(const OdeSurfaceParameters &surface_parameters);
INLINE void set_geom(const OdeContactGeom &contact_geom);
INLINE void set_fdir1(const LVecBase3f &fdir1);
public:
const dContact* get_contact_ptr() const;
private:
void operator = (const OdeContact &copy);
dContact _contact;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "OdeContact",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeContact.I"
#endif

87
panda/src/ode/odeContactGeom.I Executable file
View File

@ -0,0 +1,87 @@
// Filename: odeContactGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE LVecBase3f OdeContactGeom::
get_pos() const {
return LVecBase3f(_contact_geom.pos[0],
_contact_geom.pos[1],
_contact_geom.pos[2]);
}
INLINE LVecBase3f OdeContactGeom::
get_normal() const {
return LVecBase3f(_contact_geom.normal[0],
_contact_geom.normal[1],
_contact_geom.normal[2]);
}
INLINE dReal OdeContactGeom::
get_depth() const {
return _contact_geom.depth;
}
INLINE OdeGeom OdeContactGeom::
get_g1() const {
return OdeGeom(_contact_geom.g1);
}
INLINE OdeGeom OdeContactGeom::
get_g2() const {
return OdeGeom(_contact_geom.g2);
}
INLINE int OdeContactGeom::
get_side1() const {
return _contact_geom.side1;
}
INLINE int OdeContactGeom::
get_side2() const {
return _contact_geom.side2;
}
INLINE void OdeContactGeom::
set_pos(const LVecBase3f &pos){
_contact_geom.pos[0] = pos[0];
_contact_geom.pos[1] = pos[1];
_contact_geom.pos[2] = pos[2];
}
INLINE void OdeContactGeom::
set_normal(const LVecBase3f &normal){
_contact_geom.normal[0] = normal[0];
_contact_geom.normal[1] = normal[1];
_contact_geom.normal[2] = normal[2];
}
INLINE void OdeContactGeom::
set_depth(const dReal depth){
_contact_geom.depth = depth;
}
INLINE void OdeContactGeom::
set_g1(const OdeGeom &geom){
_contact_geom.g1 = geom._id;
}
INLINE void OdeContactGeom::
set_g2(const OdeGeom &geom){
_contact_geom.g2 = geom._id;
}

View File

@ -0,0 +1,84 @@
// Filename: odeContactGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeContactGeom.h"
TypeHandle OdeContactGeom::_type_handle;
OdeContactGeom::
OdeContactGeom() :
_contact_geom() {
}
OdeContactGeom::
OdeContactGeom(const OdeContactGeom &copy) :
_contact_geom() {
_contact_geom.pos[0] = copy._contact_geom.pos[0];
_contact_geom.pos[1] = copy._contact_geom.pos[1];
_contact_geom.pos[2] = copy._contact_geom.pos[2];
_contact_geom.normal[0] = copy._contact_geom.normal[0];
_contact_geom.normal[1] = copy._contact_geom.normal[1];
_contact_geom.normal[2] = copy._contact_geom.normal[2];
_contact_geom.depth = copy._contact_geom.depth;
_contact_geom.g1 = copy._contact_geom.g1;
_contact_geom.g2 = copy._contact_geom.g2;
_contact_geom.side1 = copy._contact_geom.side1;
_contact_geom.side2 = copy._contact_geom.side2;
}
OdeContactGeom::
OdeContactGeom(const dContactGeom &contact_geom) :
_contact_geom() {
_contact_geom.pos[0] = contact_geom.pos[0];
_contact_geom.pos[1] = contact_geom.pos[1];
_contact_geom.pos[2] = contact_geom.pos[2];
_contact_geom.normal[0] = contact_geom.normal[0];
_contact_geom.normal[1] = contact_geom.normal[1];
_contact_geom.normal[2] = contact_geom.normal[2];
_contact_geom.depth = contact_geom.depth;
_contact_geom.g1 = contact_geom.g1;
_contact_geom.g2 = contact_geom.g2;
_contact_geom.side1 = contact_geom.side1;
_contact_geom.side2 = contact_geom.side2;
}
OdeContactGeom::
~OdeContactGeom() {
}
const dContactGeom* OdeContactGeom::
get_contact_geom_ptr() const {
return &_contact_geom;
}
void OdeContactGeom::
operator = (const OdeContactGeom &copy) {
_contact_geom.pos[0] = copy._contact_geom.pos[0];
_contact_geom.pos[1] = copy._contact_geom.pos[1];
_contact_geom.pos[2] = copy._contact_geom.pos[2];
_contact_geom.normal[0] = copy._contact_geom.normal[0];
_contact_geom.normal[1] = copy._contact_geom.normal[1];
_contact_geom.normal[2] = copy._contact_geom.normal[2];
_contact_geom.depth = copy._contact_geom.depth;
_contact_geom.g1 = copy._contact_geom.g1;
_contact_geom.g2 = copy._contact_geom.g2;
_contact_geom.side1 = copy._contact_geom.side1;
_contact_geom.side2 = copy._contact_geom.side2;
}

85
panda/src/ode/odeContactGeom.h Executable file
View File

@ -0,0 +1,85 @@
// Filename: odeContactGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODECONTACTGEOM_H
#define ODECONTACTGEOM_H
#include "pandabase.h"
#include "typedReferenceCount.h"
#include "luse.h"
#include "ode/ode.h"
#include "OdeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeContactGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeContactGeom : public TypedReferenceCount {
friend class OdeContact;
protected:
OdeContactGeom(const dContactGeom &contact_geom);
PUBLISHED:
OdeContactGeom();
OdeContactGeom(const OdeContactGeom &copy);
virtual ~OdeContactGeom();
INLINE LVecBase3f get_pos() const;
INLINE LVecBase3f get_normal() const;
INLINE dReal get_depth() const;
INLINE OdeGeom get_g1() const;
INLINE OdeGeom get_g2() const;
INLINE int get_side1() const;
INLINE int get_side2() const;
INLINE void set_pos(const LVecBase3f &pos);
INLINE void set_normal(const LVecBase3f &normal);
INLINE void set_depth(const dReal depth);
INLINE void set_g1(const OdeGeom &geom);
INLINE void set_g2(const OdeGeom &geom);
public:
const dContactGeom* get_contact_geom_ptr() const;
private:
void operator = (const OdeContactGeom &copy);
dContactGeom _contact_geom;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "OdeContactGeom",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeContactGeom.I"
#endif

17
panda/src/ode/odeContactJoint.I Executable file
View File

@ -0,0 +1,17 @@
// Filename: odeContactJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,36 @@
// Filename: odeContactJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeContactJoint.h"
TypeHandle OdeContactJoint::_type_handle;
OdeContactJoint::
OdeContactJoint(OdeWorld &world, const OdeContact &contact) :
OdeJoint(dJointCreateContact(world.get_id(), 0, contact.get_contact_ptr())) {
}
OdeContactJoint::
OdeContactJoint(OdeWorld &world, OdeJointGroup &joint_group, const OdeContact &contact) :
OdeJoint(dJointCreateContact(world.get_id(), joint_group.get_id(), contact.get_contact_ptr())) {
}
OdeContactJoint::
~OdeContactJoint() {
}

View File

@ -0,0 +1,43 @@
#ifndef ODECONTACTJOINT_H
#define ODECONTACTJOINT_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
#include "odeContact.h"
////////////////////////////////////////////////////////////////////
// Class : OdeContactJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeContactJoint : public OdeJoint {
PUBLISHED:
OdeContactJoint(OdeWorld &world, const OdeContact &contact);
OdeContactJoint(OdeWorld &world, OdeJointGroup &joint_group, const OdeContact &contact);
virtual ~OdeContactJoint();
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeContactJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeContactJoint.I"
#endif

23
panda/src/ode/odeConvexGeom.I Executable file
View File

@ -0,0 +1,23 @@
// Filename: odeBoxGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeGeom::
set_convex(dReal *_planes, unsigned int _count, dReal *_points, unsigned int _pointcount, unsigned int *_polygons) {
dGeomSetConvex(_id, *_planes, _count, *_points, _pointcount, *_polygons);
}

View File

@ -0,0 +1,36 @@
// Filename: odeConvexGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeConvexGeom.h"
TypeHandle OdeConvexGeom::_type_handle;
OdeConvexGeom::
OdeConvexGeom(dReal radius, dReal length) :
OdeGeom(dCreateConvex(0, radius, length)) {
}
OdeConvexGeom::
OdeConvexGeom(OdeSpace &space, dReal radius, dReal length) :
OdeGeom(dCreateConvex(space.get_id(), radius, length)) {
}
OdeConvexGeom::
~OdeConvexGeom() {
}

63
panda/src/ode/odeConvexGeom.h Executable file
View File

@ -0,0 +1,63 @@
// Filename: odeConvexGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODECONVEXGEOM_H
#define ODECONVEXGEOM_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeConvexGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeConvexGeom : public OdeGeom {
PUBLISHED:
OdeConvexGeom();
virtual ~OdeConvexGeom();
INLINE void set_convex(dReal *_planes, unsigned int _count, dReal *_points, unsigned int _pointcount, unsigned int *_polygons);
public:
INLINE static int get_geom_class() { return dConvexClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeConvexGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeConvexGeom.I"
#endif

41
panda/src/ode/odeCylinderGeom.I Executable file
View File

@ -0,0 +1,41 @@
// Filename: odeCylinderGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeCylinderGeom::
set_params(dReal radius, dReal length) {
dGeomCylinderSetParams(_id, radius, length);
}
INLINE void OdeCylinderGeom::
get_params(dReal *radius, dReal *length) const {
dGeomCapsuleGetParams(_id, radius, length);
}
INLINE dReal OdeCylinderGeom::
get_radius() const {
dReal radius, length;
dGeomCylinderGetParams(_id, &radius, &length);
return radius;
}
INLINE dReal OdeCylinderGeom::
get_length() const {
dReal radius, length;
dGeomCylinderGetParams(_id, &radius, &length);
return length;
}

View File

@ -0,0 +1,36 @@
// Filename: odeCylinderGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeCylinderGeom.h"
TypeHandle OdeCylinderGeom::_type_handle;
OdeCylinderGeom::
OdeCylinderGeom(dReal radius, dReal length) :
OdeGeom(dCreateCylinder(0, radius, length)) {
}
OdeCylinderGeom::
OdeCylinderGeom(OdeSpace &space, dReal radius, dReal length) :
OdeGeom(dCreateCylinder(space.get_id(), radius, length)) {
}
OdeCylinderGeom::
~OdeCylinderGeom() {
}

67
panda/src/ode/odeCylinderGeom.h Executable file
View File

@ -0,0 +1,67 @@
// Filename: odeCylinderGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODECYLINDERGEOM_H
#define ODECYLINDERGEOM_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeCylinderGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeCylinderGeom : public OdeGeom {
PUBLISHED:
OdeCylinderGeom(dReal radius, dReal length);
OdeCylinderGeom(OdeSpace &space, dReal radius, dReal length);
virtual ~OdeCylinderGeom();
INLINE void set_params(dReal radius, dReal length);
INLINE void get_params(dReal *radius, dReal *length) const;
INLINE dReal get_radius() const;
INLINE dReal get_length() const;
public:
INLINE static int get_geom_class() { return dCylinderClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeCylinderGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeCylinderGeom.I"
#endif

22
panda/src/ode/odeFixedJoint.I Executable file
View File

@ -0,0 +1,22 @@
// Filename: odeFixedJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeFixedJoint::
set_fixed() {
dJointSetFixed(_id);
}

View File

@ -0,0 +1,36 @@
// Filename: odeFixedJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeFixedJoint.h"
TypeHandle OdeFixedJoint::_type_handle;
OdeFixedJoint::
OdeFixedJoint(OdeWorld &world) :
OdeJoint(dJointCreateFixed(world.get_id(), 0)) {
}
OdeFixedJoint::
OdeFixedJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateFixed(world.get_id(), joint_group.get_id())) {
}
OdeFixedJoint::
~OdeFixedJoint() {
}

View File

@ -0,0 +1,44 @@
#ifndef ODEFIXEDJOINT_H
#define ODEFIXEDJOINT_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeFixedJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeFixedJoint : public OdeJoint {
PUBLISHED:
OdeFixedJoint(OdeWorld &world);
OdeFixedJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeFixedJoint();
INLINE void set_fixed();
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeFixedJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeFixedJoint.I"
#endif

190
panda/src/ode/odeGeom.I Executable file
View File

@ -0,0 +1,190 @@
// Filename: odeGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE dGeomID OdeGeom::
get_id() const {
return _id;
}
INLINE OdeBody OdeGeom::
get_body() const {
return OdeBody(dGeomGetBody(_id));
}
INLINE void OdeGeom::
set_body(OdeBody &body) {
dGeomSetBody(_id, body.get_id());
}
/*
INLINE void OdeGeom::
set_data(void* data) {
dGeomSetData(_id, data);
}
*/
INLINE void OdeGeom::
set_position(dReal x, dReal y, dReal z) {
dGeomSetPosition(_id, x, y, z);
}
INLINE void OdeGeom::
set_rotation(const LMatrix3f &r) {
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
r._m.data[3], r._m.data[4], r._m.data[5], 0,
r._m.data[6], r._m.data[7], r._m.data[8], 0 };
dGeomSetRotation(_id, rot);
}
INLINE void OdeGeom::
set_quaternion(const LQuaternionf &q) {
dQuaternion quat = { q[0], q[1], q[2], q[3] };
dGeomSetQuaternion(_id, quat);
}
INLINE LPoint3f OdeGeom::
get_position() const {
const dReal *pos = dGeomGetPosition(_id);
return LPoint3f(pos[0], pos[1], pos[2]);
}
INLINE LMatrix3f OdeGeom::
get_rotation() const {
const dReal *rot = dGeomGetRotation(_id);
return LMatrix3f(rot[0], rot[1], rot[2],
rot[4], rot[5], rot[6],
rot[8], rot[9], rot[10]);
}
INLINE LQuaternionf OdeGeom::
get_quaternion() const {
dQuaternion res;
dGeomGetQuaternion(_id, res);
return LQuaternionf(res[0], res[1], res[2], res[3]);
}
/*
INLINE void OdeGeom::
get_aabb(dReal aabb[6]) const {
return dGeomGetAABB(_id, aabb[6]);
}
*/
INLINE int OdeGeom::
is_space() {
return dGeomIsSpace(_id);
}
INLINE int OdeGeom::
get_class() const {
return dGeomGetClass(_id);
}
INLINE void OdeGeom::
set_category_bits(unsigned long bits) {
dGeomSetCategoryBits(_id, bits);
}
INLINE void OdeGeom::
set_collide_bits(unsigned long bits) {
dGeomSetCollideBits(_id, bits);
}
INLINE void OdeGeom::
enable() {
dGeomEnable(_id);
}
INLINE void OdeGeom::
disable() {
dGeomDisable(_id);
}
INLINE int OdeGeom::
is_enabled() {
return dGeomIsEnabled(_id);
}
INLINE void OdeGeom::
set_offset_position(dReal x, dReal y, dReal z) {
dGeomSetOffsetPosition(_id, x, y, z);
}
INLINE void OdeGeom::
set_offset_rotation(const LMatrix3f &r) {
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
r._m.data[3], r._m.data[4], r._m.data[5], 0,
r._m.data[6], r._m.data[7], r._m.data[8], 0 };
dGeomSetOffsetRotation(_id, rot);
}
INLINE void OdeGeom::
set_offset_quaternion(const LQuaternionf &q) {
dQuaternion quat = { q[0], q[1], q[2], q[3] };
dGeomSetOffsetQuaternion(_id, quat);
}
INLINE void OdeGeom::
set_offset_world_position(dReal x, dReal y, dReal z) {
dGeomSetOffsetWorldPosition(_id, x, y, z);
}
INLINE void OdeGeom::
set_offset_world_rotation(const LMatrix3f &r) {
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
r._m.data[3], r._m.data[4], r._m.data[5], 0,
r._m.data[6], r._m.data[7], r._m.data[8], 0 };
dGeomSetOffsetWorldRotation(_id, rot);
}
INLINE void OdeGeom::
set_offset_world_quaternion(const LQuaternionf &q) {
dQuaternion quat = { q[0], q[1], q[2], q[3] };
dGeomSetOffsetWorldQuaternion(_id, quat);
}
INLINE void OdeGeom::
clear_offset() {
dGeomClearOffset(_id);
}
INLINE int OdeGeom::
is_offset() {
return dGeomIsOffset(_id);
}
INLINE LPoint3f OdeGeom::
get_offset_position() const {
const dReal *pos = dGeomGetOffsetPosition(_id);
return LPoint3f(pos[0], pos[1], pos[2]);
}
INLINE LMatrix3f OdeGeom::
get_offset_rotation() const {
const dReal *rot = dGeomGetOffsetRotation(_id);
return LMatrix3f(rot[0], rot[1], rot[2],
rot[4], rot[5], rot[6],
rot[8], rot[9], rot[10]);
}
INLINE LQuaternionf OdeGeom::
get_offset_quaternion() const {
dQuaternion res;
dGeomGetOffsetQuaternion(_id, res);
return LQuaternionf(res[0], res[1], res[2], res[3]);
}

60
panda/src/ode/odeGeom.cxx Executable file
View File

@ -0,0 +1,60 @@
// Filename: odeGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeGeom.h"
TypeHandle OdeGeom::_type_handle;
OdeGeom::
OdeGeom() :
_id(0) {
odegeom_cat.debug() << get_type() << "(" << _id << ")\n";
}
OdeGeom::
OdeGeom(dGeomID id) :
_id(id) {
odegeom_cat.debug() << get_type() << "(" << _id << ")\n";
}
OdeGeom::
~OdeGeom() {
}
void OdeGeom::
destroy() {
if (get_class() == OdeTriMeshGeom::get_geom_class()) {
OdeTriMeshGeom::unlink_data(_id);
}
}
void OdeGeom::
get_space(OdeSpace &space) const {
space._id = dGeomGetSpace(_id);
}
void OdeGeom::
write(ostream &out, unsigned int indent) const {
#ifndef NDEBUG //[
out.width(indent);
out << get_type() << "(id = " << _id << ")";
#endif //] NDEBUG
}

107
panda/src/ode/odeGeom.h Executable file
View File

@ -0,0 +1,107 @@
// Filename: odeGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEGEOM_H
#define ODEGEOM_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeSpace.h" // Needed for derived classes
#include "odeBody.h"
class OdeTriMeshGeom;
////////////////////////////////////////////////////////////////////
// Class : OdeGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeGeom : public TypedObject {
friend class OdeContactGeom;
friend class OdeSpace;
protected:
OdeGeom(dGeomID id);
PUBLISHED:
OdeGeom();
virtual ~OdeGeom();
void destroy();
//INLINE void set_data(void* data);
INLINE void set_body(OdeBody &body);
INLINE OdeBody get_body() const;
INLINE void set_position(dReal x, dReal y, dReal z);
INLINE void set_rotation(const LMatrix3f &r);
INLINE void set_quaternion(const LQuaternionf &q);
INLINE LPoint3f get_position() const;
INLINE LMatrix3f get_rotation() const;
INLINE LQuaternionf get_quaternion() const;
//INLINE void get_aabb(dReal aabb[6]) const;
INLINE int is_space();
INLINE int get_class() const;
INLINE void set_category_bits(unsigned long bits);
INLINE void set_collide_bits(unsigned long bits);
INLINE void enable();
INLINE void disable();
INLINE int is_enabled();
INLINE void set_offset_position(dReal x, dReal y, dReal z);
INLINE void set_offset_rotation(const LMatrix3f &r);
INLINE void set_offset_quaternion(const LQuaternionf &q);
INLINE void set_offset_world_position(dReal x, dReal y, dReal z);
INLINE void set_offset_world_rotation(const LMatrix3f &r);
INLINE void set_offset_world_quaternion(const LQuaternionf &q);
INLINE void clear_offset();
INLINE int is_offset();
INLINE LPoint3f get_offset_position() const;
INLINE LMatrix3f get_offset_rotation() const;
INLINE LQuaternionf get_offset_quaternion() const;
void get_space(OdeSpace &space) const;
virtual void write(ostream &out = cout, unsigned int indent=0) const;
public:
INLINE dGeomID get_id() const;
INLINE static int get_geom_class() { return -1; };
protected:
dGeomID _id;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeGeom",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeGeom.I"
#endif

36
panda/src/ode/odeHashSpace.I Executable file
View File

@ -0,0 +1,36 @@
// Filename: odeHashSpace.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeHashSpace::
set_levels(int minlevel, int maxlevel) {
dHashSpaceSetLevels(_id, minlevel, maxlevel);
}
INLINE int OdeHashSpace::
get_min_level() const {
int min, max;
dHashSpaceGetLevels(_id, &min, &max);
return min;
}
INLINE int OdeHashSpace::
get_max_level() const {
int min, max;
dHashSpaceGetLevels(_id, &min, &max);
return max;
}

37
panda/src/ode/odeHashSpace.cxx Executable file
View File

@ -0,0 +1,37 @@
// Filename: odeHashSpace.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeHashSpace.h"
TypeHandle OdeHashSpace::_type_handle;
OdeHashSpace::
OdeHashSpace() :
OdeSpace(dHashSpaceCreate(0)) {
}
OdeHashSpace::
OdeHashSpace(OdeSpace &space) :
OdeSpace(dHashSpaceCreate(space.get_id())) {
}
OdeHashSpace::
~OdeHashSpace() {
}

65
panda/src/ode/odeHashSpace.h Executable file
View File

@ -0,0 +1,65 @@
// Filename: odeHashSpace.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEHASHSPACE_H
#define ODEHASHSPACE_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeSpace.h"
////////////////////////////////////////////////////////////////////
// Class : OdeHashSpace
// Description :
////////////////////////////////////////////////////////////////////c
class EXPCL_PANDAODE OdeHashSpace : public OdeSpace {
PUBLISHED:
OdeHashSpace();
OdeHashSpace(OdeSpace &space);
virtual ~OdeHashSpace();
INLINE void set_levels(int minlevel, int maxlevel);
INLINE int get_min_level() const;
INLINE int get_max_level() const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeSpace::init_type();
register_type(_type_handle, "OdeHashSpace",
OdeSpace::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeHashSpace.I"
#endif

View File

@ -0,0 +1,68 @@
// Filename: odeBoxGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEBOXGEOM_H
#define ODEBOXGEOM_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeBoxGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeBoxGeom : public OdeGeom {
PUBLISHED:
OdeBoxGeom();
virtual ~OdeBoxGeom();
INLINE dHeightfieldDataID heightfield_data_create();
INLINE void heightfield_data_destroy(dHeightfieldDataID d);
INLINE void heightfield_data_build_callback(dHeightfieldDataID d, void* p_user_data, dHeightfieldGetHeight* p_callback, dReal width, dReal depth, int width_samples, int depth_samples, dReal scale, dReal offset, dReal thickness, int b_wrap);
INLINE void heightfield_data_build_byte(dHeightfieldDataID d, const unsigned char* p_height_data, int b_copy_height_data, dReal width, dReal depth, int width_samples, int depth_samples, dReal scale, dReal offset, dReal thickness, int b_wrap);
INLINE void heightfield_data_build_short(dHeightfieldDataID d, const short* p_height_data, int b_copy_height_data, dReal width, dReal depth, int width_samples, int depth_samples, dReal scale, dReal offset, dReal thickness, int b_wrap);
INLINE void heightfield_data_build_single(dHeightfieldDataID d, const float* p_height_data, int b_copy_height_data, dReal width, dReal depth, int width_samples, int depth_samples, dReal scale, dReal offset, dReal thickness, int b_wrap);
INLINE void heightfield_data_build_double(dHeightfieldDataID d, const double* p_height_data, int b_copy_height_data, dReal width, dReal depth, int width_samples, int depth_samples, dReal scale, dReal offset, dReal thickness, int b_wrap);
INLINE void heightfield_data_set_bounds(dHeightfieldDataID d, dReal min_height, dReal max_height);
INLINE void heightfield_set_heightfield_data(dHeightfieldDataID d);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeBoxGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeBoxGeom.I"
#endif

83
panda/src/ode/odeHinge2Joint.I Executable file
View File

@ -0,0 +1,83 @@
// Filename: odeHinge2Joint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeHinge2Joint::
set_hinge2_anchor(dReal x, dReal y, dReal z) {
dJointSetHinge2Anchor(_id, x, y, z);
}
INLINE void OdeHinge2Joint::
set_hinge2_axis1(dReal x, dReal y, dReal z) {
dJointSetHinge2Axis1(_id, x, y, z);
}
INLINE void OdeHinge2Joint::
set_hinge2_axis2(dReal x, dReal y, dReal z) {
dJointSetHinge2Axis2(_id, x, y, z);
}
INLINE void OdeHinge2Joint::
set_hinge2_param(int parameter, dReal value) {
dJointSetHinge2Param(_id, parameter, value);
}
INLINE void OdeHinge2Joint::
add_hinge2_torques(dReal torque1, dReal torque2) {
dJointAddHinge2Torques(_id, torque1, torque2);
}
INLINE void OdeHinge2Joint::
get_hinge2_anchor(dVector3 result) const {
return dJointGetHinge2Anchor(_id, result);
}
INLINE void OdeHinge2Joint::
get_hinge2_anchor2(dVector3 result) const {
return dJointGetHinge2Anchor2(_id, result);
}
INLINE void OdeHinge2Joint::
get_hinge2_axis1(dVector3 result) const {
return dJointGetHinge2Axis1(_id, result);
}
INLINE void OdeHinge2Joint::
get_hinge2_axis2(dVector3 result) const {
return dJointGetHinge2Axis2(_id, result);
}
INLINE dReal OdeHinge2Joint::
get_hinge2_param(int parameter) const {
return dJointGetHinge2Param(_id, parameter);
}
INLINE dReal OdeHinge2Joint::
get_hinge2_angle1() const {
return dJointGetHinge2Angle1(_id);
}
INLINE dReal OdeHinge2Joint::
get_hinge2_angle1_rate() const {
return dJointGetHinge2Angle1Rate(_id);
}
INLINE dReal OdeHinge2Joint::
get_hinge2_angle2_rate() const {
return dJointGetHinge2Angle2Rate(_id);
}

View File

@ -0,0 +1,36 @@
// Filename: odeHinge2Joint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeHinge2Joint.h"
TypeHandle OdeHinge2Joint::_type_handle;
OdeHinge2Joint::
OdeHinge2Joint(OdeWorld &world) :
OdeJoint(dJointCreateHinge2(world.get_id(), 0)) {
}
OdeHinge2Joint::
OdeHinge2Joint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateHinge2(world.get_id(), joint_group.get_id())) {
}
OdeHinge2Joint::
~OdeHinge2Joint() {
}

View File

@ -0,0 +1,57 @@
#ifndef ODEHINGE2JOINT_H
#define ODEHINGE2JOINT_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeHinge2Joint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeHinge2Joint : public OdeJoint {
PUBLISHED:
OdeHinge2Joint(OdeWorld &world, OdeJointGroup &joint_group);
OdeHinge2Joint(OdeWorld &world);
virtual ~OdeHinge2Joint();
INLINE void set_hinge2_anchor(dReal x, dReal y, dReal z);
INLINE void set_hinge2_axis1(dReal x, dReal y, dReal z);
INLINE void set_hinge2_axis2(dReal x, dReal y, dReal z);
INLINE void set_hinge2_param(int parameter, dReal value);
INLINE void add_hinge2_torques(dReal torque1, dReal torque2);
INLINE void get_hinge2_anchor(dVector3 result) const;
INLINE void get_hinge2_anchor2(dVector3 result) const;
INLINE void get_hinge2_axis1(dVector3 result) const;
INLINE void get_hinge2_axis2(dVector3 result) const;
INLINE dReal get_hinge2_param(int parameter) const;
INLINE dReal get_hinge2_angle1() const;
INLINE dReal get_hinge2_angle1_rate() const;
INLINE dReal get_hinge2_angle2_rate() const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeHinge2Joint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeHinge2Joint.I"
#endif

73
panda/src/ode/odeHingeJoint.I Executable file
View File

@ -0,0 +1,73 @@
// Filename: odeHingeJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeHingeJoint::
set_hinge_anchor(dReal x, dReal y, dReal z) {
dJointSetHingeAnchor(_id, x, y, z);
}
INLINE void OdeHingeJoint::
set_hinge_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) {
dJointSetHingeAnchorDelta(_id, x, y, z, ax, ay, az);
}
INLINE void OdeHingeJoint::
set_hinge_axis(dReal x, dReal y, dReal z) {
dJointSetHingeAxis(_id, x, y, z);
}
INLINE void OdeHingeJoint::
set_hinge_param(int parameter, dReal value) {
dJointSetHingeParam(_id, parameter, value);
}
INLINE void OdeHingeJoint::
add_hinge_torque(dReal torque) {
dJointAddHingeTorque(_id, torque);
}
INLINE void OdeHingeJoint::
get_hinge_anchor(dVector3 result) const {
return dJointGetHingeAnchor(_id, result);
}
INLINE void OdeHingeJoint::
get_hinge_anchor2(dVector3 result) const {
return dJointGetHingeAnchor2(_id, result);
}
INLINE void OdeHingeJoint::
get_hinge_axis(dVector3 result) const {
return dJointGetHingeAxis(_id, result);
}
INLINE dReal OdeHingeJoint::
get_hinge_param(int parameter) const {
return dJointGetHingeParam(_id, parameter);
}
INLINE dReal OdeHingeJoint::
get_hinge_angle() const {
return dJointGetHingeAngle(_id);
}
INLINE dReal OdeHingeJoint::
get_hinge_angle_rate() const {
return dJointGetHingeAngleRate(_id);
}

View File

@ -0,0 +1,36 @@
// Filename: odeHingeJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeHingeJoint.h"
TypeHandle OdeHingeJoint::_type_handle;
OdeHingeJoint::
OdeHingeJoint(OdeWorld &world) :
OdeJoint(dJointCreateHinge(world.get_id(), 0)) {
}
OdeHingeJoint::
OdeHingeJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateHinge(world.get_id(), joint_group.get_id())) {
}
OdeHingeJoint::
~OdeHingeJoint() {
}

54
panda/src/ode/odeHingeJoint.h Executable file
View File

@ -0,0 +1,54 @@
#ifndef ODEHINGEJOINT_H
#define ODEHINGEJOINT_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeHingeJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeHingeJoint : public OdeJoint {
PUBLISHED:
OdeHingeJoint(OdeWorld &world);
OdeHingeJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeHingeJoint();
INLINE void set_hinge_anchor(dReal x, dReal y, dReal z);
INLINE void set_hinge_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
INLINE void set_hinge_axis(dReal x, dReal y, dReal z);
INLINE void set_hinge_param(int parameter, dReal value);
INLINE void add_hinge_torque(dReal torque);
INLINE void get_hinge_anchor(dVector3 result) const;
INLINE void get_hinge_anchor2(dVector3 result) const;
INLINE void get_hinge_axis(dVector3 result) const;
INLINE dReal get_hinge_param(int parameter) const;
INLINE dReal get_hinge_angle() const;
INLINE dReal get_hinge_angle_rate() const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeHingeJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeHingeJoint.I"
#endif

47
panda/src/ode/odeJoint.I Executable file
View File

@ -0,0 +1,47 @@
// Filename: odeJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE dJointID OdeJoint::
get_id() const {
return _id;
}
INLINE void OdeJoint::
set_data(void *data) {
dJointSetData(_id, data);
}
INLINE void *OdeJoint::
get_data() {
return dJointGetData(_id);
}
INLINE int OdeJoint::
get_joint_type() const {
return dJointGetType(_id);
}
INLINE void OdeJoint::
set_feedback(dJointFeedback *feedback) {
dJointSetFeedback(_id, feedback);
}
INLINE dJointFeedback *OdeJoint::
get_feedback() {
return dJointGetFeedback(_id);
}

89
panda/src/ode/odeJoint.cxx Executable file
View File

@ -0,0 +1,89 @@
// Filename: odeJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeJoint.h"
TypeHandle OdeJoint::_type_handle;
OdeJoint::
OdeJoint(dJointID id) :
_id(id) {
ostream &out = odejoint_cat.debug();
out << get_type() << "(" << _id << ")\n";
}
OdeJoint::
~OdeJoint() {
}
void OdeJoint::
destroy() {
dJointDestroy(_id);
}
void OdeJoint::
attach(const OdeBody &body1, const OdeBody &body2) {
dJointAttach(_id, body1.get_id(), body2.get_id());
}
void OdeJoint::
attach(const OdeBody &body, int index) {
if (index == 0) {
dJointAttach(_id, body.get_id(), 0);
} else {
dJointAttach(_id, 0, body.get_id());
}
}
void OdeJoint::
detach() {
dJointAttach(_id, 0, 0);
}
void OdeJoint::
get_body(int index, OdeBody &body) const {
body._id = dJointGetBody(_id, index);
}
void OdeJoint::
write(ostream &out, unsigned int indent) const {
#ifndef NDEBUG //[
out.width(indent); out << "" << get_type() \
<< "(id = " << _id \
<< ", body1 = ";
OdeBody body;
get_body(0, body);
if (body.get_id() != 0) {
body.write(out);
}
else {
out << "0";
}
out << ", body2 = ";
get_body(1, body);
if (body.get_id() != 0) {
body.write(out);
}
else {
out << "0";
}
out << ")";
#endif //] NDEBUG
}

88
panda/src/ode/odeJoint.h Executable file
View File

@ -0,0 +1,88 @@
// Filename: odeJoint.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEJOINT_H
#define ODEJOINT_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeWorld.h" // Needed for derived classes
#include "odeJointGroup.h"
class OdeBody;
////////////////////////////////////////////////////////////////////
// Class : OdeJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeJoint : public TypedObject {
friend class OdeBody;
friend class OdeUtil;
protected:
OdeJoint(dJointID id);
PUBLISHED:
virtual ~OdeJoint();
void destroy();
INLINE void set_data(void *data);
INLINE void *get_data();
INLINE int get_joint_type() const;
void get_body(int index, OdeBody &body) const;
INLINE void set_feedback(dJointFeedback *);
INLINE dJointFeedback *get_feedback();
void attach(const OdeBody &body1, const OdeBody &body2);
void attach(const OdeBody &body, int index);
void detach();
virtual void write(ostream &out = cout, unsigned int indent=0) const;
public:
INLINE dJointID get_id() const;
protected:
dJointID _id;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeJoint",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeJoint.I"
#endif

28
panda/src/ode/odeJointGroup.I Executable file
View File

@ -0,0 +1,28 @@
// Filename: odeJointGroup.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE dJointGroupID OdeJointGroup::
get_id() const {
return _id;
}
INLINE void OdeJointGroup::
empty() const {
dJointGroupEmpty(_id);
}

36
panda/src/ode/odeJointGroup.cxx Executable file
View File

@ -0,0 +1,36 @@
// Filename: odeJointGroup.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeJointGroup.h"
TypeHandle OdeJointGroup::_type_handle;
OdeJointGroup::
OdeJointGroup() :
_id(dJointGroupCreate(0)) {
}
OdeJointGroup::
~OdeJointGroup() {
}
void OdeJointGroup::
destroy() {
dJointGroupDestroy(_id);
}

67
panda/src/ode/odeJointGroup.h Executable file
View File

@ -0,0 +1,67 @@
// Filename: odeJointGroup.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEJOINTGROUP_H
#define ODEJOINTGROUP_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
////////////////////////////////////////////////////////////////////
// Class : OdeJointGroup
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeJointGroup : public TypedObject {
PUBLISHED:
OdeJointGroup();
virtual ~OdeJointGroup();
void destroy();
INLINE void empty() const;
public:
INLINE dJointGroupID get_id() const;
private:
dJointGroupID _id;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeJointGroup",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeJointGroup.I"
#endif

49
panda/src/ode/odeLMotorJoint.I Executable file
View File

@ -0,0 +1,49 @@
// Filename: odeLMotorJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeLMotorJoint::
set_l_motor_num_axes(int num) {
dJointSetLMotorNumAxes(_id, num);
}
INLINE void OdeLMotorJoint::
set_l_motor_axis(int anum, int rel, dReal x, dReal y, dReal z) {
dJointSetLMotorAxis(_id, anum, rel, x, y, z);
}
INLINE void OdeLMotorJoint::
set_l_motor_param(int parameter, dReal value) {
dJointSetLMotorParam(_id, parameter, value);
}
INLINE int OdeLMotorJoint::
get_l_motor_num_axes() const {
return dJointGetLMotorNumAxes(_id);
}
INLINE void OdeLMotorJoint::
get_l_motor_axis(int anum, dVector3 result) const {
return dJointGetLMotorAxis(_id, anum, result);
}
INLINE dReal OdeLMotorJoint::
get_l_motor_param(int parameter) const {
return dJointGetLMotorParam(_id, parameter);
}

View File

@ -0,0 +1,36 @@
// Filename: odeLMotorJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeLMotorJoint.h"
TypeHandle OdeLMotorJoint::_type_handle;
OdeLMotorJoint::
OdeLMotorJoint(OdeWorld &world ) :
OdeJoint(dJointCreateLMotor(world.get_id(), 0)) {
}
OdeLMotorJoint::
OdeLMotorJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateLMotor(world.get_id(), joint_group.get_id())) {
}
OdeLMotorJoint::
~OdeLMotorJoint() {
}

49
panda/src/ode/odeLMotorJoint.h Executable file
View File

@ -0,0 +1,49 @@
#ifndef ODELMOTORJOINT_H
#define ODELMOTORJOINT_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeLMotorJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeLMotorJoint : public OdeJoint {
PUBLISHED:
OdeLMotorJoint(OdeWorld &world);
OdeLMotorJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeLMotorJoint();
INLINE void set_l_motor_num_axes(int num);
INLINE void set_l_motor_axis(int anum, int rel, dReal x, dReal y, dReal z);
INLINE void set_l_motor_param(int parameter, dReal value);
INLINE int get_l_motor_num_axes() const;
INLINE void get_l_motor_axis(int anum, dVector3 result) const;
INLINE dReal get_l_motor_param(int parameter) const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeLMotorJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeLMotorJoint.I"
#endif

130
panda/src/ode/odeMass.I Executable file
View File

@ -0,0 +1,130 @@
// Filename: odeMass.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE int OdeMass::
check() {
return dMassCheck(&_mass);
}
INLINE void OdeMass::
set_zero() {
_mass.setZero();
}
INLINE void OdeMass::
set_parameters(dReal themass,
dReal cgx, dReal cgy, dReal cgz,
dReal I11, dReal I22, dReal I33,
dReal I12, dReal I13, dReal I23) {
_mass.setParameters(themass,
cgx, cgy, cgz,
I11, I22, I33,
I12, I13, I23);
}
INLINE void OdeMass::
set_sphere(dReal density, dReal radius) {
_mass.setSphere(density, radius);
}
INLINE void OdeMass::
set_sphere_total(dReal total_mass, dReal radius) {
dMassSetSphereTotal(&_mass, total_mass, radius);
}
INLINE void OdeMass::
set_capsule(dReal density, int direction,
dReal radius, dReal length) {
_mass.setCapsule(density, direction,
radius, length);
}
INLINE void OdeMass::
set_capsule_total(dReal total_mass, int direction,
dReal radius, dReal length) {
dMassSetCapsuleTotal(&_mass,
total_mass, direction,
radius, length);
}
INLINE void OdeMass::
set_cylinder(dReal density, int direction,
dReal radius, dReal length) {
dMassSetCylinder(&_mass,
density,direction,
radius,length);
}
INLINE void OdeMass::
set_cylinder_total(dReal total_mass, int direction,
dReal radius, dReal length) {
dMassSetCylinderTotal(&_mass, total_mass, direction,
radius, length);
}
INLINE void OdeMass::
set_box(dReal density,
dReal lx, dReal ly, dReal lz) {
_mass.setBox(density,
lx, ly, lz);
}
INLINE void OdeMass::
set_box_total(dReal total_mass,
dReal lx, dReal ly, dReal lz) {
dMassSetBoxTotal(&_mass,
total_mass,
lx, ly, lz);
}
INLINE void OdeMass::
adjust(dReal newmass) {
_mass.adjust(newmass);
}
INLINE void OdeMass::
translate(dReal x, dReal y, dReal z) {
_mass.translate(x, y, z);
}
INLINE void OdeMass::
rotate(const dMatrix3 R) {
_mass.rotate(R);
}
INLINE void OdeMass::
add(OdeMass &other) {
_mass.add(other.get_mass_ptr());
}
INLINE dReal OdeMass::
get_magnitude() const {
return _mass.mass;
}
INLINE LPoint3f OdeMass::
get_center() const {
return LPoint3f(_mass.c[0], _mass.c[1], _mass.c[2]);
}
INLINE LMatrix3f OdeMass::
get_inertia() const {
return LMatrix3f(_mass.I[0], _mass.I[1], _mass.I[2] ,
_mass.I[4], _mass.I[5], _mass.I[6] ,
_mass.I[8], _mass.I[9], _mass.I[10]);
}

67
panda/src/ode/odeMass.cxx Executable file
View File

@ -0,0 +1,67 @@
// Filename: odeMass.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeMass.h"
TypeHandle OdeMass::_type_handle;
OdeMass::
OdeMass() :
_mass() {
}
OdeMass::
OdeMass(const OdeMass &copy) :
_mass() {
_mass.setParameters(copy._mass.mass,
copy._mass.c[0], copy._mass.c[1], copy._mass.c[2],
copy._mass.I[0], copy._mass.I[5], copy._mass.I[10],
copy._mass.I[1], copy._mass.I[2], copy._mass.I[4]);
}
OdeMass::
~OdeMass() {
}
dMass* OdeMass::
get_mass_ptr() {
return &_mass;
}
void OdeMass::
operator = (const OdeMass &copy) {
_mass.setParameters(copy._mass.mass,
copy._mass.c[0], copy._mass.c[1], copy._mass.c[2],
copy._mass.I[0], copy._mass.I[5], copy._mass.I[10],
copy._mass.I[1], copy._mass.I[2], copy._mass.I[4]);
}
void OdeMass::
write(ostream &out, unsigned int indent) const {
#ifndef NDEBUG //[
out.width(indent);
out << get_type() \
<< "(mag = " << get_magnitude() \
<< ", center = " << get_center() \
<< ", inertia = " << get_inertia() \
<< ")";
#endif //] NDEBUG
}

96
panda/src/ode/odeMass.h Executable file
View File

@ -0,0 +1,96 @@
// Filename: odeMass.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEMASS_H
#define ODEMASS_H
#include "pandabase.h"
#include "typedReferenceCount.h"
#include "luse.h"
#include "ode/ode.h"
////////////////////////////////////////////////////////////////////
// Class : OdeMass
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeMass : public TypedReferenceCount {
PUBLISHED:
OdeMass();
OdeMass(const OdeMass &copy);
virtual ~OdeMass();
INLINE int check();
INLINE void set_zero();
INLINE void set_parameters(dReal themass,
dReal cgx, dReal cgy, dReal cgz,
dReal I11, dReal I22, dReal I33,
dReal I12, dReal I13, dReal I23);
INLINE void set_sphere(dReal density, dReal radius);
INLINE void set_sphere_total(dReal total_mass, dReal radius);
INLINE void set_capsule(dReal density, int direction,
dReal radius, dReal length);
INLINE void set_capsule_total(dReal total_mass, int direction,
dReal radius, dReal length);
INLINE void set_cylinder(dReal density, int direction,
dReal radius, dReal length);
INLINE void set_cylinder_total(dReal total_mass, int direction,
dReal radius, dReal length);
INLINE void set_box(dReal density,
dReal lx, dReal ly, dReal lz);
INLINE void set_box_total(dReal total_mass,
dReal lx, dReal ly, dReal lz);
INLINE void adjust(dReal newmass);
INLINE void translate(dReal x, dReal y, dReal z);
INLINE void rotate(const dMatrix3 R);
INLINE void add(OdeMass &other);
INLINE dReal get_magnitude() const;
INLINE LPoint3f get_center() const;
INLINE LMatrix3f get_inertia() const;
virtual void write(ostream &out = cout, unsigned int indent=0) const;
public:
dMass* get_mass_ptr();
private:
void operator = (const OdeMass &copy);
dMass _mass;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "OdeMass",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeMass.I"
#endif

17
panda/src/ode/odeNullJoint.I Executable file
View File

@ -0,0 +1,17 @@
// Filename: odeNullJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,36 @@
// Filename: odeNullJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeNullJoint.h"
TypeHandle OdeNullJoint::_type_handle;
OdeNullJoint::
OdeNullJoint(OdeWorld &world) :
OdeJoint(dJointCreateNull(world.get_id(), 0)) {
}
OdeNullJoint::
OdeNullJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateNull(world.get_id(), joint_group.get_id())) {
}
OdeNullJoint::
~OdeNullJoint() {
}

41
panda/src/ode/odeNullJoint.h Executable file
View File

@ -0,0 +1,41 @@
#ifndef ODENULLJOINT_H
#define ODENULLJOINT_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeNullJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeNullJoint : public OdeJoint {
PUBLISHED:
OdeNullJoint(OdeWorld &world);
OdeNullJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeNullJoint();
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeNullJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeNullJoint.I"
#endif

32
panda/src/ode/odePlane2dJoint.I Executable file
View File

@ -0,0 +1,32 @@
// Filename: odePlane2dJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdePlane2dJoint::
set_plane2_dxparam(int parameter, dReal value) {
dJointSetPlane2DXParam(_id, parameter, value);
}
INLINE void OdePlane2dJoint::
set_plane2_dyparam(int parameter, dReal value) {
dJointSetPlane2DYParam(_id, parameter, value);
}
INLINE void OdePlane2dJoint::
set_plane2_dangle_param(int parameter, dReal value) {
dJointSetPlane2DAngleParam(_id, parameter, value);
}

View File

@ -0,0 +1,36 @@
// Filename: odePlane2dJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odePlane2dJoint.h"
TypeHandle OdePlane2dJoint::_type_handle;
OdePlane2dJoint::
OdePlane2dJoint(OdeWorld &world) :
OdeJoint(dJointCreatePlane2D(world.get_id(), 0)) {
}
OdePlane2dJoint::
OdePlane2dJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreatePlane2D(world.get_id(), joint_group.get_id())) {
}
OdePlane2dJoint::
~OdePlane2dJoint() {
}

45
panda/src/ode/odePlane2dJoint.h Executable file
View File

@ -0,0 +1,45 @@
#ifndef ODEPLANE2DJOINT_H
#define ODEPLANE2DJOINT_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdePlane2dJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdePlane2dJoint : public OdeJoint {
PUBLISHED:
OdePlane2dJoint(OdeWorld &world);
OdePlane2dJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdePlane2dJoint();
INLINE void set_plane2_dxparam(int parameter, dReal value);
INLINE void set_plane2_dyparam(int parameter, dReal value);
INLINE void set_plane2_dangle_param(int parameter, dReal value);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdePlane2dJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odePlane2dJoint.I"
#endif

34
panda/src/ode/odePlaneGeom.I Executable file
View File

@ -0,0 +1,34 @@
// Filename: odePlaneGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdePlaneGeom::
set_params(dReal a, dReal b, dReal c, dReal d) {
dGeomPlaneSetParams(_id, a, b, c, d);
}
INLINE LVecBase4f OdePlaneGeom::
get_params() const {
dVector4 res;
dGeomPlaneGetParams(_id, res);
return LVecBase4f(res[0], res[1], res[2], res[3]);
}
INLINE dReal OdePlaneGeom::
get_point_depth(dReal x, dReal y, dReal z) const {
return dGeomPlanePointDepth(_id, x, y, z);
}

View File

@ -0,0 +1,36 @@
// Filename: odePlaneGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odePlaneGeom.h"
TypeHandle OdePlaneGeom::_type_handle;
OdePlaneGeom::
OdePlaneGeom(dReal a, dReal b, dReal c, dReal d) :
OdeGeom(dCreatePlane(0, a, b, c, d)) {
}
OdePlaneGeom::
OdePlaneGeom(OdeSpace &space, dReal a, dReal b, dReal c, dReal d) :
OdeGeom(dCreatePlane(space.get_id(), a, b, c, d)) {
}
OdePlaneGeom::
~OdePlaneGeom() {
}

65
panda/src/ode/odePlaneGeom.h Executable file
View File

@ -0,0 +1,65 @@
// Filename: odePlaneGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEPLANEGEOM_H
#define ODEPLANEGEOM_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdePlaneGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdePlaneGeom : public OdeGeom {
PUBLISHED:
OdePlaneGeom(dReal a, dReal b, dReal c, dReal d);
OdePlaneGeom(OdeSpace &space, dReal a, dReal b, dReal c, dReal d);
virtual ~OdePlaneGeom();
INLINE void set_params(dReal a, dReal b, dReal c, dReal d);
INLINE LVecBase4f get_params() const;
INLINE dReal get_point_depth(dReal x, dReal y, dReal z) const;
public:
INLINE static int get_geom_class() { return dPlaneClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdePlaneGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odePlaneGeom.I"
#endif

View File

@ -0,0 +1,18 @@
// Filename: odeQuadTreeSpace.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,61 @@
// Filename: odeQuadTreeSpace.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeQuadTreeSpace.h"
TypeHandle OdeQuadTreeSpace::_type_handle;
typedef struct { dVector4 vec; } sdVector4;
sdVector4 LVec3TodVector4(const LVecBase3f& vec) {
sdVector4 sdVec4;
sdVec4.vec[0] = vec[0];
sdVec4.vec[1] = vec[1];
sdVec4.vec[2] = vec[2];
sdVec4.vec[3] = 0;
return sdVec4;
}
OdeQuadTreeSpace::
OdeQuadTreeSpace(const LPoint3f &center,
const LVecBase3f &extents,
const int depth) :
OdeSpace(dQuadTreeSpaceCreate(0,
LVec3TodVector4(center).vec,
LVec3TodVector4(extents).vec,
depth)) {
}
OdeQuadTreeSpace::
OdeQuadTreeSpace(OdeSpace &space,
const LPoint3f &center,
const LVecBase3f &extents,
const int depth) :
OdeSpace(dQuadTreeSpaceCreate(space.get_id(),
LVec3TodVector4(center).vec,
LVec3TodVector4(extents).vec,
depth)) {
}
OdeQuadTreeSpace::
~OdeQuadTreeSpace() {
}

View File

@ -0,0 +1,65 @@
// Filename: odeQuadTreeSpace.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODEQUADTREESPACE_H
#define ODEQUADTREESPACE_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeSpace.h"
////////////////////////////////////////////////////////////////////
// Class : OdeQuadTreeSpace
// Description :
////////////////////////////////////////////////////////////////////c
class EXPCL_PANDAODE OdeQuadTreeSpace : public OdeSpace {
PUBLISHED:
OdeQuadTreeSpace(const LPoint3f &center,
const LVecBase3f &extents,
const int depth);
OdeQuadTreeSpace(OdeSpace &space,
const LPoint3f &center,
const LVecBase3f &extents,
const int depth);
virtual ~OdeQuadTreeSpace();
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeSpace::init_type();
register_type(_type_handle, "OdeQuadTreeSpace",
OdeSpace::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeQuadTreeSpace.I"
#endif

88
panda/src/ode/odeRayGeom.I Executable file
View File

@ -0,0 +1,88 @@
// Filename: odeRayGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeRayGeom::
set_length(dReal length) {
dGeomRaySetLength(_id, length);
}
INLINE dReal OdeRayGeom::
get_length() {
return dGeomRayGetLength(_id);
}
INLINE void OdeRayGeom::
set(dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz) {
dGeomRaySet(_id, px, py, pz, dx, dy, dz);
}
INLINE void OdeRayGeom::
get(LVecBase3f &start, LVecBase3f &dir) const {
dVector3 s, d;
dGeomRayGet(_id, s, d);
start.set(s[0], s[1], s[2]);
dir.set(d[0], d[1], d[2]);
}
INLINE LVecBase3f OdeRayGeom::
get_start() const {
dVector3 start, dir;
dGeomRayGet(_id, start, dir);
return LVecBase3f(start[0], start[1], start[2]);
}
INLINE LVecBase3f OdeRayGeom::
get_direction() const {
dVector3 start, dir;
dGeomRayGet(_id, start, dir);
return LVecBase3f(dir[0], dir[1], dir[2]);
}
INLINE void OdeRayGeom::
set_params(int first_contact, int backface_cull) {
dGeomRaySetParams(_id, first_contact, backface_cull);
}
INLINE void OdeRayGeom::
get_params(int &first_contact, int &backface_cull) const {
dGeomRayGetParams(_id, &first_contact, &backface_cull);
}
INLINE int OdeRayGeom::
get_first_contact() const {
int fc, bc;
dGeomRayGetParams(_id, &fc, &bc);
return fc;
}
INLINE int OdeRayGeom::
get_backface_cull() const {
int fc, bc;
dGeomRayGetParams(_id, &fc, &bc);
return bc;
}
INLINE void OdeRayGeom::
set_closest_hit(int closest_hit) {
dGeomRaySetClosestHit(_id, closest_hit);
}
INLINE int OdeRayGeom::
get_closest_hit() {
return dGeomRayGetClosestHit(_id);
}

View File

@ -0,0 +1,36 @@
// Filename: odeRayGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeRayGeom.h"
TypeHandle OdeRayGeom::_type_handle;
OdeRayGeom::
OdeRayGeom(dReal length) :
OdeGeom(dCreateRay(0, length)) {
}
OdeRayGeom::
OdeRayGeom(OdeSpace &space, dReal length) :
OdeGeom(dCreateRay(space.get_id(), length)) {
}
OdeRayGeom::
~OdeRayGeom() {
}

74
panda/src/ode/odeRayGeom.h Executable file
View File

@ -0,0 +1,74 @@
// Filename: odeRayGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODERAYGEOM_H
#define ODERAYGEOM_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeRayGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeRayGeom : public OdeGeom {
PUBLISHED:
OdeRayGeom(dReal length);
OdeRayGeom(OdeSpace &space, dReal length);
virtual ~OdeRayGeom();
INLINE void set_length(dReal length);
INLINE dReal get_length();
INLINE void set(dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz);
INLINE void get(LVecBase3f &start, LVecBase3f &dir) const;
INLINE LVecBase3f get_start() const;
INLINE LVecBase3f get_direction() const;
INLINE void set_params(int first_contact, int backface_cull);
INLINE void get_params(int &first_contact, int &backface_cull) const;
INLINE int get_first_contact() const;
INLINE int get_backface_cull() const;
INLINE void set_closest_hit(int closest_hit);
INLINE int get_closest_hit();
public:
INLINE static int get_geom_class() { return dRayClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeRayGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeRayGeom.I"
#endif

17
panda/src/ode/odeSimpleSpace.I Executable file
View File

@ -0,0 +1,17 @@
// Filename: odeSimpleSpace.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,37 @@
// Filename: odeSimpleSpace.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeSimpleSpace.h"
TypeHandle OdeSimpleSpace::_type_handle;
OdeSimpleSpace::
OdeSimpleSpace() :
OdeSpace(dSimpleSpaceCreate(0)) {
}
OdeSimpleSpace::
OdeSimpleSpace(OdeSpace &space) :
OdeSpace(dSimpleSpaceCreate(space.get_id())) {
}
OdeSimpleSpace::
~OdeSimpleSpace() {
}

60
panda/src/ode/odeSimpleSpace.h Executable file
View File

@ -0,0 +1,60 @@
// Filename: odeSimpleSpace.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODESIMPLESPACE_H
#define ODESIMPLESPACE_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeSpace.h"
////////////////////////////////////////////////////////////////////
// Class : OdeSimpleSpace
// Description :
////////////////////////////////////////////////////////////////////c
class EXPCL_PANDAODE OdeSimpleSpace : public OdeSpace {
PUBLISHED:
OdeSimpleSpace();
OdeSimpleSpace(OdeSpace &space);
virtual ~OdeSimpleSpace();
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeSpace::init_type();
register_type(_type_handle, "OdeSimpleSpace",
OdeSpace::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeSimpleSpace.I"
#endif

57
panda/src/ode/odeSliderJoint.I Executable file
View File

@ -0,0 +1,57 @@
// Filename: odeSliderJoint.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeSliderJoint::
set_slider_axis(dReal x, dReal y, dReal z) {
dJointSetSliderAxis(_id, x, y, z);
}
INLINE void OdeSliderJoint::
set_slider_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) {
dJointSetSliderAxisDelta(_id, x, y, z, ax, ay, az);
}
INLINE void OdeSliderJoint::
set_slider_param(int parameter, dReal value) {
dJointSetSliderParam(_id, parameter, value);
}
INLINE void OdeSliderJoint::
add_slider_force(dReal force) {
dJointAddSliderForce(_id, force);
}
INLINE dReal OdeSliderJoint::
get_slider_position() const {
return dJointGetSliderPosition(_id);
}
INLINE dReal OdeSliderJoint::
get_slider_position_rate() const {
return dJointGetSliderPositionRate(_id);
}
INLINE void OdeSliderJoint::
get_slider_axis(dVector3 result) const {
return dJointGetSliderAxis(_id, result);
}
INLINE dReal OdeSliderJoint::
get_slider_param(int parameter) const {
return dJointGetSliderParam(_id, parameter);
}

View File

@ -0,0 +1,36 @@
// Filename: odeSliderJoint.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeSliderJoint.h"
TypeHandle OdeSliderJoint::_type_handle;
OdeSliderJoint::
OdeSliderJoint(OdeWorld &world) :
OdeJoint(dJointCreateSlider(world.get_id(), 0)) {
}
OdeSliderJoint::
OdeSliderJoint(OdeWorld &world, OdeJointGroup &joint_group) :
OdeJoint(dJointCreateSlider(world.get_id(), joint_group.get_id())) {
}
OdeSliderJoint::
~OdeSliderJoint() {
}

51
panda/src/ode/odeSliderJoint.h Executable file
View File

@ -0,0 +1,51 @@
#ifndef ODESLIDERJOINT_H
#define ODESLIDERJOINT_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeJoint.h"
////////////////////////////////////////////////////////////////////
// Class : OdeSliderJoint
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeSliderJoint : public OdeJoint {
PUBLISHED:
OdeSliderJoint(OdeWorld &world);
OdeSliderJoint(OdeWorld &world, OdeJointGroup &joint_group);
virtual ~OdeSliderJoint();
INLINE void set_slider_axis(dReal x, dReal y, dReal z);
INLINE void set_slider_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
INLINE void set_slider_param(int parameter, dReal value);
INLINE void add_slider_force(dReal force);
INLINE dReal get_slider_position() const;
INLINE dReal get_slider_position_rate() const;
INLINE void get_slider_axis(dVector3 result) const;
INLINE dReal get_slider_param(int parameter) const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeJoint::init_type();
register_type(_type_handle, "OdeSliderJoint",
OdeJoint::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeSliderJoint.I"
#endif

86
panda/src/ode/odeSpace.I Executable file
View File

@ -0,0 +1,86 @@
// Filename: odeSpace.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE dSpaceID OdeSpace::
get_id() const {
return _id;
}
INLINE void OdeSpace::
set_cleanup(int mode) {
dSpaceSetCleanup(_id, mode);
}
INLINE int OdeSpace::
get_cleanup() const {
return dSpaceGetCleanup(_id);
}
INLINE int OdeSpace::
get_num_geoms() const {
return dSpaceGetNumGeoms(_id);
}
INLINE OdeSpace OdeSpace::
get_space() const {
return OdeSpace(dGeomGetSpace((dGeomID)_id));
}
/*
INLINE void OdeSpace::
get_aabb(dReal aabb[6]) const {
return dGeomGetAABB((dGeomID)_id, aabb[6]);
}
*/
INLINE int OdeSpace::
is_space() {
return dGeomIsSpace((dGeomID)_id);
}
INLINE int OdeSpace::
get_class() const {
return dGeomGetClass((dGeomID)_id);
}
INLINE void OdeSpace::
set_category_bits(unsigned long bits) {
dGeomSetCategoryBits((dGeomID)_id, bits);
}
INLINE void OdeSpace::
set_collide_bits(unsigned long bits) {
dGeomSetCollideBits((dGeomID)_id, bits);
}
INLINE void OdeSpace::
enable() {
dGeomEnable((dGeomID)_id);
}
INLINE void OdeSpace::
disable() {
dGeomDisable((dGeomID)_id);
}
INLINE int OdeSpace::
is_enabled() {
return dGeomIsEnabled((dGeomID)_id);
}

93
panda/src/ode/odeSpace.cxx Executable file
View File

@ -0,0 +1,93 @@
// Filename: odeSpace.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeSpace.h"
TypeHandle OdeSpace::_type_handle;
OdeSpace::
OdeSpace(dSpaceID id) :
_id(id) {
}
OdeSpace::
~OdeSpace() {
}
void OdeSpace::
destroy() {
if (get_cleanup()) {
OdeGeom geom;
for (int i = 0; i < get_num_geoms(); ++i) {
get_geom(i, geom);
if (geom.get_class() == OdeTriMeshGeom::get_geom_class()) {
OdeTriMeshGeom::unlink_data(geom.get_id());
}
}
}
dSpaceDestroy(_id);
}
int OdeSpace::
query(const OdeGeom& geom) const {
return dSpaceQuery(_id, geom.get_id());
}
int OdeSpace::
query(const OdeSpace& space) const {
return dSpaceQuery(_id, (dGeomID)space.get_id());
}
void OdeSpace::
add(OdeSpace& space) {
dSpaceAdd(_id, (dGeomID)space.get_id());
}
void OdeSpace::
remove(OdeSpace& space) {
dSpaceRemove(_id, (dGeomID)space.get_id());
}
void OdeSpace::
add(OdeGeom& geom) {
dSpaceAdd(_id, geom.get_id());
}
void OdeSpace::
remove(OdeGeom& geom) {
dSpaceRemove(_id, geom.get_id());
}
void OdeSpace::
clean() {
dSpaceClean(_id);
}
void OdeSpace::
get_geom(int i, OdeGeom &geom) {
geom._id = dSpaceGetGeom(_id, i);
}
void OdeSpace::
write(ostream &out, unsigned int indent) const {
#ifndef NDEBUG //[
out.width(indent); out << "" << get_type() << "(id = " << _id << ")";
#endif //] NDEBUG
}

97
panda/src/ode/odeSpace.h Executable file
View File

@ -0,0 +1,97 @@
// Filename: odeSpace.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODESPACE_H
#define ODESPACE_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
class OdeGeom;
class OdeTriMeshGeom;
////////////////////////////////////////////////////////////////////
// Class : OdeSpace
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeSpace : public TypedObject {
friend class OdeGeom;
protected:
OdeSpace(dSpaceID id);
PUBLISHED:
virtual ~OdeSpace();
void destroy();
INLINE void set_cleanup(int mode);
INLINE int get_cleanup() const;
INLINE int query(const OdeGeom& geom) const;
INLINE int query(const OdeSpace& space) const;
INLINE int get_num_geoms() const;
// INLINE void get_aabb() const;
INLINE int is_space();
INLINE int get_class() const;
INLINE void set_category_bits(unsigned long bits);
INLINE void set_collide_bits(unsigned long bits);
INLINE void enable();
INLINE void disable();
INLINE int is_enabled();
void add(OdeGeom& geom);
void add(OdeSpace& space);
void remove(OdeGeom& geom);
void remove(OdeSpace& space);
void clean();
void get_geom(int i, OdeGeom &geom);
INLINE OdeSpace get_space() const;
virtual void write(ostream &out = cout, unsigned int indent=0) const;
public:
INLINE dSpaceID get_id() const;
protected:
dSpaceID _id;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeSpace",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeSpace.I"
#endif

33
panda/src/ode/odeSphereGeom.I Executable file
View File

@ -0,0 +1,33 @@
// Filename: odeSphereGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeSphereGeom::
set_radius(dReal radius) {
dGeomSphereSetRadius(_id, radius);
}
INLINE dReal OdeSphereGeom::
get_radius() const {
return dGeomSphereGetRadius(_id);
}
INLINE dReal OdeSphereGeom::
get_point_depth(dReal x, dReal y, dReal z) const {
return dGeomSpherePointDepth(_id, x, y, z);
}

42
panda/src/ode/odeSphereGeom.cxx Executable file
View File

@ -0,0 +1,42 @@
// Filename: odeSphereGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeSphereGeom.h"
TypeHandle OdeSphereGeom::_type_handle;
OdeSphereGeom::
OdeSphereGeom(dReal radius) :
OdeGeom(dCreateSphere(0, radius)) {
}
OdeSphereGeom::
OdeSphereGeom(OdeGeom &geom) :
OdeGeom(geom.get_id()) {
nassertv(dGeomGetClass(_id) == dSphereClass);
}
OdeSphereGeom::
OdeSphereGeom(OdeSpace &space, dReal radius) :
OdeGeom(dCreateSphere(space.get_id(), radius)) {
}
OdeSphereGeom::
~OdeSphereGeom() {
}

66
panda/src/ode/odeSphereGeom.h Executable file
View File

@ -0,0 +1,66 @@
// Filename: odeSphereGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODESPHEREGEOM_H
#define ODESPHEREGEOM_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
////////////////////////////////////////////////////////////////////
// Class : OdeSphereGeom
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeSphereGeom : public OdeGeom {
PUBLISHED:
OdeSphereGeom(dReal radius);
OdeSphereGeom(OdeSpace &space, dReal radius);
OdeSphereGeom(OdeGeom &geom);
virtual ~OdeSphereGeom();
INLINE void set_radius(dReal radius);
INLINE dReal get_radius() const;
INLINE dReal get_point_depth(dReal x, dReal y, dReal z) const;
public:
INLINE static int get_geom_class() { return dSphereClass; };
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeSphereGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeSphereGeom.I"
#endif

View File

@ -0,0 +1,130 @@
// Filename: odeSurfaceParameters.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeSurfaceParameters::
set_mode(int mode) {
_surface_parameters.mode = mode;
}
INLINE void OdeSurfaceParameters::
set_mu(dReal mu) {
_surface_parameters.mu = mu;
}
INLINE void OdeSurfaceParameters::
set_mu2(dReal mu2) {
_surface_parameters.mu2 = mu2;
}
INLINE void OdeSurfaceParameters::
set_bounce(dReal bounce) {
_surface_parameters.bounce = bounce;
}
INLINE void OdeSurfaceParameters::
set_bounce_vel(dReal bounce_vel) {
_surface_parameters.bounce_vel = bounce_vel;
}
INLINE void OdeSurfaceParameters::
set_soft_erp(dReal soft_erp) {
_surface_parameters.soft_erp = soft_erp;
}
INLINE void OdeSurfaceParameters::
set_soft_cfm(dReal soft_cfm) {
_surface_parameters.soft_cfm = soft_cfm;
}
INLINE void OdeSurfaceParameters::
set_motion1(dReal motion) {
_surface_parameters.motion1 = motion;
}
INLINE void OdeSurfaceParameters::
set_motion2(dReal motion) {
_surface_parameters.motion2 = motion;
}
INLINE void OdeSurfaceParameters::
set_slip1(dReal slip) {
_surface_parameters.slip1 = slip;
}
INLINE void OdeSurfaceParameters::
set_slip2(dReal slip) {
_surface_parameters.slip2 = slip;
}
INLINE int OdeSurfaceParameters::
get_mode() const {
return _surface_parameters.mode;
}
INLINE dReal OdeSurfaceParameters::
get_mu() const {
return _surface_parameters.mu;
}
INLINE dReal OdeSurfaceParameters::
get_mu2() const {
return _surface_parameters.mu2;
}
INLINE dReal OdeSurfaceParameters::
get_bounce() const {
return _surface_parameters.bounce;
}
INLINE dReal OdeSurfaceParameters::
get_bounce_vel() const {
return _surface_parameters.bounce_vel;
}
INLINE dReal OdeSurfaceParameters::
get_soft_erp() const {
return _surface_parameters.soft_erp;
}
INLINE dReal OdeSurfaceParameters::
get_soft_cfm() const {
return _surface_parameters.soft_cfm;
}
INLINE dReal OdeSurfaceParameters::
get_motion1() const {
return _surface_parameters.motion1;
}
INLINE dReal OdeSurfaceParameters::
get_motion2() const {
return _surface_parameters.motion2;
}
INLINE dReal OdeSurfaceParameters::
get_slip1() const {
return _surface_parameters.slip1;
}
INLINE dReal OdeSurfaceParameters::
get_slip2() const {
return _surface_parameters.slip2;
}

View File

@ -0,0 +1,84 @@
// Filename: odeSurfaceParameters.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeSurfaceParameters.h"
TypeHandle OdeSurfaceParameters::_type_handle;
OdeSurfaceParameters::
OdeSurfaceParameters(int mode, dReal mu) :
_surface_parameters() {
if (mu < 0) {
mu = 0;
} else if (mu > dInfinity) {
mu = dInfinity;
}
_surface_parameters.mode = mode;
_surface_parameters.mu = mu;
_surface_parameters.mu2 = 0;
_surface_parameters.bounce = 0;
_surface_parameters.bounce = 0;
_surface_parameters.soft_erp = 0;
_surface_parameters.soft_cfm = 0;
_surface_parameters.motion1 = 0;
_surface_parameters.motion2 = 0;
_surface_parameters.slip1 = 0;
_surface_parameters.slip2 = 0;
}
OdeSurfaceParameters::
OdeSurfaceParameters(const dSurfaceParameters &surface_parameters) :
_surface_parameters() {
_surface_parameters.mode = surface_parameters.mode;
_surface_parameters.mu = surface_parameters.mu;
_surface_parameters.mu2 = surface_parameters.mu2;
_surface_parameters.bounce = surface_parameters.bounce;
_surface_parameters.bounce = surface_parameters.bounce_vel;
_surface_parameters.soft_erp = surface_parameters.soft_erp;
_surface_parameters.soft_cfm = surface_parameters.soft_cfm;
_surface_parameters.motion1 = surface_parameters.motion1;
_surface_parameters.motion2 = surface_parameters.motion2;
_surface_parameters.slip1 = surface_parameters.slip1;
_surface_parameters.slip2 = surface_parameters.slip2;
}
OdeSurfaceParameters::
~OdeSurfaceParameters() {
}
const dSurfaceParameters *OdeSurfaceParameters::
get_surface_parameters_ptr() const {
return &_surface_parameters;
}
void OdeSurfaceParameters::
operator = (const OdeSurfaceParameters &copy) {
_surface_parameters.mode = copy._surface_parameters.mode;
_surface_parameters.mu = copy._surface_parameters.mu;
_surface_parameters.mu2 = copy._surface_parameters.mu2;
_surface_parameters.bounce = copy._surface_parameters.bounce;
_surface_parameters.bounce = copy._surface_parameters.bounce_vel;
_surface_parameters.soft_erp = copy._surface_parameters.soft_erp;
_surface_parameters.soft_cfm = copy._surface_parameters.soft_cfm;
_surface_parameters.motion1 = copy._surface_parameters.motion1;
_surface_parameters.motion2 = copy._surface_parameters.motion2;
_surface_parameters.slip1 = copy._surface_parameters.slip1;
_surface_parameters.slip2 = copy._surface_parameters.slip2;
}

View File

@ -0,0 +1,127 @@
// Filename: odeSurfaceParameters.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODESURFACEPARAMETERS_H
#define ODESURFACEPARAMETERS_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode/ode.h"
class OdeContact;
////////////////////////////////////////////////////////////////////
// Class : OdeSurfaceParameters
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeSurfaceParameters : public TypedObject {
friend class OdeContact;
protected:
OdeSurfaceParameters(const dSurfaceParameters &surface_parameters);
PUBLISHED:
enum ModeFlags { MF_contact_mu2 = 0x001,
MF_contactFDir1 = 0x002,
MF_contactBounce = 0x004,
MF_contactSoftERP = 0x008,
MF_contactSoftCFM = 0x010,
MF_contactMotion1 = 0x020,
MF_contactMotion2 = 0x040,
MF_contactSlip1 = 0x080,
MF_contactSlip2 = 0x100,
MF_contactApprox0 = 0x0000,
MF_contactApprox1_1 = 0x1000,
MF_contactApprox1_2 = 0x2000,
MF_contactApprox1 = 0x3000 };
/*
// Interrogate doesn't seem to handle this so well
enum ModeFlags { MF_contact_mu2 = dContactMu2,
MF_contactFDir1 = dContactFDir1,
MF_contactBounce = dContactBounce,
MF_contactSoftERP = dContactSoftERP,
MF_contactSoftCFM = dContactSoftCFM,
MF_contactMotion1 = dContactMotion1,
MF_contactMotion2 = dContactMotion2,
MF_contactSlip1 = dContactSlip1,
MF_contactSlip2 = dContactSlip2,
// MF_contactApprox0 = dContactApprox0,
MF_contactApprox1_1 = dContactApprox1_1,
MF_contactApprox1_2 = dContactApprox1_2,
MF_contactApprox1 = dContactApprox1 };
*/
OdeSurfaceParameters(int mode = 0, dReal mu = 0);
virtual ~OdeSurfaceParameters();
INLINE void set_mode(int mode);
INLINE void set_mu(dReal mu);
INLINE void set_mu2(dReal mu2);
INLINE void set_bounce(dReal bounce);
INLINE void set_bounce_vel(dReal bounce_vel);
INLINE void set_soft_erp(dReal soft_erp);
INLINE void set_soft_cfm(dReal soft_cfm);
INLINE void set_motion1(dReal motion);
INLINE void set_motion2(dReal motion);
INLINE void set_slip1(dReal slip);
INLINE void set_slip2(dReal slip);
INLINE int get_mode() const;
INLINE dReal get_mu() const;
INLINE dReal get_mu2() const;
INLINE dReal get_bounce() const;
INLINE dReal get_bounce_vel() const;
INLINE dReal get_soft_erp() const;
INLINE dReal get_soft_cfm() const;
INLINE dReal get_motion1() const;
INLINE dReal get_motion2() const;
INLINE dReal get_slip1() const;
INLINE dReal get_slip2() const;
public:
const dSurfaceParameters *get_surface_parameters_ptr() const;
private:
void operator = (const OdeSurfaceParameters &copy);
dSurfaceParameters _surface_parameters;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeSurfaceParameters",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeSurfaceParameters.I"
#endif

88
panda/src/ode/odeTriMeshData.I Executable file
View File

@ -0,0 +1,88 @@
// Filename: odeTriMeshData.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE dTriMeshDataID OdeTriMeshData::
get_id() const {
return _id;
}
/*
INLINE void OdeTriMeshData::
set(int data_id, void* in_data) {
dGeomTriMeshDataSet(_id, data_id, in_data);
}
INLINE void* OdeTriMeshData::
get(int data_id) {
dGeomTriMeshDataGet(_id,data_id);
}
*/
INLINE void OdeTriMeshData::
build_single(const void* vertices, int vertex_stride, int vertex_count, const void* indices, int index_count, int tri_stride) {
odetrimeshdata_cat.debug() << "build_single(" << vertices << ", " << vertex_stride << ", " << vertex_count << ", " << indices << ", " << index_count << ", " << tri_stride << ")\n";
dGeomTriMeshDataBuildSingle(_id, vertices, vertex_stride, vertex_count, indices, index_count, tri_stride);
}
INLINE void OdeTriMeshData::
build_single1(const void* vertices, int vertex_stride, int vertex_count, const void* indices, int index_count, int tri_stride, const void* normals) {
dGeomTriMeshDataBuildSingle1(_id, vertices, vertex_stride, vertex_count, indices, index_count, tri_stride, normals);
}
INLINE void OdeTriMeshData::
build_double(const void* vertices, int vertex_stride, int vertex_count, const void* indices, int index_count, int tri_stride) {
dGeomTriMeshDataBuildDouble(_id, vertices, vertex_stride, vertex_count, indices, index_count, tri_stride);
}
INLINE void OdeTriMeshData::
build_double1(const void* vertices, int vertex_stride, int vertex_count, const void* indices, int index_count, int tri_stride, const void* normals) {
dGeomTriMeshDataBuildDouble1(_id, vertices, vertex_stride, vertex_count, indices, index_count, tri_stride, normals);
}
INLINE void OdeTriMeshData::
build_simple(const dReal* vertices, int vertex_count, const int* indices, int index_count) {
dGeomTriMeshDataBuildSimple(_id, vertices, vertex_count, indices, index_count);
}
INLINE void OdeTriMeshData::
build_simple1(const dReal* vertices, int vertex_count, const int* indices, int index_count, const int* normals) {
dGeomTriMeshDataBuildSimple1(_id, vertices, vertex_count, indices, index_count, normals);
}
INLINE void OdeTriMeshData::
preprocess() {
dGeomTriMeshDataPreprocess(_id);
}
/*
INLINE void OdeTriMeshData::
get_buffer(unsigned char** buf, int* buf_len) const {
return dGeomTriMeshDataGetBuffer(_id, buf, buf_len);
}
INLINE void OdeTriMeshData::
set_buffer(unsigned char* buf) {
dGeomTriMeshDataSetBuffer(_id, buf);
}
INLINE void OdeTriMeshData::
update() {
dGeomTriMeshDataUpdate(_id);
}
*/

236
panda/src/ode/odeTriMeshData.cxx Executable file
View File

@ -0,0 +1,236 @@
// Filename: odeTriMeshData.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeTriMeshData.h"
TypeHandle OdeTriMeshData::_type_handle;
OdeTriMeshData::
OdeTriMeshData(const NodePath& model, bool use_normals) :
_id(dGeomTriMeshDataCreate()),
_vertices(0),
_faces(0),
_num_vertices(0),
_num_faces(0),
_normals(false) {
odetrimeshdata_cat.debug() << get_type() << "(" << _id << ")" << "\n";
process_model(model, use_normals);
write_faces(odetrimeshdata_cat.debug());
if (!use_normals) {
build_single(_vertices, sizeof(StridedVertex), _num_vertices,
_faces, _num_faces * 3, sizeof(StridedTri));
} else {
build_single1(_vertices, sizeof(StridedVertex), _num_vertices,
_faces, _num_faces * 3, sizeof(StridedTri),
_normals);
}
preprocess();
}
OdeTriMeshData::
~OdeTriMeshData() {
odetrimeshdata_cat.debug() << "~" << get_type() << "(" << _id << ")" << "\n";
dGeomTriMeshDataDestroy(_id);
if (_vertices != 0) {
delete[] _vertices;
_vertices = 0;
}
if (_faces != 0) {
delete[] _faces;
_faces = 0;
}
if (_normals != 0) {
delete[] _normals;
_normals = 0;
}
}
void OdeTriMeshData::
process_model(const NodePath& model, bool &use_normals) {
// TODO: assert if _vertices is something other than 0.
ostream &out = odetrimeshdata_cat.debug();
out << "process_model(" << model << ")" << "\n";
NodePathCollection geomNodePaths = model.find_all_matches("**/+GeomNode");
if (model.node()->get_type() == GeomNode::get_class_type()) {
geomNodePaths.add_path(model);
}
for (int i = 0; i < geomNodePaths.get_num_paths(); ++i) {
analyze((GeomNode*)geomNodePaths[i].node());
}
odetrimeshdata_cat.debug() << "Found " << _num_vertices << " vertices.\n";
odetrimeshdata_cat.debug() << "Found " << _num_faces << " faces.\n";
_vertices = new StridedVertex[_num_vertices];
_faces = new StridedTri[_num_faces];
_num_vertices = 0, _num_faces = 0;
for (int i = 0; i < geomNodePaths.get_num_paths(); ++i) {
process_geom_node((GeomNode*)geomNodePaths[i].node());
odetrimeshdata_cat.debug() << "_num_vertices now at " << _num_vertices << "\n";
}
odetrimeshdata_cat.debug() << "Filled " << _num_faces << " triangles(" \
<< _num_vertices << " vertices)\n";
}
void OdeTriMeshData::
process_geom_node(const GeomNode *geomNode) {
ostream &out = odetrimeshdata_cat.debug();
out.width(2); out << "" << "process_geom_node(" << *geomNode << ")" << "\n";
for (int i = 0; i < geomNode->get_num_geoms(); ++i) {
process_geom(geomNode->get_geom(i));
}
}
void OdeTriMeshData::
process_geom(const Geom *geom) {
ostream &out = odetrimeshdata_cat.debug();
out.width(4); out << "" << "process_geom(" << *geom << ")" << "\n";
if (geom->get_primitive_type() != Geom::PT_polygons) {
return;
}
CPT(GeomVertexData) vData = geom->get_vertex_data();
for (int i = 0; i < geom->get_num_primitives(); ++i) {
process_primitive(geom->get_primitive(i), vData);
}
}
void OdeTriMeshData::
process_primitive(const GeomPrimitive *primitive,
CPT(GeomVertexData) vData) {
GeomVertexReader vReader(vData, "vertex");
GeomVertexReader nReader(vData, "normal");
LVecBase3f vertex, normal;
//CPT(GeomPrimitive) dPrimitive = primitive->decompose();
CPT(GeomPrimitive) dPrimitive = primitive;
ostream &out = odetrimeshdata_cat.debug();
out.width(6); out << "" << "process_primitive(" << *dPrimitive << ")" << "\n";
if (dPrimitive->get_type() == GeomTriangles::get_class_type()) {
for (int i = 0; i < dPrimitive->get_num_primitives(); i++, _num_faces++) {
int s = dPrimitive->get_primitive_start(i);
int e = dPrimitive->get_primitive_end(i);
out.width(8); out << "" << "primitive " << i << ":" << "\n";
for (int j = s, m = 0; j < e; j++, m++, _num_vertices++) {
int vRowIndex = dPrimitive->get_vertex(j);
vReader.set_row(vRowIndex);
nReader.set_row(vRowIndex);
vertex = vReader.get_data3f();
normal = nReader.get_data3f();
_faces[_num_faces].Indices[m] = _num_vertices;
_vertices[_num_vertices].Vertex[0] = vertex[0];
_vertices[_num_vertices].Vertex[1] = vertex[1];
_vertices[_num_vertices].Vertex[2] = vertex[2];
out.width(10); out << "" << "vertex " << j << " has: pos(" \
<< vertex << ") normal(" << normal << ")" << "\n";
}
}
} else if (dPrimitive->get_type() == GeomTristrips::get_class_type()){
for (int i = 0; i < dPrimitive->get_num_primitives(); i++, _num_faces++) {
int s = dPrimitive->get_primitive_start(i);
int e = dPrimitive->get_primitive_end(i);
out.width(8); out << "" << "primitive " << i << ":" << "\n";
for (int j = s, m = 0; j < e; j++, m++, _num_vertices++) {
int vRowIndex = dPrimitive->get_vertex(j);
vReader.set_row(vRowIndex);
nReader.set_row(vRowIndex);
vertex = vReader.get_data3f();
normal = nReader.get_data3f();
_vertices[_num_vertices].Vertex[0] = vertex[0];
_vertices[_num_vertices].Vertex[1] = vertex[1];
_vertices[_num_vertices].Vertex[2] = vertex[2];
out.width(10); out << "" << "vertex " << j << " has: pos(" \
<< vertex << ") normal(" << normal << ")" << "\n";
if (m < 3) {
_faces[_num_faces].Indices[m] = _num_vertices;
} else {
_num_faces++;
if ( m & 1) {
_faces[_num_faces].Indices[0] = _num_vertices-1;
_faces[_num_faces].Indices[1] = _num_vertices-2;
_faces[_num_faces].Indices[2] = _num_vertices;
} else {
_faces[_num_faces].Indices[0] = _num_vertices-2;
_faces[_num_faces].Indices[1] = _num_vertices-1;
_faces[_num_faces].Indices[2] = _num_vertices;
}
}
}
out << "\n";
}
}
}
void OdeTriMeshData::
analyze(const GeomNode *geomNode) {
for (int i = 0; i < geomNode->get_num_geoms(); ++i) {
analyze(geomNode->get_geom(i));
}
}
void OdeTriMeshData::
analyze(const Geom *geom) {
if (geom->get_primitive_type() != Geom::PT_polygons) {
return;
}
for (int i = 0; i < geom->get_num_primitives(); ++i) {
analyze(geom->get_primitive(i));
}
}
void OdeTriMeshData::
analyze(const GeomPrimitive *primitive) {
for (int i = 0; i < primitive->get_num_primitives(); ++i) {
_num_vertices += primitive->get_primitive_num_vertices(i);
_num_faces += primitive->get_primitive_num_faces(i);
}
}
void OdeTriMeshData::
write_faces(ostream &out) const {
out<<"\n";
for (unsigned int i = 0; i < _num_faces; ++i) {
out.width(2); out << "Face " << i << ":\n";
for (int j = 0; j < 3; ++j) {
out.width(4);
out << "(" << _vertices[_faces[i].Indices[j]].Vertex[0] \
<< ", " << _vertices[_faces[i].Indices[j]].Vertex[1] \
<< ", " << _vertices[_faces[i].Indices[j]].Vertex[2] << ")\n" ;
}
}
}
void OdeTriMeshData::
write(ostream &out, unsigned int indent) const {
out.width(indent); out << "" << get_type() << "(id = " << _id << ") : " \
<< "" << "Vertices: " << _num_vertices << ", " \
<< "" << "Triangles: " << _num_faces << "\n";
}

123
panda/src/ode/odeTriMeshData.h Executable file
View File

@ -0,0 +1,123 @@
// Filename: odeTriMeshData.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODETRIMESHDATA_H
#define ODETRIMESHDATA_H
#include "pandabase.h"
#include "typedReferenceCount.h"
#include "luse.h"
#include "ode/ode.h"
#include "nodePathCollection.h"
#include "geomNode.h"
#include "geomVertexData.h"
#include "geomVertexReader.h"
#include "geomTriangles.h"
#include "geomTristrips.h"
////////////////////////////////////////////////////////////////////
// Class : OdeTriMeshData
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAODE OdeTriMeshData : public TypedReferenceCount {
PUBLISHED:
OdeTriMeshData(const NodePath& model, bool use_normals = false);
virtual ~OdeTriMeshData();
enum DataType { DT_face_normals,
DT_last_transformation };
// INLINE void set(int data_id, void* in_data);
// INLINE void* get(int data_id);
// INLINE void get_buffer(unsigned char** buf, int* buf_len) const;
// INLINE void set_buffer(unsigned char* buf);
// INLINE void update();
virtual void write(ostream &out = cout, unsigned int indent=0) const;
void write_faces(ostream &out) const;
public:
INLINE void build_single(const void* vertices, int vertex_stride, int vertex_count, \
const void* indices, int index_count, int tri_stride);
INLINE void build_single1(const void* vertices, int vertex_stride, int vertex_count, \
const void* indices, int index_count, int tri_stride, \
const void* normals);
INLINE void build_double(const void* vertices, int vertex_stride, int vertex_count, \
const void* indices, int index_count, int tri_stride);
INLINE void build_double1(const void* vertices, int vertex_stride, int vertex_count, \
const void* indices, int index_count, int tri_stride, \
const void* normals);
INLINE void build_simple(const dReal* vertices, int vertex_count, \
const int* indices, int index_count);
INLINE void build_simple1(const dReal* vertices, int vertex_count, \
const int* indices, int index_count, \
const int* normals);
INLINE void preprocess();
INLINE dTriMeshDataID get_id() const;
private:
void process_model(const NodePath& model, bool &use_normals);
void process_geom_node(const GeomNode *geomNode);
void process_geom(const Geom *geom);
void process_primitive(const GeomPrimitive *primitive,
CPT(GeomVertexData) vData);
void analyze(const GeomNode *geomNode);
void analyze(const Geom *geom);
void analyze(const GeomPrimitive *geom);
protected:
struct StridedVertex{
dReal Vertex[3];
};
struct StridedTri{
int Indices[3];
};
struct FaceNormal{
dVector3 Normal;
};
dTriMeshDataID _id;
StridedVertex *_vertices;
StridedTri *_faces;
FaceNormal *_normals;
unsigned int _num_vertices;
unsigned int _num_faces;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "OdeTriMeshData",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeTriMeshData.I"
#endif

71
panda/src/ode/odeTriMeshGeom.I Executable file
View File

@ -0,0 +1,71 @@
// Filename: odeTriMeshGeom.I
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
INLINE void OdeTriMeshGeom::
set_data(OdeTriMeshData &data) {
unlink_data(_id);
dGeomTriMeshSetData(_id, data.get_id());
link_data(_id, data);
}
INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
get_data() const {
return MeshData[_id];
}
INLINE void OdeTriMeshGeom::
enable_TC(int geom_class, int enable){
dGeomTriMeshEnableTC(_id, geom_class, enable);
}
INLINE int OdeTriMeshGeom::
is_TC_enabled(int geom_class) const {
return dGeomTriMeshIsTCEnabled(_id, geom_class);
}
INLINE void OdeTriMeshGeom::
clear_TC_cache(const OdeGeom &geom){
dGeomTriMeshClearTCCache(_id);
}
INLINE void OdeTriMeshGeom::
get_triangle(int face_index, LPoint3f &v0, LPoint3f &v1, LPoint3f &v2) const {
dVector3 dv0, dv1, dv2;
dGeomTriMeshGetTriangle(_id, face_index, &dv0, &dv1, &dv2);
v0.set(dv0[0], dv0[1], dv0[2]);
v1.set(dv1[0], dv1[1], dv1[2]);
v2.set(dv2[0], dv2[1], dv2[2]);
}
INLINE LPoint3f OdeTriMeshGeom::
get_point(int face_index, dReal u, dReal v) const {
dVector3 out;
dGeomTriMeshGetPoint(_id, face_index, u, v, out);
return LPoint3f(out[0], out[1], out[2]);
}
INLINE int OdeTriMeshGeom::
get_num_triangles() const {
return dGeomTriMeshGetTriangleCount(_id);
}
INLINE dTriMeshDataID OdeTriMeshGeom::
get_data_id() const {
return dGeomTriMeshGetTriMeshDataID(_id);
}

View File

@ -0,0 +1,63 @@
// Filename: odeTriMeshGeom.cxx
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "config_ode.h"
#include "odeTriMeshGeom.h"
TypeHandle OdeTriMeshGeom::_type_handle;
TriMeshDataMap OdeTriMeshGeom::MeshData;
OdeTriMeshGeom::
OdeTriMeshGeom(OdeTriMeshData &data) :
OdeGeom(dCreateTriMesh(0, data.get_id(), 0, 0, 0)) {
link_data(_id, data);
}
OdeTriMeshGeom::
OdeTriMeshGeom(OdeSpace &space, OdeTriMeshData &data) :
OdeGeom(dCreateTriMesh(space.get_id(), data.get_id(), 0, 0, 0)) {
link_data(_id, data);
}
OdeTriMeshGeom::
OdeTriMeshGeom(OdeTriMeshGeom &copy) :
OdeGeom(dCreateTriMesh(0, copy.get_data_id(), 0, 0, 0)) {
}
OdeTriMeshGeom::
~OdeTriMeshGeom() {
}
void OdeTriMeshGeom::
link_data(dGeomID id, OdeTriMeshData &data) {
odegeom_cat.debug() << get_class_type() << "(" << id << ") linking to data: " << data.get_id() << "\n";
MeshData[id] = &data;
}
void OdeTriMeshGeom::
unlink_data(dGeomID id) {
TriMeshDataMap::iterator iter = MeshData.find(id);
if (iter != MeshData.end()) {
odegeom_cat.debug() << get_class_type() << "(" << id << ") unlinking from data: " << iter->second->get_id() << "\n";
} else {
odegeom_cat.warning() << get_class_type() << "(" << id << ") Unlinking from absent data!\n";
}
MeshData.erase(id);
}

85
panda/src/ode/odeTriMeshGeom.h Executable file
View File

@ -0,0 +1,85 @@
// Filename: odeTriMeshGeom.h
// Created by: joswilso (27Dec06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef ODETRIMESHGEOM_H
#define ODETRIMESHGEOM_H
#include "pandabase.h"
#include "luse.h"
#include "ode/ode.h"
#include "odeGeom.h"
#include "odeTriMeshData.h"
////////////////////////////////////////////////////////////////////
// Class : OdeTriMeshGeom
// Description :
////////////////////////////////////////////////////////////////////
typedef pmap<dGeomID, PT(OdeTriMeshData)> TriMeshDataMap;
class EXPCL_PANDAODE OdeTriMeshGeom : public OdeGeom {
protected:
static TriMeshDataMap MeshData;
PUBLISHED:
//ODE_API dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCallback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCallback);
OdeTriMeshGeom(OdeTriMeshData &data);
OdeTriMeshGeom(OdeSpace &space, OdeTriMeshData &data);
OdeTriMeshGeom(OdeTriMeshGeom &copy);
virtual ~OdeTriMeshGeom();
INLINE void set_data(OdeTriMeshData &data);
INLINE PT(OdeTriMeshData) get_data() const;
INLINE void enable_TC(int geom_class, int enable);
INLINE int is_TC_enabled(int geom_class) const;
INLINE void clear_TC_cache(const OdeGeom &geom);
INLINE void get_triangle(int face_index, LPoint3f &v0, LPoint3f &v1, LPoint3f &v2) const;
INLINE LPoint3f get_point(int face_index, dReal u, dReal v) const;
INLINE int get_num_triangles() const;
public:
INLINE static int get_geom_class() { return dTriMeshClass; };
INLINE dTriMeshDataID get_data_id() const;
static void link_data(dGeomID, OdeTriMeshData &data);
static void unlink_data(dGeomID);
private:
void operator = (const OdeTriMeshGeom &copy);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
OdeGeom::init_type();
register_type(_type_handle, "OdeTriMeshGeom",
OdeGeom::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeTriMeshGeom.I"
#endif

Some files were not shown because too many files have changed in this diff Show More