aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/animation__playlist_8cpp-source.html
blob: d358880acec74955923127b7a6169a615315315f (plain)
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG  SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>animation_playlist.cpp</h1><a href="animation__playlist_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="animation__playlist_8h.html">3d/animation_playlist.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font>
00031 <font class="preprocessor">#include &lt;math.h&gt;</font>
00032 
00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00034 
00035 <font class="keyword">namespace </font>NL3D 
00036 {
00037 
00038 <font class="comment">// ***************************************************************************</font>
00039 
<a name="l00040"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a0">00040</a> CAnimationPlaylist::CAnimationPlaylist()
00041 {
00042         <font class="comment">// Empty the playlist</font>
00043         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a1">emptyPlayList</a> ();
00044 
00045         <font class="comment">// Set default wrap mode</font>
00046         <font class="keywordflow">for</font> (uint i=0; i&lt;CChannelMixer::NumAnimationSlot; i++)
00047                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o10">_WrapMode</a>[i]=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s6s1">Clamp</a>;
00048 }
00049 
00050 <font class="comment">// ***************************************************************************</font>
00051 
<a name="l00052"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a1">00052</a> <font class="keywordtype">void</font> CAnimationPlaylist::emptyPlayList ()
00053 {
00054         <font class="comment">// Empty each slot</font>
00055         <font class="keywordflow">for</font> (uint i=0; i&lt;CChannelMixer::NumAnimationSlot; i++)
00056         {
00057                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[i]=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s5s0">empty</a>;
00058                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o1">_SkeletonWeight</a>[i]=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s5s0">empty</a>;
00059                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o2">_InvertWeight</a>[i]=<font class="keyword">false</font>;
00060                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o3">_TimeOrigin</a>[i]=0.f;
00061                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o4">_SpeedFactor</a>[i]=1.f;
00062                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o5">_StartWeight</a>[i]=1.f;
00063                 <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o7">_EndWeight</a>[i]=1.f;
00064         }
00065 }
00066 
00067 <font class="comment">// ***************************************************************************</font>
00068 
<a name="l00069"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a2">00069</a> <font class="keywordtype">void</font> CAnimationPlaylist::setAnimation (uint8 slot, uint animation)
00070 {
00071         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[slot]=animation;
00072 }
00073 
00074 <font class="comment">// ***************************************************************************</font>
00075 
<a name="l00076"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a3">00076</a> uint CAnimationPlaylist::getAnimation (uint8 slot)<font class="keyword"> const</font>
00077 <font class="keyword"></font>{
00078         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[slot];
00079 }
00080 
00081 <font class="comment">// ***************************************************************************</font>
00082 
<a name="l00083"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a4">00083</a> <font class="keywordtype">void</font> CAnimationPlaylist::setSkeletonWeight (uint8 slot, uint skeletonId, <font class="keywordtype">bool</font> inverted)
00084 {
00085         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o1">_SkeletonWeight</a>[slot]=skeletonId;
00086         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o2">_InvertWeight</a>[slot]=inverted;
00087 }
00088 
00089 <font class="comment">// ***************************************************************************</font>
00090 
<a name="l00091"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a5">00091</a> uint CAnimationPlaylist::getSkeletonWeight (uint8 slot, <font class="keywordtype">bool</font> &amp;inverted)<font class="keyword"> const</font>
00092 <font class="keyword"></font>{
00093         inverted=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o2">_InvertWeight</a>[slot];
00094         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o1">_SkeletonWeight</a>[slot];
00095 }
00096 
00097 <font class="comment">// ***************************************************************************</font>
00098 
<a name="l00099"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a6">00099</a> <font class="keywordtype">void</font> CAnimationPlaylist::setTimeOrigin (uint8 slot, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> timeOrigin)
00100 {
00101         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o3">_TimeOrigin</a>[slot]=timeOrigin;
00102 }
00103 
00104 <font class="comment">// ***************************************************************************</font>
00105 
<a name="l00106"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a7">00106</a> <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> CAnimationPlaylist::getTimeOrigin (uint8 slot)<font class="keyword"> const</font>
00107 <font class="keyword"></font>{
00108         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o3">_TimeOrigin</a>[slot];
00109 }
00110 
00111 <font class="comment">// ***************************************************************************</font>
00112 
<a name="l00113"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a8">00113</a> <font class="keywordtype">void</font> CAnimationPlaylist::setSpeedFactor (uint8 slot, <font class="keywordtype">float</font> speedFactor)
00114 {
00115         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o4">_SpeedFactor</a>[slot]=speedFactor;
00116 }
00117 
00118 <font class="comment">// ***************************************************************************</font>
00119 
<a name="l00120"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a9">00120</a> <font class="keywordtype">float</font> CAnimationPlaylist::getSpeedFactor (uint8 slot)<font class="keyword"> const</font>
00121 <font class="keyword"></font>{
00122         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o4">_SpeedFactor</a>[slot];
00123 }
00124 
00125 <font class="comment">// ***************************************************************************</font>
00126 
<a name="l00127"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a10">00127</a> <font class="keywordtype">void</font> CAnimationPlaylist::setStartWeight (uint8 slot, <font class="keywordtype">float</font> startWeight, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> time)
00128 {
00129         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o5">_StartWeight</a>[slot]=startWeight;
00130         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o6">_StartWeightTime</a>[slot]=time;
00131 }
00132 
00133 <font class="comment">// ***************************************************************************</font>
00134 
<a name="l00135"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a11">00135</a> <font class="keywordtype">float</font> CAnimationPlaylist::getStartWeight (uint8 slot, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a>&amp; time)<font class="keyword"> const</font>
00136 <font class="keyword"></font>{
00137         time=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o6">_StartWeightTime</a>[slot];
00138         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o5">_StartWeight</a>[slot];
00139 }
00140 
00141 <font class="comment">// ***************************************************************************</font>
00142 
<a name="l00143"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a12">00143</a> <font class="keywordtype">void</font> CAnimationPlaylist::setEndWeight (uint8 slot, <font class="keywordtype">float</font> endWeight, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> time)
00144 {
00145         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o7">_EndWeight</a>[slot]=endWeight;
00146         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o8">_EndWeightTime</a>[slot]=time;
00147 }
00148 
00149 <font class="comment">// ***************************************************************************</font>
00150 
<a name="l00151"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a13">00151</a> <font class="keywordtype">float</font> CAnimationPlaylist::getEndWeight (uint8 slot, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a>&amp; time)<font class="keyword"> const</font>
00152 <font class="keyword"></font>{
00153         time=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o8">_EndWeightTime</a>[slot];
00154         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o7">_EndWeight</a>[slot];
00155 }
00156 
00157 <font class="comment">// ***************************************************************************</font>
00158 
<a name="l00159"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a14">00159</a> <font class="keywordtype">void</font> CAnimationPlaylist::setWeightSmoothness (uint8 slot, <font class="keywordtype">float</font> smoothness)
00160 {
00161         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o9">_Smoothness</a>[slot]=smoothness;
00162 }
00163 
00164 <font class="comment">// ***************************************************************************</font>
00165 
<a name="l00166"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a15">00166</a> <font class="keywordtype">float</font> CAnimationPlaylist::getWeightSmoothness (uint8 slot)<font class="keyword"> const</font>
00167 <font class="keyword"></font>{
00168         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o9">_Smoothness</a>[slot];
00169 }
00170 
00171 <font class="comment">// ***************************************************************************</font>
00172 
<a name="l00173"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a16">00173</a> <font class="keywordtype">void</font> CAnimationPlaylist::setupMixer (CChannelMixer&amp; mixer, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> time)<font class="keyword"> const</font>
00174 <font class="keyword"></font>{
00175         <font class="comment">// For each slot</font>
00176         <font class="keywordflow">for</font> (uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>&lt;CChannelMixer::NumAnimationSlot; <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>++)
00177         {
00178                 <font class="comment">// *** Set the time</font>
00179 
00180                 <font class="comment">// Animation enabled</font>
00181                 <font class="keywordtype">bool</font> enabled=<font class="keyword">true</font>;
00182 
00183                 <font class="comment">// Get the animationSet pointer from the mixer</font>
00184                 <font class="keyword">const</font> CAnimationSet *animSet=mixer.getAnimationSet ();
00185 
00186                 <font class="comment">// If is exists</font>
00187                 <font class="keywordflow">if</font> (animSet)
00188                 {
00189                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]!=<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s5s0">empty</a>)
00190                         {
00191                                 <font class="comment">// Get the local time</font>
00192                                 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> wrappedTime = <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a19">getLocalTime</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>, time, *animSet);
00193 
00194                                 <font class="comment">// Get the animation</font>
00195                                 <font class="keyword">const</font> CAnimation *pAnimation=animSet-&gt;getAnimation (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]);
00196 
00197                                 <font class="comment">// Disable mode ?</font>
00198                                 <font class="keywordflow">if</font> ((<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o10">_WrapMode</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]==<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s6s3">Disable</a>)&amp;&amp;((wrappedTime&lt;pAnimation-&gt;getBeginTime ())||(wrappedTime&gt;pAnimation-&gt;getEndTime ())))
00199                                         enabled=<font class="keyword">false</font>;
00200 
00201                                 <font class="comment">// Set the time</font>
00202                                 <font class="keywordflow">if</font> (enabled)
00203                                         mixer.setSlotTime (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>, wrappedTime);
00204                         }
00205                 }
00206 
00207                 <font class="comment">// *** Set the animation</font>
00208         
00209                 <font class="comment">// Still enabled</font>
00210                 <font class="keywordflow">if</font> (enabled)
00211                 {
00212                         <font class="comment">// empty ?</font>
00213                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]==<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s5s0">empty</a>)
00214                                 <font class="comment">// Empty the slot</font>
00215                                 mixer.emptySlot (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>);
00216                         <font class="keywordflow">else</font>
00217                                 <font class="comment">// Set the animation id</font>
00218                                 mixer.setSlotAnimation (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>, <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]);
00219 
00220                         <font class="comment">// *** Set the skeleton weight</font>
00221 
00222                         <font class="comment">// empty ?</font>
00223                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o1">_SkeletonWeight</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]==<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s5s0">empty</a>)
00224                                 <font class="comment">// Empty the slot</font>
00225                                 mixer.resetSkeletonWeight (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>);
00226                         <font class="keywordflow">else</font>
00227                                 <font class="comment">// Set the animation id</font>
00228                                 mixer.applySkeletonWeight (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>, <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o1">_SkeletonWeight</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>],       <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o2">_InvertWeight</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]);
00229 
00230                         <font class="comment">// *** Set the weight</font>
00231                         mixer.setSlotWeight (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>, <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#d0">getWeightValue</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o6">_StartWeightTime</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>], <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o8">_EndWeightTime</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>], time, <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o5">_StartWeight</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>], <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o7">_EndWeight</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>], <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o9">_Smoothness</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>]));
00232                 }
00233                 <font class="keywordflow">else</font>
00234                 {
00235                         <font class="comment">// Disable this slot</font>
00236                         mixer.emptySlot (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>);
00237                 }
00238         }
00239 }
00240 
00241 <font class="comment">// ***************************************************************************</font>
00242 
<a name="l00243"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#d0">00243</a> <font class="keywordtype">float</font> CAnimationPlaylist::getWeightValue (<a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> startWeightTime, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> endWeightTime, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> time, <font class="keywordtype">float</font> startWeight, <font class="keywordtype">float</font> endWeight, <font class="keywordtype">float</font> smoothness)
00244 {
00245         <font class="comment">// Clamp left</font>
00246         <font class="keywordflow">if</font> (time&lt;=startWeightTime)
00247                 <font class="keywordflow">return</font> startWeight;
00248         <font class="comment">// Clamp left</font>
00249         <font class="keywordflow">if</font> (time&gt;=endWeightTime)
00250                 <font class="keywordflow">return</font> endWeight;
00251         
00252         <font class="comment">// *** Interpolate</font>
00253         
00254         <font class="comment">// Linear value</font>
00255         <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> linear=startWeight+(endWeight-startWeight)*(time-startWeightTime)/(endWeightTime-startWeightTime);
00256 
00257         <font class="comment">// Linear ?</font>
00258         <font class="keywordflow">if</font> (smoothness&lt;0.0001f)
00259                 <font class="keywordflow">return</font> (float)linear;
00260 
00261         <font class="comment">// Quadratic value</font>
00262         <font class="keywordtype">double</font> a=2.f*startWeight-2.f*endWeight;
00263         <font class="keywordtype">double</font> b=3.f*endWeight-3.f*startWeight;
00264         <font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=(time-startWeightTime)/(endWeightTime-startWeightTime);
00265         <font class="keywordtype">double</font> xSquare=<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>*<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00266         <font class="keywordtype">double</font> xCube=<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>*xSquare;
00267         <font class="keywordtype">double</font> quad=a*xCube+b*xSquare+startWeight;
00268 
00269         <font class="comment">// Interpolate between linear and quadratic</font>
00270         <font class="keywordflow">return</font> (float)(smoothness*quad+(1.f-smoothness)*linear);
00271 }
00272 
00273 <font class="comment">// ***************************************************************************</font>
00274 
<a name="l00275"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a17">00275</a> <font class="keywordtype">void</font> CAnimationPlaylist::setWrapMode (uint8 slot, TWrapMode wrapMode)
00276 {
00277         <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o10">_WrapMode</a>[slot]=wrapMode;
00278 }
00279 
00280 <font class="comment">// ***************************************************************************</font>
00281 
<a name="l00282"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a18">00282</a> CAnimationPlaylist::TWrapMode CAnimationPlaylist::getWrapMode (uint8 slot)<font class="keyword"> const</font>
00283 <font class="keyword"></font>{
00284         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o10">_WrapMode</a>[slot];
00285 }
00286 
00287 <font class="comment">// ***************************************************************************</font>
00288 
<a name="l00289"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a21">00289</a> <font class="keywordtype">void</font> CAnimationPlaylist::serial (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; f)
00290 {
00291         <font class="comment">// Serial a version</font>
00292         (void)f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a> (0);
00293 
00294         <font class="comment">// Serial all the values</font>
00295         <font class="keywordflow">for</font> (uint i=0; i&lt;CChannelMixer::NumAnimationSlot; i++)
00296         {
00297                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[i]);
00298                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o1">_SkeletonWeight</a>[i]);
00299                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o2">_InvertWeight</a>[i]);
00300                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o3">_TimeOrigin</a>[i]);
00301                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o4">_SpeedFactor</a>[i]);
00302                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o5">_StartWeight</a>[i]);
00303                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o6">_StartWeightTime</a>[i]);
00304                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o7">_EndWeight</a>[i]);
00305                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o8">_EndWeightTime</a>[i]);
00306                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o9">_Smoothness</a>[i]);
00307                 f.<a class="code" href="classNLMISC_1_1IStream.html#a6">serialEnum</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o10">_WrapMode</a>[i]);
00308         }
00309 }
00310 
00311 <font class="comment">// ***************************************************************************</font>
00312 
<a name="l00313"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a19">00313</a> <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> CAnimationPlaylist::getLocalTime (uint8 slot, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> globalTime, <font class="keyword">const</font> CAnimationSet&amp; animSet)<font class="keyword"> const</font>
00314 <font class="keyword"></font>{
00315         <font class="comment">// Get the animation</font>
00316         <font class="keyword">const</font> CAnimation *pAnimation=animSet.getAnimation (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o0">_Animations</a>[slot]);
00317 
00318         <font class="comment">// If this animation exists</font>
00319         <font class="keywordflow">if</font> (pAnimation)
00320         {
00321                 <font class="comment">// Compute the non-wrapped time</font>
00322                 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> wrappedTime=pAnimation-&gt;getBeginTime ()+(TAnimationTime)((globalTime-<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o3">_TimeOrigin</a>[slot])*<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o4">_SpeedFactor</a>[slot]);
00323 
00324                 <font class="comment">// Wrap mode</font>
00325                 <font class="keywordflow">switch</font> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o10">_WrapMode</a>[slot])
00326                 {
00327                 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s6s1">Clamp</a>:
00328                         <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (wrappedTime, pAnimation-&gt;getBeginTime (), pAnimation-&gt;getEndTime ());
00329                         <font class="keywordflow">break</font>;
00330                 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#s6s2">Repeat</a>:
00331                         <font class="comment">// Mod repeat the time</font>
00332                         {
00333                                 <font class="keywordtype">float</font> length=pAnimation-&gt;getEndTime ()-pAnimation-&gt;getBeginTime();
00334                                 <font class="keywordflow">if</font> (wrappedTime&gt;=pAnimation-&gt;getBeginTime())
00335                                         wrappedTime=pAnimation-&gt;getBeginTime()+(float)fmod (wrappedTime-pAnimation-&gt;getBeginTime(), length);
00336                                 <font class="keywordflow">else</font>
00337                                         wrappedTime=pAnimation-&gt;getBeginTime()+(float)fmod (wrappedTime-pAnimation-&gt;getBeginTime(), length)+length;
00338                         }
00339                         <font class="keywordflow">break</font>;
00340                         <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00341                 }
00342 
00343                 <font class="comment">// Return localTime</font>
00344                 <font class="keywordflow">return</font> wrappedTime;
00345         }
00346 
00347         <font class="keywordflow">return</font> (TAnimationTime)globalTime;
00348 }
00349 
00350 <font class="comment">// ***************************************************************************</font>
00351 
<a name="l00352"></a><a class="code" href="classNL3D_1_1CAnimationPlaylist.html#a20">00352</a> <font class="keywordtype">float</font> CAnimationPlaylist::getLocalWeight (uint8 slot, <a class="code" href="namespaceNL3D.html#a2">TGlobalAnimationTime</a> globalTime)<font class="keyword"> const</font>
00353 <font class="keyword"></font>{
00354         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#d0">getWeightValue</a> (<a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o6">_StartWeightTime</a>[slot], <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o8">_EndWeightTime</a>[slot], globalTime, <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o5">_StartWeight</a>[slot], <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o7">_EndWeight</a>[slot], <a class="code" href="classNL3D_1_1CAnimationPlaylist.html#o9">_Smoothness</a>[slot]);
00355 }
00356 
00357 <font class="comment">// ***************************************************************************</font>
00358 
00359 
00360 } <font class="comment">// NL3D</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>