From 20d60f21267d73ebc4f352f7d932c635111e2c7c Mon Sep 17 00:00:00 2001 From: enn0x Date: Mon, 6 May 2013 12:37:54 +0000 Subject: [PATCH] Removing obsolete bullet-full-sync option. --- panda/src/bullet/bulletRigidBodyNode.cxx | 54 ++++++------------------ panda/src/bullet/bulletRigidBodyNode.h | 4 -- panda/src/bullet/config_bullet.cxx | 7 --- panda/src/bullet/config_bullet.h | 1 - 4 files changed, 12 insertions(+), 54 deletions(-) diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index d6b6f85a5c..c871dbb1ce 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -27,7 +27,6 @@ BulletRigidBodyNode(const char *name) : BulletBodyNode(name) { // Motion state _motion = new MotionState(); - _sync = TransformState::make_identity(); // Mass properties btScalar mass(0.0); @@ -273,7 +272,7 @@ transform_changed() { NodePath np = NodePath::any_path((PandaNode *)this); CPT(TransformState) ts = np.get_net_transform(); - // For kinematic bodies Bullet with collect the transform + // For kinematic bodies Bullet will query the transform // via Motionstate::getWorldTransform. Therefor we need to // store the new transform within the motion state. // For dynamic bodies we need to store the net scale within @@ -305,9 +304,6 @@ transform_changed() { if (!_rigid->isActive()) { _rigid->activate(true); } - - // Rememeber current transform (bullet_full_sync) - _sync = ts; } //////////////////////////////////////////////////////////////////// @@ -321,19 +317,6 @@ sync_p2b() { if (is_kinematic()) { transform_changed(); } - - // Check if net transform has changed (bullet_full_sync) - else if (bullet_full_sync) { - NodePath np = NodePath::any_path((PandaNode *)this); - CPT(TransformState) ts = np.get_net_transform(); - - LMatrix4 m_sync = _sync->get_mat(); - LMatrix4 m_ts = ts->get_mat(); - - if (!m_sync.almost_equal(m_ts)) { - transform_changed(); - } - } } //////////////////////////////////////////////////////////////////// @@ -345,11 +328,6 @@ void BulletRigidBodyNode:: sync_b2p() { _motion->sync_b2p((PandaNode *)this); - - // Store new transform (bullet_full_sync) - if (bullet_full_sync) { - _motion->get_net_transform(_sync); - } } //////////////////////////////////////////////////////////////////// @@ -510,7 +488,6 @@ BulletRigidBodyNode::MotionState:: MotionState() { _trans.setIdentity(); - _scale = LVecBase3(1.0f, 1.0f, 1.0f); _disabled = false; _dirty = false; _was_dirty = false; @@ -563,7 +540,15 @@ sync_b2p(PandaNode *node) { //////////////////////////////////////////////////////////////////// // Function: BulletRigidBodyNode::MotionState::set_net_transform // Access: Public -// Description: +// Description: This method stores the global transform within the +// Motionstate. It is called from +// BulletRigidBodyNode::transform_changed(). +// For kinematic bodies the global transform is +// required since Bullet queries the body transform +// via MotionState::getGlobalStranform(). +// For dynamic bodies the global scale is required, +// since Bullet will overwrite the member _trans +// by calling MotionState::setGlobalTransform. //////////////////////////////////////////////////////////////////// void BulletRigidBodyNode::MotionState:: set_net_transform(CPT(TransformState) &ts) { @@ -571,21 +556,6 @@ set_net_transform(CPT(TransformState) &ts) { nassertv(ts); _trans = TransformState_to_btTrans(ts); - - if (ts->has_scale()) { - _scale = ts->get_scale(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: BulletRigidBodyNode::MotionState::get_net_transform -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void BulletRigidBodyNode::MotionState:: -get_net_transform(CPT(TransformState) &ts) const { - - ts = btTrans_to_TransformState(_trans, _scale); } //////////////////////////////////////////////////////////////////// @@ -607,9 +577,9 @@ sync_disabled() const { bool BulletRigidBodyNode::MotionState:: pick_dirty_flag() { - bool flag = _was_dirty; + bool rc = _was_dirty; _was_dirty = false; - return flag; + return rc; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/bullet/bulletRigidBodyNode.h b/panda/src/bullet/bulletRigidBodyNode.h index f0f59cfe3d..e553bbe3d9 100644 --- a/panda/src/bullet/bulletRigidBodyNode.h +++ b/panda/src/bullet/bulletRigidBodyNode.h @@ -105,7 +105,6 @@ private: virtual void setWorldTransform(const btTransform &trans); void set_net_transform(CPT(TransformState) &ts); - void get_net_transform(CPT(TransformState) &ts) const; void sync_b2p(PandaNode *node); bool sync_disabled() const; @@ -114,7 +113,6 @@ private: private: btTransform _trans; - LVecBase3 _scale; bool _disabled; bool _dirty; bool _was_dirty; @@ -123,8 +121,6 @@ private: MotionState *_motion; btRigidBody *_rigid; - CPT(TransformState) _sync; // only used with bullet_full_sync - //////////////////////////////////////////////////////////////////// public: static TypeHandle get_class_type() { diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 908c61eb43..8f9c069906 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -129,13 +129,6 @@ ConfigVariableDouble bullet_additional_damping_angular_threshold PRC_DESC("Only used when bullet-additional-damping is set to TRUE. " "Default value is 0.01.")); -ConfigVariableBool bullet_full_sync -("bullet-full-sync", false, -PRC_DESC("Enables optional synchronisation features like checking " - "for changed in a nodes net transform before each simulation " - "step. Disable these features for better performance. " - "Default value is FALSE.")); - //////////////////////////////////////////////////////////////////// // Function: init_libbullet // Description: Initializes the library. This must be called at diff --git a/panda/src/bullet/config_bullet.h b/panda/src/bullet/config_bullet.h index 89ef6076db..b9c9ea4ac1 100644 --- a/panda/src/bullet/config_bullet.h +++ b/panda/src/bullet/config_bullet.h @@ -40,7 +40,6 @@ extern ConfigVariableDouble bullet_additional_damping_linear_factor; extern ConfigVariableDouble bullet_additional_damping_angular_factor; extern ConfigVariableDouble bullet_additional_damping_linear_threshold; extern ConfigVariableDouble bullet_additional_damping_angular_threshold; -extern ConfigVariableBool bullet_full_sync; extern EXPCL_PANDABULLET void init_libbullet();