瀏覽代碼

JointVertexTransform

David Rose 21 年之前
父節點
當前提交
4bb06ac900
共有 3 個文件被更改,包括 27 次插入36 次删除
  1. 5 16
      panda/src/char/jointVertexTransform.I
  2. 9 10
      panda/src/char/jointVertexTransform.cxx
  3. 13 10
      panda/src/char/jointVertexTransform.h

+ 5 - 16
panda/src/char/jointVertexTransform.I

@@ -18,23 +18,12 @@
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: JointVertexTransform::get_from
+//     Function: JointVertexTransform::get_joint
 //       Access: Published
-//  Description: Returns the joint whose coordinate space this object
-//               moves vertices from.
+//  Description: Returns the joint for which this object returns the
+//               transform.
 ////////////////////////////////////////////////////////////////////
 INLINE const CharacterJoint *JointVertexTransform::
-get_from() const {
-  return _from;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: JointVertexTransform::get_to
-//       Access: Published
-//  Description: Returns the joint whose coordinate space this object
-//               moves vertices into.
-////////////////////////////////////////////////////////////////////
-INLINE const CharacterJoint *JointVertexTransform::
-get_to() const {
-  return _to;
+get_joint() const {
+  return _joint;
 }

+ 9 - 10
panda/src/char/jointVertexTransform.cxx

@@ -44,13 +44,12 @@ JointVertexTransform() :
 //               other indicated joint's space.
 ////////////////////////////////////////////////////////////////////
 JointVertexTransform::
-JointVertexTransform(CharacterJoint *from, CharacterJoint *to) :
-  _from(from),
-  _to(to),
+JointVertexTransform(CharacterJoint *joint) :
+  _joint(joint),
   _matrix_stale(true)
 {
-  // Tell the "to" joint that we need to be informed when it moves.
-  _to->_vertex_transforms.insert(this);
+  // Tell the joint that we need to be informed when it moves.
+  _joint->_vertex_transforms.insert(this);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -60,8 +59,8 @@ JointVertexTransform(CharacterJoint *from, CharacterJoint *to) :
 ////////////////////////////////////////////////////////////////////
 JointVertexTransform::
 ~JointVertexTransform() {
-  // Tell the "to" joint to stop informing us about its motion.
-  _to->_vertex_transforms.erase(this);
+  // Tell the joint to stop informing us about its motion.
+  _joint->_vertex_transforms.erase(this);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -73,8 +72,8 @@ void JointVertexTransform::
 get_matrix(LMatrix4f &matrix) const {
   if (_matrix_stale) {
     ((JointVertexTransform *)this)->_matrix = 
-      _from->_initial_net_transform_inverse *
-      _to->_net_transform;
+      _joint->_initial_net_transform_inverse *
+      _joint->_net_transform;
     ((JointVertexTransform *)this)->_matrix_stale = false;
   }
   
@@ -88,7 +87,7 @@ get_matrix(LMatrix4f &matrix) const {
 ////////////////////////////////////////////////////////////////////
 void JointVertexTransform::
 output(ostream &out) const {
-  out << _to->get_name();
+  out << _joint->get_name();
 }
 
 

+ 13 - 10
panda/src/char/jointVertexTransform.h

@@ -27,11 +27,16 @@
 ////////////////////////////////////////////////////////////////////
 //       Class : JointVertexTransform
 // Description : This is a specialization on VertexTransform that
-//               returns the relative transform from one joint's
-//               initial position to another joint's (or possibly the
-//               same joint's) current position.  It is used to
-//               implement soft-skinned vertices for an animated
-//               character.
+//               returns the transform necessary to move vertices as
+//               if they were assigned to the indicated joint.  The
+//               geometry itself should be parented to the scene graph
+//               at the level of the character's root joint; that is,
+//               it should not be parented under a node directly
+//               animated by any joints.
+//
+//               Multiple combinations of these with different weights
+//               are used to implement soft-skinned vertices for an
+//               animated character.
 //
 //               This is part of the experimental Geom rewrite.
 ////////////////////////////////////////////////////////////////////
@@ -40,19 +45,17 @@ private:
   JointVertexTransform();
 
 PUBLISHED:
-  JointVertexTransform(CharacterJoint *from, CharacterJoint *to);
+  JointVertexTransform(CharacterJoint *joint);
   virtual ~JointVertexTransform();
 
-  INLINE const CharacterJoint *get_from() const;
-  INLINE const CharacterJoint *get_to() const;
+  INLINE const CharacterJoint *get_joint() const;
 
   virtual void get_matrix(LMatrix4f &matrix) const;
 
   virtual void output(ostream &out) const;
 
 private:
-  PT(CharacterJoint) _from;
-  PT(CharacterJoint) _to;
+  PT(CharacterJoint) _joint;
 
   LMatrix4f _matrix;
   bool _matrix_stale;