1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: HOWTO Mesh LightAnim</TITLE>
<META NAME="description" CONTENT="Crystal Space: HOWTO Mesh LightAnim">
<META NAME="keywords" CONTENT="Crystal Space: HOWTO Mesh LightAnim">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC233"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_117.html#SEC226"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_119.html#SEC237"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_108.html#SEC209"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_116.html#SEC225"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H3> 5.8.2 Mesh Lighting and Animation </H3>
<!--docid::SEC233::-->
<P>
This section describes how to do animation for meshes and how they can
get lit by surrounding lights.
</P><P>
<A NAME="SEC234"></A>
<H4> Animating Meshes </H4>
<!--docid::SEC234::-->
<P>
Not all meshes support animation. All particle systems and 3D sprites
have animation.
</P><P>
The engine is smart enough to only animate mesh objects that are actually
visible on screen.
</P><P>
<A NAME="SEC235"></A>
<H4> Lighting Meshes </H4>
<!--docid::SEC235::-->
<P>
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 <CODE>SetLighting(false)</CODE> on the
state of the mesh object).
</P><P>
To make sure that lighting will be calculated for an object you
need to call <CODE>DeferUpdateLighting()</CODE> 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:
</P><P>
<TABLE><tr><td> </td><td class=example><pre> iMeshWrapper* mesh;
mesh->DeferUpdateLighting (CS_NLIGHT_STATIC|CS_NLIGHT_DYNAMIC, 10);
</pre></td></tr></table></P><P>
This example considers both dynamic and static lights and will take the
10 lights that are closest to the mesh.
</P><P>
<A NAME="SEC236"></A>
<H4> Mesh Include Files </H4>
<!--docid::SEC236::-->
<P>
The include files useful for this section are:
</P><P>
<TABLE><tr><td> </td><td class=example><pre> #include "iengine/mesh.h"
#include "iengine/engine.h"
</pre></td></tr></table><A NAME="HOWTO Mesh Movement"></A>
<HR SIZE=1>
<BR>
<FONT SIZE="-1">
This document was generated
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>
|