mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-21 06:32:33 -04:00
change merge_bundles() interface
This commit is contained in:
parent
964201d713
commit
f7cc947329
@ -223,32 +223,40 @@ calc_tight_bounds(LPoint3f &min_point, LPoint3f &max_point, bool &found_any,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Character::merge_bundles
|
// Function: Character::merge_bundles
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Merges the other_ith bundle into the this_ith within
|
// Description: Merges old_bundle with new_bundle. old_bundle
|
||||||
// this node. At the end of this call, this node and
|
// must be one of the PartBundles within this node. At
|
||||||
// the other node will share the same bundle pointer at
|
// the end of this call, the old_bundle pointer within
|
||||||
// their corresponding positions (usually zero).
|
// this node will be replaced with the new_bundle
|
||||||
|
// pointer, and all geometry within this node will be
|
||||||
|
// updated to reference new_bundle.
|
||||||
//
|
//
|
||||||
// Normally, this is called when the two bundles have
|
// Normally, this is called when the two bundles have
|
||||||
// the same, or nearly the same, hierarchies. In this
|
// the same, or nearly the same, hierarchies. In this
|
||||||
// case, the indicated bundle will simply be assigned to
|
// case, new_bundle will simply be assigned over the
|
||||||
// the this_ith bundle position. However, if any joints
|
// old_bundle position. However, if any joints are
|
||||||
// are present in one bundle or the other, the new
|
// present in one bundle or the other, new_bundle will
|
||||||
// bundle will contain the union of all joints.
|
// be modified to contain the union of all joints.
|
||||||
//
|
//
|
||||||
// The geometry below this node is also updated to
|
// The geometry below this node is also updated to
|
||||||
// reference the indicated bundle, instead of the
|
// reference new_bundle, instead of the original
|
||||||
// original bundle.
|
// old_bundle.
|
||||||
//
|
//
|
||||||
// This method is intended to unify two different models
|
// This method is intended to unify two different models
|
||||||
// that share a common skeleton, for instance, different
|
// that share a common skeleton, for instance, different
|
||||||
// LOD's of the same model.
|
// LOD's of the same model.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void Character::
|
void Character::
|
||||||
merge_bundles(Character *other, int this_i, int other_i) {
|
merge_bundles(PartBundle *old_bundle, PartBundle *new_bundle) {
|
||||||
nassertv(this_i >= 0 && this_i < (int)_bundles.size());
|
// Find the index number of old_bundle.
|
||||||
nassertv(other_i >= 0 && other_i < (int)other->_bundles.size());
|
size_t index = 0;
|
||||||
CharacterJointBundle *old_bundle = DCAST(CharacterJointBundle, _bundles[this_i]);
|
while (index < _bundles.size()) {
|
||||||
CharacterJointBundle *new_bundle = DCAST(CharacterJointBundle, other->_bundles[other_i]);
|
if (_bundles[index] == old_bundle) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
nassertv_always(index < (int)_bundles.size());
|
||||||
|
|
||||||
if (old_bundle == new_bundle) {
|
if (old_bundle == new_bundle) {
|
||||||
// Trivially return.
|
// Trivially return.
|
||||||
return;
|
return;
|
||||||
@ -257,7 +265,7 @@ merge_bundles(Character *other, int this_i, int other_i) {
|
|||||||
// First, merge the bundles themselves.
|
// First, merge the bundles themselves.
|
||||||
JointMap joint_map;
|
JointMap joint_map;
|
||||||
r_merge_bundles(joint_map, old_bundle, new_bundle);
|
r_merge_bundles(joint_map, old_bundle, new_bundle);
|
||||||
_bundles[this_i] = new_bundle;
|
_bundles[index] = new_bundle;
|
||||||
|
|
||||||
// Now convert the geometry to use the new bundle.
|
// Now convert the geometry to use the new bundle.
|
||||||
GeomVertexMap gvmap;
|
GeomVertexMap gvmap;
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE CharacterJointBundle *get_bundle(int i) const;
|
INLINE CharacterJointBundle *get_bundle(int i) const;
|
||||||
void merge_bundles(Character *other, int this_i, int other_i);
|
void merge_bundles(PartBundle *old_bundle, PartBundle *other_bundle);
|
||||||
|
|
||||||
CharacterJoint *find_joint(const string &name) const;
|
CharacterJoint *find_joint(const string &name) const;
|
||||||
CharacterSlider *find_slider(const string &name) const;
|
CharacterSlider *find_slider(const string &name) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user