force_update, etc.

This commit is contained in:
David Rose 2003-01-24 00:52:05 +00:00
parent 50eb99ed62
commit 1e334b3a03
5 changed files with 50 additions and 16 deletions

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////
// Function: Character::get_bundle
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE CharacterJointBundle *Character::
@ -31,7 +31,7 @@ get_bundle() const {
////////////////////////////////////////////////////////////////////
// Function: Character::get_computed_vertices
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE ComputedVertices *Character::
@ -41,7 +41,7 @@ get_computed_vertices() const {
////////////////////////////////////////////////////////////////////
// Function: Character::get_num_parts
// Access: Public
// Access: Published
// Description: Returns the total number of moving parts (e.g. joints
// and sliders) associated with the Character.
////////////////////////////////////////////////////////////////////
@ -52,7 +52,7 @@ get_num_parts() const {
////////////////////////////////////////////////////////////////////
// Function: Character::get_part
// Access: Public
// Access: Published
// Description: Returns the nth moving part associated with the
// Character.
////////////////////////////////////////////////////////////////////
@ -64,7 +64,7 @@ get_part(int n) const {
////////////////////////////////////////////////////////////////////
// Function: Character::write_parts
// Access: Public
// Access: Published
// Description: Writes a list of the Character's joints and sliders,
// in their hierchical structure, to the indicated
// output stream.
@ -76,7 +76,7 @@ write_parts(ostream &out) const {
////////////////////////////////////////////////////////////////////
// Function: Character::write_part_values
// Access: Public
// Access: Published
// Description: Writes a list of the Character's joints and sliders,
// along with each current position, in their hierchical
// structure, to the indicated output stream.

View File

@ -154,7 +154,7 @@ cull_callback(CullTraverser *, CullTraverserData &) {
////////////////////////////////////////////////////////////////////
// Function: Character::update_to_now
// Access: Public
// Access: Published
// Description: Advances the character's frame to the current time,
// and then calls update(). This can be used by show
// code to force an update of the character's position
@ -175,7 +175,7 @@ update_to_now() {
////////////////////////////////////////////////////////////////////
// Function: Character::update
// Access: Public
// Access: Published
// Description: Recalculates the Character's joints and vertices for
// the current frame. Normally this is performed
// automatically during the render and need not be
@ -198,6 +198,26 @@ update() {
}
}
////////////////////////////////////////////////////////////////////
// Function: Character::force_update
// Access: Published
// Description: Recalculates the character even if we think it
// doesn't need it.
////////////////////////////////////////////////////////////////////
void Character::
force_update() {
// Statistics
PStatTimer timer(_char_pcollector);
// First, update all the joints and sliders.
get_bundle()->force_update();
// Now update the vertices.
if (_computed_vertices != (ComputedVertices *)NULL) {
_computed_vertices->update(this);
}
}
////////////////////////////////////////////////////////////////////
// Function: Character::copy_joints
// Access: Private

View File

@ -63,6 +63,7 @@ PUBLISHED:
void update_to_now();
void update();
void force_update();
private:
void copy_joints(PartGroup *copy, PartGroup *orig);

View File

@ -149,7 +149,7 @@ update_internals(PartGroup *parent, bool self_changed, bool parent_changed) {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::add_net_transform
// Access: Public
// Access: Published
// Description: 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
@ -163,7 +163,7 @@ add_net_transform(PandaNode *node) {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::remove_net_transform
// Access: Public
// Access: Published
// Description: 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
@ -177,7 +177,7 @@ remove_net_transform(PandaNode *node) {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::has_net_transform
// Access: Public
// Access: Published
// Description: 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.
@ -189,7 +189,7 @@ has_net_transform(PandaNode *node) const {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::clear_net_transforms
// Access: Public
// Access: Published
// Description: Removes all nodes from the list of nodes that will be
// updated each frame with the joint's net transform
// from the root.
@ -201,7 +201,7 @@ clear_net_transforms() {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::add_local_transform
// Access: Public
// Access: Published
// Description: 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
@ -215,7 +215,7 @@ add_local_transform(PandaNode *node) {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::remove_local_transform
// Access: Public
// Access: Published
// Description: 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
@ -229,7 +229,7 @@ remove_local_transform(PandaNode *node) {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::has_local_transform
// Access: Public
// Access: Published
// Description: 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.
@ -241,7 +241,7 @@ has_local_transform(PandaNode *node) const {
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::clear_local_transforms
// Access: Public
// Access: Published
// Description: Removes all nodes from the list of nodes that will be
// updated each frame with the joint's local transform
// from its parent.
@ -251,6 +251,17 @@ clear_local_transforms() {
_local_transform_nodes.clear();
}
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::get_transform
// Access: Published
// Description: Copies the joint's current transform into the
// indicated matrix.
////////////////////////////////////////////////////////////////////
void CharacterJoint::
get_transform(LMatrix4f &transform) const {
transform = _value;
}
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::write_datagram
// Access: Public

View File

@ -54,6 +54,8 @@ PUBLISHED:
bool has_local_transform(PandaNode *node) const;
void clear_local_transforms();
void get_transform(LMatrix4f &transform) const;
private:
typedef pset< PT(PandaNode) > NodeList;
NodeList _net_transform_nodes;