add steal_vrefs

This commit is contained in:
David Rose 2003-07-20 15:50:00 +00:00
parent 986f3f8bdc
commit 397b886289
2 changed files with 21 additions and 0 deletions

View File

@ -505,6 +505,26 @@ get_vertex_membership(const EggVertex *vert) const {
}
}
////////////////////////////////////////////////////////////////////
// Function: EggGroup::steal_vrefs
// Access: Public
// Description: Moves all of the vertex references from the indicated
// other group into this one. If a given vertex was
// previously shared by both groups, the relative
// memberships will be summed.
////////////////////////////////////////////////////////////////////
void EggGroup::
steal_vrefs(EggGroup *other) {
nassertv(other != this);
VertexRef::const_iterator vri;
for (vri = other->vref_begin(); vri != other->vref_end(); ++vri) {
EggVertex *vert = (*vri).first;
double membership = (*vri).second;
ref_vertex(vert, membership);
}
other->unref_all_vertices();
}
#ifndef NDEBUG

View File

@ -198,6 +198,7 @@ public:
void unref_vertex(EggVertex *vert);
void unref_all_vertices();
double get_vertex_membership(const EggVertex *vert) const;
void steal_vrefs(EggGroup *other);
INLINE VertexRef::const_iterator vref_begin() const;
INLINE VertexRef::const_iterator vref_end() const;