aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/vertex__buffer_8cpp-source.html
blob: da7319e7d0be55bc20eafc68f10a109e3b701eca (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
<!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.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>vertex_buffer.cpp</h1><a href="vertex__buffer_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="vertex__buffer_8h.html">3d/vertex_buffer.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="vector_8h.html">nel/misc/vector.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
00031 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00032 
00033 
00034 <font class="keyword">namespace </font>NL3D
00035 {
00036 
00037 <font class="comment">// --------------------------------------------------</font>
00038 
<a name="l00039"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#p0">00039</a> <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a13">uint</a> CVertexBuffer::SizeType[NumType]=
00040 {
00041         1*<font class="keyword">sizeof</font>(double),
00042         1*<font class="keyword">sizeof</font>(float),
00043         1*<font class="keyword">sizeof</font>(short),
00044         2*<font class="keyword">sizeof</font>(double),
00045         2*<font class="keyword">sizeof</font>(float),
00046         2*<font class="keyword">sizeof</font>(short),
00047         3*<font class="keyword">sizeof</font>(double),
00048         3*<font class="keyword">sizeof</font>(float),
00049         3*<font class="keyword">sizeof</font>(short),
00050         4*<font class="keyword">sizeof</font>(double),
00051         4*<font class="keyword">sizeof</font>(float),
00052         4*<font class="keyword">sizeof</font>(short),
00053         4*<font class="keyword">sizeof</font>(char),
00054 };
00055 
00056 <font class="comment">// --------------------------------------------------</font>
00057 
<a name="l00058"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#p1">00058</a> <font class="keyword">const</font> CVertexBuffer::TType CVertexBuffer::DefaultValueType[NumValue]=
00059 {
00060         Float3,         <font class="comment">// Position</font>
00061         Float3,         <font class="comment">// Normal</font>
00062         Float2,         <font class="comment">// TexCoord0</font>
00063         Float2,         <font class="comment">// TexCoord1</font>
00064         Float2,         <font class="comment">// TexCoord2</font>
00065         Float2,         <font class="comment">// TexCoord3</font>
00066         Float2,         <font class="comment">// TexCoord4</font>
00067         Float2,         <font class="comment">// TexCoord5</font>
00068         Float2,         <font class="comment">// TexCoord6</font>
00069         Float2,         <font class="comment">// TexCoord7</font>
00070         UChar4,         <font class="comment">// Primary color</font>
00071         UChar4,         <font class="comment">// Secondary color</font>
00072         Float4,         <font class="comment">// 4 Weights</font>
00073         UChar4,         <font class="comment">// PaletteSkin</font>
00074         Float1,         <font class="comment">// Fog</font>
00075         Float1,         <font class="comment">// Empty</font>
00076 };
00077 
00078 <font class="comment">// --------------------------------------------------</font>
00079 
<a name="l00080"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a0">00080</a> CVertexBuffer::CVertexBuffer()
00081 {
00082         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> = 0;
00083         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = 0;
00084         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> = 0;
00085         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> = 0;
00086         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a> = 0;
00087 }
00088 
00089 <font class="comment">// --------------------------------------------------</font>
00090 
<a name="l00091"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a1">00091</a> CVertexBuffer::CVertexBuffer(<font class="keyword">const</font> CVertexBuffer &amp;vb)
00092 {
00093         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> = 0;
00094         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = 0;
00095         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> = 0;
00096         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a> = 0;
00097         <a class="code" href="classNL3D_1_1CVertexBuffer.html#a3">operator=</a>(vb);
00098 }
00099 
00100 <font class="comment">// --------------------------------------------------</font>
00101 
<a name="l00102"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a2">00102</a> CVertexBuffer::~CVertexBuffer()
00103 {
00104         <font class="comment">// Must kill the drv mirror of this VB.</font>
00105         <a class="code" href="classNL3D_1_1CVertexBuffer.html#z824_2">DrvInfos</a>.kill();
00106 }
00107 
00108 <font class="comment">// --------------------------------------------------</font>
00109 
<a name="l00110"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a3">00110</a> CVertexBuffer   &amp;CVertexBuffer::operator=(<font class="keyword">const</font> CVertexBuffer &amp;vb)
00111 {
00112         <font class="comment">// Single value</font>
00113         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a> = vb._VertexSize;
00114         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> = vb._Flags;
00115         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> = vb._InternalFlags;
00116         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> = vb._NbVerts;
00117         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = vb._Capacity;
00118         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a> = vb._Verts;
00119 
00120         <font class="comment">// Arraies</font>
00121         <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> value=0; value&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; value++)
00122         {
00123                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[value]= vb._Offset[value];
00124                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[value]= vb._Type[value];
00125         }
00126 
00127         <font class="comment">// Set touch flags</font>
00128         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>;
00129 
00130         <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00131 }
00132 
00133 <font class="comment">// --------------------------------------------------</font>
00134 
<a name="l00135"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_0">00135</a> <font class="keywordtype">bool</font> CVertexBuffer::setVertexFormat(<a class="code" href="types__nl_8h.html#a9">uint32</a> flags)
00136 {
00137         <a class="code" href="types__nl_8h.html#a13">uint</a>    i;
00138 
00139         <font class="comment">// Clear extended values </font>
00140         <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_0">clearValueEx</a> ();
00141 
00142         <font class="comment">// Position ?</font>
00143         <font class="keywordflow">if</font> (flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s19">PositionFlag</a>)
00144         {
00145                 <font class="comment">// Add a standard position value</font>
00146                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s0">Position</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>);
00147         }
00148 
00149         <font class="comment">// Normal ?</font>
00150         <font class="keywordflow">if</font> (flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>)
00151         {
00152                 <font class="comment">// Add a standard normal value</font>
00153                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>);
00154         }
00155 
00156         <font class="comment">// For each uv values</font>
00157         <font class="keywordflow">for</font>(i=0 ; i&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s49">MaxStage</a> ; i++)
00158         {
00159                 <font class="comment">// UV ?</font>
00160                 <font class="keywordflow">if</font> (flags &amp; (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a>&lt;&lt;i))
00161                 {
00162                         <font class="comment">// Add a standard uv value</font>
00163                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>)(<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>+i), <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>);
00164                 }
00165         }
00166 
00167         <font class="comment">// Fog ?</font>
00168         <font class="keywordflow">if</font> (flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s33">FogFlag</a>)
00169         {
00170                 <font class="comment">// Add a standard primary color value</font>
00171                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s14">Fog</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>);
00172         }
00173 
00174         <font class="comment">// Primary color ?</font>
00175         <font class="keywordflow">if</font> (flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>)
00176         {
00177                 <font class="comment">// Add a standard primary color value</font>
00178                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s47">UChar4</a>);
00179         }
00180 
00181         <font class="comment">// Secondary color ?</font>
00182         <font class="keywordflow">if</font> (flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>)
00183         {
00184                 <font class="comment">// Add a standard primary color value</font>
00185                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s47">UChar4</a>);
00186         }
00187 
00188         <font class="comment">// Weight ?</font>
00189         <font class="keywordflow">if</font> (flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>)
00190         {
00191                 <font class="comment">// Add a standard primary color value</font>
00192                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>);
00193         }
00194 
00195         <font class="comment">// Palette skin ?</font>
00196         <font class="keywordflow">if</font> ((flags &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>)==CVertexBuffer::PaletteSkinFlag)
00197         {
00198                 <font class="comment">// Add a standard primary color value</font>
00199                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s47">UChar4</a>);
00200         }
00201 
00202         <font class="comment">// Compute the vertex buffer</font>
00203         <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_3">initEx</a> ();
00204 
00205         <font class="keywordflow">return</font> (true);
00206 }
00207 
00208 <font class="comment">// --------------------------------------------------</font>
00209 
<a name="l00210"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_22">00210</a> CVertexBuffer::TValue CVertexBuffer::getValueIdByNumberEx (<a class="code" href="types__nl_8h.html#a13">uint</a> valueNumber)
00211 {
00212         <font class="comment">// See NV_vertex_program spec, or driver_opengl_vertex.cpp:: GLVertexAttribIndex.</font>
00213         <font class="keyword">static</font>  <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>  lut[16]= {
00214                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s0">Position</a>,
00215                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>,
00216                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>,
00217                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>,
00218                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>,
00219                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s14">Fog</a>,
00220                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>,
00221                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s15">Empty</a>,
00222                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>,
00223                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s3">TexCoord1</a>,
00224                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s4">TexCoord2</a>,
00225                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s5">TexCoord3</a>,
00226                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s6">TexCoord4</a>,
00227                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s7">TexCoord5</a>,
00228                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s8">TexCoord6</a>,
00229                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s9">TexCoord7</a>,
00230         };
00231 
00232         <font class="keywordflow">return</font> lut[valueNumber];
00233 }
00234 
00235 <font class="comment">// --------------------------------------------------</font>
00236 
<a name="l00237"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_0">00237</a> <font class="keywordtype">void</font> CVertexBuffer::clearValueEx ()
00238 {
00239         <font class="comment">// Reset format flags</font>
00240         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>=0;
00241 }
00242 
00243 <font class="comment">// --------------------------------------------------</font>
00244 
<a name="l00245"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">00245</a> <font class="keywordtype">void</font> CVertexBuffer::addValueEx (TValue valueId, TType <a class="code" href="driver__opengl__extension__def_8h.html#a240">type</a>)
00246 {
00247         <font class="comment">// Reset format flags</font>
00248         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> |= 1&lt;&lt;valueId;
00249 
00250         <font class="comment">// Set the type</font>
00251         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[valueId]=(uint8)<a class="code" href="driver__opengl__extension__def_8h.html#a240">type</a>;
00252 }
00253 
00254 <font class="comment">// --------------------------------------------------</font>
00255 
<a name="l00256"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_2">00256</a> <font class="keywordtype">bool</font> CVertexBuffer::hasValueEx(TValue valueId)<font class="keyword"> const</font>
00257 <font class="keyword"></font>{
00258         <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; (1 &lt;&lt; valueId)) != 0;
00259 }
00260 
00261 <font class="comment">// --------------------------------------------------</font>
00262 
<a name="l00263"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_3">00263</a> <font class="keywordtype">void</font> CVertexBuffer::initEx ()
00264 {
00265         <font class="comment">// Reset internal flag</font>
00266         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a>=<a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>;
00267 
00268         <font class="comment">// Calc vertex size and set value's offset</font>
00269         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>=0;
00270         <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> value=0; value&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; value++)
00271         {
00272                 <font class="comment">// Value used ?</font>
00273                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>&amp;(1&lt;&lt;value))
00274                 {
00275                         <font class="comment">// Set offset</font>
00276                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[value]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00277 
00278                         <font class="comment">// New size</font>
00279                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#p0">SizeType</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[value]];
00280                 }
00281         }
00282 
00283         <font class="comment">// Reset number of vertices</font>
00284         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>=0;
00285 
00286         <font class="comment">// Compute new capacity</font>
00287         <font class="keywordflow">if</font> (_VertexSize)
00288                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = <a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.size()/<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00289         <font class="keywordflow">else</font>
00290                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = 0;
00291 }
00292 
00293 <font class="comment">// --------------------------------------------------</font>
00294 
<a name="l00295"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">00295</a> <font class="keywordtype">void</font> CVertexBuffer::reserve(<a class="code" href="types__nl_8h.html#a9">uint32</a> n)
00296 {
00297         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.resize(n*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>);
00298         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a>= n;
00299 }
00300 
00301 <font class="comment">// --------------------------------------------------</font>
00302 
<a name="l00303"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">00303</a> <font class="keywordtype">void</font> CVertexBuffer::setNumVertices(<a class="code" href="types__nl_8h.html#a9">uint32</a> n)
00304 {
00305         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a>&lt;n)
00306         {
00307                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">reserve</a>(n);
00308         }
00309         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> != n)
00310         {
00311                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u1">TouchedNumVertices</a>;
00312                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>=n;
00313         }
00314 }
00315 
00316 <font class="comment">// --------------------------------------------------</font>
00317 
<a name="l00318"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a6">00318</a> <font class="keywordtype">void</font>    CVertexBuffer::deleteAllVertices()
00319 {
00320         <font class="comment">// free memory.</font>
00321         <a class="code" href="namespaceNLMISC.html#a197">contReset</a>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>);
00322         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a>= 0;
00323         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>!=0)
00324         {
00325                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>=0;
00326                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u1">TouchedNumVertices</a>;
00327         }
00328 }
00329 
00330 <font class="comment">// --------------------------------------------------</font>
00331 
<a name="l00332"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_18">00332</a> <font class="keywordtype">void</font>* CVertexBuffer::getVertexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)
00333 {
00334         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00335 
00336         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00337         ptr+=(idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>);
00338         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00339 }
00340 
00341 <font class="comment">// --------------------------------------------------</font>
00342 
<a name="l00343"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_19">00343</a> <font class="keywordtype">void</font>* CVertexBuffer::getNormalCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)
00344 {
00345         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00346 
00347         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>) )
00348         {
00349                 <font class="keywordflow">return</font>(NULL);
00350         }
00351         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00352         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>];
00353         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00354         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00355 }
00356 
00357 <font class="comment">// --------------------------------------------------</font>
00358 
<a name="l00359"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_21">00359</a> <font class="keywordtype">void</font>* CVertexBuffer::getColorPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)
00360 {
00361         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00362 
00363         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>) )
00364         {
00365                 <font class="keywordflow">return</font>(NULL);
00366         }
00367         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00368         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>];
00369         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00370         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00371 }
00372 
00373 <font class="comment">// --------------------------------------------------</font>
00374 
<a name="l00375"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_22">00375</a> <font class="keywordtype">void</font>* CVertexBuffer::getSpecularPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)
00376 {
00377         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00378 
00379         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>) )
00380         {
00381                 <font class="keywordflow">return</font>(NULL);
00382         }
00383         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00384         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>];
00385         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00386         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00387 }
00388 
00389 <font class="comment">// --------------------------------------------------</font>
00390 
<a name="l00391"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_20">00391</a> <font class="keywordtype">void</font>* CVertexBuffer::getTexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> stage)
00392 {
00393         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00394 
00395         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a>&lt;&lt;stage)) )
00396         {
00397                 <font class="keywordflow">return</font>(NULL);
00398         }
00399         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00400         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>+stage];
00401         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00402         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00403 }
00404 
00405 <font class="comment">// --------------------------------------------------</font>
00406 
<a name="l00407"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_23">00407</a> <font class="keywordtype">void</font>* CVertexBuffer::getWeightPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> wgt)
00408 {
00409         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00410 
00411         <a class="code" href="debug_8h.html#a6">nlassert</a>(wgt&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s50">MaxWeight</a>);
00412         <font class="keywordflow">if</font>( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>))
00413                 <font class="keywordflow">return</font> NULL;
00414 
00415         ptr=(<a class="code" href="types__nl_8h.html#a5">uint8</a>*)(&amp;<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>[idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>]);
00416         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]+wgt*<font class="keyword">sizeof</font>(float);
00417 
00418         <font class="keywordflow">return</font> ptr;
00419 }
00420 
00421 <font class="comment">// --------------------------------------------------</font>
00422 
<a name="l00423"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_24">00423</a> <font class="keywordtype">void</font>* CVertexBuffer::getPaletteSkinPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)
00424 {
00425         <a class="code" href="types__nl_8h.html#a5">uint8</a>*  ptr;
00426 
00427         <font class="keywordflow">if</font> ( (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>) != CVertexBuffer::PaletteSkinFlag )
00428         {
00429                 <font class="keywordflow">return</font>(NULL);
00430         }
00431         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00432         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>];
00433         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00434         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00435 }
00436 
00437 <font class="comment">// --------------------------------------------------</font>
00438 
00439 
00441 <font class="comment">// const versions //</font>
00443 <font class="comment"></font>
00444 
00445 <font class="comment">// --------------------------------------------------</font>
00446 
<a name="l00447"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_25">00447</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getVertexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const </font>
00448 <font class="keyword"></font>{
00449         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00450 
00451         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00452         ptr+=(idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>);
00453         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00454 }
00455 
00456 <font class="comment">// --------------------------------------------------</font>
00457 
<a name="l00458"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_26">00458</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getNormalCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font>
00459 <font class="keyword"></font>{
00460         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00461 
00462         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>) )
00463         {
00464                 <font class="keywordflow">return</font>(NULL);
00465         }
00466         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00467         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>];
00468         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00469         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00470 }
00471 
00472 <font class="comment">// --------------------------------------------------</font>
00473 
<a name="l00474"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_28">00474</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getColorPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font>
00475 <font class="keyword"></font>{
00476         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00477 
00478         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>) )
00479         {
00480                 <font class="keywordflow">return</font>(NULL);
00481         }
00482         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00483         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>];
00484         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00485         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00486 }
00487 
00488 <font class="comment">// --------------------------------------------------</font>
00489 
<a name="l00490"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_29">00490</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getSpecularPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font>
00491 <font class="keyword"></font>{
00492         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00493 
00494         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>) )
00495         {
00496                 <font class="keywordflow">return</font>(NULL);
00497         }
00498         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00499         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>];
00500         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00501         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00502 }
00503 
00504 <font class="comment">// --------------------------------------------------</font>
00505 
<a name="l00506"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_27">00506</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getTexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> stage)<font class="keyword"> const</font>
00507 <font class="keyword"></font>{
00508         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00509 
00510         <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a>&lt;&lt;stage)) )
00511         {
00512                 <font class="keywordflow">return</font>(NULL);
00513         }
00514         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00515         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>+stage];
00516         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00517         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00518 }
00519 
00520 <font class="comment">// --------------------------------------------------</font>
00521 
<a name="l00522"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_30">00522</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getWeightPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> wgt)<font class="keyword"> const</font>
00523 <font class="keyword"></font>{
00524         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00525 
00526         <a class="code" href="debug_8h.html#a6">nlassert</a>(wgt&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s50">MaxWeight</a>);
00527         <font class="keywordflow">if</font>( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>))
00528                 <font class="keywordflow">return</font> NULL;
00529 
00530         ptr=(<a class="code" href="types__nl_8h.html#a5">uint8</a>*)(&amp;<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>[idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>]);
00531         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]+wgt*<font class="keyword">sizeof</font>(float);
00532 
00533         <font class="keywordflow">return</font> ptr;
00534 }
00535 
00536 <font class="comment">// --------------------------------------------------</font>
00537 
<a name="l00538"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_31">00538</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getPaletteSkinPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font>
00539 <font class="keyword"></font>{
00540         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>*    ptr;
00541 
00542         <font class="keywordflow">if</font> ( (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>) != CVertexBuffer::PaletteSkinFlag )
00543         {
00544                 <font class="keywordflow">return</font>(NULL);
00545         }
00546         ptr=&amp;(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin());
00547         ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>];
00548         ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>;
00549         <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr);
00550 }
00551 
00552 <font class="comment">// --------------------------------------------------</font>
00553 
<a name="l00554"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#c1">00554</a> <a class="code" href="types__nl_8h.html#a7">uint16</a>          CVertexBuffer::remapV2Flags (<a class="code" href="types__nl_8h.html#a9">uint32</a> oldFlags, <a class="code" href="types__nl_8h.html#a13">uint</a>&amp; weightCount)
00555 {
00556         <font class="comment">// Old flags</font>
00557         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_XYZ = 0x00000001;
00558         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W0 = 0x00000002;
00559         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W1 = 0x00000004;
00560         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W2 = 0x00000008;
00561         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W3 = 0x00000010;
00562         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_NORMAL = 0x00000020;
00563         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_COLOR = 0x00000040;
00564         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_SPECULAR = 0x00000080;
00565         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV0 = 0x00000100;
00566         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV1 = 0x00000200;
00567         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV2 = 0x00000400;
00568         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV3 = 0x00000800;
00569         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV4 = 0x00001000;
00570         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV5 = 0x00002000;
00571         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV6 = 0x00004000;
00572         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV7 = 0x00008000;
00573         <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_PALETTE_SKIN = 0x00010000 | OLD_IDRV_VF_W0 | OLD_IDRV_VF_W1 | OLD_IDRV_VF_W2 | OLD_IDRV_VF_W3;
00574 
00575         <font class="comment">// Old Flags</font>
00576         <a class="code" href="types__nl_8h.html#a7">uint16</a> newFlags=0;
00577 
00578         <font class="comment">// Number of weight values</font>
00579         weightCount=0;
00580 
00581         <font class="comment">// Remap the flags</font>
00582         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_XYZ)
00583                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s19">PositionFlag</a>;
00584         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_NORMAL)
00585                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>;
00586         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_COLOR)
00587                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>;
00588         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_SPECULAR)
00589                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>;
00590         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV0)
00591                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a>;
00592         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV1)
00593                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s22">TexCoord1Flag</a>;
00594         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV2)
00595                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s23">TexCoord2Flag</a>;
00596         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV3)
00597                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s24">TexCoord3Flag</a>;
00598         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV4)
00599                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s25">TexCoord4Flag</a>;
00600         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV5)
00601                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s26">TexCoord5Flag</a>;
00602         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV6)
00603                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s27">TexCoord6Flag</a>;
00604         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_UV7)
00605                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s28">TexCoord7Flag</a>;
00606         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_W0)
00607         {
00608                 weightCount=1;
00609                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>;
00610         }
00611         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_W1)
00612         {
00613                 weightCount=2;
00614                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>;
00615         }
00616         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_W2)
00617         {
00618                 weightCount=3;
00619                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>;
00620         }
00621         <font class="keywordflow">if</font> (oldFlags&amp;OLD_IDRV_VF_W3)
00622         {
00623                 weightCount=4;
00624                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>;
00625         }
00626         <font class="keywordflow">if</font> (oldFlags&amp;(OLD_IDRV_VF_PALETTE_SKIN))
00627                 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>;
00628 
00629         <font class="comment">// Return the new flags</font>
00630         <font class="keywordflow">return</font> newFlags;
00631 }
00632 
00633 <font class="comment">// --------------------------------------------------</font>
00634 
<a name="l00635"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#c0">00635</a> <font class="keywordtype">void</font>            CVertexBuffer::serialOldV1Minus(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, <a class="code" href="types__nl_8h.html#a12">sint</a> ver)
00636 {
00637         <font class="comment">/*</font>
00638 <font class="comment">        Version 1:</font>
00639 <font class="comment">                - PaletteSkin version.</font>
00640 <font class="comment">        Version 0:</font>
00641 <font class="comment">                - base verison.</font>
00642 <font class="comment">        */</font>
00643 
00644         <font class="comment">// old Flags</font>
00645         <a class="code" href="types__nl_8h.html#a9">uint32</a> oldFlags;
00646 
00647         <font class="comment">// Serial VBuffers format/size.</font>
00648         <font class="comment">//=============================</font>
00649         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(oldFlags);
00650 
00651         <font class="comment">// Remap the flags</font>
00652         <a class="code" href="types__nl_8h.html#a13">uint</a> weightCount;
00653         <a class="code" href="types__nl_8h.html#a7">uint16</a> newFlags=<a class="code" href="classNL3D_1_1CVertexBuffer.html#c1">remapV2Flags</a> (oldFlags, weightCount);
00654 
00655         <font class="comment">// Must be reading</font>
00656         <a class="code" href="debug_8h.html#a6">nlassert</a> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>());
00657 
00658         <font class="comment">// Set default value type</font>
00659         <a class="code" href="types__nl_8h.html#a13">uint</a> i;
00660         <font class="keywordflow">for</font> (i=0; i&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++)
00661                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#p1">DefaultValueType</a>[i];
00662 
00663         <a class="code" href="types__nl_8h.html#a9">uint32</a> nbVert;  <font class="comment">// Read only</font>
00664         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(nbVert);
00665         <a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">reserve</a>(0);
00666         <a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_0">setVertexFormat</a>(newFlags);
00667         <a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">setNumVertices</a>(nbVert);
00668         <font class="comment">// All other infos (but _Verts) are computed by setVertexFormat() and setNumVertices().</font>
00669 
00670         <font class="comment">// Weight count ?</font>
00671         <font class="keywordflow">switch</font> (weightCount)
00672         {
00673         <font class="keywordflow">case</font> 1:
00674                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>;
00675                 <font class="keywordflow">break</font>;
00676         <font class="keywordflow">case</font> 2:
00677                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>;
00678                 <font class="keywordflow">break</font>;
00679         <font class="keywordflow">case</font> 3:
00680                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>;
00681                 <font class="keywordflow">break</font>;
00682         <font class="keywordflow">case</font> 4:
00683                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>;
00684                 <font class="keywordflow">break</font>;
00685         }
00686 
00687         <font class="comment">// Serial VBuffers components.</font>
00688         <font class="comment">//============================</font>
00689         <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a12">sint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>=0;<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>&lt;(sint)<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>;<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>++)
00690         {
00691                 <font class="comment">// XYZ.</font>
00692                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s19">PositionFlag</a>)
00693                 {
00694                         CVector         &amp;vert= *(CVector*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_18">getVertexCoordPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>);
00695                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(vert);
00696                 }
00697                 <font class="comment">// Normal</font>
00698                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>)
00699                 {
00700                         CVector         &amp;norm= *(CVector*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_19">getNormalCoordPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>);
00701                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(norm);
00702                 }
00703                 <font class="comment">// Uvs.</font>
00704                 <font class="keywordflow">for</font>(i=0;i&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s49">MaxStage</a>;i++)
00705                 {
00706                         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a>&lt;&lt;i))
00707                         {
00708                                 CUV             &amp;uv= *(CUV*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_20">getTexCoordPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>, i);
00709                                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(uv);
00710                         }
00711                 }
00712                 <font class="comment">// Color.</font>
00713                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>)
00714                 {
00715                         CRGBA           &amp;col= *(CRGBA*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_21">getColorPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>);
00716                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(col);
00717                 }
00718                 <font class="comment">// Specular.</font>
00719                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>)
00720                 {
00721                         CRGBA           &amp;col= *(CRGBA*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_22">getSpecularPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>);
00722                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(col);
00723                 }
00724                 <font class="comment">// Weights</font>
00725                 <font class="keywordflow">for</font>(i=0;i&lt;weightCount;i++)
00726                 {
00727                         <font class="comment">// Weight channel available ?</font>
00728                         <font class="keywordtype">float</font>   &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a234">w</a>= *(<font class="keywordtype">float</font>*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_23">getWeightPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>, i);
00729                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a234">w</a>);
00730                 }
00731                 <font class="comment">// CPaletteSkin (version 1+ only).</font>
00732                 <font class="keywordflow">if</font>((ver&gt;=1) &amp;&amp; ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>) == CVertexBuffer::PaletteSkinFlag) )
00733                 {
00734                         CPaletteSkin    &amp;ps= *(CPaletteSkin*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_24">getPaletteSkinPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>);
00735                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(ps);
00736                 }
00737 
00738         }
00739 
00740         <font class="comment">// Set touch flags</font>
00741         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> = 0;
00742         <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
00743                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>;
00744 }
00745 
00746 <font class="comment">// --------------------------------------------------</font>
00747 
<a name="l00748"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a13">00748</a> <font class="keywordtype">void</font>            CVertexBuffer::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
00749 {
00750         <font class="comment">/*</font>
00751 <font class="comment">        Version 2:</font>
00752 <font class="comment">                - cut to use serialHeader() serialSubset().</font>
00753 <font class="comment">        Version 1:</font>
00754 <font class="comment">                - PaletteSkin version.</font>
00755 <font class="comment">        Version 0:</font>
00756 <font class="comment">                - base verison.</font>
00757 <font class="comment">        */</font>
00758         <a class="code" href="types__nl_8h.html#a12">sint</a>    ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(2);
00759 
00760         <font class="keywordflow">if</font> (ver&lt;2)
00761         {
00762                 <font class="comment">// old serial method</font>
00763                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#c0">serialOldV1Minus</a>(f, ver);
00764         }
00765         <font class="keywordflow">else</font>
00766         {
00767                 <font class="comment">// read write the header of the VBuffer.</font>
00768                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_0">serialHeader</a>(f);
00769 
00770                 <font class="comment">// read write the entire subset.</font>
00771                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_1">serialSubset</a>(f, 0, <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>);
00772         }
00773 }
00774 
00775 <font class="comment">// --------------------------------------------------</font>
00776 
<a name="l00777"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_0">00777</a> <font class="keywordtype">void</font>            CVertexBuffer::serialHeader(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
00778 {
00779         <font class="comment">/*</font>
00780 <font class="comment">        Version 1:</font>
00781 <font class="comment">                - Extended vertex format management.</font>
00782 <font class="comment">        Version 0:</font>
00783 <font class="comment">                - base verison of the header serialisation.</font>
00784 <font class="comment">        */</font>
00785         <a class="code" href="types__nl_8h.html#a12">sint</a>    ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(1);
00786 
00787         <font class="comment">// Serial VBuffers format/size.</font>
00788         <font class="comment">//=============================</font>
00789 
00790         <font class="comment">// Flags</font>
00791         <a class="code" href="types__nl_8h.html#a7">uint16</a> flags=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>;
00792 
00793         <font class="keywordflow">if</font> (ver&lt;1)
00794         {
00795                 <font class="comment">// Must be reading</font>
00796                 <a class="code" href="debug_8h.html#a6">nlassert</a> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>());
00797 
00798                 <font class="comment">// Serial old flags</font>
00799                 <a class="code" href="types__nl_8h.html#a9">uint32</a> oldFlags;
00800                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(oldFlags);
00801 
00802                 <font class="comment">// Remap flags</font>
00803                 <a class="code" href="types__nl_8h.html#a13">uint</a> weightCount;
00804                 flags=<a class="code" href="classNL3D_1_1CVertexBuffer.html#c1">remapV2Flags</a> (oldFlags, weightCount);
00805 
00806                 <font class="comment">// Set default value type</font>
00807                 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> i=0; i&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++)
00808                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#p1">DefaultValueType</a>[i];
00809 
00810                 <font class="comment">// weight count ?</font>
00811                 <font class="keywordflow">switch</font> (weightCount)
00812                 {
00813                 <font class="keywordflow">case</font> 1:
00814                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>;
00815                         <font class="keywordflow">break</font>;
00816                 <font class="keywordflow">case</font> 2:
00817                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>;
00818                         <font class="keywordflow">break</font>;
00819                 <font class="keywordflow">case</font> 3:
00820                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>;
00821                         <font class="keywordflow">break</font>;
00822                 <font class="keywordflow">case</font> 4:
00823                         <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>;
00824                         <font class="keywordflow">break</font>;
00825                 }
00826         }
00827         <font class="keywordflow">else</font>
00828         {
00829                 <font class="comment">// Serial new vertex flags</font>
00830                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(flags);
00831 
00832                 <font class="comment">// Serial type of values</font>
00833                 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> i=0; i&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++)
00834                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]);
00835         }
00836 
00837         <font class="comment">// Serial nb vertices</font>
00838         <a class="code" href="types__nl_8h.html#a9">uint32</a> nbVerts=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>;
00839         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(nbVerts);
00840 
00841         <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
00842         {
00843                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">reserve</a>(0);
00844 
00845                 <font class="comment">// Init vertex format setup</font>
00846                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_0">clearValueEx</a> ();
00847 
00848                 <font class="comment">// Init vertex format</font>
00849                 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> i=0; i&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++)
00850                 {
00851                         <font class="comment">// Setup this value ?</font>
00852                         <font class="keywordflow">if</font> (flags&amp;(1&lt;&lt;i))
00853                         {
00854                                 <font class="comment">// Add a value</font>
00855                                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>)i, (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54">TType</a>)<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]);
00856                         }
00857                 }
00858 
00859                 <font class="comment">// Build final vertex format</font>
00860                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_3">initEx</a> ();
00861 
00862                 <font class="comment">// Set num of vertices</font>
00863                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">setNumVertices</a>(nbVerts);
00864         }
00865         <font class="comment">// All other infos (but _Verts) are computed by initEx() and setNumVertices().</font>
00866 }
00867 
00868 
00869 <font class="comment">// --------------------------------------------------</font>
<a name="l00870"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_2">00870</a> <a class="code" href="types__nl_8h.html#a13">uint</a>    CVertexBuffer:: getNumTexCoordUsed()<font class="keyword"> const</font>
00871 <font class="keyword"></font>{       
00872         <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a12">sint</a> k = (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s49">MaxStage</a> - 1); k &gt;= 0; --k)
00873         {
00874                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> &amp; (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a> &lt;&lt; k))  <font class="keywordflow">return</font> (uint) (k + 1);
00875         }
00876         <font class="keywordflow">return</font> 0;
00877 }
00878 
00879 <font class="comment">// --------------------------------------------------</font>
00880 
<a name="l00881"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a12">00881</a> <a class="code" href="types__nl_8h.html#a5">uint8</a>           CVertexBuffer::getNumWeight ()<font class="keyword"> const</font>
00882 <font class="keyword"></font>{
00883         <font class="comment">// Num weight</font>
00884         <font class="keywordflow">switch</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>])
00885         {
00886         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>:
00887                 <font class="keywordflow">return</font> 1;
00888         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>:
00889                 <font class="keywordflow">return</font> 2;
00890         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>:
00891                 <font class="keywordflow">return</font> 3;
00892         <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>:
00893                 <font class="keywordflow">return</font> 4;
00894         }
00895 
00896         <font class="comment">// No weight</font>
00897         <font class="keywordflow">return</font> 0;
00898 }
00899 
00900 <font class="comment">// --------------------------------------------------</font>
00901 
<a name="l00902"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_1">00902</a> <font class="keywordtype">void</font>            CVertexBuffer::serialSubset(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, <a class="code" href="types__nl_8h.html#a13">uint</a> vertexStart, <a class="code" href="types__nl_8h.html#a13">uint</a> vertexEnd)
00903 {
00904         <font class="comment">/*</font>
00905 <font class="comment">        Version 1:</font>
00906 <font class="comment">                - weight is 4 float in standard format.</font>
00907 <font class="comment">        Version 0:</font>
00908 <font class="comment">                - base verison of a vbuffer subset serialisation.</font>
00909 <font class="comment">        */</font>
00910         <a class="code" href="types__nl_8h.html#a12">sint</a>    ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(1);
00911 
00912 
00913         <font class="comment">// Serial VBuffers components.</font>
00914         <font class="comment">//============================</font>
00915         <a class="code" href="debug_8h.html#a6">nlassert</a>(vertexStart&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> || <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>==0);
00916         <a class="code" href="debug_8h.html#a6">nlassert</a>(vertexEnd&lt;=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>);
00917         <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a13">uint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>=vertexStart; <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>&lt;vertexEnd; <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>++)
00918         {
00919                 <font class="comment">// For each value</font>
00920                 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> value=0; value&lt;<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; value++)
00921                 {
00922                         <font class="comment">// Value used ?</font>
00923                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>&amp;(1&lt;&lt;value))
00924                         {
00925                                 <font class="comment">// Get the pointer on it</font>
00926                                 <font class="keywordtype">void</font> *ptr=<a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_19">getValueEx</a> ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>)value, <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>);
00927                                 f.<a class="code" href="classNLMISC_1_1IStream.html#z316_0">serialBuffer</a> ((<a class="code" href="types__nl_8h.html#a5">uint8</a>*)ptr, <a class="code" href="classNL3D_1_1CVertexBuffer.html#p0">SizeType</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[value]]);
00928                         }
00929                 }
00930         }
00931 
00932         <font class="comment">// Set touch flags</font>
00933         <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
00934                 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>;
00935 }
00936 
00937 <font class="comment">// --------------------------------------------------</font>
00938 
00939 <font class="comment">// CPaletteSkin serial (no version chek).</font>
<a name="l00940"></a><a class="code" href="structNL3D_1_1CPaletteSkin.html#a0">00940</a> <font class="keywordtype">void</font>    CPaletteSkin::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
00941 {
00942         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[0], <a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[1], <a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[2], <a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[3]);
00943 }
00944 
00945 <font class="comment">// --------------------------------------------------</font>
00946 
<a name="l00947"></a><a class="code" href="classNL3D_1_1IVBDrvInfos.html#a1">00947</a> IVBDrvInfos::~IVBDrvInfos()
00948 {
00949         <a class="code" href="classNL3D_1_1IVBDrvInfos.html#o0">_Driver</a>-&gt;removeVBDrvInfoPtr(<a class="code" href="classNL3D_1_1IVBDrvInfos.html#o1">_DriverIterator</a>);
00950 }
00951 
00952 <font class="comment">// --------------------------------------------------</font>
00953 
00954 }
</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>