An animated character, with skeleton-morph animation and either soft- skinned or hard-skinned vertices.
Character(std::string const &name)¶
Undoes the effect of a recent call to
set_lod_animation(). Henceforth, the character will animate every frame, regardless of its distance from the camera.
find_joint(std::string const &name) const¶
Returns a pointer to the joint with the given name, if there is such a joint, or NULL if there is no such joint. This will not return a pointer to a slider.
find_slider(std::string const &name) const¶
Returns a pointer to the slider with the given name, if there is such a slider, or NULL if there is no such slider. This will not return a pointer to a joint.
Recalculates the character even if we think it doesn’t need it.
merge_bundles(PartBundleHandle *old_bundle_handle, PartBundleHandle *other_bundle_handle)¶
Merges old_bundle with new_bundle. old_bundle must be one of the
PartBundleswithin this node. At the end of this call, the old_bundle pointer within this node will be replaced with the new_bundle pointer, and all geometry within this node will be updated to reference new_bundle.
Deprecated: Use the newer version of this method, below.
Merges old_bundle_handle->get_bundle() with new_bundle. old_bundle_handle must be one of the
PartBundleHandlewithin this node. At the end of this call, the bundle pointer within the old_bundle_handle will be replaced with that within the new_bundle_handle pointer, and all geometry within this node will be updated to reference new_bundle.
Normally, this is called when the two bundles have the same, or nearly the same, hierarchies. In this case, new_bundle will simply be assigned over the old_bundle position. However, if any joints are present in one bundle or the other, new_bundle will be modified to contain the union of all joints.
The geometry below this node is also updated to reference new_bundle, instead of the original old_bundle.
This method is intended to unify two different models that share a common skeleton, for instance, different LOD’s of the same model.
set_lod_animation(LPoint3 const ¢er, PN_stdfloat far_distance, PN_stdfloat near_distance, PN_stdfloat delay_factor)¶
Activates a special mode in which the character animates less frequently as it gets further from the camera. This is intended as a simple optimization to minimize the effort of computing animation for lots of characters that may not necessarily be very important to animate every frame.
If the character is closer to the camera than near_distance, then it is animated its normal rate, every frame. If the character is exactly far_distance away, it is animated only every delay_factor seconds (which should be a number greater than 0). If the character is between near_distance and far_distance, its animation rate is linearly interpolated according to its distance between the two. The interpolation function continues beyond far_distance, so that the character is animated increasingly less frequently as it gets farther away.
The distance calculations are made from center, which is a fixed point relative to the character node, to the camera’s lod center or cull center node (or to the camera node itself).
If multiple cameras are viewing the character in any given frame, the closest one counts.
Recalculates the Character’s joints and vertices for the current frame. Normally this is performed automatically during the render and need not be called explicitly.
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 to the current frame, regardless of whether the character is currently onscreen and animating.
write_part_values(std::ostream &out) const¶
Writes a list of the Character’s joints and sliders, along with each current position, in their hierchical structure, to the indicated output stream.
write_parts(std::ostream &out) const¶
Writes a list of the Character’s joints and sliders, in their hierchical structure, to the indicated output stream.