aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/mesh__base__instance_8cpp-source.html
blob: d0890cdc4a7b3f3cd7e3d53e4a8e91f3b4989c92 (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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
<!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>mesh_base_instance.cpp</h1><a href="mesh__base__instance_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="mesh__base__instance_8h.html">3d/mesh_base_instance.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="mesh__base_8h.html">3d/mesh_base.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="animation_8h.html">3d/animation.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="anim__detail__trav_8h.html">3d/anim_detail_trav.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="texture__file_8h.html">3d/texture_file.h</a>"</font>
00035 <font class="preprocessor">#include "<a class="code" href="async__texture__manager_8h.html">3d/async_texture_manager.h</a>"</font>
00036 
00037 
00038 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00039 
00040 <font class="keyword">namespace </font>NL3D 
00041 {
00042 
00043 
00044 <font class="comment">// ***************************************************************************</font>
<a name="l00045"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#b0">00045</a> CMeshBaseInstance::CMeshBaseInstance()
00046 {
00047         IAnimatable::resize(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z577_0s1">AnimValueLast</a>);
00048         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o3">_OwnerScene</a>= NULL;
00049         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_1">_AsyncTextureToLoadRefCount</a>= 0;
00050         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_3">_AsyncTextureMode</a>= <font class="keyword">false</font>;
00051         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_4">_AsyncTextureReady</a>= <font class="keyword">true</font>;
00052         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_2">_AsyncTextureDirty</a>= <font class="keyword">false</font>;
00053         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_6">_AsyncTextureDistance</a>= 0;
00054 
00055         <font class="comment">// I am a CMeshBaseInstance!!</font>
00056         CTransform::setIsMeshBaseInstance(<font class="keyword">true</font>);
00057 }
00058 
00059 <font class="comment">// ***************************************************************************</font>
<a name="l00060"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#b1">00060</a> CMeshBaseInstance::~CMeshBaseInstance()
00061 {
00062         <font class="comment">// If AsyncTextureMode, must disable. This ensure that async loading stop, and that no ref still exist</font>
00063         <font class="comment">// in the AsyncTextureManager</font>
00064         <font class="keywordflow">if</font>(_AsyncTextureMode)
00065                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_0">enableAsyncTextureMode</a>(<font class="keyword">false</font>);
00066 }
00067 
00068 
00069 <font class="comment">// ***************************************************************************</font>
<a name="l00070"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#d0">00070</a> <font class="keywordtype">void</font>            CMeshBaseInstance::registerBasic()
00071 {
00072         CMOT::registerModel(<a class="code" href="namespaceNL3D.html#a140">MeshBaseInstanceId</a>, <a class="code" href="namespaceNL3D.html#a277">TransformShapeId</a>, CMeshBaseInstance::creator);
00073         CMOT::registerObs(<a class="code" href="namespaceNL3D.html#a3">AnimDetailTravId</a>, <a class="code" href="namespaceNL3D.html#a140">MeshBaseInstanceId</a>, CMeshBaseInstanceAnimDetailObs::creator);
00074 }
00075 
00076 
00077 <font class="comment">// ***************************************************************************</font>
<a name="l00078"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z577_1">00078</a> <font class="keywordtype">void</font>            CMeshBaseInstance::registerToChannelMixer(CChannelMixer *chanMixer, <font class="keyword">const</font> std::string &amp;prefix)
00079 {
00080         uint32 i;
00081         CTransformShape::registerToChannelMixer(chanMixer, prefix);
00082 
00083         <font class="comment">// Add any materials.</font>
00084         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o0">_AnimatedMaterials</a>.size(); i++)
00085         {
00086                 <font class="comment">// append material  matname.*</font>
00087                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o0">_AnimatedMaterials</a>[i].registerToChannelMixer(chanMixer, prefix + <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o0">_AnimatedMaterials</a>[i].getMaterialName() + <font class="stringliteral">"."</font>);
00088         }
00089 
00090         <font class="comment">// Add any morph</font>
00091         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>.size(); i++)
00092         {
00093                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>[i].registerToChannelMixer(chanMixer, prefix + <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>[i].<a class="code" href="zone__lighter_8cpp.html#a11">getName</a>());
00094         }
00095 }
00096 
00097 
00098 <font class="comment">// ***************************************************************************</font>
<a name="l00099"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z579_0">00099</a> ITrack*         CMeshBaseInstance::getDefaultTrack (uint valueId)
00100 {
00101         <font class="comment">// Pointer on the CMeshBase</font>
00102         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>* pMesh=(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>*)(IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>;
00103 
00104         <font class="comment">// Switch the value</font>
00105         <font class="keywordflow">switch</font> (valueId)
00106         {
00107         <font class="keywordflow">case</font> CTransform::PosValue:                      
00108                 <font class="keywordflow">return</font> pMesh-&gt;getDefaultPos();
00109         <font class="keywordflow">case</font> CTransform::RotEulerValue:         
00110                 <font class="keywordflow">return</font> pMesh-&gt;getDefaultRotEuler();
00111         <font class="keywordflow">case</font> CTransform::RotQuatValue:          
00112                 <font class="keywordflow">return</font> pMesh-&gt;getDefaultRotQuat();
00113         <font class="keywordflow">case</font> CTransform::ScaleValue:            
00114                 <font class="keywordflow">return</font> pMesh-&gt;getDefaultScale();
00115         <font class="keywordflow">case</font> CTransform::PivotValue:            
00116                 <font class="keywordflow">return</font> pMesh-&gt;getDefaultPivot();
00117         <font class="keywordflow">default</font>:
00118                 <font class="comment">// Problem, new values ?</font>
00119                 <a class="code" href="debug_8h.html#a12">nlstop</a>;
00120         };
00121         <font class="keywordflow">return</font> NULL;
00122 }
00123 
00124 
00125 <font class="comment">// ***************************************************************************</font>
<a name="l00126"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z580_0">00126</a> uint32 CMeshBaseInstance::getNbLightMap()
00127 {
00128         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>* pMesh=(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>*)(IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>;
00129         <font class="keywordflow">return</font> pMesh-&gt;_LightInfos.size();
00130 }
00131 
00132 <font class="comment">// ***************************************************************************</font>
<a name="l00133"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z580_1">00133</a> <font class="keywordtype">void</font> CMeshBaseInstance::getLightMapName( uint32 nLightMapNb, std::string &amp;LightMapName )
00134 {
00135         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>* pMesh=(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>*)(IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>;
00136         <font class="keywordflow">if</font>( nLightMapNb &gt;= pMesh-&gt;_LightInfos.size() )
00137                 <font class="keywordflow">return</font>;
00138         CMeshBase::TLightInfoMap::iterator itMap = pMesh-&gt;_LightInfos.begin();
00139         <font class="keywordflow">for</font>( uint32 i = 0; i &lt; nLightMapNb; ++i ) ++itMap;
00140         LightMapName = itMap-&gt;first;
00141 }
00142 
00143 <font class="comment">// ***************************************************************************</font>
<a name="l00144"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z580_2">00144</a> <font class="keywordtype">void</font> CMeshBaseInstance::setLightMapFactor( <font class="keyword">const</font> std::string &amp;LightMapName, CRGBA Factor )
00145 {
00146         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>* pMesh=(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a>*)(IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>;
00147         CMeshBase::TLightInfoMap::iterator itMap = pMesh-&gt;_LightInfos.find( LightMapName );
00148         <font class="keywordflow">if</font>( itMap == pMesh-&gt;_LightInfos.end() )
00149                 <font class="keywordflow">return</font>;
00150         CMeshBase::CLightInfoMapList::iterator itList = itMap-&gt;second.begin();
00151         uint32 nNbElt = itMap-&gt;second.size();
00152         <font class="keywordflow">for</font>( uint32 i = 0; i &lt; nNbElt; ++i )
00153         {
00154                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[itList-&gt;nMatNb].setLightMapFactor( itList-&gt;nStageNb, Factor );
00155                 ++itList;
00156         }
00157 }
00158 
00159 <font class="comment">// ***************************************************************************</font>
<a name="l00160"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z581_0">00160</a> uint32 CMeshBaseInstance::getNbBlendShape()
00161 {
00162         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>.size();
00163 }
00164 
00165 <font class="comment">// ***************************************************************************</font>
<a name="l00166"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z581_1">00166</a> <font class="keywordtype">void</font> CMeshBaseInstance::getBlendShapeName (uint32 nBlendShapeNb, std::string &amp;BlendShapeName )
00167 {
00168         <font class="keywordflow">if</font> (nBlendShapeNb &gt;= <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>.size())
00169                 <font class="keywordflow">return</font>;
00170         BlendShapeName = <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>[nBlendShapeNb].getName();
00171 }
00172 
00173 <font class="comment">// ***************************************************************************</font>
<a name="l00174"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z581_2">00174</a> <font class="keywordtype">void</font> CMeshBaseInstance::setBlendShapeFactor (<font class="keyword">const</font> std::string &amp;BlendShapeName, <font class="keywordtype">float</font> rFactor)
00175 {
00176         <font class="keywordflow">for</font> (uint32 i = 0; i &lt; <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>.size(); ++i)
00177                 <font class="keywordflow">if</font> (BlendShapeName == <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>[i].getName())
00178                 {
00179                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o2">_AnimatedMorphFactor</a>[i].setFactor (rFactor);
00180                 }
00181 }
00182 
00183 
00184 <font class="comment">// ***************************************************************************</font>
<a name="l00185"></a><a class="code" href="classNL3D_1_1CMeshBaseInstanceAnimDetailObs.html#a0">00185</a> <font class="keywordtype">void</font> CMeshBaseInstanceAnimDetailObs::traverse(IObs *caller)
00186 {
00187         
00188         CMeshBaseInstance       *mi = (CMeshBaseInstance*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
00189         CMeshBase                       *mb = NLMISC::safe_cast&lt;CMeshBase *&gt;((IShape *) mi-&gt;Shape);
00190 
00191         <font class="comment">// if the base instance uses automatic animations, we must also setup the date of the channel mixer controlling this object</font>
00192         <font class="keywordflow">if</font> (mb-&gt;getAutoAnim())
00193         {
00194                 <font class="comment">// setup the channel mixer date</font>
00195                 CChannelMixer *chanMix = mi-&gt;getChannelMixer();
00196                 <font class="keywordflow">if</font> (chanMix)
00197                 {                       
00198                         ITravScene      *ts = NLMISC::safe_cast&lt;ITravScene *&gt;(Trav);
00199                         <a class="code" href="debug_8h.html#a6">nlassert</a>(ts-&gt;Scene);
00200                         <font class="keyword">const</font> CAnimation *anim = chanMix-&gt;getSlotAnimation(0);
00204                         <font class="keywordflow">if</font> (anim)
00205                         {
00206                                 <font class="keywordtype">float</font> animLenght = anim-&gt;getEndTime() - anim-&gt;getBeginTime();
00207                                 <font class="keywordflow">if</font> (animLenght &gt; 0)
00208                                 {
00209                                         <font class="keywordtype">float</font> currTime = (TAnimationTime) ts-&gt;Scene-&gt;getCurrentTime();
00210                                         <font class="keywordtype">float</font> startTime = (uint) (currTime / animLenght) * animLenght;
00211                                         <font class="comment">// Set the channel mixer date using the global date of the scene</font>
00212                                         chanMix-&gt;setSlotTime(0, anim-&gt;getBeginTime() + currTime - startTime);
00213                                 }
00214                                 <font class="keywordflow">else</font>
00215                                 {
00216                                         chanMix-&gt;setSlotTime(0, anim-&gt;getBeginTime());
00217                                 }
00218 
00223                                 chanMix-&gt;eval(<font class="keyword">false</font>);
00224                         }
00225                 }
00226         }
00227 
00228         CTransformAnimDetailObs::traverse(caller);
00229 
00230         
00231         <font class="comment">// update animated materials.</font>
00232         <font class="comment">// test if animated materials must be updated.</font>
00233         <font class="keywordflow">if</font>(mi-&gt;IAnimatable::isTouched(CMeshBaseInstance::OwnerBit))
00234         {
00235                 <font class="comment">// must test / update all AnimatedMaterials.</font>
00236                 <font class="keywordflow">for</font>(uint i=0;i&lt;mi-&gt;_AnimatedMaterials.size();i++)
00237                 {
00238                         <font class="comment">// This test and update the pointed material.</font>
00239                         mi-&gt;_AnimatedMaterials[i].update();
00240                 }
00241 
00242                 mi-&gt;IAnimatable::clearFlag(CMeshBaseInstance::OwnerBit);
00243         }
00244 
00245         <font class="comment">// Lightmap automatic animation</font>
00246         <font class="keywordflow">for</font>( uint i = 0; i &lt; mi-&gt;_AnimatedLightmap.size(); ++i )
00247         {
00248                 <font class="keyword">const</font> <font class="keywordtype">char</font> *LightGroupName = strchr( mi-&gt;_AnimatedLightmap[i]-&gt;getName().c_str(), <font class="charliteral">'.'</font> )+1;
00249                 mi-&gt;setLightMapFactor(  LightGroupName,
00250                                                                 mi-&gt;_AnimatedLightmap[i]-&gt;getFactor() );
00251         }
00252 }
00253 
00254 
00255 <font class="comment">// ***************************************************************************</font>
<a name="l00256"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#a3">00256</a> <font class="keywordtype">void</font> CMeshBaseInstance::selectTextureSet(uint <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00257 {
00258         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
00259         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#l0">CMeshBase</a> *mb = NLMISC::safe_cast&lt;CMeshBase *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
00260         <font class="keyword">const</font> uint numMat = mb-&gt;getNbMaterial();
00261         <a class="code" href="debug_8h.html#a6">nlassert</a>(numMat == <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>.size());
00262         <font class="comment">// see which material are selectable</font>
00263         <font class="keywordflow">for</font>(uint k = 0; k &lt; numMat; ++k)
00264         {
00265                 CMaterial &amp;mat = mb-&gt;getMaterial(k);
00266                 <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="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00267                 {
00268                         <font class="keywordflow">if</font> (mat.getTexture(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>) &amp;&amp; mat.getTexture(l)-&gt;isSelectable())
00269                         {
00270                                 <font class="comment">// use a smartPtr so the textFile will be released if just used to set the name for AsyncTextures.</font>
00271                                 CSmartPtr&lt;ITexture&gt;             texNSV= mat.getTexture(l)-&gt;buildNonSelectableVersion(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00272 
00273                                 <font class="comment">// std case: just replace the texture.</font>
00274                                 <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_3">_AsyncTextureMode</a>)
00275                                 {
00276                                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[k].setTexture(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, texNSV);
00277                                 }
00278                                 <font class="comment">// Async case</font>
00279                                 <font class="keywordflow">else</font>
00280                                 {
00281                                         <font class="comment">// If texture file, must copy the texture name</font>
00282                                         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[k].IsTextureFile[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>])
00283                                         {
00284                                                 CTextureFile    *textFile= safe_cast&lt;CTextureFile*&gt;((ITexture*)texNSV);
00285                                                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[k].TextureNames[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>]= textFile-&gt;getFileName();
00286                                         }
00287                                         <font class="comment">// else replace the texture.</font>
00288                                         <font class="keywordflow">else</font>
00289                                                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[k].setTexture(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, texNSV);
00290                                 }
00291                         }
00292                 }
00293         }
00294 
00295         <font class="comment">// Flag the instance as AsyncTextureDirty if in this mode</font>
00296         <font class="keywordflow">if</font>(_AsyncTextureMode)
00297         {
00298                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_6">setAsyncTextureDirty</a>(<font class="keyword">true</font>);
00299         }
00300 }
00301 
00302 
00303 <font class="comment">// ***************************************************************************</font>
<a name="l00304"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#a0">00304</a> <font class="keywordtype">void</font> CMeshBaseInstance::setAnimatedLightmap (CAnimatedLightmap *alm)
00305 {
00306         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o1">_AnimatedLightmap</a>.push_back( alm );
00307         <font class="comment">// Must be traversed in AnimDetail, even if no channel mixer registered</font>
00308         CTransform::setIsForceAnimDetail(<font class="keyword">true</font>);
00309 }
00310 
00311 
00312 <font class="comment">// ***************************************************************************</font>
<a name="l00313"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z578_0">00313</a> uint CMeshBaseInstance::getNumMaterial ()<font class="keyword"> const</font>
00314 <font class="keyword"></font>{
00315         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>.size ();
00316 }
00317 
00318 
00319 <font class="comment">// ***************************************************************************</font>
<a name="l00320"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z578_1">00320</a> <font class="keyword">const</font> CMaterial *CMeshBaseInstance::getMaterial (uint materialId)<font class="keyword"> const</font>
00321 <font class="keyword"></font>{
00322         <font class="keywordflow">return</font> &amp;(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[materialId]);
00323 }
00324 
00325 
00326 <font class="comment">// ***************************************************************************</font>
<a name="l00327"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z578_2">00327</a> CMaterial       *CMeshBaseInstance::getMaterial (uint materialId)
00328 {
00329         <font class="keywordflow">return</font> &amp;(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[materialId]);
00330 }
00331 
00332 
00333 <font class="comment">// ***************************************************************************</font>
00334 <font class="comment">// ***************************************************************************</font>
00335 <font class="comment">// Async texture loading</font>
00336 <font class="comment">// ***************************************************************************</font>
00337 <font class="comment">// ***************************************************************************</font>
00338 
00339 
00340 <font class="comment">// ***************************************************************************</font>
<a name="l00341"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_0">00341</a> <font class="keywordtype">void</font>                    CMeshBaseInstance::enableAsyncTextureMode(<font class="keywordtype">bool</font> enable)
00342 {
00343         <font class="comment">// if same, no-op.</font>
00344         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_3">_AsyncTextureMode</a>==enable)
00345                 <font class="keywordflow">return</font>;
00346         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_3">_AsyncTextureMode</a>= enable;
00347 
00348         <font class="comment">// if comes to async texture mode, must prepare AsyncTexturing</font>
00349         <font class="keywordflow">if</font>(_AsyncTextureMode)
00350         {
00351                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_4">_AsyncTextureReady</a>= <font class="keyword">true</font>;
00352 
00353                 <font class="comment">// For all TextureFiles in material</font>
00354                 <font class="keywordflow">for</font>(uint i=0;i&lt;<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>.size();i++)
00355                 {
00356                         <font class="keywordflow">for</font>(uint stage=0;stage&lt;<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>;stage++)
00357                         {
00358                                 <font class="comment">// test if really a CTextureFile</font>
00359                                 CTextureFile    *text= dynamic_cast&lt;CTextureFile*&gt;(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[i].getTexture(stage));
00360                                 <font class="keywordflow">if</font>(text)
00361                                 {
00362                                         <font class="comment">// Must setup the AsyncTextures</font>
00363                                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].IsTextureFile[stage]= <font class="keyword">true</font>;
00364                                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].TextureNames[stage]= text-&gt;getFileName();
00365                                         <font class="comment">// Now, must copy the textureFile, to Avoid writing in CMeshBase TextureFile descriptor !!!</font>
00366                                         CTextureFile *tf = <font class="keyword">new</font> CTextureFile(*text);
00367                                         <font class="comment">// setup a dummy texture =&gt; Instance won't block rendering because texture not yet ready</font>
00368                                         tf-&gt;setFileName(<font class="stringliteral">"blank.tga"</font>);
00369                                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[i].setTexture(stage, tf);
00370                                 }
00371                                 <font class="keywordflow">else</font>
00372                                 {
00373                                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].IsTextureFile[stage]= <font class="keyword">false</font>;
00374                                 }
00375                         }
00376                 }
00377 
00378                 <font class="comment">// For convenience, flag the instance as Dirty.</font>
00379                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_6">setAsyncTextureDirty</a>(<font class="keyword">true</font>);
00380         }
00381         <font class="comment">// else, AsyncTextureMode disabled</font>
00382         <font class="keywordflow">else</font>
00383         {
00384                 <font class="comment">// first, must stop and release all textures in the async manager.</font>
00385                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_0">releaseCurrentAsyncTextures</a>();
00386                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_1">_AsyncTextureToLoadRefCount</a>==0);
00387                 <font class="comment">// clear the array =&gt; ensure good work if enableAsyncTextureMode(true) is made later</font>
00388                 <a class="code" href="namespaceNLMISC.html#a222">contReset</a>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>);
00389 
00390                 <font class="comment">// For all TextureFiles in material, copy User setup from AsyncTextures, to real fileName</font>
00391                 <font class="keywordflow">for</font>(uint i=0;i&lt;<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>.size();i++)
00392                 {
00393                         <font class="keywordflow">for</font>(uint stage=0;stage&lt;<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>;stage++)
00394                         {
00395                                 <font class="comment">// if an async texture file</font>
00396                                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].IsTextureFile[stage])
00397                                 {
00398                                         <font class="comment">// copy the texture name into the texture file.</font>
00399                                         CTextureFile    *text= safe_cast&lt;CTextureFile*&gt;(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[i].getTexture(stage));
00400                                         text-&gt;setFileName(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].TextureNames[stage]);
00401                                         <font class="comment">// clear string space</font>
00402                                         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].TextureNames[stage].clear();
00403                                 }
00404                         }
00405                 }
00406         }
00407 }
00408 
00409 
00410 <font class="comment">// ***************************************************************************</font>
<a name="l00411"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_2">00411</a> <font class="keywordtype">void</font>                    CMeshBaseInstance::startAsyncTextureLoading()
00412 {
00413         <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_1">getAsyncTextureMode</a>())
00414                 <font class="keywordflow">return</font>;
00415 
00416         <font class="comment">// If the async texutre manager is not setuped in the scene, abort.</font>
00417         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_7">CAsyncTextureManager</a>    *asyncTextMgr= <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o3">_OwnerScene</a>-&gt;getAsyncTextureManager();
00418         <font class="keywordflow">if</font>(!asyncTextMgr)
00419                 <font class="keywordflow">return</font>;
00420 
00421         uint    i;
00422 
00423 
00424         <font class="comment">/* for all new texture names to load, add them to the manager</font>
00425 <font class="comment">                NB: done first before release because of RefCount Management (in case of same texture name).</font>
00426 <font class="comment">        */</font>
00427         <font class="keywordflow">for</font>(i=0;i&lt;<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>.size();i++)
00428         {
00429                 <font class="keywordflow">for</font>(uint stage=0;stage&lt;<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>;stage++)
00430                 {
00431                         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].IsTextureFile[stage])
00432                         {
00433                                 uint    <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>;
00434                                 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>= asyncTextMgr-&gt;addTextureRef(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].TextureNames[stage], <font class="keyword">this</font>);
00435                                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>[i].TextIds[stage]= <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>;
00436                         }
00437                 }
00438         }
00439 
00440         <font class="comment">/* For all old textures (0 for the first time...), release them.</font>
00441 <font class="comment">        */</font>
00442         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_0">releaseCurrentAsyncTextures</a>();
00443 
00444         <font class="comment">// OK! bkup the setup</font>
00445         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>= <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m1">AsyncTextures</a>;
00446 
00447         <font class="comment">// texture async is not ready.</font>
00448         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_4">_AsyncTextureReady</a>= <font class="keyword">false</font>;
00449 }
00450 
00451 <font class="comment">// ***************************************************************************</font>
<a name="l00452"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_0">00452</a> <font class="keywordtype">void</font>                    CMeshBaseInstance::releaseCurrentAsyncTextures()
00453 {
00454         <font class="comment">// If the async texutre manager is not setuped in the scene, abort.</font>
00455         <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_7">CAsyncTextureManager</a>    *asyncTextMgr= <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#o3">_OwnerScene</a>-&gt;getAsyncTextureManager();
00456         <font class="keywordflow">if</font>(!asyncTextMgr)
00457                 <font class="keywordflow">return</font>;
00458 
00459         <font class="comment">// release all texture in the manager</font>
00460         <font class="keywordflow">for</font>(uint i=0;i&lt;<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>.size();i++)
00461         {
00462                 <font class="keywordflow">for</font>(uint stage=0;stage&lt;<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>;stage++)
00463                 {
00464                         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>[i].IsTextureFile[stage])
00465                         {
00466                                 asyncTextMgr-&gt;releaseTexture(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>[i].TextIds[stage], <font class="keyword">this</font>);
00467                         }
00468                 }
00469         }
00470 }
00471 
00472 <font class="comment">// ***************************************************************************</font>
<a name="l00473"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_3">00473</a> <font class="keywordtype">bool</font>                    CMeshBaseInstance::isAsyncTextureReady()
00474 {
00475         <font class="comment">// if ok, just quit</font>
00476         <font class="keywordflow">if</font>(_AsyncTextureReady)
00477                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00478 
00479         <font class="comment">// test if async loading ended</font>
00480         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_1">_AsyncTextureToLoadRefCount</a>==0)
00481         {
00482                 <font class="comment">// must copy all fileNames into the actual Texture Files. Those are the valid ones now!</font>
00483                 <font class="keywordflow">for</font>(uint i=0;i&lt;<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>.size();i++)
00484                 {
00485                         <font class="keywordflow">for</font>(uint stage=0;stage&lt;<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>;stage++)
00486                         {
00487                                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>[i].IsTextureFile[stage])
00488                                 {
00489                                         <font class="comment">// copy the texture name into the texture file.</font>
00490                                         CTextureFile    *text= safe_cast&lt;CTextureFile*&gt;(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#m0">Materials</a>[i].getTexture(stage));
00491                                         <font class="comment">// Since the texture is really uploaded in the driver, the true driver Texture Id will</font>
00492                                         <font class="comment">// be bound to this texture.</font>
00493                                         text-&gt;setFileName(<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>[i].TextureNames[stage]);
00494                                         <font class="comment">/* Since driver setup will only occurs when object become visible, it is a good idea to release</font>
00495 <font class="comment">                                           Old driver info, because it may points to old driver texture data (eg: old shared textureFile).</font>
00496 <font class="comment">                                           thus doing so release VRAM Texture Memory</font>
00497 <font class="comment">                                        */</font>
00498                                         text-&gt;releaseDriverSetup();
00499                                 }
00500                         }
00501                 }
00502 
00503                 <font class="comment">// Ok, we are now ready.</font>
00504                 <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_4">_AsyncTextureReady</a>= <font class="keyword">true</font>;
00505                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00506         }
00507         <font class="keywordflow">else</font>
00508                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00509 }
00510 
00511 
00512 <font class="comment">// ***************************************************************************</font>
<a name="l00513"></a><a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z582_8">00513</a> sint                    CMeshBaseInstance::getAsyncTextureId(uint matId, uint stage)<font class="keyword"> const</font>
00514 <font class="keyword"></font>{
00515         <font class="keywordflow">if</font>(matId&gt;=<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>.size())
00516                 <font class="keywordflow">return</font> -1;
00517         <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>[matId].isTextureFile(stage))
00518                 <font class="keywordflow">return</font> -1;
00519         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#z583_5">_CurrentAsyncTextures</a>[matId].TextIds[stage];
00520 }
00521 
00522 
00523 
00524 } <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>