File: cs_206.html

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (262 lines) | stat: -rw-r--r-- 9,603 bytes parent folder | download
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!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: MeshObject Spr3D</TITLE>

<META NAME="description" CONTENT="Crystal Space: MeshObject Spr3D">
<META NAME="keywords" CONTENT="Crystal Space: MeshObject Spr3D">
<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="SEC471"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_205.html#SEC464"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_207.html#SEC478"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_196.html#SEC414"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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> 7.8.5 Sprite3D Mesh Object </H3>
<!--docid::SEC471::-->
<P>

<EM>Written by Jorrit Tyberghein,
<A HREF="mailto:jorrit.tyberghein@uz.kuleuven.ac.be">jorrit.tyberghein@uz.kuleuven.ac.be</A>.</EM>
</P><P>

A 3D Sprite is a complex set of 3D triangles that either supports frame
based animation or else skeletal animation.
</P><P>

<A NAME="SEC472"></A>
<H4> Basic Structure  </H4>
<!--docid::SEC472::-->
<P>

The following SCF class names are used (for <CODE>CS_LOAD_PLUGIN()</CODE>):
</P><P>

<UL>
<LI>
Type plugin: `<SAMP>crystalspace.mesh.object.sprite.3d</SAMP>'
<LI>
Loader plugin: `<SAMP>crystalspace.mesh.loader.sprite.3d</SAMP>'
<LI>
Factory loader plugin: `<SAMP>crystalspace.mesh.loader.factory.sprite.3d</SAMP>'
</UL>
<P>

Objects in this plugin implement the following SCF interfaces (get
with <CODE>SCF_QUERY_INTERFACE()</CODE>):
</P><P>

<UL>
<LI>
<EM>MeshObject</EM>
<UL>
<LI>
Implements `<SAMP>iMeshObject</SAMP>'
<LI>
Implements `<SAMP>iSprite3DState</SAMP>'
<LI>
Implements `<SAMP>iPolygonMesh</SAMP>'
</UL>
<LI>
<EM>MeshObjectFactory</EM>
<UL>
<LI>
Implements `<SAMP>iMeshObjectFactory</SAMP>'
<LI>
Implements `<SAMP>iSprite3DFactoryState</SAMP>'
</UL>
<LI>
<EM>MeshObjectType</EM>
<UL>
<LI>
Implements `<SAMP>iMeshObjectType</SAMP>'
<LI>
Implements `<SAMP>iConfig</SAMP>'
</UL>
</UL>
<P>

<A NAME="SEC473"></A>
<H4> Factory State Interface  </H4>
<!--docid::SEC473::-->
<P>

Use the `<SAMP>iSprite3DFactoryState</SAMP>' SCF interface to access settings for
a 3D sprite factory.  The definition of this interface can be found in
`<TT>CS/include/imesh/sprite3d.h</TT>' and that is also the include file you need
to include in your applications to use this plugin.  Using this interface you
can access the material, triangles, vertices, texture coordinates, normals,
frames, actions, skeletal structure, and various other configuration parameters
for a 3D sprite factory.
</P><P>

