aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__mesh_8cpp-source.html
blob: 21aeee1813e1694dbb1ff6073624e60d839771e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

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

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>ps_mesh.cpp</h1><a href="ps__mesh_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="ps__mesh_8h.html">3d/ps_mesh.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="ps__macro_8h.html">3d/ps_macro.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="shape_8h.html">3d/shape.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="mesh_8h.html">3d/mesh.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="transform__shape_8h.html">3d/transform_shape.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="shape__bank_8h.html">3d/shape_bank.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="texture__mem_8h.html">3d/texture_mem.h</a>"</font>
00035 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
00036 <font class="preprocessor">#include "<a class="code" href="ps__located_8h.html">3d/ps_located.h</a>"</font>
00037 <font class="preprocessor">#include "<a class="code" href="particle__system_8h.html">3d/particle_system.h</a>"</font>
00038 <font class="preprocessor">#include "<a class="code" href="particle__system__shape_8h.html">3d/particle_system_shape.h</a>"</font>
00039 <font class="preprocessor">#include "<a class="code" href="ps__iterator_8h.html">3d/ps_iterator.h</a>"</font>
00040 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font>
00041 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
00042 
00043 <font class="preprocessor">#include &lt;memory&gt;</font>
00044 
00045 
00046 
00047 
00048 
00049 <font class="keyword">namespace </font>NL3D 
00050 {
00051 
00053 <font class="comment">// static members //</font>
00055 <font class="comment"></font>
00056 
00057 
00058 
00059 CPSConstraintMesh::CMeshDisplayShare            CPSConstraintMesh::_MeshDisplayShare(16);       
<a name="l00060"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q1">00060</a> CVertexBuffer                                                           CPSConstraintMesh::_PreRotatedMeshVB;                     <font class="comment">// mesh has no normals</font>
<a name="l00061"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q2">00061</a> CVertexBuffer                                                           CPSConstraintMesh::_PreRotatedMeshVBWithNormal;  <font class="comment">// mesh has normals</font>
00062 
00063 
00064 
00065 <font class="comment">// this produce a random unit vector</font>
00066 <font class="keyword">static</font> CVector <a class="code" href="namespaceNL3D.html#a421">MakeRandomUnitVect</a>(<font class="keywordtype">void</font>) 
00067 {
00068         CVector <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>((<font class="keywordtype">float</font>) ((rand() % 20000) - 10000)
00069                           ,(<font class="keywordtype">float</font>) ((rand() % 20000) - 10000)
00070                           ,(<font class="keywordtype">float</font>) ((rand() % 20000) - 10000)
00071                           );
00072         <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.normalize();
00073         <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>;
00074 }
00075 
00076 
00078 <font class="comment">// CPSMesh implementation //</font>
00080 <font class="comment"></font>
00081 
00082 <font class="comment">//====================================================================================</font>
00083 
00084 
00085 
00086 
00087 <font class="keyword">const</font> std::string <a class="code" href="namespaceNL3D.html#a428">DummyShapeName</a>(<font class="stringliteral">"dummy mesh shape"</font>);
00088 
00092 <font class="keyword">static</font> CMesh *<a class="code" href="namespaceNL3D.html#a429">CreateDummyShape</a>(<font class="keywordtype">void</font>)
00093 {
00094         CMesh::CMeshBuild mb;
00095         CMeshBase::CMeshBaseBuild mbb;
00096 
00097         mb.VertexFlags = CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag;
00098         mb.Vertices.push_back(CVector(-.5f, -.5f, -.5f));
00099         mb.Vertices.push_back(CVector(.5f, -.5f, -.5f));
00100         mb.Vertices.push_back(CVector(.5f, -.5f, .5f));
00101         mb.Vertices.push_back(CVector(-.5f, -.5f, .5f));
00102 
00103         mb.Vertices.push_back(CVector(-.5f, .5f, -.5f));
00104         mb.Vertices.push_back(CVector(.5f, .5f, -.5f));
00105         mb.Vertices.push_back(CVector(.5f, .5f, .5f));
00106         mb.Vertices.push_back(CVector(-.5f, .5f, .5f));
00107 
00108         <font class="comment">// index for each face</font>
00109         uint32 tab[] = { 4, 1, 0,
00110                                          4, 5, 1,
00111                                          5, 2, 1,
00112                                          5, 6, 2,
00113                                          6, 3, 2,
00114                                          6, 7, 3,
00115                                          7, 0, 3,
00116                                          7, 4, 0,
00117                                          7, 5, 4,
00118                                          7, 6, 5,
00119                                          2, 0, 1,
00120                                          2, 3, 0
00121                                         };
00122 
00123         <font class="keywordflow">for</font> (uint k = 0; k &lt; 6; ++k)
00124         {
00125                 CMesh::CFace f;
00126                 f.Corner[0].Vertex = tab[6 * k];
00127                 f.Corner[0].Uvws[0] = <a class="code" href="classNLMISC_1_1CUVW.html">NLMISC::CUVW</a>(0, 0, 0);
00128 
00129                 f.Corner[1].Vertex = tab[6 * k + 1];
00130                 f.Corner[1].Uvws[0] = <a class="code" href="classNLMISC_1_1CUVW.html">NLMISC::CUVW</a>(1, 1, 0);
00131 
00132                 f.Corner[2].Vertex = tab[6 * k + 2];
00133                 f.Corner[2].Uvws[0] = <a class="code" href="classNLMISC_1_1CUVW.html">NLMISC::CUVW</a>(0, 1, 0);
00134 
00135                 f.MaterialId = 0;
00136 
00137                 mb.Faces.push_back(f);
00138 
00139                 f.Corner[0].Vertex = tab[6 * k + 3];
00140                 f.Corner[0].Uvws[0] = <a class="code" href="classNLMISC_1_1CUVW.html">NLMISC::CUVW</a>(0, 0, 0);
00141 
00142                 f.Corner[1].Vertex = tab[6 * k + 4];
00143                 f.Corner[1].Uvws[0] = <a class="code" href="classNLMISC_1_1CUVW.html">NLMISC::CUVW</a>(1, 0, 0);
00144 
00145                 f.Corner[2].Vertex = tab[6 * k + 5];
00146                 f.Corner[2].Uvws[0] = <a class="code" href="classNLMISC_1_1CUVW.html">NLMISC::CUVW</a>(1, 1, 0);
00147 
00148                 f.MaterialId = 0;
00149                 mb.Faces.push_back(f);          
00150         }
00151 
00152         CMaterial mat;
00153         CTextureMem *tex = <font class="keyword">new</font> CTextureMem;
00154         tex-&gt;makeDummy();
00155         mat.setTexture(0, tex);
00156         mat.setLighting(<font class="keyword">false</font>);
00157         mat.setColor(CRGBA::White);
00158         mbb.Materials.push_back(mat);
00159         CMesh *m = <font class="keyword">new</font> CMesh;
00160         m-&gt;build(mbb, mb);
00161         <font class="keywordflow">return</font> m;
00162 } 
00163 
00164 
00165 <font class="comment">//====================================================================================</font>
<a name="l00166"></a><a class="code" href="classNL3D_1_1CPSMesh.html#a3">00166</a> <font class="keywordtype">void</font> CPSMesh::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00167 {       
00168         (void)f.serialVersion(3);       
00169         CPSParticle::serial(f);
00170         CPSSizedParticle::serialSizeScheme(f);
00171         CPSRotated3DPlaneParticle::serialPlaneBasisScheme(f);
00172         CPSRotated2DParticle::serialAngle2DScheme(f);
00173         f.serial(_Shape);
00174         <font class="keywordflow">if</font> (f.isReading())
00175         {
00176                 invalidate();
00177         }
00178 }
00179 
00180 
00181 <font class="comment">//====================================================================================</font>
<a name="l00182"></a><a class="code" href="classNL3D_1_1CPSMesh.html#a9">00182</a> uint32 CPSMesh::getMaxNumFaces(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
00183 <font class="keyword"></font>{
00185         <font class="keywordflow">return</font> 0;
00186 }
00187 
00188 <font class="comment">//====================================================================================</font>
<a name="l00189"></a><a class="code" href="classNL3D_1_1CPSMesh.html#a7">00189</a> <font class="keywordtype">bool</font> CPSMesh::hasTransparentFaces(<font class="keywordtype">void</font>)
00190 {
00192         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00193 }
00194 
00195 <font class="comment">//====================================================================================</font>
<a name="l00196"></a><a class="code" href="classNL3D_1_1CPSMesh.html#a8">00196</a> <font class="keywordtype">bool</font> CPSMesh::hasOpaqueFaces(<font class="keywordtype">void</font>)
00197 {
00199         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00200 }
00201 
00202 <font class="comment">//====================================================================================</font>
<a name="l00203"></a><a class="code" href="classNL3D_1_1CPSMesh.html#b0">00203</a> <font class="keywordtype">void</font> CPSMesh::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
00204 {
00205         <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#b1">newPlaneBasisElement</a>(emitterLocated, emitterIndex);
00206         <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#b1">newAngle2DElement</a>(emitterLocated, emitterIndex);
00207         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b1">newSizeElement</a>(emitterLocated, emitterIndex);
00208 
00209         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
00210         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner());
00211 
00212         CScene *scene = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getScene();
00213         <a class="code" href="debug_8h.html#a6">nlassert</a>(scene); <font class="comment">// the setScene method of the particle system should have been called</font>
00214         <font class="comment">//CTransformShape *instance = _Shape-&gt;createInstance(*scene);</font>
00215 
00216         CTransformShape *instance = scene-&gt;createInstance(<a class="code" href="classNL3D_1_1CPSMesh.html#n0">_Shape</a>);
00217 
00218         <font class="keywordflow">if</font> (!instance)
00219         {
00220                 
00221                 <font class="comment">// mesh not found ...</font>
00222                 IShape *is = <a class="code" href="namespaceNL3D.html#a429">CreateDummyShape</a>();
00223                 scene-&gt;getShapeBank()-&gt;add(<a class="code" href="namespaceNL3D.html#a428">DummyShapeName</a>, is);
00224                 instance = scene-&gt;createInstance(<a class="code" href="namespaceNL3D.html#a428">DummyShapeName</a>);
00225                 <a class="code" href="debug_8h.html#a6">nlassert</a>(instance);
00226         }
00227 
00228 
00229         instance-&gt;setTransformMode(CTransform::DirectMatrix);
00230 
00231         instance-&gt;hide(); <font class="comment">// the object hasn't the right matrix yet so we hide it. It'll be shown once it is computed</font>
00232         <a class="code" href="debug_8h.html#a6">nlassert</a>(instance);
00233 
00234         <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.insert(instance);
00235 }
00236 
00237 <font class="comment">//====================================================================================  </font>
<a name="l00238"></a><a class="code" href="classNL3D_1_1CPSMesh.html#b1">00238</a> <font class="keywordtype">void</font> CPSMesh::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
00239 {       
00240         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b2">deleteSizeElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00241         <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#b2">deleteAngle2DElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00242         <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#b2">deletePlaneBasisElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00243 
00244         <font class="comment">// check wether CTransformShape have been instanciated</font>
00245         <font class="keywordflow">if</font> (_Invalidated) <font class="keywordflow">return</font>;
00246 
00247         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
00248         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner());
00249 
00250         CScene *scene = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getScene();
00251         <a class="code" href="debug_8h.html#a6">nlassert</a>(scene); <font class="comment">// the setScene method of the particle system should have been called</font>
00252 
00253         scene-&gt;deleteInstance(<a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]);
00254         <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00255 }
00256 
00257 <font class="comment">//====================================================================================</font>
<a name="l00258"></a><a class="code" href="classNL3D_1_1CPSMesh.html#b2">00258</a> <font class="keywordtype">void</font> CPSMesh::step(<a class="code" href="namespaceNL3D.html#a484">TPSProcessPass</a> pass, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> realEt)
00259 {
00260                 <font class="keywordflow">if</font> (pass == <a class="code" href="namespaceNL3D.html#a484a169">PSSolidRender</a>)                      
00261                 {
00262                         <a class="code" href="classNL3D_1_1CPSMesh.html#b3">updatePos</a>();
00263                 }
00264                 <font class="keywordflow">else</font> 
00265                 <font class="keywordflow">if</font> (pass == <a class="code" href="namespaceNL3D.html#a484a171">PSToolRender</a>) <font class="comment">// edition mode only</font>
00266                 {                       
00267                         <a class="code" href="classNL3D_1_1CPSParticle.html#a8">showTool</a>();
00268                 }
00269 
00270 }
00271 
00272 <font class="comment">//====================================================================================</font>
<a name="l00273"></a><a class="code" href="classNL3D_1_1CPSMesh.html#b3">00273</a> <font class="keywordtype">void</font> CPSMesh::updatePos()
00274 {
00275         <font class="keyword">const</font> uint MeshBufSize = 512;
00276         PARTICLES_CHECK_MEM;
00277         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
00278         <font class="keyword">const</font> uint32 size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
00279         <font class="keywordflow">if</font> (!size) <font class="keywordflow">return</font>;
00280 
00281 
00282         <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;incrementNbDrawnParticles(size); <font class="comment">// for benchmark purpose       </font>
00283 
00284 
00285         <font class="keywordflow">if</font> (_Invalidated)
00286         {
00287                 <font class="comment">// need to rebuild all the transform shapes</font>
00288                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
00289                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner());
00290 
00291                 CScene *scene = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getScene();
00292                 <a class="code" href="debug_8h.html#a6">nlassert</a>(scene); <font class="comment">// the setScene method of the particle system should have been called</font>
00293         
00294 
00295                 <a class="code" href="classNL3D_1_1CPSMesh.html#b4">resize</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize());
00296 
00297                 <font class="keywordflow">for</font> (uint k = 0; k &lt; size; ++k)
00298                 {
00299                         CTransformShape *instance = scene-&gt;createInstance(<a class="code" href="classNL3D_1_1CPSMesh.html#n0">_Shape</a>);
00300                         instance-&gt;setTransformMode(CTransform::DirectMatrix);
00301                         instance-&gt;hide();
00302                         <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.insert(instance);
00303                 }
00304 
00305                 <a class="code" href="classNL3D_1_1CPSMesh.html#n2">_Invalidated</a> = <font class="keyword">false</font>;
00306         }
00307         
00308         <font class="keywordtype">float</font> sizes[MeshBufSize];
00309         <font class="keywordtype">float</font> angles[MeshBufSize];
00310         <font class="keyword">static</font> CPlaneBasis planeBasis[MeshBufSize];
00311 
00312         uint32 leftToDo = size, toProcess;
00313 
00314 
00315         <font class="keywordtype">float</font> *ptCurrSize;
00316         <font class="keyword">const</font> uint  ptCurrSizeIncrement = <a class="code" href="classNL3D_1_1CPSSizedParticle.html#n1">_SizeScheme</a> ? 1 : 0;
00317 
00318         <font class="keywordtype">float</font> *ptCurrAngle;
00319         <font class="keyword">const</font> uint  ptCurrAngleIncrement = <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#n1">_Angle2DScheme</a> ? 1 : 0;
00320 
00321         CPlaneBasis *ptBasis;
00322         <font class="keyword">const</font> uint  ptCurrPlaneBasisIncrement = <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#n0">_PlaneBasisScheme</a> ? 1 : 0;
00323 
00324         TPSAttribVector::const_iterator posIt = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(), endPosIt;
00325 
00326 
00327         TInstanceCont::iterator instanceIt = <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.begin();
00328 
00329         <font class="keywordflow">do</font>
00330         {
00331                 toProcess = leftToDo &lt; MeshBufSize ? leftToDo : MeshBufSize;
00332 
00333                 <font class="keywordflow">if</font> (_SizeScheme)
00334                 {
00335                         ptCurrSize  = (<font class="keywordtype">float</font> *) (<a class="code" href="classNL3D_1_1CPSSizedParticle.html#n1">_SizeScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, size - leftToDo, &amp;sizes[0], <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>));                        
00336                 }
00337                 <font class="keywordflow">else</font>
00338                 {
00339                         ptCurrSize =&amp; <a class="code" href="classNL3D_1_1CPSSizedParticle.html#n0">_ParticleSize</a>;
00340                 }
00341 
00342                 <font class="keywordflow">if</font> (_Angle2DScheme)
00343                 {
00344                         ptCurrAngle  = (<font class="keywordtype">float</font> *) (<a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#n1">_Angle2DScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, size - leftToDo, &amp;angles[0], <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>));                   
00345                 }
00346                 <font class="keywordflow">else</font>
00347                 {
00348                         ptCurrAngle =&amp; <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#n0">_Angle2D</a>;
00349                 }
00350 
00351 
00352                 <font class="keywordflow">if</font> (_PlaneBasisScheme)
00353                 {
00354                         ptBasis  = (CPlaneBasis *) (<a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#n0">_PlaneBasisScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, size - leftToDo, &amp;planeBasis[0], <font class="keyword">sizeof</font>(CPlaneBasis), toProcess, <font class="keyword">true</font>));                    
00355                 }
00356                 <font class="keywordflow">else</font>
00357                 {
00358                         ptBasis = &amp;<a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#n1">_PlaneBasis</a>;
00359                 }
00360 
00361                 endPosIt = posIt + toProcess;           
00362                 CMatrix mat, tmat;              
00363 
00364                 <font class="comment">// the matrix used to get in the right basis</font>
00365                 <font class="keyword">const</font> CMatrix &amp;transfo = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;isInSystemBasis() ? <font class="comment">/*_Owner-&gt;getOwner()-&gt;*/</font><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a15">getSysMat</a>() : CMatrix::Identity;
00366                 <font class="keywordflow">do</font>
00367                 {
00368                         (*instanceIt)-&gt;show();
00369 
00370                         tmat.identity();
00371                         mat.identity();
00372 
00373                         tmat.translate(*posIt);
00374 
00375                         
00376 
00377                         mat.setRot( ptBasis-&gt;X * CPSUtil::getCos((sint32) *ptCurrAngle) + ptBasis-&gt;Y * CPSUtil::getSin((sint32) *ptCurrAngle)
00378                                                 , ptBasis-&gt;X * CPSUtil::getCos((sint32) *ptCurrAngle + 64) + ptBasis-&gt;Y * CPSUtil::getSin((sint32) *ptCurrAngle + 64)
00379                                                 , ptBasis-&gt;X ^ ptBasis-&gt;Y
00380                                           );
00381 
00382                         mat.scale(*ptCurrSize);                 
00383                         
00384                         (*instanceIt)-&gt;setMatrix(transfo * tmat * mat);                 
00385 
00386                         ++instanceIt;
00387                         ++posIt;
00388                         ptCurrSize += ptCurrSizeIncrement;
00389                         ptCurrAngle += ptCurrAngleIncrement;
00390                         ptBasis += ptCurrPlaneBasisIncrement;
00391                 }
00392                 <font class="keywordflow">while</font> (posIt != endPosIt);
00393                 leftToDo -= toProcess;
00394         }
00395         <font class="keywordflow">while</font> (leftToDo);
00396 
00397         PARTICLES_CHECK_MEM;
00398 }
00399 
00400 <font class="comment">//====================================================================================</font>
<a name="l00401"></a><a class="code" href="classNL3D_1_1CPSMesh.html#b4">00401</a> <font class="keywordtype">void</font> CPSMesh::resize(uint32 size)
00402 {
00403         <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
00404         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b3">resizeSize</a>(size);
00405         <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#b3">resizeAngle2D</a>(size);
00406         <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#b3">resizePlaneBasis</a>(size);
00407         <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.resize(size);
00408 }
00409 
00410 
00411 <font class="comment">//====================================================================================</font>
<a name="l00412"></a><a class="code" href="classNL3D_1_1CPSMesh.html#a4">00412</a> CPSMesh::~CPSMesh()
00413 {       
00414         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner())
00415         {       
00416                 CScene *scene = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getScene();
00417                 <a class="code" href="debug_8h.html#a6">nlassert</a>(scene); <font class="comment">// the setScene method of the particle system should have been called</font>
00418 
00419                 <font class="keywordflow">for</font> (TInstanceCont::iterator it = <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSMesh.html#n1">_Instances</a>.end(); ++it)
00420                 {
00421                         scene-&gt;deleteInstance(*it);
00422                 }
00423         }
00424 }
00425 
00427 <font class="comment">// CPSConstraintMesh implementation //</font>
00429 <font class="comment"></font>
00431 <font class="comment">static uint getMeshNumTri(const CMesh &amp;m)</font>
00432 {       
00433         uint numFaces = 0;
00434         <font class="keywordflow">for</font> (uint k = 0; k &lt; m.getNbMatrixBlock(); ++k)
00435         {
00436                 <font class="keywordflow">for</font> (uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>  &lt; m.getNbRdrPass(k); ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00437                 {
00438                         <font class="keyword">const</font> CPrimitiveBlock pb = m.getRdrPassPrimitiveBlock(k, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>);
00439                         numFaces += (pb.getNumLine() &lt;&lt; 1) + pb.getNumTri() + (pb.getNumQuad() &lt;&lt; 1);
00440 
00441                 }
00442         }
00443         <font class="keywordflow">return</font> numFaces;
00444 }
00445 
00446 
00447 <font class="comment">//====================================================================================</font>
00449 <font class="comment">static void CheckForOpaqueAndTransparentFacesInMesh(const CMesh &amp;m, bool &amp;hasTransparentFaces, bool &amp;hasOpaqueFaces)</font>
00450 {
00451         hasTransparentFaces = <font class="keyword">false</font>;
00452         hasOpaqueFaces = <font class="keyword">false</font>;
00453         
00454         <font class="keywordflow">for</font> (uint k = 0; k &lt; m.getNbRdrPass(0); ++k)
00455         {
00456                 <font class="keyword">const</font> CMaterial &amp;currMat = m.getMaterial(m.getRdrPassMaterial(0, k));
00457                 <font class="keywordflow">if</font> (!currMat.getZWrite())
00458                 {
00459                         hasTransparentFaces = <font class="keyword">true</font>;
00460                 }
00461                 <font class="keywordflow">else</font> <font class="comment">// z-buffer write or no blending -&gt; the face is opaque</font>
00462                 {
00463                         hasOpaqueFaces = <font class="keyword">true</font>;
00464                 }
00465         }        
00466 }
00467 
00468 
00469 
<a name="l00475"></a><a class="code" href="classNL3D_1_1CPSConstraintMeshHelper.html">00475</a> <font class="keyword">class </font>CPSConstraintMeshHelper
00476 {
00477 <font class="keyword">public</font>:
00478         <font class="keyword">template</font> &lt;<font class="keyword">class</font> T&gt;      
<a name="l00479"></a><a class="code" href="classNL3D_1_1CPSConstraintMeshHelper.html#d0">00479</a>         <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSConstraintMeshHelper.html#d0">drawMeshs</a>(T posIt, CPSConstraintMesh &amp;m, uint size, uint32 srcStep, <font class="keywordtype">bool</font> opaque)
00480         {
00481                 CMesh                             &amp;mesh = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Shapes[0]);        
00482                 <font class="keyword">const</font> CVertexBuffer   &amp;modelVb = mesh.getVertexBuffer();
00483 
00484                 <font class="comment">// size for model vertices</font>
00485                 <font class="keyword">const</font> uint inVSize        = modelVb.getVertexSize(); <font class="comment">// vertex size                             </font>
00486 
00487                 <font class="comment">// driver setup</font>
00488                 IDriver *driver = m.getDriver();
00489                 m.setupDriverModelMatrix();     
00490 
00491                 <font class="comment">// buffer to compute sizes</font>
00492                 <font class="keywordtype">float</font>                   sizes[<a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>];
00493                 
00494                 <font class="keywordtype">float</font> *ptCurrSize;
00495                 uint ptCurrSizeIncrement = m._SizeScheme ? 1 : 0;
00496 
00497                 T endPosIt;
00498                 uint leftToDo = size, toProcess;                        
00499                 
00501                 CPSConstraintMesh::CMeshDisplay  &amp;md= m._MeshDisplayShare.getMeshDisplay(m._Shapes[0], modelVb.getVertexFormat() 
00502                                                                                                                                 | (m._ColorScheme ? CVertexBuffer::PrimaryColorFlag : 0));
00503 
00504                 m.setupRenderPasses((<font class="keywordtype">float</font>) m._Owner-&gt;getOwner()-&gt;getSystemDate() - m._GlobalAnimDate, md.RdrPasses, opaque);
00505 
00506                 CVertexBuffer &amp;outVb = md.VB;
00507                 <font class="keyword">const</font> uint outVSize = outVb.getVertexSize();
00508                 
00509                 driver-&gt;activeVertexBuffer(outVb);      
00510 
00511                 <font class="comment">// we don't have precomputed mesh there ... so each mesh must be transformed, which is the worst case   </font>
00512                 CPlaneBasis planeBasis[<a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>];
00513                 CPlaneBasis *ptBasis;
00514                 uint ptBasisIncrement = m._PlaneBasisScheme ? 1 : 0;
00515 
00516                 <font class="keyword">const</font> uint nbVerticesInSource   = modelVb.getNumVertices();
00517 
00518                 sint inNormalOff=0;
00519                 sint outNormalOff=0;
00520                 <font class="keywordflow">if</font> (modelVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
00521                 {       
00522                         inNormalOff  =  modelVb.getNormalOff();
00523                         outNormalOff =  outVb.getNormalOff();   
00524                 }
00525                 
00526                 <font class="keywordflow">do</font>
00527                 {
00528                         uint8 *outVertex = (uint8 *) outVb.getVertexCoordPointer();             
00529 
00530                         toProcess = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(leftToDo, <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>);
00531 
00532                         <font class="keywordflow">if</font> (m._SizeScheme)
00533                         {
00534                                 ptCurrSize  = (<font class="keywordtype">float</font> *) (m._SizeScheme-&gt;make(m._Owner, size -leftToDo, &amp;sizes[0], <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>, srcStep));                            
00535                         }
00536                         <font class="keywordflow">else</font>
00537                         {
00538                                 ptCurrSize = &amp;m._ParticleSize;
00539                         }
00540 
00541                         <font class="keywordflow">if</font> (m._PlaneBasisScheme)
00542                         {
00543                                 ptBasis = (CPlaneBasis *) (m._PlaneBasisScheme-&gt;make(m._Owner, size -leftToDo, &amp;planeBasis[0], <font class="keyword">sizeof</font>(CPlaneBasis), toProcess, <font class="keyword">true</font>, srcStep));
00544                         }
00545                         <font class="keywordflow">else</font>
00546                         {
00547                                 ptBasis = &amp;m._PlaneBasis;
00548                         }
00549                         
00550 
00551                         endPosIt = posIt + toProcess;
00552                         <font class="comment">// transfo matrix &amp; scaled transfo matrix;</font>
00553                         CMatrix  M, sM;
00554 
00555                 
00556                         <font class="keywordflow">if</font> (m._Shapes.size() == 1)
00557                         {
00559                                 <font class="keywordflow">do</font>
00560                                 {
00561 
00562                                         uint8 *inVertex = (uint8 *) modelVb.getVertexCoordPointer();
00563                                         uint k = nbVerticesInSource;
00564 
00565                                         <font class="comment">// do we need a normal ?</font>
00566                                         <font class="keywordflow">if</font> (modelVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
00567                                         {
00568                                                 M.identity();
00569                                                 M.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
00570                                                 sM = M;
00571                                                 sM.scale(*ptCurrSize);
00572 
00573                                                 <font class="comment">// offset of normals in the prerotated mesh                             </font>
00574                                                 <font class="keywordflow">do</font>
00575                                                 {
00576                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(modelVb, inVertex); 
00577                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb,        outVertex);   
00578                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(modelVb, inVertex + inNormalOff);   
00579                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb,        outVertex + outNormalOff);    
00580 
00581                                                         <font class="comment">// translate and resize the vertex (relatively to the mesh origin)</font>
00582                                                         *(CVector *) outVertex = *posIt + sM * *(CVector *) inVertex;                                                                           
00583                                                         <font class="comment">// copy the normal</font>
00584                                                         *(CVector *) (outVertex + outNormalOff) = M * *(CVector *) (inVertex + inNormalOff);
00585                                                         
00586 
00587                                                         inVertex  += inVSize;
00588                                                         outVertex += outVSize;
00589                                                 }
00590                                                 <font class="keywordflow">while</font> (--k);
00591                                         }
00592                                         <font class="keywordflow">else</font>
00593                                         {
00594                                                 <font class="comment">// no normal to transform</font>
00595                                                 sM.identity();
00596                                                 sM.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
00597                                                 sM.scale(*ptCurrSize);
00598 
00599                                                 <font class="keywordflow">do</font>
00600                                                 {
00601                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(modelVb, inVertex);
00602                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
00603 
00604                                                         <font class="comment">// translate and resize the vertex (relatively to the mesh origin)</font>
00605                                                         *(CVector *) outVertex = *posIt + sM * *(CVector *) inVertex;                           
00606 
00607                                                         inVertex  += inVSize;
00608                                                         outVertex += outVSize;
00609                                                 }
00610                                                 <font class="keywordflow">while</font> (--k);
00611                                         }
00612 
00613                                         
00614                                         ++posIt;
00615                                         ptCurrSize += ptCurrSizeIncrement;
00616                                         ptBasis += ptBasisIncrement;
00617                                 }
00618                                 <font class="keywordflow">while</font> (posIt != endPosIt);
00619                         }
00620                         <font class="keywordflow">else</font>
00621                         {
00622                                 <font class="comment">// morphed case</font>
00623                                 
00624                                 <font class="comment">// first, compute the morph value for each mesh</font>
00625                                 <font class="keywordtype">float</font>   morphValues[<a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>];
00626                                 <font class="keywordtype">float</font>   *currMorphValue;
00627                                 uint    morphValueIncr;
00628 
00629                                 <font class="keywordflow">if</font> (m._MorphScheme) <font class="comment">// variable case</font>
00630                                 {
00631                                         currMorphValue = (<font class="keywordtype">float</font> *) m._MorphScheme-&gt;make(m._Owner, size - leftToDo, &amp;morphValues[0], <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>, srcStep);
00632                                         morphValueIncr  = 1;
00633                                 }
00634                                 <font class="keywordflow">else</font> 
00635                                 {
00636                                         currMorphValue = &amp;m._MorphValue;
00637                                         morphValueIncr  = 0;
00638                                 }
00639 
00640                                 <font class="keywordflow">do</font>
00641                                 {
00642                                         <font class="keyword">const</font> uint numShapes = m._Shapes.size();
00643                                         <font class="keyword">const</font> uint8 *m0, *m1;
00644                                         <font class="keywordtype">float</font> lambda;
00645                                         <font class="keywordtype">float</font> opLambda;
00646                                         <font class="keyword">const</font> CVertexBuffer *inVB0, *inVB1;
00647                                         <font class="keywordflow">if</font> (*currMorphValue &gt;= numShapes - 1)
00648                                         {
00649                                                 lambda = 0.f;
00650                                                 opLambda = 1.f;
00651                                                 inVB0 = inVB1 = &amp;NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Shapes[numShapes - 1])-&gt;getVertexBuffer();
00652                                         }
00653                                         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (*currMorphValue &lt;= 0)
00654                                         {
00655                                                 lambda = 0.f;
00656                                                 opLambda = 1.f;
00657                                                 inVB0 = inVB1 = &amp;NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Shapes[0])-&gt;getVertexBuffer();
00658                                         }
00659                                         <font class="keywordflow">else</font>
00660                                         {
00661                                                 uint iMeshIndex = (uint) *currMorphValue;
00662                                                 lambda = *currMorphValue - iMeshIndex;
00663                                                 opLambda = 1.f - lambda;
00664                                                 inVB0 = &amp;NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Shapes[iMeshIndex])-&gt;getVertexBuffer();
00665                                                 inVB1 = &amp;NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Shapes[iMeshIndex + 1])-&gt;getVertexBuffer();
00666                                         }
00667 
00668                                         m0 = (uint8 *) inVB0-&gt;getVertexCoordPointer();
00669                                         m1 = (uint8 *) inVB1-&gt;getVertexCoordPointer();
00670 
00671                                                         
00672                                         uint k = nbVerticesInSource;
00673                                         <font class="comment">// do we need a normal ?</font>
00674                                         <font class="keywordflow">if</font> (modelVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
00675                                         {
00676                                                 M.identity();
00677                                                 M.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
00678                                                 sM = M;
00679                                                 sM.scale(*ptCurrSize);
00680 
00681                                                 <font class="comment">// offset of normals in the prerotated mesh                             </font>
00682                                                 <font class="keywordflow">do</font>
00683                                                 {
00684                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB0),     m0);                                                  
00685                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB1),     m1);  
00686                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB0),     m0 + inNormalOff);                    
00687                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB1),     m1 + inNormalOff);
00688                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb,        outVertex);                                                   
00689                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb,        outVertex + outNormalOff);    
00690 
00691                                                         <font class="comment">// morph, and transform the vertex</font>
00692                                                         *(CVector *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + lambda * *(CVector *) m1);
00693                                                         <font class="comment">// morph, and transform the normal</font>
00694                                                         *(CVector *) (outVertex + outNormalOff) = M * (opLambda * *(CVector *) (m0 + inNormalOff)
00695                                                                                                                                                   + lambda * *(CVector *) (m1 + inNormalOff)).normed();
00696                                                         
00697 
00698                                                         m0  += inVSize;
00699                                                         m1  += inVSize;
00700                                                         outVertex += outVSize;
00701                                                 }
00702                                                 <font class="keywordflow">while</font> (--k);
00703                                         }
00704                                         <font class="keywordflow">else</font>
00705                                         {
00706                                                 <font class="comment">// no normal to transform</font>
00707                                                 sM.identity();
00708                                                 sM.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
00709                                                 sM.scale(*ptCurrSize);
00710 
00711                                                 <font class="keywordflow">do</font>
00712                                                 {                       
00713                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB0),     m0);                                                  
00714                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB1),     m1);          
00715                                                         <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
00716                                                         <font class="comment">// morph, and transform the vertex</font>
00717                                                         *(CVector *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + opLambda * *(CVector *) m1);
00718 
00719                                                         m0  += inVSize;
00720                                                         m1  += inVSize;
00721                                                         outVertex += outVSize;
00722                                                 }
00723                                                 <font class="keywordflow">while</font> (--k);
00724                                         }
00725 
00726                                         
00727                                         ++posIt;
00728                                         ptCurrSize += ptCurrSizeIncrement;
00729                                         ptBasis += ptBasisIncrement;
00730                                         currMorphValue += morphValueIncr;
00731                                 }
00732                                 <font class="keywordflow">while</font> (posIt != endPosIt);
00733                         }               
00734 
00735                         <font class="comment">// compute colors if needed</font>
00736                         <font class="keywordflow">if</font> (m._ColorScheme)
00737                         {
00738                                 m.computeColors(outVb, modelVb, size - leftToDo, toProcess, srcStep);
00739                         }
00740                         
00741                         <font class="comment">// render meshs</font>
00742                         m.doRenderPasses(driver, toProcess, md.RdrPasses, opaque);
00743                         leftToDo -= toProcess;
00744 
00745                 }
00746                 <font class="keywordflow">while</font> (leftToDo);
00747         }
00748 
00749 
00750         <font class="keyword">template</font> &lt;<font class="keyword">class</font> T, <font class="keyword">class</font> U&gt;     
<a name="l00751"></a><a class="code" href="classNL3D_1_1CPSConstraintMeshHelper.html#d1">00751</a>         <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSConstraintMeshHelper.html#d1">drawPrerotatedMeshs</a>(T posIt,
00752                                                                     U indexIt,
00753                                                                         CPSConstraintMesh &amp;m,
00754                                                                         uint size,
00755                                                                         uint32 srcStep,
00756                                                                         <font class="keywordtype">bool</font> opaque,
00757                                                                         <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime)
00758         {
00759                 <font class="comment">// get the vb from the original mesh</font>
00760                 CMesh                             &amp;mesh = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Shapes[0]);        
00761                 <font class="keyword">const</font> CVertexBuffer   &amp;modelVb = mesh.getVertexBuffer();
00762 
00764                 CVertexBuffer &amp;prerotVb  = m.makePrerotatedVb(modelVb, ellapsedTime);   
00765 
00766                 <font class="comment">// driver setup</font>
00767                 IDriver *driver = m.getDriver();
00768                 m.setupDriverModelMatrix();     
00769 
00770                 <font class="comment">// renderPasses setup</font>
00771                 <a class="code" href="debug_8h.html#a6">nlassert</a>(m._Owner)      
00772 
00773                 <font class="comment">// storage for sizes of meshs</font>
00774                 <font class="keywordtype">float</font> sizes[<a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>];
00775                 
00776                 <font class="comment">// point the size for the current mesh</font>
00777                 <font class="keywordtype">float</font> *ptCurrSize;
00778                 uint ptCurrSizeIncrement = m._SizeScheme ? 1 : 0;
00779 
00780                 T endPosIt;
00781                 uint leftToDo = size, toProcess;
00782                 <font class="keyword">const</font> uint nbVerticesInSource = modelVb.getNumVertices();
00783                 
00784 
00785 
00786                 <font class="comment">// size of a complete prerotated model</font>
00787                 <font class="keyword">const</font> uint prerotatedModelSize = prerotVb.getVertexSize() * modelVb.getNumVertices();
00788 
00790                 CPSConstraintMesh::CMeshDisplay  &amp;md    = m._MeshDisplayShare.getMeshDisplay(m._Shapes[0], modelVb.getVertexFormat() 
00791                                                                                                                                 | (m._ColorScheme ? CVertexBuffer::PrimaryColorFlag : 0));
00792 
00793 
00794                 m.setupRenderPasses((<font class="keywordtype">float</font>) m._Owner-&gt;getOwner()-&gt;getSystemDate() - m._GlobalAnimDate, md.RdrPasses, opaque);
00795 
00796                 CVertexBuffer &amp;outVb = md.VB;
00797 
00798                 driver-&gt;activeVertexBuffer(outVb);
00799 
00800 
00801                 <font class="comment">// size of vertices in prerotated model</font>
00802                 <font class="keyword">const</font> uint inVSize = prerotVb.getVertexSize();
00803 
00804                 <font class="comment">// size ofr vertices in dest vb</font>
00805                 <font class="keyword">const</font> uint outVSize = outVb.getVertexSize();
00806 
00807                 <font class="comment">// offset of normals in vertices of the prerotated model, and source model              </font>
00808                 uint normalOff=0;
00809                 uint pNormalOff=0;
00810                 <font class="keywordflow">if</font> (prerotVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag) 
00811                 {
00812                         normalOff  =  outVb.getNormalOff();
00813                         pNormalOff =  prerotVb.getNormalOff();                  
00814                 }
00815                                         
00816                 <font class="keywordflow">do</font>
00817                 {                       
00818                         toProcess = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(leftToDo, <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>);
00819 
00820                         <font class="keywordflow">if</font> (m._SizeScheme)
00821                         {
00822                                 <font class="comment">// compute size</font>
00823                                 ptCurrSize = (<font class="keywordtype">float</font> *) (m._SizeScheme-&gt;make(m._Owner, size - leftToDo, &amp;sizes[0], <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>, srcStep));                            
00824                         }
00825                         <font class="keywordflow">else</font>
00826                         {
00827                                 <font class="comment">// pointer on constant size</font>
00828                                 ptCurrSize = &amp;m._ParticleSize;
00829                         }
00830 
00831                         endPosIt = posIt + toProcess;
00832                         uint8 *outVertex  = (uint8 *) outVb.getVertexCoordPointer();
00834                         <font class="keywordflow">do</font>
00835                         {
00836                                 uint8 *inVertex = (uint8 *) prerotVb.getVertexCoordPointer() + prerotatedModelSize * *indexIt; <font class="comment">// prerotated vertex                     </font>
00837                                 uint k = nbVerticesInSource;
00838                                 
00839                                 <font class="keywordflow">if</font> (prerotVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag) <font class="comment">// has it a normal ?</font>
00840                                 {
00841                                         <font class="keywordflow">do</font>
00842                                         {
00843                                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
00844                                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(prerotVb, inVertex);
00845                                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex + normalOff);
00846                                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(prerotVb, inVertex + pNormalOff);
00847 
00848 
00849                                                 <font class="comment">// translate and resize the vertex (relatively to the mesh origin)</font>
00850                                                 *(CVector *)  outVertex                                          = *posIt + *ptCurrSize * *(CVector *) inVertex;
00851                                                 <font class="comment">// copy the normal</font>
00852                                                 *(CVector *)  (outVertex + normalOff ) = *(CVector *) (inVertex + pNormalOff);
00853                                                 inVertex  += inVSize;
00854                                                 outVertex += outVSize;
00855                                         }
00856                                         <font class="keywordflow">while</font> (--k);
00857                                 }
00858                                 <font class="keywordflow">else</font>
00859                                 {
00860                                         <font class="keywordflow">do</font>
00861                                         {                                       
00862                                                 <font class="comment">// translate and resize the vertex (relatively to the mesh origin)</font>
00863                                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
00864                                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(prerotVb, inVertex);
00865                                                 *(CVector *)  outVertex = *posIt + *ptCurrSize * *(CVector *) inVertex;                                                                                                 
00866                                                 inVertex  += inVSize;
00867                                                 outVertex += outVSize;
00868                                         }
00869                                         <font class="keywordflow">while</font> (--k);
00870                                 }
00871                                 
00872                                 ++indexIt;
00873                                 ++posIt;
00874                                 ptCurrSize += ptCurrSizeIncrement;
00875                         }
00876                         <font class="keywordflow">while</font> (posIt != endPosIt);
00877 
00878                         <font class="comment">// compute colors if needed</font>
00879                         <font class="keywordflow">if</font> (m._ColorScheme)
00880                         {
00881                                 m.computeColors(outVb, modelVb, size - leftToDo, toProcess, srcStep);
00882                         }
00883                                         
00884 
00886                         m.doRenderPasses(driver, toProcess, md.RdrPasses, opaque);
00887                         leftToDo -= toProcess;
00888 
00889                 }
00890                 <font class="keywordflow">while</font> (leftToDo);
00891                 PARTICLES_CHECK_MEM
00892         }
00893 };
00894 
<a name="l00895"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a0">00895</a> CPSConstraintMesh::CPSConstraintMesh() : _NumFaces(0),
00896                                                                                  _ModelBank(NULL),
00897                                                                                  _ModulatedStages(0),
00898                                                                                  _Touched(1),
00899                                                                                  _VertexColorLightingForced(false),
00900                                                                                  _GlobalAnimationEnabled(0),
00901                                                                                  _ReinitGlobalAnimTimeOnNewElement(0),
00902                                                                                  _MorphValue(0),
00903                                                                                  _MorphScheme(NULL)
00904 {               
00905         <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n3">_Name</a> = std::string(<font class="stringliteral">"ConstraintMesh"</font>);
00906 }
00907 
00908 <font class="comment">//====================================================================================</font>
<a name="l00909"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a21">00909</a> uint32 CPSConstraintMesh::getMaxNumFaces(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
00910 <font class="keyword"></font>{
00911 <font class="comment">//      nlassert(_ModelVb);</font>
00912         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n2">_NumFaces</a> * <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize();
00913         
00914 }
00915 
00916 
00917 <font class="comment">//====================================================================================</font>
<a name="l00918"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a19">00918</a> <font class="keywordtype">bool</font> CPSConstraintMesh::hasTransparentFaces(<font class="keywordtype">void</font>)
00919 {
00920         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a>) <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n10">_HasTransparentFaces</a> != 0;
00922         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b10">update</a>();
00923         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n10">_HasTransparentFaces</a> != 0;
00924 }
00925 
00926 <font class="comment">//====================================================================================</font>
<a name="l00927"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a20">00927</a> <font class="keywordtype">bool</font> CPSConstraintMesh::hasOpaqueFaces(<font class="keywordtype">void</font>)
00928 {
00929         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a>) <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n11">_HasOpaqueFaces</a> != 0;     
00930         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b10">update</a>();
00931         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n11">_HasOpaqueFaces</a> != 0;
00932 }
00933 
00934 <font class="comment">//====================================================================================</font>
<a name="l00935"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a2">00935</a> <font class="keywordtype">void</font> CPSConstraintMesh::setShape(<font class="keyword">const</font> std::string &amp;meshFileName)
00936 {       
00937         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.resize(1);   
00938         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[0] = meshFileName;
00939         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a> = 1;
00940 }
00941 
00942 
00943 <font class="comment">//===========================================================================</font>
<a name="l00944"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a3">00944</a> std::string                     CPSConstraintMesh::getShape(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
00945 <font class="keyword"></font>{
00946         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size() == 1);
00947         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[0];
00948 }
00949 
00950 <font class="comment">//====================================================================================</font>
<a name="l00951"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a4">00951</a> <font class="keywordtype">void</font>            CPSConstraintMesh::setShapes(<font class="keyword">const</font> std::string *shapesNames, uint numShapes)
00952 {
00953         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.resize(numShapes);
00954         std::copy(shapesNames, shapesNames + numShapes, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.begin());
00955         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a> = 1;
00956 }
00957 
00958 <font class="comment">//====================================================================================</font>
<a name="l00959"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a7">00959</a> uint        CPSConstraintMesh::getNumShapes()<font class="keyword"> const</font>
00960 <font class="keyword"></font>{
00961         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size();
00962 }
00963 
00964 <font class="comment">//====================================================================================</font>
<a name="l00965"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a8">00965</a> <font class="keywordtype">void</font>    CPSConstraintMesh::getShapesNames(std::string *shapesNames)<font class="keyword"> const</font>
00966 <font class="keyword"></font>{
00967         std::copy(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.begin(), <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.end(), shapesNames);
00968 }
00969 
00970 
00971 
00972 <font class="comment">//====================================================================================</font>
<a name="l00973"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a5">00973</a> <font class="keywordtype">void</font>            CPSConstraintMesh::setShape(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">const</font> std::string &amp;shapeName)
00974 {
00975         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size());
00976         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = shapeName;
00977         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a> = 1;
00978 }
00979 
00980         
00981 <font class="comment">//====================================================================================</font>
<a name="l00982"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a6">00982</a> <font class="keyword">const</font> std::string          &amp;CPSConstraintMesh::getShape(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
00983 <font class="keyword"></font>{
00984         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size());
00985         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
00986 }
00987 
00988 
00989 
00990 <font class="comment">//====================================================================================</font>
<a name="l00991"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a9">00991</a> <font class="keywordtype">void</font>    CPSConstraintMesh::setMorphValue(<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
00992 {
00993         <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>;
00994         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a> = NULL;
00995         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_0">_MorphValue</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>;
00996 }
00997 
00998 
00999 <font class="comment">//====================================================================================</font>
<a name="l01000"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a10">01000</a> <font class="keywordtype">float</font>   CPSConstraintMesh::getMorphValue()<font class="keyword"> const</font>
01001 <font class="keyword"></font>{
01002         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_0">_MorphValue</a>;
01003 }
01004 
01005 <font class="comment">//====================================================================================</font>
<a name="l01006"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a11">01006</a> <font class="keywordtype">void</font>    CPSConstraintMesh::setMorphScheme(CPSAttribMaker&lt;float&gt; *scheme)
01007 {
01008         <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>;
01009         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a> = scheme;
01010         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;resize(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize(), <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize());
01011 }
01012 
01013 <font class="comment">//====================================================================================</font>
<a name="l01014"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a12">01014</a> CPSAttribMaker&lt;float&gt;           *CPSConstraintMesh::getMorphScheme()
01015 {
01016         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>;
01017 }
01018 
01019 <font class="comment">//====================================================================================</font>
<a name="l01020"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a13">01020</a> <font class="keyword">const</font> CPSAttribMaker&lt;float&gt;     *CPSConstraintMesh::getMorphScheme()<font class="keyword"> const</font>
01021 <font class="keyword"></font>{
01022         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>;
01023 }
01024 
01025 
01026 <font class="comment">//====================================================================================</font>
01027 <font class="keyword">static</font> IShape *<a class="code" href="namespaceNL3D.html#a432">GetDummyShapeFromBank</a>(CShapeBank &amp;sb)
01028 {       
01029         <font class="keyword">static</font> <font class="keyword">const</font> std::string dummyMeshName(<font class="stringliteral">"dummy constraint mesh shape"</font>);
01030         <font class="keywordflow">if</font> (sb.isPresent(dummyMeshName) == CShapeBank::Present)
01031         {                               
01032                 <font class="keywordflow">return</font> sb.addRef(dummyMeshName);
01033         }
01034         <font class="keywordflow">else</font>
01035         {
01036                 <font class="comment">// no dummy shape created -&gt; add one to the bank</font>
01037                 IShape *is = <a class="code" href="namespaceNL3D.html#a429">CreateDummyShape</a>();
01038                 sb.add(std::string(<font class="stringliteral">"dummy constraint mesh shape"</font>), is);
01039                 <font class="keywordflow">return</font> is;
01040         }
01041 }
01042 
01043 <font class="comment">//====================================================================================</font>
<a name="l01044"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b10">01044</a> <font class="keywordtype">bool</font> CPSConstraintMesh::update(<font class="keywordtype">void</font>)
01045 {               
01046         <font class="keywordtype">bool</font> ok = <font class="keyword">true</font>;
01047         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a>) <font class="keywordflow">return</font> ok;
01048 
01049         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b16">clean</a>();
01050         
01051         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getScene());
01052 
01053         CScene *scene = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getScene();
01054         CShapeBank *sb = scene-&gt;getShapeBank();
01055         IShape *is;
01056 
01057 
01058         uint32 vFormat=0;
01059         uint   numVerts=0;      
01060 
01061         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size() == 0)
01062         {
01063                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.resize(1);
01064                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[0] = <a class="code" href="namespaceNL3D.html#a428">DummyShapeName</a>;         
01065         }
01066         
01067 
01068         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.resize(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size());      
01069         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>.size(); ++k)
01070         {
01071                 <font class="keywordflow">if</font> (sb-&gt;isPresent(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k]) == CShapeBank::Present)
01072                 {
01073                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[k] = sb-&gt;addRef(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k]);
01074 
01076                         <font class="keyword">const</font> CMesh &amp;m  = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[k]); <font class="comment">// only mesh shape's can be used with this class!</font>
01077                         <font class="keywordflow">if</font> (k == 0)
01078                         {                       
01079                                 vFormat = m.getVertexBuffer().getVertexFormat();
01080                                 numVerts =  m.getVertexBuffer().getNumVertices();
01081                         }
01082                         <font class="keywordflow">else</font>
01083                         {
01084                                 <font class="keywordflow">if</font> (vFormat != m.getVertexBuffer().getVertexFormat()
01085                                         || numVerts != m.getVertexBuffer().getNumVertices())
01086                                 {
01087                                         ok = <font class="keyword">false</font>;
01088                                 }
01089                         }
01090                 }
01091                 <font class="keywordflow">else</font>
01092                 {
01093                         <font class="keywordflow">try</font>
01094                         {
01095                                 sb-&gt;load(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k]);
01096                         }       
01097                         <font class="keywordflow">catch</font> (<a class="code" href="structNLMISC_1_1EPathNotFound.html">NLMISC::EPathNotFound</a> &amp;)
01098                         {
01099                                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"mesh not found : %s; used as a constraint mesh particle"</font>, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k].c_str());
01100                                 <font class="comment">// shape not found, so not present in the shape bank -&gt; we create a dummy shape</font>
01101                         }
01102 
01103                         <font class="keywordflow">if</font> (sb-&gt;isPresent(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k]) != CShapeBank::Present)
01104                         {                                       
01105                                 ok = <font class="keyword">false</font>;
01106                         }
01107                         <font class="keywordflow">else</font>
01108                         {
01109                                 is = sb-&gt;addRef(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k]);
01110                                 <font class="keywordflow">if</font> (!dynamic_cast&lt;CMesh *&gt;(is)) <font class="comment">// is it a mesh</font>
01111                                 {
01112                                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Tried to bind a shape that is not a mesh to a mesh particle : %s"</font>, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k].c_str());
01113                                         sb-&gt;release(is);                                        
01114                                         ok = <font class="keyword">false</font>;
01115                                 }
01116                                 <font class="keywordflow">else</font>
01117                                 {
01118                                         <font class="keyword">const</font> CMesh &amp;m  = * NLMISC::safe_cast&lt;CMesh *&gt;(is);
01120                                         <font class="keywordflow">if</font> (m.getVertexBuffer().getNumVertices() &gt; <a class="code" href="namespaceNL3D.html#a211">ConstraintMeshMaxNumVerts</a>)
01121                                         {
01122                                                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Tried to bind a mesh that has more than %d vertices to a particle mesh: %s"</font>, (<font class="keywordtype">int</font>) <a class="code" href="namespaceNL3D.html#a211">ConstraintMeshMaxNumVerts</a>, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n0">_MeshShapeFileName</a>[k].c_str());
01123                                                 sb-&gt;release(is);                                                
01124                                                 ok = <font class="keyword">false</font>;
01125                                         }
01126                                         <font class="keywordflow">else</font>
01127                                         {
01128                                                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[k] = is;
01130                                                 <font class="keyword">const</font> CMesh &amp;m  = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[k]); <font class="comment">// only mesh shape's can be used with this class!</font>
01131                                                 <font class="keywordflow">if</font> (k == 0)
01132                                                 {                       
01133                                                         vFormat = m.getVertexBuffer().getVertexFormat();
01134                                                         numVerts =  m.getVertexBuffer().getNumVertices();
01135                                                 }
01136                                                 <font class="keywordflow">else</font>
01137                                                 {
01138                                                         <font class="keywordflow">if</font> (vFormat != m.getVertexBuffer().getVertexFormat()
01139                                                                 || numVerts != m.getVertexBuffer().getNumVertices())
01140                                                         {
01141                                                                 ok = <font class="keyword">false</font>;
01142                                                         }
01143                                                 }
01144                                         }
01145                                 }
01146                         }
01147                 }
01148                 
01149                 <font class="keywordflow">if</font> (!ok)
01150                 {
01151                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b7">releaseShapes</a>();
01152                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.resize(1);
01153                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[0] = <a class="code" href="namespaceNL3D.html#a432">GetDummyShapeFromBank</a>(*sb);
01154                         <font class="keywordflow">break</font>;
01155                 }
01156         }
01157 
01158 
01159         <font class="keyword">const</font> CMesh &amp;m  = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[0]); <font class="comment">// only mesh shape's can be used with this class!</font>
01160 
01162         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n2">_NumFaces</a> = <a class="code" href="namespaceNL3D.html#a430">getMeshNumTri</a>(m);
01163         <a class="code" href="classNL3D_1_1CPSParticle.html#b0">notifyOwnerMaxNumFacesChanged</a>();
01164         
01166         <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a19">hasTransparentFaces</a>, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a20">hasOpaqueFaces</a>;
01167         <a class="code" href="namespaceNL3D.html#a431">CheckForOpaqueAndTransparentFacesInMesh</a>(m, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a19">hasTransparentFaces</a>, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a20">hasOpaqueFaces</a>);
01168         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n10">_HasTransparentFaces</a> = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a19">hasTransparentFaces</a>;     
01169         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n11">_HasOpaqueFaces</a> = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a20">hasOpaqueFaces</a>;
01170         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n3">_ModelBank</a> = sb;        
01171         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n16">_GlobalAnimDate</a> = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getSystemDate();
01172         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n9">_Touched</a> = 0;
01173         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.size() &gt; 0);
01174 
01175 <font class="preprocessor">        #ifdef NL_DEBUG</font>
01176 <font class="preprocessor"></font>                <font class="keywordflow">for</font> (uint j = 0; j &lt; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.size(); ++j)
01177                 {
01178                         <a class="code" href="debug_8h.html#a6">nlassert</a>(dynamic_cast&lt;CMesh *&gt;((IShape *) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[j]));
01179                 }
01180 <font class="preprocessor">        #endif</font>
01181 <font class="preprocessor"></font>
01182         <font class="keywordflow">return</font> ok;
01183         
01184 }
01185 
01186 
01187 
01188 <font class="comment">//====================================================================================</font>
<a name="l01189"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a14">01189</a> <font class="keywordtype">void</font> CPSConstraintMesh::hintRotateTheSame(uint32 nbConfiguration,
01190                                                                                   <font class="keywordtype">float</font> minAngularVelocity,
01191                                                                                   <font class="keywordtype">float</font> maxAngularVelocity
01192                                                                                 )
01193 {
01194         <a class="code" href="debug_8h.html#a6">nlassert</a>(nbConfiguration &lt;= <a class="code" href="namespaceNL3D.html#a213">ConstraintMeshMaxNumPrerotatedModels</a>);
01195 
01196         <font class="comment">// TODO : avoid code duplication with CPSFace ...</font>
01197         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n4">_MinAngularVelocity</a> = minAngularVelocity;
01198         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n5">_MaxAngularVelocity</a> = maxAngularVelocity;
01199 
01200 
01201 
01202         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.resize(nbConfiguration);
01203 
01204         <font class="keywordflow">if</font> (nbConfiguration)
01205         {
01206                 <font class="comment">// each precomp basis is created randomly;</font>
01207                 <font class="keywordflow">for</font> (uint k = 0; k &lt; nbConfiguration; ++k)
01208                 {
01209                          CVector <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = <a class="code" href="namespaceNL3D.html#a421">MakeRandomUnitVect</a>();
01210                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>[k].Basis = CPlaneBasis(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>);
01211                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>[k].Axis = <a class="code" href="namespaceNL3D.html#a421">MakeRandomUnitVect</a>();
01212                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>[k].AngularVelocity = minAngularVelocity 
01213                                                                                            + (rand() % 20000) / 20000.f * (maxAngularVelocity - minAngularVelocity);
01214 
01215                 }       
01216 
01217                 <font class="comment">// we need to do this because nbConfs may have changed</font>
01218                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b15">fillIndexesInPrecompBasis</a>();
01219         }       
01220 }
01221 
01222 
01223 <font class="comment">//====================================================================================</font>
<a name="l01224"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b15">01224</a> <font class="keywordtype">void</font> CPSConstraintMesh::fillIndexesInPrecompBasis(<font class="keywordtype">void</font>)
01225 {
01226         <font class="comment">// TODO : avoid code duplication with CPSFace ...</font>
01227         <font class="keyword">const</font> uint32 nbConf = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.size();
01228         <font class="keywordflow">if</font> (_Owner)
01229         {
01230                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>.resize( <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize() );
01231         }       
01232         <font class="keywordflow">for</font> (std::vector&lt;uint32&gt;::iterator it = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>.end(); ++it)
01233         {
01234                 *it = rand() % nbConf;
01235         }
01236 }
01237 
01238 <font class="comment">//====================================================================================  </font>
<a name="l01240"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a17">01240</a> <font class="comment">void CPSConstraintMesh::serial(NLMISC::IStream &amp;f) throw(NLMISC::EStream)</font>
01241 {
01242 
01243         sint ver = f.serialVersion(4);
01244         <font class="keywordflow">if</font> (f.isReading())
01245         {
01246                 clean();
01247         }
01248 
01249         CPSParticle::serial(f);
01250         CPSSizedParticle::serialSizeScheme(f);
01251         CPSRotated3DPlaneParticle::serialPlaneBasisScheme(f);
01252 
01253         <font class="comment">// prerotations ...</font>
01254 
01255         <font class="keywordflow">if</font> (f.isReading())
01256         {
01257                 uint32 nbConfigurations;
01258                 f.serial(nbConfigurations);
01259                 <font class="keywordflow">if</font> (nbConfigurations)
01260                 {
01261                         f.serial(_MinAngularVelocity, _MaxAngularVelocity);             
01262                 }
01263                 hintRotateTheSame(nbConfigurations, _MinAngularVelocity, _MaxAngularVelocity);  
01264         }
01265         <font class="keywordflow">else</font>    
01266         {                               
01267                 uint32 nbConfigurations = _PrecompBasis.size();
01268                 f.serial(nbConfigurations);
01269                 <font class="keywordflow">if</font> (nbConfigurations)
01270                 {
01271                         f.serial(_MinAngularVelocity, _MaxAngularVelocity);             
01272                 }
01273         }
01274 
01275         <font class="comment">// saves the model file name, or an empty string if nothing has been set        </font>
01276         <font class="keyword">static</font> std::string emptyStr;
01277 
01278         <font class="keywordflow">if</font> (ver &lt; 4) <font class="comment">// early version : no morphing support</font>
01279         {
01280                 <font class="keywordflow">if</font> (!f.isReading())
01281                 {
01282                         <font class="keywordflow">if</font> (_MeshShapeFileName.size() &gt; 0)
01283                         {
01284                                 f.serial(_MeshShapeFileName[0]);                        
01285                         }
01286                         <font class="keywordflow">else</font>
01287                         {
01288                                 f.serial(emptyStr); 
01289                         }
01290                 }
01291                 <font class="keywordflow">else</font>
01292                 {       
01293                         _MeshShapeFileName.resize(1);                           
01294                         f.serial(_MeshShapeFileName[0]);
01295                         _Touched = <font class="keyword">true</font>;                        
01296                 }
01297         }
01298 
01299         <font class="keywordflow">if</font> (ver &gt; 1)
01300         {
01301                 CPSColoredParticle::serialColorScheme(f);
01302                 f.serial(_ModulatedStages);
01303                 <font class="keywordflow">if</font> (f.isReading())
01304                 {
01305                         <font class="keywordtype">bool</font> vcEnabled;
01306                         f.serial(vcEnabled);
01307                         _VertexColorLightingForced = vcEnabled;
01308                 }
01309                 <font class="keywordflow">else</font>
01310                 {
01311                         <font class="keywordtype">bool</font> vcEnabled = (_VertexColorLightingForced != 0);
01312                         f.serial(vcEnabled);
01313                 }                                               
01314         }
01315 
01316         <font class="keywordflow">if</font> (ver &gt; 2) <font class="comment">// texture animation</font>
01317         {
01318                 <font class="keywordflow">if</font> (f.isReading())
01319                 {
01320                         <font class="keywordtype">bool</font> gaEnabled;
01321                         f.serial(gaEnabled);
01322                         _GlobalAnimationEnabled = gaEnabled;
01323                         <font class="keywordflow">if</font> (gaEnabled)
01324                         {
01325                                 PGlobalTexAnims newPtr(<font class="keyword">new</font> CGlobalTexAnims); <font class="comment">// create new</font>
01326                                 std::swap(_GlobalTexAnims, newPtr);                      <font class="comment">// replace old</font>
01327                                 f.serial(*_GlobalTexAnims);
01328                         }
01329 
01330                         <font class="keywordtype">bool</font> rgt;
01331                         f.serial(rgt);
01332                         _ReinitGlobalAnimTimeOnNewElement = rgt;
01333                 }
01334                 <font class="keywordflow">else</font>
01335                 {
01336                         <font class="keywordtype">bool</font> gaEnabled = (_GlobalAnimationEnabled != 0);
01337                         f.serial(gaEnabled);
01338                         <font class="keywordflow">if</font> (gaEnabled)
01339                         {
01340                                 f.serial(*_GlobalTexAnims);
01341                         }
01342 
01343                         <font class="keywordtype">bool</font> rgt = _ReinitGlobalAnimTimeOnNewElement != 0;
01344                         f.serial(rgt);                  
01345                 }
01346         }
01347 
01348         <font class="keywordflow">if</font> (ver &gt; 3) <font class="comment">// mesh morphing</font>
01349         {
01350                 f.serialCont(_MeshShapeFileName);
01351                 <font class="keywordtype">bool</font> useScheme;
01352                 <font class="keywordflow">if</font> (f.isReading())
01353                 {               
01354                         <font class="keyword">delete</font> _MorphScheme;
01355                 }
01356                 <font class="keywordflow">else</font>
01357                 {
01358                         useScheme = _MorphScheme != NULL;
01359                 }
01360                 f.serial(useScheme);
01361                 <font class="keywordflow">if</font> (useScheme)
01362                 {                               
01363                         f.serialPolyPtr(_MorphScheme);
01364                 }
01365                 <font class="keywordflow">else</font>
01366                 {
01367                         f.serial(_MorphValue);
01368                 }               
01369         }
01370 }
01371 
01372 <font class="comment">//====================================================================================</font>
<a name="l01373"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a1">01373</a> CPSConstraintMesh::~CPSConstraintMesh() 
01374 {
01375         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b16">clean</a>();
01376         <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>;
01377 }
01378 
01379 
01380 
01381 <font class="comment">//====================================================================================</font>
<a name="l01382"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b7">01382</a> <font class="keywordtype">void</font> CPSConstraintMesh::releaseShapes()
01383 {
01384         <font class="keywordflow">for</font> (TShapeVect::iterator it = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.end(); ++it)
01385         {
01386                 <font class="keywordflow">if</font> (*it)
01387                 {
01388                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n3">_ModelBank</a>-&gt;release(*it);
01389                 }
01390         }
01391         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>.clear();
01392 }
01393 
01394 <font class="comment">//====================================================================================</font>
<a name="l01395"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b16">01395</a> <font class="keywordtype">void</font> CPSConstraintMesh::clean(<font class="keywordtype">void</font>)
01396 {       
01397         <font class="keywordflow">if</font> (_ModelBank)
01398         {       
01399                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b7">releaseShapes</a>();                
01400         }
01401 }
01402 
01403 
01404 <font class="comment">//====================================================================================</font>
<a name="l01405"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b11">01405</a> CVertexBuffer &amp;CPSConstraintMesh::makePrerotatedVb(<font class="keyword">const</font> CVertexBuffer &amp;inVb, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime)
01406 {
01407         <font class="comment">// get a VB that has positions and eventually normals</font>
01408         CVertexBuffer &amp;prerotatedVb = inVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag ? <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q2">_PreRotatedMeshVBWithNormal</a> : <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q1">_PreRotatedMeshVB</a>;
01409 
01410         <font class="comment">// size of vertices for source VB</font>
01411         <font class="keyword">const</font> uint vSize = inVb.getVertexSize();
01412 
01413         <font class="comment">// size for vertices in prerotated model</font>
01414         <font class="keyword">const</font> uint vpSize = prerotatedVb.getVertexSize();
01415         
01416 
01417         <font class="comment">// offset of normals in vertices of the prerotated model, and source model              </font>
01418         uint normalOff=0;
01419         uint pNormalOff=0;
01420         <font class="keywordflow">if</font> (prerotatedVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag) 
01421         {
01422                 normalOff  =  inVb.getNormalOff();
01423                 pNormalOff =  prerotatedVb.getNormalOff();                      
01424         }
01425 
01426         <font class="keyword">const</font> uint nbVerticesInSource   = inVb.getNumVertices();
01427                 
01428 
01429         <font class="comment">// rotate basis</font>
01430         <font class="comment">// and compute the set of prerotated meshs that will then duplicated (with scale and translation) to create the Vb of what must be drawn</font>
01431         uint8 *outVertex = (uint8 *) prerotatedVb.getVertexCoordPointer();
01432         <font class="keywordflow">for</font> (std::vector&lt; CPlaneBasisPair &gt;::iterator it = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.end(); ++it)
01433         {
01434                 <font class="comment">// not optimized at all, but this will apply to very few elements anyway...</font>
01435                 CMatrix mat;
01436                 mat.rotate(CQuat(it-&gt;Axis, ellapsedTime * it-&gt;AngularVelocity));
01437                 CVector n = mat * it-&gt;Basis.getNormal();
01438                 it-&gt;Basis = CPlaneBasis(n);
01439         
01440                 mat.identity();
01441                 mat.setRot(it-&gt;Basis.X, it-&gt;Basis.Y, it-&gt;Basis.X ^ it-&gt;Basis.Y);
01442 
01443                 uint8 *inVertex = (uint8 *) inVb.getVertexCoordPointer();
01444 
01445                 uint k = nbVerticesInSource;
01446 
01447                 <font class="comment">// check wether we need to rotate normals as well...</font>
01448                 <font class="keywordflow">if</font> (inVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
01449                 {
01450                 
01451                         <font class="keywordflow">do</font>
01452                         {
01453                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(inVb, inVertex);
01454                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(inVb, inVertex + normalOff);
01455                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(prerotatedVb, outVertex);
01456                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(prerotatedVb, outVertex + pNormalOff);
01457 
01458                                 * (CVector *) outVertex =  mat.mulVector(* (CVector *) inVertex);
01459                                 * (CVector *) (outVertex + normalOff) =  mat.mulVector(* (CVector *) (inVertex + pNormalOff) );
01460                                 outVertex += vpSize;
01461                                 inVertex  += vSize;
01462                                 
01463                         }
01464                         <font class="keywordflow">while</font> (--k);            
01465                 }
01466                 <font class="keywordflow">else</font>
01467                 {
01468                         <font class="comment">// no normal included</font>
01469                         <font class="keywordflow">do</font>
01470                         {       
01471                                 
01472                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(prerotatedVb, outVertex);   
01473                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(inVb, inVertex);                                    
01474 
01475                                 * (CVector *) outVertex =  mat.mulVector(* (CVector *) inVertex);
01476                                 outVertex += vpSize;
01477                                 inVertex += vSize;
01478                         }
01479                         <font class="keywordflow">while</font> (--k);    
01480 
01481                 }
01482         }
01483         <font class="keywordflow">return</font> prerotatedVb;
01484 }
01485 
01486 
01487 <font class="comment">//====================================================================================</font>
<a name="l01488"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">01488</a> <font class="keywordtype">void</font> CPSConstraintMesh::step(<a class="code" href="namespaceNL3D.html#a484">TPSProcessPass</a> pass, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> realEt)
01489 {
01490                 <font class="keywordflow">if</font> (
01491                         (pass == <a class="code" href="namespaceNL3D.html#a484a170">PSBlendRender</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a19">hasTransparentFaces</a>())
01492                         || (pass == <a class="code" href="namespaceNL3D.html#a484a169">PSSolidRender</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a20">hasOpaqueFaces</a>())
01493                         )
01494                 {
01495                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b5">draw</a>(pass == <a class="code" href="namespaceNL3D.html#a484a169">PSSolidRender</a>, ellapsedTime);
01496                 }
01497                 <font class="keywordflow">else</font> 
01498                 <font class="keywordflow">if</font> (pass == <a class="code" href="namespaceNL3D.html#a484a171">PSToolRender</a>) <font class="comment">// edition mode only</font>
01499                 {                       
01500                         <a class="code" href="classNL3D_1_1CPSParticle.html#a8">showTool</a>();
01501                 }
01502 }
01503 
01504 <font class="comment">//====================================================================================</font>
<a name="l01505"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b5">01505</a> <font class="keywordtype">void</font> CPSConstraintMesh::draw(<font class="keywordtype">bool</font> opaque, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime)
01506 {
01507         PARTICLES_CHECK_MEM;
01508         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);       
01509         
01510         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b10">update</a>(); <font class="comment">// update mesh datas if needed</font>
01511         uint32 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>;
01512         uint   numToProcess;
01513         <a class="code" href="classNL3D_1_1CPSParticle.html#b4">computeSrcStep</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>, numToProcess);     
01514         <font class="keywordflow">if</font> (!numToProcess) <font class="keywordflow">return</font>;
01515         <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;incrementNbDrawnParticles(numToProcess); <font class="comment">// for benchmark purpose       </font>
01516 
01517         
01518         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.size() == 0) 
01519         {
01520                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a> == (1 &lt;&lt; 16))
01521                 {
01522                         CPSConstraintMeshHelper::drawMeshs(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(),                                       
01523                                                                                           *<font class="keyword">this</font>,
01524                                                                       numToProcess,
01525                                                                                           <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>,
01526                                                                                           opaque
01527                                                                                          );
01528                 }
01529                 <font class="keywordflow">else</font>
01530                 {       
01531                         CPSConstraintMeshHelper::drawMeshs(<a class="code" href="namespaceNL3D.html#a199">TIteratorVectStep1616</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(), 0, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>),
01532                                                                                           *<font class="keyword">this</font>,
01533                                                                       numToProcess,
01534                                                                                           <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>,
01535                                                                                           opaque
01536                                                                                          );             
01537                 }
01538         }
01539         <font class="keywordflow">else</font>
01540         {
01541                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a> == (1 &lt;&lt; 16))
01542                 {
01543                         CPSConstraintMeshHelper::drawPrerotatedMeshs(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(),
01544                                                                                                              <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>.begin(),
01545                                                                                                                  *<font class="keyword">this</font>,
01546                                                                                                                  numToProcess,
01547                                                                                                                  <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>,
01548                                                                                                                  opaque,
01549                                                                                                                  ellapsedTime
01550                                                                                                             );
01551                 }
01552                 <font class="keywordflow">else</font>
01553                 {       
01554                         <font class="keyword">typedef</font> CAdvance1616Iterator&lt;std::vector&lt;uint32&gt;::const_iterator, uint32&gt; TIndexIterator;
01555                         CPSConstraintMeshHelper::drawPrerotatedMeshs(<a class="code" href="namespaceNL3D.html#a199">TIteratorVectStep1616</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(), 0, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>),
01556                                                                                                                  TIndexIterator(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>.begin(), 0, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>),
01557                                                                                                                  *<font class="keyword">this</font>,
01558                                                                                                                  numToProcess,
01559                                                                                                                  <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b4">step</a>,
01560                                                                                                                  opaque,
01561                                                                                                                  ellapsedTime
01562                                                                                                             );          
01563                 }
01564         }
01565         
01566                 
01567 }
01568 
01569 <font class="comment">//====================================================================================</font>
01570 <font class="comment">// Private func used to force modulation on a material and to store the preious state</font>
01571 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a433">ForceMaterialModulation</a>(CMaterial &amp;destMat, CMaterial &amp;srcMat, uint8 modulatedStages)
01572 {
01573         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
01574         {               
01575                 <font class="keywordflow">if</font> (modulatedStages &amp; (1 &lt;&lt; k))
01576                 {
01577                         destMat.texEnvArg0RGB(k, CMaterial::Previous, CMaterial::SrcColor);
01578                         destMat.texEnvArg0Alpha(k, CMaterial::Previous, CMaterial::SrcAlpha);
01579                         destMat.texEnvArg1RGB(k, CMaterial::Constant, CMaterial::SrcColor);
01580                         destMat.texEnvArg1Alpha(k, CMaterial::Constant, CMaterial::SrcAlpha);
01581                         destMat.texEnvOpRGB(k, CMaterial::Modulate);
01582                         destMat.texEnvOpAlpha(k, CMaterial::Modulate);                  
01583                 }
01584                 <font class="keywordflow">else</font> <font class="comment">// restore from source material</font>
01585                 {
01586                         destMat.setTexEnvMode(k, srcMat.getTexEnvMode(k));
01587                 }
01588         }       
01589 }
01590 
01591 
01592 <font class="comment">//====================================================================================</font>
01593 <font class="keywordtype">void</font>    CPSConstraintMesh::setupRenderPasses(<font class="keywordtype">float</font> date, TRdrPassSet &amp;rdrPasses, <font class="keywordtype">bool</font> opaque)
01594 {
01595         <font class="comment">// render meshs : we process each rendering pass</font>
01596         <font class="keywordflow">for</font> (TRdrPassSet::iterator rdrPassIt = rdrPasses.begin() 
01597                 ; rdrPassIt != rdrPasses.end(); ++rdrPassIt)
01598         {
01599 
01600                 CMaterial &amp;Mat = rdrPassIt-&gt;Mat;
01601                 CMaterial &amp;SourceMat = rdrPassIt-&gt;SourceMat;
01602 
01603 
01605                 <font class="keywordflow">if</font> ((opaque &amp;&amp; Mat.getZWrite()) || (!opaque &amp;&amp; ! Mat.getZWrite()))
01606                 {               
01607 
01608         
01609                         <font class="comment">// has to setup material constant color ?</font>
01610                         <font class="comment">// global color not supported for mesh</font>
01611                 <font class="comment">/*      CParticleSystem &amp;ps = *(_Owner-&gt;getOwner());</font>
01612 <font class="comment">                        if (!_ColorScheme) </font>
01613 <font class="comment">                        {                                                               </font>
01614 <font class="comment">                                NLMISC::CRGBA col;</font>
01615 <font class="comment">                                col.modulateFromColor(SourceMat.getColor(), _Color);</font>
01616 <font class="comment">                                if (ps.getColorAttenuationScheme() == NULL)</font>
01617 <font class="comment">                                {</font>
01618 <font class="comment">                                        col.modulateFromColor(col, ps.getGlobalColor());</font>
01619 <font class="comment">                                }</font>
01620 <font class="comment">                                Mat.setColor(col);                              </font>
01621 <font class="comment">                        }</font>
01622 <font class="comment">                        else</font>
01623 <font class="comment">                        {                               </font>
01624 <font class="comment">                                Mat.setColor(ps.getGlobalColor());</font>
01625 <font class="comment">                        }*/</font>
01626 
01628                         <a class="code" href="namespaceNL3D.html#a433">ForceMaterialModulation</a>(Mat, SourceMat, <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n8">_ModulatedStages</a>);
01629 
01631                         <font class="keywordtype">bool</font> forceVertexcolorLighting = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n12">_VertexColorLightingForced</a> != 0 ? <font class="keyword">true</font> : SourceMat.getLightedVertexColor();
01632                         <font class="keywordflow">if</font> (forceVertexcolorLighting != Mat.getLightedVertexColor()) <font class="comment">// avoid to touch mat if not needed</font>
01633                         {
01634                                 Mat.setLightedVertexColor(forceVertexcolorLighting);
01635                         }
01636 
01638                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> != 0)
01639                         {
01640                                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
01641                                 {
01642                                         <font class="keywordflow">if</font> (Mat.getTexture(k) != NULL)
01643                                         {
01644                                                 Mat.enableUserTexMat(k, <font class="keyword">true</font>);
01645                                                 CMatrix mat;
01646                                                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>-&gt;Anims[k].buildMatrix(date, mat);
01647                                                 Mat.setUserTexMat(k ,mat);
01648                                         }
01649                                 }
01650                         }               
01651                 }                       
01652         }
01653 
01654 }
01655 
01656 <font class="comment">//====================================================================================</font>
<a name="l01657"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b14">01657</a> <font class="keywordtype">void</font>    CPSConstraintMesh::doRenderPasses(IDriver *driver, uint numObj, TRdrPassSet &amp;rdrPasses, <font class="keywordtype">bool</font> opaque)
01658 {               
01659         <font class="comment">// render meshs : we process each rendering pass</font>
01660         <font class="keywordflow">for</font> (TRdrPassSet::iterator rdrPassIt = rdrPasses.begin() 
01661                 ; rdrPassIt != rdrPasses.end(); ++rdrPassIt)
01662         {       
01663                 CMaterial &amp;Mat = rdrPassIt-&gt;Mat;
01664                 <font class="keywordflow">if</font> ((opaque &amp;&amp; Mat.getZWrite()) || (!opaque &amp;&amp; ! Mat.getZWrite()))
01665                 {
01667                         rdrPassIt-&gt;Pb.setNumTri(rdrPassIt-&gt;Pb.capacityTri()   * numObj / <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>);
01668                         rdrPassIt-&gt;Pb.setNumQuad(rdrPassIt-&gt;Pb.capacityQuad() * numObj / <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>);
01669                         rdrPassIt-&gt;Pb.setNumLine(rdrPassIt-&gt;Pb.capacityLine() * numObj / <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>);
01670 
01672                         driver-&gt;render(rdrPassIt-&gt;Pb, rdrPassIt-&gt;Mat);
01673                 }
01674         }
01675 
01676 }
01677 
01678 
01679 <font class="comment">//====================================================================================</font>
<a name="l01680"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b8">01680</a> <font class="keywordtype">void</font>    CPSConstraintMesh::computeColors(CVertexBuffer &amp;outVB, <font class="keyword">const</font> CVertexBuffer &amp;inVB, uint startIndex, uint toProcess, uint32 srcStep)
01681 {       
01682         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a>);
01683         <font class="comment">// there are 2 case : 1 - the source mesh has colors, which are modulated with the current color</font>
01684         <font class="comment">//                                        2 - the source mesh has no colors : colors are directly copied into the dest vb</font>
01685 
01686         <font class="keywordflow">if</font> (inVB.getVertexFormat() &amp; CVertexBuffer::PrimaryColorFlag) <font class="comment">// case 1</font>
01687         {
01688                 <font class="comment">// TODO: optimisation : avoid to duplicate colors...</font>
01689                 <a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a>-&gt;makeN(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, startIndex, outVB.getColorPointer(), outVB.getVertexSize(), toProcess, inVB.getNumVertices(), srcStep);
01690                 <font class="comment">// modulate from the source mesh</font>
01691                 uint8 *vDest  = (uint8 *) outVB.getColorPointer();
01692                 uint8 *vSrc   = (uint8 *) inVB.getColorPointer();
01693                 <font class="keyword">const</font> uint vSize = outVB.getVertexSize();
01694                 <font class="keyword">const</font> uint numVerts = inVB.getNumVertices();
01695                 uint  meshSize = vSize * numVerts;              
01696                 <font class="keywordflow">for</font> (uint k = 0; k &lt; toProcess; ++k)
01697                 {
01698                         <a class="code" href="classNLMISC_1_1CRGBA.html#z322_1">NLMISC::CRGBA::modulateColors</a>((CRGBA *) vDest, (CRGBA *) vSrc, (CRGBA *) vDest, numVerts, vSize, vSize);
01699                         vDest += meshSize;
01700                 }
01701         }
01702         <font class="keywordflow">else</font> <font class="comment">// case 2</font>
01703         {
01704                 <a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a>-&gt;makeN(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, startIndex, outVB.getColorPointer(), outVB.getVertexSize(), toProcess, inVB.getNumVertices(), srcStep);
01705         }
01706 }
01707 
01708 
01709 <font class="comment">//====================================================================================</font>
<a name="l01710"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b2">01710</a> <font class="keywordtype">void</font> CPSConstraintMesh::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
01711 {
01712         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b1">newSizeElement</a>(emitterLocated, emitterIndex);
01713         <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#b1">newPlaneBasisElement</a>(emitterLocated, emitterIndex);
01714         <font class="comment">// TODO : avoid code cuplication with CPSFace ...</font>
01715         <font class="keyword">const</font> uint32 nbConf = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.size();
01716         <font class="keywordflow">if</font> (nbConf) <font class="comment">// do we use precomputed basis ?</font>
01717         {
01718                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>[<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getNewElementIndex()] = rand() % nbConf;
01719         }
01720         <a class="code" href="classNL3D_1_1CPSColoredParticle.html#b2">newColorElement</a>(emitterLocated, emitterIndex);
01721         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n14">_ReinitGlobalAnimTimeOnNewElement</a>)
01722         {               
01723                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n16">_GlobalAnimDate</a> = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getSystemDate();
01724         }
01725         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;newElement(emitterLocated, emitterIndex);
01726 }
01727         
01728 <font class="comment">//====================================================================================  </font>
<a name="l01729"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b3">01729</a> <font class="keywordtype">void</font> CPSConstraintMesh::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
01730 {
01731         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b2">deleteSizeElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
01732         <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#b2">deletePlaneBasisElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
01733         <font class="comment">// TODO : avoid code cuplication with CPSFace ...</font>
01734         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.size()) <font class="comment">// do we use precomputed basis ?</font>
01735         {
01736                 <font class="comment">// replace ourself by the last element...</font>
01737                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>[<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize() - 1];
01738         }
01739         <a class="code" href="classNL3D_1_1CPSColoredParticle.html#b3">deleteColorElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
01740         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
01741 }
01742         
01743 <font class="comment">//====================================================================================</font>
<a name="l01744"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b9">01744</a> <font class="keywordtype">void</font> CPSConstraintMesh::resize(uint32 size)
01745 {
01746         <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
01747         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b3">resizeSize</a>(size);
01748         <a class="code" href="classNL3D_1_1CPSRotated3DPlaneParticle.html#b3">resizePlaneBasis</a>(size);
01749         <font class="comment">// TODO : avoid code cuplication with CPSFace ...</font>
01750         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n6">_PrecompBasis</a>.size()) <font class="comment">// do we use precomputed basis ?</font>
01751         {
01752                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n7">_IndexInPrecompBasis</a>.resize(size);
01753         }
01754         <a class="code" href="classNL3D_1_1CPSColoredParticle.html#b4">resizeColor</a>(size);
01755         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z723_1">_MorphScheme</a>-&gt;resize(size, <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize());
01756 }       
01757 
01758 <font class="comment">//====================================================================================</font>
<a name="l01759"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b1">01759</a> <font class="keywordtype">void</font> CPSConstraintMesh::updateMatAndVbForColor(<font class="keywordtype">void</font>)
01760 {
01761         <font class="comment">// nothing to do for us...</font>
01762 }
01763 
01764 <font class="comment">//====================================================================================</font>
<a name="l01765"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a22">01765</a> <font class="keywordtype">void</font>    CPSConstraintMesh::forceStageModulationByColor(uint stage, <font class="keywordtype">bool</font> force)
01766 {
01767         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
01768         <font class="keywordflow">if</font> (force)
01769         {
01770                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n8">_ModulatedStages</a> |= 1 &lt;&lt; stage;
01771         }
01772         <font class="keywordflow">else</font>
01773         {
01774                 <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n8">_ModulatedStages</a> &amp;= ~(1 &lt;&lt; stage);
01775         }
01776 }
01777 
01778 <font class="comment">//====================================================================================</font>
<a name="l01779"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#a23">01779</a> <font class="keywordtype">bool</font>    CPSConstraintMesh::isStageModulationForced(uint stage)<font class="keyword"> const</font>
01780 <font class="keyword"></font>{
01781         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
01782         <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n8">_ModulatedStages</a> &amp; (1 &lt;&lt; stage)) != 0;
01783 }
01784 
01785 <font class="comment">//====================================================================================</font>
01786 
01792 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a434">DuplicatePrimitiveBlock</a>(<font class="keyword">const</font> CPrimitiveBlock &amp;srcBlock, CPrimitiveBlock &amp;destBlock, uint nbReplicate, uint vertOffset)
01793 {
01794         PARTICLES_CHECK_MEM;
01795 
01796         <font class="comment">// this must be update each time a new primitive is added</font>
01797         
01798         <font class="comment">// loop counters, and index of the current primitive in the dest pb</font>
01799         uint k, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
01800 
01801         <font class="comment">// the current vertex offset.</font>
01802         uint currVertOffset;
01803 
01804 
01805         <font class="comment">// duplicate triangles</font>
01806         uint numTri = srcBlock.getNumTri();
01807         destBlock.reserveTri(numTri * nbReplicate);
01808         
01809         <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = 0;
01810         currVertOffset = 0;
01811 
01812         <font class="keyword">const</font> uint32 *triPtr = srcBlock.getTriPointer();
01813         <font class="keyword">const</font> uint32 *currTriPtr; <font class="comment">// current Tri</font>
01814         <font class="keywordflow">for</font> (k = 0; k &lt; nbReplicate; ++k)
01815         {
01816                 currTriPtr = triPtr;
01817                 <font class="keywordflow">for</font> (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numTri; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
01818                 {
01819                         destBlock.setTri(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, currTriPtr[0] + currVertOffset, currTriPtr[1] + currVertOffset, currTriPtr[2] + currVertOffset);
01820                         currTriPtr += 3;
01821                         ++ <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
01822                 }
01823                 currVertOffset += vertOffset;
01824         }
01825 
01826 
01827         <font class="comment">// duplicate quads</font>
01828         uint numQuad = srcBlock.getNumQuad();
01829         destBlock.reserveQuad(numQuad * nbReplicate);
01830         
01831         <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = 0;
01832         currVertOffset = 0;
01833 
01834         <font class="keyword">const</font> uint32 *QuadPtr = srcBlock.getQuadPointer();
01835         <font class="keyword">const</font> uint32 *currQuadPtr; <font class="comment">// current Quad</font>
01836         <font class="keywordflow">for</font> (k = 0; k &lt; nbReplicate; ++k)
01837         {
01838                 currQuadPtr = QuadPtr;
01839                 <font class="keywordflow">for</font> (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numQuad; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
01840                 {
01841                         destBlock.setQuad(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, currQuadPtr[0] + currVertOffset, currQuadPtr[1] + currVertOffset, currQuadPtr[2] + currVertOffset, currQuadPtr[3] + currVertOffset);
01842                         currQuadPtr += 4;
01843                         ++ <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
01844                 }
01845                 currVertOffset += vertOffset;
01846         }
01847 
01848         <font class="comment">// duplicate lines</font>
01849         uint numLine = srcBlock.getNumLine();
01850         destBlock.reserveLine(numLine * nbReplicate);
01851         
01852         <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = 0;
01853         currVertOffset = 0;
01854 
01855         <font class="keyword">const</font> uint32 *LinePtr = srcBlock.getLinePointer();
01856         <font class="keyword">const</font> uint32 *currLinePtr; <font class="comment">// current Line</font>
01857         <font class="keywordflow">for</font> (k = 0; k &lt; nbReplicate; ++k)
01858         {
01859                 currLinePtr = LinePtr;
01860                 <font class="keywordflow">for</font> (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numLine; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
01861                 {
01862                         destBlock.setLine(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, currLinePtr[0] + currVertOffset, currLinePtr[1] + currVertOffset);
01863                         currLinePtr += 4;
01864                         ++ <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
01865                 }
01866                 currVertOffset += vertOffset;
01867         }       
01868 
01869 
01870         <font class="comment">// TODO quad / strips duplication : (unimplemented in primitive blocks for now)</font>
01871 
01872         PARTICLES_CHECK_MEM;
01873 }
01874 
01875 <font class="comment">//====================================================================================</font>
<a name="l01876"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#d0">01876</a> <font class="keywordtype">void</font> CPSConstraintMesh::initPrerotVB()
01877 {
01878         <font class="comment">// position, no normals</font>
01879         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q1">_PreRotatedMeshVB</a>.setVertexFormat(CVertexBuffer::PositionFlag);
01880         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q1">_PreRotatedMeshVB</a>.setNumVertices(<a class="code" href="namespaceNL3D.html#a213">ConstraintMeshMaxNumPrerotatedModels</a> * <a class="code" href="namespaceNL3D.html#a211">ConstraintMeshMaxNumVerts</a>);
01881 
01882         <font class="comment">// position &amp; normals</font>
01883         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q2">_PreRotatedMeshVBWithNormal</a>.setVertexFormat(CVertexBuffer::PositionFlag | CVertexBuffer::NormalFlag);
01884         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q2">_PreRotatedMeshVBWithNormal</a>.setNumVertices(<a class="code" href="namespaceNL3D.html#a213">ConstraintMeshMaxNumPrerotatedModels</a> * <a class="code" href="namespaceNL3D.html#a211">ConstraintMeshMaxNumVerts</a>);
01885 }
01886 
01887 <font class="comment">//====================================================================================</font>
<a name="l01888"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#a2">01888</a> CPSConstraintMesh::CMeshDisplay &amp;CPSConstraintMesh::CMeshDisplayShare::getMeshDisplay(IShape *shape, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>)
01889 {
01890         CKey key;
01891         key.Shape = shape;
01892         key.Format = <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>;
01893         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>.count(key)) <font class="comment">// already exists ?</font>
01894         {
01895                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>[key]);
01896                 <font class="keywordflow">return</font> *<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>[key];
01897         }
01898         <font class="keywordflow">else</font>
01899         {
01900                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n1">MDQueue</a>.size() == <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n0">_MaxNumMD</a>) <font class="comment">// is there room left?</font>
01901                 {
01902                         <font class="comment">// no, destroy the least recent entry</font>
01903                         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>.count(<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n1">MDQueue</a>.front())); <font class="comment">// make sure it is also in the map</font>
01904                         <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>.erase(<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n1">MDQueue</a>.front());
01905                         <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n1">MDQueue</a>.pop();
01906                 }
01907                 std::auto_ptr&lt;CMeshDisplay&gt; MD(<font class="keyword">new</font> CMeshDisplay);
01908         
01909                 <font class="comment">// setup rdr passes &amp; primitive blocks</font>
01910                 <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#e0">buildRdrPassSet</a>(MD-&gt;RdrPasses, shape);
01911                 
01912                 <font class="comment">// setup vb</font>
01913                 <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#e1">buildVB</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, MD-&gt;VB, shape);
01914                 
01915                 <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n1">MDQueue</a>.push(key);
01916                 <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>[key] = MD.get();
01917                 <font class="keywordflow">return</font> *(MD.release());
01918         }
01919 }
01920 
01921 
01922 <font class="comment">//====================================================================================</font>
<a name="l01923"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#a1">01923</a> CPSConstraintMesh::CMeshDisplayShare::~CMeshDisplayShare()
01924 {
01925         <font class="keywordflow">for</font> (TMDMap::iterator it = <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#n2">MDMap</a>.end(); ++it)
01926         {
01927                 <font class="keyword">delete</font> it-&gt;second;
01928         }
01929 }
01930 
01931 <font class="comment">//====================================================================================</font>
<a name="l01932"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#e0">01932</a> <font class="keywordtype">void</font> CPSConstraintMesh::CMeshDisplayShare::buildRdrPassSet(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#t0">TRdrPassSet</a> &amp;dest, <font class="keyword">const</font> IShape *shape)
01933 {       
01934         <font class="keyword">const</font> CMesh &amp;m = *NLMISC::safe_cast&lt;const CMesh *&gt;(shape);
01935         <font class="comment">// we don't support skinning for mesh particles, so there must be only one matrix block </font>
01936         <a class="code" href="debug_8h.html#a6">nlassert</a>(m.getNbMatrixBlock() == 1);  <font class="comment">// SKINNING UNSUPPORTED</font>
01937         
01938         dest.resize(m.getNbRdrPass(0));
01939         <font class="keyword">const</font> CVertexBuffer &amp;srcVb = m.getVertexBuffer();
01940         
01941         <font class="keywordflow">for</font> (uint k = 0; k &lt; m.getNbRdrPass(0); ++k)
01942         {
01943                 dest[k].Mat = m.getMaterial(m.getRdrPassMaterial(0, k));
01944                 dest[k].SourceMat = dest[k].Mat;
01945                 <a class="code" href="namespaceNL3D.html#a434">DuplicatePrimitiveBlock</a>(m.getRdrPassPrimitiveBlock(0, k), dest[k].Pb, <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>, srcVb.getNumVertices() );          
01946         }       
01947 }
01948 
01949 <font class="comment">//====================================================================================</font>
<a name="l01950"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#e1">01950</a> <font class="keywordtype">void</font> CPSConstraintMesh::CMeshDisplayShare::buildVB(uint32 destFormat, CVertexBuffer &amp;dest, <font class="keyword">const</font> IShape *shape)
01951 {
01953         <a class="code" href="debug_8h.html#a6">nlassert</a>(shape);
01954         <font class="keyword">const</font> CMesh &amp;m = *NLMISC::safe_cast&lt;const CMesh *&gt;(shape);
01955         <font class="keyword">const</font> CVertexBuffer &amp;meshVb = m.getVertexBuffer();
01956         <a class="code" href="debug_8h.html#a6">nlassert</a>(destFormat == meshVb.getVertexFormat() || destFormat == (meshVb.getVertexFormat() | (uint32) CVertexBuffer::PrimaryColorFlag) );
01957         dest.setVertexFormat(destFormat);
01958         dest.setNumVertices(<a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a> * meshVb.getNumVertices());
01959 
01960         uint8 *outPtr = (uint8 *) dest.getVertexCoordPointer();
01961         uint8 *inPtr = (uint8 *)  meshVb.getVertexCoordPointer();
01962         uint  meshSize  = dest.getVertexSize() * meshVb.getNumVertices();
01963 
01964         <font class="keywordflow">if</font> (destFormat == meshVb.getVertexFormat()) <font class="comment">// no color added</font>
01965         {               
01966                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>; ++k)
01967                 {
01968                         ::memcpy((<font class="keywordtype">void</font> *) (outPtr + k * meshSize), (<font class="keywordtype">void</font> *) inPtr, meshSize);                   
01969                 }
01970         }
01971         <font class="keywordflow">else</font> <font class="comment">// color added, but not available in src </font>
01972         {
01973                 sint colorOff = dest.getColorOff();
01974                 uint inVSize    = meshVb.getVertexSize();
01975                 uint outVSize   = dest.getVertexSize();         
01976                 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a212">ConstraintMeshBufSize</a>; ++k)
01977                 {
01978                         <font class="keywordflow">for</font> (uint <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = 0; <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> &lt; meshVb.getNumVertices(); ++<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
01979                         {
01980                                 <font class="comment">// copy until color</font>
01981                                 ::memcpy((<font class="keywordtype">void</font> *) (outPtr + k * meshSize + <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> * outVSize), (<font class="keywordtype">void</font> *) (inPtr + <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> * inVSize), colorOff);
01982                                 <font class="comment">// copy datas after color</font>
01983                                 ::memcpy((<font class="keywordtype">void</font> *) (outPtr + k * meshSize + <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> * outVSize + colorOff + <font class="keyword">sizeof</font>(uint8[4])), (<font class="keywordtype">void</font> *) (inPtr + <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> * inVSize + colorOff), inVSize - colorOff);
01984                         }
01985                 }
01986         }
01987 }
01988 
01989 <font class="comment">//=====================================================================================</font>
<a name="l01990"></a><a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare_1_1CKey.html#a0">01990</a> CPSConstraintMesh::CMeshDisplayShare::CKey::~CKey()
01991 {
01992 }
01993 
01994 <font class="comment">//===================================================================================== </font>
<a name="l01995"></a><a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#a0">01995</a> CPSConstraintMesh::CGlobalTexAnim::CGlobalTexAnim() : TransSpeed(NLMISC::CVector2f::Null),
01996                                                          TransAccel(NLMISC::CVector2f::Null),
01997                                                          ScaleStart(1 ,1),
01998                                                          ScaleSpeed(NLMISC::CVector2f::Null),
01999                                                          ScaleAccel(NLMISC::CVector2f::Null),
02000                                                          WRotSpeed(0),
02001                                                          WRotAccel(0)
02002 {
02003 }
02004 
02005 <font class="comment">//=====================================================================================</font>
<a name="l02006"></a><a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#a1">02006</a> <font class="keywordtype">void</font>    CPSConstraintMesh::CGlobalTexAnim::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
02007 {
02008         f.serialVersion(0);
02009         f.serial(TransSpeed, TransAccel, ScaleStart, ScaleSpeed, ScaleAccel);
02010         f.serial(WRotSpeed, WRotAccel);
02011 }
02012 
02013 <font class="comment">//=====================================================================================</font>
02014 <font class="keywordtype">void</font> CPSConstraintMesh::CGlobalTexAnim::buildMatrix(<font class="keywordtype">float</font> &amp;date, <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;dest)
02015 {
02016         <font class="keywordtype">float</font> fDate = (float) date;
02017         <font class="keywordtype">float</font> halfDateSquared   = 0.5f * fDate * fDate;
02018         <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> pos   = fDate * <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m0">TransSpeed</a> + halfDateSquared * fDate * <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m1">TransAccel</a>;
02019         <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> scale = <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m2">ScaleStart</a> + fDate * <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m3">ScaleSpeed</a> + halfDateSquared * fDate * <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m4">ScaleAccel</a>;
02020         <font class="keywordtype">float</font> rot = fDate * <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m5">WRotSpeed</a> + halfDateSquared * <a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnim.html#m6">WRotAccel</a>;
02021         
02022                         
02023         <font class="keywordtype">float</font> fCos, fSin;
02024         <font class="keywordflow">if</font> (rot != 0.f)
02025         {
02026                 fCos = ::cosf(- rot);
02027                 fSin = ::sinf(- rot);
02028         }
02029         <font class="keywordflow">else</font>
02030         {
02031                 fCos = 1.f;
02032                 fSin = 0.f;
02033         }
02034 
02035         <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> I(fCos, fSin, 0);
02036         <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> J(-fSin, fCos, 0);                              
02037         dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_1">setRot</a>(scale.<a class="code" href="classNLMISC_1_1CVector2f.html#m0">x</a> * I, scale.<a class="code" href="classNLMISC_1_1CVector2f.html#m1">y</a> * J, <a class="code" href="classNLMISC_1_1CVector.html#p3">NLMISC::CVector::K</a>);      
02038         <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> center(-0.5f, -0.5f, 0.f);
02039         <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>(pos.<a class="code" href="classNLMISC_1_1CVector2f.html#m0">x</a>, pos.<a class="code" href="classNLMISC_1_1CVector2f.html#m1">y</a>, 0);
02040         dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_6">setPos</a>(t + dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z294_0">mulVector</a>(center) - center);       
02041 }
02042 
02043 <font class="comment">//=====================================================================================</font>
<a name="l02044"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z722_0">02044</a> <font class="keywordtype">void</font>    CPSConstraintMesh::setGlobalTexAnim(uint stage, <font class="keyword">const</font> CGlobalTexAnim &amp;properties)
02045 {
02046         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> != 0);
02047         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
02048         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>.get());
02049         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>-&gt;Anims[stage] = properties;
02050 }
02051 
02052 <font class="comment">//=====================================================================================</font>
<a name="l02053"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z722_1">02053</a> <font class="keyword">const</font> CPSConstraintMesh::CGlobalTexAnim &amp;CPSConstraintMesh::getGlobalTexAnim(uint stage)<font class="keyword"> const</font>
02054 <font class="keyword"></font>{
02055         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> != 0);
02056         <a class="code" href="debug_8h.html#a6">nlassert</a>(stage &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>);
02057         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>.get());
02058         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>-&gt;Anims[stage];
02059 }
02060 
02061 
02062 <font class="comment">//=====================================================================================</font>
<a name="l02063"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_2">02063</a> CPSConstraintMesh::TTexAnimType CPSConstraintMesh::getTexAnimType()<font class="keyword"> const</font>
02064 <font class="keyword"></font>{
02065         <font class="keywordflow">return</font> (TTexAnimType) (<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> != 0 ? <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_0s1">GlobalAnim</a> : <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_0s0">NoAnim</a>);     
02066 }
02067 
02068 <font class="comment">//=====================================================================================</font>
<a name="l02069"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_1">02069</a> <font class="keywordtype">void</font>  CPSConstraintMesh::setTexAnimType(TTexAnimType <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
02070 {
02071         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> &lt; <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_0s2">Last</a>);
02072         <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_2">getTexAnimType</a>()) <font class="keywordflow">return</font>; <font class="comment">// does the type of animation change ?</font>
02073         <font class="keywordflow">switch</font> (type)
02074         {
02075                 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_0s0">NoAnim</a>:
02076                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>.reset();
02077                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b12">restoreMaterials</a>();
02078                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> = 0;
02079                 <font class="keywordflow">break</font>;
02080                 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#z721_0s1">GlobalAnim</a>:
02081                 {
02082                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#t4">PGlobalTexAnims</a> newPtr(<font class="keyword">new</font> CGlobalTexAnims);
02083                         std::swap(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n15">_GlobalTexAnims</a>, newPtr);                     
02084                         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n13">_GlobalAnimationEnabled</a> = 1;
02085                 }
02086                 <font class="keywordflow">break</font>;
02087                 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
02088         }
02089 }
02090 
02091 <font class="comment">//=====================================================================================</font>
<a name="l02092"></a><a class="code" href="structNL3D_1_1CPSConstraintMesh_1_1CGlobalTexAnims.html#a0">02092</a> <font class="keywordtype">void</font>    CPSConstraintMesh::CGlobalTexAnims::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
02093 {
02094         f.serialVersion(0);
02095         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; ++k)
02096         {
02097                 f.serial(Anims[k]);
02098         }
02099 }
02100 
02101 <font class="comment">//=====================================================================================</font>
<a name="l02102"></a><a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b12">02102</a> <font class="keywordtype">void</font> CPSConstraintMesh::restoreMaterials()
02103 {
02104         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#b10">update</a>();
02105         CMesh                             &amp;mesh = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[0]);
02106         <font class="keyword">const</font> CVertexBuffer   &amp;modelVb = mesh.getVertexBuffer();
02107         CMeshDisplay  &amp;md= <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#q0">_MeshDisplayShare</a>.<a class="code" href="classNL3D_1_1CPSConstraintMesh_1_1CMeshDisplayShare.html#a2">getMeshDisplay</a>(<a class="code" href="classNL3D_1_1CPSConstraintMesh.html#n1">_Shapes</a>[0], modelVb.getVertexFormat() 
02108                                                                                                                         | (<a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a> ? CVertexBuffer::PrimaryColorFlag : 0));
02109 
02110         <a class="code" href="classNL3D_1_1CPSConstraintMesh.html#t0">TRdrPassSet</a> rdrPasses = md.RdrPasses;
02111                 <font class="comment">// render meshs : we process each rendering pass</font>
02112         <font class="keywordflow">for</font> (TRdrPassSet::iterator rdrPassIt = rdrPasses.begin() 
02113                 ; rdrPassIt != rdrPasses.end(); ++rdrPassIt)
02114         {       
02115                 rdrPassIt-&gt;Mat = rdrPassIt-&gt;SourceMat;          
02116         }
02117 }
02118 
02119 } <font class="comment">// NL3D</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>