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

4.10.5 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).

Note that objects that don't use lightmaps are normally updated automatically whenever needed. The engine will track when lights are added, removed, or changed (i.e. moving or color change), and the engine will track when the object itself moves. There is one case where this can fail and that's when a light affects an object indirectly through some portal and the object containing the portal changes (i.e. moves or otherwise). In this case the engine will not notice the lighting change on the mesh. If you suffer from this rare case then you can force the set of lights to be recalculated all the time (when the object is visible) by using iMeshWrapper::SetLightingUpdate() and setting the CS_LIGHTINGUPDATE_ALWAYSUPDATE flag. Note that using the same function you can also control the maximum number of lights that can affect your mesh (default is 8).

Mesh Include Files

The include files useful for this section are:

 
#include <iengine/mesh.h>
#include <iengine/engine.h>

This document was generated using texi2html 1.76.