aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/animated__material_8cpp-source.html
blob: 07da2f7ec6e5dd8d5f74c1652e9d9d9c3e08833f (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
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<!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>animated_material.cpp</h1><a href="animated__material_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="animated__material_8h.html">3d/animated_material.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
00030 
00031 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00032 
00033 <font class="keyword">namespace </font>NL3D
00034 {
00035 
00036 
00037 <font class="comment">// ***************************************************************************</font>
00038 <font class="comment">// ***************************************************************************</font>
00039 <font class="comment">// ***************************************************************************</font>
00040 <font class="comment">// ***************************************************************************</font>
00041 
00042 
00043 
00044 <font class="comment">// ***************************************************************************</font>
<a name="l00045"></a><a class="code" href="structNL3D_1_1CMaterialBase_1_1CAnimatedTexture.html#a0">00045</a> <font class="keywordtype">void</font>    CMaterialBase::CAnimatedTexture::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
00046 {
00047         ITexture        *text= NULL;
00048         <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
00049         {
00050                 f.<a class="code" href="classNLMISC_1_1IStream.html#a28">serialPolyPtr</a>(text);
00051                 <a class="code" href="structNL3D_1_1CMaterialBase_1_1CAnimatedTexture.html#m0">Texture</a>= text;
00052         }
00053         <font class="keywordflow">else</font>
00054         {
00055                 text= <a class="code" href="structNL3D_1_1CMaterialBase_1_1CAnimatedTexture.html#m0">Texture</a>;
00056                 f.<a class="code" href="classNLMISC_1_1IStream.html#a28">serialPolyPtr</a>(text);
00057         }
00058 }
00059 
00060 
00061 
00062 <font class="comment">// ***************************************************************************</font>
<a name="l00063"></a><a class="code" href="classNL3D_1_1CMaterialBase.html#a0">00063</a> CMaterialBase::CMaterialBase()
00064 {
00065         <a class="code" href="classNL3D_1_1CMaterialBase.html#m1">DefaultAmbient</a>.setValue(CRGBA(64,64,64));
00066         <a class="code" href="classNL3D_1_1CMaterialBase.html#m2">DefaultDiffuse</a>.setValue(CRGBA(128,128,128));
00067         <a class="code" href="classNL3D_1_1CMaterialBase.html#m3">DefaultSpecular</a>.setValue(CRGBA(0,0,0));
00068         <a class="code" href="classNL3D_1_1CMaterialBase.html#m4">DefaultShininess</a>.setValue(10);
00069         <a class="code" href="classNL3D_1_1CMaterialBase.html#m5">DefaultEmissive</a>.setValue(CRGBA(128,128,128));
00070         <a class="code" href="classNL3D_1_1CMaterialBase.html#m6">DefaultOpacity</a>.setValue(1);
00071         <a class="code" href="classNL3D_1_1CMaterialBase.html#m7">DefaultTexture</a>.setValue(0x7FFFFFFF);
00072         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00073         {
00074                 <a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k].<a class="code" href="structNL3D_1_1CMaterialBase_1_1CTexAnimTracks.html#a0">setDefaultValue</a>();
00075         }
00076 }
00077 
00078 
00079 <font class="comment">// ***************************************************************************</font>
<a name="l00080"></a><a class="code" href="classNL3D_1_1CMaterialBase.html#a2">00080</a> <font class="keywordtype">void</font>    CMaterialBase::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
00081 {
00082         sint    ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(1);
00083 
00084         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CMaterialBase.html#m0">Name</a>);
00085         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CMaterialBase.html#m1">DefaultAmbient</a>, <a class="code" href="classNL3D_1_1CMaterialBase.html#m2">DefaultDiffuse</a>, <a class="code" href="classNL3D_1_1CMaterialBase.html#m3">DefaultSpecular</a>);
00086         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CMaterialBase.html#m4">DefaultShininess</a>, <a class="code" href="classNL3D_1_1CMaterialBase.html#m5">DefaultEmissive</a>, <a class="code" href="classNL3D_1_1CMaterialBase.html#m6">DefaultOpacity</a>, <a class="code" href="classNL3D_1_1CMaterialBase.html#m7">DefaultTexture</a>);
00087         f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a>(<a class="code" href="classNL3D_1_1CMaterialBase.html#o0">_AnimatedTextures</a>);
00088         <font class="keywordflow">if</font> (ver &gt; 0)
00089         {
00090                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00091                 {
00092                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k]);
00093                 }
00094         }
00095 }
00096 
00097 
00098 <font class="comment">// ***************************************************************************</font>
<a name="l00099"></a><a class="code" href="classNL3D_1_1CMaterialBase.html#a1">00099</a> <font class="keywordtype">void</font>    CMaterialBase::copyFromMaterial(CMaterial *pMat)
00100 {
00101         <a class="code" href="classNL3D_1_1CMaterialBase.html#m1">DefaultAmbient</a>.setValue(pMat-&gt;getAmbient());
00102         <a class="code" href="classNL3D_1_1CMaterialBase.html#m2">DefaultDiffuse</a>.setValue(pMat-&gt;getDiffuse());
00103         <a class="code" href="classNL3D_1_1CMaterialBase.html#m3">DefaultSpecular</a>.setValue(pMat-&gt;getSpecular());
00104         <a class="code" href="classNL3D_1_1CMaterialBase.html#m4">DefaultShininess</a>.setValue(pMat-&gt;getShininess());
00105         <a class="code" href="classNL3D_1_1CMaterialBase.html#m5">DefaultEmissive</a>.setValue(pMat-&gt;getEmissive());
00106         <a class="code" href="classNL3D_1_1CMaterialBase.html#m6">DefaultOpacity</a>.setValue(pMat-&gt;getDiffuse().A/255.f);
00107 
00109         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00110         {
00111                 <font class="keywordflow">if</font> (pMat-&gt;isUserTexMatEnabled(k))
00112                 {
00113                         <font class="keywordtype">float</font> uTrans, vTrans, uScale, vScale, wRot;
00114                         pMat-&gt;decompUserTexMat(k, uTrans, vTrans, wRot, uScale, vScale);                        
00115                         <a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k].<a class="code" href="structNL3D_1_1CMaterialBase_1_1CTexAnimTracks.html#m0">DefaultUTrans</a>.setValue(uTrans);
00116                         <a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k].<a class="code" href="structNL3D_1_1CMaterialBase_1_1CTexAnimTracks.html#m1">DefaultVTrans</a>.setValue(vTrans);
00117                         <a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k].<a class="code" href="structNL3D_1_1CMaterialBase_1_1CTexAnimTracks.html#m2">DefaultUScale</a>.setValue(uScale);
00118                         <a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k].<a class="code" href="structNL3D_1_1CMaterialBase_1_1CTexAnimTracks.html#m3">DefaultVScale</a>.setValue(vScale);
00119                         <a class="code" href="classNL3D_1_1CMaterialBase.html#m8">DefaultTexAnimTracks</a>[k].<a class="code" href="structNL3D_1_1CMaterialBase_1_1CTexAnimTracks.html#m4">DefaultWRot</a>.setValue(wRot);
00120                 }      
00121         }
00122 }
00123 
00124 
00125 <font class="comment">// ***************************************************************************</font>
<a name="l00126"></a><a class="code" href="classNL3D_1_1CMaterialBase.html#z371_0">00126</a> <font class="keywordtype">void</font>                    CMaterialBase::setAnimatedTexture(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, CSmartPtr&lt;ITexture&gt;  pText)
00127 {
00128         <font class="comment">// add or replace the texture.</font>
00129         <a class="code" href="classNL3D_1_1CMaterialBase.html#o0">_AnimatedTextures</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].Texture= pText;
00130 }
00131 <font class="comment">// ***************************************************************************</font>
<a name="l00132"></a><a class="code" href="classNL3D_1_1CMaterialBase.html#z371_1">00132</a> <font class="keywordtype">bool</font>                    CMaterialBase::validAnimatedTexture(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00133 {
00134         TAnimatedTextureMap::iterator   it;
00135         it= <a class="code" href="classNL3D_1_1CMaterialBase.html#o0">_AnimatedTextures</a>.find(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00136         <font class="keywordflow">return</font> it!=<a class="code" href="classNL3D_1_1CMaterialBase.html#o0">_AnimatedTextures</a>.end();
00137 }
00138 <font class="comment">// ***************************************************************************</font>
<a name="l00139"></a><a class="code" href="classNL3D_1_1CMaterialBase.html#z371_2">00139</a> ITexture*               CMaterialBase::getAnimatedTexture(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00140 {
00141         TAnimatedTextureMap::iterator   it;
00142         it= <a class="code" href="classNL3D_1_1CMaterialBase.html#o0">_AnimatedTextures</a>.find(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00143         <font class="keywordflow">if</font>( it!=<a class="code" href="classNL3D_1_1CMaterialBase.html#o0">_AnimatedTextures</a>.end() )
00144                 <font class="keywordflow">return</font> it-&gt;second.Texture;
00145         <font class="keywordflow">else</font>
00146                 <font class="keywordflow">return</font> NULL;
00147 }
00148 
00149 
00150 
00151 
00152 <font class="comment">// ***************************************************************************</font>
00153 <font class="comment">// ***************************************************************************</font>
00154 <font class="comment">// ***************************************************************************</font>
00155 <font class="comment">// ***************************************************************************</font>
00156 
00157 
00158 <font class="comment">// ***************************************************************************</font>
<a name="l00159"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z372_0">00159</a> CAnimatedMaterial::CAnimatedMaterial(CMaterialBase *baseMat)
00160 {
00161         <a class="code" href="debug_8h.html#a6">nlassert</a>(baseMat);
00162         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>= baseMat;
00163 
00164         <font class="comment">// IAnimatable.</font>
00165         IAnimatable::resize(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s10">AnimValueLast</a>);
00166 
00167         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o2">_Ambient</a>.affect(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultAmbient.getValue());
00168         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o3">_Diffuse</a>.affect(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultDiffuse.getValue());
00169         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o4">_Specular</a>.affect(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultSpecular.getValue());
00170         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o5">_Shininess</a>.affect(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultShininess.getValue());
00171         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o6">_Emissive</a>.affect(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultEmissive.getValue());
00172         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o7">_Opacity</a>.affect(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultOpacity.getValue());
00173 
00174         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00175         {
00176                 <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[k].<a class="code" href="structNL3D_1_1CAnimatedMaterial_1_1CTexAnimatedMatValues.html#a0">affect</a>(baseMat-&gt;DefaultTexAnimTracks[k]);
00177         }
00178 }
00179 
00180 
00181 <font class="comment">// ***************************************************************************</font>
<a name="l00182"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z372_1">00182</a> <font class="keywordtype">void</font>    CAnimatedMaterial::setMaterial(CMaterial *pMat)
00183 {
00184         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>= pMat;
00185 }
00186 
00187 
00188 <font class="comment">// ***************************************************************************</font>
<a name="l00189"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z372_2">00189</a> std::string             CAnimatedMaterial::getMaterialName()<font class="keyword"> const</font>
00190 <font class="keyword"></font>{
00191         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>);
00192         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;Name;
00193 }
00194 
00195 
00196 <font class="comment">// ***************************************************************************</font>
<a name="l00197"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#a0">00197</a> <font class="keywordtype">void</font>    CAnimatedMaterial::update()
00198 {
00199         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IAnimatable.html#z368_2">isTouched</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>) &amp;&amp; <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>!=NULL <font class="comment">/*&amp;&amp; _Material-&gt;isLighted()*/</font>)
00200         {
00201                 
00202                 <font class="comment">// well, just update all...  :)</font>
00203 
00204                 <font class="comment">// diffuse part.</font>
00205                 CRGBA   diff= <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o3">_Diffuse</a>.Value;
00206                 sint c= (sint)(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o7">_Opacity</a>.Value*255);
00207                 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(c, 0, 255);
00208                 diff.A= c;
00209 
00210                 <font class="comment">// setup material.</font>
00211                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>-&gt;isLighted())
00212                 {               
00213                         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>-&gt;setLighting(<font class="keyword">true</font>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o6">_Emissive</a>.Value, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o2">_Ambient</a>.Value, diff, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o4">_Specular</a>.Value, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o5">_Shininess</a>.Value);
00214                 }
00215                 <font class="keywordflow">else</font>
00216                 {
00217                         <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>-&gt;setColor(diff);
00218                 }
00219 
00220                 <font class="comment">// clear flags.</font>
00221                 <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s2">AmbientValue</a>);
00222                 <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s3">DiffuseValue</a>);
00223                 <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s4">SpecularValue</a>);
00224                 <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s5">ShininessValue</a>);
00225                 <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s6">EmissiveValue</a>);
00226                 <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s7">OpacityValue</a>);
00227 
00228 
00229                 <font class="comment">// Texture Anim.</font>
00230                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IAnimatable.html#z368_2">isTouched</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s8">TextureValue</a>))
00231                 {
00232                         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>);
00233 
00234                         uint32  <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>= <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o8">_Texture</a>.Value;
00235                         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;validAnimatedTexture(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>))
00236                         {
00237                                 <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>-&gt;setTexture(0, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;getAnimatedTexture(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>) );
00238                         }
00239                         <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s8">TextureValue</a>);
00240                 }
00241 
00242                 <font class="comment">// Get texture matrix from animated value to setup the material</font>
00243                 uint flagIndex = <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a>;
00244                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00245                 {
00246                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>-&gt;isUserTexMatEnabled(k))
00247                         {
00248                                 <font class="keyword">const</font> CTexAnimatedMatValues &amp;texMatAV = <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[k];
00249                                 CMatrix texMat; 
00250                                 <font class="keywordtype">float</font> fCos, fSin;
00251                                 <font class="keywordflow">if</font> (texMatAV._WRot.Value != 0.f)
00252                                 {
00253                                         fCos = ::cosf(- texMatAV._WRot.Value);
00254                                         fSin = ::sinf(- texMatAV._WRot.Value);
00255                                 }
00256                                 <font class="keywordflow">else</font>
00257                                 {
00258                                         fCos = 1.f;
00259                                         fSin = 0.f;
00260                                 }
00261                                 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> I(fCos, fSin, 0);
00262                                 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> J(-fSin, fCos, 0);                              
00263                                 texMat.setRot(texMatAV._UScale.Value * I, texMatAV._VScale.Value * J, <a class="code" href="classNLMISC_1_1CVector.html#p3">NLMISC::CVector::K</a>);                                                              
00264                                 <font class="keywordflow">for</font> (uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00265                                 {
00266                                         <a class="code" href="classNL3D_1_1IAnimatable.html#b1">clearFlag</a>(flagIndex++);
00267                                 }
00268                                 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> center(-0.5f, -0.5f, 0.f);
00269                                 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>(- texMatAV._UTrans.Value, texMatAV._VTrans.Value, 0);
00270                                 texMat.setPos(t + texMat.mulVector(center) - center);
00271                                 <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o1">_Material</a>-&gt;setUserTexMat(k, texMat);
00272                         }
00273                 }
00274 
00275                 <font class="comment">// We are OK!</font>
00276                 IAnimatable::clearFlag(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>);
00277         }
00278 }
00279 
00280 
00281 <font class="comment">// ***************************************************************************</font>
<a name="l00282"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_1">00282</a> IAnimatedValue* CAnimatedMaterial::getValue (uint valueId)
00283 {
00284         <font class="keywordflow">switch</font>(valueId)
00285         {
00286         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s2">AmbientValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o2">_Ambient</a>;
00287         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s3">DiffuseValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o3">_Diffuse</a>;
00288         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s4">SpecularValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o4">_Specular</a>;
00289         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s5">ShininessValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o5">_Shininess</a>;
00290         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s6">EmissiveValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o6">_Emissive</a>;
00291         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s7">OpacityValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o7">_Opacity</a>;
00292         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s8">TextureValue</a>: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o8">_Texture</a>;
00293         <font class="keywordflow">default</font>: <font class="comment">// this may be a texture animated value...</font>
00294                 <font class="keywordflow">if</font> (valueId &gt;= <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a> &amp;&amp; valueId &lt; <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s10">AnimValueLast</a>)
00295                 {
00296                         <font class="keyword">const</font> uint baseId = valueId - <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a>;
00297                         <font class="keyword">const</font> uint texNum =   baseId / <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>; <font class="comment">// stage index</font>
00298                         <font class="keyword">const</font> uint argID  =   baseId % <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>; <font class="comment">// value for this stage</font>
00299                         <font class="keywordflow">switch</font>(argID)
00300                         {
00301                                 <font class="keywordflow">case</font> 0: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[texNum].<a class="code" href="structNL3D_1_1CAnimatedMaterial_1_1CTexAnimatedMatValues.html#m0">_UTrans</a>;
00302                                 <font class="keywordflow">case</font> 1: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[texNum].<a class="code" href="structNL3D_1_1CAnimatedMaterial_1_1CTexAnimatedMatValues.html#m1">_VTrans</a>;
00303                                 <font class="keywordflow">case</font> 2: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[texNum].<a class="code" href="structNL3D_1_1CAnimatedMaterial_1_1CTexAnimatedMatValues.html#m2">_UScale</a>;
00304                                 <font class="keywordflow">case</font> 3: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[texNum].<a class="code" href="structNL3D_1_1CAnimatedMaterial_1_1CTexAnimatedMatValues.html#m3">_VScale</a>;                          
00305                                 <font class="keywordflow">case</font> 4: <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o9">_TexAnimatedMatValues</a>[texNum].<a class="code" href="structNL3D_1_1CAnimatedMaterial_1_1CTexAnimatedMatValues.html#m4">_WRot</a>;                            
00306                         }
00307                 }               
00308         <font class="keywordflow">break</font>;
00309         };
00310 
00311         <font class="comment">// shoudl not be here!!</font>
00312         <a class="code" href="debug_8h.html#a12">nlstop</a>;
00313         <font class="keywordflow">return</font> NULL;
00314 }
00315 <font class="comment">// ***************************************************************************</font>
<a name="l00316"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_2">00316</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CAnimatedMaterial::getValueName (uint valueId)<font class="keyword"> const</font>
00317 <font class="keyword"></font>{
00318         <font class="keywordflow">switch</font>(valueId)
00319         {
00320         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s2">AmbientValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_0">getAmbientValueName</a>();
00321         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s3">DiffuseValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_1">getDiffuseValueName</a>();
00322         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s4">SpecularValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_2">getSpecularValueName</a>();
00323         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s5">ShininessValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_3">getShininessValueName</a>();
00324         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s6">EmissiveValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_4">getEmissiveValueName</a>();
00325         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s7">OpacityValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_5">getOpacityValueName</a>();
00326         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s8">TextureValue</a>: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_6">getTextureValueName</a>();
00327         <font class="keywordflow">default</font>: <font class="comment">// this may be a texture animated value...</font>
00328                 <font class="keywordflow">if</font> (valueId &gt;= <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a> &amp;&amp; valueId &lt; <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s10">AnimValueLast</a>)
00329                 {
00330                         <font class="keyword">const</font> uint baseId = valueId - <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a>;
00331                         <font class="keyword">const</font> uint texNum =   baseId / <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>;
00332                         <font class="keyword">const</font> uint argID  =   baseId % <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>;
00333                         <font class="keywordflow">switch</font>(argID)
00334                         {
00335                                 <font class="keywordflow">case</font> 0: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_7">getTexMatUTransName</a>      (texNum);
00336                                 <font class="keywordflow">case</font> 1: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_8">getTexMatVTransName</a>(texNum);
00337                                 <font class="keywordflow">case</font> 2: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_9">getTexMatUScaleName</a>(texNum);
00338                                 <font class="keywordflow">case</font> 3: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_10">getTexMatVScaleName</a>(texNum);
00339                                 <font class="keywordflow">case</font> 4: <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_11">getTexMatWRotName</a>(texNum);
00340                         }
00341                 }               
00342         <font class="keywordflow">break</font>;
00343         };
00344 
00345         <font class="comment">// shoudl not be here!!</font>
00346         <a class="code" href="debug_8h.html#a12">nlstop</a>;
00347         <font class="keywordflow">return</font> <font class="stringliteral">""</font>;
00348 }
00349 <font class="comment">// ***************************************************************************</font>
<a name="l00350"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_3">00350</a> ITrack* CAnimatedMaterial::getDefaultTrack (uint valueId)
00351 {
00352         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>);
00353 
00354         <font class="keywordflow">switch</font>(valueId)
00355         {
00356         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s2">AmbientValue</a>: <font class="keywordflow">return</font>       &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultAmbient;
00357         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s3">DiffuseValue</a>: <font class="keywordflow">return</font>       &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultDiffuse;
00358         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s4">SpecularValue</a>: <font class="keywordflow">return</font>      &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultSpecular;
00359         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s5">ShininessValue</a>: <font class="keywordflow">return</font>     &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultShininess;
00360         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s6">EmissiveValue</a>: <font class="keywordflow">return</font>      &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultEmissive;
00361         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s7">OpacityValue</a>: <font class="keywordflow">return</font>       &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultOpacity;
00362         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s8">TextureValue</a>: <font class="keywordflow">return</font>       &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultTexture;
00363         <font class="keywordflow">default</font>: <font class="comment">// this may be a texture animated value...</font>
00364                 <font class="keywordflow">if</font> (valueId &gt;= <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a> &amp;&amp; valueId &lt; <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s10">AnimValueLast</a>)
00365                 {
00366                         <font class="keyword">const</font> uint baseId = valueId - <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a>;
00367                         <font class="keyword">const</font> uint texNum =   baseId / <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>;
00368                         <font class="keyword">const</font> uint argID  =   baseId % <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>;
00369                         <font class="keywordflow">switch</font>(argID)
00370                         {
00371                                 <font class="keywordflow">case</font> 0: <font class="keywordflow">return</font>  &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultTexAnimTracks[texNum].DefaultUTrans;
00372                                 <font class="keywordflow">case</font> 1: <font class="keywordflow">return</font>  &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultTexAnimTracks[texNum].DefaultVTrans;
00373                                 <font class="keywordflow">case</font> 2: <font class="keywordflow">return</font>  &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultTexAnimTracks[texNum].DefaultUTrans;
00374                                 <font class="keywordflow">case</font> 3: <font class="keywordflow">return</font>  &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultTexAnimTracks[texNum].DefaultVTrans;
00375                                 <font class="keywordflow">case</font> 4: <font class="keywordflow">return</font>  &amp;<a class="code" href="classNL3D_1_1CAnimatedMaterial.html#o0">_MaterialBase</a>-&gt;DefaultTexAnimTracks[texNum].DefaultWRot;
00376                         }
00377                 }               
00378         <font class="keywordflow">break</font>;
00379         };
00380 
00381         <font class="comment">// shoudl not be here!!</font>
00382         <a class="code" href="debug_8h.html#a12">nlstop</a>;
00383         <font class="keywordflow">return</font> NULL;
00384 }
00385 <font class="comment">// ***************************************************************************</font>
<a name="l00386"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_4">00386</a> <font class="keywordtype">void</font>    CAnimatedMaterial::registerToChannelMixer(CChannelMixer *chanMixer, <font class="keyword">const</font> std::string &amp;prefix)
00387 {
00388         <font class="comment">// For CAnimatedMaterial, channels are detailled (material rendered after clip)!</font>
00389         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s2">AmbientValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00390         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s3">DiffuseValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00391         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s4">SpecularValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00392         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s5">ShininessValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00393         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s6">EmissiveValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00394         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s7">OpacityValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00395         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s8">TextureValue</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00396         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00397         {
00398                 <font class="keywordflow">for</font> (uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00399                 {
00400                         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s9">TextureMatValues</a> + <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k * <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#s11s0">NumTexAnimatedValues</a>, <a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z374_0s1">OwnerBit</a>, prefix, <font class="keyword">true</font>);
00401                 }
00402         }
00403 }
00404 
00405 <font class="comment">// ***************************************************************************</font>
<a name="l00406"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_7">00406</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CAnimatedMaterial::getTexMatUTransName(uint stage)
00407 {
00408         <font class="keyword">static</font> <font class="keywordtype">char</font> names[<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>][16];
00409         <font class="keyword">static</font> <font class="keywordtype">bool</font> init = <font class="keyword">false</font>;
00410         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00411         <font class="keywordflow">if</font> (!init) <font class="comment">// where name initialized ?</font>
00412         {
00413                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00414                 {
00415                         sprintf(&amp;names[k][0], <font class="stringliteral">"UTrans%d"</font>, k);
00416                 }
00417                 init = <font class="keyword">true</font>;
00418         }
00419         <font class="keywordflow">return</font> names[stage];
00420 }
00421 
00422 <font class="comment">// ***************************************************************************</font>
<a name="l00423"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_8">00423</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CAnimatedMaterial::getTexMatVTransName(uint stage)
00424 {
00425         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00426         <font class="keyword">static</font> <font class="keywordtype">char</font> names[<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>][16];
00427         <font class="keyword">static</font> <font class="keywordtype">bool</font> init = <font class="keyword">false</font>;
00428         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00429         <font class="keywordflow">if</font> (!init) <font class="comment">// where name initialized ?</font>
00430         {
00431                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00432                 {
00433                         sprintf(&amp;names[k][0], <font class="stringliteral">"VTrans%d"</font>, k);
00434                 }
00435                 init = <font class="keyword">true</font>;
00436         }
00437         <font class="keywordflow">return</font> names[stage];
00438 }
00439 
00440 
00441 <font class="comment">// ***************************************************************************</font>
<a name="l00442"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_9">00442</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CAnimatedMaterial::getTexMatUScaleName(uint stage)
00443 {
00444         <font class="keyword">static</font> <font class="keywordtype">char</font> names[<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>][16];
00445         <font class="keyword">static</font> <font class="keywordtype">bool</font> init = <font class="keyword">false</font>;
00446         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00447         <font class="keywordflow">if</font> (!init) <font class="comment">// where name initialized ?</font>
00448         {
00449                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00450                 {
00451                         sprintf(&amp;names[k][0], <font class="stringliteral">"UScale%d"</font>, k);
00452                 }
00453                 init = <font class="keyword">true</font>;
00454         }
00455         <font class="keywordflow">return</font> names[stage];
00456 }
00457 
00458 <font class="comment">// ***************************************************************************</font>
<a name="l00459"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_10">00459</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CAnimatedMaterial::getTexMatVScaleName(uint stage)
00460 {
00461         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00462         <font class="keyword">static</font> <font class="keywordtype">char</font> names[<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>][16];
00463         <font class="keyword">static</font> <font class="keywordtype">bool</font> init = <font class="keyword">false</font>;
00464         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00465         <font class="keywordflow">if</font> (!init) <font class="comment">// where name initialized ?</font>
00466         {
00467                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00468                 {
00469                         sprintf(&amp;names[k][0], <font class="stringliteral">"VScale%d"</font>, k);
00470                 }
00471                 init = <font class="keyword">true</font>;
00472         }
00473         <font class="keywordflow">return</font> names[stage];
00474 }
00475 
00476 
00477 <font class="comment">// ***************************************************************************</font>
<a name="l00478"></a><a class="code" href="classNL3D_1_1CAnimatedMaterial.html#z373_11">00478</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CAnimatedMaterial::getTexMatWRotName(uint stage)
00479 {
00480         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00481         <font class="keyword">static</font> <font class="keywordtype">char</font> names[<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>][16];
00482         <font class="keyword">static</font> <font class="keywordtype">bool</font> init = <font class="keyword">false</font>;
00483         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
00484         <font class="keywordflow">if</font> (!init) <font class="comment">// where name initialized ?</font>
00485         {
00486                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
00487                 {
00488                         sprintf(&amp;names[k][0], <font class="stringliteral">"WRot%d"</font>, k);
00489                 }
00490                 init = <font class="keyword">true</font>;
00491         }
00492         <font class="keywordflow">return</font> names[stage];
00493 }
00494 
00495 
00496 
00497 } <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>