Game Development Reference
In-Depth Information
Figure 7.3 A two bone set-up with some basic overlapping.
deforms vertices 9-12. So the list of point indices for Bone01 is simply {1,
2, 3, 4, 5, 6, 7, 8} and the list for Bone02 is {5, 6, 7, 8, 9, 10, 11, 12}. In
a more complex example, the vertex numbers would not be so obvious
and the list could easily be {2, 34, 72, 123, 125, 212, 216, 321, 322, 333,
469} or any other arbitrary list from the mesh; nevertheless, the principle
of the system remains the same. As the program initializes the data,
Bone01 is created in memory. The software creates an array of eight
pointers to vertices 1-8 from the single mesh. Bone02 dynamically
creates the set of vertices that point to vertices 5-12 from the single
mesh. The single mesh is informed that it is no longer responsible for its
own deformations using a weight flag for each vertex. A possible type
definition for the vertices in the single mesh is:
typedef stMESHVERTEX{
double ox,oy,oz; //Original vertex location
double wx,wy,wz; //World transformed vertex location
int weight;
//0 = vertex transformed by mesh
//n = vertex transformed by n
// controls
}MESHVERTEX;
We ensure that the weight parameter is set to zero on creation of the
single mesh, indicating that the mesh itself is responsible for the