mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
JointVertexTransform
This commit is contained in:
parent
24353df3ef
commit
4bb06ac900
@ -18,23 +18,12 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: JointVertexTransform::get_from
|
// Function: JointVertexTransform::get_joint
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns the joint whose coordinate space this object
|
// Description: Returns the joint for which this object returns the
|
||||||
// moves vertices from.
|
// transform.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE const CharacterJoint *JointVertexTransform::
|
INLINE const CharacterJoint *JointVertexTransform::
|
||||||
get_from() const {
|
get_joint() const {
|
||||||
return _from;
|
return _joint;
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,12 @@ JointVertexTransform() :
|
|||||||
// other indicated joint's space.
|
// other indicated joint's space.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
JointVertexTransform::
|
JointVertexTransform::
|
||||||
JointVertexTransform(CharacterJoint *from, CharacterJoint *to) :
|
JointVertexTransform(CharacterJoint *joint) :
|
||||||
_from(from),
|
_joint(joint),
|
||||||
_to(to),
|
|
||||||
_matrix_stale(true)
|
_matrix_stale(true)
|
||||||
{
|
{
|
||||||
// Tell the "to" joint that we need to be informed when it moves.
|
// Tell the joint that we need to be informed when it moves.
|
||||||
_to->_vertex_transforms.insert(this);
|
_joint->_vertex_transforms.insert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -60,8 +59,8 @@ JointVertexTransform(CharacterJoint *from, CharacterJoint *to) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
JointVertexTransform::
|
JointVertexTransform::
|
||||||
~JointVertexTransform() {
|
~JointVertexTransform() {
|
||||||
// Tell the "to" joint to stop informing us about its motion.
|
// Tell the joint to stop informing us about its motion.
|
||||||
_to->_vertex_transforms.erase(this);
|
_joint->_vertex_transforms.erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -73,8 +72,8 @@ void JointVertexTransform::
|
|||||||
get_matrix(LMatrix4f &matrix) const {
|
get_matrix(LMatrix4f &matrix) const {
|
||||||
if (_matrix_stale) {
|
if (_matrix_stale) {
|
||||||
((JointVertexTransform *)this)->_matrix =
|
((JointVertexTransform *)this)->_matrix =
|
||||||
_from->_initial_net_transform_inverse *
|
_joint->_initial_net_transform_inverse *
|
||||||
_to->_net_transform;
|
_joint->_net_transform;
|
||||||
((JointVertexTransform *)this)->_matrix_stale = false;
|
((JointVertexTransform *)this)->_matrix_stale = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ get_matrix(LMatrix4f &matrix) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void JointVertexTransform::
|
void JointVertexTransform::
|
||||||
output(ostream &out) const {
|
output(ostream &out) const {
|
||||||
out << _to->get_name();
|
out << _joint->get_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,11 +27,16 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : JointVertexTransform
|
// Class : JointVertexTransform
|
||||||
// Description : This is a specialization on VertexTransform that
|
// Description : This is a specialization on VertexTransform that
|
||||||
// returns the relative transform from one joint's
|
// returns the transform necessary to move vertices as
|
||||||
// initial position to another joint's (or possibly the
|
// if they were assigned to the indicated joint. The
|
||||||
// same joint's) current position. It is used to
|
// geometry itself should be parented to the scene graph
|
||||||
// implement soft-skinned vertices for an animated
|
// at the level of the character's root joint; that is,
|
||||||
// character.
|
// 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.
|
// This is part of the experimental Geom rewrite.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -40,19 +45,17 @@ private:
|
|||||||
JointVertexTransform();
|
JointVertexTransform();
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
JointVertexTransform(CharacterJoint *from, CharacterJoint *to);
|
JointVertexTransform(CharacterJoint *joint);
|
||||||
virtual ~JointVertexTransform();
|
virtual ~JointVertexTransform();
|
||||||
|
|
||||||
INLINE const CharacterJoint *get_from() const;
|
INLINE const CharacterJoint *get_joint() const;
|
||||||
INLINE const CharacterJoint *get_to() const;
|
|
||||||
|
|
||||||
virtual void get_matrix(LMatrix4f &matrix) const;
|
virtual void get_matrix(LMatrix4f &matrix) const;
|
||||||
|
|
||||||
virtual void output(ostream &out) const;
|
virtual void output(ostream &out) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PT(CharacterJoint) _from;
|
PT(CharacterJoint) _joint;
|
||||||
PT(CharacterJoint) _to;
|
|
||||||
|
|
||||||
LMatrix4f _matrix;
|
LMatrix4f _matrix;
|
||||||
bool _matrix_stale;
|
bool _matrix_stale;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user