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
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NL3D::CMRMBuilder class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CMRMBuilder Class Reference</h1><code>#include <<a class="el" href="a06056.html">mrm_builder.h</a>></code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The class for building MRMs. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00052">52</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Top Level methods.</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a02952.html">CAttributeKey</a>,<br>
<a class="el" href="a04558.html#a14">sint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">TAttributeMap</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a> (const <a class="el" href="a03668.html">CVectorH</a> &att) const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03641.html">NLMISC::CUVW</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a> (const <a class="el" href="a03668.html">CVectorH</a> &att) const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_3">buildMeshBuildMrm</a> (const <a class="el" href="a02961.html">CMRMMeshFinal</a> &finalMRM, <a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> &mbuild, <a class="el" href="a04558.html#a11">uint32</a> vbFlags, <a class="el" href="a04558.html#a11">uint32</a> nbMats, const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mb)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_4">buildMeshBuildMrm</a> (const <a class="el" href="a02961.html">CMRMMeshFinal</a> &finalMRM, <a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> &mbuild, <a class="el" href="a04558.html#a11">uint32</a> vbFlags, <a class="el" href="a04558.html#a11">uint32</a> nbMats, const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mb)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, const <a class="el" href="a03668.html">CVectorH</a> &att)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_7">findInsertColorInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, <a class="el" href="a03337.html">CRGBA</a> col)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_8">findInsertNormalInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, const <a class="el" href="a03128.html">CVector</a> &normal)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_9">findInsertUvwInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, const <a class="el" href="a03641.html">NLMISC::CUVW</a> &uvw)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_10">normalizeBaseMeshSkin</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh) const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02865.html">CMesh::CSkinWeight</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_11">normalizeSkinWeight</a> (const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> &sw) const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">TAttributeMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a> [NL3D_MRM_MAX_ATTRIB]</td></tr>
<tr><td colspan=2><br><h2>MRM Level Variables.</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a02971.html">CMRMWedgeGeom</a>,<br>
<a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a02953.html">CGeomPred</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">TGeomMap</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">TGeomMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a></td></tr>
<tr><td colspan=2><br><h2>Mesh Interfaces computing</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_0">buildMRMSewingMeshes</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, <a class="el" href="a04558.html#a15">uint</a> nWantedLods, <a class="el" href="a04558.html#a15">uint</a> divisor)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">_CurrentLodComputed</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02968.html">CMRMSewingMesh</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuildera0">CMRMBuilder</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CMRMBuildera0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuildera1">compileMRM</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > &bsList, const <a class="el" href="a02967.html">CMRMParameters</a> &<a class="el" href="a04223.html#a565">params</a>, <a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> &mrmMesh, <a class="el" href="a04558.html#a15">uint</a> numMaxMaterial)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuildera2">compileMRM</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > &bsList, const <a class="el" href="a02967.html">CMRMParameters</a> &<a class="el" href="a04223.html#a565">params</a>, <a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> &mrmMesh, <a class="el" href="a04558.html#a15">uint</a> numMaxMaterial)</td></tr>
<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderd0">computeBsVerticesAttributes</a> (std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > &srcBsMeshs, std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > &srcBsMeshsMod)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderd1">makeCoarserBS</a> (std::vector< <a class="el" href="a02950.html">CMRMBlendShape</a> > &csBsMeshs)</td></tr>
<tr><td colspan="2"><div class="groupHeader">MRM Level Methods.</div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz565_0">buildAllLods</a> (const <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > &lodMeshs, <a class="el" href="a04558.html#a15">uint</a> nWantedLods=10, <a class="el" href="a04558.html#a15">uint</a> divisor=50)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz565_1">buildBlendShapes</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > &bsList, <a class="el" href="a04558.html#a11">uint32</a> VertexFlags)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz565_2">buildFinalMRM</a> (std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > &lodMeshs, <a class="el" href="a02961.html">CMRMMeshFinal</a> &finalMRM)</td></tr>
<tr><td colspan="2"><div class="groupHeader">Collapse methods.</div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_0">collapseEdge</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02865.html">CMesh::CSkinWeight</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_1">collapseSkinWeight</a> (const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> &sw1, const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> &sw2, float InterValue) const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_2">faceShareWedges</a> (<a class="el" href="a02958.html">CMRMFaceBuild</a> *face, <a class="el" href="a04558.html#a14">sint</a> attribId, <a class="el" href="a04558.html#a14">sint</a> numVertex1, <a class="el" href="a04558.html#a14">sint</a> numVertex2)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_3">followVertex</a> (<a class="el" href="a04558.html#a14">sint</a> i)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_4">followWedge</a> (<a class="el" href="a04558.html#a14">sint</a> attribId, <a class="el" href="a04558.html#a14">sint</a> i)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_5">insertFaceIntoEdgeList</a> (<a class="el" href="a02958.html">CMRMFaceBuild</a> &tmpf)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_6">removeFaceFromEdgeList</a> (<a class="el" href="a02958.html">CMRMFaceBuild</a> &f)</td></tr>
<tr><td colspan="2"><div class="groupHeader">Mesh Level methods.</div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_0">collapseEdges</a> (<a class="el" href="a04558.html#a14">sint</a> nWantedFaces)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_1">init</a> (const <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_2">makeFromMesh</a> (const <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a02966.html">CMRMMeshGeom</a> &lodMesh, <a class="el" href="a02960.html">CMRMMesh</a> &coarserMesh, <a class="el" href="a04558.html#a14">sint</a> nWantedFaces)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">this is the root call to compute a single lodMesh and the coarserMesh from a baseMesh. <a href="#NL3D_1_1CMRMBuilderz559_2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_3">makeLODMesh</a> (<a class="el" href="a02966.html">CMRMMeshGeom</a> &lodMesh)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_4">saveCoarserMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &coarserMesh)</td></tr>
<tr><td colspan="2"><div class="groupHeader">Edge Cost methods.</div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_2">edgeNearUniqueMatFace</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_3">getDeltaFaceNormals</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_4">vertexClosed</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_6">vertexHasOneMaterial</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_7">vertexHasOneWedge</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr>
<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Mesh Level Tmp Values.</div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02967.html#NL3D_1_1CMRMParametersw3">CMRMParameters::TSkinReduction</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">If the current build is skinned, control the quality of the skinning redcution. <a href="#NL3D_1_1CMRMBuilderz553_1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05363.html#a152">TEdgeMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02949.html">CMRMAttribute</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a> [NL3D_MRM_MAX_ATTRIB]</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02958.html">CMRMFaceBuild</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02970.html">CMRMVertex</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a></td></tr>
</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_0" doxytag="NL3D::CMRMBuilder::TAttributeMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef std::map<<a class="el" href="a02952.html">CAttributeKey</a>, <a class="el" href="a04558.html#a14">sint</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">NL3D::CMRMBuilder::TAttributeMap</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00228">228</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz563_0" doxytag="NL3D::CMRMBuilder::TGeomMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef std::map<<a class="el" href="a02971.html">CMRMWedgeGeom</a>, <a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a02953.html">CGeomPred</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">NL3D::CMRMBuilder::TGeomMap</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00179">179</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. </td>
</tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CMRMBuildera0" doxytag="NL3D::CMRMBuilder::CMRMBuilder" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> NL3D::CMRMBuilder::CMRMBuilder </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Constructor.
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00859">859</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, and <a class="el" href="a06056.html#l00094">NumAttributes</a>.
<p>
<div class="fragment"><pre>00860 {
00861 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>= 0;
00862 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= <span class="keyword">false</span>;
00863 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>= <span class="keyword">false</span>;
00864 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_1" doxytag="NL3D::CMRMBuilder::attToColor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NL3D::CMRMBuilder::attToColor </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a03668.html">CVectorH</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>att</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01709">1709</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>.
<p>
<div class="fragment"><pre>01710 {
01711 <a class="code" href="a03337.html">CRGBA</a> ret;
01712 <span class="keywordtype">float</span> tmp;
01713 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255);
01714 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp;
01715 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255);
01716 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo2">G</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp;
01717 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255);
01718 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo1">B</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp;
01719 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255);
01720 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp;
01721
01722 <span class="keywordflow">return</span> ret;
01723 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_2" doxytag="NL3D::CMRMBuilder::attToUvw" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a03641.html">NLMISC::CUVW</a> NL3D::CMRMBuilder::attToUvw </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a03668.html">CVectorH</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>att</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01727">1727</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>.
<p>
<div class="fragment"><pre>01728 {
01729 <span class="keywordflow">return</span> <a class="code" href="a03641.html">CUVW</a>(att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
01730 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz565_0" doxytag="NL3D::CMRMBuilder::buildAllLods" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildAllLods </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > & </td>
<td class="mdname" nowrap> <em>lodMeshs</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>nWantedLods</em> = 10, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>divisor</em> = 50</td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
build all LODs from a baseMesh. NB: the coarsestMesh is stored in lodMeshs[0], and has no geomorph info since it is the coarsest mesh. nWantedLods are created (including the coarsestMesh). <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>lodMeshs</em> </td><td>array created by the function (size of nWantedlods). </td></tr>
<tr><td valign=top><em>nWantedLods</em> </td><td>number of LODs wanted. </td></tr>
<tr><td valign=top><em>divisor</em> </td><td>the coarsestMesh will have <a class="el" href="a04223.html#a587">baseMesh.Faces.size()</a>/divisor faces.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06055.html#l01287">1287</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00154">_CurrentLodComputed</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01256">makeFromMesh()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>01289 {
01290 <a class="code" href="a04558.html#a14">sint</a> nFaces= baseMesh.Faces.size();
01291 <a class="code" href="a04558.html#a14">sint</a> nBaseFaces;
01292 <a class="code" href="a04558.html#a14">sint</a> i;
01293 CMRMMesh srcMesh = baseMesh;
01294
01295 <span class="comment">// coarsest LOD will have those number of faces.</span>
01296 nBaseFaces=nFaces/divisor;
01297 nBaseFaces=max(nBaseFaces,4);
01298
01299 <span class="comment">// must have at least 2 LOD to be really intersting. But the rest of the process work too with only one Lod!!</span>
01300 <a class="code" href="a04199.html#a6">nlassert</a>(nWantedLods>=1);
01301 lodMeshs.resize(nWantedLods);
01302
01303 <span class="comment">// If only one lod asked, must init some Tmp Global values (like NumAttributes)</span>
01304 <span class="keywordflow">if</span>(nWantedLods==1)
01305 {
01306 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">_CurrentLodComputed</a>= 0;
01307 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_1">init</a>(baseMesh);
01308 }
01309
01310 <span class="comment">// must fill all LODs, from end to start. do not proces last lod since it will be the coarsest mesh.</span>
01311 <span class="keywordflow">for</span>(i=nWantedLods-1;i>0;i--)
01312 {
01313 <a class="code" href="a04558.html#a14">sint</a> nbWantedFaces;
01314
01315 <span class="comment">// for sewing computing</span>
01316 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">_CurrentLodComputed</a>= i;
01317
01318 <span class="comment">// Linear.</span>
01319 nbWantedFaces= nBaseFaces + (nFaces-nBaseFaces) * (i-1)/(nWantedLods-1);
01320 nbWantedFaces=max(nbWantedFaces,4);
01321
01322 <span class="comment">// Build this LOD.</span>
01323 CMRMMesh csMesh;
01324 <span class="comment">// The mesh</span>
01325 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_2">makeFromMesh</a>(srcMesh, lodMeshs[i], csMesh, nbWantedFaces);
01326
01327 <span class="comment">// next mesh to process is csMesh.</span>
01328 srcMesh = csMesh;
01329 }
01330 <span class="comment">// the first lodMedsh gets the coarsest mesh.</span>
01331 lodMeshs[0]= srcMesh;
01332 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz565_1" doxytag="NL3D::CMRMBuilder::buildBlendShapes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildBlendShapes </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > & </td>
<td class="mdname" nowrap> <em>bsList</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td>
<td class="mdname" nowrap> <em>VertexFlags</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
build the blend shapes in the same way we constructed the base mesh mrm
<p>
Definition at line <a class="el" href="a06055.html#l02912">2912</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a05990.html#l00090">NL3D::CMesh::CCorner::Color</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05990.html#l00088">NL3D::CMesh::CCorner::Normal</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a05990.html#l00091">NL3D::CMesh::CCorner::Specular</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00089">NL3D::CMesh::CCorner::Uvws</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>02914 {
02915 <a class="code" href="a04558.html#a11">uint32</a> i, j, k, m, destIndex;
02916 <a class="code" href="a04558.html#a11">uint32</a> attId;
02917 <a class="code" href="a03668.html">CVectorH</a> vh;
02918 vector<CMRMBlendShape> &bsMeshes= baseMesh.BlendShapes;
02919
02920 bsMeshes.resize (bsList.size());
02921
02922 <span class="keywordflow">for</span> (i = 0; i < bsList.size(); ++i)
02923 {
02924 <span class="comment">// Construct a blend shape like a mrm mesh</span>
02925 <a class="code" href="a04199.html#a6">nlassert</a> (baseMesh.Vertices.size() == bsList[i]->Vertices.size());
02926 bsMeshes[i].Vertices.resize (baseMesh.Vertices.size());
02927 bsMeshes[i].Vertices = bsList[i]->Vertices;
02928
02929 bsMeshes[i].NumAttributes = baseMesh.NumAttributes;
02930 <span class="keywordflow">for</span> (j = 0; j < (<a class="code" href="a04558.html#a11">uint32</a>)bsMeshes[i].NumAttributes; ++j)
02931 bsMeshes[i].Attributes[j].resize(baseMesh.Attributes[j].size());
02932
02933 <span class="comment">// For all corners parse the faces (given by the baseMesh) and construct blend shape mrm meshes</span>
02934 <span class="keywordflow">for</span> (j = 0; j < baseMesh.Faces.size(); ++j)
02935 <span class="keywordflow">for</span> (k = 0; k < 3; ++k)
02936 {
02937 <span class="keyword">const</span> CMesh::CCorner &srcCorner = bsList[i]->Faces[j].Corner[k];
02938 CMRMCorner &neutralCorner = baseMesh.Faces[j].Corner[k];
02939
02940 attId= 0;
02941
02942 <span class="keywordflow">if</span> (VertexFlags & CVertexBuffer::NormalFlag)
02943 {
02944 destIndex = neutralCorner.Attributes[attId];
02945 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Normal.x;
02946 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Normal.y;
02947 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Normal.z;
02948 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = 0.0f;
02949 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh;
02950 attId++;
02951 }
02952 <span class="keywordflow">if</span> (VertexFlags & CVertexBuffer::PrimaryColorFlag)
02953 {
02954 destIndex = neutralCorner.Attributes[attId];
02955 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Color.R;
02956 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Color.G;
02957 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Color.B;
02958 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = srcCorner.Color.A;
02959 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh;
02960 attId++;
02961 }
02962 <span class="keywordflow">if</span> (VertexFlags & CVertexBuffer::SecondaryColorFlag)
02963 {
02964 destIndex = neutralCorner.Attributes[attId];
02965 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Specular.R;
02966 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Specular.G;
02967 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Specular.B;
02968 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = srcCorner.Specular.A;
02969 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh;
02970 attId++;
02971 }
02972 <span class="keywordflow">for</span> (m = 0; m < CVertexBuffer::MaxStage; ++m)
02973 {
02974 <span class="keywordflow">if</span> (VertexFlags & (CVertexBuffer::TexCoord0Flag<<m))
02975 {
02976 destIndex = neutralCorner.Attributes[attId];
02977 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Uvws[m].U;
02978 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Uvws[m].V;
02979 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Uvws[m].W;
02980 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = 0.0f;
02981 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh;
02982 attId++;
02983 }
02984 }
02985 }
02986 }
02987 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz565_2" doxytag="NL3D::CMRMBuilder::buildFinalMRM" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildFinalMRM </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > & </td>
<td class="mdname" nowrap> <em>lodMeshs</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02961.html">CMRMMeshFinal</a> & </td>
<td class="mdname" nowrap> <em>finalMRM</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
given a list of LODs, compress/reorganize data, and store in finalMRM mesh.
<p>
Definition at line <a class="el" href="a06055.html#l01336">1336</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00180">_GeomMap</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06062.html#l00215">NL3D::CMRMMeshFinal::CWedge::Attributes</a>, <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a06062.html#l00155">NL3D::CMRMMeshGeom::CoarserFaces</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06062.html#l00185">NL3D::CMRMWedgeGeom::End</a>, <a class="el" href="a06062.html#l00266">NL3D::CMRMMeshFinal::CLod::Faces</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06061.html#l00051">NL3D::CMRMMeshFinal::findInsertWedge()</a>, <a class="el" href="a06062.html#l00268">NL3D::CMRMMeshFinal::CLod::Geomorphs</a>, <a class="el" href="a06062.html#l00289">NL3D::CMRMMeshFinal::Lods</a>, <a class="el" href="a06062.html#l00083">NL3D::CMRMFace::MaterialId</a>, <a class="el" href="a06062.html#l00256">NL3D::CMRMMeshFinal::CFace::MaterialId</a>, <a class="el" href="a06062.html#l00292">NL3D::CMRMMeshFinal::MRMBlendShapesFinals</a>, <a class="el" href="a06062.html#l00283">NL3D::CMRMMeshFinal::NGeomSpace</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06062.html#l00213">NL3D::CMRMMeshFinal::CWedge::NSkinMatUsed</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06062.html#l00285">NL3D::CMRMMeshFinal::NumAttributes</a>, <a class="el" href="a06062.html#l00305">NL3D::CMRMMeshFinal::reset()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06062.html#l00287">NL3D::CMRMMeshFinal::Skinned</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a06062.html#l00183">NL3D::CMRMWedgeGeom::Start</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, <a class="el" href="a06062.html#l00214">NL3D::CMRMMeshFinal::CWedge::Vertex</a>, <a class="el" href="a06062.html#l00211">NL3D::CMRMMeshFinal::CWedge::VertexSkin</a>, <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>, <a class="el" href="a06062.html#l00065">NL3D::CMRMCorner::WedgeEndId</a>, <a class="el" href="a06062.html#l00066">NL3D::CMRMCorner::WedgeGeomId</a>, <a class="el" href="a06062.html#l00254">NL3D::CMRMMeshFinal::CFace::WedgeId</a>, <a class="el" href="a06062.html#l00274">NL3D::CMRMMeshFinal::CMRMBlendShapeFinal::Wedges</a>, <a class="el" href="a06062.html#l00281">NL3D::CMRMMeshFinal::Wedges</a>, <a class="el" href="a06062.html#l00064">NL3D::CMRMCorner::WedgeStartId</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>01337 {
01338 <a class="code" href="a04558.html#a14">sint</a> i,j;
01339 <a class="code" href="a04558.html#a14">sint</a> lodId, attId;
01340 <a class="code" href="a04558.html#a14">sint</a> nLods= lodMeshs.size();
01341
01342 <span class="comment">// Init.</span>
01343 <span class="comment">// ===============</span>
01344 finalMRM.reset();
01345 finalMRM.NumAttributes= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;
01346 finalMRM.Skinned= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>;
01347 CMRMMeshFinal::CWedge::NumAttributesToCompare= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;
01348 CMRMMeshFinal::CWedge::CompareSkinning= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>;
01349 finalMRM.Lods.resize(nLods);
01350
01351
01352 <span class="comment">// Build Wedges, and faces index.</span>
01353 <span class="comment">// ===============</span>
01354 <span class="comment">// for all lods.</span>
01355 <span class="keywordflow">for</span>(lodId=0; lodId<nLods; lodId++)
01356 {
01357 CMRMMeshGeom &lodMesh= lodMeshs[lodId];
01358 CMRMMeshGeom &lodMeshPrec= lodMeshs[lodId==0?0:lodId-1];
01359 <span class="comment">// for all face corner.</span>
01360 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++)
01361 {
01362 <span class="comment">// The current face.</span>
01363 CMRMFace &face= lodMesh.Faces[i];
01364 <span class="comment">// the current face, but which points to the prec LOD vertices/attributes.</span>
01365 CMRMFace &faceCoarser= lodMesh.CoarserFaces[i];
01366 <span class="comment">// for 3 corners.</span>
01367 <span class="keywordflow">for</span>(j=0;j<3;j++)
01368 {
01369 CMRMCorner &corner= face.Corner[j];
01370 CMRMCorner &cornerCoarser= faceCoarser.Corner[j];
01371 <span class="comment">// start and end wedge (geomorph), maybe same.</span>
01372 CMRMMeshFinal::CWedge wedgeStart;
01373 CMRMMeshFinal::CWedge wedgeEnd;
01374
01375 <span class="comment">// fill wedgeStart with values from lodMesh.</span>
01376 wedgeStart.Vertex= lodMesh.Vertices[corner.Vertex];
01377 <span class="keywordflow">if</span>(_Skinned)
01378 wedgeStart.VertexSkin= lodMesh.SkinWeights[corner.Vertex];
01379 <span class="keywordflow">for</span>(attId=0; attId<NumAttributes; attId++)
01380 {
01381 wedgeStart.Attributes[attId]= lodMesh.Attributes[attId][corner.Attributes[attId]];
01382 }
01383
01384 <span class="comment">// if geomorph possible (ie not lod 0).</span>
01385 <span class="keywordflow">if</span>(lodId>0)
01386 {
01387 <span class="comment">// fill wedgeEnd with values from coarser lodMesh.</span>
01388 wedgeEnd.Vertex= lodMeshPrec.Vertices[cornerCoarser.Vertex];
01389 <span class="keywordflow">if</span>(_Skinned)
01390 wedgeEnd.VertexSkin= lodMeshPrec.SkinWeights[cornerCoarser.Vertex];
01391 <span class="keywordflow">for</span>(attId=0; attId<NumAttributes; attId++)
01392 {
01393 wedgeEnd.Attributes[attId]= lodMeshPrec.Attributes[attId][cornerCoarser.Attributes[attId]];
01394 }
01395 }
01396 <span class="keywordflow">else</span>
01397 {
01398 <span class="comment">// no geomorph.</span>
01399 wedgeEnd= wedgeStart;
01400 }
01401
01402 <span class="comment">// find/insert wedge, and get Ids. NB: if start/end same, same indices.</span>
01403 <a class="code" href="a04558.html#a14">sint</a> wedgeStartId= finalMRM.findInsertWedge(wedgeStart);
01404 <a class="code" href="a04558.html#a14">sint</a> wedgeEndId= finalMRM.findInsertWedge(wedgeEnd);
01405
01406 <span class="comment">// store in TmpCorner.</span>
01407 corner.WedgeStartId= wedgeStartId;
01408 corner.WedgeEndId= wedgeEndId;
01409 }
01410 }
01411
01412 <span class="comment">// Here, the number of wedge indicate the max number of wedge this LOD needs.</span>
01413 finalMRM.Lods[lodId].NWedges= finalMRM.Wedges.size();
01414 }
01415
01416
01417 <span class="comment">// Count NBWedges necessary for geomorph, and compute Dest geomorph wedges ids.</span>
01418 <span class="comment">// ===============</span>
01419 <span class="comment">// the number of geomorph required for one LOD.</span>
01420 <a class="code" href="a04558.html#a14">sint</a> sglmGeom;
01421 <span class="comment">// the number of geomorph required for all LOD (max of sglmGeom).</span>
01422 <a class="code" href="a04558.html#a14">sint</a> sglmGeomMax= 0;
01423
01424 <span class="comment">// Do not process lod 0, since no geomorph.</span>
01425 <span class="keywordflow">for</span>(lodId=1; lodId<nLods; lodId++)
01426 {
01427 CMRMMeshGeom &lodMesh= lodMeshs[lodId];
01428
01429 <span class="comment">// reset the GeomMap, the one which indicate if we have already inserted a geomorph.</span>
01430 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.clear();
01431 sglmGeom= 0;
01432
01433 <span class="comment">// for all face corner.</span>
01434 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++)
01435 {
01436 <span class="comment">// The current face.</span>
01437 CMRMFace &face= lodMesh.Faces[i];
01438 <span class="comment">// for 3 corners.</span>
01439 <span class="keywordflow">for</span>(j=0;j<3;j++)
01440 {
01441 CMRMCorner &corner= face.Corner[j];
01442
01443 <span class="comment">// if not same wedge Ids, this is a geomorphed wedge.</span>
01444 <span class="keywordflow">if</span>(corner.WedgeStartId != corner.WedgeEndId)
01445 {
01446 <span class="comment">// search if it exist yet in the set.</span>
01447 CMRMWedgeGeom geom;
01448 geom.Start= corner.WedgeStartId;
01449 geom.End= corner.WedgeEndId;
01450 <a class="code" href="a04558.html#a14">sint</a> geomDest= sglmGeom;
01451 <span class="comment">// if don't find this geom in the set, then it is a new one.</span>
01452 TGeomMap::const_iterator it= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.find(geom);
01453 <span class="keywordflow">if</span>(it == <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.end())
01454 {
01455 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.insert( make_pair(geom, geomDest) );
01456 sglmGeom++;
01457 }
01458 <span class="keywordflow">else</span>
01459 geomDest= it->second;
01460
01461 <span class="comment">// store this Geom Id in the corner.</span>
01462 corner.WedgeGeomId= geomDest;
01463 }
01464 }
01465 }
01466
01467 <span class="comment">// take the max.</span>
01468 sglmGeomMax= max(sglmGeomMax, sglmGeom);
01469 }
01470
01471
01472 <span class="comment">// inform the finalMRM.</span>
01473 finalMRM.NGeomSpace= sglmGeomMax;
01474
01475
01476 <span class="comment">// decal all wedges/ face index.</span>
01477 <span class="comment">// ===============</span>
01478 <span class="comment">// insert an empty space for dest geomorph.</span>
01479 finalMRM.Wedges.insert(finalMRM.Wedges.begin(), sglmGeomMax, CMRMMeshFinal::CWedge());
01480
01481 <span class="comment">// Parse all faces corner of All lods, and decal Start/End Wedge index.</span>
01482 <span class="keywordflow">for</span>(lodId=0; lodId<nLods; lodId++)
01483 {
01484 CMRMMeshGeom &lodMesh= lodMeshs[lodId];
01485
01486 <span class="comment">// for all face corner.</span>
01487 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++)
01488 {
01489 <span class="comment">// The current face.</span>
01490 CMRMFace &face= lodMesh.Faces[i];
01491 <span class="comment">// for 3 corners.</span>
01492 <span class="keywordflow">for</span>(j=0;j<3;j++)
01493 {
01494 CMRMCorner &corner= face.Corner[j];
01495
01496 <span class="comment">// decal indices.</span>
01497 corner.WedgeStartId+= sglmGeomMax;
01498 corner.WedgeEndId+= sglmGeomMax;
01499 }
01500 }
01501
01502 <span class="comment">// increment too the number of wedge required for this Lod.</span>
01503 finalMRM.Lods[lodId].NWedges+= sglmGeomMax;
01504 }
01505
01506
01507 <span class="comment">// fill faces.</span>
01508 <span class="comment">// ===============</span>
01509 <span class="comment">// Parse all faces corner of All lods, and build Faces/Geomorphs..</span>
01510 <span class="keywordflow">for</span>(lodId=0; lodId<nLods; lodId++)
01511 {
01512 CMRMMeshGeom &lodMesh= lodMeshs[lodId];
01513 CMRMMeshFinal::CLod &lodDest= finalMRM.Lods[lodId];
01514
01515 <span class="comment">// alloc final faces of this LOD.</span>
01516 lodDest.Faces.resize(lodMesh.Faces.size());
01517
01518 <span class="comment">// reset the GeomMap, the one which indicate if we have already inserted a geomorph.</span>
01519 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.clear();
01520
01521 <span class="comment">// for all face corner.</span>
01522 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++)
01523 {
01524 <span class="comment">// The current face.</span>
01525 CMRMFace &face= lodMesh.Faces[i];
01526 <span class="comment">// The dest face.</span>
01527 CMRMMeshFinal::CFace &faceDest= lodDest.Faces[i];
01528 <span class="comment">// fill good material.</span>
01529 faceDest.MaterialId= face.MaterialId;
01530
01531 <span class="comment">// for 3 corners.</span>
01532 <span class="keywordflow">for</span>(j=0;j<3;j++)
01533 {
01534 CMRMCorner &corner= face.Corner[j];
01535
01536 <span class="comment">// if not same wedge Ids, this is a geomorphed wedge.</span>
01537 <span class="keywordflow">if</span>(corner.WedgeStartId != corner.WedgeEndId)
01538 {
01539 <span class="comment">// geomorph, so point to geomorphed wedge.</span>
01540 faceDest.WedgeId[j]= corner.WedgeGeomId;
01541
01542 <span class="comment">// Build the geomorph, add it to the list (if not yet inserted).</span>
01543 CMRMWedgeGeom geom;
01544 geom.Start= corner.WedgeStartId;
01545 geom.End= corner.WedgeEndId;
01546 <span class="comment">// if don't find this geom in the set, then it is a new one.</span>
01547 TGeomMap::const_iterator it= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.find(geom);
01548 <span class="keywordflow">if</span>(it == <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.end())
01549 {
01550 <span class="comment">// mark it as inserted.</span>
01551 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.insert( make_pair(geom, corner.WedgeGeomId) );
01552 <span class="comment">// and we must insert this geom in the array.</span>
01553 <a class="code" href="a04199.html#a6">nlassert</a>( corner.WedgeGeomId==(<a class="code" href="a04558.html#a14">sint</a>)lodDest.Geomorphs.size() );
01554 lodDest.Geomorphs.push_back(geom);
01555 }
01556 }
01557 <span class="keywordflow">else</span>
01558 {
01559 <span class="comment">// no geomorph, so just point to good wedge.</span>
01560 faceDest.WedgeId[j]= corner.WedgeStartId;
01561 }
01562 }
01563 }
01564 }
01565
01566
01567 <span class="comment">// process all wedges, and compute NSkinMatUsed, skipping geomorphs.</span>
01568 <span class="comment">// ===============</span>
01569 <span class="comment">// NB: this works because weights are sorted from biggest to lowest.</span>
01570 <span class="keywordflow">if</span>(_Skinned)
01571 {
01572 <span class="keywordflow">for</span>(i=finalMRM.NGeomSpace; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Wedges.size();i++)
01573 {
01574 CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[i];
01575 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++)
01576 {
01577 <span class="keywordflow">if</span>(wedge.VertexSkin.Weights[j]==0)
01578 <span class="keywordflow">break</span>;
01579 }
01580 <a class="code" href="a04199.html#a6">nlassert</a>(j>0);
01581 wedge.NSkinMatUsed= j;
01582 }
01583 }
01584
01585 <span class="comment">// Blend Shape Stuff</span>
01586 finalMRM.MRMBlendShapesFinals.resize (lodMeshs[0].BlendShapes.size());
01587 <span class="keywordflow">for</span> (lodId = 0; lodId < nLods; ++lodId)
01588 {
01589 CMRMMeshGeom &lodMesh= lodMeshs[lodId];
01590 CMRMMeshGeom &lodMeshPrec= lodMeshs[lodId==0?0:lodId-1];
01591
01592 <span class="comment">// for all face corner.</span>
01593 <span class="keywordflow">for</span> (i = 0; i < (<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size(); ++i)
01594 {
01595 <span class="comment">// The current face.</span>
01596 CMRMFace &face = lodMesh.Faces[i];
01597 <span class="comment">// the current face, but which points to the prec LOD vertices/attributes.</span>
01598 CMRMFace &faceCoarser = lodMesh.CoarserFaces[i];
01599 <span class="comment">// for 3 corners.</span>
01600 <span class="keywordflow">for</span> (j = 0; j < 3; ++j)
01601 {
01602 CMRMCorner &corner = face.Corner[j];
01603 CMRMCorner &cornerCoarser = faceCoarser.Corner[j];
01604
01605 <a class="code" href="a04558.html#a14">sint</a> startDestIndex = corner.WedgeStartId;
01606
01607 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> k = 0; k < (<a class="code" href="a04558.html#a14">sint</a>)finalMRM.MRMBlendShapesFinals.size(); ++k)
01608 {
01609 CMRMMeshFinal::CMRMBlendShapeFinal &rBSFinal = finalMRM.MRMBlendShapesFinals[k];
01610
01611 rBSFinal.Wedges.resize (finalMRM.Wedges.size());
01612 <span class="comment">// Fill WedgeStart used by this corner.</span>
01613 rBSFinal.Wedges[startDestIndex].Vertex = lodMesh.BlendShapes[k].Vertices[corner.Vertex];
01614 <span class="keywordflow">for</span> (attId = 0; attId < NumAttributes; ++attId)
01615 {
01616 rBSFinal.Wedges[startDestIndex].Attributes[attId] = lodMesh.BlendShapes[k].Attributes[attId][corner.Attributes[attId]];
01617 }
01618
01619 <span class="comment">// If geomorph, must fill the end too</span>
01620 <span class="keywordflow">if</span>(lodId>0 && corner.WedgeStartId != corner.WedgeEndId)
01621 {
01622 <a class="code" href="a04558.html#a14">sint</a> endDestIndex = corner.WedgeEndId;
01623
01624 rBSFinal.Wedges[endDestIndex].Vertex = lodMeshPrec.BlendShapes[k].Vertices[cornerCoarser.Vertex];
01625 <span class="keywordflow">for</span> (attId = 0; attId < NumAttributes; ++attId)
01626 {
01627 rBSFinal.Wedges[endDestIndex].Attributes[attId] = lodMeshPrec.BlendShapes[k].Attributes[attId][cornerCoarser.Attributes[attId]];
01628 }
01629 }
01630 }
01631
01632 }
01633 }
01634 }
01635 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_3" doxytag="NL3D::CMRMBuilder::buildMeshBuildMrm" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildMeshBuildMrm </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02961.html">CMRMMeshFinal</a> & </td>
<td class="mdname" nowrap> <em>finalMRM</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> & </td>
<td class="mdname" nowrap> <em>mbuild</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td>
<td class="mdname" nowrap> <em>vbFlags</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td>
<td class="mdname" nowrap> <em>nbMats</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td>
<td class="mdname" nowrap> <em>mb</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
from a final MRM Mesh representation, compute a CMeshBuildMRM. This is the last stage of the algo. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>vbFlags</em> </td><td>the vertex format returned by earlier call too <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh()</a>. </td></tr>
<tr><td valign=top><em>nbMats</em> </td><td>the number of materials of original MeshBuild.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06055.html#l02414">2414</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00661">NLMISC::CRGBAF::A</a>, <a class="el" href="a06710.html#l00338">NL3D::CVertexBuffer::addValueEx()</a>, <a class="el" href="a06062.html#l00215">NL3D::CMRMMeshFinal::CWedge::Attributes</a>, <a class="el" href="a06055.html#l01709">attToColor()</a>, <a class="el" href="a06055.html#l01727">attToUvw()</a>, <a class="el" href="a06340.html#l00659">NLMISC::CRGBAF::B</a>, <a class="el" href="a06012.html#l00403">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::BlendShapes</a>, <a class="el" href="a06710.html#l00271">NL3D::CVertexBuffer::clearValueEx()</a>, <a class="el" href="a06004.html#l00052">NL3D::CBlendShape::deltaCol</a>, <a class="el" href="a06004.html#l00049">NL3D::CBlendShape::deltaNorm</a>, <a class="el" href="a06004.html#l00048">NL3D::CBlendShape::deltaPos</a>, <a class="el" href="a06004.html#l00050">NL3D::CBlendShape::deltaTgSpace</a>, <a class="el" href="a06004.html#l00051">NL3D::CBlendShape::deltaUV</a>, <a class="el" href="a06062.html#l00266">NL3D::CMRMMeshFinal::CLod::Faces</a>, <a class="el" href="a06340.html#l00657">NLMISC::CRGBAF::G</a>, <a class="el" href="a06062.html#l00268">NL3D::CMRMMeshFinal::CLod::Geomorphs</a>, <a class="el" href="a06012.html#l00353">NL3D::CMeshMRMSkinnedGeom::CLod::Geomorphs</a>, <a class="el" href="a06012.html#l00360">NL3D::CMeshMRMSkinnedGeom::CLod::InfluencedVertices</a>, <a class="el" href="a06710.html#l00369">NL3D::CVertexBuffer::initEx()</a>, <a class="el" href="a06062.html#l00289">NL3D::CMRMMeshFinal::Lods</a>, <a class="el" href="a06012.html#l00400">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::Lods</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06012.html#l00362">NL3D::CMeshMRMSkinnedGeom::CLod::MatrixInfluences</a>, <a class="el" href="a05990.html#l00202">NL3D::CMesh::CMeshBuild::MeshVertexProgram</a>, <a class="el" href="a06062.html#l00292">NL3D::CMRMMeshFinal::MRMBlendShapesFinals</a>, <a class="el" href="a06062.html#l00283">NL3D::CMRMMeshFinal::NGeomSpace</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a05990.html#l00180">NL3D::CMesh::CMeshBuild::NumCoords</a>, <a class="el" href="a06062.html#l00264">NL3D::CMRMMeshFinal::CLod::NWedges</a>, <a class="el" href="a06012.html#l00351">NL3D::CMeshMRMSkinnedGeom::CLod::NWedges</a>, <a class="el" href="a06340.html#l00655">NLMISC::CRGBAF::R</a>, <a class="el" href="a06012.html#l00355">NL3D::CMeshMRMSkinnedGeom::CLod::RdrPass</a>, <a class="el" href="a06711.html#l00568">NL3D::CVertexBuffer::setColor()</a>, <a class="el" href="a06711.html#l00554">NL3D::CVertexBuffer::setNormalCoord()</a>, <a class="el" href="a06710.html#l00409">NL3D::CVertexBuffer::setNumVertices()</a>, <a class="el" href="a06711.html#l00584">NL3D::CVertexBuffer::setSpecular()</a>, <a class="el" href="a06711.html#l00600">NL3D::CVertexBuffer::setTexCoord()</a>, <a class="el" href="a06711.html#l00505">NL3D::CVertexBuffer::setUVRouting()</a>, <a class="el" href="a06711.html#l00795">NL3D::CVertexBuffer::setValueFloat3Ex()</a>, <a class="el" href="a06711.html#l00524">NL3D::CVertexBuffer::setVertexCoord()</a>, <a class="el" href="a06710.html#l00169">NL3D::CVertexBuffer::setVertexFormat()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06012.html#l00391">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::Skinned</a>, <a class="el" href="a06012.html#l00394">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::SkinWeights</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::U</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00181">NL3D::CMesh::CMeshBuild::UVRouting</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::V</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06012.html#l00397">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::VBuffer</a>, <a class="el" href="a06062.html#l00214">NL3D::CMRMMeshFinal::CWedge::Vertex</a>, <a class="el" href="a06062.html#l00211">NL3D::CMRMMeshFinal::CWedge::VertexSkin</a>, <a class="el" href="a06004.html#l00054">NL3D::CBlendShape::VertRefs</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06062.html#l00281">NL3D::CMRMMeshFinal::Wedges</a>, <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
<div class="fragment"><pre>02415 {
02416 <a class="code" href="a04558.html#a14">sint</a> i,j,k;
02417 <a class="code" href="a04558.html#a14">sint</a> attId;
02418
02419 <span class="comment">// reset the mbuild.</span>
02420 mbuild= CMeshMRMSkinnedGeom::CMeshBuildMRM();
02421 <span class="comment">// Setup VB.</span>
02422
02423 <span class="keywordtype">bool</span> useFormatExt = <span class="keyword">false</span>;
02424 <span class="comment">// Check wether there are texture coordinates with more than 2 compnents, which force us to use an extended vertex format</span>
02425 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k)
02426 {
02427 <span class="keywordflow">if</span> (
02428 (vbFlags & (CVertexBuffer::TexCoord0Flag << k))
02429 && mb.NumCoords[k] != 2)
02430 {
02431 useFormatExt = <span class="keyword">true</span>;
02432 <span class="keywordflow">break</span>;
02433 }
02434 }
02435
02436 <a class="code" href="a04558.html#a15">uint</a> numTexCoordUsed = 0;
02437
02438
02439 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k)
02440 {
02441 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k))
02442 {
02443 numTexCoordUsed = k;
02444 }
02445 }
02446
02447 <span class="keywordflow">if</span> (!useFormatExt)
02448 {
02449 <span class="comment">// setup standard format</span>
02450 mbuild.VBuffer.setVertexFormat(vbFlags);
02451 }
02452 <span class="keywordflow">else</span> <span class="comment">// setup extended format</span>
02453 {
02454 mbuild.VBuffer.clearValueEx();
02455 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PositionFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Position, CVertexBuffer::Float3);
02456 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Normal, CVertexBuffer::Float3);
02457 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PrimaryColor, CVertexBuffer::UChar4);
02458 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::SecondaryColor, CVertexBuffer::UChar4);
02459 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::WeightFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Weight, CVertexBuffer::Float4);
02460 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PaletteSkinFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PaletteSkin, CVertexBuffer::UChar4);
02461 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::FogFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Fog, CVertexBuffer::Float1);
02462
02463 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k)
02464 {
02465 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k))
02466 {
02467 <span class="keywordflow">switch</span>(mb.NumCoords[k])
02468 {
02469 <span class="keywordflow">case</span> 2:
02470 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float2);
02471 <span class="keywordflow">break</span>;
02472 <span class="keywordflow">case</span> 3:
02473 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float3);
02474 <span class="keywordflow">break</span>;
02475 <span class="keywordflow">default</span>:
02476 <a class="code" href="a04199.html#a6">nlassert</a>(0);
02477 <span class="keywordflow">break</span>;
02478 }
02479 }
02480 }
02481 mbuild.VBuffer.initEx();
02482 }
02483
02484 <span class="comment">// Copy the UVRouting</span>
02485 <span class="keywordflow">for</span> (i=0; i<CVertexBuffer::MaxStage; i++)
02486 {
02487 mbuild.VBuffer.setUVRouting (i, mb.UVRouting[i]);
02488 }
02489
02490 <span class="comment">// Setup the VertexBuffer.</span>
02491 <span class="comment">// ========================</span>
02492 <span class="comment">// resize the VB.</span>
02493 mbuild.VBuffer.setNumVertices(finalMRM.Wedges.size());
02494 <span class="comment">// Setup SkinWeights.</span>
02495 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
02496 mbuild.SkinWeights.resize(finalMRM.Wedges.size());
02497
02498 <span class="comment">// fill the VB.</span>
02499 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Wedges.size(); i++)
02500 {
02501 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[i];
02502
02503 <span class="comment">// setup Vertex.</span>
02504 mbuild.VBuffer.setVertexCoord(i, wedge.Vertex);
02505
02506 <span class="comment">// seutp attributes.</span>
02507 attId= 0;
02508
02509 <span class="comment">// For all activated attributes in mbuild, retriev the attribute from the finalMRM.</span>
02510 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::NormalFlag)
02511 {
02512 mbuild.VBuffer.setNormalCoord(i, wedge.Attributes[attId] );
02513 attId++;
02514 }
02515 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::PrimaryColorFlag)
02516 {
02517 mbuild.VBuffer.setColor(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) );
02518 attId++;
02519 }
02520 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::SecondaryColorFlag)
02521 {
02522 mbuild.VBuffer.setSpecular(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) );
02523 attId++;
02524 }
02525 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++)
02526 {
02527 <span class="keywordflow">if</span>(vbFlags & (CVertexBuffer::TexCoord0Flag<<k))
02528 {
02529 <span class="keywordflow">switch</span>(mb.NumCoords[k])
02530 {
02531 <span class="keywordflow">case</span> 2:
02532 mbuild.VBuffer.setTexCoord(i, k, (CUV) <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]) );
02533 <span class="keywordflow">break</span>;
02534 <span class="keywordflow">case</span> 3:
02535 {
02536 <a class="code" href="a03641.html">CUVW</a> uvw = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]);
02537 mbuild.VBuffer.setValueFloat3Ex((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), i, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo0">U</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo1">V</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo2">W</a>);
02538 }
02539 <span class="keywordflow">break</span>;
02540 <span class="keywordflow">default</span>:
02541 <a class="code" href="a04199.html#a6">nlassert</a>(0);
02542 <span class="keywordflow">break</span>;
02543 }
02544 attId++;
02545 }
02546 }
02547
02548 <span class="comment">// Setup SkinWeights.</span>
02549 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
02550 {
02551 mbuild.SkinWeights[i]= wedge.VertexSkin;
02552 }
02553 }
02554
02555
02556 <span class="comment">// Build Lods.</span>
02557 <span class="comment">// ========================</span>
02558 <span class="comment">// resize</span>
02559 mbuild.Lods.resize(finalMRM.Lods.size());
02560 <span class="comment">// fill.</span>
02561 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Lods.size(); i++)
02562 {
02563 <span class="keyword">const</span> CMRMMeshFinal::CLod &srcLod= finalMRM.Lods[i];
02564 CMeshMRMSkinnedGeom::CLod &destLod= mbuild.Lods[i];
02565
02566 <span class="comment">// Basic.</span>
02567 <span class="comment">//---------</span>
02568
02569 <span class="comment">// Copy NWedges infos.</span>
02570 destLod.NWedges= srcLod.NWedges;
02571 <span class="comment">// Copy Geomorphs infos.</span>
02572 destLod.Geomorphs= srcLod.Geomorphs;
02573
02574
02575 <span class="comment">// Reorder faces by rdrpass.</span>
02576 <span class="comment">//---------</span>
02577
02578 <span class="comment">// First count the number of faces used by this LOD for each material </span>
02579 vector<sint> matCount;
02580 <span class="comment">// resize, and reset to 0.</span>
02581 matCount.clear();
02582 matCount.resize(nbMats, 0);
02583 <span class="comment">// For each face of this Lods, incr the mat face counter.</span>
02584 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++)
02585 {
02586 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId;
02587 <a class="code" href="a04199.html#a6">nlassert</a>(matId>=0);
02588 <a class="code" href="a04199.html#a6">nlassert</a>(matId<(<a class="code" href="a04558.html#a14">sint</a>)nbMats);
02589 <span class="comment">// increment the refcount of this material by this LOD.</span>
02590 matCount[matId]++;
02591 }
02592
02593 <span class="comment">// Then for each material not empty, create a rdrPass, and ref it for this material.</span>
02594 vector<sint> rdrPassIndex; <span class="comment">// material to rdrPass map.</span>
02595 rdrPassIndex.resize(nbMats);
02596 <span class="keywordflow">for</span>(j=0; j<(<a class="code" href="a04558.html#a14">sint</a>)nbMats; j++)
02597 {
02598 <span class="keywordflow">if</span>(matCount[j]==0)
02599 rdrPassIndex[j]= -1;
02600 <span class="keywordflow">else</span>
02601 {
02602 <span class="comment">// map material to rdrPass.</span>
02603 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= destLod.RdrPass.size();
02604 rdrPassIndex[j]= idRdrPass;
02605 <span class="comment">// create a rdrPass.</span>
02606 destLod.RdrPass.push_back(CMeshMRMSkinnedGeom::CRdrPass());
02607 <span class="comment">// assign the good materialId to this rdrPass.</span>
02608 destLod.RdrPass[idRdrPass].MaterialId= j;
02609 <span class="comment">// reserve the array of faces of this rdrPass.</span>
02610 destLod.RdrPass[idRdrPass].PBlock.reserve(3*matCount[j]);
02611 }
02612 }
02613
02614 <span class="comment">// Then for each face, add it to the good rdrPass of this Lod.</span>
02615 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++)
02616 {
02617 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId;
02618 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= rdrPassIndex[matId];
02619 <span class="comment">// add this face to the good rdrPass.</span>
02620 <a class="code" href="a04558.html#a14">sint</a> w0= srcLod.Faces[j].WedgeId[0];
02621 <a class="code" href="a04558.html#a14">sint</a> w1= srcLod.Faces[j].WedgeId[1];
02622 <a class="code" href="a04558.html#a14">sint</a> w2= srcLod.Faces[j].WedgeId[2];
02623 destLod.RdrPass[idRdrPass].PBlock.push_back (w0);
02624 destLod.RdrPass[idRdrPass].PBlock.push_back (w1);
02625 destLod.RdrPass[idRdrPass].PBlock.push_back (w2);
02626 }
02627
02628
02629 <span class="comment">// Build skin info for this Lod.</span>
02630 <span class="comment">//---------</span>
02631 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++)
02632 {
02633 destLod.InfluencedVertices[j].clear();
02634 }
02635 destLod.MatrixInfluences.clear();
02636 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
02637 {
02638 <span class="comment">// This is the set which tell what wedge has already been inserted.</span>
02639 set<uint> wedgeInfSet;
02640
02641 <span class="comment">// First, build the list of vertices influenced by this Lod.</span>
02642 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++)
02643 {
02644 <span class="keywordflow">for</span>(k=0; k<3; k++)
02645 {
02646 <a class="code" href="a04558.html#a14">sint</a> wedgeId= srcLod.Faces[j].WedgeId[k];
02647 <span class="comment">// If it is a geomorph</span>
02648 <span class="keywordflow">if</span>(wedgeId<finalMRM.NGeomSpace)
02649 {
02650 <span class="comment">// add the start and end to the list (if not here). NB: wedgeId is both the id </span>
02651 <span class="comment">// of the dest wedge, and the id of the geomorph.</span>
02652 <a class="code" href="a04558.html#a14">sint</a> wedgeStartId= destLod.Geomorphs[wedgeId].Start;
02653 <a class="code" href="a04558.html#a14">sint</a> wedgeEndId= destLod.Geomorphs[wedgeId].End;
02654 <a class="code" href="a04558.html#a15">uint</a> nMatUsedStart= finalMRM.Wedges[wedgeStartId].NSkinMatUsed;
02655 <a class="code" href="a04558.html#a15">uint</a> nMatUsedEnd= finalMRM.Wedges[wedgeEndId].NSkinMatUsed;
02656
02657 <span class="comment">// if insertion in the set work, add to the good array.</span>
02658 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeStartId).second )
02659 destLod.InfluencedVertices[nMatUsedStart-1].push_back(wedgeStartId);
02660 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeEndId).second )
02661 destLod.InfluencedVertices[nMatUsedEnd-1].push_back(wedgeEndId);
02662 }
02663 <span class="keywordflow">else</span>
02664 {
02665 <a class="code" href="a04558.html#a15">uint</a> nMatUsed= finalMRM.Wedges[wedgeId].NSkinMatUsed;
02666
02667 <span class="comment">// just add this wedge to the list (if not here).</span>
02668 <span class="comment">// if insertion in the set work, add to the array.</span>
02669 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeId).second )
02670 destLod.InfluencedVertices[nMatUsed-1].push_back(wedgeId);
02671 }
02672 }
02673 }
02674
02675 <span class="comment">// Optimisation: for better cache, sort the destLod.InfluencedVertices in increasing order.</span>
02676 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++)
02677 {
02678 sort(destLod.InfluencedVertices[j].begin(), destLod.InfluencedVertices[j].end());
02679 }
02680
02681
02682 <span class="comment">// Then Build the MatrixInfluences array, for all thoses Influenced Vertices only.</span>
02683 <span class="comment">// This is the map MatrixId -> MatrixInfId.</span>
02684 map<uint, uint> matrixInfMap;
02685
02686 <span class="comment">// For all influenced vertices, flags matrix they use.</span>
02687 <a class="code" href="a04558.html#a15">uint</a> iSkinMat;
02688 <span class="keywordflow">for</span>(iSkinMat= 0; iSkinMat<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; iSkinMat++)
02689 {
02690 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)destLod.InfluencedVertices[iSkinMat].size(); j++)
02691 {
02692 <a class="code" href="a04558.html#a15">uint</a> wedgeId= destLod.InfluencedVertices[iSkinMat][j];
02693
02694 <span class="comment">// take the original wedge.</span>
02695 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[wedgeId];
02696 <span class="comment">// For all matrix with not null influence...</span>
02697 <span class="keywordflow">for</span>(k= 0; k<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; k++)
02698 {
02699 <span class="keywordtype">float</span> matWeight= wedge.VertexSkin.Weights[k];
02700
02701 <span class="comment">// This check the validity of skin weights sort. If false, problem before in the algo.</span>
02702 <span class="keywordflow">if</span>((<a class="code" href="a04558.html#a15">uint</a>)k<iSkinMat+1)
02703 {
02704 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight>0 );
02705 }
02706 <span class="keywordflow">else</span>
02707 {
02708 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight==0 );
02709 }
02710 <span class="comment">// if not null influence.</span>
02711 <span class="keywordflow">if</span>(matWeight>0)
02712 {
02713 <a class="code" href="a04558.html#a15">uint</a> matId= wedge.VertexSkin.MatrixId[k];
02714
02715 <span class="comment">// search/insert the matrixInfId.</span>
02716 map<uint, uint>::iterator it= matrixInfMap.find(matId);
02717 <span class="keywordflow">if</span>( it==matrixInfMap.end() )
02718 {
02719 <a class="code" href="a04558.html#a15">uint</a> matInfId= destLod.MatrixInfluences.size();
02720 matrixInfMap.insert( make_pair(matId, matInfId) );
02721 <span class="comment">// create the new MatrixInfluence.</span>
02722 destLod.MatrixInfluences.push_back(matId);
02723 }
02724 }
02725 }
02726 }
02727 }
02728
02729 }
02730
02731 }
02732
02733 <span class="comment">// Indicate Skinning.</span>
02734 mbuild.Skinned= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>;
02735
02736
02737
02738 <span class="keywordtype">bool</span> useTgSpace = mb.MeshVertexProgram != NULL ? mb.MeshVertexProgram->needTangentSpace() : false;
02739
02740 <span class="comment">// Construct Blend Shapes</span>
02742 <span class="comment"></span> mbuild.BlendShapes.resize (finalMRM.MRMBlendShapesFinals.size());
02743 <span class="keywordflow">for</span> (k = 0; k < (<a class="code" href="a04558.html#a14">sint</a>)mbuild.BlendShapes.size(); ++k)
02744 {
02745 CBlendShape &rBS = mbuild.BlendShapes[k];
02746 <a class="code" href="a04558.html#a10">sint32</a> nNbVertVB = finalMRM.Wedges.size();
02747 <span class="keywordtype">bool</span> bIsDeltaPos = <span class="keyword">false</span>;
02748 rBS.deltaPos.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f));
02749 <span class="keywordtype">bool</span> bIsDeltaNorm = <span class="keyword">false</span>;
02750 rBS.deltaNorm.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f));
02751 <span class="keywordtype">bool</span> bIsDeltaUV = <span class="keyword">false</span>;
02752 rBS.deltaUV.resize (nNbVertVB, CUV(0.0f,0.0f));
02753 <span class="keywordtype">bool</span> bIsDeltaCol = <span class="keyword">false</span>;
02754 rBS.deltaCol.resize (nNbVertVB, <a class="code" href="a03338.html">CRGBAF</a>(0.0f,0.0f,0.0f,0.0f));
02755 <span class="keywordtype">bool</span> bIsDeltaTgSpace = <span class="keyword">false</span>;
02756 <span class="keywordflow">if</span> (useTgSpace)
02757 {
02758 rBS.deltaTgSpace.resize(nNbVertVB, CVector::Null);
02759 }
02760
02761 rBS.VertRefs.resize (nNbVertVB, 0xffffffff);
02762
02763 <span class="keywordflow">for</span> (i = 0; i < nNbVertVB; i++)
02764 {
02765 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeRef = finalMRM.Wedges[i];
02766 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeTar = finalMRM.MRMBlendShapesFinals[k].Wedges[i];
02767
02768 CVector delta = rWedgeTar.Vertex - rWedgeRef.Vertex;
02769 <a class="code" href="a03668.html">CVectorH</a> attr;
02770
02771 <span class="keywordflow">if</span> (delta.norm() > 0.001f)
02772 {
02773 rBS.deltaPos[i] = delta;
02774 rBS.VertRefs[i] = i;
02775 bIsDeltaPos = <span class="keyword">true</span>;
02776 }
02777
02778 attId = 0;
02779 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag)
02780 {
02781 attr = rWedgeRef.Attributes[attId];
02782 CVector NormRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02783 attr = rWedgeTar.Attributes[attId];
02784 CVector NormTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02785 delta = NormTar - NormRef;
02786 <span class="keywordflow">if</span> (delta.norm() > 0.001f)
02787 {
02788 rBS.deltaNorm[i] = delta;
02789 rBS.VertRefs[i] = i;
02790 bIsDeltaNorm = <span class="keyword">true</span>;
02791 }
02792 attId++;
02793 }
02794
02795 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag)
02796 {
02797 attr = rWedgeRef.Attributes[attId];
02798 <a class="code" href="a03338.html">CRGBAF</a> RGBARef = <a class="code" href="a03338.html">CRGBAF</a>(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f);
02799 attr = rWedgeTar.Attributes[attId];
02800 CRGBAF RGBATar = CRGBAF(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f);
02801 CRGBAF deltaRGBA = RGBATar - RGBARef;
02802 <span class="keywordflow">if</span> ((deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a> +
02803 deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>) > 0.0001f)
02804 {
02805 rBS.deltaCol[i] = deltaRGBA;
02806 rBS.VertRefs[i] = i;
02807 bIsDeltaCol = <span class="keyword">true</span>;
02808 }
02809 attId++;
02810 }
02811
02812 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag)
02813 { <span class="comment">// Nothing to do !</span>
02814 attId++;
02815 }
02816
02817 <span class="comment">// Do that only for the UV0</span>
02818 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::TexCoord0Flag)
02819 {
02820 attr = rWedgeRef.Attributes[attId];
02821 CUV UVRef = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>);
02822 attr = rWedgeTar.Attributes[attId];
02823 CUV UVTar = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>);
02824 CUV deltaUV = UVTar - UVRef;
02825 <span class="keywordflow">if</span> ((deltaUV.U*deltaUV.U + deltaUV.V*deltaUV.V) > 0.0001f)
02826 {
02827 rBS.deltaUV[i] = deltaUV;
02828 rBS.VertRefs[i] = i;
02829 bIsDeltaUV = <span class="keyword">true</span>;
02830 }
02831 attId++;
02832 }
02833
02834 <span class="keywordflow">if</span> (useTgSpace)
02835 {
02836 attr = rWedgeRef.Attributes[attId];
02837 CVector TgSpaceRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02838 attr = rWedgeTar.Attributes[attId];
02839 CVector TgSpaceTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02840 delta = TgSpaceTar - TgSpaceRef;
02841 <span class="keywordflow">if</span> (delta.norm() > 0.001f)
02842 {
02843 rBS.deltaTgSpace[i] = delta;
02844 rBS.VertRefs[i] = i;
02845 bIsDeltaTgSpace = <span class="keyword">true</span>;
02846 }
02847 attId++;
02848 }
02849
02850 } <span class="comment">// End of all vertices added in blend shape</span>
02851
02852 <span class="comment">// Delete unused items and calculate the number of vertex used (blended)</span>
02853
02854 <a class="code" href="a04558.html#a10">sint32</a> nNbVertUsed = nNbVertVB;
02855 <a class="code" href="a04558.html#a10">sint32</a> nDstPos = 0;
02856 <span class="keywordflow">for</span> (j = 0; j < nNbVertVB; ++j)
02857 {
02858 <span class="keywordflow">if</span> (rBS.VertRefs[j] == 0xffffffff) <span class="comment">// Is vertex UNused</span>
02859 {
02860 --nNbVertUsed;
02861 }
02862 <span class="keywordflow">else</span> <span class="comment">// Vertex used</span>
02863 {
02864 <span class="keywordflow">if</span> (nDstPos != j)
02865 {
02866 rBS.VertRefs[nDstPos] = rBS.VertRefs[j];
02867 rBS.deltaPos[nDstPos] = rBS.deltaPos[j];
02868 rBS.deltaNorm[nDstPos] = rBS.deltaNorm[j];
02869 rBS.deltaUV[nDstPos] = rBS.deltaUV[j];
02870 rBS.deltaCol[nDstPos] = rBS.deltaCol[j];
02871 <span class="keywordflow">if</span> (useTgSpace)
02872 {
02873 rBS.deltaTgSpace[nDstPos] = rBS.deltaTgSpace[j];
02874 }
02875 }
02876 ++nDstPos;
02877 }
02878 }
02879
02880 <span class="keywordflow">if</span> (bIsDeltaPos)
02881 rBS.deltaPos.resize (nNbVertUsed);
02882 <span class="keywordflow">else</span>
02883 rBS.deltaPos.resize (0);
02884
02885 <span class="keywordflow">if</span> (bIsDeltaNorm)
02886 rBS.deltaNorm.resize (nNbVertUsed);
02887 <span class="keywordflow">else</span>
02888 rBS.deltaNorm.resize (0);
02889
02890 <span class="keywordflow">if</span> (bIsDeltaUV)
02891 rBS.deltaUV.resize (nNbVertUsed);
02892 <span class="keywordflow">else</span>
02893 rBS.deltaUV.resize (0);
02894
02895 <span class="keywordflow">if</span> (bIsDeltaCol)
02896 rBS.deltaCol.resize (nNbVertUsed);
02897 <span class="keywordflow">else</span>
02898 rBS.deltaCol.resize (0);
02899
02900 <span class="keywordflow">if</span> (bIsDeltaTgSpace)
02901 rBS.deltaTgSpace.resize (nNbVertUsed);
02902 <span class="keywordflow">else</span>
02903 rBS.deltaTgSpace.resize (0);
02904
02905
02906 rBS.VertRefs.resize (nNbVertUsed);
02907
02908 }
02909 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_4" doxytag="NL3D::CMRMBuilder::buildMeshBuildMrm" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildMeshBuildMrm </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02961.html">CMRMMeshFinal</a> & </td>
<td class="mdname" nowrap> <em>finalMRM</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> & </td>
<td class="mdname" nowrap> <em>mbuild</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td>
<td class="mdname" nowrap> <em>vbFlags</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td>
<td class="mdname" nowrap> <em>nbMats</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td>
<td class="mdname" nowrap> <em>mb</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
from a final MRM Mesh representation, compute a CMeshBuildMRM. This is the last stage of the algo. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>vbFlags</em> </td><td>the vertex format returned by earlier call too <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh()</a>. </td></tr>
<tr><td valign=top><em>nbMats</em> </td><td>the number of materials of original MeshBuild.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06055.html#l01918">1918</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00661">NLMISC::CRGBAF::A</a>, <a class="el" href="a06710.html#l00338">NL3D::CVertexBuffer::addValueEx()</a>, <a class="el" href="a06062.html#l00215">NL3D::CMRMMeshFinal::CWedge::Attributes</a>, <a class="el" href="a06055.html#l01709">attToColor()</a>, <a class="el" href="a06055.html#l01727">attToUvw()</a>, <a class="el" href="a06340.html#l00659">NLMISC::CRGBAF::B</a>, <a class="el" href="a06006.html#l00436">NL3D::CMeshMRMGeom::CMeshBuildMRM::BlendShapes</a>, <a class="el" href="a06710.html#l00271">NL3D::CVertexBuffer::clearValueEx()</a>, <a class="el" href="a06004.html#l00052">NL3D::CBlendShape::deltaCol</a>, <a class="el" href="a06004.html#l00049">NL3D::CBlendShape::deltaNorm</a>, <a class="el" href="a06004.html#l00048">NL3D::CBlendShape::deltaPos</a>, <a class="el" href="a06004.html#l00050">NL3D::CBlendShape::deltaTgSpace</a>, <a class="el" href="a06004.html#l00051">NL3D::CBlendShape::deltaUV</a>, <a class="el" href="a06062.html#l00266">NL3D::CMRMMeshFinal::CLod::Faces</a>, <a class="el" href="a06340.html#l00657">NLMISC::CRGBAF::G</a>, <a class="el" href="a06062.html#l00268">NL3D::CMRMMeshFinal::CLod::Geomorphs</a>, <a class="el" href="a06006.html#l00383">NL3D::CMeshMRMGeom::CLod::Geomorphs</a>, <a class="el" href="a06006.html#l00390">NL3D::CMeshMRMGeom::CLod::InfluencedVertices</a>, <a class="el" href="a06710.html#l00369">NL3D::CVertexBuffer::initEx()</a>, <a class="el" href="a06062.html#l00289">NL3D::CMRMMeshFinal::Lods</a>, <a class="el" href="a06006.html#l00433">NL3D::CMeshMRMGeom::CMeshBuildMRM::Lods</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06006.html#l00392">NL3D::CMeshMRMGeom::CLod::MatrixInfluences</a>, <a class="el" href="a05990.html#l00202">NL3D::CMesh::CMeshBuild::MeshVertexProgram</a>, <a class="el" href="a06062.html#l00292">NL3D::CMRMMeshFinal::MRMBlendShapesFinals</a>, <a class="el" href="a06062.html#l00283">NL3D::CMRMMeshFinal::NGeomSpace</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a05990.html#l00180">NL3D::CMesh::CMeshBuild::NumCoords</a>, <a class="el" href="a06062.html#l00264">NL3D::CMRMMeshFinal::CLod::NWedges</a>, <a class="el" href="a06006.html#l00381">NL3D::CMeshMRMGeom::CLod::NWedges</a>, <a class="el" href="a06340.html#l00655">NLMISC::CRGBAF::R</a>, <a class="el" href="a06006.html#l00385">NL3D::CMeshMRMGeom::CLod::RdrPass</a>, <a class="el" href="a06711.html#l00568">NL3D::CVertexBuffer::setColor()</a>, <a class="el" href="a06711.html#l00554">NL3D::CVertexBuffer::setNormalCoord()</a>, <a class="el" href="a06710.html#l00409">NL3D::CVertexBuffer::setNumVertices()</a>, <a class="el" href="a06711.html#l00584">NL3D::CVertexBuffer::setSpecular()</a>, <a class="el" href="a06711.html#l00600">NL3D::CVertexBuffer::setTexCoord()</a>, <a class="el" href="a06711.html#l00505">NL3D::CVertexBuffer::setUVRouting()</a>, <a class="el" href="a06711.html#l00795">NL3D::CVertexBuffer::setValueFloat3Ex()</a>, <a class="el" href="a06711.html#l00524">NL3D::CVertexBuffer::setVertexCoord()</a>, <a class="el" href="a06710.html#l00169">NL3D::CVertexBuffer::setVertexFormat()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06006.html#l00424">NL3D::CMeshMRMGeom::CMeshBuildMRM::Skinned</a>, <a class="el" href="a06006.html#l00427">NL3D::CMeshMRMGeom::CMeshBuildMRM::SkinWeights</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::U</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00181">NL3D::CMesh::CMeshBuild::UVRouting</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::V</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06006.html#l00430">NL3D::CMeshMRMGeom::CMeshBuildMRM::VBuffer</a>, <a class="el" href="a06062.html#l00214">NL3D::CMRMMeshFinal::CWedge::Vertex</a>, <a class="el" href="a06062.html#l00211">NL3D::CMRMMeshFinal::CWedge::VertexSkin</a>, <a class="el" href="a06004.html#l00054">NL3D::CBlendShape::VertRefs</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06062.html#l00281">NL3D::CMRMMeshFinal::Wedges</a>, <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>01919 {
01920 <a class="code" href="a04558.html#a14">sint</a> i,j,k;
01921 <a class="code" href="a04558.html#a14">sint</a> attId;
01922
01923 <span class="comment">// reset the mbuild.</span>
01924 mbuild= CMeshMRMGeom::CMeshBuildMRM();
01925 <span class="comment">// Setup VB.</span>
01926
01927 <span class="keywordtype">bool</span> useFormatExt = <span class="keyword">false</span>;
01928 <span class="comment">// Check wether there are texture coordinates with more than 2 compnents, which force us to use an extended vertex format</span>
01929 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k)
01930 {
01931 <span class="keywordflow">if</span> (
01932 (vbFlags & (CVertexBuffer::TexCoord0Flag << k))
01933 && mb.NumCoords[k] != 2)
01934 {
01935 useFormatExt = <span class="keyword">true</span>;
01936 <span class="keywordflow">break</span>;
01937 }
01938 }
01939
01940 <a class="code" href="a04558.html#a15">uint</a> numTexCoordUsed = 0;
01941
01942
01943 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k)
01944 {
01945 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k))
01946 {
01947 numTexCoordUsed = k;
01948 }
01949 }
01950
01951 <span class="keywordflow">if</span> (!useFormatExt)
01952 {
01953 <span class="comment">// setup standard format</span>
01954 mbuild.VBuffer.setVertexFormat(vbFlags);
01955 }
01956 <span class="keywordflow">else</span> <span class="comment">// setup extended format</span>
01957 {
01958 mbuild.VBuffer.clearValueEx();
01959 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PositionFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Position, CVertexBuffer::Float3);
01960 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Normal, CVertexBuffer::Float3);
01961 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PrimaryColor, CVertexBuffer::UChar4);
01962 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::SecondaryColor, CVertexBuffer::UChar4);
01963 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::WeightFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Weight, CVertexBuffer::Float4);
01964 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PaletteSkinFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PaletteSkin, CVertexBuffer::UChar4);
01965 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::FogFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Fog, CVertexBuffer::Float1);
01966
01967 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k)
01968 {
01969 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k))
01970 {
01971 <span class="keywordflow">switch</span>(mb.NumCoords[k])
01972 {
01973 <span class="keywordflow">case</span> 2:
01974 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float2);
01975 <span class="keywordflow">break</span>;
01976 <span class="keywordflow">case</span> 3:
01977 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float3);
01978 <span class="keywordflow">break</span>;
01979 <span class="keywordflow">default</span>:
01980 <a class="code" href="a04199.html#a6">nlassert</a>(0);
01981 <span class="keywordflow">break</span>;
01982 }
01983 }
01984 }
01985 mbuild.VBuffer.initEx();
01986 }
01987
01988 <span class="comment">// Copy the UVRouting</span>
01989 <span class="keywordflow">for</span> (i=0; i<CVertexBuffer::MaxStage; i++)
01990 {
01991 mbuild.VBuffer.setUVRouting (i, mb.UVRouting[i]);
01992 }
01993
01994 <span class="comment">// Setup the VertexBuffer.</span>
01995 <span class="comment">// ========================</span>
01996 <span class="comment">// resize the VB.</span>
01997 mbuild.VBuffer.setNumVertices(finalMRM.Wedges.size());
01998 <span class="comment">// Setup SkinWeights.</span>
01999 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
02000 mbuild.SkinWeights.resize(finalMRM.Wedges.size());
02001
02002 <span class="comment">// fill the VB.</span>
02003 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Wedges.size(); i++)
02004 {
02005 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[i];
02006
02007 <span class="comment">// setup Vertex.</span>
02008 mbuild.VBuffer.setVertexCoord(i, wedge.Vertex);
02009
02010 <span class="comment">// seutp attributes.</span>
02011 attId= 0;
02012
02013 <span class="comment">// For all activated attributes in mbuild, retriev the attribute from the finalMRM.</span>
02014 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::NormalFlag)
02015 {
02016 mbuild.VBuffer.setNormalCoord(i, wedge.Attributes[attId] );
02017 attId++;
02018 }
02019 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::PrimaryColorFlag)
02020 {
02021 mbuild.VBuffer.setColor(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) );
02022 attId++;
02023 }
02024 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::SecondaryColorFlag)
02025 {
02026 mbuild.VBuffer.setSpecular(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) );
02027 attId++;
02028 }
02029 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++)
02030 {
02031 <span class="keywordflow">if</span>(vbFlags & (CVertexBuffer::TexCoord0Flag<<k))
02032 {
02033 <span class="keywordflow">switch</span>(mb.NumCoords[k])
02034 {
02035 <span class="keywordflow">case</span> 2:
02036 mbuild.VBuffer.setTexCoord(i, k, (CUV) <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]) );
02037 <span class="keywordflow">break</span>;
02038 <span class="keywordflow">case</span> 3:
02039 {
02040 <a class="code" href="a03641.html">CUVW</a> uvw = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]);
02041 mbuild.VBuffer.setValueFloat3Ex((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), i, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo0">U</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo1">V</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo2">W</a>);
02042 }
02043 <span class="keywordflow">break</span>;
02044 <span class="keywordflow">default</span>:
02045 <a class="code" href="a04199.html#a6">nlassert</a>(0);
02046 <span class="keywordflow">break</span>;
02047 }
02048 attId++;
02049 }
02050 }
02051
02052 <span class="comment">// Setup SkinWeights.</span>
02053 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
02054 {
02055 mbuild.SkinWeights[i]= wedge.VertexSkin;
02056 }
02057 }
02058
02059
02060 <span class="comment">// Build Lods.</span>
02061 <span class="comment">// ========================</span>
02062 <span class="comment">// resize</span>
02063 mbuild.Lods.resize(finalMRM.Lods.size());
02064 <span class="comment">// fill.</span>
02065 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Lods.size(); i++)
02066 {
02067 <span class="keyword">const</span> CMRMMeshFinal::CLod &srcLod= finalMRM.Lods[i];
02068 CMeshMRMGeom::CLod &destLod= mbuild.Lods[i];
02069
02070 <span class="comment">// Basic.</span>
02071 <span class="comment">//---------</span>
02072
02073 <span class="comment">// Copy NWedges infos.</span>
02074 destLod.NWedges= srcLod.NWedges;
02075 <span class="comment">// Copy Geomorphs infos.</span>
02076 destLod.Geomorphs= srcLod.Geomorphs;
02077
02078
02079 <span class="comment">// Reorder faces by rdrpass.</span>
02080 <span class="comment">//---------</span>
02081
02082 <span class="comment">// First count the number of faces used by this LOD for each material </span>
02083 vector<sint> matCount;
02084 <span class="comment">// resize, and reset to 0.</span>
02085 matCount.clear();
02086 matCount.resize(nbMats, 0);
02087 <span class="comment">// For each face of this Lods, incr the mat face counter.</span>
02088 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++)
02089 {
02090 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId;
02091 <a class="code" href="a04199.html#a6">nlassert</a>(matId>=0);
02092 <a class="code" href="a04199.html#a6">nlassert</a>(matId<(<a class="code" href="a04558.html#a14">sint</a>)nbMats);
02093 <span class="comment">// increment the refcount of this material by this LOD.</span>
02094 matCount[matId]++;
02095 }
02096
02097 <span class="comment">// Then for each material not empty, create a rdrPass, and ref it for this material.</span>
02098 vector<sint> rdrPassIndex; <span class="comment">// material to rdrPass map.</span>
02099 rdrPassIndex.resize(nbMats);
02100 <span class="keywordflow">for</span>(j=0; j<(<a class="code" href="a04558.html#a14">sint</a>)nbMats; j++)
02101 {
02102 <span class="keywordflow">if</span>(matCount[j]==0)
02103 rdrPassIndex[j]= -1;
02104 <span class="keywordflow">else</span>
02105 {
02106 <span class="comment">// map material to rdrPass.</span>
02107 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= destLod.RdrPass.size();
02108 rdrPassIndex[j]= idRdrPass;
02109 <span class="comment">// create a rdrPass.</span>
02110 destLod.RdrPass.push_back(CMeshMRMGeom::CRdrPass());
02111 <span class="comment">// assign the good materialId to this rdrPass.</span>
02112 destLod.RdrPass[idRdrPass].MaterialId= j;
02113 <span class="comment">// reserve the array of faces of this rdrPass.</span>
02114 destLod.RdrPass[idRdrPass].PBlock.reserveTri(matCount[j]);
02115 }
02116 }
02117
02118 <span class="comment">// Then for each face, add it to the good rdrPass of this Lod.</span>
02119 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++)
02120 {
02121 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId;
02122 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= rdrPassIndex[matId];
02123 <span class="comment">// add this face to the good rdrPass.</span>
02124 <a class="code" href="a04558.html#a14">sint</a> w0= srcLod.Faces[j].WedgeId[0];
02125 <a class="code" href="a04558.html#a14">sint</a> w1= srcLod.Faces[j].WedgeId[1];
02126 <a class="code" href="a04558.html#a14">sint</a> w2= srcLod.Faces[j].WedgeId[2];
02127 destLod.RdrPass[idRdrPass].PBlock.addTri(w0, w1, w2);
02128 }
02129
02130
02131 <span class="comment">// Build skin info for this Lod.</span>
02132 <span class="comment">//---------</span>
02133 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++)
02134 {
02135 destLod.InfluencedVertices[j].clear();
02136 }
02137 destLod.MatrixInfluences.clear();
02138 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
02139 {
02140 <span class="comment">// This is the set which tell what wedge has already been inserted.</span>
02141 set<uint> wedgeInfSet;
02142
02143 <span class="comment">// First, build the list of vertices influenced by this Lod.</span>
02144 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++)
02145 {
02146 <span class="keywordflow">for</span>(k=0; k<3; k++)
02147 {
02148 <a class="code" href="a04558.html#a14">sint</a> wedgeId= srcLod.Faces[j].WedgeId[k];
02149 <span class="comment">// If it is a geomorph</span>
02150 <span class="keywordflow">if</span>(wedgeId<finalMRM.NGeomSpace)
02151 {
02152 <span class="comment">// add the start and end to the list (if not here). NB: wedgeId is both the id </span>
02153 <span class="comment">// of the dest wedge, and the id of the geomorph.</span>
02154 <a class="code" href="a04558.html#a14">sint</a> wedgeStartId= destLod.Geomorphs[wedgeId].Start;
02155 <a class="code" href="a04558.html#a14">sint</a> wedgeEndId= destLod.Geomorphs[wedgeId].End;
02156 <a class="code" href="a04558.html#a15">uint</a> nMatUsedStart= finalMRM.Wedges[wedgeStartId].NSkinMatUsed;
02157 <a class="code" href="a04558.html#a15">uint</a> nMatUsedEnd= finalMRM.Wedges[wedgeEndId].NSkinMatUsed;
02158
02159 <span class="comment">// if insertion in the set work, add to the good array.</span>
02160 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeStartId).second )
02161 destLod.InfluencedVertices[nMatUsedStart-1].push_back(wedgeStartId);
02162 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeEndId).second )
02163 destLod.InfluencedVertices[nMatUsedEnd-1].push_back(wedgeEndId);
02164 }
02165 <span class="keywordflow">else</span>
02166 {
02167 <a class="code" href="a04558.html#a15">uint</a> nMatUsed= finalMRM.Wedges[wedgeId].NSkinMatUsed;
02168
02169 <span class="comment">// just add this wedge to the list (if not here).</span>
02170 <span class="comment">// if insertion in the set work, add to the array.</span>
02171 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeId).second )
02172 destLod.InfluencedVertices[nMatUsed-1].push_back(wedgeId);
02173 }
02174 }
02175 }
02176
02177 <span class="comment">// Optimisation: for better cache, sort the destLod.InfluencedVertices in increasing order.</span>
02178 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++)
02179 {
02180 sort(destLod.InfluencedVertices[j].begin(), destLod.InfluencedVertices[j].end());
02181 }
02182
02183
02184 <span class="comment">// Then Build the MatrixInfluences array, for all thoses Influenced Vertices only.</span>
02185 <span class="comment">// This is the map MatrixId -> MatrixInfId.</span>
02186 map<uint, uint> matrixInfMap;
02187
02188 <span class="comment">// For all influenced vertices, flags matrix they use.</span>
02189 <a class="code" href="a04558.html#a15">uint</a> iSkinMat;
02190 <span class="keywordflow">for</span>(iSkinMat= 0; iSkinMat<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; iSkinMat++)
02191 {
02192 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)destLod.InfluencedVertices[iSkinMat].size(); j++)
02193 {
02194 <a class="code" href="a04558.html#a15">uint</a> wedgeId= destLod.InfluencedVertices[iSkinMat][j];
02195
02196 <span class="comment">// take the original wedge.</span>
02197 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[wedgeId];
02198 <span class="comment">// For all matrix with not null influence...</span>
02199 <span class="keywordflow">for</span>(k= 0; k<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; k++)
02200 {
02201 <span class="keywordtype">float</span> matWeight= wedge.VertexSkin.Weights[k];
02202
02203 <span class="comment">// This check the validity of skin weights sort. If false, problem before in the algo.</span>
02204 <span class="keywordflow">if</span>((<a class="code" href="a04558.html#a15">uint</a>)k<iSkinMat+1)
02205 {
02206 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight>0 );
02207 }
02208 <span class="keywordflow">else</span>
02209 {
02210 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight==0 );
02211 }
02212 <span class="comment">// if not null influence.</span>
02213 <span class="keywordflow">if</span>(matWeight>0)
02214 {
02215 <a class="code" href="a04558.html#a15">uint</a> matId= wedge.VertexSkin.MatrixId[k];
02216
02217 <span class="comment">// search/insert the matrixInfId.</span>
02218 map<uint, uint>::iterator it= matrixInfMap.find(matId);
02219 <span class="keywordflow">if</span>( it==matrixInfMap.end() )
02220 {
02221 <a class="code" href="a04558.html#a15">uint</a> matInfId= destLod.MatrixInfluences.size();
02222 matrixInfMap.insert( make_pair(matId, matInfId) );
02223 <span class="comment">// create the new MatrixInfluence.</span>
02224 destLod.MatrixInfluences.push_back(matId);
02225 }
02226 }
02227 }
02228 }
02229 }
02230
02231 }
02232
02233 }
02234
02235 <span class="comment">// Indicate Skinning.</span>
02236 mbuild.Skinned= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>;
02237
02238
02239
02240 <span class="keywordtype">bool</span> useTgSpace = mb.MeshVertexProgram != NULL ? mb.MeshVertexProgram->needTangentSpace() : false;
02241
02242 <span class="comment">// Construct Blend Shapes</span>
02244 <span class="comment"></span> mbuild.BlendShapes.resize (finalMRM.MRMBlendShapesFinals.size());
02245 <span class="keywordflow">for</span> (k = 0; k < (<a class="code" href="a04558.html#a14">sint</a>)mbuild.BlendShapes.size(); ++k)
02246 {
02247 CBlendShape &rBS = mbuild.BlendShapes[k];
02248 <a class="code" href="a04558.html#a10">sint32</a> nNbVertVB = finalMRM.Wedges.size();
02249 <span class="keywordtype">bool</span> bIsDeltaPos = <span class="keyword">false</span>;
02250 rBS.deltaPos.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f));
02251 <span class="keywordtype">bool</span> bIsDeltaNorm = <span class="keyword">false</span>;
02252 rBS.deltaNorm.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f));
02253 <span class="keywordtype">bool</span> bIsDeltaUV = <span class="keyword">false</span>;
02254 rBS.deltaUV.resize (nNbVertVB, CUV(0.0f,0.0f));
02255 <span class="keywordtype">bool</span> bIsDeltaCol = <span class="keyword">false</span>;
02256 rBS.deltaCol.resize (nNbVertVB, <a class="code" href="a03338.html">CRGBAF</a>(0.0f,0.0f,0.0f,0.0f));
02257 <span class="keywordtype">bool</span> bIsDeltaTgSpace = <span class="keyword">false</span>;
02258 <span class="keywordflow">if</span> (useTgSpace)
02259 {
02260 rBS.deltaTgSpace.resize(nNbVertVB, CVector::Null);
02261 }
02262
02263 rBS.VertRefs.resize (nNbVertVB, 0xffffffff);
02264
02265 <span class="keywordflow">for</span> (i = 0; i < nNbVertVB; i++)
02266 {
02267 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeRef = finalMRM.Wedges[i];
02268 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeTar = finalMRM.MRMBlendShapesFinals[k].Wedges[i];
02269
02270 CVector delta = rWedgeTar.Vertex - rWedgeRef.Vertex;
02271 <a class="code" href="a03668.html">CVectorH</a> attr;
02272
02273 <span class="keywordflow">if</span> (delta.norm() > 0.001f)
02274 {
02275 rBS.deltaPos[i] = delta;
02276 rBS.VertRefs[i] = i;
02277 bIsDeltaPos = <span class="keyword">true</span>;
02278 }
02279
02280 attId = 0;
02281 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag)
02282 {
02283 attr = rWedgeRef.Attributes[attId];
02284 CVector NormRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02285 attr = rWedgeTar.Attributes[attId];
02286 CVector NormTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02287 delta = NormTar - NormRef;
02288 <span class="keywordflow">if</span> (delta.norm() > 0.001f)
02289 {
02290 rBS.deltaNorm[i] = delta;
02291 rBS.VertRefs[i] = i;
02292 bIsDeltaNorm = <span class="keyword">true</span>;
02293 }
02294 attId++;
02295 }
02296
02297 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag)
02298 {
02299 attr = rWedgeRef.Attributes[attId];
02300 <a class="code" href="a03338.html">CRGBAF</a> RGBARef = <a class="code" href="a03338.html">CRGBAF</a>(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f);
02301 attr = rWedgeTar.Attributes[attId];
02302 CRGBAF RGBATar = CRGBAF(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f);
02303 CRGBAF deltaRGBA = RGBATar - RGBARef;
02304 <span class="keywordflow">if</span> ((deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a> +
02305 deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>) > 0.0001f)
02306 {
02307 rBS.deltaCol[i] = deltaRGBA;
02308 rBS.VertRefs[i] = i;
02309 bIsDeltaCol = <span class="keyword">true</span>;
02310 }
02311 attId++;
02312 }
02313
02314 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag)
02315 { <span class="comment">// Nothing to do !</span>
02316 attId++;
02317 }
02318
02319 <span class="comment">// Do that only for the UV0</span>
02320 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::TexCoord0Flag)
02321 {
02322 attr = rWedgeRef.Attributes[attId];
02323 CUV UVRef = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>);
02324 attr = rWedgeTar.Attributes[attId];
02325 CUV UVTar = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>);
02326 CUV deltaUV = UVTar - UVRef;
02327 <span class="keywordflow">if</span> ((deltaUV.U*deltaUV.U + deltaUV.V*deltaUV.V) > 0.0001f)
02328 {
02329 rBS.deltaUV[i] = deltaUV;
02330 rBS.VertRefs[i] = i;
02331 bIsDeltaUV = <span class="keyword">true</span>;
02332 }
02333 attId++;
02334 }
02335
02336 <span class="keywordflow">if</span> (useTgSpace)
02337 {
02338 attr = rWedgeRef.Attributes[attId];
02339 CVector TgSpaceRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02340 attr = rWedgeTar.Attributes[attId];
02341 CVector TgSpaceTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>);
02342 delta = TgSpaceTar - TgSpaceRef;
02343 <span class="keywordflow">if</span> (delta.norm() > 0.001f)
02344 {
02345 rBS.deltaTgSpace[i] = delta;
02346 rBS.VertRefs[i] = i;
02347 bIsDeltaTgSpace = <span class="keyword">true</span>;
02348 }
02349 attId++;
02350 }
02351
02352 } <span class="comment">// End of all vertices added in blend shape</span>
02353
02354 <span class="comment">// Delete unused items and calculate the number of vertex used (blended)</span>
02355
02356 <a class="code" href="a04558.html#a10">sint32</a> nNbVertUsed = nNbVertVB;
02357 <a class="code" href="a04558.html#a10">sint32</a> nDstPos = 0;
02358 <span class="keywordflow">for</span> (j = 0; j < nNbVertVB; ++j)
02359 {
02360 <span class="keywordflow">if</span> (rBS.VertRefs[j] == 0xffffffff) <span class="comment">// Is vertex UNused</span>
02361 {
02362 --nNbVertUsed;
02363 }
02364 <span class="keywordflow">else</span> <span class="comment">// Vertex used</span>
02365 {
02366 <span class="keywordflow">if</span> (nDstPos != j)
02367 {
02368 rBS.VertRefs[nDstPos] = rBS.VertRefs[j];
02369 rBS.deltaPos[nDstPos] = rBS.deltaPos[j];
02370 rBS.deltaNorm[nDstPos] = rBS.deltaNorm[j];
02371 rBS.deltaUV[nDstPos] = rBS.deltaUV[j];
02372 rBS.deltaCol[nDstPos] = rBS.deltaCol[j];
02373 <span class="keywordflow">if</span> (useTgSpace)
02374 {
02375 rBS.deltaTgSpace[nDstPos] = rBS.deltaTgSpace[j];
02376 }
02377 }
02378 ++nDstPos;
02379 }
02380 }
02381
02382 <span class="keywordflow">if</span> (bIsDeltaPos)
02383 rBS.deltaPos.resize (nNbVertUsed);
02384 <span class="keywordflow">else</span>
02385 rBS.deltaPos.resize (0);
02386
02387 <span class="keywordflow">if</span> (bIsDeltaNorm)
02388 rBS.deltaNorm.resize (nNbVertUsed);
02389 <span class="keywordflow">else</span>
02390 rBS.deltaNorm.resize (0);
02391
02392 <span class="keywordflow">if</span> (bIsDeltaUV)
02393 rBS.deltaUV.resize (nNbVertUsed);
02394 <span class="keywordflow">else</span>
02395 rBS.deltaUV.resize (0);
02396
02397 <span class="keywordflow">if</span> (bIsDeltaCol)
02398 rBS.deltaCol.resize (nNbVertUsed);
02399 <span class="keywordflow">else</span>
02400 rBS.deltaCol.resize (0);
02401
02402 <span class="keywordflow">if</span> (bIsDeltaTgSpace)
02403 rBS.deltaTgSpace.resize (nNbVertUsed);
02404 <span class="keywordflow">else</span>
02405 rBS.deltaTgSpace.resize (0);
02406
02407
02408 rBS.VertRefs.resize (nNbVertUsed);
02409
02410 }
02411 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_5" doxytag="NL3D::CMRMBuilder::buildMrmBaseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NL3D::CMRMBuilder::buildMrmBaseMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td>
<td class="mdname" nowrap> <em>mbuild</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
from a meshBuild, compute a <a class="el" href="a02960.html">CMRMMesh</a>. This is the first stage of the algo. <dl compact><dt><b>Returns:</b></dt><dd>the vertexFormat supported by <a class="el" href="a02951.html">CMRMBuilder</a>.</dd></dl>
<p>
Definition at line <a class="el" href="a06055.html#l01734">1734</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00229">_AttributeMap</a>, <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a05990.html#l00090">NL3D::CMesh::CCorner::Color</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a05990.html#l00193">NL3D::CMesh::CMeshBuild::Faces</a>, <a class="el" href="a06055.html#l01685">findInsertColorInBaseMesh()</a>, <a class="el" href="a06055.html#l01675">findInsertNormalInBaseMesh()</a>, <a class="el" href="a06055.html#l01697">findInsertUvwInBaseMesh()</a>, <a class="el" href="a05990.html#l00207">NL3D::CMesh::CMeshBuild::InterfaceLinks</a>, <a class="el" href="a06062.html#l00123">NL3D::CMRMMesh::InterfaceLinks</a>, <a class="el" href="a06062.html#l00046">NL3D_MRM_MAX_ATTRIB</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05990.html#l00088">NL3D::CMesh::CCorner::Normal</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05990.html#l00187">NL3D::CMesh::CMeshBuild::SkinWeights</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a05990.html#l00091">NL3D::CMesh::CCorner::Specular</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00089">NL3D::CMesh::CCorner::Uvws</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, <a class="el" href="a05990.html#l00179">NL3D::CMesh::CMeshBuild::VertexFlags</a>, <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>, and <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>01735 {
01736 <a class="code" href="a04558.html#a14">sint</a> i,j,k;
01737 <a class="code" href="a04558.html#a14">sint</a> nFaces;
01738 <a class="code" href="a04558.html#a14">sint</a> attId;
01739 <span class="comment">// build the supported VertexFormat.</span>
01740 <a class="code" href="a04558.html#a11">uint32</a> retVbFlags= CVertexBuffer::PositionFlag;
01741
01742
01743 <span class="comment">// reset the baseMesh.</span>
01744 baseMesh= CMRMMesh();
01745 <span class="comment">// reset Tmp.</span>
01746 <span class="keywordflow">for</span>(attId=0; attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++)
01747 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a>[attId].clear();
01748
01749
01750 <span class="comment">// Compute number of attributes used by the MeshBuild.</span>
01751 <span class="comment">// ========================</span>
01752 <span class="comment">// Compute too </span>
01753 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::NormalFlag)
01754 {
01755 baseMesh.NumAttributes++;
01756 retVbFlags|= CVertexBuffer::NormalFlag;
01757 }
01758 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::PrimaryColorFlag)
01759 {
01760 baseMesh.NumAttributes++;
01761 retVbFlags|= CVertexBuffer::PrimaryColorFlag;
01762 }
01763 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::SecondaryColorFlag)
01764 {
01765 baseMesh.NumAttributes++;
01766 retVbFlags|= CVertexBuffer::SecondaryColorFlag;
01767 }
01768 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++)
01769 {
01770 <a class="code" href="a04558.html#a15">uint</a> flag=CVertexBuffer::TexCoord0Flag<<k;
01771 <span class="keywordflow">if</span>(mbuild.VertexFlags & flag)
01772 {
01773 baseMesh.NumAttributes++;
01774 retVbFlags|=flag;
01775 }
01776 }
01777 <a class="code" href="a04199.html#a6">nlassert</a>(baseMesh.NumAttributes<=NL3D_MRM_MAX_ATTRIB);
01778
01779
01780 <span class="comment">// Fill basics: Vertices and Faces materials / index to vertices.</span>
01781 <span class="comment">// ========================</span>
01782 <span class="comment">// Just copy vertices.</span>
01783 baseMesh.Vertices= mbuild.Vertices;
01784 <span class="comment">// Just copy SkinWeights.</span>
01785 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
01786 baseMesh.SkinWeights= mbuild.SkinWeights;
01787 <span class="comment">// Just copy InterfaceLinks</span>
01788 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>)
01789 baseMesh.InterfaceLinks= mbuild.InterfaceLinks;
01790 <span class="comment">// Resize faces.</span>
01791 nFaces= mbuild.Faces.size();
01792 baseMesh.Faces.resize(nFaces);
01793 <span class="keywordflow">for</span>(i=0; i<nFaces; i++)
01794 {
01795 <span class="comment">// copy material Id.</span>
01796 baseMesh.Faces[i].MaterialId= mbuild.Faces[i].MaterialId;
01797 <span class="comment">// Copy Vertex index.</span>
01798 <span class="keywordflow">for</span>(j=0; j<3; j++)
01799 {
01800 baseMesh.Faces[i].Corner[j].Vertex= mbuild.Faces[i].Corner[j].Vertex;
01801 }
01802 }
01803
01804 <span class="comment">// Resolve attributes discontinuities and Fill attributes of the baseMesh.</span>
01805 <span class="comment">// ========================</span>
01806 <span class="comment">// For all corners.</span>
01807 <span class="keywordflow">for</span>(i=0; i<nFaces; i++)
01808 {
01809 <span class="keywordflow">for</span>(j=0; j<3; j++)
01810 {
01811 <span class="keyword">const</span> CMesh::CCorner &srcCorner= mbuild.Faces[i].Corner[j];
01812 CMRMCorner &destCorner= baseMesh.Faces[i].Corner[j];
01813 attId= 0;
01814
01815 <span class="comment">// For all activated attributes in mbuild, find/insert the attribute in the baseMesh.</span>
01816 <span class="comment">// NB: 2 attributes are said to be different if they have not the same value OR if they don't lie </span>
01817 <span class="comment">// on the same vertex. This is very important for MRM computing.</span>
01818 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::NormalFlag)
01819 {
01820 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_8">findInsertNormalInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Normal);
01821 attId++;
01822 }
01823 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::PrimaryColorFlag)
01824 {
01825 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_7">findInsertColorInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Color);
01826 attId++;
01827 }
01828 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::SecondaryColorFlag)
01829 {
01830 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_7">findInsertColorInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Specular);
01831 attId++;
01832 }
01833 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++)
01834 {
01835 <span class="keywordflow">if</span>(mbuild.VertexFlags & (CVertexBuffer::TexCoord0Flag<<k))
01836 {
01837 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_9">findInsertUvwInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Uvws[k]);
01838 attId++;
01839 }
01840 }
01841 }
01842 }
01843
01844
01845
01846 <span class="comment">// End. clear Tmp infos.</span>
01847 <span class="comment">// ========================</span>
01848 <span class="comment">// reset Tmp.</span>
01849 <span class="keywordflow">for</span>(attId=0; attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++)
01850 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a>[attId].clear();
01851
01852 <span class="keywordflow">return</span> retVbFlags;
01853 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz561_0" doxytag="NL3D::CMRMBuilder::buildMRMSewingMeshes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::buildMRMSewingMeshes </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td>
<td class="mdname" nowrap> <em>mbuild</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>nWantedLods</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>divisor</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l03115">3115</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00152">_SewingMeshes</a>, <a class="el" href="a05990.html#l00207">NL3D::CMesh::CMeshBuild::InterfaceLinks</a>, <a class="el" href="a05990.html#l00205">NL3D::CMesh::CMeshBuild::Interfaces</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>03116 {
03117 <a class="code" href="a04199.html#a6">nlassert</a>(nWantedLods>=1);
03118 <a class="code" href="a04199.html#a6">nlassert</a>(divisor>=1);
03119 <span class="keywordflow">if</span>(mbuild.Interfaces.size()==0)
03120 <span class="keywordflow">return</span> <span class="keyword">false</span>;
03121 <span class="comment">// must have same size</span>
03122 <span class="keywordflow">if</span>(mbuild.InterfaceLinks.size()!=mbuild.Vertices.size())
03123 <span class="keywordflow">return</span> <span class="keyword">false</span>;
03124
03125 <span class="comment">// **** For each interface, MRM-ize it and store.</span>
03126 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>.resize(mbuild.Interfaces.size());
03127 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<mbuild.Interfaces.size();i++)
03128 {
03129 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>[i].build(mbuild.Interfaces[i], nWantedLods, divisor);
03130 }
03131
03132
03133 <span class="keywordflow">return</span> <span class="keyword">true</span>;
03134 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_0" doxytag="NL3D::CMRMBuilder::collapseEdge" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::collapseEdge </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>edge</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00499">499</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00154">_CurrentLodComputed</a>, <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00152">_SewingMeshes</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06058.html#l00124">NL3D::CMRMAttribute::BSCurrent</a>, <a class="el" href="a06058.html#l00097">NL3D::CMRMVertex::BSCurrent</a>, <a class="el" href="a06058.html#l00223">NL3D::CMRMFaceBuild::BSInterpolated</a>, <a class="el" href="a06058.html#l00125">NL3D::CMRMAttribute::CollapsedTo</a>, <a class="el" href="a06058.html#l00101">NL3D::CMRMVertex::CollapsedTo</a>, <a class="el" href="a06055.html#l00399">collapseSkinWeight()</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06058.html#l00123">NL3D::CMRMAttribute::Current</a>, <a class="el" href="a06058.html#l00096">NL3D::CMRMVertex::Current</a>, <a class="el" href="a06058.html#l00099">NL3D::CMRMVertex::CurrentSW</a>, <a class="el" href="a06055.html#l00051">NL3D::deleteElement()</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06055.html#l00333">faceShareWedges()</a>, <a class="el" href="a06055.html#l00046">NL3D::findElement()</a>, <a class="el" href="a06058.html#l00313">NL3D::CMRMFaceBuild::getAssociatedWedge()</a>, <a class="el" href="a05990.html#l00162">NL3D::CMesh::CInterfaceLink::InterfaceId</a>, <a class="el" href="a06058.html#l00106">NL3D::CMRMVertex::InterfaceLink</a>, <a class="el" href="a05990.html#l00164">NL3D::CMesh::CInterfaceLink::InterfaceVertexId</a>, <a class="el" href="a06058.html#l00222">NL3D::CMRMFaceBuild::InterpolatedAttribute</a>, <a class="el" href="a06058.html#l00131">NL3D::CMRMAttribute::InterpolatedFace</a>, <a class="el" href="a06057.html#l00041">NL3D::CMRMSewingMesh::mustCollapseEdge()</a>, <a class="el" href="a06058.html#l00132">NL3D::CMRMAttribute::NbSharedFaces</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06055.html#l00367">removeFaceFromEdgeList()</a>, <a class="el" href="a06058.html#l00133">NL3D::CMRMAttribute::Shared</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, <a class="el" href="a06055.html#l00108">vertexClosed()</a>, <a class="el" href="a06055.html#l00103">vertexContinue()</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00945">collapseEdges()</a>.
<p>
<div class="fragment"><pre>00500 {
00501 <a class="code" href="a04558.html#a14">sint</a> i,j;
00502 <span class="keywordtype">float</span> InterValue;
00503 <a class="code" href="a04558.html#a14">sint</a> edgeV1=edge.v0;
00504 <a class="code" href="a04558.html#a14">sint</a> edgeV2=edge.v1;
00505
00506
00507 <span class="comment">// 0. collapse the vertices.</span>
00508 <span class="comment">//==========================</span>
00509
00510 <span class="comment">// edge.Vertex1 kept, but morphed.</span>
00511 <span class="comment">// edge.Vertex2 deleted, and must know on which vertex it collapse.</span>
00512 CMRMVertex &Vertex1=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[edgeV1], &Vertex2=TmpVertices[edgeV2];
00513
00514 <span class="comment">// Interpolation choice.</span>
00515 <span class="comment">// Default is to interpolate vertex 0 to the middle of the edge.</span>
00516 InterValue=0.5;
00517 <span class="comment">//InterValue=1;</span>
00518 <span class="comment">// **** If at least one vertex of the edge is on a mesh sewing interface, must change InterValue</span>
00519 <span class="keywordflow">if</span>( <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a> && (Vertex1.InterfaceLink.InterfaceId>=0 || Vertex2.InterfaceLink.InterfaceId>=0) )
00520 {
00521 <span class="comment">// If this is an edge of a mesh sewing interface</span>
00522 <span class="keywordflow">if</span>(Vertex1.InterfaceLink.InterfaceId==Vertex2.InterfaceLink.InterfaceId)
00523 {
00524 <span class="comment">// Then the edge is one of the sewing interface mesh. must do special things for it</span>
00525 CMRMSewingMesh &sewingMesh= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>[Vertex1.InterfaceLink.InterfaceId];
00526
00527 <span class="comment">// get the sewing edge id</span>
00528 CMRMEdge sewingEdge;
00529 sewingEdge.v0= Vertex1.InterfaceLink.InterfaceVertexId;
00530 sewingEdge.v1= Vertex2.InterfaceLink.InterfaceVertexId;
00531
00532 <span class="comment">// Get the edge in the sewing mesh which is said to be collapsed</span>
00533 <a class="code" href="a04558.html#a15">uint</a> vertToCollapse;
00534 <a class="code" href="a04558.html#a14">sint</a> collapseId= sewingMesh.mustCollapseEdge(_CurrentLodComputed, sewingEdge, vertToCollapse);
00535 <span class="comment">// if exist</span>
00536 <span class="keywordflow">if</span>(collapseId>=0)
00537 {
00538 <span class="comment">// if it is v0 which must collapse, then InterValue=1</span>
00539 <span class="keywordflow">if</span>(vertToCollapse==(<a class="code" href="a04558.html#a15">uint</a>)sewingEdge.v0)
00540 InterValue= 1;
00541 <span class="keywordflow">else</span>
00542 InterValue= 0;
00543
00544 }
00545 <span class="keywordflow">else</span>
00546 {
00547 <span class="comment">// This should not happens. But it is still possible if this edge don't want to collapse but if their</span>
00548 <span class="comment">// is no more choice. Take a default value</span>
00549 InterValue= 0;
00550 }
00551 }
00552 <span class="keywordflow">else</span>
00553 {
00554 <span class="comment">// must collapse to the vertex on the sewing interface (as if it was open)</span>
00555 <span class="keywordflow">if</span>(Vertex1.InterfaceLink.InterfaceId>=0)
00556 {
00557 <span class="comment">// NB: it is possible that both vertices are on a different sewing interface... still collapse (must have to)</span>
00558 InterValue= 0;
00559 }
00560 <span class="keywordflow">else</span>
00561 {
00562 <span class="comment">// Then Vertex2 is on a sewing interface, collapse to it</span>
00563 InterValue= 1;
00564 }
00565 }
00566 }
00567 <span class="comment">// **** Else, on special cases, it is much more efficient to interpolate at start or at end of edge.</span>
00568 <span class="keywordflow">else</span>
00569 {
00570 <span class="comment">// If one vertex is "open", ie his shared faces do not represent a closed Fan, then interpolate to this one, </span>
00571 <span class="comment">// so the mesh has the same silhouette.</span>
00572 <span class="keywordtype">bool</span> vc1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_4">vertexClosed</a>(edgeV1);
00573 <span class="keywordtype">bool</span> vc2= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_4">vertexClosed</a>(edgeV2);
00574 <span class="keywordflow">if</span>(!vc1 && vc2) InterValue=0;
00575 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(vc1 && !vc2) InterValue=1;
00576 <span class="keywordflow">else</span>
00577 {
00578 <span class="comment">// Do the same test but with vertex continue: it is preferable to not move the boundaries </span>
00579 <span class="comment">// of a material, or a mapping.</span>
00580 <span class="keywordtype">bool</span> vc1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(edgeV1);
00581 <span class="keywordtype">bool</span> vc2= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(edgeV2);
00582 <span class="keywordflow">if</span>(!vc1 && vc2) InterValue=0;
00583 <span class="keywordflow">if</span>(vc1 && !vc2) InterValue=1;
00584 }
00585 }
00586 <span class="comment">/*BENCH_TotalCollapses++;</span>
00587 <span class="comment"> if(InterValue==0.5)</span>
00588 <span class="comment"> BENCH_MiddleCollapses++;*/</span>
00589
00590 <span class="comment">// Collapse the Vertex.</span>
00591 <span class="comment">//========================</span>
00592 Vertex1.Current= Vertex1.Current*(1-InterValue) + Vertex2.Current*InterValue;
00593 <span class="keywordflow">for</span> (i = 0; i < (<a class="code" href="a04558.html#a14">sint</a>)Vertex1.BSCurrent.size(); ++i)
00594 Vertex1.BSCurrent[i] = Vertex1.BSCurrent[i]*(1-InterValue) + Vertex2.BSCurrent[i]*InterValue;
00595 Vertex2.CollapsedTo= edgeV1;
00596 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
00597 Vertex1.CurrentSW= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_1">collapseSkinWeight</a>(Vertex1.CurrentSW, Vertex2.CurrentSW, InterValue);
00598 <span class="keywordflow">if</span>( <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a> )
00599 Vertex1.InterfaceLink= InterValue<0.5f? Vertex1.InterfaceLink : Vertex2.InterfaceLink;
00600
00601 <span class="comment">// \todo yoyo: TODO_BUG: Don't know why, but vertices may point on deleted faces.</span>
00602 <span class="comment">// Temp: we destroy here thoses face from SharedFaces...</span>
00603 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++)
00604 {
00605 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i];
00606 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].Deleted)
00607 <a class="code" href="a05363.html#a438">deleteElement</a>(Vertex1.SharedFaces, numFace), i--;
00608 }
00609 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex2.SharedFaces.size();i++)
00610 {
00611 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex2.SharedFaces[i];
00612 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].Deleted)
00613 <a class="code" href="a05363.html#a438">deleteElement</a>(Vertex2.SharedFaces, numFace), i--;
00614 }
00615
00616
00617 <span class="comment">// Build Neighbor faces.</span>
00618 vector<sint> neighboorFaces;
00619 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++)
00620 {
00621 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i];
00622 <span class="keywordflow">if</span>(!<a class="code" href="a05363.html#a437">findElement</a>(neighboorFaces, numFace))
00623 neighboorFaces.push_back(numFace);
00624 }
00625 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex2.SharedFaces.size();i++)
00626 {
00627 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex2.SharedFaces[i];
00628 <span class="keywordflow">if</span>(!<a class="code" href="a05363.html#a437">findElement</a>(neighboorFaces, numFace))
00629 neighboorFaces.push_back(numFace);
00630 }
00631
00632 <span class="comment">// Build faces which will be destroyed (may 1 or 2, maybe more for non conventionnal meshes).</span>
00633 vector<sint> deletedFaces;
00634 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++)
00635 {
00636 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i];
00637 <a class="code" href="a04199.html#a6">nlassert</a>(!TmpFaces[numFace].Deleted);
00638 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].hasVertex(edgeV2))
00639 deletedFaces.push_back(numFace);
00640 }
00641
00642
00643 <span class="comment">// 1. Collapse the wedges.</span>
00644 <span class="comment">//========================</span>
00645
00646 <span class="comment">// For ALL Attributes.</span>
00647 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++)
00648 {
00649 <span class="comment">// a/ Stock the wedge interpolation in each destroyed face.</span>
00650 <span class="comment">//------------------------------------------------------</span>
00651 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++)
00652 {
00653 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]];
00654
00655 <a class="code" href="a03668.html">CVectorH</a> &w0= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][ face.getAssociatedWedge(attId, edgeV1) ].Current;
00656 <a class="code" href="a03668.html">CVectorH</a> &w1= TmpAttributes[attId][ face.getAssociatedWedge(attId, edgeV2) ].Current;
00657
00658 <a class="code" href="a03668.html">CVectorH</a> &itp= face.InterpolatedAttribute;
00659 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*InterValue;
00660 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*InterValue;
00661 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*InterValue;
00662 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*InterValue;
00663
00664 <span class="keywordflow">for</span> (j = 0; j < (<a class="code" href="a04558.html#a14">sint</a>)face.BSInterpolated.size(); ++j)
00665 {
00666 <a class="code" href="a03668.html">CVectorH</a> &w0 = TmpAttributes[attId][face.getAssociatedWedge(attId, edgeV1)].BSCurrent[j];
00667 <a class="code" href="a03668.html">CVectorH</a> &w1 = TmpAttributes[attId][face.getAssociatedWedge(attId, edgeV2)].BSCurrent[j];
00668 <a class="code" href="a03668.html">CVectorH</a> &itb = face.BSInterpolated[j];
00669 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*InterValue;
00670 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*InterValue;
00671 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*InterValue;
00672 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*InterValue;
00673 }
00674 }
00675
00676
00677 <span class="comment">// b/ Build wedge list to be modify.</span>
00678 <span class="comment">//----------------------------------</span>
00679 vector<sint> wedges;
00680
00681 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)neighboorFaces.size();i++)
00682 {
00683 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[neighboorFaces[i]];
00684 <a class="code" href="a04558.html#a14">sint</a> numWedge;
00685
00686 numWedge= face.getAssociatedWedge(attId, edgeV1);
00687 <span class="keywordflow">if</span>(numWedge>=0 && !<a class="code" href="a05363.html#a437">findElement</a>(wedges, numWedge))
00688 wedges.push_back(numWedge);
00689
00690 numWedge= face.getAssociatedWedge(attId, edgeV2);
00691 <span class="keywordflow">if</span>(numWedge>=0 && !<a class="code" href="a05363.html#a437">findElement</a>(wedges, numWedge))
00692 wedges.push_back(numWedge);
00693 }
00694
00695
00696 <span class="comment">// c/ Count numFaces which point on those wedges. (- deleted faces).</span>
00697 <span class="comment">//------------------------------------------------------------------</span>
00698
00699 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)wedges.size();i++)
00700 {
00701 <a class="code" href="a04558.html#a14">sint</a> numWedge= wedges[i];
00702 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][numWedge];
00703
00704 wedge.NbSharedFaces=0;
00705 wedge.Shared=<span class="keyword">false</span>;
00706
00707 <span class="comment">// Count total ref count.</span>
00708 <span class="keywordflow">for</span>(j=0;j<(<a class="code" href="a04558.html#a14">sint</a>)neighboorFaces.size();j++)
00709 {
00710 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[neighboorFaces[j]].hasWedge(attId, numWedge))
00711 wedge.NbSharedFaces++;
00712 }
00713
00714 <span class="comment">// Minus deleted faces.</span>
00715 <span class="keywordflow">for</span>(j=0;j<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();j++)
00716 {
00717 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[j]].hasWedge(attId, numWedge))
00718 {
00719 wedge.NbSharedFaces--;
00720 wedge.Shared=<span class="keyword">true</span>;
00721 wedge.InterpolatedFace=deletedFaces[j];
00722 }
00723 }
00724 }
00725
00726
00727 <span class="comment">// d/ Collapse wedge following 3 possibles cases.</span>
00728 <span class="comment">//-----------------------------------------------</span>
00729
00730
00731 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)wedges.size();i++)
00732 {
00733 <a class="code" href="a04558.html#a14">sint</a> numWedge= wedges[i];
00734 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][numWedge];
00735
00736 <span class="comment">// if wedge not shared...</span>
00737 <span class="keywordflow">if</span>(!wedge.Shared)
00738 {
00739 <span class="comment">// We've got an "exterior wedge" which lost no corner => do not merge it nor delete it. </span>
00740 <span class="comment">// Leave it as the same value (extrapolate it may not be a good solution).</span>
00741 }
00742 <span class="keywordflow">else</span>
00743 {
00744 <span class="comment">// if wedge dissapears, notify.</span>
00745 <span class="keywordflow">if</span>(wedge.NbSharedFaces==0)
00746 {
00747 wedge.CollapsedTo=-2;
00748 <span class="comment">// Do not change his value. (as specified in Hope article).</span>
00749 }
00750 <span class="keywordflow">else</span>
00751 {
00752 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[wedge.InterpolatedFace];
00753
00754 <span class="comment">// Must interpolate it.</span>
00755 wedge.Current= face.InterpolatedAttribute;
00756 wedge.BSCurrent = face.BSInterpolated;
00757
00758 <span class="comment">// Must merge the wedge of the second vertex on first</span>
00759 <span class="comment">// ONLY IF 2 interpolated wedges are shared and NbSharedFaces!=0.</span>
00760 <span class="keywordflow">if</span>( numWedge==face.getAssociatedWedge(attId, edgeV2) &&
00761 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_2">faceShareWedges</a>(&face, attId, edgeV1, edgeV2) )
00762 {
00763 wedge.CollapsedTo= face.getAssociatedWedge(attId, edgeV1);
00764 }
00765 }
00766 }
00767 }
00768
00769 }
00770
00771 <span class="comment">// 3. collapse faces.</span>
00772 <span class="comment">//===================</span>
00773
00774 <span class="comment">// delete face shared by edge.</span>
00775 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++)
00776 {
00777 <a class="code" href="a04558.html#a14">sint</a> numFace= deletedFaces[i];
00778 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].Deleted=<span class="keyword">true</span>;
00779
00780 <span class="comment">// release edges from list.</span>
00781 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_6">removeFaceFromEdgeList</a>(TmpFaces[numFace]);
00782 <span class="comment">// ivalid all it!!</span>
00783 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].invalidAllIts(EdgeCollapses);
00784
00785
00786 <span class="comment">// delete from vertex1 and 2 the deleted faces.</span>
00787 <a class="code" href="a05363.html#a438">deleteElement</a>( Vertex1.SharedFaces, numFace);
00788 <a class="code" href="a05363.html#a438">deleteElement</a>( Vertex2.SharedFaces, numFace);
00789 }
00790
00791
00792 <span class="comment">// must ref correctly the faces.</span>
00793 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)neighboorFaces.size();i++)
00794 {
00795 CMRMFaceBuild &face=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[neighboorFaces[i]];
00796
00797 <span class="comment">// good vertices</span>
00798 <span class="keywordflow">if</span>(face.Corner[0].Vertex ==edgeV2) face.Corner[0].Vertex=edgeV1;
00799 <span class="keywordflow">if</span>(face.Corner[1].Vertex ==edgeV2) face.Corner[1].Vertex=edgeV1;
00800 <span class="keywordflow">if</span>(face.Corner[2].Vertex ==edgeV2) face.Corner[2].Vertex=edgeV1;
00801 <span class="comment">// nb: doesn't matter if deletedFaces are modified...</span>
00802
00803 <span class="comment">// good wedges</span>
00804 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<NumAttributes;attId++)
00805 {
00806 <a class="code" href="a04558.html#a14">sint</a> newWedge;
00807 newWedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][ face.Corner[0].Attributes[attId] ].CollapsedTo;
00808 <span class="keywordflow">if</span>(newWedge>=0) face.Corner[0].Attributes[attId]= newWedge;
00809 newWedge= TmpAttributes[attId][ face.Corner[1].Attributes[attId] ].CollapsedTo;
00810 <span class="keywordflow">if</span>(newWedge>=0) face.Corner[1].Attributes[attId]= newWedge;
00811 newWedge= TmpAttributes[attId][ face.Corner[2].Attributes[attId] ].CollapsedTo;
00812 <span class="keywordflow">if</span>(newWedge>=0) face.Corner[2].Attributes[attId]= newWedge;
00813 }
00814
00815 <span class="comment">// good edges.</span>
00816 <span class="comment">/* Those ones are updated in collapseEdges(): they are removed from the edgeCollapseList, </span>
00817 <span class="comment"> then they are re-inserted with good Vertex indices.</span>
00818 <span class="comment"> */</span>
00819 }
00820
00821
00822 <span class="comment">// The vertex1 has now the shared env of vertex2.</span>
00823 Vertex1.SharedFaces.insert(Vertex1.SharedFaces.end(), Vertex2.SharedFaces.begin(),
00824 Vertex2.SharedFaces.end());
00825
00826
00827 <span class="keywordflow">return</span> deletedFaces.size();
00828 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz559_0" doxytag="NL3D::CMRMBuilder::collapseEdges" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::collapseEdges </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>nWantedFaces</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00945">945</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>, <a class="el" href="a06058.html#l00278">NL3D::CMRMFaceBuild::invalidEdgeIt()</a>, <a class="el" href="a06058.html#l00207">NL3D::ItEdgeMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l00367">removeFaceFromEdgeList()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, and <a class="el" href="a06058.html#l00288">NL3D::CMRMFaceBuild::validEdgeIt()</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>.
<p>
<div class="fragment"><pre>00946 {
00947 <a class="code" href="a05363.html#a153">ItEdgeMap</a> EdgeIt;
00948
00949 <a class="code" href="a04558.html#a14">sint</a> nCurrentFaces=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();
00950 <a class="code" href="a04558.html#a14">sint</a> bug0=0,bug2=0,bug3=0;
00951
00952 <span class="keywordflow">while</span>(nCurrentFaces>nWantedFaces)
00953 {
00954 bug0++;
00955 EdgeIt= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.begin();
00956
00957 <span class="keywordflow">if</span>(EdgeIt== <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.end())
00958 <span class="keywordflow">break</span>;
00959
00960 <span class="comment">// 0. Look if edge already deleted</span>
00961 <span class="comment">//================================</span>
00962 CMRMEdge edge=(*EdgeIt).second;
00963
00964 <span class="comment">// Is it valid?? (ie his vertices exist yet??).</span>
00965 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[ edge.v0 ].CollapsedTo>=0
00966 || <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[ edge.v1 ].CollapsedTo>=0)
00967 {
00968 <span class="comment">// \todo yoyo: TODO_BUG: potential bug here...</span>
00969 CMRMFaceBuild &f= *(EdgeIt->second.Face);
00970 <a class="code" href="a04199.html#a6">nlassert</a>(f.validEdgeIt(EdgeIt->second));
00971 f.invalidEdgeIt(EdgeIt->second, EdgeCollapses);
00972 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(EdgeIt);
00973 bug2++;
00974 <span class="keywordflow">continue</span>;
00975 }
00976 <span class="comment">// \todo yoyo: TODO_BUG: potential bug here...</span>
00977 <span class="comment">// If a mesh is "open" it will crash if a "hole collapse"...</span>
00978 <span class="keywordflow">if</span>(edge.v0==edge.v1)
00979 {
00980 CMRMFaceBuild &f= *(EdgeIt->second.Face);
00981 <a class="code" href="a04199.html#a6">nlassert</a>(f.validEdgeIt(EdgeIt->second));
00982 f.invalidEdgeIt(EdgeIt->second, EdgeCollapses);
00983 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(EdgeIt);
00984 bug3++;
00985 <span class="keywordflow">continue</span>;
00986 }
00987
00988
00989 <span class="comment">// 1. else, OK, collapse it!!</span>
00990 <span class="comment">//===========================</span>
00991 <a class="code" href="a04558.html#a14">sint</a> vertexCollapsed= edge.v0;
00992 nCurrentFaces-= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_0">collapseEdge</a>(edge);
00993
00994
00995 <span class="comment">// 2. Must reorder all his neighborhood.</span>
00996 <span class="comment">//======================================</span>
00997 CMRMVertex &vert=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[vertexCollapsed];
00998 <a class="code" href="a04558.html#a14">sint</a> i;
00999 <span class="comment">// we delete from list modified edges, and we re-add them with their new value.</span>
01000 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++)
01001 {
01002 CMRMFaceBuild &f= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]];
01003 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_6">removeFaceFromEdgeList</a>(f);
01004 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_5">insertFaceIntoEdgeList</a>(f);
01005 }
01006
01007 }
01008 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_1" doxytag="NL3D::CMRMBuilder::collapseSkinWeight" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02865.html">CMesh::CSkinWeight</a> NL3D::CMRMBuilder::collapseSkinWeight </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> & </td>
<td class="mdname" nowrap> <em>sw1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> & </td>
<td class="mdname" nowrap> <em>sw2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>float </td>
<td class="mdname" nowrap> <em>InterValue</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"> const<code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00399">399</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00103">_SkinReduction</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06055.html#l00382">NL3D::CTmpVertexWeight::MatrixId</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06055.html#l00383">NL3D::CTmpVertexWeight::Weight</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>.
<p>
<div class="fragment"><pre>00400 {
00401 <span class="comment">// If fast interpolation.</span>
00402 <span class="keywordflow">if</span>(interValue==0)
00403 <span class="keywordflow">return</span> sw1;
00404 <span class="keywordflow">if</span>(interValue==1)
00405 <span class="keywordflow">return</span> sw2;
00406
00407 <span class="comment">// else, must blend a skinWeight: must identify matrix which exist in the 2 sws, and add new ones.</span>
00408 <a class="code" href="a04558.html#a15">uint</a> nbMats1=0;
00409 <a class="code" href="a04558.html#a15">uint</a> nbMats2=0;
00410 <span class="keyword">static</span> vector<CTmpVertexWeight> sws;
00411 sws.reserve(NL3D_MESH_SKINNING_MAX_MATRIX * 2);
00412 sws.clear();
00413
00414 <span class="comment">// For all weights of sw1.</span>
00415 <a class="code" href="a04558.html#a15">uint</a> i;
00416 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; i++)
00417 {
00418 CTmpVertexWeight vw;
00419 vw.MatrixId= sw1.MatrixId[i];
00420 vw.Weight= sw1.Weights[i]*(1-interValue);
00421 <span class="comment">// if this weight is not null.</span>
00422 <span class="keywordflow">if</span>(vw.Weight>0)
00423 {
00424 <span class="comment">// add it to the list.</span>
00425 sws.push_back(vw);
00426 }
00427 <span class="comment">// For skinning reduction.</span>
00428 <span class="keywordflow">if</span>(sw1.Weights[i]>0)
00429 nbMats1++;
00430 }
00431
00432
00433 <span class="comment">// For all weights of sw1.</span>
00434 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; i++)
00435 {
00436 CTmpVertexWeight vw;
00437 vw.MatrixId= sw2.MatrixId[i];
00438 vw.Weight= sw2.Weights[i]*(interValue);
00439 <span class="comment">// if this weight is not null.</span>
00440 <span class="keywordflow">if</span>(vw.Weight>0)
00441 {
00442 <span class="comment">// add it or add influence to the matrix.</span>
00443 vector<CTmpVertexWeight>::iterator it= find(sws.begin(), sws.end(), vw);
00444 <span class="keywordflow">if</span>(it== sws.end())
00445 sws.push_back(vw);
00446 <span class="keywordflow">else</span>
00447 it->Weight+= vw.Weight;
00448 }
00449 <span class="comment">// For skinning reduction.</span>
00450 <span class="keywordflow">if</span>(sw2.Weights[i]>0)
00451 nbMats2++;
00452 }
00453
00454
00455 <span class="comment">// Then keep just the best.</span>
00456 <span class="comment">// sort by Weight decreasing order.</span>
00457 sort(sws.begin(), sws.end());
00458
00459 <span class="comment">// clamp the result to the wanted max matrix.</span>
00460 <a class="code" href="a04558.html#a15">uint</a> nbMatsOut;
00461 <span class="keywordflow">switch</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a>)
00462 {
00463 <span class="keywordflow">case</span> CMRMParameters::SkinReductionMin:
00464 nbMatsOut= <a class="code" href="a04061.html#a0">min</a>(nbMats1, nbMats2);
00465 <span class="keywordflow">break</span>;
00466 <span class="keywordflow">case</span> CMRMParameters::SkinReductionMax:
00467 nbMatsOut= max(nbMats1, nbMats2);
00468 <span class="keywordflow">break</span>;
00469 <span class="keywordflow">case</span> CMRMParameters::SkinReductionBest:
00470 nbMatsOut= <a class="code" href="a04061.html#a0">min</a>( (<a class="code" href="a04558.html#a15">uint</a>)sws.size(), (<a class="code" href="a04558.html#a15">uint</a>)<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a> );
00471 <span class="keywordflow">break</span>;
00472 <span class="keywordflow">default</span>:
00473 <a class="code" href="a04199.html#a12">nlstop</a>;
00474 };
00475 <span class="comment">// For security.</span>
00476 nbMatsOut= <a class="code" href="a04061.html#a0">min</a>(nbMatsOut, (<a class="code" href="a04558.html#a15">uint</a>)sws.size());
00477 <a class="code" href="a04199.html#a6">nlassert</a>(nbMatsOut<=NL3D_MESH_SKINNING_MAX_MATRIX);
00478
00479
00480 <span class="comment">// Then output the result to the skinWeight, normalizing.</span>
00481 <span class="keywordtype">float</span> sumWeight=0;
00482 <span class="keywordflow">for</span>(i= 0; i<nbMatsOut; i++)
00483 {
00484 sumWeight+= sws[i].Weight;
00485 }
00486
00487 CMesh::CSkinWeight ret;
00488 <span class="comment">// Fill only needed matrix (other are rested in CMesh::CSkinWeight ctor).</span>
00489 <span class="keywordflow">for</span>(i= 0; i<nbMatsOut; i++)
00490 {
00491 ret.MatrixId[i]= sws[i].MatrixId;
00492 ret.Weights[i]= sws[i].Weight / sumWeight;
00493 }
00494
00495 <span class="keywordflow">return</span> ret;
00496 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuildera1" doxytag="NL3D::CMRMBuilder::compileMRM" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::compileMRM </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td>
<td class="mdname" nowrap> <em>mbuild</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > & </td>
<td class="mdname" nowrap> <em>bsList</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a02967.html">CMRMParameters</a> & </td>
<td class="mdname" nowrap> <em>params</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> & </td>
<td class="mdname" nowrap> <em>mrmMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>numMaxMaterial</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Compile a MRM skinned mesh info. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>mbuild</em> </td><td>the input mesh </td></tr>
<tr><td valign=top><em>params</em> </td><td>the parameters of MRM process. </td></tr>
<tr><td valign=top><em>mrmMesh</em> </td><td>the result MRM mesh.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06055.html#l03050">3050</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00103">_SkinReduction</a>, <a class="el" href="a06055.html#l01287">buildAllLods()</a>, <a class="el" href="a06055.html#l02912">buildBlendShapes()</a>, <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>, <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>, <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, <a class="el" href="a06055.html#l03115">buildMRMSewingMeshes()</a>, <a class="el" href="a06012.html#l00412">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::DistanceCoarsest</a>, <a class="el" href="a06012.html#l00408">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::DistanceFinest</a>, <a class="el" href="a06012.html#l00410">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::DistanceMiddle</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l01905">normalizeBaseMeshSkin()</a>, <a class="el" href="a05646.html#l00223">params</a>, <a class="el" href="a05990.html#l00187">NL3D::CMesh::CMeshBuild::SkinWeights</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00179">NL3D::CMesh::CMeshBuild::VertexFlags</a>, and <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>.
<p>
<div class="fragment"><pre>03053 {
03054 <span class="comment">// Temp data.</span>
03055 CMRMMesh baseMesh;
03056 vector<CMRMMeshGeom> lodMeshs;
03057 CMRMMeshFinal finalMRM;
03058 vector<CMRMMeshFinal> finalBsMRM;
03059 <a class="code" href="a04558.html#a11">uint32</a> vbFlags;
03060
03061
03062 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceFinest>=0);
03063 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceMiddle > <a class="code" href="a04223.html#a565">params</a>.DistanceFinest);
03064 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest > <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle);
03065
03066
03067 <span class="comment">// Copy some parameters.</span>
03068 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a>= <a class="code" href="a04223.html#a565">params</a>.SkinReduction;
03069
03070 <span class="comment">// Skinning??</span>
03071 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= ((mbuild.VertexFlags & CVertexBuffer::PaletteSkinFlag)==CVertexBuffer::PaletteSkinFlag);
03072 <span class="comment">// Skinning is OK only if SkinWeights are of same size as vertices.</span>
03073 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a> && ( mbuild.Vertices.size()==mbuild.SkinWeights.size() );
03074
03075 <span class="comment">// MeshInterface setuped ?</span>
03076 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_0">buildMRMSewingMeshes</a>(mbuild, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor);
03077
03078 <span class="comment">// from mbuild, build an internal MRM mesh representation.</span>
03079 <span class="comment">// vbFlags returned is the VBuffer format supported by CMRMBuilder.</span>
03080 <span class="comment">// NB: skinning is removed because skinning is made in software in CMeshMRMGeom.</span>
03081 vbFlags= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh</a>(mbuild, baseMesh);
03082
03083 <span class="comment">// Construct all blend shapes in the same way we have constructed the basemesh mrm</span>
03084 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_1">buildBlendShapes</a> (baseMesh, bsList, vbFlags);
03085
03086 <span class="comment">// If skinned, must ensure that skin weights have weights in ascending order.</span>
03087 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
03088 {
03089 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_10">normalizeBaseMeshSkin</a>(baseMesh);
03090 }
03091
03092 <span class="comment">// from this baseMesh, builds all LODs of the MRM, with geomorph info. NB: vertices/wedges are duplicated.</span>
03093 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_0">buildAllLods</a> ( baseMesh, lodMeshs, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor );
03094
03095 <span class="comment">// From this array of LOD, build a finalMRM, by regrouping identical vertices/wedges, and compute index geomorphs.</span>
03096 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_2">buildFinalMRM</a>(lodMeshs, finalMRM);
03097
03098 <span class="comment">// From this finalMRM, build output: a CMeshBuildMRM.</span>
03099 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_4">buildMeshBuildMrm</a>(finalMRM, mrmMesh, vbFlags, numMaxMaterial, mbuild);
03100
03101 <span class="comment">// Copy degradation control params.</span>
03102 mrmMesh.DistanceFinest= <a class="code" href="a04223.html#a565">params</a>.DistanceFinest;
03103 mrmMesh.DistanceMiddle= <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle;
03104 mrmMesh.DistanceCoarsest= <a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest;
03105 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuildera2" doxytag="NL3D::CMRMBuilder::compileMRM" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::compileMRM </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td>
<td class="mdname" nowrap> <em>mbuild</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > & </td>
<td class="mdname" nowrap> <em>bsList</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a02967.html">CMRMParameters</a> & </td>
<td class="mdname" nowrap> <em>params</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> & </td>
<td class="mdname" nowrap> <em>mrmMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>numMaxMaterial</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Compile a MRM mesh info. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>mbuild</em> </td><td>the input mesh </td></tr>
<tr><td valign=top><em>params</em> </td><td>the parameters of MRM process. </td></tr>
<tr><td valign=top><em>mrmMesh</em> </td><td>the result MRM mesh.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06055.html#l02991">2991</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00103">_SkinReduction</a>, <a class="el" href="a06055.html#l01287">buildAllLods()</a>, <a class="el" href="a06055.html#l02912">buildBlendShapes()</a>, <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>, <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>, <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, <a class="el" href="a06055.html#l03115">buildMRMSewingMeshes()</a>, <a class="el" href="a06006.html#l00445">NL3D::CMeshMRMGeom::CMeshBuildMRM::DistanceCoarsest</a>, <a class="el" href="a06006.html#l00441">NL3D::CMeshMRMGeom::CMeshBuildMRM::DistanceFinest</a>, <a class="el" href="a06006.html#l00443">NL3D::CMeshMRMGeom::CMeshBuildMRM::DistanceMiddle</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l01905">normalizeBaseMeshSkin()</a>, <a class="el" href="a05646.html#l00223">params</a>, <a class="el" href="a05990.html#l00187">NL3D::CMesh::CMeshBuild::SkinWeights</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00179">NL3D::CMesh::CMeshBuild::VertexFlags</a>, and <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>.
<p>
Referenced by <a class="el" href="a06011.html#l00206">NL3D::CMeshMRMSkinnedGeom::build()</a>, and <a class="el" href="a06005.html#l00246">NL3D::CMeshMRMGeom::build()</a>.
<p>
<div class="fragment"><pre>02994 {
02995 <span class="comment">// Temp data.</span>
02996 CMRMMesh baseMesh;
02997 vector<CMRMMeshGeom> lodMeshs;
02998 CMRMMeshFinal finalMRM;
02999 vector<CMRMMeshFinal> finalBsMRM;
03000 <a class="code" href="a04558.html#a11">uint32</a> vbFlags;
03001
03002
03003 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceFinest>=0);
03004 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceMiddle > <a class="code" href="a04223.html#a565">params</a>.DistanceFinest);
03005 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest > <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle);
03006
03007
03008 <span class="comment">// Copy some parameters.</span>
03009 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a>= <a class="code" href="a04223.html#a565">params</a>.SkinReduction;
03010
03011 <span class="comment">// Skinning??</span>
03012 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= ((mbuild.VertexFlags & CVertexBuffer::PaletteSkinFlag)==CVertexBuffer::PaletteSkinFlag);
03013 <span class="comment">// Skinning is OK only if SkinWeights are of same size as vertices.</span>
03014 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a> && ( mbuild.Vertices.size()==mbuild.SkinWeights.size() );
03015
03016 <span class="comment">// MeshInterface setuped ?</span>
03017 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_0">buildMRMSewingMeshes</a>(mbuild, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor);
03018
03019 <span class="comment">// from mbuild, build an internal MRM mesh representation.</span>
03020 <span class="comment">// vbFlags returned is the VBuffer format supported by CMRMBuilder.</span>
03021 <span class="comment">// NB: skinning is removed because skinning is made in software in CMeshMRMGeom.</span>
03022 vbFlags= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh</a>(mbuild, baseMesh);
03023
03024 <span class="comment">// Construct all blend shapes in the same way we have constructed the basemesh mrm</span>
03025 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_1">buildBlendShapes</a> (baseMesh, bsList, vbFlags);
03026
03027 <span class="comment">// If skinned, must ensure that skin weights have weights in ascending order.</span>
03028 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
03029 {
03030 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_10">normalizeBaseMeshSkin</a>(baseMesh);
03031 }
03032
03033 <span class="comment">// from this baseMesh, builds all LODs of the MRM, with geomorph info. NB: vertices/wedges are duplicated.</span>
03034 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_0">buildAllLods</a> ( baseMesh, lodMeshs, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor );
03035
03036 <span class="comment">// From this array of LOD, build a finalMRM, by regrouping identical vertices/wedges, and compute index geomorphs.</span>
03037 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_2">buildFinalMRM</a>(lodMeshs, finalMRM);
03038
03039 <span class="comment">// From this finalMRM, build output: a CMeshBuildMRM.</span>
03040 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_4">buildMeshBuildMrm</a>(finalMRM, mrmMesh, vbFlags, numMaxMaterial, mbuild);
03041
03042 <span class="comment">// Copy degradation control params.</span>
03043 mrmMesh.DistanceFinest= <a class="code" href="a04223.html#a565">params</a>.DistanceFinest;
03044 mrmMesh.DistanceMiddle= <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle;
03045 mrmMesh.DistanceCoarsest= <a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest;
03046 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderd0" doxytag="NL3D::CMRMBuilder::computeBsVerticesAttributes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::computeBsVerticesAttributes </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > & </td>
<td class="mdname" nowrap> <em>srcBsMeshs</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > & </td>
<td class="mdname" nowrap> <em>srcBsMeshsMod</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_0" doxytag="NL3D::CMRMBuilder::computeEdgeCost" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> float NL3D::CMRMBuilder::computeEdgeCost </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>edge</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00244">244</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00154">_CurrentLodComputed</a>, <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00152">_SewingMeshes</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>, <a class="el" href="a06055.html#l00143">getDeltaFaceNormals()</a>, <a class="el" href="a06057.html#l00059">NL3D::CMRMSewingMesh::getNumCollapseEdge()</a>, <a class="el" href="a06057.html#l00041">NL3D::CMRMSewingMesh::mustCollapseEdge()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, and <a class="el" href="a06055.html#l00103">vertexContinue()</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>.
<p>
<div class="fragment"><pre>00245 {
00246 <a class="code" href="a04558.html#a14">sint</a> v1= edge.v0;
00247 <a class="code" href="a04558.html#a14">sint</a> v2= edge.v1;
00248 <span class="comment">// more expensive is the edge, later it will collapse.</span>
00249
00250
00251 <span class="comment">// **** standard cost</span>
00252
00253 <span class="comment">// compute size of the edge.</span>
00254 <span class="keywordtype">float</span> cost=(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[v1].Current-TmpVertices[v2].Current).norm();
00255
00256 <span class="comment">// compute "curvature" of the edge.</span>
00257 <span class="keywordtype">float</span> faceCost= (<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_3">getDeltaFaceNormals</a>(v1)+<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_3">getDeltaFaceNormals</a>(v2));
00258 <span class="comment">// totally plane faces (faceCost==0) must be collapsed with respect to size (and not random if cost==0).</span>
00259 <span class="comment">// else we may have Plane Mesh (like flags) that will collapse in a very ugly way.</span>
00260 faceCost= max(faceCost, 0.01f);
00261
00262 <span class="comment">// modulate size with curvature.</span>
00263 cost*= faceCost;
00264
00265 <span class="comment">// Like H.Hope, add a weight on discontinuities..</span>
00266 <span class="keywordflow">if</span>( !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(v1) && !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(v2) )
00267 {
00268 <span class="comment">// Nb: don't do this on discontinuities edges, unless the unique material face will collapse (pffiou!!).</span>
00269 <span class="keywordflow">if</span>( <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(edge) || <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_2">edgeNearUniqueMatFace</a>(edge) )
00270 cost*=4;
00271 }
00272
00273 <span class="comment">// **** Interface Sewing cost</span>
00274 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>)
00275 {
00276 <span class="comment">// if the 2 vertices comes from a Sewing Interface mesh (must be a real interface id)</span>
00277 <a class="code" href="a04558.html#a14">sint</a> meshSewingId= TmpVertices[v1].InterfaceLink.InterfaceId;
00278 <span class="keywordflow">if</span>( meshSewingId>=0 && TmpVertices[v2].InterfaceLink.InterfaceId>=0 )
00279 {
00280 <span class="comment">// if the 2 vertices comes from the same Sewing Interface mesh</span>
00281 <span class="keywordflow">if</span>( meshSewingId == TmpVertices[v2].InterfaceLink.InterfaceId )
00282 {
00283 <span class="comment">// Then the edge is one of the sewing interface mesh. must do special things for it</span>
00284 CMRMSewingMesh &sewingMesh= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>[meshSewingId];
00285 <a class="code" href="a04558.html#a15">uint</a> dummy;
00286
00287 <span class="comment">// get the sewing edge id</span>
00288 CMRMEdge sewingEdge;
00289 sewingEdge.v0= TmpVertices[v1].InterfaceLink.InterfaceVertexId;
00290 sewingEdge.v1= TmpVertices[v2].InterfaceLink.InterfaceVertexId;
00291 <span class="comment">// if the current sewing lod want to collapse this edge</span>
00292 <a class="code" href="a04558.html#a14">sint</a> collapseId= sewingMesh.mustCollapseEdge(_CurrentLodComputed, sewingEdge, dummy);
00293 <span class="keywordflow">if</span>(collapseId>=0)
00294 {
00295 <span class="comment">// Then set a negative priority (ie will collapse as soon as possible). from -N to -1.</span>
00296 <span class="comment">// NB: sort them according to collapseId</span>
00297 cost= (<span class="keywordtype">float</span>)(-sewingMesh.getNumCollapseEdge(_CurrentLodComputed) + collapseId);
00298 }
00299 <span class="keywordflow">else</span>
00300 {
00301 <span class="comment">// This edge must not collapse at this Lod, set an infinite priority (hope will never collapse).</span>
00302 cost= FLT_MAX;
00303 }
00304 }
00305 <span class="keywordflow">else</span>
00306 {
00307 <span class="comment">/* The edge is between 2 interfaces but not the same. If we collide it we'll have holes!</span>
00308 <span class="comment"> This problem arise if space beetween interfaces is small. eg: if we setup an interface beetween </span>
00309 <span class="comment"> hair and head, and an other one beetween head and torso, then we'll have this problem in the</span>
00310 <span class="comment"> back of the neck.</span>
00311 <span class="comment"> The solution is to make a big big cost to hope we'll never collide them (else Holes...)!!</span>
00312 <span class="comment"> Don't use FLT_MAX to still have a correct order if we don't have choice...</span>
00313 <span class="comment"> */</span>
00314 cost*= 10000;
00315 }
00316 }
00317 }
00318
00319 <span class="keywordflow">return</span> cost;
00320 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_1" doxytag="NL3D::CMRMBuilder::edgeContinue" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::edgeContinue </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>edge</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00169">169</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, and <a class="el" href="a05646.html#l00236">w</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, and <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>.
<p>
<div class="fragment"><pre>00170 {
00171 <a class="code" href="a04558.html#a14">sint</a> v0= edge.v0;
00172 <a class="code" href="a04558.html#a14">sint</a> v1= edge.v1;
00173 CMRMVertex &Vertex1=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[v0];
00174
00175 <span class="comment">// build list sharing edge.</span>
00176 vector<sint> deletedFaces;
00177 <a class="code" href="a04558.html#a14">sint</a> i;
00178 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++)
00179 {
00180 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i];
00181 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].hasVertex(v1))
00182 deletedFaces.push_back(numFace);
00183 }
00184
00185 <a class="code" href="a04558.html#a14">sint</a> matId=-1;
00186 <span class="comment">// test if faces have same material.</span>
00187 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++)
00188 {
00189 <a class="code" href="a04558.html#a14">sint</a> m;
00190 m= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]].MaterialId;
00191 <span class="keywordflow">if</span>(matId>=0 && matId!=m) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00192 <span class="keywordflow">else</span> matId=m;
00193 }
00194
00195 <span class="comment">// test if faces have same wedge (for all att).</span>
00196 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++)
00197 {
00198 <a class="code" href="a04558.html#a14">sint</a> numwedge1=-1,numwedge2=-1;
00199 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++)
00200 {
00201 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a575">w</a>;
00202 <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]].getAssociatedWedge(attId, v0);
00203 <span class="keywordflow">if</span>(numwedge1>=0 && numwedge1!=<a class="code" href="a04223.html#a575">w</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00204 <span class="keywordflow">else</span> numwedge1=<a class="code" href="a04223.html#a575">w</a>;
00205 <a class="code" href="a04223.html#a575">w</a>= TmpFaces[deletedFaces[i]].getAssociatedWedge(attId, v1);
00206 <span class="keywordflow">if</span>(numwedge2>=0 && numwedge2!=<a class="code" href="a04223.html#a575">w</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00207 <span class="keywordflow">else</span> numwedge2=<a class="code" href="a04223.html#a575">w</a>;
00208 }
00209 }
00210
00211 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00212 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_2" doxytag="NL3D::CMRMBuilder::edgeNearUniqueMatFace" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::edgeNearUniqueMatFace </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>edge</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00214">214</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06058.html#l00263">NL3D::CMRMFaceBuild::getEdge()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, and <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>.
<p>
<div class="fragment"><pre>00215 {
00216 <a class="code" href="a04558.html#a14">sint</a> v0= edge.v0;
00217 <a class="code" href="a04558.html#a14">sint</a> v1= edge.v1;
00218 CMRMVertex &Vertex1=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[v0];
00219
00220 <span class="comment">// build list sharing edge.</span>
00221 vector<sint> deletedFaces;
00222 <a class="code" href="a04558.html#a14">sint</a> i;
00223 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++)
00224 {
00225 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i];
00226 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].hasVertex(v1))
00227 deletedFaces.push_back(numFace);
00228 }
00229
00230 <span class="comment">// test if faces are not isolated OneMaterial faces.</span>
00231 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++)
00232 {
00233 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]];
00234 <span class="keywordflow">if</span>( !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(f.getEdge(0)) &&
00235 !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(f.getEdge(1)) &&
00236 !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(f.getEdge(2)))
00237 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00238 }
00239
00240 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00241 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_2" doxytag="NL3D::CMRMBuilder::faceShareWedges" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::faceShareWedges </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02958.html">CMRMFaceBuild</a> * </td>
<td class="mdname" nowrap> <em>face</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>attribId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>numVertex1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>numVertex2</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00333">333</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06058.html#l00313">NL3D::CMRMFaceBuild::getAssociatedWedge()</a>, <a class="el" href="a06058.html#l00132">NL3D::CMRMAttribute::NbSharedFaces</a>, <a class="el" href="a06058.html#l00133">NL3D::CMRMAttribute::Shared</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00092">TmpAttributes</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>.
<p>
<div class="fragment"><pre>00334 {
00335 <a class="code" href="a04558.html#a14">sint</a> numWedge1= face->getAssociatedWedge(attribId, numVertex1);
00336 <a class="code" href="a04558.html#a14">sint</a> numWedge2= face->getAssociatedWedge(attribId, numVertex2);
00337 <span class="keywordflow">if</span>(numWedge1<0) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00338 <span class="keywordflow">if</span>(numWedge2<0) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00339
00340 CMRMAttribute &w1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attribId][numWedge1];
00341 CMRMAttribute &w2= TmpAttributes[attribId][numWedge2];
00342 <span class="keywordflow">return</span> w1.Shared && w2.Shared && w1.NbSharedFaces>0 && w2.NbSharedFaces>0;
00343 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_6" doxytag="NL3D::CMRMBuilder::findInsertAttributeInBaseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertAttributeInBaseMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>attId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>vertexId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a03668.html">CVectorH</a> & </td>
<td class="mdname" nowrap> <em>att</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01648">1648</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00229">_AttributeMap</a>, <a class="el" href="a06056.html#l00219">NL3D::CMRMBuilder::CAttributeKey::Attribute</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00218">NL3D::CMRMBuilder::CAttributeKey::VertexId</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01685">findInsertColorInBaseMesh()</a>, <a class="el" href="a06055.html#l01675">findInsertNormalInBaseMesh()</a>, and <a class="el" href="a06055.html#l01697">findInsertUvwInBaseMesh()</a>.
<p>
<div class="fragment"><pre>01649 {
01650 <span class="comment">// find this attribute in the map.</span>
01651 CAttributeKey key;
01652 key.VertexId= vertexId;
01653 key.Attribute= att;
01654 TAttributeMap::iterator it= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a>[attId].find(key);
01655
01656 <span class="comment">// if attribute not found in the map, then insert a new one.</span>
01657 <span class="keywordflow">if</span>(it==_AttributeMap[attId].end())
01658 {
01659 <a class="code" href="a04558.html#a14">sint</a> idx= baseMesh.Attributes[attId].size();
01660 <span class="comment">// insert into the array.</span>
01661 baseMesh.Attributes[attId].push_back(att);
01662 <span class="comment">// insert into the map.</span>
01663 _AttributeMap[attId].insert(make_pair(key, idx));
01664 <span class="keywordflow">return</span> idx;
01665 }
01666 <span class="keywordflow">else</span>
01667 {
01668 <span class="comment">// return the one found.</span>
01669 <span class="keywordflow">return</span> it->second;
01670 }
01671 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_7" doxytag="NL3D::CMRMBuilder::findInsertColorInBaseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertColorInBaseMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>attId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>vertexId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a03337.html">CRGBA</a> </td>
<td class="mdname" nowrap> <em>col</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01685">1685</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>.
<p>
<div class="fragment"><pre>01686 {
01687 <a class="code" href="a03668.html">CVectorH</a> att;
01688 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>;
01689 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo2">G</a>;
01690 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo1">B</a>;
01691 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>;
01692 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a>(baseMesh, attId, vertexId, att);
01693 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_8" doxytag="NL3D::CMRMBuilder::findInsertNormalInBaseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertNormalInBaseMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>attId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>vertexId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td>
<td class="mdname" nowrap> <em>normal</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01675">1675</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>.
<p>
<div class="fragment"><pre>01676 {
01677 <a class="code" href="a03668.html">CVectorH</a> att;
01678 att= normal;
01679 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= 0;
01680 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a>(baseMesh, attId, vertexId, att);
01681 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_9" doxytag="NL3D::CMRMBuilder::findInsertUvwInBaseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertUvwInBaseMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>attId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>vertexId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a03641.html">NLMISC::CUVW</a> & </td>
<td class="mdname" nowrap> <em>uvw</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01697">1697</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>.
<p>
<div class="fragment"><pre>01698 {
01699 <a class="code" href="a03668.html">CVectorH</a> att;
01700 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>= uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo0">U</a>;
01701 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>= uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo1">V</a>;
01702 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>= uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo2">W</a>;
01703 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= 0;
01704 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a>(baseMesh, attId, vertexId, att);
01705 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_3" doxytag="NL3D::CMRMBuilder::followVertex" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::followVertex </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>i</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00832">832</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06058.html#l00101">NL3D::CMRMVertex::CollapsedTo</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00090">TmpVertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01108">makeLODMesh()</a>.
<p>
<div class="fragment"><pre>00833 {
00834 CMRMVertex &vert=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i];
00835 <span class="keywordflow">if</span>(vert.CollapsedTo>=0)
00836 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_3">followVertex</a>(vert.CollapsedTo);
00837 <span class="keywordflow">else</span>
00838 <span class="keywordflow">return</span> i;
00839 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_4" doxytag="NL3D::CMRMBuilder::followWedge" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::followWedge </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>attribId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>i</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00841">841</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06058.html#l00125">NL3D::CMRMAttribute::CollapsedTo</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00092">TmpAttributes</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01108">makeLODMesh()</a>.
<p>
<div class="fragment"><pre>00842 {
00843 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attribId][i];
00844 <span class="keywordflow">if</span>(wedge.CollapsedTo>=0)
00845 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_4">followWedge</a>(attribId, wedge.CollapsedTo);
00846 <span class="keywordflow">else</span>
00847 <span class="keywordflow">return</span> i;
00848 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_3" doxytag="NL3D::CMRMBuilder::getDeltaFaceNormals" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> float NL3D::CMRMBuilder::getDeltaFaceNormals </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00143">143</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06058.html#l00096">NL3D::CMRMVertex::Current</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, and <a class="el" href="a06056.html#l00090">TmpVertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>.
<p>
<div class="fragment"><pre>00144 {
00145 <span class="comment">// return a positive value of Somme(|DeltaNormals|) / NNormals.</span>
00146 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex];
00147 <span class="keywordtype">float</span> delta=0;
00148 CVector refNormal;
00149 <a class="code" href="a04558.html#a14">sint</a> nfaces=vert.SharedFaces.size();
00150 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<nfaces;i++)
00151 {
00152 CVector normal;
00153 CVector &v0= TmpVertices[<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i].Corner[0].Vertex].Current;
00154 CVector &v1= TmpVertices[TmpFaces[i].Corner[1].Vertex].Current;
00155 CVector &v2= TmpVertices[TmpFaces[i].Corner[2].Vertex].Current;
00156 normal= (v1-v0)^(v2-v0);
00157 normal.normalize();
00158 <span class="keywordflow">if</span>(i==0)
00159 refNormal=normal;
00160 <span class="keywordflow">else</span>
00161 delta+=(1-refNormal*normal);
00162 }
00163 <span class="keywordflow">if</span>(nfaces<2)
00164 <span class="keywordflow">return</span> 0;
00165 <span class="keywordflow">else</span>
00166 <span class="keywordflow">return</span> delta/(nfaces-1);
00167 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz559_1" doxytag="NL3D::CMRMBuilder::init" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::init </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>baseMesh</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00867">867</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>, <a class="el" href="a06062.html#l00123">NL3D::CMRMMesh::InterfaceLinks</a>, <a class="el" href="a06062.html#l00046">NL3D_MRM_MAX_ATTRIB</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, and <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01287">buildAllLods()</a>, and <a class="el" href="a06055.html#l01256">makeFromMesh()</a>.
<p>
<div class="fragment"><pre>00868 {
00869 <a class="code" href="a04558.html#a14">sint</a> i, attId;
00870
00871
00872 <span class="comment">// First clear ALL.</span>
00873 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.clear();
00874 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++)
00875 {
00876 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].clear();
00877 }
00878 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.clear();
00879 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.clear();
00880
00881
00882 <span class="comment">// resize.</span>
00883 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>= baseMesh.NumAttributes;
00884 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.resize(baseMesh.Vertices.size());
00885 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++)
00886 {
00887 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].resize(baseMesh.Attributes[attId].size());
00888 }
00889 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.resize(baseMesh.Faces.size());
00890
00891
00892 <span class="comment">// Then copy.</span>
00893 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)baseMesh.Vertices.size();i++)
00894 {
00895 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].Current= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].Original= baseMesh.Vertices[i];
00896 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].BSCurrent.resize(baseMesh.BlendShapes.size());
00897 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a11">uint32</a> j = 0; j <baseMesh.BlendShapes.size() ;++j)
00898 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].BSCurrent[j]= baseMesh.BlendShapes[j].Vertices[i];
00899 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
00900 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].CurrentSW= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].OriginalSW= baseMesh.SkinWeights[i];
00901 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>)
00902 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].InterfaceLink= baseMesh.InterfaceLinks[i];
00903 }
00904 <span class="keywordflow">for</span>(attId=0;attId<NumAttributes;attId++)
00905 {
00906 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)baseMesh.Attributes[attId].size();i++)
00907 {
00908 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].Current= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].Original=
00909 baseMesh.Attributes[attId][i];
00910 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].BSCurrent.resize(baseMesh.BlendShapes.size());
00911 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a11">uint32</a> j = 0; j <baseMesh.BlendShapes.size() ;++j)
00912 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].BSCurrent[j]= baseMesh.BlendShapes[j].Attributes[attId][i];
00913 }
00914 }
00915 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)baseMesh.Faces.size();i++)
00916 {
00917 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i]= baseMesh.Faces[i];
00918 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i].BSInterpolated.resize(baseMesh.BlendShapes.size());
00919 }
00920
00921
00922 <span class="comment">// Create vertices sharedFaces.</span>
00923 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();i++)
00924 {
00925 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i];
00926
00927 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[0].Vertex].SharedFaces.push_back(i);
00928 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[1].Vertex].SharedFaces.push_back(i);
00929 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[2].Vertex].SharedFaces.push_back(i);
00930 }
00931
00932
00933 <span class="comment">// Compute EdgeCost.</span>
00934 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();i++)
00935 {
00936 CMRMFaceBuild &f= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i];
00937 <span class="comment">// At start, valid all edges.</span>
00938 f. ValidIt0= <span class="keyword">true</span>;
00939 f. ValidIt1= <span class="keyword">true</span>;
00940 f. ValidIt2= <span class="keyword">true</span>;
00941 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_5">insertFaceIntoEdgeList</a>(f);
00942 }
00943 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_5" doxytag="NL3D::CMRMBuilder::insertFaceIntoEdgeList" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::insertFaceIntoEdgeList </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02958.html">CMRMFaceBuild</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>tmpf</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00347">347</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06058.html#l00263">NL3D::CMRMFaceBuild::getEdge()</a>, <a class="el" href="a05646.html#l00235">len</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt0</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt1</a>, and <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt2</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00945">collapseEdges()</a>, and <a class="el" href="a06055.html#l00867">init()</a>.
<p>
<div class="fragment"><pre>00348 {
00349 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a571">len</a>;
00350 <span class="keywordflow">if</span>(f.ValidIt0)
00351 {
00352 <a class="code" href="a04223.html#a571">len</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a>(f.getEdge(0));
00353 f. It0= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.insert( TEdgeMap::value_type( len, CMRMEdgeFace(f.getEdge(0),&f) ) );
00354 }
00355 <span class="keywordflow">if</span>(f.ValidIt1)
00356 {
00357 <a class="code" href="a04223.html#a571">len</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a>(f.getEdge(1));
00358 f. It1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.insert( TEdgeMap::value_type( len, CMRMEdgeFace(f.getEdge(1),&f) ) );
00359 }
00360 <span class="keywordflow">if</span>(f.ValidIt2)
00361 {
00362 <a class="code" href="a04223.html#a571">len</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a>(f.getEdge(2));
00363 f. It2= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.insert( TEdgeMap::value_type( len, CMRMEdgeFace(f.getEdge(2),&f) ) );
00364 }
00365 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderd1" doxytag="NL3D::CMRMBuilder::makeCoarserBS" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::makeCoarserBS </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">std::vector< <a class="el" href="a02950.html">CMRMBlendShape</a> > & </td>
<td class="mdname1" valign="top" nowrap> <em>csBsMeshs</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01203">1203</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06062.html#l00101">NL3D::CMRMBlendShape::Attributes</a>, <a class="el" href="a06058.html#l00124">NL3D::CMRMAttribute::BSCurrent</a>, <a class="el" href="a06058.html#l00097">NL3D::CMRMVertex::BSCurrent</a>, <a class="el" href="a06058.html#l00127">NL3D::CMRMAttribute::CoarserIndex</a>, <a class="el" href="a06058.html#l00103">NL3D::CMRMVertex::CoarserIndex</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06062.html#l00103">NL3D::CMRMBlendShape::NumAttributes</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a06062.html#l00099">NL3D::CMRMBlendShape::Vertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>.
<p>
<div class="fragment"><pre>01204 {
01205 <a class="code" href="a04558.html#a11">uint32</a> i, k;
01206 <a class="code" href="a04558.html#a10">sint32</a> nSizeVert, nSizeAttr, attId;
01207
01208 <span class="comment">// Calculate size of vertices array</span>
01209 nSizeVert = 0;
01210 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.size(); ++i)
01211 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].CoarserIndex > nSizeVert)
01212 nSizeVert = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].CoarserIndex;
01213 ++nSizeVert;
01214
01215 <span class="keywordflow">for</span> (k = 0; k < csBsMeshs.size(); ++k)
01216 {
01217 CMRMBlendShape &rBsCoarserMesh = csBsMeshs[k];
01218
01219 rBsCoarserMesh.Vertices.resize (nSizeVert);
01220 rBsCoarserMesh.NumAttributes = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;
01221
01222 <span class="comment">// Vertices</span>
01223 <span class="keywordflow">for</span>(i = 0; i < TmpVertices.size(); ++i)
01224 {
01225 CMRMVertex &vert = TmpVertices[i];
01226 <span class="keywordflow">if</span> (vert.CoarserIndex != -1)
01227 {
01228 rBsCoarserMesh.Vertices[vert.CoarserIndex] = vert.BSCurrent[k];
01229 }
01230 }
01231
01232 <span class="keywordflow">for</span> (attId = 0; attId < <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>; attId++)
01233 {
01234 <span class="comment">// Calculate size of attribute attId array</span>
01235 nSizeAttr = 0;
01236 <span class="keywordflow">for</span>(i = 0; i < <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].size(); i++)
01237 <span class="keywordflow">if</span> (TmpAttributes[attId][i].CoarserIndex > nSizeAttr)
01238 nSizeAttr = TmpAttributes[attId][i].CoarserIndex;
01239 ++nSizeAttr;
01240
01241 rBsCoarserMesh.Attributes[attId].resize (nSizeAttr);
01242
01243 <span class="keywordflow">for</span> (i = 0; i < TmpAttributes[attId].size(); i++)
01244 {
01245 CMRMAttribute &wedge = TmpAttributes[attId][i];
01246 <span class="keywordflow">if</span> (wedge.CoarserIndex != -1)
01247 {
01248 rBsCoarserMesh.Attributes[attId][wedge.CoarserIndex] = wedge.BSCurrent[k];
01249 }
01250 }
01251 }
01252 }
01253 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz559_2" doxytag="NL3D::CMRMBuilder::makeFromMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::makeFromMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>baseMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02966.html">CMRMMeshGeom</a> & </td>
<td class="mdname" nowrap> <em>lodMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname" nowrap> <em>coarserMesh</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>nWantedFaces</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
this is the root call to compute a single lodMesh and the coarserMesh from a baseMesh.
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01256">1256</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, and <a class="el" href="a05981.html#l00104">sint</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01287">buildAllLods()</a>.
<p>
<div class="fragment"><pre>01257 {
01258 <span class="comment">// Init Tmp values in MRM builder.</span>
01259 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_1">init</a>(baseMesh);
01260
01261 <span class="comment">// compute MRM too next tgt face.</span>
01262 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_0">collapseEdges</a>(nWantedFaces);
01263
01264 <span class="comment">// save the coarser mesh.</span>
01265 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_4">saveCoarserMesh</a>(coarserMesh);
01266 <span class="comment">// Build coarser BlendShapes.</span>
01267 coarserMesh.BlendShapes.resize(baseMesh.BlendShapes.size());
01268 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderd1">makeCoarserBS</a>(coarserMesh.BlendShapes);
01269
01270 <span class="comment">// build the lodMesh (baseMesh, with vertex/Attributes collapse infos).</span>
01271 lodMesh= baseMesh;
01272 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_3">makeLODMesh</a>(lodMesh);
01273
01274 <span class="comment">// end for this level.</span>
01275 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz559_3" doxytag="NL3D::CMRMBuilder::makeLODMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::makeLODMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02966.html">CMRMMeshGeom</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>lodMesh</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01108">1108</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00155">NL3D::CMRMMeshGeom::CoarserFaces</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06055.html#l00832">followVertex()</a>, <a class="el" href="a06055.html#l00841">followWedge()</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, and <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>.
<p>
<div class="fragment"><pre>01109 {
01110 <a class="code" href="a04558.html#a14">sint</a> i,j,attId,<a class="code" href="a04223.html#a566">index</a>,coidx;
01111
01112 <span class="comment">// for all faces of this mesh, find target in the coarser mesh.</span>
01113 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.CoarserFaces.size();i++)
01114 {
01115 CMRMFace &face= lodMesh.CoarserFaces[i];
01116
01117 <span class="comment">// For 3 corners.</span>
01118 <span class="keywordflow">for</span>(j=0;j<3;j++)
01119 {
01120 <span class="comment">// Vertex.</span>
01121 <span class="comment">// The index is yet the index in the finer mesh.</span>
01122 <a class="code" href="a04223.html#a566">index</a>= face.Corner[j].Vertex;
01123 <span class="comment">// the index in the coarser mesh is vert.CoarserIndex.</span>
01124 coidx= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[<a class="code" href="a04223.html#a566">index</a>].CoarserIndex;
01125 <span class="comment">// but if this vertex is collapsed, must find the good index (yet in the finer mesh)</span>
01126 <span class="keywordflow">if</span>(coidx==-1)
01127 {
01128 <span class="comment">// find to which we must collapse.</span>
01129 <a class="code" href="a04223.html#a566">index</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_3">followVertex</a>(index);
01130 <span class="comment">// and so we have the coarser index. this one must be valid.</span>
01131 coidx= TmpVertices[<a class="code" href="a04223.html#a566">index</a>].CoarserIndex;
01132 <a class="code" href="a04199.html#a6">nlassert</a>(coidx>=0);
01133 }
01134 <span class="comment">// update corner of CoarserFace.</span>
01135 face.Corner[j].Vertex= coidx;
01136
01137
01138 <span class="comment">// Do exactly same thing for all attributes.</span>
01139 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++)
01140 {
01141 <a class="code" href="a04223.html#a566">index</a>= face.Corner[j].Attributes[attId];
01142 coidx= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][<a class="code" href="a04223.html#a566">index</a>].CoarserIndex;
01143 <span class="keywordflow">if</span>(coidx==-1)
01144 {
01145 <a class="code" href="a04223.html#a566">index</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_4">followWedge</a>(attId, index);
01146 coidx= TmpAttributes[attId][<a class="code" href="a04223.html#a566">index</a>].CoarserIndex;
01147 <a class="code" href="a04199.html#a6">nlassert</a>(coidx>=0);
01148 }
01149 face.Corner[j].Attributes[attId]= coidx;
01150 }
01151 }
01152 }
01153
01154 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_10" doxytag="NL3D::CMRMBuilder::normalizeBaseMeshSkin" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::normalizeBaseMeshSkin </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>baseMesh</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01905">1905</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l01858">normalizeSkinWeight()</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>.
<p>
<div class="fragment"><pre>01906 {
01907 <a class="code" href="a04199.html#a6">nlassert</a>(_Skinned);
01908
01909 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<baseMesh.SkinWeights.size(); i++)
01910 {
01911 baseMesh.SkinWeights[i]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_11">normalizeSkinWeight</a>(baseMesh.SkinWeights[i]);
01912 }
01913 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_11" doxytag="NL3D::CMRMBuilder::normalizeSkinWeight" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02865.html">CMesh::CSkinWeight</a> NL3D::CMRMBuilder::normalizeSkinWeight </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>sw</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01858">1858</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06055.html#l00382">NL3D::CTmpVertexWeight::MatrixId</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06055.html#l00383">NL3D::CTmpVertexWeight::Weight</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01905">normalizeBaseMeshSkin()</a>.
<p>
<div class="fragment"><pre>01859 {
01860 <a class="code" href="a04558.html#a15">uint</a> nbMats= 0;
01861 <span class="keyword">static</span> vector<CTmpVertexWeight> sws;
01862 sws.reserve(NL3D_MESH_SKINNING_MAX_MATRIX);
01863 sws.clear();
01864
01865 <span class="comment">// For all weights of sw1.</span>
01866 <a class="code" href="a04558.html#a15">uint</a> i;
01867 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; i++)
01868 {
01869 CTmpVertexWeight vw;
01870 vw.MatrixId= sw.MatrixId[i];
01871 vw.Weight= sw.Weights[i];
01872 <span class="comment">// if this weight is not null.</span>
01873 <span class="keywordflow">if</span>(vw.Weight>0)
01874 {
01875 <span class="comment">// add it to the list.</span>
01876 sws.push_back(vw);
01877 nbMats++;
01878 }
01879 }
01880
01881 <span class="comment">// sort by Weight decreasing order.</span>
01882 sort(sws.begin(), sws.end());
01883
01884
01885 <span class="comment">// Then output the result to the skinWeight, normalizing.</span>
01886 <span class="keywordtype">float</span> sumWeight=0;
01887 <span class="keywordflow">for</span>(i= 0; i<nbMats; i++)
01888 {
01889 sumWeight+= sws[i].Weight;
01890 }
01891
01892 CMesh::CSkinWeight ret;
01893 <span class="comment">// Fill only needed matrix (other are rested in CMesh::CSkinWeight ctor).</span>
01894 <span class="keywordflow">for</span>(i= 0; i<nbMats; i++)
01895 {
01896 ret.MatrixId[i]= sws[i].MatrixId;
01897 ret.Weights[i]= sws[i].Weight / sumWeight;
01898 }
01899
01900 <span class="keywordflow">return</span> ret;
01901 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz557_6" doxytag="NL3D::CMRMBuilder::removeFaceFromEdgeList" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::removeFaceFromEdgeList </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02958.html">CMRMFaceBuild</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>f</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00367">367</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06058.html#l00228">NL3D::CMRMFaceBuild::It0</a>, <a class="el" href="a06058.html#l00228">NL3D::CMRMFaceBuild::It1</a>, <a class="el" href="a06058.html#l00228">NL3D::CMRMFaceBuild::It2</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt0</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt1</a>, and <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt2</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00945">collapseEdges()</a>.
<p>
<div class="fragment"><pre>00368 {
00369 <span class="keywordflow">if</span>(f.ValidIt0)
00370 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(f.It0);
00371 <span class="keywordflow">if</span>(f.ValidIt1)
00372 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(f.It1);
00373 <span class="keywordflow">if</span>(f.ValidIt2)
00374 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(f.It2);
00375 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz559_4" doxytag="NL3D::CMRMBuilder::saveCoarserMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::saveCoarserMesh </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>coarserMesh</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l01010">1010</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06058.html#l00127">NL3D::CMRMAttribute::CoarserIndex</a>, <a class="el" href="a06058.html#l00103">NL3D::CMRMVertex::CoarserIndex</a>, <a class="el" href="a06058.html#l00125">NL3D::CMRMAttribute::CollapsedTo</a>, <a class="el" href="a06058.html#l00101">NL3D::CMRMVertex::CollapsedTo</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06058.html#l00123">NL3D::CMRMAttribute::Current</a>, <a class="el" href="a06058.html#l00096">NL3D::CMRMVertex::Current</a>, <a class="el" href="a06058.html#l00099">NL3D::CMRMVertex::CurrentSW</a>, <a class="el" href="a06058.html#l00226">NL3D::CMRMFaceBuild::Deleted</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a06058.html#l00106">NL3D::CMRMVertex::InterfaceLink</a>, <a class="el" href="a06062.html#l00123">NL3D::CMRMMesh::InterfaceLinks</a>, <a class="el" href="a06062.html#l00083">NL3D::CMRMFace::MaterialId</a>, <a class="el" href="a06062.html#l00046">NL3D_MRM_MAX_ATTRIB</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, and <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>.
<p>
<div class="fragment"><pre>01011 {
01012 <a class="code" href="a04558.html#a14">sint</a> i,attId,<a class="code" href="a04223.html#a566">index</a>;
01013 <span class="comment">// First clear ALL.</span>
01014 coarserMesh.Vertices.clear();
01015 coarserMesh.SkinWeights.clear();
01016 coarserMesh.InterfaceLinks.clear();
01017 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++)
01018 {
01019 coarserMesh.Attributes[attId].clear();
01020 }
01021 coarserMesh.Faces.clear();
01022 coarserMesh.NumAttributes= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;
01023
01024 <span class="comment">// Vertices.</span>
01025 <span class="comment">//==========</span>
01026 <a class="code" href="a04223.html#a566">index</a>=0;
01027 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.size();i++)
01028 {
01029 CMRMVertex &vert=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i];
01030 <span class="keywordflow">if</span>(vert.CollapsedTo==-1) <span class="comment">// if exist yet.</span>
01031 {
01032 vert.CoarserIndex=<a class="code" href="a04223.html#a566">index</a>;
01033 coarserMesh.Vertices.push_back(vert.Current);
01034 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>)
01035 coarserMesh.SkinWeights.push_back(vert.CurrentSW);
01036 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>)
01037 coarserMesh.InterfaceLinks.push_back(vert.InterfaceLink);
01038
01039 <a class="code" href="a04223.html#a566">index</a>++;
01040 }
01041 <span class="keywordflow">else</span>
01042 vert.CoarserIndex=-1; <span class="comment">// indicate that this vertex no more exist and is to be geomorphed to an other.</span>
01043 }
01044
01045
01046 <span class="comment">// Attributes.</span>
01047 <span class="comment">//============</span>
01048 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++)
01049 {
01050 <a class="code" href="a04223.html#a566">index</a>=0;
01051 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].size();i++)
01052 {
01053 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i];
01054 <span class="keywordflow">if</span>(wedge.CollapsedTo==-1) <span class="comment">// if exist yet.</span>
01055 {
01056 wedge.CoarserIndex=<a class="code" href="a04223.html#a566">index</a>;
01057 coarserMesh.Attributes[attId].push_back(wedge.Current);
01058 <a class="code" href="a04223.html#a566">index</a>++;
01059 }
01060 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(wedge.CollapsedTo==-2) <span class="comment">// else if totaly destroyed.</span>
01061 {
01062 <span class="comment">// Insert this wedge in the coarser mesh.</span>
01063 <span class="comment">// NB: the coarser mesh faces do not use it anymore, but FinerMesh use it</span>
01064 <span class="comment">// for geomorph (LODMesh.CoarserFaces may point to it).</span>
01065 <span class="comment">// NB: look at buildFinalMRM(), it works fine for all cases.</span>
01066 wedge.CoarserIndex=<a class="code" href="a04223.html#a566">index</a>;
01067 coarserMesh.Attributes[attId].push_back(wedge.Current);
01068 <a class="code" href="a04223.html#a566">index</a>++;
01069 }
01070 <span class="keywordflow">else</span>
01071 wedge.CoarserIndex=-1; <span class="comment">// indicate that this wedge no more exist and is to be geomorphed to an other.</span>
01072 }
01073 }
01074
01075 <span class="comment">// Faces.</span>
01076 <span class="comment">//=======</span>
01077 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();i++)
01078 {
01079 CMRMFaceBuild &face=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i];
01080 <span class="keywordflow">if</span>(!face.Deleted)
01081 {
01082 CMRMFace newFace;
01083 <span class="comment">// Material.</span>
01084 newFace.MaterialId= face.MaterialId;
01085 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> j=0;j<3;j++)
01086 {
01087 <span class="comment">// Vertex.</span>
01088 newFace.Corner[j].Vertex= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[j].Vertex].CoarserIndex;
01089 <a class="code" href="a04199.html#a6">nlassert</a>(newFace.Corner[j].Vertex>=0);
01090 <span class="comment">// Attributes.</span>
01091 <span class="keywordflow">for</span>(attId=0;attId<NumAttributes;attId++)
01092 {
01093 <a class="code" href="a04558.html#a14">sint</a> oldidx= face.Corner[j].Attributes[attId];
01094 newFace.Corner[j].Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][oldidx].CoarserIndex;
01095 <a class="code" href="a04199.html#a6">nlassert</a>(newFace.Corner[j].Attributes[attId]>=0);
01096 }
01097
01098 }
01099
01100 coarserMesh.Faces.push_back(newFace);
01101 }
01102 }
01103
01104 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_4" doxytag="NL3D::CMRMBuilder::vertexClosed" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexClosed </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00108">108</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06058.html#l00263">NL3D::CMRMFaceBuild::getEdge()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, and <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>.
<p>
<div class="fragment"><pre>00109 {
00110 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex];
00111 map<CMRMEdge, sint> EdgeShare;
00112 <span class="comment">// Init to 0.</span>
00113 <a class="code" href="a04558.html#a14">sint</a> i;
00114 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++)
00115 {
00116 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]];
00117 EdgeShare[f.getEdge(0)]= 0;
00118 EdgeShare[f.getEdge(1)]= 0;
00119 EdgeShare[f.getEdge(2)]= 0;
00120 }
00121 <span class="comment">// Inc count.</span>
00122 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++)
00123 {
00124 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]];
00125 EdgeShare[f.getEdge(0)]++;
00126 EdgeShare[f.getEdge(1)]++;
00127 EdgeShare[f.getEdge(2)]++;
00128 }
00129 <span class="comment">// Test open edges.</span>
00130 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++)
00131 {
00132 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]];
00133 <a class="code" href="a04558.html#a14">sint</a> v0= f.Corner[0].Vertex;
00134 <a class="code" href="a04558.html#a14">sint</a> v1= f.Corner[1].Vertex;
00135 <a class="code" href="a04558.html#a14">sint</a> v2= f.Corner[2].Vertex;
00136 <span class="keywordflow">if</span>(EdgeShare[f.getEdge(0)]<2 && (v0==numvertex || v1==numvertex)) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00137 <span class="keywordflow">if</span>(EdgeShare[f.getEdge(1)]<2 && (v1==numvertex || v2==numvertex)) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00138 <span class="keywordflow">if</span>(EdgeShare[f.getEdge(2)]<2 && (v0==numvertex || v2==numvertex)) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00139 }
00140 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00141 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_5" doxytag="NL3D::CMRMBuilder::vertexContinue" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexContinue </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00103">103</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06055.html#l00090">vertexHasOneMaterial()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>.
<p>
<div class="fragment"><pre>00104 {
00105 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_7">vertexHasOneWedge</a>(numvertex) && <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_6">vertexHasOneMaterial</a>(numvertex);
00106 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_6" doxytag="NL3D::CMRMBuilder::vertexHasOneMaterial" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexHasOneMaterial </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00090">90</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, and <a class="el" href="a06056.html#l00090">TmpVertices</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00103">vertexContinue()</a>.
<p>
<div class="fragment"><pre>00091 {
00092 <a class="code" href="a04558.html#a14">sint</a> matId=-1;
00093 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex];
00094 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++)
00095 {
00096 <a class="code" href="a04558.html#a14">sint</a> m= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]].MaterialId;
00097 <span class="keywordflow">if</span>(matId>=0 && matId!=m) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00098 <span class="keywordflow">else</span> matId=m;
00099 }
00100 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00101 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz555_7" doxytag="NL3D::CMRMBuilder::vertexHasOneWedge" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexHasOneWedge </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06055.html#l00074">74</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>.
<p>
References <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, and <a class="el" href="a05646.html#l00236">w</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00103">vertexContinue()</a>.
<p>
<div class="fragment"><pre>00075 {
00076 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex];
00077 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++)
00078 {
00079 <a class="code" href="a04558.html#a14">sint</a> numwedge=-1;
00080 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++)
00081 {
00082 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]].getAssociatedWedge(attId, numvertex);
00083 <span class="keywordflow">if</span>(numwedge>=0 && numwedge!=<a class="code" href="a04223.html#a575">w</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
00084 <span class="keywordflow">else</span> numwedge=<a class="code" href="a04223.html#a575">w</a>;
00085 }
00086 }
00087 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00088 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CMRMBuilderz567_12" doxytag="NL3D::CMRMBuilder::_AttributeMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">TAttributeMap</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">NL3D::CMRMBuilder::_AttributeMap</a>[NL3D_MRM_MAX_ATTRIB]<code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00229">229</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, and <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz561_1" doxytag="NL3D::CMRMBuilder::_CurrentLodComputed" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">NL3D::CMRMBuilder::_CurrentLodComputed</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00154">154</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01287">buildAllLods()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz563_1" doxytag="NL3D::CMRMBuilder::_GeomMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">TGeomMap</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">NL3D::CMRMBuilder::_GeomMap</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00180">180</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz561_2" doxytag="NL3D::CMRMBuilder::_HasMeshInterfaces" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">NL3D::CMRMBuilder::_HasMeshInterfaces</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00150">150</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, <a class="el" href="a06055.html#l00859">CMRMBuilder()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l02991">compileMRM()</a>, <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, <a class="el" href="a06055.html#l00867">init()</a>, and <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz561_3" doxytag="NL3D::CMRMBuilder::_SewingMeshes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02968.html">CMRMSewingMesh</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">NL3D::CMRMBuilder::_SewingMeshes</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00152">152</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l03115">buildMRMSewingMeshes()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_0" doxytag="NL3D::CMRMBuilder::_Skinned" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">NL3D::CMRMBuilder::_Skinned</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00101">101</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_1" doxytag="NL3D::CMRMBuilder::_SkinReduction" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02967.html#NL3D_1_1CMRMParametersw3">CMRMParameters::TSkinReduction</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">NL3D::CMRMBuilder::_SkinReduction</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
If the current build is skinned, control the quality of the skinning redcution.
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00103">103</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00399">collapseSkinWeight()</a>, and <a class="el" href="a06055.html#l02991">compileMRM()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_2" doxytag="NL3D::CMRMBuilder::EdgeCollapses" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a05363.html#a152">TEdgeMap</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">NL3D::CMRMBuilder::EdgeCollapses</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00098">98</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>, and <a class="el" href="a06055.html#l00367">removeFaceFromEdgeList()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_3" doxytag="NL3D::CMRMBuilder::NumAttributes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NL3D::CMRMBuilder::NumAttributes</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00094">94</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>, <a class="el" href="a06055.html#l00859">CMRMBuilder()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_4" doxytag="NL3D::CMRMBuilder::TmpAttributes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02949.html">CMRMAttribute</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">NL3D::CMRMBuilder::TmpAttributes</a>[NL3D_MRM_MAX_ATTRIB]<code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00092">92</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00333">faceShareWedges()</a>, <a class="el" href="a06055.html#l00841">followWedge()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, and <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_5" doxytag="NL3D::CMRMBuilder::TmpFaces" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02958.html">CMRMFaceBuild</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">NL3D::CMRMBuilder::TmpFaces</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00096">96</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>, <a class="el" href="a06055.html#l00143">getDeltaFaceNormals()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, <a class="el" href="a06055.html#l00108">vertexClosed()</a>, <a class="el" href="a06055.html#l00090">vertexHasOneMaterial()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CMRMBuilderz553_6" doxytag="NL3D::CMRMBuilder::TmpVertices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02970.html">CMRMVertex</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">NL3D::CMRMBuilder::TmpVertices</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06056.html#l00090">90</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.
<p>
Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>, <a class="el" href="a06055.html#l00832">followVertex()</a>, <a class="el" href="a06055.html#l00143">getDeltaFaceNormals()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, <a class="el" href="a06055.html#l00108">vertexClosed()</a>, <a class="el" href="a06055.html#l00090">vertexHasOneMaterial()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a06056.html">mrm_builder.h</a><li><a class="el" href="a06055.html">mrm_builder.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:56:45 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.6 </small></address>
</body>
</html>
|