aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02798.html
blob: 5b3945d344f481d6d2f8a9eb4e81d303e7b6e059 (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
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NL3D::CLodCharacterBuilder class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CLodCharacterBuilder Class Reference</h1><code>#include &lt;<a class="el" href="a05932.html">lod_character_builder.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A tool class used to build a <a class="el" href="a02801.html">CLodCharacterShape</a> Use it by first calling <a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuildera3">setShape()</a>, then add animations to it, and finally get result with getLodShape <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a05932.html#l00049">49</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuildera0">addAnim</a> (const char *animName, <a class="el" href="a02205.html">CAnimation</a> *animation, float frameRate)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuildera1">CLodCharacterBuilder</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#NL3D_1_1CLodCharacterBuildera1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a02801.html">CLodCharacterShape</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuildera2">getLodShape</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">return the lod shape in its current state.  <a href="#NL3D_1_1CLodCharacterBuildera2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuildera3">setShape</a> (const std::string &amp;name, <a class="el" href="a03402.html">CSkeletonShape</a> *skeletonShape, <a class="el" href="a02808.html">CLodCharacterShapeBuild</a> *lodBuild)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuildera4">~CLodCharacterBuilder</a> ()</td></tr>

<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderd0">applySkin</a> (<a class="el" href="a03399.html">CSkeletonModel</a> *skeleton, <a class="el" href="a03128.html">CVector</a> *dstVertices)</td></tr>

<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector&lt; <a class="el" href="a04558.html#a15">uint</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">_BoneRemap</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02808.html">CLodCharacterShapeBuild</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">_LodBuild</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02801.html">CLodCharacterShape</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">_LodCharacterShape</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03408.html">NLMISC::CSmartPtr</a>&lt; <a class="el" href="a03402.html">CSkeletonShape</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr3">_SkeletonShape</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03348.html">CScene</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a></td></tr>

</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CLodCharacterBuildera1" doxytag="NL3D::CLodCharacterBuilder::CLodCharacterBuilder" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CLodCharacterBuilder::CLodCharacterBuilder </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. 
<p>

<p>
Definition at line <a class="el" href="a05931.html#l00045">45</a> of file <a class="el" href="a05931.html">lod_character_builder.cpp</a>.
<p>
References <a class="el" href="a05932.html#l00083">_LodBuild</a>, <a class="el" href="a05932.html#l00082">_SkeletonShape</a>, and <a class="el" href="a05932.html#l00087">_TmpScene</a>.
<p>
<div class="fragment"><pre>00046 {
00047         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr3">_SkeletonShape</a>= NULL;
00048         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">_LodBuild</a>= NULL;
00049         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>= NULL;
00050 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuildera4" doxytag="NL3D::CLodCharacterBuilder::~CLodCharacterBuilder" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CLodCharacterBuilder::~<a class="el" href="a02798.html">CLodCharacterBuilder</a> </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05931.html#l00052">52</a> of file <a class="el" href="a05931.html">lod_character_builder.cpp</a>.
<p>
References <a class="el" href="a05932.html#l00087">_TmpScene</a>, and <a class="el" href="a06348.html#l00194">NL3D::CScene::release()</a>.
<p>
<div class="fragment"><pre>00053 {
00054         <span class="comment">// release the scene</span>
00055         <span class="keywordflow">if</span>(<a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>)
00056         {
00057                 <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>-&gt;release();
00058                 <span class="keyword">delete</span> <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>;
00059                 <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>= NULL;
00060         }
00061 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CLodCharacterBuildera0" doxytag="NL3D::CLodCharacterBuilder::addAnim" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CLodCharacterBuilder::addAnim </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>animName</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02205.html">CAnimation</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>animation</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>float&nbsp;</td>
          <td class="mdname" nowrap> <em>frameRate</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
add an animation to the process <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>animName</em>&nbsp;</td><td>is the name of the animation, used as a key to receover animations in the <a class="el" href="a02801.html">CLodCharacterShape</a> built </td></tr>
    <tr><td valign=top><em>animation</em>&nbsp;</td><td>is the animation to bake/over sample. NB: the animation is deleted at the end of addAnim </td></tr>
    <tr><td valign=top><em>frameRate</em>&nbsp;</td><td>is the desired overSampling rate. eg: 20 frame per second.</td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a05931.html#l00111">111</a> of file <a class="el" href="a05931.html">lod_character_builder.cpp</a>.
<p>
References <a class="el" href="a05932.html#l00080">_LodCharacterShape</a>, <a class="el" href="a05932.html#l00082">_SkeletonShape</a>, <a class="el" href="a05932.html#l00087">_TmpScene</a>, <a class="el" href="a05937.html#l00411">NL3D::CLodCharacterShape::addAnim()</a>, <a class="el" href="a05449.html#l00061">NL3D::CAnimationSet::addAnimation()</a>, <a class="el" href="a05938.html#l00142">NL3D::CLodCharacterShape::CAnimBuild::AnimLength</a>, <a class="el" href="a05931.html#l00199">applySkin()</a>, <a class="el" href="a05449.html#l00104">NL3D::CAnimationSet::build()</a>, <a class="el" href="a06393.html#l00807">NL3D::CSkeletonModel::computeAllBones()</a>, <a class="el" href="a06348.html#l01053">NL3D::CScene::deleteModel()</a>, <a class="el" href="a05543.html#l00154">NL3D::CChannelMixer::eval()</a>, <a class="el" href="a05450.html#l00083">NL3D::CAnimationSet::getAnimationIdByName()</a>, <a class="el" href="a05443.html#l00157">NL3D::CAnimation::getEndTime()</a>, <a class="el" href="a05938.html#l00184">NL3D::CLodCharacterShape::getNumVertices()</a>, <a class="el" href="a05938.html#l00145">NL3D::CLodCharacterShape::CAnimBuild::Keys</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05938.html#l00138">NL3D::CLodCharacterShape::CAnimBuild::Name</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05938.html#l00140">NL3D::CLodCharacterShape::CAnimBuild::NumKeys</a>, <a class="el" href="a06393.html#l00061">NL3D::CSkeletonModel::registerToChannelMixer()</a>, <a class="el" href="a05543.html#l00063">NL3D::CChannelMixer::setAnimationSet()</a>, <a class="el" href="a05543.html#l00449">NL3D::CChannelMixer::setSlotAnimation()</a>, <a class="el" href="a05544.html#l00345">NL3D::CChannelMixer::setSlotTime()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
<p>
<div class="fragment"><pre>00112 {
00113         <a class="code" href="a04199.html#a6">nlassert</a>(frameRate&gt;0);
00114         <a class="code" href="a04199.html#a6">nlassert</a>(animation);
00115 
00116         <span class="comment">/*      Create a Scene, a skeletonModel, an animation set, and a channel mixer to play the animation</span>
00117 <span class="comment">                NB: no render is made and no driver is created. The scene is just here for correct creation of the skeleton</span>
00118 <span class="comment">                Yoyo: This is a tricky way, but I found it the easier one...</span>
00119 <span class="comment">        */</span>
00120 
00121         <span class="comment">// Create Components necesssary to play the animation</span>
00122         <span class="comment">//==========================</span>
00123 
00124         <span class="comment">// create an animationSet, and a channelMixer.</span>
00125         <span class="comment">//--------------</span>
00126         <span class="comment">// build an animation set with the only one animation. This animation will be deleted with the animationSet</span>
00127         CAnimationSet   *tmpAnimationSet= <span class="keyword">new</span> CAnimationSet;
00128         tmpAnimationSet-&gt;addAnimation(animName, animation);
00129         tmpAnimationSet-&gt;build();
00130         <span class="comment">// Build a channelMixer.</span>
00131         CChannelMixer   *tmpChannelMixer= <span class="keyword">new</span> CChannelMixer;
00132         tmpChannelMixer-&gt;setAnimationSet(tmpAnimationSet);
00133 
00134 
00135         <span class="comment">// create a skeleton Model for animation</span>
00136         <span class="comment">//---------------</span>
00137         CSkeletonModel  *skeleton= (CSkeletonModel*)<a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr3">_SkeletonShape</a>-&gt;createInstance(*_TmpScene);
00138         <span class="comment">// and skeleton it with animation</span>
00139         skeleton-&gt;registerToChannelMixer(tmpChannelMixer, <span class="stringliteral">""</span>);
00140         <span class="comment">// activate the anim</span>
00141         <a class="code" href="a04558.html#a15">uint</a> animID = tmpAnimationSet-&gt;getAnimationIdByName(animName);
00142         <a class="code" href="a04199.html#a6">nlassert</a>(animID != CAnimationSet::NotFound);
00143         tmpChannelMixer-&gt;setSlotAnimation(0, animID);
00144 
00145 
00146         <span class="comment">// Build Dst Animation basics.</span>
00147         <span class="comment">//--------------</span>
00148         CLodCharacterShape::CAnimBuild  dstAnim;
00149         dstAnim.Name= animName;
00150         dstAnim.AnimLength= animation-&gt;getEndTime();
00151         dstAnim.NumKeys= (<a class="code" href="a04558.html#a15">uint</a>)ceil(dstAnim.AnimLength * frameRate);
00152         dstAnim.NumKeys= max(1U, dstAnim.NumKeys);
00153         <span class="comment">// resize array.</span>
00154         dstAnim.Keys.resize(<a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">_LodCharacterShape</a>.getNumVertices() * dstAnim.NumKeys);
00155 
00156 
00157         <span class="comment">// Bake the animation</span>
00158         <span class="comment">//==========================</span>
00159         <span class="keywordtype">double</span>  time=0;
00160         <span class="keywordtype">double</span>  dt= 1.0/(<span class="keywordtype">double</span>)frameRate;
00161         <a class="code" href="a04558.html#a13">uint64</a>  evalDetaiDate= 0;
00162         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;dstAnim.NumKeys; i++, time+= dt)
00163         {
00164                 <span class="comment">// clamp the time</span>
00165                 time= <a class="code" href="a04061.html#a0">min</a>(time, (<span class="keywordtype">double</span>)dstAnim.AnimLength);
00166 
00167                 <span class="comment">// setup the channelMixer time</span>
00168                 tmpChannelMixer-&gt;setSlotTime(0, (<span class="keywordtype">float</span>)time);
00169 
00170                 <span class="comment">// Eval the channelMixer, both global and detail</span>
00171                 tmpChannelMixer-&gt;eval(<span class="keyword">false</span>);
00172                 tmpChannelMixer-&gt;eval(<span class="keyword">true</span>, evalDetaiDate++);
00173 
00174                 <span class="comment">// Use the skeleton model to compute bone skin matrix, supposing an identity skeleton worldMatrix</span>
00175                 skeleton-&gt;computeAllBones(CMatrix::Identity);
00176 
00177                 <span class="comment">// apply the skinning from the current skeleton state</span>
00178                 <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderd0">applySkin</a>(skeleton, &amp;dstAnim.Keys[i*<a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">_LodCharacterShape</a>.getNumVertices()]);
00179         }
00180 
00181 
00182         <span class="comment">// Add the animation to the lod</span>
00183         <span class="comment">//==========================</span>
00184         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">_LodCharacterShape</a>.addAnim(dstAnim);
00185 
00186 
00187         <span class="comment">// Delete</span>
00188         <span class="comment">//==========================</span>
00189         <span class="comment">// release the skeleton</span>
00190         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>-&gt;deleteModel(skeleton);
00191         <span class="comment">// delete the channelMixer</span>
00192         <span class="keyword">delete</span> tmpChannelMixer;
00193         <span class="comment">// delete the animationSet</span>
00194         <span class="keyword">delete</span> tmpAnimationSet;
00195 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuilderd0" doxytag="NL3D::CLodCharacterBuilder::applySkin" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CLodCharacterBuilder::applySkin </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a03399.html">CSkeletonModel</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>skeleton</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03128.html">CVector</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>dstVertices</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [private]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05931.html#l00199">199</a> of file <a class="el" href="a05931.html">lod_character_builder.cpp</a>.
<p>
References <a class="el" href="a05932.html#l00084">_BoneRemap</a>, <a class="el" href="a05932.html#l00083">_LodBuild</a>, <a class="el" href="a06394.html#l00098">NL3D::CSkeletonModel::Bones</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05938.html#l00080">NL3D::CLodCharacterShapeBuild::SkinWeights</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05938.html#l00077">NL3D::CLodCharacterShapeBuild::Vertices</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>.
<p>
Referenced by <a class="el" href="a05931.html#l00111">addAnim()</a>.
<p>
<div class="fragment"><pre>00200 {
00201         <a class="code" href="a04558.html#a15">uint</a>    numVerts= <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">_LodBuild</a>-&gt;Vertices.size();
00202 
00203         <span class="comment">// for all vertices.</span>
00204         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;numVerts; i++)
00205         {
00206                 CMesh::CSkinWeight      &amp;skinWgt= <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">_LodBuild</a>-&gt;SkinWeights[i];
00207                 CVector                         &amp;srcVert= <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">_LodBuild</a>-&gt;Vertices[i];
00208                 CVector                         &amp;dstVert= dstVertices[i];
00209                 dstVert= CVector::Null;
00210                 <span class="comment">// parse all Weights, and add influence.</span>
00211                 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++)
00212                 {
00213                         <span class="keywordtype">float</span>   wgt= skinWgt.Weights[j];
00214 
00215                         <span class="keywordflow">if</span>(wgt==0)
00216                         {
00217                                 <span class="comment">// this should not happen, at least weight 0 should have an influence.</span>
00218                                 <span class="keywordflow">if</span>(j==0)
00219                                         dstVert= srcVert;
00220                                 <span class="comment">// no more influence for this vertex.</span>
00221                                 <span class="keywordflow">break</span>;
00222                         }
00223                         <span class="keywordflow">else</span>
00224                         {
00225                                 <span class="comment">// Get the skeleton bone to read.</span>
00226                                 <a class="code" href="a04558.html#a15">uint</a>    boneId= <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">_BoneRemap</a>[skinWgt.MatrixId[j]];
00227                                 <span class="comment">// Get the computed matrix from the skeleton.</span>
00228                                 <span class="keyword">const</span>   CMatrix &amp;boneMat= skeleton-&gt;Bones[boneId].getBoneSkinMatrix();
00229                                 <span class="comment">// Add the influence of this bone.</span>
00230                                 dstVert+= (boneMat * srcVert) * wgt;
00231                         }
00232                 }
00233         }
00234 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuildera2" doxytag="NL3D::CLodCharacterBuilder::getLodShape" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const <a class="el" href="a02801.html">CLodCharacterShape</a>&amp; NL3D::CLodCharacterBuilder::getLodShape </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
return the lod shape in its current state. 
<p>

<p>
Definition at line <a class="el" href="a05932.html#l00075">75</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.
<p>
References <a class="el" href="a05932.html#l00080">_LodCharacterShape</a>.
<p>
<div class="fragment"><pre>00075 {<span class="keywordflow">return</span> <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">_LodCharacterShape</a>;}
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuildera3" doxytag="NL3D::CLodCharacterBuilder::setShape" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CLodCharacterBuilder::setShape </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03402.html">CSkeletonShape</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>skeletonShape</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02808.html">CLodCharacterShapeBuild</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>lodBuild</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
init process with the Mesh and the SkeletonShape to use. NB: nlWarnings may occurs if don't find bones used by lodBuild, in the skeletonShape. In this case, root bone 0 of the skeleton shape is used.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>name</em>&nbsp;</td><td>is the name to give to the shape </td></tr>
    <tr><td valign=top><em>skeletonShape</em>&nbsp;</td><td>the skeleton used for animation. Ptr is handled by the builder as a smartPtr. </td></tr>
    <tr><td valign=top><em>lodBuild</em>&nbsp;</td><td>the mesh information. Ptr is hold by the builder, but not deleted</td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a05931.html#l00064">64</a> of file <a class="el" href="a05931.html">lod_character_builder.cpp</a>.
<p>
References <a class="el" href="a05932.html#l00084">_BoneRemap</a>, <a class="el" href="a05932.html#l00083">_LodBuild</a>, <a class="el" href="a05932.html#l00080">_LodCharacterShape</a>, <a class="el" href="a05932.html#l00082">_SkeletonShape</a>, <a class="el" href="a05932.html#l00087">_TmpScene</a>, <a class="el" href="a05937.html#l00337">NL3D::CLodCharacterShape::buildMesh()</a>, <a class="el" href="a06348.html#l00249">NL3D::CScene::initDefaultRoots()</a>, <a class="el" href="a06348.html#l00277">NL3D::CScene::initQuadGridClipManager()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05981.html#l00099">sint32</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
<div class="fragment"><pre>00065 {
00066         <a class="code" href="a04199.html#a6">nlassert</a>(skeletonShape);
00067         <a class="code" href="a04199.html#a6">nlassert</a>(lodBuild);
00068 
00069         <span class="comment">// SmartPtr the skeleton Shape (NB: important because skeletonModel use it)</span>
00070         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr3">_SkeletonShape</a>= skeletonShape;
00071         <span class="comment">// a std ptr.</span>
00072         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">_LodBuild</a>= lodBuild;
00073 
00074         <span class="comment">// Remap bone, with help of lodBuild and skeleton names.</span>
00075         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">_BoneRemap</a>.resize(lodBuild-&gt;BonesNames.size());
00076         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;<a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">_BoneRemap</a>.size(); i++)
00077         {
00078                 <span class="keyword">const</span> std::string       &amp;boneName= lodBuild-&gt;BonesNames[i];
00079                 <a class="code" href="a04558.html#a10">sint32</a>  boneId= <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr3">_SkeletonShape</a>-&gt;getBoneIdByName(boneName);
00080                 <span class="comment">// If not found</span>
00081                 <span class="keywordflow">if</span>(boneId&lt;0)
00082                 {
00083                         <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Not found a bone in the skeleton Shape: %s"</span>, boneName.c_str());
00084                         <span class="comment">// use root bone.</span>
00085                         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">_BoneRemap</a>[i]= 0;
00086                 }
00087                 <span class="keywordflow">else</span>
00088                         <span class="comment">// remap</span>
00089                         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">_BoneRemap</a>[i]= boneId;
00090         }
00091 
00092         <span class="comment">// build basics</span>
00093         <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">_LodCharacterShape</a>.buildMesh(name, *_LodBuild);
00094 
00095         <span class="comment">// Build a scene, for addAnim purpose</span>
00096         <span class="keywordflow">if</span>(!<a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>)
00097         {
00098                 <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>= <span class="keyword">new</span> CScene(<span class="keyword">false</span>);
00099                 <span class="comment">// Must init Statics for scene (because use it in addAnim). NB: never mind if done twice.</span>
00100                 CScene::registerBasics();
00101                 <span class="comment">// init default Roots.</span>
00102                 <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>-&gt;initDefaultRoots();
00103                 <span class="comment">// Don't Set driver/viewport</span>
00104                 <span class="comment">// init QuadGridClipManager</span>
00105                 <a class="code" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">_TmpScene</a>-&gt;initQuadGridClipManager ();
00106         }
00107 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CLodCharacterBuilderr0" doxytag="NL3D::CLodCharacterBuilder::_BoneRemap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> std::vector&lt;<a class="el" href="a04558.html#a15">uint</a>&gt; <a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr0">NL3D::CLodCharacterBuilder::_BoneRemap</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05932.html#l00084">84</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.
<p>
Referenced by <a class="el" href="a05931.html#l00199">applySkin()</a>, and <a class="el" href="a05931.html#l00064">setShape()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuilderr1" doxytag="NL3D::CLodCharacterBuilder::_LodBuild" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02808.html">CLodCharacterShapeBuild</a>* <a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr1">NL3D::CLodCharacterBuilder::_LodBuild</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05932.html#l00083">83</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.
<p>
Referenced by <a class="el" href="a05931.html#l00199">applySkin()</a>, <a class="el" href="a05931.html#l00045">CLodCharacterBuilder()</a>, and <a class="el" href="a05931.html#l00064">setShape()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuilderr2" doxytag="NL3D::CLodCharacterBuilder::_LodCharacterShape" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02801.html">CLodCharacterShape</a> <a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr2">NL3D::CLodCharacterBuilder::_LodCharacterShape</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05932.html#l00080">80</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.
<p>
Referenced by <a class="el" href="a05931.html#l00111">addAnim()</a>, <a class="el" href="a05932.html#l00075">getLodShape()</a>, and <a class="el" href="a05931.html#l00064">setShape()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuilderr3" doxytag="NL3D::CLodCharacterBuilder::_SkeletonShape" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03408.html">NLMISC::CSmartPtr</a>&lt;<a class="el" href="a03402.html">CSkeletonShape</a>&gt; <a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr3">NL3D::CLodCharacterBuilder::_SkeletonShape</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05932.html#l00082">82</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.
<p>
Referenced by <a class="el" href="a05931.html#l00111">addAnim()</a>, <a class="el" href="a05931.html#l00045">CLodCharacterBuilder()</a>, and <a class="el" href="a05931.html#l00064">setShape()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLodCharacterBuilderr4" doxytag="NL3D::CLodCharacterBuilder::_TmpScene" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03348.html">CScene</a>* <a class="el" href="a02798.html#NL3D_1_1CLodCharacterBuilderr4">NL3D::CLodCharacterBuilder::_TmpScene</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05932.html#l00087">87</a> of file <a class="el" href="a05932.html">lod_character_builder.h</a>.
<p>
Referenced by <a class="el" href="a05931.html#l00111">addAnim()</a>, <a class="el" href="a05931.html#l00045">CLodCharacterBuilder()</a>, <a class="el" href="a05931.html#l00064">setShape()</a>, and <a class="el" href="a05931.html#l00052">~CLodCharacterBuilder()</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05932.html">lod_character_builder.h</a><li><a class="el" href="a05931.html">lod_character_builder.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:49:47 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>