From a762ee42f48788945469100067bb08281e9f3a1b Mon Sep 17 00:00:00 2001 From: enn0x Date: Tue, 20 Nov 2012 22:53:50 +0000 Subject: [PATCH] Exposed additional member of btManifoldPoint --- panda/src/bullet/bulletManifoldPoint.I | 277 +++++++++++++++++++++++ panda/src/bullet/bulletManifoldPoint.cxx | 26 ++- panda/src/bullet/bulletManifoldPoint.h | 32 ++- 3 files changed, 333 insertions(+), 2 deletions(-) diff --git a/panda/src/bullet/bulletManifoldPoint.I b/panda/src/bullet/bulletManifoldPoint.I index 03b8b1b9a1..301ee98c3f 100644 --- a/panda/src/bullet/bulletManifoldPoint.I +++ b/panda/src/bullet/bulletManifoldPoint.I @@ -22,3 +22,280 @@ INLINE BulletManifoldPoint:: } +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::is_const +// Access: Published +// Description: Returns TRUE if this instance of BulletManifoldPoint +// can not be modified. +//////////////////////////////////////////////////////////////////// +INLINE bool BulletManifoldPoint:: +is_const() const { + + return _const; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_lateral_friction_initialized +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_lateral_friction_initialized(bool value) { + + nassertv(!_const); + _pt.m_lateralFrictionInitialized = value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_lateral_friction_initialized +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE bool BulletManifoldPoint:: +get_lateral_friction_initialized() const { + + return _pt.m_lateralFrictionInitialized; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_lateral_friction_dir1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_lateral_friction_dir1(const LVecBase3 &dir) { + + nassertv(!_const); + _pt.m_lateralFrictionDir1 = LVecBase3_to_btVector3(dir); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_lateral_friction_dir1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE LVector3 BulletManifoldPoint:: +get_lateral_friction_dir1() const { + + return btVector3_to_LVector3(_pt.m_lateralFrictionDir1); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_lateral_friction_dir2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_lateral_friction_dir2(const LVecBase3 &dir) { + + nassertv(!_const); + _pt.m_lateralFrictionDir2 = LVecBase3_to_btVector3(dir); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_lateral_friction_dir2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE LVector3 BulletManifoldPoint:: +get_lateral_friction_dir2() const { + + return btVector3_to_LVector3(_pt.m_lateralFrictionDir2); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_contact_motion1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_contact_motion1(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_contactMotion1 = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_contact_motion1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_contact_motion1() const { + + return (PN_stdfloat)_pt.m_contactMotion1; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_contact_motion2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_contact_motion2(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_contactMotion2 = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_contact_motion2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_contact_motion2() const { + + return (PN_stdfloat)_pt.m_contactMotion2; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_combined_friction +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_combined_friction(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_combinedFriction = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_combined_friction +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_combined_friction() const { + + return (PN_stdfloat)_pt.m_combinedFriction; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_combined_restitution +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_combined_restitution(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_combinedRestitution = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_combined_restitution +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_combined_restitution() const { + + return (PN_stdfloat)_pt.m_combinedRestitution; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_applied_impulse +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_applied_impulse(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_appliedImpulse = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_applied_impulse_lateral1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_applied_impulse_lateral1(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_appliedImpulseLateral1 = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_applied_impulse_lateral1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_applied_impulse_lateral1() const { + + return (PN_stdfloat)_pt.m_appliedImpulseLateral1; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_applied_impulse_lateral2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_applied_impulse_lateral2(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_appliedImpulseLateral2 = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_applied_impulse_lateral2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_applied_impulse_lateral2() const { + + return (PN_stdfloat)_pt.m_appliedImpulseLateral2; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_contact_cfm1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_contact_cfm1(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_contactCFM1 = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_contact_cfm1 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_contact_cfm1() const { + + return (PN_stdfloat)_pt.m_contactCFM1; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::set_contact_cfm2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void BulletManifoldPoint:: +set_contact_cfm2(PN_stdfloat value) { + + nassertv(!_const); + _pt.m_contactCFM2 = (btScalar)value; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_contact_cfm2 +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat BulletManifoldPoint:: +get_contact_cfm2() const { + + return (PN_stdfloat)_pt.m_contactCFM2; +} + diff --git a/panda/src/bullet/bulletManifoldPoint.cxx b/panda/src/bullet/bulletManifoldPoint.cxx index 9985f89b0a..fc61d9fa59 100644 --- a/panda/src/bullet/bulletManifoldPoint.cxx +++ b/panda/src/bullet/bulletManifoldPoint.cxx @@ -20,10 +20,23 @@ // Description: //////////////////////////////////////////////////////////////////// BulletManifoldPoint:: -BulletManifoldPoint(const btManifoldPoint &pt) : _pt(pt) { +BulletManifoldPoint(btManifoldPoint &pt) + : _pt(pt), _const(false) { } +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +BulletManifoldPoint:: +BulletManifoldPoint(const btManifoldPoint &pt) { + + _pt = (btManifoldPoint &)pt; + _const = true; +} + //////////////////////////////////////////////////////////////////// // Function: BulletManifoldPoint::get_lift_time // Access: Published @@ -79,6 +92,17 @@ get_position_world_on_b() const { return btVector3_to_LPoint3(_pt.getPositionWorldOnB()); } +//////////////////////////////////////////////////////////////////// +// Function: BulletManifoldPoint::get_normal_world_on_b +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +LPoint3 BulletManifoldPoint:: +get_normal_world_on_b() const { + + return btVector3_to_LPoint3(_pt.m_normalWorldOnB); +} + //////////////////////////////////////////////////////////////////// // Function: BulletManifoldPoint::get_local_point_a // Access: Published diff --git a/panda/src/bullet/bulletManifoldPoint.h b/panda/src/bullet/bulletManifoldPoint.h index d1116346f1..c3edcf2fde 100644 --- a/panda/src/bullet/bulletManifoldPoint.h +++ b/panda/src/bullet/bulletManifoldPoint.h @@ -36,6 +36,7 @@ PUBLISHED: PN_stdfloat get_applied_impulse() const; LPoint3 get_position_world_on_a() const; LPoint3 get_position_world_on_b() const; + LPoint3 get_normal_world_on_b() const; LPoint3 get_local_point_a() const; LPoint3 get_local_point_b() const; @@ -44,11 +45,40 @@ PUBLISHED: int get_index0() const; int get_index1() const; + INLINE bool is_const() const; + + INLINE void set_lateral_friction_initialized(bool value); + INLINE void set_lateral_friction_dir1(const LVecBase3 &dir); + INLINE void set_lateral_friction_dir2(const LVecBase3 &dir); + INLINE void set_contact_motion1(PN_stdfloat value); + INLINE void set_contact_motion2(PN_stdfloat value); + INLINE void set_combined_friction(PN_stdfloat value); + INLINE void set_combined_restitution(PN_stdfloat value); + INLINE void set_applied_impulse(PN_stdfloat value); + INLINE void set_applied_impulse_lateral1(PN_stdfloat value); + INLINE void set_applied_impulse_lateral2(PN_stdfloat value); + INLINE void set_contact_cfm1(PN_stdfloat value); + INLINE void set_contact_cfm2(PN_stdfloat value); + + INLINE bool get_lateral_friction_initialized() const; + INLINE LVector3 get_lateral_friction_dir1() const; + INLINE LVector3 get_lateral_friction_dir2() const; + INLINE PN_stdfloat get_contact_motion1() const; + INLINE PN_stdfloat get_contact_motion2() const; + INLINE PN_stdfloat get_combined_friction() const; + INLINE PN_stdfloat get_combined_restitution() const; + INLINE PN_stdfloat get_applied_impulse_lateral1() const; + INLINE PN_stdfloat get_applied_impulse_lateral2() const; + INLINE PN_stdfloat get_contact_cfm1() const; + INLINE PN_stdfloat get_contact_cfm2() const; + public: BulletManifoldPoint(const btManifoldPoint &pt); + BulletManifoldPoint(btManifoldPoint &pt); private: - const btManifoldPoint _pt; + btManifoldPoint _pt; + bool _const; }; #include "bulletManifoldPoint.I"