aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/object_viewer_cpp-source.html
blob: 9ec3a0afff9f45573d111cdb99f372fd487c90ae (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
<!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=><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.2 on Mon Jul 2 22:01:38 2001 -->
<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>object_viewer.cpp</h1><a href="object_viewer_cpp.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="plugin_max_nel_export_std_afx_h.html">std_afx.h</a>"</font>
00027 
<a name="l00028"></a><a class="code" href="object_viewer_cpp.html#a0">00028</a> <font class="preprocessor">#define OBJECT_VIEWER_EXPORT __declspec( dllexport ) 
</font>00029 <font class="preprocessor"></font>
00030 <font class="preprocessor">#include "<a class="code" href="object_viewer_h.html">object_viewer.h</a>"</font>
00031 <font class="preprocessor">#include &lt;<a class="code" href="nelu_h.html">3d/nelu.h</a>&gt;</font>
00032 <font class="preprocessor">#include &lt;<a class="code" href="mesh_h.html">3d/mesh.h</a>&gt;</font>
00033 <font class="preprocessor">#include &lt;<a class="code" href="transform_shape_h.html">3d/transform_shape.h</a>&gt;</font>
00034 <font class="preprocessor">#include &lt;<a class="code" href="mesh_instance_h.html">3d/mesh_instance.h</a>&gt;</font>
00035 <font class="preprocessor">#include &lt;<a class="code" href="skeleton_model_h.html">3d/skeleton_model.h</a>&gt;</font>
00036 <font class="preprocessor">#include &lt;<a class="code" href="file_h.html">nel/misc/file.h</a>&gt;</font>
00037 <font class="preprocessor">#include &lt;<a class="code" href="path_h.html">nel/misc/path.h</a>&gt;</font>
00038 <font class="preprocessor">#include &lt;<a class="code" href="time_nl_h.html">nel/misc/time_nl.h</a>&gt;</font>
00039 
00040 <font class="preprocessor">#include "<a class="code" href="editable_range_h.html">editable_range.h</a>"</font>
00041 <font class="preprocessor">#include "<a class="code" href="located_properties_h.html">located_properties.h</a>"</font>
00042 <font class="preprocessor">#include "<a class="code" href="color_button_h.html">color_button.h</a>"</font>
00043 
00044 <font class="preprocessor">#ifdef _DEBUG
</font>00045 <font class="preprocessor"></font><font class="preprocessor">#define new DEBUG_NEW
</font>00046 <font class="preprocessor"></font><font class="preprocessor">#undef THIS_FILE
</font>00047 <font class="preprocessor"></font><font class="keyword">static</font> <font class="keywordtype">char</font> THIS_FILE[] = __FILE__;
00048 <font class="preprocessor">#endif
</font>00049 <font class="preprocessor"></font>
00050 <font class="keyword">using</font> <font class="keyword">namespace</font> NL3D;
00051 <font class="keyword">using</font> <font class="keyword">namespace</font> NLMISC;
00052 
00053 <font class="comment">//</font>
00054 <font class="comment">//      Note!</font>
00055 <font class="comment">//</font>
00056 <font class="comment">//              If this DLL is dynamically linked against the MFC</font>
00057 <font class="comment">//              DLLs, any functions exported from this DLL which</font>
00058 <font class="comment">//              call into MFC must have the AFX_MANAGE_STATE macro</font>
00059 <font class="comment">//              added at the very beginning of the function.</font>
00060 <font class="comment">//</font>
00061 <font class="comment">//              For example:</font>
00062 <font class="comment">//</font>
00063 <font class="comment">//              extern "C" BOOL PASCAL EXPORT ExportedFunction()</font>
00064 <font class="comment">//              {</font>
00065 <font class="comment">//                      AFX_MANAGE_STATE(AfxGetStaticModuleState());</font>
00066 <font class="comment">//                      // normal function body here</font>
00067 <font class="comment">//              }</font>
00068 <font class="comment">//</font>
00069 <font class="comment">//              It is very important that this macro appear in each</font>
00070 <font class="comment">//              function, prior to any calls into MFC.  This means that</font>
00071 <font class="comment">//              it must appear as the first statement within the </font>
00072 <font class="comment">//              function, even before any object variable declarations</font>
00073 <font class="comment">//              as their constructors may generate calls into the MFC</font>
00074 <font class="comment">//              DLL.</font>
00075 <font class="comment">//</font>
00076 <font class="comment">//              Please see MFC Technical Notes 33 and 58 for additional</font>
00077 <font class="comment">//              details.</font>
00078 <font class="comment">//</font>
00079 
00081 <font class="comment">// CObject_viewerApp</font>
00082 
00083 <a class="code" href="ViewColumn_cpp.html#a1">BEGIN_MESSAGE_MAP</a>(<a class="code" href="class_CObject_viewerApp.html">CObject_viewerApp</a>, <a class="code" href="class_CWinApp.html">CWinApp</a>)
00084         <font class="comment">//{{AFX_MSG_MAP(CObject_viewerApp)</font>
00085                 <font class="comment">// NOTE - the ClassWizard will add and remove mapping macros here.</font>
00086                 <font class="comment">//    DO NOT EDIT what you see in these blocks of generated code!</font>
00087         <font class="comment">//}}AFX_MSG_MAP</font>
00088 END_MESSAGE_MAP()
00089 
00091 <font class="comment">// CObject_viewerApp construction</font>
00092 
00093 <a class="code" href="class_CObject_viewerApp.html#a0">CObject_viewerApp::CObject_viewerApp</a>()<font class="keyword">
</font>00094 <font class="keyword"></font>{
00095         <font class="comment">// TODO: add construction code here,</font>
00096         <font class="comment">// Place all significant initialization in InitInstance</font>
00097 }
00098 
00100 <font class="comment">// The one and only CObject_viewerApp object</font>
00101 
00102 <a class="code" href="class_CObject_viewerApp.html">CObject_viewerApp</a> theApp;
00103 
00104 <font class="comment">// ***************************************************************************</font>
00105 
<a name="l00106"></a><a class="code" href="class_CObjectViewer.html#a0">00106</a> <a class="code" href="class_CObjectViewer.html#a0">CObjectViewer::CObjectViewer</a> ()<font class="keyword">
</font>00107 <font class="keyword"></font>{
00108         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00109         _SlotDlg=NULL;
00110         _AnimationSetDlg=NULL;
00111         _AnimationDlg=NULL;
00112         _SceneDlg=NULL;
00113         _ParticleDlg = NULL ;
00114 
00115         <font class="comment">// Setup animation set</font>
00116         _ChannelMixer.<a class="code" href="class_NL3D__CChannelMixer.html#a1">setAnimationSet</a> (&amp;_AnimationSet);
00117 
00118         <font class="comment">// Hotspot color</font>
00119         _HotSpotColor.R=255;
00120         _HotSpotColor.G=255;
00121         _HotSpotColor.B=0;
00122         _HotSpotColor.A=255;
00123 
00124         <font class="comment">// Hotspot size</font>
00125         _HotSpotSize=10.f;
00126 }
00127 
00128 <font class="comment">// ***************************************************************************</font>
00129 
<a name="l00130"></a><a class="code" href="class_CObjectViewer.html#a1">00130</a> <a class="code" href="class_CObjectViewer.html#a1">CObjectViewer::~CObjectViewer</a> ()<font class="keyword">
</font>00131 <font class="keyword"></font>{
00132         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00133         <font class="keywordflow">if</font> (_SlotDlg)   
00134                 <font class="keyword">delete</font> _SlotDlg;
00135         <font class="keywordflow">if</font> (_AnimationSetDlg)
00136                 <font class="keyword">delete</font> _AnimationSetDlg;
00137         <font class="keywordflow">if</font> (_AnimationDlg)
00138                 <font class="keyword">delete</font> _AnimationDlg;
00139         <font class="keywordflow">if</font> (_SceneDlg)
00140                 <font class="keyword">delete</font> _SceneDlg;
00141         <font class="keywordflow">if</font> (_ParticleDlg)
00142                 <font class="keyword">delete</font> _ParticleDlg ;
00143 }
00144 
00145 <font class="comment">// ***************************************************************************</font>
00146 
<a name="l00147"></a><a class="code" href="class_CObjectViewer.html#a2">00147</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a2">CObjectViewer::initUI</a> ()<font class="keyword">
</font>00148 <font class="keyword"></font>{
00149         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00150 
00151         <font class="comment">// The viewport</font>
00152         CViewport viewport;
00153 
00154         <font class="comment">// Init NELU</font>
00155         <a class="code" href="nel_3dsmax_shared_cpp.html#a2">CNELU::init</a> (640, 480, viewport);
00156 
00157         <font class="comment">// Create a cwnd</font>
00158         <a class="code" href="class_CWnd.html">CWnd</a> driverWnd;
00159         driverWnd.Attach((HWND)CNELU::Driver-&gt;getDisplay());
00160         <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (&amp;driverWnd, REGKEY_OBJ_VIEW_OPENGL_WND, <font class="keyword">true</font>);
00161 
00162         <font class="comment">// Camera</font>
00163         CFrustum frustrum;
00164         frustrum.initPerspective( 75.f*(<font class="keywordtype">float</font>)Pi/180.f, 1.33f, 0.1f, 1000.f);
00165         CNELU::Camera-&gt;setFrustum (frustrum);
00166                 
00167 
00168         <font class="comment">// Hide the main window</font>
00169         <font class="comment">//driverWnd.ShowWindow (SW_HIDE);</font>
00170 
00171         <font class="comment">// Create animation set dialog</font>
00172         _AnimationDlg=<font class="keyword">new</font> CAnimationDlg (<font class="keyword">this</font>, &amp;driverWnd);
00173         _AnimationDlg-&gt;Create (IDD_ANIMATION);
00174         <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_AnimationDlg, REGKEY_OBJ_VIEW_ANIMATION_DLG, <font class="keyword">false</font>);
00175 
00176         <font class="comment">// Create animation set dialog</font>
00177         _AnimationSetDlg=<font class="keyword">new</font> <a class="code" href="class_CObjectViewer.html#l1">CAnimationSetDlg</a> (<font class="keyword">this</font>, &amp;driverWnd);
00178         _AnimationSetDlg-&gt;Create (IDD_ANIMATION_SET);
00179         <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_AnimationSetDlg, REGKEY_OBJ_VIEW_ANIMATION_SET_DLG, <font class="keyword">false</font>);
00180 
00181         <font class="comment">// Create the main dialog</font>
00182         _SlotDlg=<font class="keyword">new</font> CMainDlg (<font class="keyword">this</font>, &amp;driverWnd);
00183         _SlotDlg-&gt;<a class="code" href="class_CMainDlg.html#a1">init</a> (&amp;_AnimationSet);
00184         _SlotDlg-&gt;Create (IDD_MAIN_DLG);
00185         <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_SlotDlg, REGKEY_OBJ_VIEW_SLOT_DLG, <font class="keyword">false</font>);
00186 
00187         <font class="comment">// Create animation set dialog</font>
00188         _SceneDlg=<font class="keyword">new</font> <a class="code" href="class_CObjectViewer.html#l0">CSceneDlg</a> (<font class="keyword">this</font>, &amp;driverWnd);
00189         _SceneDlg-&gt;Create (IDD_SCENE);
00190         _SceneDlg-&gt;ShowWindow (TRUE);
00191         <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_SceneDlg, REGKEY_OBJ_VIEW_SCENE_DLG, <font class="keyword">false</font>);
00192 
00193         <font class="comment">// Create particle dialog</font>
00194         _ParticleDlg=<font class="keyword">new</font> CParticleDlg (&amp;driverWnd, _SceneDlg);
00195         _ParticleDlg-&gt;Create (IDD_PARTICLE);
00196         <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_ParticleDlg, REGKEY_OBJ_PARTICLE_DLG, <font class="keyword">false</font>);  
00197 
00198 
00199         <font class="comment">// Show the windows</font>
00200         <font class="comment">//driverWnd.ShowWindow (SW_SHOW);</font>
00201 
00202         <font class="comment">// Set current frame</font>
00203         <a class="code" href="class_CObjectViewer.html#a18">setAnimTime</a> (0.f, 100.f);
00204 
00205         <font class="comment">// Register this as listener</font>
00206         CNELU::EventServer.addListener (EventDestroyWindowId, <font class="keyword">this</font>);
00207 
00208         <font class="comment">// Add mouse listener to event server</font>
00209         _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a16">addToServer</a>(CNELU::EventServer);
00210                 
00211         <font class="comment">// Detach the hwnd</font>
00212         driverWnd.Detach ();
00213 
00214         CNELU::Driver-&gt;activate ();
00215 }
00216 
00217 <font class="comment">// ***************************************************************************</font>
00218 
<a name="l00219"></a><a class="code" href="class_CObjectViewer.html#a13">00219</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a13">CObjectViewer::operator ()</a>(<font class="keyword">const</font> CEvent&amp; event)<font class="keyword">
</font>00220 <font class="keyword"></font>{
00221         <font class="comment">// Destro window ?</font>
00222         <font class="keywordflow">if</font> (event==EventDestroyWindowId)
00223         {
00224         }
00225 }
00226 
00227 <font class="comment">// ***************************************************************************</font>
00228 
<a name="l00229"></a><a class="code" href="class_CObjectViewer.html#a3">00229</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a3">CObjectViewer::go</a> ()<font class="keyword">
</font>00230 <font class="keyword"></font>{
00231         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00232 
00233         <font class="keywordflow">do</font>
00234         {
00235                 CNELU::Driver-&gt;activate ();
00236 
00237                 <font class="comment">// Handle animation</font>
00238                 _AnimationDlg-&gt;<a class="code" href="class_CAnimationDlg.html#a1">handle</a> ();
00239 
00240                 <font class="comment">// Update the playlist</font>
00241                 _SlotDlg-&gt;<a class="code" href="class_CMainDlg.html#a3">getSlot</a> ();
00242 
00243                 <font class="comment">// Setup the channel mixer</font>
00244                 _SlotDlg-&gt;Playlist.setupMixer (_ChannelMixer, _AnimationDlg-&gt;<a class="code" href="class_CAnimationDlg.html#a4">getTime</a>());
00245 
00246                 <font class="comment">// Animate the automatic animation in the scene</font>
00247                 CNELU::Scene.animate( NLMISC::CTime::ticksToSecond( NLMISC::CTime::getPerformanceTime() ) );
00248 
00249                 <font class="comment">// Eval channel mixer for transform</font>
00250                 _ChannelMixer.<a class="code" href="class_NL3D__CChannelMixer.html#a3">eval</a> (<font class="keyword">false</font>);
00251 
00252                 <font class="comment">// Mouse listener</font>
00253                 _SceneDlg-&gt;UpdateData();
00254                 
00255                 
00256 
00257                 <font class="comment">// Clear the buffers</font>
00258 <font class="comment">//              CNELU::clearBuffers(CRGBA(120,120,120));</font>
00259 
00260                 CNELU::clearBuffers(CRGBA(0,0,0));
00261 
00262                 <font class="comment">// Draw the scene</font>
00263                 CNELU::Scene.render();
00264 
00265                 <font class="comment">// Draw the hotSpot</font>
00266                 <font class="keywordflow">if</font> (_SceneDlg-&gt;ObjectMode)
00267                 {
00268                         <font class="keywordtype">float</font> radius=_HotSpotSize/2.f;
00269                         CNELU::Driver-&gt;setupModelMatrix (CMatrix::Identity);
00270                         CDRU::drawLine (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (radius, 0, 0), _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (-radius, 0, 0), _HotSpotColor, *CNELU::Driver);
00271                         CDRU::drawLine (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, radius, 0), _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, -radius, 0), _HotSpotColor, *CNELU::Driver);
00272                         CDRU::drawLine (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, 0, radius), _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, 0, -radius), _HotSpotColor, *CNELU::Driver);
00273                 }
00274 
00275                 <font class="comment">// Swap the buffers</font>
00276                 CNELU::swapBuffers();
00277 
00278 
00279                 <font class="keywordflow">if</font> (_SceneDlg-&gt;ObjectMode)
00280                         _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a6">setMouseMode</a> (CEvent3dMouseListener::edit3d);
00281                 <font class="keywordflow">else</font>
00282                 {
00283                         _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a6">setMouseMode</a> (CEvent3dMouseListener::firstPerson);
00284                         _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a12">setSpeed</a> (_SceneDlg-&gt;MoveSpeed);
00285                 }
00286 
00287 
00288                 <font class="comment">// Pump message from the server</font>
00289                 CNELU::EventServer.pump();
00290 
00291                 <font class="keywordflow">if</font> (!_SceneDlg-&gt;MoveElement)
00292                 {
00293                         <font class="comment">// New matrix from camera</font>
00294                         CNELU::Camera-&gt;setTransformMode (ITransformable::DirectMatrix);
00295                         CNELU::Camera-&gt;setMatrix (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a13">getViewMatrix</a>());
00296                 }
00297                 <font class="keywordflow">else</font>
00298                 {
00299                         <font class="comment">// for now we apply a transform on the selected object in the particle system                   </font>
00300                         _ParticleDlg-&gt;<a class="code" href="class_CParticleDlg.html#a8">moveElement</a>(_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a14">getModelMatrix</a>()) ;            
00301                 }
00302 
00303                 <font class="comment">// Pump others message for the windows</font>
00304                 MSG     msg;
00305                 <font class="keywordflow">while</font> ( PeekMessage(&amp;msg, NULL,0,0,PM_REMOVE) )
00306                 {
00307                         TranslateMessage(&amp;msg);
00308                         DispatchMessage(&amp;msg);
00309                 }
00310         }
00311         <font class="keywordflow">while</font> (!CNELU::AsyncListener.isKeyPushed(KeyESCAPE)&amp;&amp;CNELU::Driver-&gt;isActive());
00312 }
00313 
00314 <font class="comment">// ***************************************************************************</font>
00315 
<a name="l00316"></a><a class="code" href="class_CObjectViewer.html#a4">00316</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a4">CObjectViewer::releaseUI</a> ()<font class="keyword">
</font>00317 <font class="keyword"></font>{
00318         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00319 
00320         <font class="keywordflow">if</font> (CNELU::Driver-&gt;isActive())
00321         {
00322                 <font class="comment">// register window position</font>
00323                 <font class="keywordflow">if</font> (CNELU::Driver-&gt;getDisplay())
00324                 {
00325                         <a class="code" href="class_CWnd.html">CWnd</a> driverWnd;
00326                         driverWnd.Attach((HWND)CNELU::Driver-&gt;getDisplay());
00327                         <a class="code" href="object_viewer_cpp.html#a2">setRegisterWindowState</a> (&amp;driverWnd, REGKEY_OBJ_VIEW_OPENGL_WND);
00328                         driverWnd.Detach ();
00329                 }
00330         }
00331 
00332         <font class="comment">// Release the emitter from the server</font>
00333         _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a17">removeFromServer</a> (CNELU::EventServer);
00334 
00335         <font class="comment">// Remove this as listener</font>
00336         CNELU::EventServer.removeListener (EventDestroyWindowId, <font class="keyword">this</font>);
00337 
00338         <font class="comment">// exit</font>
00339         CNELU::release();
00340 }
00341 
00342 <font class="comment">// ***************************************************************************</font>
00343 
<a name="l00344"></a><a class="code" href="object_viewer_cpp.html#a2">00344</a> <font class="keywordtype">void</font> <a class="code" href="object_viewer_cpp.html#a2">setRegisterWindowState</a> (<font class="keyword">const</font> <a class="code" href="class_CWnd.html">CWnd</a> *pWnd, <font class="keyword">const</font> <font class="keywordtype">char</font>* keyName)<font class="keyword">
</font>00345 <font class="keyword"></font>{
00346         HKEY hKey;
00347         <font class="keywordflow">if</font> (RegCreateKey(HKEY_CURRENT_USER, keyName, &amp;hKey)==ERROR_SUCCESS)
00348         {
00349                 RECT rect;
00350                 pWnd-&gt;GetWindowRect (&amp;rect);
00351                 RegSetValueEx(hKey, <font class="stringliteral">"Left"</font>, 0, REG_DWORD, (LPBYTE)&amp;rect.left, 4);
00352                 RegSetValueEx(hKey, <font class="stringliteral">"Right"</font>, 0, REG_DWORD, (LPBYTE)&amp;rect.right, 4);
00353                 RegSetValueEx(hKey, <font class="stringliteral">"Top"</font>, 0, REG_DWORD, (LPBYTE)&amp;rect.top, 4);
00354                 RegSetValueEx(hKey, <font class="stringliteral">"Bottom"</font>, 0, REG_DWORD, (LPBYTE)&amp;rect.bottom, 4);
00355         }
00356 }
00357 
00358 <font class="comment">// ***************************************************************************</font>
00359 
<a name="l00360"></a><a class="code" href="object_viewer_cpp.html#a3">00360</a> <font class="keywordtype">void</font> <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (<a class="code" href="class_CWnd.html">CWnd</a> *pWnd, <font class="keyword">const</font> <font class="keywordtype">char</font>* keyName, <font class="keywordtype">bool</font> resize)<font class="keyword">
</font>00361 <font class="keyword"></font>{
00362         HKEY hKey;
00363         <font class="keywordflow">if</font> (RegOpenKeyEx(HKEY_CURRENT_USER, keyName, 0, KEY_READ, &amp;hKey)==ERROR_SUCCESS)
00364         {
00365                 DWORD len=4;
00366                 DWORD type;
00367                 RECT rect;
00368                 RegQueryValueEx (hKey, <font class="stringliteral">"Left"</font>, 0, &amp;type, (LPBYTE)&amp;rect.left, &amp;len);
00369                 RegQueryValueEx (hKey, <font class="stringliteral">"Right"</font>, 0, &amp;type, (LPBYTE)&amp;rect.right, &amp;len);
00370                 RegQueryValueEx (hKey, <font class="stringliteral">"Top"</font>, 0, &amp;type, (LPBYTE)&amp;rect.top, &amp;len);
00371                 RegQueryValueEx (hKey, <font class="stringliteral">"Bottom"</font>, 0, &amp;type, (LPBYTE)&amp;rect.bottom, &amp;len);
00372 
00373                 <font class="comment">// Set window pos</font>
00374                 pWnd-&gt;SetWindowPos (NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOOWNERZORDER|SWP_NOZORDER|
00375                         (resize?0:SWP_NOSIZE));
00376         }
00377 }
00378 
00379 <font class="comment">// ***************************************************************************</font>
00380 
<a name="l00381"></a><a class="code" href="class_CObjectViewer.html#a18">00381</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a18">CObjectViewer::setAnimTime</a> (<font class="keywordtype">float</font> animStart, <font class="keywordtype">float</font> animEnd)<font class="keyword">
</font>00382 <font class="keyword"></font>{
00383         <font class="comment">// Dispatch the command</font>
00384         _SlotDlg-&gt;<a class="code" href="class_CMainDlg.html#a2">setAnimTime</a> (animStart, animEnd);
00385         _AnimationDlg-&gt;<a class="code" href="class_CAnimationDlg.html#a2">setAnimTime</a> (animStart, animEnd);
00386 }
00387 
00388 <font class="comment">// ***************************************************************************</font>
00389 
00390 
<a name="l00391"></a><a class="code" href="class_CObjectViewer.html#a19">00391</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a19">CObjectViewer::resetSlots</a> ()<font class="keyword">
</font>00392 <font class="keyword"></font>{
00393         <font class="comment">// Reset the animation set</font>
00394         _AnimationSet.<a class="code" href="class_NL3D__CAnimationSet.html#a15">reset</a> ();
00395 
00396         <font class="comment">// Set no animation in slot UI</font>
00397         <font class="keywordflow">for</font> (uint i=0; i&lt;NL3D::CChannelMixer::NumAnimationSlot; i++)
00398                 _SlotDlg-&gt;Slots[i].setAnimation (0xffffffff, NULL, NULL);
00399 }
00400 
00401 <font class="comment">// ***************************************************************************</font>
00402 
<a name="l00403"></a><a class="code" href="class_CObjectViewer.html#a20">00403</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a20">CObjectViewer::reinitChannels</a> ()<font class="keyword">
</font>00404 <font class="keyword"></font>{
00405         <font class="comment">// Reset the channels</font>
00406         _ChannelMixer.<a class="code" href="class_NL3D__CChannelMixer.html#a5">resetChannels</a> ();
00407 
00408         <font class="comment">// Add all the instance in the channel mixer</font>
00409         <font class="keywordflow">for</font> (uint i=0; i&lt;_ListTransformShape.size(); i++)
00410                 _ListTransformShape[i]-&gt;<a class="code" href="class_NL3D__CTransform.html#a6">registerToChannelMixer</a> (&amp;_ChannelMixer, _ListShapeBaseName[i]);
00411 }
00412 
00413 <font class="comment">// ***************************************************************************</font>
00414 
<a name="l00415"></a><a class="code" href="class_CObjectViewer.html#a21">00415</a> <font class="keywordtype">float</font> <a class="code" href="class_CObjectViewer.html#a21">CObjectViewer::getFrameRate</a> ()<font class="keyword">
</font>00416 <font class="keyword"></font>{
00417         <font class="keywordflow">return</font> _AnimationDlg-&gt;Speed;
00418 }
00419 
00420 <font class="comment">// ***************************************************************************</font>
00421 
<a name="l00422"></a><a class="code" href="class_CObjectViewer.html#a22">00422</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a22">CObjectViewer::serial</a> (<a class="code" href="class_NLMISC__IStream.html">NLMISC::IStream</a>&amp; f)<font class="keyword">
</font>00423 <font class="keyword"></font>{
00424         <font class="comment">// serial "OBJV_CFG"</font>
00425         f.<a class="code" href="class_NLMISC__IStream.html#a52">serialCheck</a> ((uint32)'VJBO');
00426         f.<a class="code" href="class_NLMISC__IStream.html#a52">serialCheck</a> ((uint32)'GFC_');
00427 
00428         <font class="comment">// serial the version</font>
00429         <font class="keywordtype">int</font> ver=f.<a class="code" href="class_NLMISC__IStream.html#a51">serialVersion</a> (0);
00430 
00431         <font class="comment">// update data</font>
00432         _AnimationDlg-&gt;UpdateData ();
00433         _SceneDlg-&gt;UpdateData ();
00434 
00435         <font class="comment">// serial animation data</font>
00436         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg-&gt;Start);
00437         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg-&gt;End);
00438         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg-&gt;Speed);
00439         <font class="keywordtype">bool</font> loop=_AnimationDlg-&gt;Loop!=0;
00440         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (loop);
00441         _AnimationDlg-&gt;Loop=loop;
00442         <font class="keywordtype">bool</font> euler=_SceneDlg-&gt;Euler!=0;
00443         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (euler);
00444         _SceneDlg-&gt;Euler=euler;
00445         sint32 ui=_AnimationDlg-&gt;UICurrentFrame;
00446         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (ui);
00447         _AnimationDlg-&gt;UICurrentFrame=ui;
00448         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg-&gt;CurrentFrame);
00449 
00450         <font class="comment">// update data</font>
00451         _AnimationDlg-&gt;UpdateData (FALSE);
00452         _SceneDlg-&gt;UpdateData (FALSE);
00453 
00454         <font class="comment">// For each slot</font>
00455         <font class="keywordflow">for</font> (uint i=0; i&lt;NL3D::CChannelMixer::NumAnimationSlot; i++)
00456         {
00457                 <font class="comment">// Update values</font>
00458                 _SlotDlg-&gt;Slots[i].UpdateData();
00459 
00460                 <font class="comment">// Serial the slot state</font>
00461                 <font class="keywordtype">bool</font> slotState=_SlotDlg-&gt;Slots[i].enable!=0;
00462                 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (slotState);
00463                 _SlotDlg-&gt;Slots[i].enable=slotState;
00464 
00465                 <font class="comment">// Update values</font>
00466                 _SlotDlg-&gt;Slots[i].UpdateData(FALSE);
00467         }
00468                 
00469 
00470         <font class="comment">// view matrix</font>
00471         CMatrix mt=_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a13">getViewMatrix</a>();
00472         f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (mt);
00473         _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a1">setMatrix</a> (mt);
00474 
00475         <font class="comment">// serial list of shape</font>
00476         std::vector&lt;CMeshDesc&gt; meshArray=_ListMeshes;
00477 
00478         <font class="comment">// serial list of shape</font>
00479         f.<a class="code" href="class_NLMISC__IStream.html#a29">serialCont</a> (meshArray);
00480 
00481         <font class="comment">// If reading, read shapes</font>
00482         <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ())
00483         {
00484                 <font class="comment">// Load each shape</font>
00485                 <font class="keywordflow">for</font> (uint s=0; s&lt;meshArray.size(); s++)
00486                         <a class="code" href="class_CObjectViewer.html#a9">loadMesh</a> (meshArray[s].MeshName.c_str(), meshArray[s].SkeletonName.c_str());
00487         }
00488 
00489         <font class="comment">// List of animation</font>
00490         std::vector&lt;std::string&gt; stringArray=_AnimationSetDlg-&gt;_ListAnimation;
00491 
00492         <font class="comment">// Serial the list</font>
00493         f.<a class="code" href="class_NLMISC__IStream.html#a29">serialCont</a> (stringArray);
00494 
00495         <font class="comment">// Serial the list of animation</font>
00496         <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ())
00497         {
00498                 <font class="comment">// Load animation file</font>
00499                 <font class="keywordflow">for</font> (uint s=0; s&lt;stringArray.size(); s++)
00500                         _AnimationSetDlg-&gt;<a class="code" href="class_CAnimationSetDlg.html#b1">loadAnimation</a> (stringArray[s].c_str());
00501         }
00502 
00503         <font class="comment">// List of skeleton</font>
00504         stringArray=_AnimationSetDlg-&gt;_ListSkeleton;
00505 
00506         <font class="comment">// Serial the list</font>
00507         f.<a class="code" href="class_NLMISC__IStream.html#a29">serialCont</a> (stringArray);
00508 
00509         <font class="comment">// Serial the list of animation</font>
00510         <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ())
00511         {
00512                 <font class="comment">// Load animation file</font>
00513                 <font class="keywordflow">for</font> (uint s=0; s&lt;stringArray.size(); s++)
00514                         _AnimationSetDlg-&gt;<a class="code" href="class_CAnimationSetDlg.html#b3">loadSkeleton</a> (stringArray[s].c_str());
00515         }
00516 
00517         <font class="comment">// Serial the play list</font>
00518         <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ())
00519         {
00520                 <font class="comment">// Serial the play list</font>
00521                 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_SlotDlg-&gt;Playlist);
00522 
00523                 <font class="comment">// Set the play list</font>
00524                 _SlotDlg-&gt;<a class="code" href="class_CMainDlg.html#a4">setSlot</a> ();
00525         }
00526         <font class="keywordflow">else</font>
00527         {
00528                 <font class="comment">// Set the play list</font>
00529                 _SlotDlg-&gt;<a class="code" href="class_CMainDlg.html#a3">getSlot</a> ();
00530 
00531                 <font class="comment">// Serial the play list</font>
00532                 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_SlotDlg-&gt;Playlist);
00533         }
00534 
00535         <font class="comment">// Some init</font>
00536         <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ())
00537         {
00538                 <font class="comment">// Init start and end time</font>
00539                 <a class="code" href="class_CObjectViewer.html#a18">setAnimTime</a> (_AnimationDlg-&gt;Start, _AnimationDlg-&gt;End);
00540 
00541                 <font class="comment">// Touch the channel mixer</font>
00542                 <a class="code" href="class_CObjectViewer.html#a20">reinitChannels</a> ();
00543         }
00544 }
00545 
00546 <font class="comment">// ***************************************************************************</font>
00547 
<a name="l00548"></a><a class="code" href="class_CObjectViewer.html#a9">00548</a> <font class="keywordtype">bool</font> <a class="code" href="class_CObjectViewer.html#a9">CObjectViewer::loadMesh</a> (<font class="keyword">const</font> <font class="keywordtype">char</font>* meshFilename, <font class="keyword">const</font> <font class="keywordtype">char</font>* skeleton)<font class="keyword">
</font>00549 <font class="keyword"></font>{
00550         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00551 
00552         <font class="comment">// Add to the path</font>
00553         <font class="keywordtype">char</font> drive[256];
00554         <font class="keywordtype">char</font> dir[256];
00555         <font class="keywordtype">char</font> path[256];
00556 
00557         <font class="comment">// Add search path for the mesh</font>
00558         _splitpath (meshFilename, drive, dir, NULL, NULL);
00559         _makepath (path, drive, dir, NULL, NULL);
00560         CPath::addSearchPath (path);
00561 
00562         <font class="comment">// Add search path for the skeleton</font>
00563         <font class="keywordflow">if</font> (skeleton)
00564         {
00565                 _splitpath (skeleton, drive, dir, NULL, NULL);
00566                 _makepath (path, drive, dir, NULL, NULL);
00567                 CPath::addSearchPath (path);
00568         }
00569 
00570         <font class="comment">// Shape pointer</font>
00571         IShape *shapeMesh=NULL;
00572         IShape *shapeSkel=NULL;
00573 
00574         <font class="comment">// Open a file</font>
00575         CIFile file;
00576         <font class="keywordflow">if</font> (file.open (meshFilename))
00577         {
00578                 <font class="comment">// Sream a shape</font>
00579                 CShapeStream streamShape;
00580                 <font class="keywordflow">try</font>
00581                 {
00582                         <font class="comment">// Stream it</font>
00583                         streamShape.serial (file);
00584 
00585                         <font class="comment">// Add the shape</font>
00586                         shapeMesh=streamShape.getShapePointer();
00587                 }
00588                 <font class="keywordflow">catch</font> (Exception&amp; e)
00589                 {
00590                         _SceneDlg-&gt;MessageBox (e.what(), <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION);
00591                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00592                 }
00593         }
00594         <font class="keywordflow">else</font>
00595         {
00596                 <font class="comment">// Create a message</font>
00597                 <font class="keywordtype">char</font> msg[512];
00598                 _snprintf (msg, 512, <font class="stringliteral">"Can't open the file %s for reading."</font>, meshFilename);
00599                 _SceneDlg-&gt;MessageBox (msg, <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION);
00600                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00601         }
00602 
00603         <font class="comment">// Continue ?</font>
00604         <font class="keywordflow">if</font> (skeleton&amp;&amp;(strcmp (skeleton, <font class="stringliteral">""</font>)!=0))
00605         {
00606                 <font class="comment">// Skel error ?</font>
00607                 <font class="keywordtype">bool</font> skelError=<font class="keyword">false</font>;
00608 
00609                 <font class="keywordflow">if</font> (skeleton)
00610                 {
00611                         <font class="comment">// Open a file</font>
00612                         <font class="keywordflow">if</font> (file.open (skeleton))
00613                         {
00614                                 <font class="comment">// Sream a shape</font>
00615                                 CShapeStream streamShape;
00616                                 <font class="keywordflow">try</font>
00617                                 {
00618                                         <font class="comment">// Stream it</font>
00619                                         streamShape.serial (file);
00620 
00621                                         <font class="comment">// Add the shape</font>
00622                                         shapeSkel=streamShape.getShapePointer();
00623                                 }
00624                                 <font class="keywordflow">catch</font> (Exception&amp; e)
00625                                 {
00626                                         _SceneDlg-&gt;MessageBox (e.what(), <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION);
00627 
00628                                         <font class="comment">// error</font>
00629                                         skelError=<font class="keyword">true</font>;
00630                                 }
00631                         }
00632                         <font class="keywordflow">else</font>
00633                         {
00634                                 <font class="comment">// Create a message</font>
00635                                 <font class="keywordtype">char</font> msg[512];
00636                                 _snprintf (msg, 512, <font class="stringliteral">"Can't open the file %s for reading."</font>, meshFilename);
00637                                 _SceneDlg-&gt;MessageBox (msg, <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION);
00638 
00639                                 <font class="comment">// error</font>
00640                                 skelError=<font class="keyword">true</font>;
00641                         }
00642                 }
00643 
00644                 <font class="comment">// Remove the mesh shape ?</font>
00645                 <font class="keywordflow">if</font> (skelError)
00646                 {
00647                         <font class="keywordflow">if</font> (shapeMesh)
00648                                 <font class="keyword">delete</font> shapeMesh;
00649                         shapeMesh=NULL;
00650                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00651                 }
00652         }
00653 
00654         <font class="comment">// Add the skel shape</font>
00655         <a class="code" href="class_NL3D__CSkeletonModel.html">NL3D::CSkeletonModel</a> *transformSkel=NULL;
00656         <font class="keywordflow">if</font> (shapeSkel)
00657                 transformSkel=<a class="code" href="class_CObjectViewer.html#a8">addSkel</a> (shapeSkel, skeleton, <font class="stringliteral">""</font>);
00658 
00659         <font class="comment">// Add the skel shape</font>
00660         <font class="keywordflow">if</font> (shapeMesh)
00661                 <a class="code" href="class_CObjectViewer.html#a7">addMesh</a> (shapeMesh, meshFilename, <font class="stringliteral">""</font>, transformSkel);
00662 
00663         <font class="comment">// Add an entry for config</font>
00664         _ListMeshes.push_back (<a class="code" href="class_CMeshDesc.html">CMeshDesc</a> (meshFilename, skeleton));
00665 
00666         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00667 }
00668 
00669 <font class="comment">// ***************************************************************************</font>
00670 
<a name="l00671"></a><a class="code" href="class_CObjectViewer.html#a12">00671</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a12">CObjectViewer::resetCamera</a> ()<font class="keyword">
</font>00672 <font class="keyword"></font>{
00673         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00674 
00675         _SceneDlg-&gt;<a class="code" href="class_CSceneDlg.html#b10">OnResetCamera</a>();
00676 }
00677 
00678 <font class="comment">// ***************************************************************************</font>
00679 
<a name="l00680"></a><a class="code" href="class_CObjectViewer.html#a7">00680</a> CTransformShape *<a class="code" href="class_CObjectViewer.html#a7">CObjectViewer::addMesh</a> (<a class="code" href="class_NL3D__IShape.html">NL3D::IShape</a>* pMeshShape, <font class="keyword">const</font> <font class="keywordtype">char</font>* meshName, <font class="keyword">const</font> <font class="keywordtype">char</font> *meshBaseName, CSkeletonModel* pSkel)<font class="keyword">
</font>00681 <font class="keyword"></font>{
00682         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00683 
00684         <font class="comment">// *** Add the shape</font>
00685 
00686         <font class="comment">// Store the shape pointer</font>
00687         CNELU::ShapeBank-&gt;add (meshName, CSmartPtr&lt;IShape&gt; (pMeshShape));
00688 
00689         <font class="comment">// Store the name of the shape</font>
00690         _ListShapeBaseName.push_back (meshBaseName);
00691 
00692         <font class="comment">// Create a model and add it to the scene</font>
00693         CTransformShape *pTrShape=CNELU::Scene.createInstance (meshName);
00694         <a class="code" href="debug_h.html#a6">nlassert</a> (pTrShape);
00695 
00696         <font class="comment">// Set the rot model</font>
00697         <font class="keywordflow">if</font> (_SceneDlg-&gt;Euler)
00698                 pTrShape-&gt;setTransformMode (ITransformable::RotEuler);
00699         <font class="keywordflow">else</font>
00700                 pTrShape-&gt;setTransformMode (ITransformable::RotQuat);
00701 
00702         <font class="comment">// Store the transform shape pointer</font>
00703         _ListTransformShape.push_back (pTrShape);
00704 
00705         <font class="comment">// *** Bind to the skeleton</font>
00706 
00707         <font class="comment">// Get a mesh instance</font>
00708         CMeshInstance  *meshInstance=dynamic_cast&lt;CMeshInstance*&gt;(pTrShape);
00709 
00710         <font class="comment">// Bind the mesh</font>
00711         <font class="keywordflow">if</font> (pSkel)
00712                 pSkel-&gt;bindSkin (meshInstance);
00713 
00714         <font class="comment">// Return the instance</font>
00715         <font class="keywordflow">return</font> pTrShape;
00716 }
00717 
00718 <font class="comment">// ***************************************************************************</font>
00719 
<a name="l00720"></a><a class="code" href="class_CObjectViewer.html#a8">00720</a> CSkeletonModel *<a class="code" href="class_CObjectViewer.html#a8">CObjectViewer::addSkel</a> (<a class="code" href="class_NL3D__IShape.html">NL3D::IShape</a>* pSkelShape, <font class="keyword">const</font> <font class="keywordtype">char</font>* skelName, <font class="keyword">const</font> <font class="keywordtype">char</font> *skelBaseName)<font class="keyword">
</font>00721 <font class="keyword"></font>{
00722         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00723 
00724         <font class="comment">// *** Add the shape</font>
00725 
00726         <font class="comment">// Store the shape pointer</font>
00727         CNELU::ShapeBank-&gt;add (skelName, CSmartPtr&lt;IShape&gt; (pSkelShape));
00728 
00729         <font class="comment">// Create a model and add it to the scene</font>
00730         CTransformShape *pTrShape=CNELU::Scene.createInstance (skelName);
00731         <a class="code" href="debug_h.html#a6">nlassert</a> (pTrShape);
00732 
00733         <font class="comment">// Get a skeleton model</font>
00734         CSkeletonModel *skelModel=dynamic_cast&lt;CSkeletonModel*&gt;(pTrShape);
00735 
00736         <font class="comment">// Is a skel ?</font>
00737         <font class="keywordflow">if</font> (skelModel)
00738         {
00739                 <font class="comment">// Set the rot model</font>
00740                 <font class="keywordflow">if</font> (_SceneDlg-&gt;Euler)
00741                         pTrShape-&gt;setTransformMode (ITransformable::RotEuler);
00742                 <font class="keywordflow">else</font>
00743                         pTrShape-&gt;setTransformMode (ITransformable::RotQuat);
00744 
00745                 <font class="comment">// Store the name of the shape</font>
00746                 _ListShapeBaseName.push_back (skelBaseName);
00747 
00748                 <font class="comment">// Store the transform shape pointer</font>
00749                 _ListTransformShape.push_back (skelModel);
00750         }
00751 
00752         <font class="comment">// Return the instance</font>
00753         <font class="keywordflow">return</font> skelModel;
00754 }
00755 
00756 <font class="comment">// ***************************************************************************</font>
00757 
<a name="l00758"></a><a class="code" href="class_IObjectViewer.html#d0">00758</a> <a class="code" href="class_IObjectViewer.html">IObjectViewer</a>* <a class="code" href="class_IObjectViewer.html#d0">IObjectViewer::getInterface</a> (<font class="keywordtype">int</font> version)<font class="keyword">
</font>00759 <font class="keyword"></font>{
00760         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00761 
00762         <font class="comment">// Check version number</font>
00763         <font class="keywordflow">if</font> (version!=OBJECT_VIEWER_VERSION)
00764         {
00765                 MessageBox (NULL, <font class="stringliteral">"Bad version of object_viewer.dll."</font>, <font class="stringliteral">"NeL object viewer"</font>, MB_ICONEXCLAMATION|MB_OK);
00766                 <font class="keywordflow">return</font> NULL;
00767         }
00768         <font class="keywordflow">else</font>
00769                 <font class="keywordflow">return</font> <font class="keyword">new</font> <a class="code" href="class_CObjectViewer.html">CObjectViewer</a>;
00770 }
00771 
00772 <font class="comment">// ***************************************************************************</font>
00773 
<a name="l00774"></a><a class="code" href="class_IObjectViewer.html#d1">00774</a> <font class="keywordtype">void</font> <a class="code" href="class_IObjectViewer.html#d1">IObjectViewer::releaseInterface</a> (<a class="code" href="class_IObjectViewer.html">IObjectViewer</a>* view)<font class="keyword">
</font>00775 <font class="keyword"></font>{
00776         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00777 
00778         <font class="keyword">delete</font> view;
00779 }
00780 
00781 <font class="comment">// ***************************************************************************</font>
00782 
<a name="l00783"></a><a class="code" href="class_CObjectViewer.html#a5">00783</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a5">CObjectViewer::setSingleAnimation</a> (<a class="code" href="class_NL3D__CAnimation.html">NL3D::CAnimation</a>* pAnim, <font class="keyword">const</font> <font class="keywordtype">char</font>* name)<font class="keyword">
</font>00784 <font class="keyword"></font>{
00785         AFX_MANAGE_STATE(AfxGetStaticModuleState());
00786 
00787         <font class="comment">// Add the animation to the animationSet</font>
00788         _AnimationSetDlg-&gt;UpdateData (TRUE);
00789         _AnimationSetDlg-&gt;<a class="code" href="class_CAnimationSetDlg.html#b2">addAnimation</a> (pAnim, name);
00790         _AnimationSetDlg-&gt;UpdateData (FALSE);
00791 
00792         <font class="comment">// Set time</font>
00793         <a class="code" href="class_CObjectViewer.html#a18">setAnimTime</a> (pAnim-&gt;<a class="code" href="class_NL3D__CAnimation.html#a5">getBeginTime</a>()*_AnimationDlg-&gt;Speed, pAnim-&gt;<a class="code" href="class_NL3D__CAnimation.html#a6">getEndTime</a>()*_AnimationDlg-&gt;Speed);
00794 
00795         <font class="comment">// Set the animation in the first slot</font>
00796         _SlotDlg-&gt;UpdateData ();
00797         _SlotDlg-&gt;Slots[0].setAnimation (_AnimationSet.<a class="code" href="class_NL3D__CAnimationSet.html#a3">getAnimationIdByName</a>(name), pAnim, name);
00798         _SlotDlg-&gt;Slots[0].StartBlend=1.f;
00799         _SlotDlg-&gt;Slots[0].EndBlend=1.f;
00800         _SlotDlg-&gt;Slots[0].Offset=0;
00801         _SlotDlg-&gt;Slots[0].enable=TRUE;
00802         _SlotDlg-&gt;UpdateData (FALSE);
00803 
00804         <font class="comment">// Reinit</font>
00805         <a class="code" href="class_CObjectViewer.html#a20">reinitChannels</a> ();
00806 }
00807 
00808 <font class="comment">// ***************************************************************************</font>
00809 
<a name="l00810"></a><a class="code" href="class_CObjectViewer.html#a6">00810</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a6">CObjectViewer::setAutoAnimation</a> (<a class="code" href="class_NL3D__CAnimation.html">NL3D::CAnimation</a>* pAnim)<font class="keyword">
</font>00811 <font class="keyword"></font>{
00812         CNELU::Scene.setAutoAnim (pAnim);
00813 }
00814 
00815 <font class="comment">// ***************************************************************************</font>
00816 
<a name="l00817"></a><a class="code" href="class_CObjectViewer.html#a10">00817</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a10">CObjectViewer::setAmbientColor</a> (<font class="keyword">const</font> <a class="code" href="class_NLMISC__CRGBA.html">NLMISC::CRGBA</a>&amp; color)<font class="keyword">
</font>00818 <font class="keyword"></font>{
00819         CNELU::Driver-&gt;setAmbientColor (color);
00820 }
00821 
00822 <font class="comment">// ***************************************************************************</font>
00823 
<a name="l00824"></a><a class="code" href="class_CObjectViewer.html#a11">00824</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a11">CObjectViewer::setLight</a> (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> id, <font class="keyword">const</font> <a class="code" href="class_NL3D__CLight.html">NL3D::CLight</a>&amp; light)<font class="keyword">
</font>00825 <font class="keyword"></font>{
00826         CNELU::Driver-&gt;enableLight (id);
00827         CNELU::Driver-&gt;setLight (id, light);
00828 }
00829 
00830 <font class="comment">// ***************************************************************************</font>
</div></pre>

<!-- 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>