aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/transform_8cpp-source.html
blob: b5dd712393861e730d6679a21a261d468e5e5c3f (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
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
<!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="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/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="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/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="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

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

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/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="/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:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>transform.cpp</h1><a href="transform_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000 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="transform_8h.html">3d/transform.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="skeleton__model_8h.html">3d/skeleton_model.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="skip__model_8h.html">3d/skip_model.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="root__model_8h.html">3d/root_model.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="fast__floor_8h.html">3d/fast_floor.h</a>"</font>
00034 
00035 
00036 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00037 
00038 
00039 <font class="keyword">namespace       </font>NL3D
00040 {
00041 
00042 
00043 <font class="comment">// ***************************************************************************</font>
<a name="l00044"></a><a class="code" href="classNL3D_1_1CTransform.html#d0">00044</a> <font class="keywordtype">void</font>    CTransform::registerBasic()
00045 {
00046         CMOT::registerModel( <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, 0, CTransform::creator);
00047         CMOT::registerObs( <a class="code" href="namespaceNL3D.html#a41">HrcTravId</a>,                   <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, CTransformHrcObs::creator                  );
00048         CMOT::registerObs( <a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>,                  <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, CTransformClipObs::creator                 );
00049         CMOT::registerObs( <a class="code" href="namespaceNL3D.html#a3">AnimDetailTravId</a>,    <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, CTransformAnimDetailObs::creator   );
00050         CMOT::registerObs( <a class="code" href="namespaceNL3D.html#a92">LightTravId</a>,                 <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, CTransformLightObs::creator                );
00051         CMOT::registerObs( <a class="code" href="namespaceNL3D.html#a232">RenderTravId</a>,                <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, CTransformRenderObs::creator               );
00052 }
00053 
00054 
00055 <font class="comment">// ***************************************************************************</font>
<a name="l00056"></a><a class="code" href="classNL3D_1_1CTransform.html#b0">00056</a> CTransform::CTransform()
00057 {
00058         <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>= NULL;
00059         <a class="code" href="classNL3D_1_1CTransform.html#n1">_ClipObs</a>= NULL;
00060         <a class="code" href="classNL3D_1_1CTransform.html#n2">_LightObs</a>=NULL;
00061 
00062         <a class="code" href="classNL3D_1_1IModel.html#z615_3">TouchObs</a>.<a class="code" href="classNLMISC_1_1CBitSet.html#z272_0">resize</a>(<a class="code" href="classNL3D_1_1CTransform.html#u23u1">Last</a>);
00063 
00064         <a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>= CHrcTrav::Herit;
00065 
00066         <a class="code" href="classNL3D_1_1CTransform.html#o2">_LastTransformableMatrixDate</a>= 0;
00067 
00068         <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>= NULL;
00069 
00070         <a class="code" href="classNL3D_1_1CTransform.html#o3">_ClusterSystem</a> = NULL;
00071 
00072         <a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a>= <a class="code" href="classNL3D_1_1CTransform.html#u24u2">FreezeHRCStateDisabled</a>;
00073 
00074         <a class="code" href="classNL3D_1_1CTransform.html#o5">_OrderingLayer</a> = 0;
00075 
00076         
00077         <font class="comment">// No logicInfo by default</font>
00078         <a class="code" href="classNL3D_1_1CTransform.html#o7">_LogicInfo</a>= NULL;
00079 
00080         <a class="code" href="classNL3D_1_1CTransform.html#o6">_ForceCLodSticked</a>= <font class="keyword">false</font>;
00081 
00082         <font class="comment">// default MeanColor value</font>
00083         <a class="code" href="classNL3D_1_1CTransform.html#o8">_MeanColor</a>.set(255,255,255,255);
00084 
00085 
00086         <font class="comment">// Setup some state.</font>
00087 
00088         <font class="comment">/*</font>
00089 <font class="comment">                Default are:</font>
00090 <font class="comment">                        IsAnimDetailable= 0</font>
00091 <font class="comment">                        IsLoadBalancable= 0</font>
00092 <font class="comment">                        IsLightable= 0</font>
00093 <font class="comment">                        IsRenderable= 0</font>
00094 <font class="comment">                        IsTransparent= 0</font>
00095 <font class="comment">                        IsOpaque= 1</font>
00096 <font class="comment">                        QuadGridClipEnabled= 0.</font>
00097 <font class="comment"></font>
00098 <font class="comment">                        IsUserLightable= 1                      // default, the model may be lighted.</font>
00099 <font class="comment">                        IsFinalLightable= 0</font>
00100 <font class="comment">                        IsNeedUpdateLighting= 0</font>
00101 <font class="comment">                        ISNeedUpdateFrozenStaticLightSetup= 0</font>
00102 <font class="comment"></font>
00103 <font class="comment">                        IsSkeleton= 0</font>
00104 <font class="comment"></font>
00105 <font class="comment">                        IsDeleteChannelMixer = 0;</font>
00106 <font class="comment">        */</font>
00107         <a class="code" href="classNL3D_1_1CTransform.html#z854_3">_StateFlags</a>= <a class="code" href="classNL3D_1_1CTransform.html#z854_0u11">IsOpaque</a> | <a class="code" href="classNL3D_1_1CTransform.html#z854_0u13">IsUserLightable</a>;
00108 }
00109 
00110 
00111 <font class="comment">// ***************************************************************************</font>
<a name="l00112"></a><a class="code" href="classNL3D_1_1CTransform.html#b3">00112</a> <font class="keywordtype">void</font>    CTransform::initModel()
00113 {
00114         IModel::initModel();
00115 
00116         <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>= (<a class="code" href="classNL3D_1_1CTransform.html#l0">CTransformHrcObs</a>*)<a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<a class="code" href="namespaceNL3D.html#a41">HrcTravId</a>);
00117         <a class="code" href="classNL3D_1_1CTransform.html#n1">_ClipObs</a>= (<a class="code" href="classNL3D_1_1CTransform.html#l1">CTransformClipObs</a>*)<a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>);
00118         <a class="code" href="classNL3D_1_1CTransform.html#n2">_LightObs</a>= (<a class="code" href="classNL3D_1_1CTransform.html#l2">CTransformLightObs</a>*)<a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<a class="code" href="namespaceNL3D.html#a92">LightTravId</a>);
00119 }
00120 
00121 
00122 <font class="comment">// ***************************************************************************</font>
<a name="l00123"></a><a class="code" href="classNL3D_1_1CTransform.html#b1">00123</a> CTransform::~CTransform()
00124 {
00125         <font class="comment">// If still binded to a father skeleton</font>
00126         <font class="keywordflow">if</font>( _FatherSkeletonModel )
00127         {
00128                 <font class="comment">/* If skinned, cannot detach me from skeleton here because detachSkeletonSon()</font>
00129 <font class="comment">                        use some virtual calls of transform: setApplySkin().</font>
00130 <font class="comment">                        Hence, It is the deriver job to detach himself from the skeleton.</font>
00131 <font class="comment"></font>
00132 <font class="comment">                        NB: test isSkinned(), not isSkinnable(), since isSkinned() is not virtual ....</font>
00133 <font class="comment">                        This means that if a Mesh isSkinnable(), but never skinned, it is not asserted here.</font>
00134 <font class="comment">                */</font>
00135                 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CTransform.html#z849_1">isSkinned</a>() )
00136                 {
00137                         <a class="code" href="debug_8h.html#a12">nlstop</a>;
00138                 }
00139                 <font class="keywordflow">else</font>
00140                         <font class="comment">// Can detach Me. Important for UTransform sticked</font>
00141                         <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;detachSkeletonSon(<font class="keyword">this</font>);
00142         }
00143 
00144         <font class="comment">// resetLighting, removing me from PointLight Transform list.</font>
00145         <font class="comment">// NB: not done for FrozenStaticLightSetup, because those lights don't owns me.</font>
00146         <a class="code" href="classNL3D_1_1CTransform.html#z847_0">resetLighting</a>();
00147 
00148         <font class="comment">// Must also remove me from the lightingManager.</font>
00149         <font class="comment">// must test _LightObs because of CCluster usage out of mot (thanks to mat!! :) )</font>
00150         <font class="keywordflow">if</font>(_LightObs)
00151         {
00152                 CLightTrav      *lightTrav= (CLightTrav*)<a class="code" href="classNL3D_1_1CTransform.html#n2">_LightObs</a>-&gt;Trav;
00153                 <a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>= lightTrav-&gt;LightingManager.eraseStaticLightedModel(<a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>);
00154         }
00155 
00156         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTransform.html#a12">getChannelMixerOwnerShip</a>()) <font class="keyword">delete</font> (CChannelMixer *) <a class="code" href="classNL3D_1_1CTransform.html#o1">_ChannelMixer</a>;
00157 }
00158 
00159 <font class="comment">// ***************************************************************************</font>
<a name="l00160"></a><a class="code" href="classNL3D_1_1CTransform.html#a6">00160</a> <font class="keywordtype">void</font>            CTransform::hide()
00161 {
00162         <font class="comment">// Optim: do nothing if already set (=&gt; not foulTransform() -ed).</font>
00163         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>!= CHrcTrav::Hide)
00164         {
00165                 <a class="code" href="classNL3D_1_1CTransform.html#c0">foulTransform</a>();
00166                 <a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>= CHrcTrav::Hide;
00167         }
00168 }
00169 <font class="comment">// ***************************************************************************</font>
<a name="l00170"></a><a class="code" href="classNL3D_1_1CTransform.html#a7">00170</a> <font class="keywordtype">void</font>            CTransform::show()
00171 {
00172         <font class="comment">// Optim: do nothing if already set (=&gt; not foulTransform() -ed).</font>
00173         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>!= CHrcTrav::Show)
00174         {
00175                 <a class="code" href="classNL3D_1_1CTransform.html#c0">foulTransform</a>();
00176                 <a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>= CHrcTrav::Show;
00177         }
00178 }
00179 <font class="comment">// ***************************************************************************</font>
<a name="l00180"></a><a class="code" href="classNL3D_1_1CTransform.html#a8">00180</a> <font class="keywordtype">void</font>            CTransform::heritVisibility()
00181 {
00182         <font class="comment">// Optim: do nothing if already set (=&gt; not foulTransform() -ed).</font>
00183         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>!= CHrcTrav::Herit)
00184         {
00185                 <a class="code" href="classNL3D_1_1CTransform.html#c0">foulTransform</a>();
00186                 <a class="code" href="classNL3D_1_1CTransform.html#o0">Visibility</a>= CHrcTrav::Herit;
00187         }
00188 }
00189 
00190 
00191 <font class="comment">// ***************************************************************************</font>
00192 CTrackDefaultVector             CTransform::DefaultPos( CVector::Null );
00193 CTrackDefaultVector             CTransform::DefaultRotEuler( CVector::Null );
00194 CTrackDefaultQuat               CTransform::DefaultRotQuat( <a class="code" href="classNLMISC_1_1CQuat.html#p0">NLMISC::CQuat::Identity</a> );
00195 CTrackDefaultVector             CTransform::DefaultScale( CVector(1,1,1) );
00196 CTrackDefaultVector             CTransform::DefaultPivot( CVector::Null );
00197 
<a name="l00198"></a><a class="code" href="classNL3D_1_1CTransform.html#z846_0">00198</a> ITrack* CTransform::getDefaultTrack (uint valueId)
00199 {
00200         <font class="comment">// Cyril: prefer do it here in CTransform, because of CCamera, CLight etc... (which may not need a default value too!!)</font>
00201 
00202         <font class="comment">// what value ?</font>
00203         <font class="keywordflow">switch</font> (valueId)
00204         {
00205         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s5">PosValue</a>:                  <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CTransform.html#r0">DefaultPos</a>;
00206         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s6">RotEulerValue</a>:             <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CTransform.html#r2">DefaultRotEuler</a>;
00207         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s7">RotQuatValue</a>:              <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CTransform.html#r3">DefaultRotQuat</a>;
00208         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s8">ScaleValue</a>:                <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CTransform.html#r4">DefaultScale</a>;
00209         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s9">PivotValue</a>:                <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CTransform.html#r1">DefaultPivot</a>;
00210         }
00211 
00212         <font class="comment">// No, only ITrnasformable values!</font>
00213         <a class="code" href="debug_8h.html#a12">nlstop</a>;
00214         <font class="comment">// Deriver note: else call BaseClass::getDefaultTrack(valueId);</font>
00215 
00216         <font class="keywordflow">return</font> NULL;
00217 
00218 }
00219 
00220 <font class="comment">// ***************************************************************************</font>
<a name="l00221"></a><a class="code" href="classNL3D_1_1CTransform.html#z846_1">00221</a> <font class="keywordtype">void</font>    CTransform::registerToChannelMixer(CChannelMixer *chanMixer, <font class="keyword">const</font> std::string &amp;prefix)
00222 {
00223         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTransform.html#a12">getChannelMixerOwnerShip</a>() &amp;&amp; chanMixer != <a class="code" href="classNL3D_1_1CTransform.html#o1">_ChannelMixer</a>)
00224         {
00225                 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CTransform.html#o1">_ChannelMixer</a>;
00226                 <a class="code" href="classNL3D_1_1CTransform.html#a11">setChannelMixerOwnerShip</a>(<font class="keyword">false</font>);
00227         }
00228 
00229         <font class="comment">// Hey!! we are animated!!</font>
00230         <a class="code" href="classNL3D_1_1CTransform.html#o1">_ChannelMixer</a>= chanMixer;
00231 
00232         <font class="comment">// Update flag, if we must be inserted in AnimDetail</font>
00233         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u6">IsAnimDetailable</a>, <a class="code" href="classNL3D_1_1CTransform.html#o1">_ChannelMixer</a> || <a class="code" href="classNL3D_1_1CTransform.html#z854_2">getStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u21">IsForceAnimDetail</a>) );
00234 
00235         <font class="comment">// If skinned, then must inform skeleton parent that it must recompute skin render/animDetail lists</font>
00236         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#z849_1">isSkinned</a>())
00237         {
00238                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>);
00239                 <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;dirtSkinRenderLists();
00240         }
00241 
00242         <font class="comment">// For CTransfom, channels are not detailled.</font>
00243         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s5">PosValue</a>, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s4">OwnerBit</a>, prefix, <font class="keyword">false</font>);
00244         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s6">RotEulerValue</a>, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s4">OwnerBit</a>, prefix, <font class="keyword">false</font>);
00245         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s7">RotQuatValue</a>, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s4">OwnerBit</a>, prefix, <font class="keyword">false</font>);
00246         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s8">ScaleValue</a>, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s4">OwnerBit</a>, prefix, <font class="keyword">false</font>);
00247         <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s9">PivotValue</a>, <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s4">OwnerBit</a>, prefix, <font class="keyword">false</font>);
00248 
00249         <font class="comment">// Deriver note: if necessary, call     BaseClass::registerToChannelMixer(chanMixer, prefix);</font>
00250 }
00251 
00252 
00253 
00254 <font class="comment">// ***************************************************************************</font>
<a name="l00255"></a><a class="code" href="classNL3D_1_1CTransform.html#c1">00255</a> <font class="keywordtype">void</font>                    CTransform::updateWorldMatrixFromFather()
00256 {
00257         <font class="comment">// If I am not skinned</font>
00258         <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CTransform.html#z849_1">isSkinned</a>())
00259         {
00260                 <font class="comment">// Compute the HRC WorldMatrix.</font>
00261                 <font class="comment">// if I am not sticked.</font>
00262                 <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>)
00263                 {
00264                         <font class="comment">// get the normal father worldMatrix in Hrc.</font>
00265                         <a class="code" href="classNL3D_1_1CTransform.html#b0">CTransform</a>      *fatherTransform= dynamic_cast&lt;CTransform*&gt;(<a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;Trav-&gt;getFirstParent(<font class="keyword">this</font>));
00266                         <font class="comment">// if exist</font>
00267                         <font class="keywordflow">if</font>(fatherTransform)
00268                         {
00269                                 <font class="keyword">const</font> CMatrix &amp;parentWM= fatherTransform-&gt;_HrcObs-&gt;WorldMatrix;
00270                                 <font class="comment">// combine worldMatrix</font>
00271                                 <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;WorldMatrix= parentWM * <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;LocalMatrix;
00272                         }
00273                         <font class="keywordflow">else</font>
00274                                 <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;WorldMatrix= <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;LocalMatrix;
00275                 }
00276                 <font class="keywordflow">else</font>
00277                 {
00278                         <font class="comment">// get the worldMatrix of the bone if I am sticked.</font>
00279                         <font class="keyword">const</font> CMatrix &amp;parentWM= <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;Bones[<a class="code" href="classNL3D_1_1CTransform.html#z851_8">_FatherBoneId</a>].getWorldMatrix();
00280                         <font class="comment">// combine worldMatrix</font>
00281                         <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;WorldMatrix= parentWM * <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;LocalMatrix;
00282                 }
00283         }
00284 }
00285 
00286 
00287 <font class="comment">// ***************************************************************************</font>
<a name="l00288"></a><a class="code" href="classNL3D_1_1CTransform.html#a13">00288</a> <font class="keywordtype">void</font>                    CTransform::freeze()
00289 {
00290         <font class="comment">// First, validate the model, and all his observers.</font>
00291         <font class="comment">// Frozen state is disabled here (in CTransformHrcObs::update()).</font>
00292         <a class="code" href="classNL3D_1_1IModel.html#z615_2">validate</a>();
00293 
00294         <font class="comment">// Then flag the frozen state.</font>
00295         <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;Frozen= <font class="keyword">true</font>;
00296 }
00297 
00298 <font class="comment">// ***************************************************************************</font>
<a name="l00299"></a><a class="code" href="classNL3D_1_1CTransform.html#a14">00299</a> <font class="keywordtype">void</font>                    CTransform::setDontUnfreezeChildren(<font class="keywordtype">bool</font> val)
00300 {
00301         <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;DontUnfreezeChildren = val;
00302 }
00303 
00304 
00305 <font class="comment">// ***************************************************************************</font>
<a name="l00306"></a><a class="code" href="classNL3D_1_1CTransform.html#a18">00306</a> <font class="keyword">const</font> CMatrix&amp; CTransform::getWorldMatrix()
00307 {
00308         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;WorldMatrix;
00309 }
00310 
00311 <font class="comment">// ***************************************************************************</font>
<a name="l00312"></a><a class="code" href="classNL3D_1_1CTransform.html#a19">00312</a> <font class="keywordtype">bool</font>    CTransform::getLastClippedState()<font class="keyword"> const</font>
00313 <font class="keyword"></font>{
00314         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTransform.html#n1">_ClipObs</a>-&gt;Visible;
00315 }
00316 
00317 
00318 
00319 <font class="comment">// ***************************************************************************</font>
<a name="l00320"></a><a class="code" href="classNL3D_1_1CTransform.html#a15">00320</a> <font class="keywordtype">void</font>            CTransform::freezeHRC()
00321 {
00322         <font class="comment">// if disabled, say we are ready to validate our worldMatrix for long.</font>
00323         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a>==<a class="code" href="classNL3D_1_1CTransform.html#u24u2">FreezeHRCStateDisabled</a>)
00324         {
00325                 <a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a>= <a class="code" href="classNL3D_1_1CTransform.html#u24u3">FreezeHRCStateRequest</a>;
00326                 <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u12">QuadGridClipEnabled</a>, <font class="keyword">true</font>);
00327         }
00328 }
00329 
00330 
00331 <font class="comment">// ***************************************************************************</font>
<a name="l00332"></a><a class="code" href="classNL3D_1_1CTransform.html#a16">00332</a> <font class="keywordtype">void</font>            CTransform::unfreezeHRC()
00333 {
00334         <font class="comment">// if this model is no HRC frozen disabled</font>
00335         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a>!=<a class="code" href="classNL3D_1_1CTransform.html#u24u2">FreezeHRCStateDisabled</a>)
00336         {
00337                 <font class="comment">// if model correctly frozen.</font>
00338                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a> == CTransform::FreezeHRCStateEnabled )
00339                 {
00340                         <font class="comment">// Trick: get the traversal via the HrcObs.</font>
00341                         CHrcTrav        *hrcTrav= static_cast&lt;CHrcTrav*&gt;(<a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;Trav);
00342                         <font class="comment">// if linked to SkipModelRoot, link this model to root of HRC.</font>
00343                         <font class="keywordflow">if</font>( hrcTrav-&gt;getFirstParent(<font class="keyword">this</font>) == hrcTrav-&gt;Scene-&gt;getSkipModelRoot() )
00344                                 hrcTrav-&gt;link(NULL, <font class="keyword">this</font>);
00345 
00346                         <font class="comment">// Link this object to the validateList.</font>
00347                         <a class="code" href="classNL3D_1_1IModel.html#z616_2">linkToValidateList</a>();
00348 
00349                         <font class="comment">// if lightable()</font>
00350                         <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CTransform.html#z847_1">isLightable</a>() )
00351                         {
00352                                 CLightTrav      *lightTrav= static_cast&lt;CLightTrav*&gt;(<a class="code" href="classNL3D_1_1CTransform.html#n2">_LightObs</a>-&gt;Trav);
00353                                 <font class="comment">// Lighting: must remove the object from the quadGrid.</font>
00354                                 <font class="comment">// NB: works if _LightedModelIt==NULL. result is that _LightedModelIt= NULL.</font>
00355                                 <a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>= lightTrav-&gt;LightingManager.eraseStaticLightedModel(<a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>);
00356                         }
00357 
00358                 }
00359 
00360                 <a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a>= <a class="code" href="classNL3D_1_1CTransform.html#u24u2">FreezeHRCStateDisabled</a>;
00361                 <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u12">QuadGridClipEnabled</a>, <font class="keyword">false</font>);
00362         }
00363 }
00364 
00365 
00366 <font class="comment">// ***************************************************************************</font>
<a name="l00367"></a><a class="code" href="classNL3D_1_1CTransform.html#b2">00367</a> <font class="keywordtype">void</font>            CTransform::update()
00368 {
00369         IModel::update();
00370 
00371         <font class="comment">// test if the matrix has been changed in ITransformable.</font>
00372         <font class="keywordflow">if</font>(ITransformable::compareMatrixDate(<a class="code" href="classNL3D_1_1CTransform.html#o2">_LastTransformableMatrixDate</a>))
00373         {
00374                 <a class="code" href="classNL3D_1_1CTransform.html#o2">_LastTransformableMatrixDate</a>= ITransformable::getMatrixDate();
00375                 <a class="code" href="classNL3D_1_1IModel.html#z615_1">foul</a>(<a class="code" href="classNL3D_1_1CTransform.html#u23u0">TransformDirty</a>);
00376         }
00377 
00378         <font class="comment">// update the freezeHRC state.</font>
00379         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a> != CTransform::FreezeHRCStateDisabled)
00380         {
00381                 <font class="comment">// if the model request to be frozen in HRC</font>
00382                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a> == CTransform::FreezeHRCStateRequest )
00383                 {
00384                         <font class="comment">// Wait for next Hrc traversal to compute good WorldMatrix for this model and his sons.</font>
00385                         <font class="comment">// Also, next Hrc traversal will insert the model in the LightingManager quadGrid (if lightable)</font>
00386                         <a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a> = CTransform::FreezeHRCStateReady;
00387                 }
00388                 <font class="comment">// if the model is ready to be frozen in HRC, then do it!!</font>
00389                 <font class="keywordflow">else</font> <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a> == CTransform::FreezeHRCStateReady )
00390                 {
00391                         <font class="comment">// Trick: get the traversal via the HrcObs.</font>
00392                         CHrcTrav        *hrcTrav= static_cast&lt;CHrcTrav*&gt;(<a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;Trav);
00393                         <font class="comment">// if linked to root of HRC, link this model to SkipModelRoot.</font>
00394                         <font class="keywordflow">if</font>( hrcTrav-&gt;getFirstParent(<font class="keyword">this</font>) == hrcTrav-&gt;getRoot() )
00395                                 hrcTrav-&gt;link(hrcTrav-&gt;Scene-&gt;getSkipModelRoot(), <font class="keyword">this</font>);
00396 
00397                         <font class="comment">// unLink this object from the validateList. NB: the list will still be correclty parsed.</font>
00398                         <a class="code" href="classNL3D_1_1IModel.html#z616_3">unlinkFromValidateList</a>();
00399 
00400                         <font class="comment">// if lightable, the model is inserted in a quadgrid to update his lighting only when</font>
00401                         <font class="comment">// dynamicLights touch him (since himself is static).</font>
00402                         <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CTransform.html#z847_1">isLightable</a>() )
00403                         {
00404                                 CLightTrav      *lightTrav= static_cast&lt;CLightTrav*&gt;(<a class="code" href="classNL3D_1_1CTransform.html#n2">_LightObs</a>-&gt;Trav);
00405                                 <font class="comment">// Lighting: must reinsert the object from the quadGrid.</font>
00406                                 <font class="comment">// NB: works if _LightedModelIt==NULL. result is that _LightedModelIt= NULL.</font>
00407                                 <a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>= lightTrav-&gt;LightingManager.eraseStaticLightedModel(<a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>);
00408                                 <font class="comment">// insert in the quadgrid.</font>
00409                                 <a class="code" href="classNL3D_1_1CTransform.html#z852_3">_LightedModelIt</a>= lightTrav-&gt;LightingManager.insertStaticLightedModel(<font class="keyword">this</font>);
00410                         }
00411 
00412                         <font class="comment">// Now this model won't be tested for validation nor for worldMatrix update. End!!</font>
00413                         <a class="code" href="classNL3D_1_1CTransform.html#o4">_FreezeHRCState</a> = CTransform::FreezeHRCStateEnabled;
00414                 }
00415         }
00416 }
00417 
00418 
00419 <font class="comment">// ***************************************************************************</font>
<a name="l00420"></a><a class="code" href="classNL3D_1_1CTransform.html#a23">00420</a> <font class="keywordtype">void</font>    CTransform::getAABBox(<a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;bbox)<font class="keyword"> const</font>
00421 <font class="keyword"></font>{
00422         bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_0">setCenter</a>(CVector::Null);
00423         bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_1">setHalfSize</a>(CVector::Null);
00424 }
00425 
00426 
00427 <font class="comment">// ***************************************************************************</font>
<a name="l00428"></a><a class="code" href="classNL3D_1_1CTransform.html#z848_0">00428</a> <font class="keywordtype">void</font>    CTransform::setLoadBalancingGroup(<font class="keyword">const</font> std::string &amp;group)
00429 {
00430         <font class="comment">// get the LoadBalancing observer</font>
00431         IBaseLoadBalancingObs   *obs= (IBaseLoadBalancingObs*)<a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<a class="code" href="namespaceNL3D.html#a93">LoadBalancingTravId</a>);
00432         <a class="code" href="debug_8h.html#a6">nlassert</a>(obs);
00433 
00434         <font class="comment">// Get the traversal.</font>
00435         CLoadBalancingTrav      *trav= (CLoadBalancingTrav*)obs-&gt;Trav;
00436         <a class="code" href="debug_8h.html#a6">nlassert</a>(trav);
00437         <font class="comment">// get the group from trav (create if needed), and set it.</font>
00438         obs-&gt;LoadBalancingGroup= trav-&gt;getOrCreateGroup(group);
00439 }
00440 
00441 
00442 <font class="comment">// ***************************************************************************</font>
<a name="l00443"></a><a class="code" href="classNL3D_1_1CTransform.html#z848_1">00443</a> <font class="keyword">const</font> std::string &amp;CTransform::getLoadBalancingGroup()<font class="keyword"> const</font>
00444 <font class="keyword"></font>{
00445         <font class="comment">// get the LoadBalancing observer</font>
00446         IBaseLoadBalancingObs   *obs= (IBaseLoadBalancingObs*)<a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<a class="code" href="namespaceNL3D.html#a93">LoadBalancingTravId</a>);
00447         <a class="code" href="debug_8h.html#a6">nlassert</a>(obs);
00448 
00449         <font class="comment">// get the group name</font>
00450         <font class="keywordflow">return</font> obs-&gt;LoadBalancingGroup-&gt;Name;
00451 }
00452 
00453 
00454 <font class="comment">// ***************************************************************************</font>
<a name="l00455"></a><a class="code" href="classNL3D_1_1CTransform.html#z850_0">00455</a> <font class="keywordtype">void</font>            CTransform::setMeanColor(CRGBA color)
00456 {
00457         <font class="comment">// if the color is different from prec</font>
00458         <font class="keywordflow">if</font>(color!=<a class="code" href="classNL3D_1_1CTransform.html#o8">_MeanColor</a>)
00459         {
00460                 <font class="comment">// change it.</font>
00461                 <a class="code" href="classNL3D_1_1CTransform.html#o8">_MeanColor</a>= color;
00462                 <font class="comment">// if skinned or sticked to a skeleton model.</font>
00463                 <font class="keywordflow">if</font>(_FatherSkeletonModel)
00464                 {
00465                         <font class="comment">// must dirt the vertex color of the lod skeleton because some object color has changed</font>
00466                         <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;dirtLodVertexColor();
00467                 }
00468         }
00469 }
00470 
00471 
00472 <font class="comment">// ***************************************************************************</font>
<a name="l00473"></a><a class="code" href="classNL3D_1_1CTransform.html#z853_0">00473</a> <font class="keywordtype">void</font>            CTransform::setIsLightable(<font class="keywordtype">bool</font> val)
00474 {
00475         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u8">IsLightable</a>, val);
00476         <font class="comment">// update IsFinalLightable</font>
00477         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u14">IsFinalLightable</a>, (<a class="code" href="classNL3D_1_1CTransform.html#z854_2">getStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u8">IsLightable</a>) &amp;&amp; <a class="code" href="classNL3D_1_1CTransform.html#z854_2">getStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u13">IsUserLightable</a>)) );
00478 }
00479 <font class="comment">// ***************************************************************************</font>
<a name="l00480"></a><a class="code" href="classNL3D_1_1CTransform.html#z847_2">00480</a> <font class="keywordtype">void</font>            CTransform::setUserLightable(<font class="keywordtype">bool</font> enable)
00481 {
00482         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u13">IsUserLightable</a>, enable);
00483         <font class="comment">// update IsFinalLightable</font>
00484         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u14">IsFinalLightable</a>, (<a class="code" href="classNL3D_1_1CTransform.html#z854_2">getStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u8">IsLightable</a>) &amp;&amp; <a class="code" href="classNL3D_1_1CTransform.html#z854_2">getStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u13">IsUserLightable</a>)) );
00485 }
00486 
00487 
00488 <font class="comment">// ***************************************************************************</font>
<a name="l00489"></a><a class="code" href="classNL3D_1_1CTransform.html#z853_1">00489</a> <font class="keywordtype">void</font>            CTransform::setIsRenderable(<font class="keywordtype">bool</font> val)
00490 {
00491         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u9">IsRenderable</a>, val);
00492 }
00493 
00494 <font class="comment">// ***************************************************************************</font>
<a name="l00495"></a><a class="code" href="classNL3D_1_1CTransform.html#z853_2">00495</a> <font class="keywordtype">void</font>            CTransform::setIsBigLightable(<font class="keywordtype">bool</font> val)
00496 {
00497         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u15">IsBigLightable</a>, val);
00498 }
00499 <font class="comment">// ***************************************************************************</font>
<a name="l00500"></a><a class="code" href="classNL3D_1_1CTransform.html#z853_3">00500</a> <font class="keywordtype">void</font>            CTransform::setIsSkeleton(<font class="keywordtype">bool</font> val)
00501 {
00502         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u18">IsSkeleton</a>, val);
00503 }
00504 
00505 <font class="comment">// ***************************************************************************</font>
<a name="l00506"></a><a class="code" href="classNL3D_1_1CTransform.html#z851_1">00506</a> <font class="keywordtype">void</font>            CTransform::setApplySkin(<font class="keywordtype">bool</font> state)
00507 {
00508         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u19">IsSkinned</a>, state);
00509 }
00510 
00511 <font class="comment">// ***************************************************************************</font>
<a name="l00512"></a><a class="code" href="classNL3D_1_1CTransform.html#z853_4">00512</a> <font class="keywordtype">void</font>            CTransform::setIsForceAnimDetail(<font class="keywordtype">bool</font> val)
00513 {
00514         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u21">IsForceAnimDetail</a>, val );
00515 
00516         <font class="comment">// Update flag, if we must be inserted in AnimDetail</font>
00517         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u6">IsAnimDetailable</a>, <a class="code" href="classNL3D_1_1CTransform.html#o1">_ChannelMixer</a> || <a class="code" href="classNL3D_1_1CTransform.html#z854_2">getStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u21">IsForceAnimDetail</a>) );
00518 
00519         <font class="comment">// If skinned, then must inform skeleton parent that it must recompute skin render/animDetail lists</font>
00520         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#z849_1">isSkinned</a>())
00521         {
00522                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>);
00523                 <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;dirtSkinRenderLists();
00524         }
00525 }
00526 <font class="comment">// ***************************************************************************</font>
<a name="l00527"></a><a class="code" href="classNL3D_1_1CTransform.html#z853_5">00527</a> <font class="keywordtype">void</font>            CTransform::setIsLoadbalancable(<font class="keywordtype">bool</font> val)
00528 {
00529         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u7">IsLoadBalancable</a>, val );
00530 }
00531 
00532 
00533 <font class="comment">// ***************************************************************************</font>
00534 <font class="comment">// ***************************************************************************</font>
00535 <font class="comment">// Observers.</font>
00536 <font class="comment">// ***************************************************************************</font>
00537 <font class="comment">// ***************************************************************************</font>
00538 
00539 
00540 <font class="comment">// ***************************************************************************</font>
<a name="l00541"></a><a class="code" href="classNL3D_1_1CTransformHrcObs.html#a1">00541</a> <font class="keywordtype">void</font>    CTransformHrcObs::update()
00542 {
00543         IBaseHrcObs::update();
00544 
00545         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>-&gt;TouchObs[CTransform::TransformDirty])
00546         {
00547                 <font class="comment">// update the local matrix.</font>
00548                 <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z459_0">LocalMatrix</a>= static_cast&lt;CTransform*&gt;(Model)-&gt;getMatrix();
00549                 IBaseHrcObs::LocalVis= static_cast&lt;CTransform*&gt;(Model)-&gt;Visibility;
00550                 <font class="comment">// update the date of the local matrix.</font>
00551                 <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z459_2">LocalDate</a>= static_cast&lt;CHrcTrav*&gt;(Trav)-&gt;CurrentDate;
00552 
00553                 <font class="comment">// The transform has been modified. Hence, it is no more frozen.</font>
00554                 <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m0">Frozen</a>= <font class="keyword">false</font>;
00555         }
00556 
00557 }
00558 
00559 
00560 <font class="comment">// ***************************************************************************</font>
<a name="l00561"></a><a class="code" href="classNL3D_1_1CTransformHrcObs.html#z855_0">00561</a> <font class="keywordtype">void</font>    CTransformHrcObs::updateWorld(IBaseHrcObs *caller)
00562 {
00563         <font class="keyword">const</font>   CMatrix         *pFatherWM;
00564         <font class="keywordtype">bool</font>                            visFather;
00565         CTransform                      *transModel= (CTransform*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
00566 
00567         <font class="comment">// If not root case, link to caller.</font>
00568         <font class="keywordflow">if</font>(caller)
00569         {
00570                 pFatherWM= &amp;(caller-&gt;WorldMatrix);
00571                 visFather= caller-&gt;WorldVis;
00572 
00573                 <font class="comment">// If father is not Frozen, so do I.</font>
00574                 <a class="code" href="classNL3D_1_1CTransformHrcObs.html#a0">CTransformHrcObs</a>        *hrcTransCaller= dynamic_cast&lt;CTransformHrcObs*&gt;(caller);
00575 
00576                 <font class="comment">// if caller is a CTransformHrcObs</font>
00577                 <font class="comment">//  and if it is not frozen (for any reason), disable us!</font>
00578 
00579                 <font class="keywordflow">if</font> (hrcTransCaller &amp;&amp; !hrcTransCaller-&gt;Frozen &amp;&amp; !hrcTransCaller-&gt;DontUnfreezeChildren)
00580                         <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m0">Frozen</a>= <font class="keyword">false</font>;
00581 
00582                 <font class="comment">// if caller is a CTransformHrcObs, may herit his _AncestorSkeletonModel</font>
00583                 <font class="comment">// if caller is ! a CTransformHrcObs, final result undefined.</font>
00584                 <font class="keywordflow">if</font> (hrcTransCaller &amp;&amp; hrcTransCaller-&gt;_AncestorSkeletonModel)
00585                         <font class="comment">// If my father has an _AncestorSkeletonModel, get it.</font>
00586                         <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a>= hrcTransCaller-&gt;_AncestorSkeletonModel;
00587                 <font class="keywordflow">else</font>
00588                         <font class="comment">// else I have an ancestor skel model if I am sticked/binded directly to a skeleton model.</font>
00589                         <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a>= transModel-&gt;_FatherSkeletonModel;
00590 
00591         }
00592         <font class="comment">// else, default!!</font>
00593         <font class="keywordflow">else</font>
00594         {
00595                 pFatherWM= &amp;(CMatrix::Identity);
00596                 visFather= <font class="keyword">true</font>;
00597 
00598                 <font class="comment">// at the root of the hierarchy, we have no parent, hence no FatherSkeletonModel nor _AncestorSkeletonModel.</font>
00599                 <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a>= NULL;
00600 
00601                 <font class="comment">// NB: Root is Frozen by essence :), so don't modify the frozen state here.</font>
00602         }
00603 
00604         <font class="comment">// Combine matrix</font>
00605         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IBaseHrcObs.html#z459_2">LocalDate</a>&gt;<a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_2">WorldDate</a> || (caller &amp;&amp; caller-&gt;WorldDate&gt;<a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_2">WorldDate</a>) )
00606         {
00607                 <font class="comment">// Must recompute the world matrix.  ONLY IF I AM NOT SKINNED/STICKED TO A SKELETON in the hierarchy!</font>
00608                 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a>==NULL )
00609                 {
00610                         <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_0">WorldMatrix</a>=  *pFatherWM * <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z459_0">LocalMatrix</a>;
00611                         <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_2">WorldDate</a>= static_cast&lt;CHrcTrav*&gt;(Trav)-&gt;CurrentDate;
00612 
00613                         <font class="comment">// Add the model to the moving object list</font>
00614                         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CTransformHrcObs.html#m0">Frozen</a>)
00615                                 static_cast&lt;CHrcTrav*&gt;(Trav)-&gt;_MovingObjects.push_back (<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>);
00616                 }
00617         }
00618 
00619         <font class="comment">// Update dynamic lighting.</font>
00620         <font class="comment">/*</font>
00621 <font class="comment">                If the model is not frozen in StaticLight, then must update lighting each frame.</font>
00622 <font class="comment">                Even if the object doesn't move, a new dynamic light may enter in its aera. Hence we must test</font>
00623 <font class="comment">                it in the light quadrid. StaticLight-ed Objects don't need it because they are inserted in a special quadgrid, </font>
00624 <font class="comment">                where dynamics lights touch all StaticLight-ed object to force their computing</font>
00625 <font class="comment"></font>
00626 <font class="comment">                NB: not done if _AncestorSkeletonModel!=NULL. no need because  in this case, </font>
00627 <font class="comment">                result is driven by the _LightContribution of the _AncestorSkeletonModel.</font>
00628 <font class="comment">        */</font>
00629         <font class="keywordflow">if</font>( !transModel-&gt;_LightContribution.FrozenStaticLightSetup &amp;&amp; <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a>==NULL )
00630         {
00631                 <font class="comment">// if the model is lightable reset lighting</font>
00632                 <font class="keywordflow">if</font>( transModel-&gt;isLightable() )
00633                         transModel-&gt;resetLighting();
00634         }
00635 
00636         <font class="comment">// Combine visibility.</font>
00637         <font class="keywordflow">switch</font>(LocalVis)
00638         {
00639                 <font class="keywordflow">case</font> CHrcTrav::Herit: <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_1">WorldVis</a>= visFather; <font class="keywordflow">break</font>;
00640                 <font class="keywordflow">case</font> CHrcTrav::Hide: <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_1">WorldVis</a>= <font class="keyword">false</font>; <font class="keywordflow">break</font>;
00641                 <font class="keywordflow">case</font> CHrcTrav::Show: <a class="code" href="classNL3D_1_1IBaseHrcObs.html#z460_1">WorldVis</a>= <font class="keyword">true</font>; <font class="keywordflow">break</font>;
00642                 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00643         }
00644 
00645 
00646         <font class="comment">// If I have an ancestor Skeleton Model, I must be binded in ClipTrav to the SonsOfAncestorSkeletonModelGroup</font>
00647         <a class="code" href="classNL3D_1_1CTransformHrcObs.html#c0">updateClipTravForAncestorSkeleton</a>();
00648 
00649 }
00650 
00651 
00652 <font class="comment">// ***************************************************************************</font>
<a name="l00653"></a><a class="code" href="classNL3D_1_1CTransformHrcObs.html#c0">00653</a> <font class="keywordtype">void</font>    CTransformHrcObs::updateClipTravForAncestorSkeleton()
00654 {
00655         CTransform                      *transModel= (CTransform*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
00656         CClipTrav                       *clipTrav= (CClipTrav*)transModel-&gt;_ClipObs-&gt;Trav;
00657 
00658         <font class="comment">// If I have an ancestor Skeleton Model, I must be binded in ClipTrav to the SonsOfAncestorSkeletonModelGroup</font>
00659         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a> &amp;&amp; !<a class="code" href="classNL3D_1_1CTransformHrcObs.html#m2">ClipLinkedInSonsOfAncestorSkeletonModelGroup</a>)
00660         {
00661                 <font class="comment">// ClipTrav is a graph, so must unlink from ALL olds models.</font>
00662                 IModel  *father= clipTrav-&gt;getFirstParent(transModel);
00663                 <font class="keywordflow">while</font>(father)
00664                 {
00665                         clipTrav-&gt;unlink(father, transModel);
00666                         father= clipTrav-&gt;getFirstParent(transModel);
00667                 }
00668 
00669                 <font class="comment">// And link to SonsOfAncestorSkeletonModelGroup.</font>
00670                 clipTrav-&gt;link(clipTrav-&gt;SonsOfAncestorSkeletonModelGroup, transModel);
00671 
00672                 <font class="comment">// update the flag.</font>
00673                 <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m2">ClipLinkedInSonsOfAncestorSkeletonModelGroup</a>= <font class="keyword">true</font>;
00674         }
00675 
00676 
00677         <font class="comment">// else I must be binded to the standard Root.</font>
00678         <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CTransformHrcObs.html#m3">_AncestorSkeletonModel</a> &amp;&amp; <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m2">ClipLinkedInSonsOfAncestorSkeletonModelGroup</a>)
00679         {
00680                 <font class="comment">// verify first I am really still linked to the SonsOfAncestorSkeletonModelGroup.</font>
00681                 <font class="comment">// This test is important, because link may have changed for any reason (portals, clipManager....).</font>
00682                 <font class="keywordflow">if</font>( clipTrav-&gt;getNumParents(transModel) == 1 &amp;&amp;
00683                         clipTrav-&gt;getFirstParent(transModel)==clipTrav-&gt;SonsOfAncestorSkeletonModelGroup )
00684                 {
00685                         <font class="comment">// yes, unlink from it.</font>
00686                         clipTrav-&gt;unlink(clipTrav-&gt;SonsOfAncestorSkeletonModelGroup, transModel);
00687                         <font class="comment">// and now, link to std root.</font>
00688                         clipTrav-&gt;link(clipTrav-&gt;getRoot(), transModel);
00689                 }
00690 
00691                 <font class="comment">// update the flag</font>
00692                 <a class="code" href="classNL3D_1_1CTransformHrcObs.html#m2">ClipLinkedInSonsOfAncestorSkeletonModelGroup</a>= <font class="keyword">false</font>;
00693         }
00694 }
00695 
00696 
00697 <font class="comment">// ***************************************************************************</font>
<a name="l00698"></a><a class="code" href="classNL3D_1_1CTransformHrcObs.html#z856_0">00698</a> <font class="keywordtype">void</font>    CTransformHrcObs::traverse(IObs *caller)
00699 {
00700         <font class="comment">// Recompute the matrix, according to caller matrix mode, and local matrix.</font>
00701         <a class="code" href="debug_8h.html#a6">nlassert</a>(!caller || dynamic_cast&lt;IBaseHrcObs*&gt;(caller));
00702         <a class="code" href="classNL3D_1_1CTransformHrcObs.html#z855_0">updateWorld</a>(static_cast&lt;IBaseHrcObs*&gt;(caller));
00703         <font class="comment">// DoIt the sons.</font>
00704         <a class="code" href="classNL3D_1_1IObs.html#z620_0">traverseSons</a>();
00705 }
00706 
00707 
00708 <font class="comment">// ***************************************************************************</font>
<a name="l00709"></a><a class="code" href="classNL3D_1_1CTransformClipObs.html#a2">00709</a> <font class="keywordtype">void</font>    CTransformClipObs::traverse(IObs *caller)
00710 {
00711         <a class="code" href="debug_8h.html#a6">nlassert</a>(!caller || dynamic_cast&lt;IBaseClipObs*&gt;(caller));
00712 
00713         CClipTrav               *clipTrav= safe_cast&lt;CClipTrav*&gt;(Trav);
00714         <a class="code" href="classNL3D_1_1IBaseClipObs.html#a0">IBaseClipObs</a>    *callerClipObs= static_cast&lt;IBaseClipObs*&gt;(caller);
00715         CTransform              *<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>= (CTransform*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
00716 
00717         <font class="keywordflow">if</font> ((<a class="code" href="classNL3D_1_1CTransformClipObs.html#m0">Date</a> == clipTrav-&gt;CurrentDate) &amp;&amp; <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a>)
00718                 <font class="keywordflow">return</font>;
00719         <a class="code" href="classNL3D_1_1CTransformClipObs.html#m0">Date</a> = clipTrav-&gt;CurrentDate;
00720 
00721         <font class="comment">// clip: update Visible flag.</font>
00722         <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a>= <font class="keyword">false</font>;
00723         <font class="comment">// if at least visible.</font>
00724         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>-&gt;WorldVis)
00725         {
00726                 <font class="comment">// If linked to a SkeletonModel anywhere in the hierarchy, don't clip, and use skeleton model clip result.</font>
00727                 <font class="comment">// This works because we are sons of a special node which is not in the clip traversal, and</font>
00728                 <font class="comment">// which is traversed at end of the traversal.</font>
00729                 <font class="keywordflow">if</font>( ((CTransformHrcObs*)<a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>)-&gt;_AncestorSkeletonModel!=NULL )
00730                 {
00731                         <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a>= ((CTransformHrcObs*)<a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>)-&gt;_AncestorSkeletonModel-&gt;isClipVisible();
00732                         <font class="comment">// Special test: if we are sticked to a skeletonModel, and if we are still visible, maybe we don't have to</font>
00733                         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> &amp;&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_FatherSkeletonModel)
00734                         {
00735                                 <font class="comment">// if our skeletonModel father is displayed with a Lod, maybe we are not to be displayed</font>
00736                                 <font class="keywordflow">if</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_FatherSkeletonModel-&gt;isDisplayedAsLodCharacter())
00737                                 {
00738                                         <font class="comment">// We are visible only if we where sticked to the skeleton with forceCLod==true.</font>
00739                                         <font class="comment">// This is also true if we are actually a skeletonModel</font>
00740                                         <font class="keywordflow">if</font>(!<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_ForceCLodSticked)
00741                                                 <font class="comment">// otherWise we are not visible. eg: this is the case of skins and some sticked object</font>
00742                                                 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a>= <font class="keyword">false</font>;
00743                                 }
00744                         }
00745                 }
00746                 <font class="comment">// else, clip.</font>
00747                 <font class="keywordflow">else</font>
00748                         <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a>= <a class="code" href="classNL3D_1_1CTransformClipObs.html#a1">clip</a>(callerClipObs);
00749         }
00750 
00751         <font class="comment">// if visible, add to list.</font>
00752         <font class="keywordflow">if</font>(Visible)
00753         {
00754                 <font class="comment">// add this observer to the visibility list.</font>
00755                 clipTrav-&gt;addVisibleObs(<font class="keyword">this</font>);
00756 
00757                 <font class="comment">// Has not an ancestor skeleton model?</font>
00758                 <font class="keywordflow">if</font>( ((CTransformHrcObs*)<a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>)-&gt;_AncestorSkeletonModel==NULL )
00759                 {
00760                         <font class="comment">// If needed, insert the model in the lighted list.</font>
00761                         <font class="comment">// don't insert if has an ancestorSkeletonModel, because in this case, result is driven by </font>
00762                         <font class="comment">// the _LightContribution of the _AncestorSkeletonModel.</font>
00763                         <font class="keywordflow">if</font>( <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;isLightable() )
00764                                 clipTrav-&gt;LightTrav-&gt;addLightedObs(<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_LightObs);
00765 
00766                         <font class="comment">// If needed, insert the model in the animDetail list.</font>
00767                         <font class="comment">// don't insert if has an ancestoreSkeletonModel, because in this case, this ancestore will </font>
00768                         <font class="comment">// animDetail through the hierarchy...</font>
00769                         <font class="keywordflow">if</font>( <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;isAnimDetailable() )
00770                                 clipTrav-&gt;AnimDetailTrav-&gt;addVisibleObs(safe_cast&lt;CTransformAnimDetailObs*&gt;(<a class="code" href="classNL3D_1_1IBaseClipObs.html#m2">AnimDetailObs</a>));
00771                 }
00772 
00773                 <font class="comment">// If needed, Add it to the loadBalancing trav</font>
00774                 <font class="keywordflow">if</font>( <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;isLoadBalancable() )
00775                         clipTrav-&gt;LoadBalancingTrav-&gt;addVisibleObs(<a class="code" href="classNL3D_1_1IBaseClipObs.html#m3">LoadBalancingObs</a>);
00776 
00777                 <font class="comment">// If needed, insert the model in the render list.</font>
00778                 <font class="keywordflow">if</font>( <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;isRenderable() )
00779                         clipTrav-&gt;RenderTrav-&gt;addRenderObs(<a class="code" href="classNL3D_1_1IBaseClipObs.html#m1">RenderObs</a>);
00780         }
00781 
00782         <font class="comment">// DoIt the sons.</font>
00783         <a class="code" href="classNL3D_1_1IObs.html#z620_0">traverseSons</a>();
00784 }
00785 
00786 
00787 
00788 <font class="comment">// ***************************************************************************</font>
<a name="l00789"></a><a class="code" href="classNL3D_1_1CTransformAnimDetailObs.html#a0">00789</a> <font class="keywordtype">void</font>    CTransformAnimDetailObs::updateWorldMatrixFromFather()
00790 {
00791         CTransform              *transModel= static_cast&lt;CTransform*&gt;(Model);
00792 
00793         <font class="comment">// If I have an ancestore Skeleton model</font>
00794         <font class="keywordflow">if</font>(transModel-&gt;_HrcObs-&gt;_AncestorSkeletonModel)
00795         {
00796                 <font class="comment">// then must first update my worldMatrix.</font>
00797                 transModel-&gt;updateWorldMatrixFromFather();
00798         }
00799 }
00800 
00801 <font class="comment">// ***************************************************************************</font>
<a name="l00802"></a><a class="code" href="classNL3D_1_1CTransformAnimDetailObs.html#a1">00802</a> <font class="keywordtype">void</font>    CTransformAnimDetailObs::traverseWithoutUpdateWorldMatrix(IObs *caller)
00803 {
00804         CTransform              *transModel= static_cast&lt;CTransform*&gt;(Model);
00805 
00806         <font class="comment">// AnimDetail behavior: animate only if not clipped.</font>
00807         <font class="comment">// NB: no need to test because of VisibilityList use.</font>
00808 
00809         <font class="comment">// test if the refptr is NULL or not (RefPtr).</font>
00810         CChannelMixer   *chanmix= transModel-&gt;_ChannelMixer;
00811         <font class="keywordflow">if</font>(chanmix)
00812         {
00813                 <font class="comment">// eval detail!!</font>
00814                 chanmix-&gt;eval(<font class="keyword">true</font>, static_cast&lt;CAnimDetailTrav*&gt;(Trav)-&gt;CurrentDate);
00815         }
00816 }
00817 
00818 <font class="comment">// ***************************************************************************</font>
<a name="l00819"></a><a class="code" href="classNL3D_1_1CTransformAnimDetailObs.html#a2">00819</a> <font class="keywordtype">void</font>    CTransformAnimDetailObs::traverse(IObs *caller)
00820 {
00821         <font class="comment">// First, test if I must update my HrcObs worldMatrix because of the ancestorSkeleton scheme</font>
00822         <a class="code" href="classNL3D_1_1CTransformAnimDetailObs.html#a0">updateWorldMatrixFromFather</a>();
00823 
00824         <font class="comment">// eval channelMixer.</font>
00825         <a class="code" href="classNL3D_1_1CTransformAnimDetailObs.html#a1">traverseWithoutUpdateWorldMatrix</a>(caller);
00826 
00827         <font class="comment">// NB: if want to add something, do it in traverseWithoutUpdateWorldMatrix(), because</font>
00828         <font class="comment">// CSkeletonModel doesn't call CTransformAnimDetailObs::traverse()</font>
00829 
00830         <font class="comment">// no need to traverseSons. No graph here.</font>
00831 }
00832 
00833 
00834 <font class="comment">// ***************************************************************************</font>
00835 <font class="comment">// ***************************************************************************</font>
00836 <font class="comment">// Lighting.</font>
00837 <font class="comment">// ***************************************************************************</font>
00838 <font class="comment">// ***************************************************************************</font>
00839 
00840 
00841 <font class="comment">// ***************************************************************************</font>
<a name="l00842"></a><a class="code" href="classNL3D_1_1CTransform.html#z847_0">00842</a> <font class="keywordtype">void</font>            CTransform::resetLighting()
00843 {
00844         <font class="comment">// if the model is already isNeedUpdateLighting, his light setup is reseted.</font>
00845         <font class="comment">// so no need to reset again</font>
00846         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#z852_0">isNeedUpdateLighting</a>())
00847                 <font class="keywordflow">return</font>;
00848 
00849 
00850         <font class="comment">// For all light not in FrozenStaticLightSetup, remove me from their list</font>
00851         uint    startLight= 0;
00852         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.FrozenStaticLightSetup)
00853         {
00854                 startLight= <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.NumFrozenStaticLight;
00855         }
00856 
00857         <font class="comment">// for all light in the list, remove me from their list.</font>
00858         <font class="keywordflow">for</font>(uint i=startLight; i&lt;<a class="code" href="light__contribution_8h.html#a0">NL3D_MAX_LIGHT_CONTRIBUTION</a>; i++)
00859         {
00860                 CPointLight             *pl= <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.PointLight[i];
00861                 <font class="comment">// if end of list, break.</font>
00862                 <font class="keywordflow">if</font>(!pl)
00863                         <font class="keywordflow">break</font>;
00864                 <font class="keywordflow">else</font>
00865                 {
00866                         <font class="comment">// remove me from this light.</font>
00867                         pl-&gt;removeLightedModel(<a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.TransformIterator[i]);
00868                 }
00869         }
00870         <font class="comment">// empty the list.</font>
00871         <font class="keywordflow">if</font>(startLight&lt;<a class="code" href="light__contribution_8h.html#a0">NL3D_MAX_LIGHT_CONTRIBUTION</a>)
00872                 <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.PointLight[startLight]= NULL;
00873 
00874 
00875         <font class="comment">// the model needs to update his lighting.</font>
00876         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u16">IsNeedUpdateLighting</a>, <font class="keyword">true</font>);
00877         
00878 }
00879 
00880 
00881 <font class="comment">// ***************************************************************************</font>
<a name="l00882"></a><a class="code" href="classNL3D_1_1CTransform.html#z847_4">00882</a> <font class="keywordtype">void</font>                    CTransform::freezeStaticLightSetup(CPointLight *pointLight[<a class="code" href="light__contribution_8h.html#a0">NL3D_MAX_LIGHT_CONTRIBUTION</a>], 
00883                 uint numPointLights, uint8 sunContribution, CPointLight *frozenAmbientlight)
00884 {
00885         <a class="code" href="debug_8h.html#a6">nlassert</a>(numPointLights &lt;= <a class="code" href="light__contribution_8h.html#a0">NL3D_MAX_LIGHT_CONTRIBUTION</a>);
00886 
00887         <font class="comment">// resetLighting() first.</font>
00888         <a class="code" href="classNL3D_1_1CTransform.html#z847_0">resetLighting</a>();
00889 
00890         <font class="comment">// Enable StaticLightSetup.</font>
00891         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.FrozenStaticLightSetup= <font class="keyword">true</font>;
00892         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.NumFrozenStaticLight= numPointLights;
00893         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.SunContribution= sunContribution;
00894         <font class="comment">// setup the FrozenAmbientLight</font>
00895         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.FrozenAmbientLight= frozenAmbientlight;
00896         <font class="comment">// Setup other pointLights</font>
00897         uint i;
00898         <font class="keywordflow">for</font>(i=0;i&lt;numPointLights;i++)
00899         {
00900                 <font class="comment">// set the light</font>
00901                 <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.PointLight[i]= pointLight[i];
00902                 <font class="comment">// Enable at max.</font>
00903                 <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.Factor[i]= 255;
00904                 <font class="comment">// Compute static AttFactor Later because don't have WorlPosition of the model here!!</font>
00905                 <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u17">IsNeedUpdateFrozenStaticLightSetup</a>, <font class="keyword">true</font>);
00906 
00907                 <font class="comment">// Do NOT set the iterator, because it is a staticLight.</font>
00908         }
00909         <font class="comment">// End the list</font>
00910         <font class="keywordflow">if</font>(i&lt;<a class="code" href="light__contribution_8h.html#a0">NL3D_MAX_LIGHT_CONTRIBUTION</a>)
00911                 <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.PointLight[i]= NULL;
00912 }
00913 
00914 <font class="comment">// ***************************************************************************</font>
<a name="l00915"></a><a class="code" href="classNL3D_1_1CTransform.html#z847_5">00915</a> <font class="keywordtype">void</font>                    CTransform::unfreezeStaticLightSetup()
00916 {
00917         <font class="comment">// resetLighting() first.</font>
00918         <a class="code" href="classNL3D_1_1CTransform.html#z847_0">resetLighting</a>();
00919 
00920         <font class="comment">// Disable StaticLightSetup.</font>
00921         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.FrozenStaticLightSetup= <font class="keyword">false</font>;
00922         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.NumFrozenStaticLight= 0;
00923         <font class="comment">// End the list</font>
00924         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.PointLight[0]= NULL;
00925         <font class="comment">// No more FrozenAmbientLight</font>
00926         <a class="code" href="classNL3D_1_1CTransform.html#z852_2">_LightContribution</a>.FrozenAmbientLight= NULL;
00927 
00928         <font class="comment">// Don't need to update StaticLightSetup since no more exist.</font>
00929         <a class="code" href="classNL3D_1_1CTransform.html#z854_1">setStateFlag</a>(<a class="code" href="classNL3D_1_1CTransform.html#z854_0u17">IsNeedUpdateFrozenStaticLightSetup</a>, <font class="keyword">false</font>);
00930 }
00931 
00932 
00933 <font class="comment">// ***************************************************************************</font>
<a name="l00934"></a><a class="code" href="classNL3D_1_1CTransformLightObs.html#a0">00934</a> <font class="keywordtype">void</font>    CTransformLightObs::traverse(IObs *caller)
00935 {
00936         CTransform              *<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>= (CTransform*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
00937 
00938         <font class="comment">// if the model do not need to update his lighting, just skip.</font>
00939         <font class="keywordflow">if</font>(!<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;isNeedUpdateLighting())
00940                 <font class="keywordflow">return</font>;
00941 
00942 
00943         <font class="comment">// If a freezeStaticLightSetup() has been called on this model recently.</font>
00944         <font class="keywordflow">if</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;isNeedUpdateFrozenStaticLightSetup())
00945         {
00946                 <font class="comment">// Now, the correct matrix is computed.</font>
00947                 <font class="comment">// get the untransformed bbox from the model.</font>
00948                 CAABBox         bbox;
00949                 <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;getAABBox(bbox);
00950                 <font class="comment">// get transformed center pos of bbox</font>
00951                 CVector worldModelPos= <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;getWorldMatrix() * bbox.getCenter();
00952 
00953                 <font class="comment">// So we can compute AttFactor for each static light influencing this static object</font>
00954                 uint    numPointLights= <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_LightContribution.NumFrozenStaticLight;
00955                 <font class="keywordflow">for</font>(uint i=0;i&lt;numPointLights;i++)
00956                 {
00957                         <font class="keyword">const</font> CPointLight       *pl= <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_LightContribution.PointLight[i];
00958                         <font class="comment">// don't worry about the precision of floor, because of *255.</font>
00959                         <font class="keywordtype">float</font>   distToModel= (pl-&gt;getPosition() - worldModelPos).norm();
00960                         sint    attFactor= <a class="code" href="namespaceNL3D.html#a362">OptFastFloor</a>( 255 * pl-&gt;computeLinearAttenuation(worldModelPos, distToModel) );
00961                         <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_LightContribution.AttFactor[i]= (uint8)attFactor;
00962                 }
00963 
00964                 <font class="comment">// clean.</font>
00965                 <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;setStateFlag(CTransform::IsNeedUpdateFrozenStaticLightSetup, <font class="keyword">false</font>);
00966         }
00967 
00968 
00969         <font class="comment">// see CTransformClipObs::clip(), here I am Lightable(), and I have no _AncestorSkeletonModel</font>
00970         <font class="comment">// So I am sure that I really need to recompute my ModelLightContributions.</font>
00971         ((CLightTrav*)<a class="code" href="classNL3D_1_1IObs.html#m1">Trav</a>)-&gt;LightingManager.computeModelLightContributions(<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>,
00972                 <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_LightContribution, <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;_LogicInfo);
00973 
00974         <font class="comment">// done!</font>
00975         <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>-&gt;setStateFlag(CTransform::IsNeedUpdateLighting, <font class="keyword">false</font>);
00976 }
00977 
00978 
00979 
00980 }
</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=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>