[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.9.3 Mesh Lighting and Animation

This section describes how to do animation for meshes and how they can get lit by surrounding lights.

Animating Meshes

Not all meshes support animation. All particle systems and 3D sprites have animation.

The engine is smart enough to only animate mesh objects that are actually visible on screen.

Lighting Meshes

Almost all meshes support lighting. Mesh things are treated specially as they have support for lightmaps and dynamic lighting using dynamic lightmaps. So this discussion is not for them. But for all other meshes the system below applies. Note that for many meshes lighting can be disabled (usually by calling SetLighting(false) on the state of the mesh object).

To make sure that lighting will be calculated for an object you need to call DeferUpdateLighting() on the mesh wrapper. Usually this is called after creation of a mesh and also after moving lights and/or the mesh itself. This call is cheap. It will only set a flag that lighting has to be recalculated as soon as the object will be visible. Here is an example:

 
  iMeshWrapper* mesh;
  mesh->DeferUpdateLighting (CS_NLIGHT_STATIC|CS_NLIGHT_DYNAMIC, 10);

This example considers both dynamic and static lights and will take the 10 lights that are closest to the mesh.

Mesh Include Files

The include files useful for this section are:

 
  #include "iengine/mesh.h"
  #include "iengine/engine.h"


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html