From 737096d8fdc566c500970cf540097712436c1d34 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 5 Jan 2007 18:43:06 +0000 Subject: [PATCH] fix laggy dynamic joints when blends are in effect --- panda/src/chan/animChannelMatrixDynamic.I | 22 ++++++++++++++++++++ panda/src/chan/animChannelMatrixDynamic.cxx | 23 ++++++++++++++++++++- panda/src/chan/animChannelMatrixDynamic.h | 3 +++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/panda/src/chan/animChannelMatrixDynamic.I b/panda/src/chan/animChannelMatrixDynamic.I index 82f56132a5..c2a167d2c3 100644 --- a/panda/src/chan/animChannelMatrixDynamic.I +++ b/panda/src/chan/animChannelMatrixDynamic.I @@ -17,3 +17,25 @@ //////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// +// Function: AnimChannelMatrixDynamic::get_value_transform +// Access: Published +// Description: Returns the explicit TransformState value that was +// set via set_value(), if any. +//////////////////////////////////////////////////////////////////// +INLINE const TransformState *AnimChannelMatrixDynamic:: +get_value_transform() const { + return _value; +} + +//////////////////////////////////////////////////////////////////// +// Function: AnimChannelMatrixDynamic::get_value_node +// Access: Published +// Description: Returns the node that was set via set_value_node(), +// if any. +//////////////////////////////////////////////////////////////////// +INLINE PandaNode *AnimChannelMatrixDynamic:: +get_value_node() const { + return _value_node; +} diff --git a/panda/src/chan/animChannelMatrixDynamic.cxx b/panda/src/chan/animChannelMatrixDynamic.cxx index 6b514847fa..794d473720 100644 --- a/panda/src/chan/animChannelMatrixDynamic.cxx +++ b/panda/src/chan/animChannelMatrixDynamic.cxx @@ -77,6 +77,9 @@ has_changed(double, double) { //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: get_value(int, LMatrix4f &mat) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } mat = _value->get_mat(); } @@ -87,7 +90,10 @@ get_value(int, LMatrix4f &mat) { // without any scale or shear information. //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: -get_value_no_scale_shear(int frame, LMatrix4f &mat) { +get_value_no_scale_shear(int, LMatrix4f &mat) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } if (_value->has_scale() || _value->has_shear()) { compose_matrix(mat, LVecBase3f(1.0f, 1.0f, 1.0f), _value->get_hpr(), _value->get_pos()); @@ -103,6 +109,9 @@ get_value_no_scale_shear(int frame, LMatrix4f &mat) { //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: get_scale(int, LVecBase3f &scale) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } scale = _value->get_scale(); } @@ -115,6 +124,9 @@ get_scale(int, LVecBase3f &scale) { //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: get_hpr(int, LVecBase3f &hpr) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } hpr = _value->get_hpr(); } @@ -127,6 +139,9 @@ get_hpr(int, LVecBase3f &hpr) { //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: get_quat(int, LQuaternionf &quat) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } quat = _value->get_quat(); } @@ -139,6 +154,9 @@ get_quat(int, LQuaternionf &quat) { //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: get_pos(int, LVecBase3f &pos) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } pos = _value->get_pos(); } @@ -151,6 +169,9 @@ get_pos(int, LVecBase3f &pos) { //////////////////////////////////////////////////////////////////// void AnimChannelMatrixDynamic:: get_shear(int, LVecBase3f &shear) { + if (_value_node != (PandaNode *)NULL) { + _value = _value_node->get_transform(); + } shear = _value->get_shear(); } diff --git a/panda/src/chan/animChannelMatrixDynamic.h b/panda/src/chan/animChannelMatrixDynamic.h index c1155eb372..11a2330187 100644 --- a/panda/src/chan/animChannelMatrixDynamic.h +++ b/panda/src/chan/animChannelMatrixDynamic.h @@ -61,6 +61,9 @@ PUBLISHED: void set_value(const TransformState *value); void set_value_node(PandaNode *node); + INLINE const TransformState *get_value_transform() const; + INLINE PandaNode *get_value_node() const; + private: // This is filled in only if we are using the set_value_node() // interface to get an implicit value from the transform on the