For frame based animation you need to access the `<SAMP>iSpriteFrame</SAMP>' and
`<SAMP>iSpriteAction</SAMP>' interfaces (defined in `<TT>CS/include/imesh/sprite3d.h</TT>')
and for skeletal animation you need to work with `<SAMP>iSkeletonLimb</SAMP>',
`<SAMP>iSkeletonConnection</SAMP>', and `<SAMP>iSkeleton</SAMP>' (defined in
`<TT>CS/include/imesh/skeleton.h</TT>').  Note that you will also have to
setup one frame if you use skeletal animation.  This frame defines the
default setup of the sprite if the skeleton is at rest (i.e. all
transformations in the skeleton connectors are identity transformations).
</P><P>

<A NAME="SEC474"></A>
<H4> Factory Loader  </H4>
<!--docid::SEC474::-->
<P>

<DL COMPACT>
<DT><CODE>MATERIAL(materialName)</CODE>
<DD>Material to use for the sprite.
<DT><CODE>FRAME(V(x,y,z:u,v) <small>...</small>)</CODE>
<DD>Define one frame.  A frame is a list of vertices which are specified using the
`<SAMP>V</SAMP>' keyword.  Every vertex has a 3D position in object space and (u,v)
coordinates in the given texture (from 0 to 1).  Note that every frame needs to
have the same number of vertices.
<DT><CODE>ACTION(F(<small>...</small>) <small>...</small>)</CODE>
<DD>Define one action.  An action is a list of frames.  Every frame is annotated
with the `<SAMP>F</SAMP>' keyword which contains the name of the frame to use and a
delay.
<DT><CODE>SKELETON(<small>...</small>)</CODE>
<DD>Define a skeleton. See below for keywords in skeleton.
<DT><CODE>TRIANGLE(i1,i2,i3)</CODE>
<DD>Define one triangle.  The three parameters are the indices for the three
triangle vertices.
<DT><CODE>SMOOTH(base,frame)</CODE>
<DD>Defines how to apply normal smoothing on the sprite.
<DT><CODE>TWEEN(boolean)</CODE>
<DD>Set to true if you want to enable frame tweening.  Default is false.
</DL>
<P>

A skeleton is a hierarchial structure which is defined as follows:
</P><P>

<DL COMPACT>
<DT><CODE>LIMB(<small>...</small>)</CODE>
<DD>A limb defines a connection to a child limb.  This is where the hierarchy kicks
in.  Inside `<SAMP>LIMB</SAMP>' you use the same keywords as on this level.
<DT><CODE>VERTICES(v1,<small>...</small>)</CODE>
<DD>This is a list of vertex indices from the main frame.  This limb will control
the given vertices.
<DT><CODE>TRANSFORM(<small>...</small>)</CODE>
<DD>Specify the default transformation to use for this limb with relation to its
parent (cannot be used on the top level).
</DL>
<P>

<A NAME="SEC475"></A>
<H4> Object State Interface  </H4>
<!--docid::SEC475::-->
<P>

`<SAMP>iSprite3DState</SAMP>' is the SCF interface that you can
use to set/get settings for a 3D Sprite object. The definition of this
interface can be found in `<TT>CS/include/imesh/sprite3d.h</TT>' and that's also the
include file you need to include in your applications to use this plugin.
Using this interface you can access the material, blending mode (mixmode),
current frame and action, current skeletal animation state, and various
other configuration parameters for a 3D sprite object.
</P><P>

The state of a skeleton is described via the following interfaces which are
defined in `<TT>CS/include/imesh/sprite3d.h</TT>':
</P><P>

<UL>
<LI>
<CODE>iSkeletonLimbState</CODE>,
<LI>
<CODE>iSkeletonConnectionState</CODE>
<LI>
<CODE>iSkeletonState</CODE>
</UL>
<P>

<A NAME="SEC476"></A>
<H4> Object Loader  </H4>
<!--docid::SEC476::-->
<P>

<DL COMPACT>
<DT><CODE>FACTORY(factoryName)</CODE>
<DD>Name of the factory to use for creation of this instance.
<DT><CODE>MIXMODE(mode)</CODE>
<DD>Blending mode, one of `<SAMP>ADD</SAMP>', `<SAMP>ALPHA</SAMP>', `<SAMP>COPY</SAMP>', `<SAMP>KEYCOLOR</SAMP>',
`<SAMP>MULTIPLY2</SAMP>', `<SAMP>MULTIPLY</SAMP>', or `<SAMP>TRANSPARENT</SAMP>'.
<DT><CODE>MATERIAL(materialName)</CODE>
<DD>Material to use for the sprite.
<DT><CODE>TWEEN(boolean)</CODE>
<DD>Set to true if you want to enable frame tweening.  Default is false.
<DT><CODE>LIGHTING(boolean)</CODE>
<DD>Set to true if you want to enable lighting.  Default is true.
<DT><CODE>BASECOLOR(r,g,b)</CODE>
<DD>Base color that will be added to all vertex colors. Default 0,0,0.
<DT><CODE>ACTION(actionName)</CODE>
<DD>The default action to use for this sprite instance.
</DL>
<P>

<A NAME="SEC477"></A>
<H4> Configuration Parameters </H4>
<!--docid::SEC477::-->
<P>

The `<TT>sprite3d</TT>' plugin supports the following configuration parameters
via the `<SAMP>iConfig</SAMP>' interface in the mesh object type plugin:
</P><P>

<DL COMPACT>
<DT><CODE>sprlod</CODE>
<DD>Set the sprite level-of-detail (LOD) level.
<DT><CODE>sprlq</CODE>
<DD>Set the sprite lighting quality.
</DL>
<P>

<A NAME="MeshObject Ball"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_205.html#SEC464"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_207.html#SEC478"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_196.html#SEC414"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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>
<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>