Panda3D
|
This represents one joint of the character's animation, containing an animating transform matrix. More...
#include "characterJoint.h"
Public Member Functions | |
CharacterJoint (Character *character, PartBundle *root, PartGroup *parent, const string &name, const LMatrix4 &default_value) | |
bool | add_local_transform (PandaNode *node) |
Adds the indicated node to the list of nodes that will be updated each frame with the joint's local transform from its parent. | |
bool | add_net_transform (PandaNode *node) |
Adds the indicated node to the list of nodes that will be updated each frame with the joint's net transform from the root. | |
void | clear_local_transforms () |
Removes all nodes from the list of nodes that will be updated each frame with the joint's local transform from its parent. | |
void | clear_net_transforms () |
Removes all nodes from the list of nodes that will be updated each frame with the joint's net transform from the root. | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Takes in a vector of pointers to TypedWritable objects that correspond to all the requests for pointers that this object made to BamReader. | |
CPT (TransformState) get_transform_state() const | |
virtual void | do_xform (const LMatrix4 &mat, const LMatrix4 &inv_mat) |
Called by PartBundle::xform(), this indicates the indicated transform is being applied to the root joint. | |
virtual TypeHandle | force_init_type () |
Character * | get_character () const |
Returns the Character that owns this joint. | |
NodePathCollection | get_local_transforms () |
Returns a list of the local transforms set for this node. | |
void | get_net_transform (LMatrix4 &transform) const |
Copies the joint's current net transform (composed from the root of the character joint hierarchy) into the indicated matrix. | |
NodePathCollection | get_net_transforms () |
Returns a list of the net transforms set for this node. | |
void | get_transform (LMatrix4 &transform) const |
Copies the joint's current transform into the indicated matrix. | |
const LMatrix4 & | get_transform () const |
Returns the transform matrix of the joint. | |
virtual TypeHandle | get_type () const |
bool | has_local_transform (PandaNode *node) const |
Returns true if the node is on the list of nodes that will be updated each frame with the joint's local transform from its parent, false otherwise. | |
bool | has_net_transform (PandaNode *node) const |
Returns true if the node is on the list of nodes that will be updated each frame with the joint's net transform from the root, false otherwise. | |
virtual bool | is_character_joint () const |
Returns true if this part is a CharacterJoint, false otherwise. | |
virtual PartGroup * | make_copy () const |
Allocates and returns a new copy of the node. | |
PT (PandaNode) _geom_node | |
bool | remove_local_transform (PandaNode *node) |
Removes the indicated node from the list of nodes that will be updated each frame with the joint's local transform from its parent. | |
bool | remove_net_transform (PandaNode *node) |
Removes the indicated node from the list of nodes that will be updated each frame with the joint's net transform from the root. | |
virtual bool | update_internals (PartBundle *root, PartGroup *parent, bool self_changed, bool parent_changed, Thread *current_thread) |
This is called by do_update() whenever the part or some ancestor has changed values. | |
virtual void | write_datagram (BamWriter *manager, Datagram &me) |
Function to write the important information in the particular object to a Datagram. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static TypedWritable * | make_CharacterJoint (const FactoryParams ¶ms) |
Factory method to generate a CharacterJoint object. | |
static void | register_with_read_factory () |
Factory method to generate a CharacterJoint object. | |
Public Attributes | |
LMatrix4 | _initial_net_transform_inverse |
LMatrix4 | _net_transform |
Protected Member Functions | |
CharacterJoint () | |
For internal use only. | |
CharacterJoint (const CharacterJoint ©) | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place. | |
Friends | |
class | Character |
class | CharacterJointBundle |
class | JointVertexTransform |
This represents one joint of the character's animation, containing an animating transform matrix.
Definition at line 34 of file characterJoint.h.
CharacterJoint::CharacterJoint | ( | ) | [protected] |
For internal use only.
Definition at line 32 of file characterJoint.cxx.
Referenced by make_CharacterJoint(), and make_copy().
bool CharacterJoint::add_local_transform | ( | PandaNode * | node | ) |
Adds the indicated node to the list of nodes that will be updated each frame with the joint's local transform from its parent.
Returns true if the node is successfully added, false if it had already been added.
The Character pointer should be the Character object that owns this joint; this will be used to create a CharacterJointEffect for this node. If it is NULL, no such effect will be created.
A CharacterJointEffect for this joint's Character will automatically be added to the specified node.
Definition at line 325 of file characterJoint.cxx.
References Thread::get_current_thread(), PandaNode::set_effect(), and PandaNode::set_transform().
bool CharacterJoint::add_net_transform | ( | PandaNode * | node | ) |
Adds the indicated node to the list of nodes that will be updated each frame with the joint's net transform from the root.
Returns true if the node is successfully added, false if it had already been added.
A CharacterJointEffect for this joint's Character will automatically be added to the specified node.
Definition at line 215 of file characterJoint.cxx.
References Thread::get_current_thread(), PandaNode::set_effect(), and PandaNode::set_transform().
void CharacterJoint::clear_local_transforms | ( | ) |
Removes all nodes from the list of nodes that will be updated each frame with the joint's local transform from its parent.
Definition at line 377 of file characterJoint.cxx.
References ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::clear(), PandaNode::clear_effect(), ordered_vector< Key, Compare >::end(), get_character(), and PandaNode::get_effect().
void CharacterJoint::clear_net_transforms | ( | ) |
Removes all nodes from the list of nodes that will be updated each frame with the joint's net transform from the root.
Definition at line 267 of file characterJoint.cxx.
References ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::clear(), PandaNode::clear_effect(), ordered_vector< Key, Compare >::end(), get_character(), and PandaNode::get_effect().
int CharacterJoint::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) | [virtual] |
Takes in a vector of pointers to TypedWritable objects that correspond to all the requests for pointers that this object made to BamReader.
Reimplemented from MovingPartBase.
Definition at line 580 of file characterJoint.cxx.
References BamReader::get_file_minor_ver().
Called by PartBundle::xform(), this indicates the indicated transform is being applied to the root joint.
Reimplemented from PartGroup.
Definition at line 194 of file characterJoint.cxx.
void CharacterJoint::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.
Reimplemented from MovingPart< ACMatrixSwitchType >.
Definition at line 551 of file characterJoint.cxx.
References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), LMatrix4f::read_datagram(), and BamReader::read_pointer().
Referenced by make_CharacterJoint().
Character * CharacterJoint::get_character | ( | ) | const |
Returns the Character that owns this joint.
Definition at line 451 of file characterJoint.cxx.
Referenced by clear_local_transforms(), clear_net_transforms(), remove_local_transform(), and remove_net_transform().
NodePathCollection CharacterJoint::get_local_transforms | ( | ) |
Returns a list of the local transforms set for this node.
Note that this returns a list of NodePaths, even though the local transforms are actually a list of PandaNodes.
Definition at line 403 of file characterJoint.cxx.
References NodePathCollection::add_path(), NodePath::any_path(), ordered_vector< Key, Compare >::begin(), and ordered_vector< Key, Compare >::end().
void CharacterJoint::get_net_transform | ( | LMatrix4 & | transform | ) | const |
Copies the joint's current net transform (composed from the root of the character joint hierarchy) into the indicated matrix.
Definition at line 441 of file characterJoint.cxx.
NodePathCollection CharacterJoint::get_net_transforms | ( | ) |
Returns a list of the net transforms set for this node.
Note that this returns a list of NodePaths, even though the net transforms are actually a list of PandaNodes.
Definition at line 293 of file characterJoint.cxx.
References NodePathCollection::add_path(), NodePath::any_path(), ordered_vector< Key, Compare >::begin(), and ordered_vector< Key, Compare >::end().
const LMatrix4 & CharacterJoint::get_transform | ( | ) | const [inline] |
Returns the transform matrix of the joint.
Definition at line 21 of file characterJoint.I.
void CharacterJoint::get_transform | ( | LMatrix4 & | transform | ) | const |
Copies the joint's current transform into the indicated matrix.
Definition at line 424 of file characterJoint.cxx.
bool CharacterJoint::has_local_transform | ( | PandaNode * | node | ) | const |
Returns true if the node is on the list of nodes that will be updated each frame with the joint's local transform from its parent, false otherwise.
Definition at line 365 of file characterJoint.cxx.
References ordered_vector< Key, Compare >::count().
bool CharacterJoint::has_net_transform | ( | PandaNode * | node | ) | const |
Returns true if the node is on the list of nodes that will be updated each frame with the joint's net transform from the root, false otherwise.
Definition at line 255 of file characterJoint.cxx.
References ordered_vector< Key, Compare >::count().
bool CharacterJoint::is_character_joint | ( | ) | const [virtual] |
Returns true if this part is a CharacterJoint, false otherwise.
This is a tiny optimization over is_of_type(CharacterType::get_class_type()).
Reimplemented from PartGroup.
Definition at line 94 of file characterJoint.cxx.
TypedWritable * CharacterJoint::make_CharacterJoint | ( | const FactoryParams & | params | ) | [static] |
Factory method to generate a CharacterJoint object.
Definition at line 609 of file characterJoint.cxx.
References CharacterJoint(), and fillin().
Referenced by register_with_read_factory().
PartGroup * CharacterJoint::make_copy | ( | ) | const [virtual] |
Allocates and returns a new copy of the node.
Children are not copied, but see copy_subgraph().
Reimplemented from PartGroup.
Definition at line 105 of file characterJoint.cxx.
References CharacterJoint().
void CharacterJoint::register_with_read_factory | ( | ) | [static] |
Factory method to generate a CharacterJoint object.
Reimplemented from MovingPartMatrix.
Definition at line 625 of file characterJoint.cxx.
References BamReader::get_factory(), make_CharacterJoint(), and Factory< Type >::register_factory().
bool CharacterJoint::remove_local_transform | ( | PandaNode * | node | ) |
Removes the indicated node from the list of nodes that will be updated each frame with the joint's local transform from its parent.
Returns true if the node is successfully removed, false if it was not on the list.
If the node has a CharacterJointEffect that matches this joint's Character, it will be cleared.
Definition at line 347 of file characterJoint.cxx.
References PandaNode::clear_effect(), get_character(), and PandaNode::get_effect().
bool CharacterJoint::remove_net_transform | ( | PandaNode * | node | ) |
Removes the indicated node from the list of nodes that will be updated each frame with the joint's net transform from the root.
Returns true if the node is successfully removed, false if it was not on the list.
If the node has a CharacterJointEffect that matches this joint's Character, it will be cleared.
Definition at line 237 of file characterJoint.cxx.
References PandaNode::clear_effect(), get_character(), and PandaNode::get_effect().
bool CharacterJoint::update_internals | ( | PartBundle * | root, |
PartGroup * | parent, | ||
bool | self_changed, | ||
bool | parent_changed, | ||
Thread * | current_thread | ||
) | [virtual] |
This is called by do_update() whenever the part or some ancestor has changed values.
It is a hook for derived classes to update whatever cache they may have that depends on these.
The return value is true if the part has changed as a result of the update, or false otherwise.
In the case of a CharacterJoint, of course, it means to recompute the joint angles and associated transforms for this particular joint.
Reimplemented from MovingPartBase.
Definition at line 125 of file characterJoint.cxx.
References ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::empty(), ordered_vector< Key, Compare >::end(), PartBundle::get_root_xform(), PartGroup::is_character_joint(), and PandaNode::set_transform().
Function to write the important information in the particular object to a Datagram.
Reimplemented from MovingPart< ACMatrixSwitchType >.
Definition at line 519 of file characterJoint.cxx.
References Datagram::add_uint16(), ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::end(), ordered_vector< Key, Compare >::size(), LMatrix4f::write_datagram(), and BamWriter::write_pointer().