4.8. The 'Renderer'

The Cal3D library does not handle the actual rendering itself, but it provides an easy-to-use interface called 'Renderer' to access all needed data for your rendering loop. The basic idea is to go through all the meshes of the model instance and visit one of its submeshes after the other.

For each submesh you execute a number of steps:

  1. Set the current mesh/submesh for the data query.

  2. Get the material data.

  3. Get the deformed vertex data.

  4. Get the transformed normal data.

  5. Get the mapping coordinate data.

  6. Get the face data.

  7. Set the rendering state in the used graphic API, and render the data.

Most of the data is returned in a user-allocated array to make usage of vertex- buffers as easy as possible.

The level-of-detail calculations are done transparently by the Cal3D library. This means that you only need to set the current detail level for the model instance, and you will automatically get the adjusted data in the next rendering loop.