Meshes and Submeshes

The Cal3D library can handle models built from one or more meshes. These meshes must be composed from triangular faces, but do not need to be in any special form otherwise. Each face inside the mesh is assigned to a corresponding submesh which holds all faces with the same material. This classification is done to minimize render state changes in the rendering phase.

Each submesh contains a list of vertices and a list of faces. The data stored per vertex includes the position, the normal, the mapping coordinates, the level-of-detail data and all the influences from the assigned bones. The face list is a simple structure that holds a vertex index for each corner of the face.

Once again, the core model holds all meshes for a specific model type, whereas the model instances have an active set of attached meshes. Each attached mesh has a current state for material and level-of-detail settings, so every model instance can be handled completely independent from the others.