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

#include "UnityPrefix.h"
#include "Configuration/UnityConfigure.h"
#include "Runtime/Mono/MonoExportUtility.h"
#include "Runtime/Camera/Camera.h"
#include "Runtime/Camera/ImageFilters.h"
#include "Runtime/Camera/Light.h"
#include "Runtime/Camera/Skybox.h"
#include "Runtime/Graphics/LightmapSettings.h"
#include "Runtime/Filters/Renderer.h"
#include "Runtime/Camera/IntermediateRenderer.h"
#include "Runtime/Graphics/GraphicsHelper.h"
#include "Runtime/Graphics/Transform.h"
#include "Runtime/Shaders/Material.h"
#include "Runtime/Filters/Misc/TextMesh.h"
#include "Runtime/Filters/Particles/EllipsoidParticleEmitter.h"
#include "Runtime/Filters/Particles/MeshParticleEmitter.h"
#include "Runtime/Shaders/Shader.h"
#include "External/shaderlab/Library/intshader.h"
#include "Runtime/Camera/Renderqueue.h"
#include "Runtime/Filters/Deformation/SkinnedMeshFilter.h"
#include "Runtime/Camera/Flare.h"
#include "Runtime/GfxDevice/GfxDevice.h"
#include "External/shaderlab/Library/texenv.h"
#include "External/shaderlab/Library/properties.h"
#include "Runtime/Geometry/Ray.h"
#include "Runtime/Graphics/Texture2D.h"
#include "Runtime/Graphics/CubemapTexture.h"
#include "Runtime/Graphics/Texture3D.h"
#include "Runtime/Graphics/SpriteFrame.h"
#include "Runtime/Video/VideoTexture.h"
#include "Runtime/Camera/Projector.h"
#include "Runtime/Camera/RenderLayers/GUITexture.h"
#include "Runtime/Camera/RenderLayers/GUIText.h"
#include "Runtime/Camera/RenderLayers/GUILayer.h"
#include "Runtime/Filters/Misc/LineRenderer.h"
#include "Runtime/Graphics/DrawUtil.h"
#include "Runtime/Math/Quaternion.h"
#include "Runtime/Filters/Mesh/LodMesh.h"
#include "Runtime/Filters/Mesh/LodMeshFilter.h"
#include "Runtime/Graphics/RenderTexture.h"
#include "Runtime/Graphics/MatrixStack.h"
#include "Runtime/Filters/Misc/TrailRenderer.h"
#include "Runtime/Camera/LODGroupManager.h"
#include "Runtime/Graphics/RenderBufferManager.h"
#include "Runtime/Camera/RenderManager.h"
#include "Runtime/Shaders/GraphicsCaps.h"
#include "Runtime/Graphics/ScreenManager.h"
#include "Runtime/Misc/ResourceManager.h"
#include "Runtime/Geometry/Plane.h"
#include "Runtime/Filters/Particles/ParticleAnimator.h"
#include "Runtime/Filters/Particles/ParticleRenderer.h"
#include "Runtime/Mono/MonoBehaviour.h"
#include "Runtime/Filters/AABBUtility.h"
#include <list>
#include <vector>
#include "Runtime/Misc/QualitySettings.h"
#include "Runtime/Filters/Misc/Font.h"
#include "Runtime/Camera/RenderSettings.h"
#include "Runtime/Geometry/Intersection.h"
#include "Runtime/Shaders/ShaderNameRegistry.h"
#include "Runtime/Shaders/ShaderKeywords.h"
#include "Runtime/Shaders/ComputeShader.h"
#include "Runtime/Geometry/TextureAtlas.h"
#include "Runtime/Misc/GameObjectUtility.h"
#include "Runtime/Camera/CameraUtil.h"
#include "Runtime/Misc/Player.h"
#include "Runtime/Graphics/ImageConversion.h"
#include "Runtime/Filters/Mesh/MeshCombiner.h"
#include "Runtime/Filters/Mesh/MeshOptimizer.h"
#include "Runtime/Misc/BuildSettings.h"
#include "Runtime/Camera/Culler.h"
#include "Runtime/Threads/Mutex.h"
#include "Runtime/Threads/AtomicRefCounter.h"
#include "Runtime/Camera/OcclusionArea.h"
#include "Runtime/Camera/OcclusionPortal.h"
#include "Runtime/Graphics/DrawSplashScreenAndWatermarks.h"
#include "Runtime/Scripting/ScriptingUtility.h"
#include "Runtime/Scripting/ScriptingManager.h"
#include "Runtime/Scripting/Backend/ScriptingTypeRegistry.h"
#include "Runtime/Scripting/ScriptingExportUtility.h"
#include "Runtime/Utilities/BitUtility.h"
#include "Runtime/Profiler/Profiler.h"
#include "Runtime/IMGUI/GUIStyle.h"
#include "Runtime/Scripting/Backend/ScriptingBackendApi.h"
#include "Runtime/Scripting/Scripting.h"
#include "Runtime/Scripting/ScriptingObjectWithIntPtrField.h"
#include "Runtime/Graphics/TriStripper.h"
#include "Runtime/Misc/GraphicsScriptingUtility.h"

#if ENABLE_TEXTUREID_MAP
	#include "Runtime/GfxDevice/TextureIdMap.h"
#endif


#if !GAMERELEASE
#include "Editor/Src/Gizmos/GizmoManager.h"
#include "Editor/Src/Gizmos/GizmoUtil.h"
#endif


// matrix stacks to be able to support GL style Push/Pop
static MatrixStack g_WorldMatrixStack;
static MatrixStack g_ViewMatrixStack;
static MatrixStack g_ProjectionMatrixStack;
//

C++RAW


class MonoMaterialPropertyBlock : public MaterialPropertyBlock {
public:
	MonoMaterialPropertyBlock() : m_Counter() { }

	void Retain()
	{
		m_Counter.Retain();
	}

	void Release()
	{
		if( m_Counter.Release() ) {
			delete this;
		}
	}

	static void CleanupMonoMaterialPropertyBlock(void* mmpb)
	{
		if (NULL != mmpb)
			((MonoMaterialPropertyBlock*)mmpb)->Release();
	}

private:
	AtomicRefCounter m_Counter;
};


extern PPtr<Shader> s_ScriptingCurrentShader;
extern const ChannelAssigns* s_ScriptingCurrentChannels;


CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;

namespace UnityEngine
{

// The type of a [[Light]].
ENUM LightType
	// The light is a spot light.
	Spot = 0,

	// The light is a directional light.
	Directional = 1,

	// The light is a point light.
	Point = 2,

	// The light is an area light. It affects only lightmaps and lightprobes.
	Area = 3
END

// How the [[Light]] is rendered.
ENUM LightRenderMode
	// Automatically choose the render mode.
	Auto = 0,
	// Force the [[Light]] to be a pixel light.
	ForcePixel = 1,
	// Force the [[Light]] to be a vertex light.
	ForceVertex = 2
END

// Shadow casting options for a [[Light]].
ENUM LightShadows
	// Do not cast shadows (default).
	None = 0,
	// Cast "hard" shadows (with no shadow filtering).
	Hard = 1,
	// Cast "soft" shadows (with 4x PCF filtering).
	Soft = 2,
END


// OcclusionArea is an area in which occlusion culling is performed
CLASS OcclusionArea : Component

	// Center of the occlusion area relative to the transform
	AUTO_PROP Vector3 center GetCenter SetCenter

	// Size that the occlusion area will have
	AUTO_PROP Vector3 size GetSize SetSize

END

//The portal for dynamically changing occlusion at runtime.
CLASS OcclusionPortal : Component
	//gets / sets the portal's open state
	CUSTOM_PROP bool open { return self->GetIsOpen(); } { self->SetIsOpen(value); }
END


// Fog mode to use.
ENUM FogMode
	// Linear fog.
	Linear = 1,

	// Exponential fog.
	Exponential = 2,

	// Exponential squared fog (default).
	ExponentialSquared = 3
END


// The Render Settings contain values for a range of visual elements in your scene, like fog and ambient light.
CLASS RenderSettings : Object
	// Is fog enabled?
	CUSTOM_PROP static bool  fog           { return GetRenderSettings().GetUseFog();  }    { return GetRenderSettings().SetUseFog(value);  }

	// Fog mode to use.
	CUSTOM_PROP static FogMode fogMode     { return GetRenderSettings().GetFogMode();  }    { return GetRenderSettings().SetFogMode(value); }

	// The color of the fog.
	CUSTOM_PROP static Color fogColor      { return GetRenderSettings().GetFogColor(); }   { GetRenderSettings().SetFogColor(value); }

	// The density of the exponential fog.
	CUSTOM_PROP static float fogDensity    { return GetRenderSettings().GetFogDensity(); } { GetRenderSettings().SetFogDensity(value); }


	// The starting distance of linear fog.
	CUSTOM_PROP static float fogStartDistance { return GetRenderSettings().GetLinearFogStart(); } { GetRenderSettings().SetLinearFogStart(value); }

	// The ending distance of linear fog.
	CUSTOM_PROP static float fogEndDistance { return GetRenderSettings().GetLinearFogEnd(); } { GetRenderSettings().SetLinearFogEnd(value); }


	// Color of the scene's ambient light.
	CUSTOM_PROP static Color ambientLight  { return GetRenderSettings().GetAmbientLight(); }    { GetRenderSettings().SetAmbientLight(value); }

	// Size of the [[Light]] halos.
	CUSTOM_PROP static float haloStrength  { return GetRenderSettings().GetHaloStrength(); }  { GetRenderSettings().SetHaloStrength(value); }

	// The intensity of all flares in the scene.
	CUSTOM_PROP static float flareStrength { return GetRenderSettings().GetFlareStrength(); } { GetRenderSettings().SetFlareStrength(value); }

	// The fade speed of all flares in the scene.
	CUSTOM_PROP static float flareFadeSpeed { return GetRenderSettings().GetFlareFadeSpeed(); } { GetRenderSettings().SetFlareFadeSpeed(value); }

	// The global skybox to use.
	CUSTOM_PROP static Material skybox { return Scripting::ScriptingWrapperFor(GetRenderSettings().GetSkyboxMaterial()); } { GetRenderSettings().SetSkyboxMaterial(value); }
END

OBSOLETE warning See QualitySettings.names, QualitySettings.SetQualityLevel, and QualitySettings.GetQualityLevel
ENUM QualityLevel
	// The "fastest" quality level.
	Fastest = 0,
	// The "fast" quality level.
	Fast = 1,
	// The "simple" quality level.
	Simple = 2,
	// The "good" quality level.
	Good = 3,
	// The "beautiful" quality level.
	Beautiful = 4,
	// The "fantastic" quality level.
	Fantastic = 5,
END

// Shadow projection type for [[wiki:class-QualitySettings|Quality Settings]].
ENUM ShadowProjection
	// Close fit shadow maps with linear fadeout.
	CloseFit = 0,

	// Stable shadow maps with spherical fadeout.
	StableFit = 1,
END


// Script interface for [[wiki:class-QualitySettings|Quality Settings]].
CLASS QualitySettings : Object
	// The indexed list of available Quality Settings
	CONDITIONAL ENABLE_MONO || UNITY_WINRT
	CUSTOM_PROP static string[] names
	{
		return Scripting::StringVectorToMono(GetQualitySettings().GetQualitySettingsNames ());
	}

	// Returns the current graphics quality level.
	CUSTOM static int GetQualityLevel ()
	{
		return GetQualitySettings().GetCurrentIndex();
	}

	// Sets a new graphics quality level.
	CUSTOM static void SetQualityLevel (int index, bool applyExpensiveChanges = true)
	{
		GetQualitySettings().SetCurrentIndex (index, applyExpensiveChanges);
	}

	OBSOLETE warning Use GetQualityLevel and SetQualityLevel
	CUSTOM_PROP static QualityLevel currentLevel { return GetQualitySettings().GetCurrentIndex(); } { GetQualitySettings().SetCurrentIndex( value, true ); }

	// Increase the current quality level.
	CUSTOM static void IncreaseLevel(bool applyExpensiveChanges = false)
	{
		QualitySettings& q = GetQualitySettings();
		q.SetCurrentIndex( q.GetCurrentIndex() + 1, applyExpensiveChanges ); // will clamp internally
	}

	// Decrease the current quality level.
	CUSTOM static void DecreaseLevel(bool applyExpensiveChanges = false)
	{
		QualitySettings& q = GetQualitySettings();
		q.SetCurrentIndex( q.GetCurrentIndex() - 1, applyExpensiveChanges ); // will clamp internally
	}

	// The maximum number of pixel lights that should affect any object.
	CUSTOM_PROP static int pixelLightCount { return GetQualitySettings().GetCurrent().pixelLightCount; } { GetQualitySettings().SetPixelLightCount(value); }

	// Directional light shadow projection.
	CUSTOM_PROP static ShadowProjection shadowProjection { return (ShadowProjection)GetQualitySettings().GetCurrent().shadowProjection; } { GetQualitySettings().SetShadowProjection((ShadowProjection)value); }

	// Number of cascades to use for directional light shadows.
	CUSTOM_PROP static int shadowCascades { return GetQualitySettings().GetCurrent().shadowCascades; } { GetQualitySettings().SetShadowCascades(value); }

	// Shadow drawing distance.
	CUSTOM_PROP static float shadowDistance { return GetQualitySettings().GetCurrent().shadowDistance; } { GetQualitySettings().SetShadowDistance(value); }


	// A texture size limit applied to all textures.
	CUSTOM_PROP static int masterTextureLimit { return GetQualitySettings().GetCurrent().textureQuality; } { GetQualitySettings().SetMasterTextureLimit(value); }

	// Global anisotropic filtering mode.
	CUSTOM_PROP static AnisotropicFiltering anisotropicFiltering { return GetQualitySettings().GetCurrent().anisotropicTextures; } { GetQualitySettings().SetAnisotropicTextures(value); }

	// Global multiplier for the LOD's switching distance.
	CUSTOM_PROP static float lodBias { return GetQualitySettings().GetCurrent().lodBias; } { GetQualitySettings().SetLODBias (value); }

	// A maximum LOD level. All LOD groups
	CUSTOM_PROP static int maximumLODLevel { return GetQualitySettings().GetCurrent().maximumLODLevel; } { GetQualitySettings().SetMaximumLODLevel (value); }

	// Budget for how many ray casts can be performed per frame for approximate collision testing.
	CUSTOM_PROP static int particleRaycastBudget { return GetQualitySettings().GetCurrent().particleRaycastBudget; } { GetQualitySettings().SetParticleRaycastBudget (value); }

	// Use a two-pass shader for the vegetation in the terrain engine.
	CUSTOM_PROP static bool softVegetation { return GetQualitySettings().GetCurrent().softVegetation; } { GetQualitySettings().SetSoftVegetation (value); }


	// Maximum number of frames queued up by graphics driver.
	CUSTOM_PROP static int maxQueuedFrames { return GetGfxDevice().GetMaxBufferedFrames(); } { GetGfxDevice().SetMaxBufferedFrames (clamp(value, -1, 10)); }

	// The VSync Count.
	CUSTOM_PROP static int vSyncCount { return GetQualitySettings().GetCurrent().vSyncCount; } { GetQualitySettings().SetVSyncCount(value); }

	// Set The AA Filtering option.
	CUSTOM_PROP static int antiAliasing { return GetQualitySettings().GetCurrent().antiAliasing; } { GetQualitySettings().SetAntiAliasing(value); }

	// Desired color space
	CUSTOM_PROP static ColorSpace desiredColorSpace { return GetPlayerSettings().GetDesiredColorSpace (); }

	// Active color space
	CUSTOM_PROP static ColorSpace activeColorSpace { return GetPlayerSettings().GetValidatedColorSpace (); }

	// Blend weights.
	CUSTOM_PROP static BlendWeights blendWeights { return GetQualitySettings().GetCurrent().blendWeights; } { GetQualitySettings().SetBlendWeights(value); }
END



// Values for Camera.clearFlags, determining what to clear when rendering a [[Camera]].
ENUM CameraClearFlags
	// Clear with the skybox.
	Skybox = 1,

	OBSOLETE planned Use CameraClearFlags.SolidColor
	Color = 2,

	// Clear with a background color.
	SolidColor = 2,

	// Clear only the depth buffer.
	Depth = 3,

	// Don't clear anything.
	Nothing = 4
END


// Depth texture generation mode for [[Camera]].
CSRAW [Flags]
ENUM DepthTextureMode
	// Do not generate depth texture (Default).
	None = 0,

	// Generate a depth texture.
	Depth = 1,

	// Generate a depth + normals texture.
	DepthNormals = 2,
END

//*undocumented*
ENUM TexGenMode
	// the texture gets its coordinates from UV
	None  = 0,
	// The texture uses spherical reflection mappping
	SphereMap = 1,
	// The texture is applied in object space
	Object = 2,
	// Projected Eye space
	EyeLinear = 3,
	// Cubemap reflection calculation
	CubeReflect = 4,
	// Cubemap normal calculation
	CubeNormal = 5
END



// Anisotropic filtering mode.
ENUM AnisotropicFiltering
	// Disable anisotropic filtering for all textures.
	Disable = 0,
	// Enable anisotropic filtering, as set for each texture.
	Enable = 1,
	// Enable anisotropic filtering for all textures.
	ForceEnable = 2
END

// Blend weights.
ENUM BlendWeights
	// One bone affects each vertex.
	OneBone = 1,
	// Two bones affect each vertex.
	TwoBones = 2,
	// Four bones affect each vertex.
	FourBones = 4
END


CONDITIONAL UNITY_EDITOR
// Compression Quality. Corresponds to the settings in a [[wiki:class-Texture2D|texture inspector]].
ENUM TextureCompressionQuality
	// Fast compression
	Fast = 0,
	// Normal compression (default)
	Normal = 50,
	// Best compression
	Best = 100
END



// A class to access the [[Mesh]] of the [[wiki:class-MeshFilter|mesh filter]].
CLASS MeshFilter : Component

	// Returns the instantiated [[Mesh]] assigned to the mesh filter.
	AUTO_PTR_PROP Mesh mesh GetInstantiatedMesh SetInstantiatedMesh

	// Returns the shared mesh of the mesh filter.
	AUTO_PTR_PROP Mesh sharedMesh GetSharedMesh SetSharedMesh
END


// Struct used to describe meshes to be combined using Mesh.CombineMeshes.
STRUCT CombineInstance

	// [[Mesh]] to combine
	CSRAW public Mesh mesh { get { return InternalGetMesh(m_MeshInstanceID); } set { m_MeshInstanceID = value != null ? value.GetInstanceID() : 0; } }

	// Submesh index of the mesh
	CSRAW public int subMeshIndex { get { return m_SubMeshIndex; } set { m_SubMeshIndex = value; } }

	// Matrix to transform the mesh with before combining
	CSRAW public Matrix4x4 transform { get { return m_Transform; } set { m_Transform = value; } }

	CSRAW private int m_MeshInstanceID;
	CUSTOM private Mesh InternalGetMesh(int instanceID)
	{
		if(instanceID == 0)
			return SCRIPTING_NULL;
		return Scripting::ScriptingWrapperFor(PPtr<Mesh>(instanceID));
	}

	CSRAW private int m_SubMeshIndex;
	CSRAW private Matrix4x4 m_Transform;
END

C++RAW

struct MonoCombineInstance
{
	int meshInstanceID;
	int subMeshIndex;
	Matrix4x4f transform;
};

// Topology of [[Mesh]] faces.
ENUM MeshTopology

	// Mesh is made from triangles.
	Triangles = 0,

	// Mesh is made from quads.
	Quads = 2,

	// Mesh is made from lines.
	Lines = 3,

	// Mesh is a line strip.
	LineStrip = 4,

	// Mesh is made from points.
	Points = 5,
END


// A class that allows creating or modifying meshes from scripts.

CLASS Mesh : Object

	// Creates an empty mesh
	CSRAW public Mesh ()
	{
		Internal_Create(this);
	}

	CUSTOM private static void Internal_Create ([Writable]Mesh mono)
	{
		Mesh* mesh = NEW_OBJECT_MAIN_THREAD (Mesh);
		mesh->Reset();
		Scripting::ConnectScriptingWrapperToObject (mono.GetScriptingObject(), mesh);
		mesh->AwakeFromLoad(kInstantiateOrCreateFromCodeAwakeFromLoad);
	}

	// Clears all vertex data and all triangle indices.
	CUSTOM void Clear (bool keepVertexLayout = true)
	{
		self->Clear (keepVertexLayout);
	}

	// Returns state of the Read/Write Enabled checkbox when model was imported.
	AUTO_PROP bool isReadable GetIsReadable

	// Works like isReadable, except it also returns true in editor outside the game loop.
	CUSTOM_PROP internal bool canAccess { return self->CanAccessFromScript(); }

	// Returns a copy of the vertex positions or assigns a new vertex positions array.
	CUSTOM_PROP Vector3[] vertices
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().vector3;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelVertex))
				return CreateScriptingArrayStride<Vector3f>(self->GetChannelPointer(kShaderChannelVertex), self->GetVertexCount(), klass, self->GetStride(kShaderChannelVertex));
		}
		else
			ErrorStringMsg("Not allowed to access vertices on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
			self->SetVertices (Scripting::GetScriptingArrayStart<Vector3f>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access vertices on mesh '%s'", self->GetName());
	}

	// The normals of the mesh.
	CUSTOM_PROP Vector3[] normals
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().vector3;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelNormal))
				return CreateScriptingArrayStride<Vector3f>(self->GetChannelPointer(kShaderChannelNormal), self->GetVertexCount(), klass, self->GetStride(kShaderChannelNormal));
		}
		else
			ErrorStringMsg("Not allowed to access normals on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
		self->SetNormals (Scripting::GetScriptingArrayStart<Vector3f>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access normals on mesh '%s'", self->GetName());
	}

	// The tangents of the mesh.
	CUSTOM_PROP Vector4[] tangents
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().vector4;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelTangent))
				return CreateScriptingArrayStride<Vector4f>(self->GetChannelPointer(kShaderChannelTangent), self->GetVertexCount(), klass, self->GetStride(kShaderChannelTangent));
		}
		else
			ErrorStringMsg("Not allowed to access tangents on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
		self->SetTangents (Scripting::GetScriptingArrayStart<Vector4f>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access tangents on mesh '%s'", self->GetName());
	}

	// The base texture coordinates of the mesh.
	CUSTOM_PROP Vector2[] uv
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().vector2;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelTexCoord0))
				return CreateScriptingArrayStride<Vector2f>(self->GetChannelPointer(kShaderChannelTexCoord0), self->GetVertexCount(), klass, self->GetStride(kShaderChannelTexCoord0));
		}
		else
			ErrorStringMsg("Not allowed to access uv on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
			self->SetUv (0, Scripting::GetScriptingArrayStart<Vector2f>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access uv on mesh '%s'", self->GetName());
	}

	// The second texture coordinate set of the mesh, if present.
	CUSTOM_PROP Vector2[] uv2
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().vector2;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelTexCoord1))
				return CreateScriptingArrayStride<Vector2f>(self->GetChannelPointer(kShaderChannelTexCoord1), self->GetVertexCount(), klass, self->GetStride(kShaderChannelTexCoord1));
		}
		else
			ErrorStringMsg("Not allowed to access uv2 on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
			self->SetUv (1, Scripting::GetScriptingArrayStart<Vector2f>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access uv2 on mesh '%s'", self->GetName());
	}

	OBSOLETE planned Use uv2 instead
	CSRAW public Vector2[] uv1 { get { return uv2; } set { uv2 = value; } }

	// The bounding volume of the mesh.
	AUTO_PROP Bounds bounds GetBounds SetBounds


	// Vertex colors of the mesh.
	CUSTOM_PROP Color[] colors
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().color;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelColor))
			{
				ScriptingArrayPtr array = CreateScriptingArray<ColorRGBAf>(klass, self->GetVertexCount());
				self->ExtractColorArrayConverting (Scripting::GetScriptingArrayStart<ColorRGBAf>(array));
				return array;
			}
		}
		else
			ErrorStringMsg("Not allowed to access colors on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
			self->SetColorsConverting (Scripting::GetScriptingArrayStart<ColorRGBAf>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access colors on mesh '%s'", self->GetName());
	}

	// Vertex colors of the mesh.
	CUSTOM_PROP Color32[] colors32
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().color32;
		if (self->CanAccessFromScript())
		{
			if (self->IsAvailable(kShaderChannelColor))
			{
				ScriptingArrayPtr array = CreateScriptingArray<ColorRGBA32>(klass, self->GetVertexCount());
				self->ExtractColorArray (Scripting::GetScriptingArrayStart<ColorRGBA32>(array));
				return array;
			}
		}
		else
			ErrorStringMsg("Not allowed to access colors on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
			self->SetColors (Scripting::GetScriptingArrayStart<ColorRGBA32>(value), GetScriptingArraySize(value));
		else
			ErrorStringMsg("Not allowed to access colors on mesh '%s'", self->GetName());
	}

	// Recalculate the bounding volume of the mesh from the vertices.
	CUSTOM void RecalculateBounds ()
	{
		if (self->CanAccessFromScript())
			self->RecalculateBounds();
		else
			ErrorStringMsg("Not allowed to call RecalculateBounds() on mesh '%s'", self->GetName());
	}

	// Recalculates the normals of the mesh from the triangles and vertices.
	CUSTOM void RecalculateNormals ()
	{
		if (self->CanAccessFromScript())
			self->RecalculateNormals();
		else
			ErrorStringMsg("Not allowed to call RecalculateNormals() on mesh '%s'", self->GetName());
	}


	// Optimizes the mesh for display.
	CUSTOM void Optimize ()
	{
	}

	// An array containing all triangles in the mesh.
	//
	// If the mesh contains multiple sub meshes (materials) the triangle list will contain all triangles of all submeshes.
	CUSTOM_PROP int[] triangles
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().int_32;
		if (self->CanAccessFromScript())
		{
			Mesh::TemporaryIndexContainer triangles;
			self->GetTriangles(triangles);
			return CreateScriptingArray(&triangles[0], triangles.size(), klass);
		}
		else
			ErrorStringMsg("Not allowed to access triangles on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}
	{
		if (self->CanAccessFromScript())
		{
			self->SetSubMeshCount(1);
			self->SetIndices (Scripting::GetScriptingArrayStart<UInt32>(value), GetScriptingArraySize(value), 0, kPrimitiveTriangles);
		}
		else
			ErrorStringMsg("Not allowed to access triangles on mesh '%s'", self->GetName());
	}


	// Returns the triangle list for the submesh.
	CUSTOM int[] GetTriangles (int submesh)
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().int_32;
		if (self->CanAccessFromScript())
		{
			Mesh::TemporaryIndexContainer triangles;
			self->GetTriangles(triangles, submesh);
			return CreateScriptingArray(&triangles[0], triangles.size(), klass);
		}
		else
			ErrorStringMsg("Not allowed to call GetTriangles() on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}

	// Sets the triangle list for the submesh.
	CUSTOM void SetTriangles(int[] triangles, int submesh)
	{
		if (self->CanAccessFromScript())
		{
			self->SetIndices(Scripting::GetScriptingArrayStart<UInt32>(triangles), GetScriptingArraySize(triangles), submesh, kPrimitiveTriangles);
		}
		else
			ErrorStringMsg("Not allowed to call SetTriangles() on mesh '%s'", self->GetName());
	}


	// Returns the index buffer for the submesh.
	CUSTOM int[] GetIndices (int submesh)
	{
		ScriptingClassPtr klass = GetScriptingManager().GetCommonClasses().int_32;
		if (self->CanAccessFromScript())
		{
			Mesh::TemporaryIndexContainer indices;
			self->GetIndices (indices, submesh);
			return CreateScriptingArray(&indices[0], indices.size(), klass);
		}
		else
			ErrorStringMsg("Not allowed to call GetIndices() on mesh '%s'", self->GetName());

		return CreateEmptyStructArray(klass);
	}

	// Sets the index buffer for the submesh.
	CUSTOM void SetIndices (int[] indices, MeshTopology topology, int submesh)
	{
		if (self->CanAccessFromScript())
		{
			self->SetIndices(Scripting::GetScriptingArrayStart<UInt32>(indices), GetScriptingArraySize(indices), submesh, topology);
		}
		else
			ErrorStringMsg("Not allowed to call SetIndices() on mesh '%s'", self->GetName());
	}

	// Gets the topology of a submesh.
	CUSTOM MeshTopology GetTopology (int submesh)
	{
		if ((unsigned)submesh >= self->GetSubMeshCount())
		{
			ErrorString("Failed getting topology. Submesh index is out of bounds.");
			return kPrimitiveTriangles;
		}
		return self->GetSubMeshFast(submesh).topology;
	}

	// Returns the number of vertices in the mesh (RO).
	AUTO_PROP int vertexCount GetVertexCount

	// The number of submeshes. Every material has a separate triangle list.
	CUSTOM_PROP int subMeshCount
	{
		return self->GetSubMeshCount();
	}
	{
		if(value < 0)
		{
			ErrorString ("subMeshCount can't be set to negative value");
			return;
		}
		self->SetSubMeshCount(value);
	}

	//*undocumented* Internal api not really generally useful
	OBSOLETE warning Use SetTriangles instead. Internally this function will convert the triangle strip to a list of triangles anyway.
	CUSTOM void SetTriangleStrip (int[] triangles, int submesh)
	{
		UInt32* triStrip = Scripting::GetScriptingArrayStart<UInt32>(triangles);
		UNITY_TEMP_VECTOR(UInt32) newTriangles;
		Destripify(triStrip, GetScriptingArraySize(triangles), newTriangles);
		self->SetIndices (&newTriangles[0], newTriangles.size(), submesh, kPrimitiveTriangles);
	}

	//*undocumented* Internal api not really generally useful
	OBSOLETE warning Use GetTriangles instead. Internally this function converts a list of triangles to a strip, so it might be slow, it might be a mess.
	CUSTOM int[] GetTriangleStrip (int submesh)
	{
		Mesh::TemporaryIndexContainer triangles;
		self->GetTriangles(triangles, submesh);

		UNITY_TEMP_VECTOR(UInt32) strip;
		Stripify(&triangles[0], triangles.size(), strip);

		return CreateScriptingArray(&strip[0], strip.size(), GetScriptingManager().GetCommonClasses().int_32);
	}

	// Combines several meshes into this mesh.
	CUSTOM void CombineMeshes(CombineInstance[] combine, bool mergeSubMeshes = true, bool useMatrices = true)
	{
		CombineInstances combineVec;
		combineVec.resize(GetScriptingArraySize(combine));
		MonoCombineInstance* mono = Scripting::GetScriptingArrayStart<MonoCombineInstance>(combine);
		for (int i=0;i<combineVec.size();i++)
		{
			combineVec[i].transform = mono[i].transform;
			combineVec[i].subMeshIndex = mono[i].subMeshIndex;
			combineVec[i].mesh = PPtr<Mesh>(mono[i].meshInstanceID);
		}
		CombineMeshes(combineVec, *self, mergeSubMeshes, useMatrices);
	}


	// The bone weights of each vertex
	CUSTOM_PROP BoneWeight[] boneWeights
	{
		int size = self->GetVertexCount();
		BoneInfluence* weights = self->GetBoneWeights();
		return CreateScriptingArray(weights, size, MONO_COMMON.boneWeight);
	}
	{
		self->SetBoneWeights(Scripting::GetScriptingArrayStart<BoneInfluence> (value), GetScriptingArraySize(value));
	}

	// The bind poses. The bind pose at each index refers to the bone with the same index.
	CUSTOM_PROP Matrix4x4[] bindposes
	{
		return CreateScriptingArray(self->GetBindposes(), self->GetBindposeCount(), MONO_COMMON.matrix4x4);
	}
	{
		self->SetBindposes(Scripting::GetScriptingArrayStart<Matrix4x4f> (value), GetScriptingArraySize(value));
	}

	// Optimize mesh for frequent updates.
	CUSTOM void MarkDynamic ()
	{
		if (self->CanAccessFromScript())
			self->MarkDynamic();
	}

	CUSTOM void UploadMeshData(bool markNoLogerReadable)
	{
		if (self->CanAccessFromScript())
			self->UploadMeshData(markNoLogerReadable);
	}

	// Returns BlendShape count on this mesh.
	CUSTOM_PROP int blendShapeCount
	{
		return self->GetBlendShapeChannelCount();
	}

	// Returns name of BlendShape by given index.
	CUSTOM string GetBlendShapeName (int index)
	{
		return scripting_string_new(GetChannelName (self->GetBlendShapeData(), index));
	}

	// Calculates the index of the blendShape name
	CUSTOM int GetBlendShapeIndex(string blendShapeName)
	{
		return GetChannelIndex (self->GetBlendShapeData(), blendShapeName.AsUTF8().c_str());
	}

END

// Skinning bone weights of a vertex in the mesh.
STRUCT BoneWeight
	CSRAW private float m_Weight0;
	CSRAW private float m_Weight1;
	CSRAW private float m_Weight2;
	CSRAW private float m_Weight3;

	CSRAW private int m_BoneIndex0;
	CSRAW private int m_BoneIndex1;
	CSRAW private int m_BoneIndex2;
	CSRAW private int m_BoneIndex3;

	// Skinning weight for first bone.
	CSRAW public float weight0 { get { return m_Weight0; } set { m_Weight0 = value; } }
	// Skinning weight for second bone.
	CSRAW public float weight1 { get { return m_Weight1; } set { m_Weight1 = value; } }
	// Skinning weight for third bone.
	CSRAW public float weight2 { get { return m_Weight2; } set { m_Weight2 = value; } }
	// Skinning weight for fourth bone.
	CSRAW public float weight3 { get { return m_Weight3; } set { m_Weight3 = value; } }

	// Index of first bone.
	CSRAW public int boneIndex0 { get { return m_BoneIndex0; } set { m_BoneIndex0 = value; } }
	// Index of second bone.
	CSRAW public int boneIndex1 { get { return m_BoneIndex1; } set { m_BoneIndex1 = value; } }
	// Index of third bone.
	CSRAW public int boneIndex2 { get { return m_BoneIndex2; } set { m_BoneIndex2 = value; } }
	// Index of fourth bone.
	CSRAW public int boneIndex3 { get { return m_BoneIndex3; } set { m_BoneIndex3 = value; } }

	// used to allow BoneWeights to be used as keys in hash tables
	public override int GetHashCode() {
		return boneIndex0.GetHashCode() ^ (boneIndex1.GetHashCode()<<2) ^ (boneIndex2.GetHashCode()>>2) ^ (boneIndex3.GetHashCode()>>1)
			^ (weight0.GetHashCode() << 5) ^ (weight1.GetHashCode()<<4) ^ (weight2.GetHashCode()>>4) ^ (weight3.GetHashCode()>>3);
	}

	// also required for being able to use BoneWeights as keys in hash tables
	public override bool Equals(object other) {
		if(!(other is BoneWeight)) return false;

		BoneWeight rhs=(BoneWeight)other;
		return boneIndex0.Equals(rhs.boneIndex0)
			&& boneIndex1.Equals(rhs.boneIndex1)
			&& boneIndex2.Equals(rhs.boneIndex2)
			&& boneIndex3.Equals(rhs.boneIndex3)
			&& (new Vector4(weight0,weight1,weight2,weight3)).Equals(new Vector4(rhs.weight0,rhs.weight1,rhs.weight2,rhs.weight3));
	}

	//*undoc*
	CSRAW public static bool operator == (BoneWeight lhs, BoneWeight rhs)
	{
		return lhs.boneIndex0 == rhs.boneIndex0
			&& lhs.boneIndex1 == rhs.boneIndex1
			&& lhs.boneIndex2 == rhs.boneIndex2
			&& lhs.boneIndex3 == rhs.boneIndex3
			&& (new Vector4( lhs.weight0, lhs.weight1, lhs.weight2, lhs.weight3 )
				== new Vector4( rhs.weight0, rhs.weight1, rhs.weight2, rhs.weight3 ));
	}

	//*undoc*
	CSRAW public static bool operator != (BoneWeight lhs, BoneWeight rhs)
	{
		return !(lhs == rhs);
	}
END

/// The maximum number of bones affecting a single vertex
ENUM SkinQuality
	// Chooses the number of bones from the number current [[QualitySettings]] (Default)
	Auto = 0,
	// Use only 1 bone to deform a single vertex. (The most important bone will be used)
	Bone1 = 1,
	// Use 2 bones to deform a single vertex. (The most important bones will be used)
	Bone2 = 2,
	// Use 4 bones to deform a single vertex.
	Bone4 = 4
END

// The Skinned Mesh filter
NONSEALED_CLASS SkinnedMeshRenderer : Renderer

	// The bones used to skin the mesh.
	CUSTOM_PROP Transform[] bones
	{
		return CreateScriptingArrayFromUnityObjects(self->GetBones(), ClassID(Transform));
	}
	{
		dynamic_array<PPtr<Transform> > transforms;
		if (value != SCRIPTING_NULL)
		{
			int size = GetScriptingArraySize(value);
			transforms.resize_uninitialized(size);

			for (int i=0;i<size;i++)
			{
				int instanceID = Scripting::GetInstanceIDFromScriptingWrapper(Scripting::GetScriptingArrayElementNoRef<ScriptingObjectPtr>(value, i));
				transforms[i] = PPtr<Transform> (instanceID);
			}
		}

		self->SetBones(transforms);
	}

	AUTO_PTR_PROP Transform rootBone GetRootBone SetRootBone

	// The maximum number of bones affecting a single vertex
	AUTO_PROP SkinQuality quality GetQuality SetQuality

	// The mesh used for skinning
	AUTO_PTR_PROP Mesh sharedMesh GetMesh SetMesh

	OBSOLETE warning Has no effect.
	CSRAW public bool skinNormals  { get { return true; } set {} }

	// If enabled, the Skinned Mesh will be updated when offscreen. If disabled, this also disables updating animations.
	AUTO_PROP bool updateWhenOffscreen GetUpdateWhenOffscreen SetUpdateWhenOffscreen

	// AABB of this Skinned Mesh in its local space.
	CUSTOM_PROP Bounds localBounds
	{
		AABB result;
		self->GetSkinnedMeshLocalAABB(result);
		return result;
	}
	{
		self->SetLocalAABB(value);
	}

	// Creates a snapshot of SkinnedMeshRenderer and stores it in mesh.
	CUSTOM void BakeMesh (Mesh mesh)
	{
		self->BakeMesh(*mesh);
	}

	CONDITIONAL UNITY_EDITOR
	CUSTOM_PROP internal Transform actualRootBone { return Scripting::ScriptingWrapperFor(&self->GetActualRootBone()); }

	// Returns weight of BlendShape on this renderer.
	CUSTOM float GetBlendShapeWeight(int index) { return self->GetBlendShapeWeight(index); }

	// Sets weight of BlendShape on this renderer.
	CUSTOM void SetBlendShapeWeight(int index, float value) { self->SetBlendShapeWeight(index, value); }

END


// A flare asset. Read more about flares in the [[wiki:class-Flare|components reference]].
CLASS Flare : Object

END


// Script interface for a [[wiki:class-LensFlare|Lens flare component]].
CLASS LensFlare : Behaviour
	// The [[wiki:class-Flare|flare asset]] to use.
	AUTO_PTR_PROP Flare flare GetFlare SetFlare

	// The strength of the flare.
	AUTO_PROP float brightness GetBrightness SetBrightness

	// The fade speed of the flare.
	AUTO_PROP float fadeSpeed GetFadeSpeed SetFadeSpeed

	// The color of the flare.
	AUTO_PROP Color color GetColor SetColor
END


// General functionality for all renderers.
NONSEALED_CLASS Renderer : Component

	CUSTOM_PROP internal Transform staticBatchRootTransform { return Scripting::ScriptingWrapperFor (self->GetStaticBatchRoot ()); } { self->SetStaticBatchRoot (value); }

	CUSTOM_PROP internal int staticBatchIndex { return self->GetStaticBatchIndex(); }

	CUSTOM internal void SetSubsetIndex (int index, int subSetIndexForMaterial)
	{
		self->SetMaterialCount (std::max(index+1, self->GetMaterialCount()));
		self->SetSubsetIndex(index, subSetIndexForMaterial);
	}

	// Has this renderer been statically batched with any other renderers?
	CUSTOM_PROP bool isPartOfStaticBatch { return self->GetStaticBatchIndex() != 0; }

	// Matrix that transforms a point from world space into local space (RO).
	AUTO_PROP Matrix4x4 worldToLocalMatrix GetWorldToLocalMatrix
	// Matrix that transforms a point from local space into world space (RO).
	AUTO_PROP Matrix4x4 localToWorldMatrix GetLocalToWorldMatrix


	// Makes the rendered 3D object visible if enabled.
	AUTO_PROP bool enabled GetEnabled SetEnabled


	// Does this object cast shadows?
	AUTO_PROP bool castShadows GetCastShadows SetCastShadows


	// Does this object receive shadows?
	AUTO_PROP bool receiveShadows GetReceiveShadows SetReceiveShadows


	// The material of this object.

	CUSTOM_PROP Material material
	{
		return Scripting::ScriptingWrapperFor (self->GetAndAssignInstantiatedMaterial (0, false));
	}
	{
		self->SetMaterialCount (std::max(1, self->GetMaterialCount()));
		self->SetMaterial (value, 0);
	}


	// The shared material of this object.
	CUSTOM_PROP Material sharedMaterial
	{
		if (self->GetMaterialCount ())
			return Scripting::ScriptingWrapperFor (self->GetMaterial (0));
		else
			return Scripting::ScriptingObjectNULL (ScriptingClassFor (Material));
	}
	{
		self->SetMaterialCount (std::max(1, self->GetMaterialCount()));
		self->SetMaterial (value, 0);
	}


	// All the shared materials of this object.
	CUSTOM_PROP Material[] sharedMaterials
	{
		return CreateScriptingArrayFromUnityObjects(self->GetMaterialArray(), ClassID(Material));
	}
	{
#if ENABLE_MONO
		if (value == SCRIPTING_NULL)
			Scripting::RaiseNullException("material array is null");
#endif

		int size = GetScriptingArraySize(value);
		self->SetMaterialCount (size);
		for (int i=0;i<size;i++)
			self->SetMaterial (ScriptingObjectToObject<Material> (Scripting::GetScriptingArrayElementNoRef<ScriptingObjectPtr>(value, i)), i);
	}

	// All the materials of this object.
	CUSTOM_PROP Material[] materials
	{
		int length = self->GetMaterialCount();
		ScriptingArrayPtr array = CreateScriptingArray<ScriptingObjectPtr> (ScriptingClassFor(Material), length);

		for (int i=0;i<length;i++)
		{
			Material* instantiated = self->GetAndAssignInstantiatedMaterial(i, false);
			Scripting::SetScriptingArrayElement<ScriptingObjectPtr>(array,i,Scripting::ScriptingWrapperFor(instantiated));
		}

		return array;
	}
	{
		if (value == SCRIPTING_NULL)
			Scripting::RaiseNullException("material array is null");

		int size = GetScriptingArraySize(value);
		self->SetMaterialCount (size);
		for (int i=0;i<size;i++)
		{
			ScriptingObjectPtr o = Scripting::GetScriptingArrayElementNoRef<ScriptingObjectPtr>(value,i);
			self->SetMaterial (ScriptingObjectToObject<Material> (o), i);
		}
	}

	// The bounding volume of the renderer (RO).
	CUSTOM_PROP Bounds bounds { return CalculateWorldAABB (self->GetGameObject ()); }

	// The index of the lightmap applied to this renderer.
	CUSTOM_PROP int lightmapIndex { return self->GetLightmapIndexInt(); } { return self->SetLightmapIndexInt(value); }

	// The tiling & offset used for lightmap.
	CUSTOM_PROP Vector4 lightmapTilingOffset
	{
		Vector4f st = self->GetLightmapST();
		return Vector4f(st.x, st.y, st.z, st.w);
	}
	{
		Vector4f st( value.x, value.y, value.z, value.w );
		self->SetLightmapST( st );
	}

	// ''OnBecameVisible'' is called when the object became visible by any camera.
	CSNONE void OnBecameVisible();


	// ''OnBecameInvisible'' is called when the object is no longer visible by any camera.
	CSNONE void OnBecameInvisible();

	// Is this renderer visible in any camera? (RO)
	AUTO_PROP bool isVisible IsVisibleInScene

	// If enabled and baked light probes are present in the scene, an interpolated light probe
	AUTO_PROP bool useLightProbes GetUseLightProbes SetUseLightProbes

	// If set, Renderer will use this Transform's position to find the interpolated light probe;
	AUTO_PTR_PROP Transform lightProbeAnchor GetLightProbeAnchor SetLightProbeAnchor

	// Lets you add per-renderer material parameters without duplicating a material.
	CUSTOM void SetPropertyBlock (MaterialPropertyBlock properties)
	{
		if (properties.GetPtr())
			self->SetPropertyBlock (*properties);
		else
			self->ClearPropertyBlock ();
	}

	CUSTOM void GetPropertyBlock (MaterialPropertyBlock dest)
	{
		if (!dest.GetPtr())
			Scripting::RaiseNullException("dest property block is null");
		self->GetPropertyBlock (*dest);
	}


	CUSTOM_PROP string sortingLayerName
	{
		DISALLOW_IN_CONSTRUCTOR
		return scripting_string_new(self->GetSortingLayerName());
	}
	{
		DISALLOW_IN_CONSTRUCTOR 
		self->SetSortingLayerName(value);
	}
	AUTO_PROP int sortingLayerID GetSortingLayerUserID SetSortingLayerUserID
	AUTO_PROP int sortingOrder GetSortingOrder SetSortingOrder


	OBSOLETE planned No longer available
	CUSTOM void Render (int material)
	{
		Shader* shader = s_ScriptingCurrentShader;
		if (!shader) {
			ErrorString ("Render requires material.SetPass before!");
			return;
		}

		GfxDevice& device = GetGfxDevice();

		// D3D needs begin/end when rendering is called out-of-band
		#if UNITY_EDITOR
		bool outsideOfFrame = !device.IsInsideFrame();
		if( outsideOfFrame )
			device.BeginFrame();
		#endif

		float matWorld[16], matView[16];

		CopyMatrix(device.GetViewMatrix(), matView);
		CopyMatrix(device.GetWorldMatrix(), matWorld);

		Matrix4x4f transformMatrix;
		Matrix4x4f scaleOnly;
		float scale;
		TransformType matrixType = self->GetTransform().CalculateTransformMatrixDisableNonUniformScale (transformMatrix, scaleOnly, scale);
		SetupObjectMatrix (transformMatrix, matrixType);

		self->Render (material, *s_ScriptingCurrentChannels);
		device.SetViewMatrix(matView);
		device.SetWorldMatrix(matWorld);

		#if UNITY_EDITOR
		if( outsideOfFrame )
			device.EndFrame();
		#endif
	}
END



// A script interface for a [[wiki:class-Projector|projector component]].
CLASS Projector : Behaviour

	// The near clipping plane distance.
	AUTO_PROP float nearClipPlane GetNearClipPlane SetNearClipPlane

	// The far clipping plane distance.
	AUTO_PROP float farClipPlane GetFarClipPlane SetFarClipPlane

	// The field of view of the projection in degrees.
	AUTO_PROP float fieldOfView GetFieldOfView SetFieldOfView

	// The aspect ratio of the projection.
	AUTO_PROP float aspectRatio GetAspectRatio SetAspectRatio

	OBSOLETE planned Use orthographic instead
	CSRAW public bool isOrthoGraphic { get { return orthographic; } set { orthographic = value; } }

	// Is the projection orthographic (''true'') or perspective (''false'')?
	AUTO_PROP bool orthographic GetOrthographic SetOrthographic

	// Projection's half-size when in orthographic mode.
	AUTO_PROP float orthographicSize GetOrthographicSize SetOrthographicSize

	OBSOLETE planned use orthographicSize
	CSRAW public float orthoGraphicSize { get { return orthographicSize; } set { orthographicSize = value; } }

	// Which object layers are ignored by the projector.
	AUTO_PROP int ignoreLayers GetIgnoreLayers SetIgnoreLayers

	// The material that will be projected onto every object.
	AUTO_PTR_PROP Material material GetMaterial SetMaterial
END

// A script interface for the [[wiki:class-Skybox|skybox component]].
CLASS Skybox : Behaviour
	// The material used by the skybox.
	CUSTOM_PROP Material material { return Scripting::ScriptingWrapperFor (self->GetMaterial ()); } { self->SetMaterial (value); }
END


// A script interface for the [[wiki:class-TextMesh|text mesh component]].
CLASS TextMesh : Component

	// The text that is displayed.
	CUSTOM_PROP string text { return scripting_string_new (self->GetText ()); } { self->SetText (value); }

	// The [[Font]] used.
	AUTO_PTR_PROP Font font GetFont SetFont


	// The font size to use (for dynamic fonts)
	AUTO_PROP int fontSize GetFontSize SetFontSize

	// The font style to use (for dynamic fonts)
	AUTO_PROP FontStyle fontStyle GetFontStyle SetFontStyle

	// How far should the text be offset from the transform.position.z when drawing
	AUTO_PROP float offsetZ GetOffsetZ SetOffsetZ

	// How lines of text are aligned (Left, Right, Center)
	AUTO_PROP TextAlignment alignment GetAlignment SetAlignment

	// Which point of the text shares the position of the Transform
	AUTO_PROP TextAnchor anchor GetAnchor SetAnchor

	// The size of each character (This scales the whole text)
	AUTO_PROP float characterSize GetCharacterSize SetCharacterSize

	// How much space will be in-between lines of text
	AUTO_PROP float lineSpacing GetLineSpacing SetLineSpacing

	// How much space will be inserted for a tab '\t' character. This is a multiplum of the 'spacebar' character offset
	AUTO_PROP float tabSize GetTabSize SetTabSize

	// Enable HTML-style tags for Text Formatting Markup.
	AUTO_PROP bool richText GetRichText SetRichText

	// Base color in which to render the text
	AUTO_PROP Color color GetColor SetColor
END

//(Legacy Particle system)
STRUCT Particle
	CSRAW
	private Vector3 m_Position;
	private Vector3 m_Velocity;
	private float   m_Size;
	private float   m_Rotation;
	private float   m_AngularVelocity;
	private float   m_Energy;
	private float   m_StartEnergy;
	private Color   m_Color;

	// The position of the particle.
	CSRAW public Vector3 position { get { return m_Position; } set { m_Position = value; } }

	// The velocity of the particle.
	CSRAW public Vector3 velocity { get { return m_Velocity; } set { m_Velocity = value; } }

	// The energy of the particle.
	CSRAW public float   energy   { get { return m_Energy; }   set { m_Energy = value; } }

	// The starting energy of the particle.
	CSRAW public float   startEnergy   { get { return m_StartEnergy; }   set { m_StartEnergy = value; } }

	// The size of the particle.
	CSRAW public float   size     { get { return m_Size; }     set { m_Size = value; } }

	// The rotation of the particle.
	CSRAW public float   rotation     { get { return m_Rotation; }     set { m_Rotation = value; } }

	// The angular velocity of the particle.
	CSRAW public float   angularVelocity     { get { return m_AngularVelocity; }     set { m_AngularVelocity = value; } }

	// The color of the particle.
	CSRAW public Color   color    { get { return m_Color; }    set { m_Color = value; } }
END

// Simple struct that contains all the arguments needed by the internal DrawTexture.
STRUCT internal InternalEmitParticleArguments
	CSRAW public Vector3 pos;
	CSRAW public Vector3 velocity;
	CSRAW public float size;
	CSRAW public float energy;
	CSRAW public Color color;
	CSRAW public float rotation;
	CSRAW public float angularVelocity;
END

C++RAW

struct MonoInternalEmitParticleArguments {
	Vector3f pos;
	Vector3f velocity;
	float size;
	float energy;
	ColorRGBAf color;
	float rotation;
	float angularVelocity;
};

// (Legacy Particles) Script interface for particle emitters.
CLASS ParticleEmitter : Component

	// Should particles be automatically emitted each frame?
	AUTO_PROP bool emit IsEmitting SetEmit

	// The minimum size each particle can be at the time when it is spawned.
	AUTO_PROP float minSize GetMinSize SetMinSize

	// The maximum size each particle can be at the time when it is spawned.
	AUTO_PROP float maxSize GetMaxSize SetMaxSize

	// The minimum lifetime of each particle, measured in seconds.
	AUTO_PROP float minEnergy GetMinEnergy SetMinEnergy

	// The maximum lifetime of each particle, measured in seconds.
	AUTO_PROP float maxEnergy GetMaxEnergy SetMaxEnergy

	// The minimum number of particles that will be spawned every second.
	AUTO_PROP float minEmission GetMinEmission SetMinEmission

	// The maximum number of particles that will be spawned every second.
	AUTO_PROP float maxEmission GetMaxEmission SetMaxEmission

	// he amount of the emitter's speed that the particles inherit.
	AUTO_PROP float emitterVelocityScale GetEmitterVelocityScale SetEmitterVelocityScale

	// The starting speed of particles in world space, along X, Y, and Z.
	AUTO_PROP Vector3 worldVelocity GetWorldVelocity SetWorldVelocity

	// The starting speed of particles along X, Y, and Z, measured in the object's orientation.
	AUTO_PROP Vector3 localVelocity GetLocalVelocity SetLocalVelocity

	// A random speed along X, Y, and Z that is added to the velocity.
	AUTO_PROP Vector3 rndVelocity GetRndVelocity SetRndVelocity

	// If enabled, the particles don't move when the emitter moves. If false, when you move the emitter, the particles follow it around.
	AUTO_PROP bool useWorldSpace GetUseWorldSpace SetUseWorldSpace

	// If enabled, the particles will be spawned with random rotations.
	AUTO_PROP bool rndRotation GetRndRotation SetRndRotation

	// The angular velocity of new particles in degrees per second.
	AUTO_PROP float angularVelocity GetAngularVelocity SetAngularVelocity

	// A random angular velocity modifier for new particles.
	AUTO_PROP float rndAngularVelocity GetRndAngularVelocity SetRndAngularVelocity

	// Returns a copy of all particles and assigns an array of all particles to be the current particles.
	CUSTOM_PROP Particle[] particles
	{
		int size = self->GetParticleCount();
		ScriptingArrayPtr array = CreateScriptingArray<SimpleParticle> (GetScriptingManager().GetCommonClasses().particle, self->GetParticleCount());
		self->ReadParticles(Scripting::GetScriptingArrayStart<SimpleParticle>(array), 0, size);
		return array;
	}
	{
		self->WriteParticles(Scripting::GetScriptingArrayStart<SimpleParticle>(value), GetScriptingArraySize(value));
	}

	// The current number of particles (RO).
	AUTO_PROP int particleCount GetParticleCount

	// Removes all particles from the particle emitter.
	AUTO void ClearParticles();

	// Emit a number of particles.
	CSRAW public void Emit () { Emit2 ( (int)Random.Range (minEmission, maxEmission) ); }

	// Emit /count/ particles immediately

	CSRAW public void Emit (int count) { Emit2 (count);}

	// Emit a single particle with given parameters.
	CSRAW public void Emit (Vector3 pos, Vector3 velocity, float size, float energy, Color color)
	{
		InternalEmitParticleArguments args = new InternalEmitParticleArguments();
		args.pos = pos;
		args.velocity = velocity;
		args.size = size;
		args.energy = energy;
		args.color = color;
		args.rotation = 0;
		args.angularVelocity = 0;
		Emit3 (ref args);
	}
	//
	CSRAW public void Emit (Vector3 pos, Vector3 velocity, float size, float energy, Color color, float rotation, float angularVelocity)
	{
		InternalEmitParticleArguments args = new InternalEmitParticleArguments();
		args.pos = pos;
		args.velocity = velocity;
		args.size = size;
		args.energy = energy;
		args.color = color;
		args.rotation = rotation;
		args.angularVelocity = angularVelocity;
		Emit3 (ref args);
	}

	CUSTOM private void Emit2 (int count)
	{
		self->EmitResetEmitterPos (count, 0.0F);
	}

	CUSTOM private void Emit3 (ref InternalEmitParticleArguments args)
	{
		self->Emit (args.pos, args.velocity, args.size, args.energy, args.color, args.rotation, args.angularVelocity);
	}

	// Advance particle simulation by given time.
	CUSTOM void Simulate (float deltaTime)
	{
		self->UpdateParticleSystem(deltaTime);
	}

	// Turns the ParticleEmitter on or off.
	AUTO_PROP bool enabled GetEnabled SetEnabled
END


// (Legacy Particles) Particle animators move your particles over time, you use them to apply wind, drag & color cycling to your particle emitters.
CLASS ParticleAnimator : Component
	// Do particles cycle their color over their lifetime?
	AUTO_PROP bool doesAnimateColor GetDoesAnimateColor SetDoesAnimateColor

	// World space axis the particles rotate around.
	AUTO_PROP Vector3 worldRotationAxis GetWorldRotationAxis SetWorldRotationAxis

	// Local space axis the particles rotate around.
	AUTO_PROP Vector3 localRotationAxis GetLocalRotationAxis SetLocalRotationAxis

	// How the particle sizes grow over their lifetime.
	AUTO_PROP float sizeGrow GetSizeGrow SetSizeGrow

	// A random force added to particles every frame.
	AUTO_PROP Vector3 rndForce GetRndForce SetRndForce

	// The force being applied to particles every frame.
	AUTO_PROP Vector3 force GetForce SetForce

	// How much particles are slowed down every frame.
	AUTO_PROP float damping GetDamping SetDamping

	// Does the [[GameObject]] of this particle animator auto destructs?
	AUTO_PROP bool autodestruct GetAutodestruct SetAutodestruct

	// Colors the particles will cycle through over their lifetime.

	CUSTOM_PROP Color[] colorAnimation
	{
		ColorRGBAf col[ParticleAnimator::kColorKeys];
		self->GetColorAnimation(col);
		return CreateScriptingArray(col, ParticleAnimator::kColorKeys, GetScriptingManager().GetCommonClasses().color);
	}
	{
		Scripting::RaiseIfNull(value);
		if(GetScriptingArraySize(value) != ParticleAnimator::kColorKeys)
		{
			Scripting::RaiseMonoException(" Array needs to contain exactly 5 Colors for colorAnimation.");
			return;
		}
		self->SetColorAnimation(Scripting::GetScriptingArrayStart<ColorRGBAf> (value));
	}
END


// The trail renderer is used to make trails behind objects in the scene as they move about.
CLASS TrailRenderer : Renderer

	// How long does the trail take to fade out.
	AUTO_PROP float time GetTime SetTime

	// The width of the trail at the spawning point.
	AUTO_PROP float startWidth GetStartWidth SetStartWidth

	// The width of the trail at the end of the trail.
	AUTO_PROP float endWidth GetEndWidth SetEndWidth

	// Does the [[GameObject]] of this trail renderer auto destructs?
	AUTO_PROP bool autodestruct GetAutodestruct SetAutodestruct

END



// The rendering mode for legacy particles.
ENUM ParticleRenderMode
	// Render the particles as billboards facing the player. (Default)
	Billboard = 0,
	// Stretch particles in the direction of motion.
	Stretch = 3,
	// Sort the particles back-to-front and render as billboards.
	SortedBillboard = 2,
	// Render the particles as billboards always facing up along the y-Axis.
	HorizontalBillboard = 4,
	// Render the particles as billboards always facing the player, but not pitching along the x-Axis.
	VerticalBillboard = 5
END

// (Legacy Particles) Renders particles on to the screen.
CLASS ParticleRenderer : Renderer
	//  How particles are drawn.
	AUTO_PROP ParticleRenderMode particleRenderMode GetRenderMode SetRenderMode

	// How much are the particles stretched in their direction of motion.
	AUTO_PROP float lengthScale GetLengthScale SetLengthScale

	// How much are the particles strectched depending on "how fast they move"
	AUTO_PROP float velocityScale GetVelocityScale SetVelocityScale

	// How much are the particles strected depending on the [[Camera]]'s speed.
	AUTO_PROP float cameraVelocityScale GetCameraVelocityScale SetCameraVelocityScale

	// Clamp the maximum particle size.
	AUTO_PROP float maxParticleSize GetMaxParticleSize SetMaxParticleSize

	// Set horizontal tiling count.
	AUTO_PROP int uvAnimationXTile GetUVAnimationXTile SetUVAnimationXTile
	// Set vertical tiling count.
	AUTO_PROP int uvAnimationYTile GetUVAnimationYTile SetUVAnimationYTile

	// Set uv animation cycles
	AUTO_PROP float uvAnimationCycles GetUVAnimationCycles SetUVAnimationCycles

	OBSOLETE warning animatedTextureCount has been replaced by uvAnimationXTile and uvAnimationYTile.
	CSRAW public int animatedTextureCount { get { return uvAnimationXTile; } set { uvAnimationXTile = value; }	}

	//*undocumented fixed typo
	CSRAW public float maxPartileSize { get { return maxParticleSize; } set { maxParticleSize = value; } }

	//*undocumented UV Rect access
	CUSTOM_PROP Rect[] uvTiles { return CreateScriptingArray(self->GetUVFrames(), self->GetNumUVFrames(), GetScriptingManager().GetCommonClasses().rect); } { Scripting::RaiseIfNull(value); self->SetUVFrames(Scripting::GetScriptingArrayStart<Rectf> (value), GetScriptingArraySize(value)); }

CSRAW #if ENABLE_MONO
	OBSOLETE error This function has been removed.
	CSRAW public AnimationCurve widthCurve { get { return null; } set { } }

	OBSOLETE error This function has been removed.
	CSRAW public AnimationCurve heightCurve { get { return null; } set { } }

	OBSOLETE error This function has been removed.
	CSRAW public AnimationCurve rotationCurve { get { return null; } set { } }

CSRAW #endif
END


// The line renderer is used to draw free-floating lines in 3D space.
CLASS LineRenderer : Renderer
	// Set the line width at the start and at the end.
	AUTO void SetWidth(float start, float end);

	// Set the line color at the start and at the end.
	AUTO void SetColors(Color start, Color end);

	// Set the number of line segments.
	AUTO void SetVertexCount(int count);

	// Set the position of the vertex in the line.
	AUTO void SetPosition(int index, Vector3 position);

	// If enabled, the lines are defined in world space.
	AUTO_PROP bool useWorldSpace GetUseWorldSpace SetUseWorldSpace

END



// A block of material values to apply.
CLASS MaterialPropertyBlock
	// Just wraps a pointer to native property block object
	CSRAW internal IntPtr m_Ptr;

	//*undocumented*
	CUSTOM internal void InitBlock()
	{
		MonoMaterialPropertyBlock* block = new MonoMaterialPropertyBlock();
		self.SetPtr(block, MonoMaterialPropertyBlock::CleanupMonoMaterialPropertyBlock);
	}
	//*undocumented*
	THREAD_SAFE
	CUSTOM internal void DestroyBlock()
	{
		MonoMaterialPropertyBlock::CleanupMonoMaterialPropertyBlock((MonoMaterialPropertyBlock*)self.GetPtr());
	}

	//*undocumented*
	CSRAW public MaterialPropertyBlock()	{ InitBlock(); }
	CSRAW ~MaterialPropertyBlock()			{ DestroyBlock(); }

	///*listonly*
	CSRAW public void AddFloat (string name, float value)
	{
		AddFloat( Shader.PropertyToID(name), value );
	}
	// Add a float material property.
	CUSTOM void AddFloat (int nameID, float value)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
		self->AddProperty( name, &value, 1, 1, 1 );
	}

	///*listonly*
	CSRAW public void AddVector (string name, Vector4 value) { AddVector( Shader.PropertyToID(name), value ); }
	// Add a vector material property.
	CUSTOM void AddVector (int nameID, Vector4 value)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
#if ENABLE_MONO
		self->AddProperty( name, value.GetPtr(), 1, 4, 1 );
#endif
	}

	///*listonly*
	CSRAW public void AddColor (string name, Color value)
	{
		AddColor( Shader.PropertyToID(name), value );
	}
	// Add a color material property.
	CUSTOM void AddColor (int nameID, Color value)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
#if ENABLE_MONO
		self->AddPropertyColor( name, value );
#endif
	}

	///*listonly*
	CSRAW public void AddMatrix (string name, Matrix4x4 value) { AddMatrix( Shader.PropertyToID(name), value ); }
	// Add a matrix material property.
	CUSTOM void AddMatrix (int nameID, Matrix4x4 value)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
#if ENABLE_MONO
		self->AddProperty( name, value.GetPtr(), 4, 4, 1 );
#endif
	}

	///*listonly*
	CSRAW public void AddTexture (string name, Texture value)
	{
		AddTexture (Shader.PropertyToID(name), value);
	}
	CUSTOM void AddTexture (int nameID, Texture value)
	{
		Texture* tex = value;
		if (!tex)
		{
			ErrorString ("Invalid argument for AddTexture()");
			return;
		}
		ShaderLab::FastPropertyName name;
		name.index = nameID;
		self->AddPropertyTexture (name, tex->GetDimension(), tex->GetTextureID());
	}

	CSRAW public float GetFloat (string name) { return GetFloat (Shader.PropertyToID(name)); }
	CUSTOM float GetFloat (int nameID)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
		const float* v = self->FindFloat (name);
		return v ? *v : 0.0f;
	}

	CSRAW public Vector4 GetVector (string name) { return GetVector (Shader.PropertyToID(name)); }
	CUSTOM Vector4 GetVector (int nameID)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
		const Vector4f* v = self->FindVector (name);
		return v ? *v : Vector4f(0,0,0,0);
	}

	CSRAW public Matrix4x4 GetMatrix (string name) { return GetMatrix (Shader.PropertyToID(name)); }
	CUSTOM Matrix4x4 GetMatrix (int nameID)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
		const Matrix4x4f* v = self->FindMatrix (name);
		return v ? *v : Matrix4x4f::identity;
	}

	CSRAW public Texture GetTexture (string name) { return GetTexture (Shader.PropertyToID(name)); }
	CUSTOM Texture GetTexture (int nameID)
	{
		ShaderLab::FastPropertyName name;
		name.index = nameID;
		TextureID v = self->FindTexture (name);
		if (v.m_ID == 0)
			return SCRIPTING_NULL;
		Texture* tex = Texture::FindTextureByID (v);
		return Scripting::ScriptingWrapperFor (tex);
	}

	// Clear material property values.
	CUSTOM void Clear() {
#if ENABLE_MONO
		self->Clear();
#endif
	}

END


// Color or depth buffer part of a [[RenderTexture]].
STRUCT RenderBuffer
	CSRAW internal int m_RenderTextureInstanceID;
	CSRAW internal IntPtr m_BufferPtr;
END

// Simple struct that contains all the arguments needed by the internal DrawTexture.
STRUCT internal InternalDrawTextureArguments
	CSRAW public Rect screenRect;
	#if UNITY_WINRT
	CSRAW public int textureInstanceId;
	#else
	CSRAW public Texture texture;
	#endif
	CSRAW public Rect sourceRect;
	CSRAW public int leftBorder;
	CSRAW public int rightBorder;
	CSRAW public int topBorder;
	CSRAW public int bottomBorder;
	CSRAW public Color32 color;
	#if UNITY_WINRT
	CSRAW public int matInstanceId;
	#else
	CSRAW public Material mat;
	#endif
END

C++RAW

struct MonoInternalDrawTextureArguments {
	Rectf screenRect;
	#if UNITY_WINRT
	int				   textureInstanceId;
	#else
	ScriptingObjectOfType<Texture> texture;
	#endif
	Rectf sourceRect;
	int leftBorder;
	int rightBorder;
	int topBorder;
	int bottomBorder;
	ColorRGBA32 color;
	#if UNITY_WINRT
	int					matInstanceId;
	#else
	ScriptingObjectOfType<Material> mat;
	#endif
};

// Simple struct that contains the arguments needed by Internal_DrawMeshTR.
STRUCT internal Internal_DrawMeshTRArguments
	CSRAW public int layer;
	CSRAW public int submeshIndex;
	CSRAW public Quaternion rotation;
	CSRAW public Vector3 position;
	CSRAW public int castShadows;
	CSRAW public int receiveShadows;
END

C++RAW

struct MonoInternal_DrawMeshTRArguments {
	int layer;
	int submeshIndex;
	Quaternionf rotation;
	Vector3f position;
	int castShadows;
	int receiveShadows;
};

// Simple struct that contains all the arguments needed by Internal_DrawMeshMatrix.
STRUCT internal Internal_DrawMeshMatrixArguments
	CSRAW public int layer;
	CSRAW public int submeshIndex;
	CSRAW public Matrix4x4 matrix;
	CSRAW public int castShadows;
	CSRAW public int receiveShadows;
END

C++RAW

struct MonoInternal_DrawMeshMatrixArguments {
	int layer;
	int submeshIndex;
	Matrix4x4f matrix;
	int castShadows;
	int receiveShadows;
};

// Raw interface to Unity's drawing functions.
CLASS Graphics

	/// *listonly*
	CSRAW static public void DrawMesh (Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera = null, int submeshIndex = 0, MaterialPropertyBlock properties = null) {
		Internal_DrawMeshTRArguments arguments = new Internal_DrawMeshTRArguments ();
		arguments.position = position;
		arguments.rotation = rotation;
		arguments.layer =  layer;
		arguments.submeshIndex = submeshIndex;
		arguments.castShadows = 1;
		arguments.receiveShadows = 1;
		Internal_DrawMeshTR(ref arguments, properties, material, mesh, camera);
	}
	// Draw a mesh.
	CSRAW static public void DrawMesh (Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera = null, int submeshIndex = 0, MaterialPropertyBlock properties = null) {
		Internal_DrawMeshMatrixArguments arguments = new Internal_DrawMeshMatrixArguments ();
		arguments.matrix = matrix;
		arguments.layer =  layer;
		arguments.submeshIndex = submeshIndex;
		arguments.castShadows = 1;
		arguments.receiveShadows = 1;

		Internal_DrawMeshMatrix(ref arguments, properties, material, mesh, camera);
	}
	//*undocumented*
	CSRAW static public void DrawMesh (Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows) {
		Internal_DrawMeshTRArguments arguments = new Internal_DrawMeshTRArguments ();
		arguments.position = position;
		arguments.rotation = rotation;
		arguments.layer =  layer;
		arguments.submeshIndex = submeshIndex;
		arguments.castShadows = castShadows ? 1 : 0;
		arguments.receiveShadows = receiveShadows ? 1 : 0;

		Internal_DrawMeshTR(ref arguments, properties, material, mesh, camera);
	}
	//*undocumented*
	CSRAW static public void DrawMesh (Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows) {
		Internal_DrawMeshMatrixArguments arguments = new Internal_DrawMeshMatrixArguments ();
		arguments.matrix = matrix;
		arguments.layer =  layer;
		arguments.submeshIndex = submeshIndex;
		arguments.castShadows = castShadows ? 1 : 0;
		arguments.receiveShadows = receiveShadows ? 1 : 0;

		Internal_DrawMeshMatrix(ref arguments, properties, material, mesh, camera);
	}
	CUSTOM private static void Internal_DrawMeshTR (ref Internal_DrawMeshTRArguments arguments,  MaterialPropertyBlock properties, Material material, Mesh mesh, Camera camera) {
		Camera* cameraPointer = camera;
		Matrix4x4f matrix;
		matrix.SetTR( arguments.position, arguments.rotation );

		IntermediateRenderer* r = AddMeshIntermediateRenderer( matrix, mesh, material, arguments.layer, arguments.castShadows != 0, arguments.receiveShadows != 0, arguments.submeshIndex, cameraPointer );
		MaterialPropertyBlock* propertiesPtr = properties.GetPtr();
		if (propertiesPtr)
			r->SetPropertyBlock (*propertiesPtr);
	}
	CUSTOM private static void Internal_DrawMeshMatrix (ref Internal_DrawMeshMatrixArguments arguments, MaterialPropertyBlock properties, Material material, Mesh mesh, Camera camera) {
		Camera* cameraPointer = camera;
		IntermediateRenderer* r = AddMeshIntermediateRenderer( arguments.matrix, mesh, material, arguments.layer, arguments.castShadows != 0, arguments.receiveShadows != 0, arguments.submeshIndex, cameraPointer);

		MaterialPropertyBlock* propertiesPtr = properties.GetPtr();
		if (propertiesPtr)
			r->SetPropertyBlock (*propertiesPtr);
	}

	/// *listonly*
	CSRAW static public void DrawMeshNow (Mesh mesh, Vector3 position, Quaternion rotation) { Internal_DrawMeshNow1(mesh, position, rotation, -1); }
	/// *listonly*
	CSRAW static public void DrawMeshNow (Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex) { Internal_DrawMeshNow1(mesh, position, rotation, materialIndex); }
	/// *listonly*
	CSRAW static public void DrawMeshNow (Mesh mesh, Matrix4x4 matrix) { Internal_DrawMeshNow2(mesh, matrix, -1); }

	// Draw a mesh immediately.
	CSRAW static public void DrawMeshNow (Mesh mesh, Matrix4x4 matrix, int materialIndex) { Internal_DrawMeshNow2(mesh, matrix, materialIndex); }

	CUSTOM private static void Internal_DrawMeshNow1 (Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex) {
		Shader* shader = s_ScriptingCurrentShader;
		if (!shader) {
			ErrorString ("DrawMesh requires material.SetPass before!");
			return;
		}
		DrawUtil::DrawMesh (*s_ScriptingCurrentChannels, *mesh, position, rotation);
	}
	CUSTOM private static void Internal_DrawMeshNow2 (Mesh mesh, Matrix4x4 matrix, int materialIndex) {
		Shader* shader = s_ScriptingCurrentShader;
		if (!shader) {
			ErrorString ("DrawMesh requires material.SetPass before!");
			return;
		}
		DrawUtil::DrawMesh (*s_ScriptingCurrentChannels, *mesh, matrix, materialIndex);
	}


	// Draws a fully procedural geometry on the GPU.
	CUSTOM static public void DrawProcedural (MeshTopology topology, int vertexCount, int instanceCount = 1) {
		DrawUtil::DrawProcedural (topology, vertexCount, instanceCount);
	}

	// Draws a fully procedural geometry on the GPU.
	CONDITIONAL !UNITY_FLASH
	CUSTOM static public void DrawProceduralIndirect (MeshTopology topology, ComputeBuffer bufferWithArgs, int argsOffset = 0) {
		DrawUtil::DrawProceduralIndirect (topology, bufferWithArgs.GetPtr(), argsOffset);
	}


	CONDITIONAL UNITY_EDITOR
	CUSTOM static internal void DrawSprite (Sprite sprite, Matrix4x4 matrix, Material material, int layer, Camera camera, Color color, MaterialPropertyBlock properties)
	{
		Camera* cameraPointer = camera;
		IntermediateRenderer* r = AddSpriteIntermediateRenderer(matrix, sprite, material, layer, color, cameraPointer);

		MaterialPropertyBlock* propertiesPtr = properties.GetPtr();
		if (propertiesPtr)
			r->SetPropertyBlock (*propertiesPtr);
	}



	FLUSHCONDITIONS

	OBSOLETE warning Use Graphics.DrawMeshNow instead.
	CSRAW static public void DrawMesh (Mesh mesh, Vector3 position, Quaternion rotation) { Internal_DrawMeshNow1(mesh, position, rotation, -1); }
	OBSOLETE warning Use Graphics.DrawMeshNow instead.
	CSRAW static public void DrawMesh (Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex) { Internal_DrawMeshNow1(mesh, position, rotation, materialIndex); }
	OBSOLETE warning Use Graphics.DrawMeshNow instead.
	CSRAW static public void DrawMesh (Mesh mesh, Matrix4x4 matrix) { Internal_DrawMeshNow2(mesh, matrix, -1); }
	OBSOLETE warning Use Graphics.DrawMeshNow instead.
	CSRAW static public void DrawMesh (Mesh mesh, Matrix4x4 matrix, int materialIndex) { Internal_DrawMeshNow2(mesh, matrix, materialIndex); }


	///*listonly*
	CSRAW public static void DrawTexture (Rect screenRect, Texture texture, Material mat = null) {
		DrawTexture (screenRect, texture, 0,0,0,0, mat);
	}
	///*listonly*
	CSRAW public static void DrawTexture (Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat = null) {
		DrawTexture (screenRect, texture, new Rect (0,0,1,1), leftBorder, rightBorder, topBorder, bottomBorder, mat);
	}
	///*listonly*
	CSRAW public static void DrawTexture (Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat = null) {
		InternalDrawTextureArguments arguments = new InternalDrawTextureArguments ();
			arguments.screenRect = screenRect;
			#if UNITY_WINRT
			arguments.textureInstanceId = texture != null ? texture.GetInstanceID() : 0;
			#else
			arguments.texture = texture;
			#endif
			arguments.sourceRect = sourceRect;
			arguments.leftBorder = leftBorder;
			arguments.rightBorder = rightBorder;
			arguments.topBorder = topBorder;
			arguments.bottomBorder = bottomBorder;
			Color32 c = new Color32();
			c.r = c.g = c.b = c.a = 128;
			arguments.color = c;
			#if UNITY_WINRT
			arguments.matInstanceId = mat != null ? mat.GetInstanceID() : 0;
			#else
			arguments.mat = mat;
			#endif
		DrawTexture (ref arguments);
	}
	// Draw a texture in screen coordinates.
	CSRAW public static void DrawTexture (Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Color color, Material mat = null) {
		InternalDrawTextureArguments arguments = new InternalDrawTextureArguments ();
			arguments.screenRect = screenRect;
			#if UNITY_WINRT
			arguments.textureInstanceId = texture != null ? texture.GetInstanceID() : 0;
			#else
			arguments.texture = texture;
			#endif
			arguments.sourceRect = sourceRect;
			arguments.leftBorder = leftBorder;
			arguments.rightBorder = rightBorder;
			arguments.topBorder = topBorder;
			arguments.bottomBorder = bottomBorder;
			arguments.color = color;
			#if UNITY_WINRT
			arguments.matInstanceId = mat != null ? mat.GetInstanceID() : 0;
			#else
			arguments.mat = mat;
			#endif
		DrawTexture (ref arguments);
	}

	CUSTOM internal static void DrawTexture (ref InternalDrawTextureArguments arguments) {
	#if UNITY_WINRT
		DrawGUITexture (
			arguments.screenRect,
			PPtr<Texture>(arguments.textureInstanceId),
			arguments.sourceRect,
			arguments.leftBorder,
			arguments.rightBorder,
			arguments.topBorder,
			arguments.bottomBorder,
			ColorRGBA32(arguments.color),
			PPtr<Material>(arguments.matInstanceId));
	#else
		DrawGUITexture (arguments.screenRect, arguments.texture, arguments.sourceRect, arguments.leftBorder, arguments.rightBorder, arguments.topBorder, arguments.bottomBorder, ColorRGBA32(arguments.color), arguments.mat);
	#endif
	}

	/// *listonly*
	CUSTOM static void Blit (Texture source, RenderTexture dest)
	{
		ImageFilters::Blit (source, dest);
	}

	// Copies source texture into destination render texture.
	CSRAW public static void Blit (Texture source, RenderTexture dest, Material mat, int pass = -1)
	{
		Internal_BlitMaterial (source, dest, mat, pass, true);
	}

	CSRAW public static void Blit (Texture source, Material mat, int pass = -1)
	{
		Internal_BlitMaterial (source, null, mat, pass, false);
	}

	CUSTOM private static void Internal_BlitMaterial (Texture source, RenderTexture dest, Material mat, int pass, bool setRT)
	{
		Material* m = mat;
		if (m == NULL)
		{
			ErrorString ("Graphics.Blit: material is null");
			return;
		}
		ImageFilters::Blit (source, dest, m, pass, setRT);
	}

	// Copies source texture into destination, for multi-tap shader.
	CSRAW public static void BlitMultiTap (Texture source, RenderTexture dest, Material mat, params Vector2[] offsets)
	{
		Internal_BlitMultiTap (source, dest, mat, offsets);
	}

	CUSTOM private static void Internal_BlitMultiTap (Texture source, RenderTexture dest, Material mat, Vector2[] offsets)
	{
		Material* m = mat;
		if (m == NULL)
		{
			ErrorString ("Graphics.BlitMultiTap: material is null");
			return;
		}
		int size = GetScriptingArraySize (offsets);
		const Vector2f* arr = Scripting::GetScriptingArrayStart<Vector2f> (offsets);
		ImageFilters::BlitMultiTap (source, dest, m, size, arr);
	}


	CSRAW public static void SetRenderTarget (RenderTexture rt) {
		Internal_SetRT (rt, 0, -1);
	}
	CSRAW public static void SetRenderTarget (RenderTexture rt, int mipLevel) {
		Internal_SetRT (rt, mipLevel, -1);
	}
	CSRAW public static void SetRenderTarget (RenderTexture rt, int mipLevel, CubemapFace face) {
		Internal_SetRT (rt, mipLevel, (int)face);
	}

	///*listonly*
	CSRAW public static void SetRenderTarget (RenderBuffer colorBuffer, RenderBuffer depthBuffer) {
		Internal_SetRTBuffer (out colorBuffer, out depthBuffer);
	}

	// Sets current render target.
	CSRAW public static void SetRenderTarget (RenderBuffer[] colorBuffers, RenderBuffer depthBuffer) {
		Internal_SetRTBuffers (colorBuffers, out depthBuffer);
	}

	CUSTOM private static void Internal_SetRT (RenderTexture rt, int mipLevel, int face) {
		RenderTexture::SetActive (rt, mipLevel, (CubemapFace)face);
	}

	CUSTOM private static void Internal_SetRTBuffer (out RenderBuffer colorBuffer, out RenderBuffer depthBuffer) {
		RenderTexture* rtC = PPtr<RenderTexture>(colorBuffer->m_RenderTextureInstanceID);
		RenderTexture* rtD = PPtr<RenderTexture>(depthBuffer->m_RenderTextureInstanceID);
		if (rtC && !rtD)
		{
			ErrorString ("SetRenderTarget can only mix color & depth buffers from RenderTextures. You're trying to set depth buffer from the screen.");
			return;
		}
		if (!rtC && rtD)
		{
			ErrorString ("SetRenderTarget can only mix color & depth buffers from RenderTextures. You're trying to set color buffer from the screen.");
			return;
		}
		if (rtC)
		{
			RenderSurfaceHandle rsHandle(colorBuffer->m_BufferPtr);
			RenderTexture::SetActive (1, &rsHandle, RenderSurfaceHandle(depthBuffer->m_BufferPtr), rtC);
		}
		else
		{
			RenderTexture::SetActive (NULL);
		}
	}

	CUSTOM private static void Internal_SetRTBuffers (RenderBuffer[] colorBuffers, out RenderBuffer depthBuffer) {
		int size = GetScriptingArraySize (colorBuffers);
		if (size < 1 || size > kMaxSupportedRenderTargets)
		{
			ErrorString ("Invalid color buffer count for SetRenderTarget");
			return;
		}

		const ScriptingRenderBuffer* arr = Scripting::GetScriptingArrayStart<ScriptingRenderBuffer> (colorBuffers);
		RenderTexture* rtC = PPtr<RenderTexture>(arr[0].m_RenderTextureInstanceID);
		RenderTexture* rtD = PPtr<RenderTexture>(depthBuffer->m_RenderTextureInstanceID);
		if (rtC && !rtD)
		{
			ErrorString ("SetRenderTarget can only mix color & depth buffers from RenderTextures. You're trying to set depth buffer from the screen.");
			return;
		}
		if (!rtC && rtD)
		{
			ErrorString ("SetRenderTarget can only mix color & depth buffers from RenderTextures. You're trying to set color buffer from the screen.");
			return;
		}
		if (rtC)
		{
			RenderSurfaceHandle colorHandles[kMaxSupportedRenderTargets];
			for (int i = 0; i < size; ++i)
				colorHandles[i].object = arr[i].m_BufferPtr;
			RenderTexture::SetActive (size, colorHandles, RenderSurfaceHandle(depthBuffer->m_BufferPtr), rtC);
		}
		else
		{
			RenderTexture::SetActive (NULL);
		}
	}

	// Currently active color buffer (RO).
	CSRAW public static RenderBuffer activeColorBuffer { get { RenderBuffer res; GetActiveColorBuffer (out res); return res; } }

	// Currently active depth buffer (RO).
	CSRAW public static RenderBuffer activeDepthBuffer { get { RenderBuffer res; GetActiveDepthBuffer (out res); return res; } }

	CUSTOM private static void GetActiveColorBuffer (out RenderBuffer res) {
		GfxDevice& device = GetGfxDevice();
		RenderTexture* rt = device.GetActiveRenderTexture();
		res->m_RenderTextureInstanceID = rt ? rt->GetInstanceID() : 0;
		res->m_BufferPtr = rt ? device.GetActiveRenderColorSurface(0).object : NULL;
	}
	CUSTOM private static void GetActiveDepthBuffer (out RenderBuffer res) {
		GfxDevice& device = GetGfxDevice();
		RenderTexture* rt = device.GetActiveRenderTexture();
		res->m_RenderTextureInstanceID = rt ? rt->GetInstanceID() : 0;
		res->m_BufferPtr = rt ? device.GetActiveRenderDepthSurface().object : NULL;
	}

	CSRAW public static void SetRandomWriteTarget (int index, RenderTexture uav) {
		Internal_SetRandomWriteTargetRT (index, uav);
	}

	CONDITIONAL !UNITY_FLASH
	CSRAW public static void SetRandomWriteTarget (int index, ComputeBuffer uav) {
		Internal_SetRandomWriteTargetBuffer (index, uav);
	}
	CUSTOM public static void ClearRandomWriteTargets () {
		GetGfxDevice().ClearRandomWriteTargets();
	}

	CUSTOM private static void Internal_SetRandomWriteTargetRT (int index, RenderTexture uav) {
		RenderTexture* rt = uav;
		TextureID tid = rt ? rt->GetTextureID() : TextureID();
		GetGfxDevice().SetRandomWriteTargetTexture(index, tid);
	}

	CONDITIONAL !UNITY_FLASH
	CUSTOM private static void Internal_SetRandomWriteTargetBuffer (int index, ComputeBuffer uav) {
		GetGfxDevice().SetRandomWriteTargetBuffer(index, uav->GetBufferHandle());
	}

	FLUSHCONDITIONS

	OBSOLETE warning Use SystemInfo.graphicsDeviceName instead.
	CSRAW static public string deviceName { get { return SystemInfo.graphicsDeviceName; } }

	OBSOLETE warning Use SystemInfo.graphicsDeviceVendor instead.
	CSRAW static public string deviceVendor { get { return SystemInfo.graphicsDeviceVendor; } }

	OBSOLETE warning Use SystemInfo.graphicsDeviceVersion instead.
	CSRAW static public string deviceVersion { get { return SystemInfo.graphicsDeviceVersion; } }

	OBSOLETE warning Use SystemInfo.supportsVertexPrograms instead.
	CSRAW static public bool supportsVertexProgram { get { return SystemInfo.supportsVertexPrograms; } }

	//*undocumented*
	CUSTOM internal static void SetupVertexLights (Light[] lights)
	{
		const int size = GetScriptingArraySize(lights);
		std::vector<Light*> lightsVec(size);
		for (int i = 0; i < size; ++i)
			lightsVec[i] = ScriptingObjectToObject<Light>(Scripting::GetScriptingArrayElementNoRef<ScriptingObjectPtr> (lights, i));

		SetupVertexLights(lightsVec);
	}

END



// Represents a display resolution.
STRUCT Resolution
	// Keep in sync with ScreenManager::Resolution
	CSRAW private int m_Width;
	CSRAW private int m_Height;
	CSRAW private int m_RefreshRate;

	// Resolution width in pixels.
	CSRAW public int width { get { return m_Width; } set { m_Width = value; } }
	// Resolution height in pixels.
	CSRAW public int height { get { return m_Height; } set { m_Height = value; } }
	// Resolution's vertical refresh rate in Hz.
	CSRAW public int refreshRate { get { return m_RefreshRate; } set { m_RefreshRate = value; } }
END



// Data of a lightmap.
CSRAW [StructLayout (LayoutKind.Sequential)]
CLASS LightmapData
	CSRAW internal Texture2D m_Lightmap;
	CSRAW internal Texture2D m_IndirectLightmap;

	// Lightmap storing the full incoming light.
	CSRAW public Texture2D lightmapFar { get { return m_Lightmap; } set { m_Lightmap = value; } }

	OBSOLETE warning Use lightmapFar instead
	CSRAW public Texture2D lightmap { get { return m_Lightmap; } set { m_Lightmap = value; } }

	// Lightmap storing only the indirect incoming light.
	CSRAW public Texture2D lightmapNear { get { return m_IndirectLightmap; } set { m_IndirectLightmap = value; } }
END

// Single, dual, or directional lightmaps rendering mode.
ENUM LightmapsMode
	// Single, traditional lightmap rendering mode.
	Single = 0,

	// Dual lightmap rendering mode.
	Dual = 1,

	// Directional rendering mode.
	Directional = 2,
END

// Valid color spaces
ENUM ColorSpace
	// Uninitialized colorspace
	Uninitialized = -1,

	// Lightmap has been baked for gamma rendering
	Gamma = 0,

	// Lightmap has been baked for linear rendering
	Linear = 1
END


// Stores light probes for the scene.
CONDITIONAL ENABLE_MONO || UNITY_WINRT
CLASS LightProbes : Object
	// Returns spherical harmonics coefficients of a light probe at the given position. The light probe is interpolated from the light probes baked
	CUSTOM void GetInterpolatedLightProbe(Vector3 position, Renderer renderer, float[] coefficients)
	{
		if (GetScriptingArraySize(coefficients) != kLightProbeBasisCount * 3)
			Scripting::RaiseArgumentException("Coefficients array must have 9*3 elements");

		self->GetInterpolatedLightProbe(position, renderer, &Scripting::GetScriptingArrayElement<float> (coefficients, 0));
	}

	// Positions of the baked light probes.
	CUSTOM_PROP Vector3[] positions
	{
		return CreateScriptingArray(self->GetPositions(), self->GetPositionsSize(), MONO_COMMON.vector3);
	}

	// Coefficients of the baked light probes. The coefficients represent a 3-band RGB spherical harmonics probe, with a total of 27 floats per light probe, laid out: rgbrgbrgb...

	CUSTOM_PROP float[] coefficients
	{
		return CreateScriptingArray(reinterpret_cast<float*>(self->GetCoefficients()), self->GetPositionsSize()*kLightProbeCoefficientCount, MONO_COMMON.floatSingle);
	}
	{
		if (GetScriptingArraySize(value) != self->GetPositionsSize() * kLightProbeBasisCount * 3)
			Scripting::RaiseArgumentException("Coefficients array must have probeCount*9*3 elements");

		self->SetCoefficients(&Scripting::GetScriptingArrayElement<float> (value, 0), GetScriptingArraySize(value));
	}

	// The number of light probes.
	CUSTOM_PROP int count
	{
		return self->GetPositionsSize();
	}

	// The number of cells (tetrahedra + outer cells) the space is divided to.
	CUSTOM_PROP int cellCount
	{
		return self->GetTetrahedraSize();
	}
END

// Stores lightmaps of the scene.
CONDITIONAL ENABLE_MONO || UNITY_WINRT
CLASS LightmapSettings : Object

	// Lightmap array.
	CUSTOM_PROP static LightmapData[] lightmaps
	{ return VectorToScriptingClassArray<LightmapData, LightmapDataMono> (GetLightmapSettings().GetLightmaps(), GetScriptingTypeRegistry().GetType("UnityEngine", "LightmapData"), LightmapDataToMono); }
	{ GetLightmapSettings().SetLightmaps (ScriptingClassArrayToVector<LightmapData, LightmapDataMono> (value, LightmapDataToCpp)); }

	// Single, Dual or Directional lightmaps rendering mode.
	CUSTOM_PROP static LightmapsMode lightmapsMode
	{ return  GetLightmapSettings().GetLightmapsMode (); }
	{ GetLightmapSettings().SetLightmapsMode (value); }

	// Color space of the lightmap
	CUSTOM_PROP static ColorSpace bakedColorSpace
	{ return  GetLightmapSettings().GetBakedColorSpace (); }
	{ }

	// Holds all data needed by the light probes.
	CUSTOM_PROP static LightProbes lightProbes
	{
		return Scripting::ScriptingWrapperFor(GetLightmapSettings().GetLightProbes());
	}
	{
		GetLightmapSettings().SetLightProbes(value);
	}
END

// Utility class for common geometric functions.
CLASS GeometryUtility

	// Calculates frustum planes.
	CSRAW static public Plane[] CalculateFrustumPlanes (Camera camera)
	{
		return CalculateFrustumPlanes (camera.projectionMatrix * camera.worldToCameraMatrix);
	}

	// Calculates frustum planes.
	CSRAW static public Plane[] CalculateFrustumPlanes (Matrix4x4 worldToProjectionMatrix)
	{
		Plane[] planes = new Plane[6];
		Internal_ExtractPlanes (planes, worldToProjectionMatrix);
		return planes;
	}

	CUSTOM private static void Internal_ExtractPlanes (Plane[] planes, Matrix4x4 worldToProjectionMatrix)
	{
		ExtractProjectionPlanes(worldToProjectionMatrix, Scripting::GetScriptingArrayStart<Plane> (planes));
	}


	// Returns true if bounds are inside the plane array.
	CUSTOM static bool TestPlanesAABB (Plane[] planes, Bounds bounds)
	{
		return TestPlanesAABB(Scripting::GetScriptingArrayStart<Plane> (planes), GetScriptingArraySize(planes), bounds);
	}
END


// Describes screen orientation.
ENUM ScreenOrientation
	//*undocumented*
	Unknown = 0,

	// Portrait orientation.
	Portrait = 1,

	// Portrait orientation, upside down.
	PortraitUpsideDown = 2,

	// Landscape orientation, counter-clockwise from the portrait orientation.
	LandscapeLeft = 3,

	// Landscape orientation, clockwise from the portrait orientation.
	LandscapeRight = 4,

	// Auto Rotation, will use enabled orientations.
	AutoRotation = 5,

	//*undocumented*
	Landscape = 3
END


// Access to display information.
CLASS Screen

	// All fullscreen resolutions supported by the monitor (RO).

	CUSTOM_PROP static Resolution[] resolutions
	{
		ScriptingClassPtr klass = GetScriptingManager ().GetCommonClasses ().resolution;
		ScreenManager::Resolutions resolutions = GetScreenManager ().GetResolutions ();
		ScriptingArrayPtr array = CreateScriptingArray<ScreenManager::Resolution> (klass, resolutions.size ());
		for (int i=0;i<resolutions.size ();i++)
			Scripting::SetScriptingArrayElement (array, i, resolutions[i]);

		return array;
	}

	OBSOLETE planned
	CSRAW static public Resolution[] GetResolution { get { return resolutions; } }

	// The current screen resolution (RO).
	CUSTOM_PROP static Resolution currentResolution { return GetScreenManager().GetCurrentResolution (); }

	// Switches the screen resolution.
	CUSTOM static void SetResolution (int width, int height, bool fullscreen, int preferredRefreshRate = 0)
	{
		#if WEBPLUG
		if (fullscreen)
		{
			if (!GetScreenManager ().GetAllowFullscreenSwitch())
			{
				ErrorString("Fullscreen mode can only be enabled in the web player after clicking on the content.");
				return;
			}
			// when going from windowed to fullscreen, show escape warning
			if( !GetScreenManager().IsFullScreen() )
				ShowFullscreenEscapeWarning();
		}
		#endif

		GetScreenManager ().RequestResolution (width, height, fullscreen, preferredRefreshRate);
	}

	// Should the cursor be visible?
	CUSTOM_PROP static bool showCursor { return GetScreenManager ().GetShowCursor (); }  { GetScreenManager ().SetShowCursor (value); }

	// Should the cursor be locked?
	CUSTOM_PROP static bool lockCursor { return GetScreenManager ().GetLockCursor (); }  { GetScreenManager ().SetLockCursor (value); }


	// The current width of the screen window in pixels (RO).
	THREAD_SAFE
	CUSTOM_PROP static int width { return GetScreenManager ().GetWidth (); }

	// The current height of the screen window in pixels (RO).
	THREAD_SAFE
	CUSTOM_PROP static int height { return GetScreenManager ().GetHeight (); }

	// The current DPI of the screen / device (RO).
	CUSTOM_PROP static float dpi { return GetScreenManager ().GetDPI (); }

	// Is the game running fullscreen?
	CUSTOM_PROP static bool fullScreen
	{
		return GetScreenManager ().IsFullScreen ();
	}
	{
		ScreenManager& screen = GetScreenManager();
		bool goFullscreen = (bool)value;
		if (goFullscreen  == screen.IsFullScreen ())
		{
			return;
		}

		#if WEBPLUG
		if (goFullscreen)
		{
			if (!GetScreenManager().GetAllowFullscreenSwitch())
			{
				ErrorString("Fullscreen mode can only be enabled in the web player after clicking on the content.");
				return;
			}
			// when going from windowed to fullscreen, show escape warning
			if( !screen.IsFullScreen() )
				ShowFullscreenEscapeWarning();
		}
		#endif

		screen.RequestSetFullscreen (goFullscreen);
	}

	// Allow auto-rotation to portrait?
	CUSTOM_PROP static bool autorotateToPortrait {
		return GetScreenManager().GetIsOrientationEnabled(kAutorotateToPortrait);
	} {
		GetScreenManager().SetIsOrientationEnabled(kAutorotateToPortrait, value);
	}

	// Allow auto-rotation to portrait, upside down?
	CUSTOM_PROP static bool autorotateToPortraitUpsideDown {
		return GetScreenManager().GetIsOrientationEnabled(kAutorotateToPortraitUpsideDown);
	} {
		GetScreenManager().SetIsOrientationEnabled(kAutorotateToPortraitUpsideDown, value);
	}

	// Allow auto-rotation to landscape left?
	CUSTOM_PROP static bool autorotateToLandscapeLeft {
		return GetScreenManager().GetIsOrientationEnabled(kAutorotateToLandscapeLeft);
	} {
		GetScreenManager().SetIsOrientationEnabled(kAutorotateToLandscapeLeft, value);
	}

	// Allow auto-rotation to landscape right?
	CUSTOM_PROP static bool autorotateToLandscapeRight {
		return GetScreenManager().GetIsOrientationEnabled(kAutorotateToLandscapeRight);
	} {
		GetScreenManager().SetIsOrientationEnabled(kAutorotateToLandscapeRight, value);
	}


	// Specifies logical orientation of the screen.
	CUSTOM_PROP static ScreenOrientation orientation {
		return GetScreenManager ().GetScreenOrientation ();
	} {
		GetScreenManager ().RequestOrientation (value);
	}

	// A power saving setting, allowing the screen to dim some time after the
	CUSTOM_PROP static int sleepTimeout {
		return GetScreenManager ().GetScreenTimeout ();
	} {
		GetScreenManager ().SetScreenTimeout (value);
	}
END

// Constants for special values of [[Screen.sleepTimeout]]. Use them to
CLASS SleepTimeout
	// Prevent screen dimming.
	CSRAW public const int NeverSleep = -1;

	// Set the sleep timeout to whatever user has specified in the system
	CSRAW public const int SystemSetting = -2;
END



// Low-level graphics library.
CLASS GL
	// Submit a vertex.
	CUSTOM static void Vertex3 (float x, float y, float z) { GetGfxDevice().ImmediateVertex( x,y,z ); }
	// Submit a vertex.
	CUSTOM static void Vertex (Vector3 v) { GetGfxDevice().ImmediateVertex( v.x, v.y, v.z ); }

	// Sets current vertex color.
	CUSTOM static void Color (Color c) { GetGfxDevice().ImmediateColor(c.r, c.g, c.b, c.a); }

	// Sets current texture coordinate (v.x,v.y,v.z) for all texture units.
	CUSTOM static void TexCoord (Vector3 v)  { GetGfxDevice().ImmediateTexCoordAll(v.x, v.y, v.z); }

	// Sets current texture coordinate (x,y) for all texture units.
	CUSTOM static void TexCoord2 (float x, float y) { GetGfxDevice().ImmediateTexCoordAll(x, y, 0.0f); }

	// Sets current texture coordinate (x,y,z) for all texture units.
	CUSTOM static void TexCoord3 (float x, float y, float z) { GetGfxDevice().ImmediateTexCoordAll(x, y, z); }

	// Sets current texture coordinate (x,y) for the actual texture /unit/.
	CUSTOM static void MultiTexCoord2 (int unit, float x, float y)
	{
		GetGfxDevice().ImmediateTexCoord( unit, x, y, 0.0f );
	}

	// Sets current texture coordinate (x,y,z) to the actual texture /unit/.
	CUSTOM static void MultiTexCoord3 (int unit, float x, float y, float z)
	{
		GetGfxDevice().ImmediateTexCoord( unit, x, y, z );
	}

	// Sets current texture coordinate (v.x,v.y,v.z) to the actual texture /unit/.
	CUSTOM static void MultiTexCoord (int unit, Vector3 v)
	{
		GetGfxDevice().ImmediateTexCoord( unit, v.x, v.y, v.z );
	}


	// Mode for ::ref::Begin: draw triangles.
	CSRAW public const int TRIANGLES = 0x0004;

	// Mode for ::ref::Begin: draw triangle strip.
	CSRAW public const int TRIANGLE_STRIP = 0x0005;

	// Mode for ::ref::Begin: draw quads.
	CSRAW public const int QUADS = 0x0007;

	// Mode for ::ref::Begin: draw lines.
	CSRAW public const int LINES = 0x0001;


	// Begin drawing 3D primitives.
	CUSTOM static void Begin (int mode) {
		GfxPrimitiveType pt;
		if( mode == 0x0004 )
			pt = kPrimitiveTriangles;
		else if( mode == 0x0005 )
			pt = kPrimitiveTriangleStripDeprecated;
		else if( mode == 0x0007 )
			pt = kPrimitiveQuads;
		else if( mode == 0x0001 )
			pt = kPrimitiveLines;
		else {
			Scripting::RaiseMonoException( "Invalid mode for GL.Begin" );
			return;
		}
		GetGfxDevice().ImmediateBegin( pt );
	}

	// End drawing 3D primitives.
	CUSTOM static void End () {
		GetGfxDevice().ImmediateEnd();
		GPU_TIMESTAMP();
	}

	// Helper function to set up an ortho perspective transform.
	CUSTOM static void LoadOrtho ()
	{
		LoadFullScreenOrthoMatrix();
	}

	// Setup a matrix for pixel-correct rendering.
	CUSTOM static void LoadPixelMatrix () {
		// Now the hack: regular code (GUITexts, GUITExtures etc.) needs to add the
		// vertical texel offset. However, looks like GUI code needs to subtract the
		// vertical texel offset. No idea why; I guess it's because GUI code does
		// the y-inversion by itself. So we pass true as the last parameter.
		if (GetCurrentCameraPtr() != NULL)
		{
			LoadPixelMatrix( GetCurrentCamera().GetScreenViewportRect(), GetGfxDevice(), true, true );
		}
	}

	// Do this "different name" trick because otherwise the wrapper functions for both
	// LoadPixelMatrix overloads will have the same name, making a compile error.
	CUSTOM private static void LoadPixelMatrixArgs(float left, float right, float bottom, float top)
	{
		// Now the hack: regular code (GUITexts, GUITExtures etc.) needs to add the
		// vertical texel offset. However, looks like GUI code needs to subtract the
		// vertical texel offset. No idea why; I guess it's because GUI code does
		// the y-inversion by itself. So we pass true as the last parameter.
		Rectf rect( left, bottom, right-left, top-bottom );
		LoadPixelMatrix( rect, GetGfxDevice(), true, true );
	}


	// Setup a matrix for pixel-correct rendering.
	CSRAW public static void LoadPixelMatrix (float left, float right, float bottom, float top)
	{
		LoadPixelMatrixArgs(left,right,bottom,top);
	}

	// Set the rendering viewport.
	CUSTOM static void Viewport (Rect pixelRect) {
		SetGLViewport(pixelRect);
	}

	// Load an arbitrary matrix to the current projection matrix.
	CUSTOM static void LoadProjectionMatrix (Matrix4x4 mat) {
		GetGfxDevice().SetProjectionMatrix (mat);
	}

	// Load the identity matrix to the current modelview matrix.
	CUSTOM static void LoadIdentity () {
		GetGfxDevice().SetViewMatrix (Matrix4x4f::identity.GetPtr()); // implicitly sets world to identity
	}

	// The current modelview matrix.
	CUSTOM_PROP static Matrix4x4 modelview
	{
		Matrix4x4f temp;
		GetGfxDevice().GetMatrix( temp.GetPtr() );
		return temp;
	}
	{
		GetGfxDevice().SetViewMatrix( value.GetPtr() );
	}

	// Multiplies the current modelview matrix with the one specified.
	CUSTOM static void MultMatrix (Matrix4x4 mat) {
		GetGfxDevice().SetWorldMatrix( mat.GetPtr() );
	}

	// Saves both projection and modelview matrices to the matrix stack.
	CUSTOM static void PushMatrix()
	{
		GfxDevice& dev = GetGfxDevice();
		g_ViewMatrixStack.Push(dev.GetViewMatrix());
		g_WorldMatrixStack.Push(dev.GetWorldMatrix());
		g_ProjectionMatrixStack.Push(dev.GetProjectionMatrix());
	}

	// Restores both projection and modelview matrices off the top of the matrix stack.
	CUSTOM static void PopMatrix ()
	{
		GfxDevice& dev = GetGfxDevice();
		g_WorldMatrixStack.Pop();
		g_ViewMatrixStack.Pop();
		g_ProjectionMatrixStack.Pop();
		// Setting the view matrix clears the world matrix to be compatible with GL the ways
		dev.SetViewMatrix(g_ViewMatrixStack.GetMatrix().GetPtr());
		dev.SetWorldMatrix(g_WorldMatrixStack.GetMatrix().GetPtr());
		dev.SetProjectionMatrix(g_ProjectionMatrixStack.GetMatrix());
	}


	// Compute GPU projection matrix from camera's projection matrix.
	CUSTOM static Matrix4x4 GetGPUProjectionMatrix (Matrix4x4 proj, bool renderIntoTexture)
	{
		bool openGLStyle = GetGfxDevice().UsesOpenGLTextureCoords();
		Matrix4x4f m = proj;
		CalculateDeviceProjectionMatrix (m, openGLStyle, !openGLStyle && renderIntoTexture);
		return m;
	}


	// Should rendering be done in wireframe?
	CUSTOM_PROP static bool wireframe { return GetGfxDevice().GetWireframe(); } { GetGfxDevice().SetWireframe(value);  }

	CUSTOM_PROP static bool sRGBWrite { return GetGfxDevice().GetSRGBWrite(); } { GetGfxDevice().SetSRGBWrite(value);  }

	// Select whether to invert the backface culling (true) or not (false).
	CUSTOM static void SetRevertBackfacing (bool revertBackFaces) { GetGfxDevice().SetUserBackfaceMode (revertBackFaces); }

	// Clear the current render buffer.
	CSRAW static public void Clear (bool clearDepth, bool clearColor, Color backgroundColor, float depth=1.0f) {
		Internal_Clear (clearDepth, clearColor, backgroundColor, depth);
	}

	CUSTOM static private void Internal_Clear (bool clearDepth, bool clearColor, Color backgroundColor, float depth) {
		UInt32 flags = 0;
		if (clearColor) flags |= kGfxClearColor;
		if (clearDepth) flags |= kGfxClearDepthStencil;
		GraphicsHelper::Clear (flags, backgroundColor.GetPtr(), depth, 0);
		GPU_TIMESTAMP();
	}


	// Clear the current render buffer with camera's skybox.
	CUSTOM static void ClearWithSkybox (bool clearDepth, Camera camera) {
		ClearWithSkybox(clearDepth, camera);
	}

	// Invalidate the internally cached renderstates.
	CUSTOM static void InvalidateState () {
		GL_CUSTOM_PushMatrix();
		GfxDevice& dev = GetGfxDevice();
		dev.InvalidateState();
		GL_CUSTOM_PopMatrix();
	}

	// Send a user-defined event to a native code plugin.
	CUSTOM static void IssuePluginEvent (int eventID)
	{
		GetGfxDevice().InsertCustomMarker (eventID);
	}

END


// GUI STUFF
// --------------------------------

// Base class for images & text strings displayed in a GUI.
NONSEALED_CLASS GUIElement : Behaviour

	// Is a point on screen inside the element.
	CUSTOM bool HitTest (Vector3 screenPosition, Camera camera = null) {
		return self->HitTest (Vector2f (screenPosition.x, screenPosition.y), GetCameraOrWindowRect(camera));
	}

	// Returns bounding rectangle of [[GUIElement]] in screen coordinates.
	CUSTOM Rect GetScreenRect (Camera camera = null) { return self->GetScreenRect (GetCameraOrWindowRect(camera)); }

END

// A texture image used in a 2D GUI.
CLASS GUITexture : GUIElement
	// The color of the GUI texture.
	AUTO_PROP Color color GetColor SetColor

	// The texture used for drawing.

	AUTO_PTR_PROP Texture texture GetTexture SetTexture

	// Pixel inset used for pixel adjustments for size and position.
	CUSTOM_PROP Rect pixelInset { return self->GetPixelInset(); } { self->SetPixelInset(value); }


	// The border defines the number of pixels from the edge that are not affected by scale.
	CUSTOM_PROP RectOffset border
	{
		RectOffset* rectOffset = new RectOffset ();

		rectOffset->left	= self->m_LeftBorder;
		rectOffset->right	= self->m_RightBorder;
		rectOffset->top		= self->m_TopBorder;
		rectOffset->bottom	= self->m_BottomBorder;

		ScriptingObjectWithIntPtrField<RectOffset> monoObject(scripting_object_new (MONO_COMMON.rectOffset));
		monoObject.SetPtr(rectOffset);
		return monoObject.object;
	}
	{
		self->m_LeftBorder		= value->left;
		self->m_RightBorder		= value->right;
		self->m_TopBorder		= value->top;
		self->m_BottomBorder	= value->bottom;
	}
END


// How multiline text should be aligned.
ENUM TextAlignment
	// Text lines are aligned on the left side.
	Left = 0,
	// Text lines are centered.
	Center = 1,
	// Text lines are aligned on the right side.
	Right = 2
END


// Where the anchor of the text is placed.
ENUM TextAnchor

	// Text is anchored in upper left corner.
	UpperLeft = 0,

	// Text is anchored in upper side, centered horizontally.
	UpperCenter = 1,

	// Text is anchored in upper right corner.
	UpperRight = 2,

	// Text is anchored in left side, centered vertically.
	MiddleLeft = 3,

	// Text is centered both horizontally and vertically.
	MiddleCenter = 4,

	// Text is anchored in right side, centered vertically.
	MiddleRight = 5,

	// Text is anchored in lower left corner.
	LowerLeft = 6,

	// Text is anchored in lower side, centered horizontally.
	LowerCenter = 7,

	// Text is anchored in lower right corner.
	LowerRight = 8

END


// A text string displayed in a GUI.
CLASS GUIText : GUIElement

	// The text to display.
	CUSTOM_PROP string text { return scripting_string_new (self->GetText ()); } { self->SetText (value); }

	// The [[Material]] to use for rendering.
	CUSTOM_PROP Material material
	{
		Material* material = self->GetMaterial ();
		if (material == NULL)
			material = GetBuiltinResource<Material> ("Font.mat");

		Material* instantiated = &Material::GetInstantiatedMaterial (material, *self, false);
		if (material != instantiated)
			self->SetMaterial (instantiated);

		return Scripting::ScriptingWrapperFor (instantiated);
	}
	{
		self->SetMaterial (value);
	}

	// Workaround for gcc/msvc where passing small mono structures by value does not work
	CUSTOM private void Internal_GetPixelOffset (out Vector2 output)
	{
		*output = self->GetPixelOffset();
	}
	CUSTOM private void Internal_SetPixelOffset (Vector2 p) { self->SetPixelOffset(p); }

	// The pixel offset of the text.
	CSRAW public Vector2 pixelOffset { get { Vector2 p; Internal_GetPixelOffset(out p); return p; } set { Internal_SetPixelOffset(value); }  }

	// The font used for the text.
	AUTO_PTR_PROP Font font GetFont SetFont

	// The alignment of the text.
	AUTO_PROP TextAlignment alignment GetAlignment SetAlignment

	// The anchor of the text.
	AUTO_PROP TextAnchor anchor GetAnchor SetAnchor

	// The line spacing multiplier.
	AUTO_PROP float lineSpacing GetLineSpacing SetLineSpacing

	// The tab width multiplier.
	AUTO_PROP float tabSize GetTabSize SetTabSize

	// The font size to use (for dynamic fonts)
	AUTO_PROP int fontSize GetFontSize SetFontSize

	// The font style to use (for dynamic fonts)
	AUTO_PROP FontStyle fontStyle GetFontStyle SetFontStyle

	// Enable HTML-style tags for Text Formatting Markup.
	AUTO_PROP bool richText GetRichText SetRichText

	// Color used to render the text
	AUTO_PROP Color color GetColor SetColor
END
// Info how to render a character from the font texture. See /Font.characterInfo/
STRUCT CharacterInfo
	CSRAW
	// Unicode value of the character
	public int index;
	// UV coordinates for the character in the texture
	public Rect	uv;
	// Screen coordinates for the character in generated text meshes
	public Rect	vert;
	// How for to advance between the beginning of this charcater and the next.
	public float width;
	// The size of the character or 0 if it is the default font size.
	public int size;
	// The style of the character.
	public FontStyle style;
	// Is the character flipped?
	public bool	flipped;
END

// Script interface for [[wiki:class-Font|font assets]].
CLASS Font : Object

	CUSTOM private static void Internal_CreateFont ([Writable]Font _font, string name)
	{
		Font* font = NEW_OBJECT (Font);
		SmartResetObject(*font);
		font->SetNameCpp (name);
		Scripting::ConnectScriptingWrapperToObject (_font.GetScriptingObject(), font);
	}

	// Creates a new font.
	CSRAW public Font () { Internal_CreateFont (this,null); }

	// Creates a new font named /name/.
	CSRAW public Font (string name){ Internal_CreateFont (this,name); }

	// The material used for the font display.
	AUTO_PTR_PROP Material material GetMaterial SetMaterial

	// Does this font have a specific character?
	CUSTOM bool HasCharacter (char c) { return self->HasCharacter((int)c);}

	// *undocumented*
	CONDITIONAL ENABLE_MONO || UNITY_WINRT
	CUSTOM_PROP string[] fontNames
	{
		ScriptingArrayPtr arr = CreateScriptingArray<ScriptingStringPtr>(MONO_COMMON.string, self->GetFontNames().size());
		int idx = 0;
		for (UNITY_VECTOR(kMemFont,UnityStr)::const_iterator i = self->GetFontNames().begin(); i != self->GetFontNames().end(); ++i)
		{
			Scripting::SetScriptingArrayElement<ScriptingStringPtr>(arr, idx, scripting_string_new(*i));
			idx++;
		}
		return arr;
	}
	{
		UNITY_VECTOR(kMemFont,UnityStr) names;
		for (int i = 0; i < GetScriptingArraySize(value); ++i)
			names.push_back(scripting_cpp_string_for(Scripting::GetScriptingArrayElementNoRef<ScriptingStringPtr>(value, i)));
		self->SetFontNames(names);
	}

	// Access an array of all characters contained in the font texture.
	CUSTOM_PROP public CharacterInfo[] characterInfo
	{
		const Font::CharacterInfos &infos = self->GetCharacterInfos();
		int size = infos.size();
		ScriptingArrayPtr array = CreateScriptingArray<ScriptingCharacterInfo> (GetScriptingManager().GetCommonClasses().characterInfo, size);
		#if UNITY_WINRT
			for (int i=0; i<size; i++)
			{
				ScriptingCharacterInfo temp; temp.CopyFrom(infos[i]);
				ScriptingObjectPtr data;
				MarshallNativeStructIntoManaged(temp, data);
				Scripting::SetScriptingArrayElement(array, i, data);
			}
		#else
			ScriptingCharacterInfo *sci = Scripting::GetScriptingArrayStart<ScriptingCharacterInfo>(array);
			for (int i=0; i<size; i++)
			{
				sci[i].CopyFrom(infos[i]);
			}
		#endif
		return array;
	}
	{
		Font::CharacterInfos infos;
		int size = GetScriptingArraySize(value);
		infos.resize(size);

		#if UNITY_WINRT
			for (int i=0; i<size; i++)
			{
				ScriptingCharacterInfo temp;
				MarshallManagedStructIntoNative(Scripting::GetScriptingArrayElementNoRef<ScriptingObjectPtr>(value, i), &temp);
				temp.CopyTo(infos[i]);
			}
		#else
			ScriptingCharacterInfo *sci = Scripting::GetScriptingArrayStart<ScriptingCharacterInfo>(value);
			for (int i=0; i<size; i++)
			{
				sci[i].CopyTo(infos[i]);
			}
		#endif
		self->SetCharacterInfos (infos);
	}

	// Request characters to be added to the font texture (dynamic fonts only).

	CUSTOM void RequestCharactersInTexture (string characters, int size = 0, FontStyle style = FontStyle.Normal)
	{
		UTF16String str(characters.AsUTF8().c_str());
		self->CacheFontForText (str.text, str.length, size, style);
	}

	// Callback delegate for use with ::ref::textureRebuildCallback.
	CSRAW public delegate void FontTextureRebuildCallback();
	CSRAW private event FontTextureRebuildCallback m_FontTextureRebuildCallback = null;

	CSRAW private void InvokeFontTextureRebuildCallback_Internal()
	{
		if (m_FontTextureRebuildCallback != null)
			m_FontTextureRebuildCallback();
	}

	// A delegate which gets called when the font texture is rebuilt (dynamic fonts only).
	CSRAW public FontTextureRebuildCallback textureRebuildCallback { get {
			return m_FontTextureRebuildCallback; }
		set { m_FontTextureRebuildCallback = value; }
	}

	// Get rendering info for a specific character
	CUSTOM bool GetCharacterInfo(char ch, out CharacterInfo info, int size = 0, FontStyle style = FontStyle.Normal)
	{
		if (self->HasCharacterInTexture (ch, size, style))
		{
			info->index = ch;
			info->size = size;
			info->style = style;
			self->GetCharacterRenderInfo( ch, size, style, info->vert, info->uv, info->flipped );
			info->width = self->GetCharacterWidth (ch, size, style);
			return true;
		}
		return false;
	}

END


// [[Component]] added to a camera to make it render 2D GUI elements.
CLASS GUILayer : Behaviour
	// Get the GUI element at a specific screen position.
	CUSTOM GUIElement HitTest (Vector3 screenPosition) { return Scripting::ScriptingWrapperFor (self->HitTest (Vector2f (screenPosition.x, screenPosition.y))); }
END

// Renders meshes inserted by the [[MeshFilter]] or [[TextMesh]].
CLASS MeshRenderer : Renderer
END

// StaticBatchingUtility can prepare your objects to take advantage of Unity's static batching.
CONDITIONAL !UNITY_FLASH
CLASS StaticBatchingUtility

	// Combine will prepare all children of the @@staticBatchRoot@@ for static batching.
	CSRAW static public void Combine (GameObject staticBatchRoot)
	{
		InternalStaticBatchingUtility.Combine(staticBatchRoot);
	}

	// Combine will prepare all @@gos@@ for the static batching. @@staticBatchRoot@@ will be treated as their parent.
	CSRAW static public void Combine (GameObject[] gos, GameObject staticBatchRoot)
	{
		InternalStaticBatchingUtility.Combine(gos, staticBatchRoot);
	}


	C++RAW

	struct InternalMonoMeshInstance
	{
		int					meshInstanceID;
		Matrix4x4f			transform;
		Vector4f			lightmapTilingOffset;
	};

	CUSTOM static internal Mesh InternalCombineVertices (MeshSubsetCombineUtility.MeshInstance[] meshes, string meshName)
	{
		const int numMeshes = GetScriptingArraySize( meshes );

		CombineInstances mi;

		mi.resize ( numMeshes );
		InternalMonoMeshInstance* instances = Scripting::GetScriptingArrayStart<InternalMonoMeshInstance>( meshes );
		for ( int i=0; i!=numMeshes; ++i )
		{
			mi[i].mesh = PPtr<Mesh>(instances[i].meshInstanceID);
			mi[i].transform = instances[i].transform;
			mi[i].lightmapTilingOffset = instances[i].lightmapTilingOffset;
		}

		Mesh* outMesh = CreateObjectFromCode<Mesh> (kDefaultAwakeFromLoad);

		CombineMeshVerticesForStaticBatching ( mi, meshName, *outMesh );

		return Scripting::ScriptingWrapperFor( outMesh );
	}

	C++RAW

	struct InternalMonoSubMeshInstance
	{
		int	meshInstanceID;		// public Mesh mesh;
		int vertexOffset;			// public int vertexOffset;
		int goInstanceID;	// public GameObject gameObject;
		int subMeshIndex;			// public int subMeshIndex;
		Matrix4x4f transform;
	};

	CUSTOM static internal void InternalCombineIndices(MeshSubsetCombineUtility.SubMeshInstance[] submeshes, [Writable]Mesh combinedMesh)
	{
		InternalMonoSubMeshInstance* instances = Scripting::GetScriptingArrayStart<InternalMonoSubMeshInstance>( submeshes );
		int numSubMeshes = GetScriptingArraySize( submeshes );
		CombineInstances smi;
		smi.resize( numSubMeshes );

		for( int i=0; i!=numSubMeshes; ++i )
		{
			smi[i].mesh				= PPtr<Mesh>(instances[i].meshInstanceID);
			smi[i].vertexOffset		= instances[i].vertexOffset;
			smi[i].subMeshIndex		= instances[i].subMeshIndex;
			smi[i].transform = instances[i].transform;
		}

		Mesh* mesh = combinedMesh;
		CombineMeshIndicesForStaticBatching (smi, *mesh, false, true);
		mesh->SetIsReadable (false);
		mesh->SetKeepIndices (true);
		// Call awake to create the actual VBO; needed since we did SetIsReadable (false)
		mesh->AwakeFromLoad (kDefaultAwakeFromLoad);
	}
END

// When using HDR rendering it can sometime be desirable to switch to LDR rendering during ImageEffect rendering.
CLASS ImageEffectTransformsToLDR : Attribute

END

// Any Image Effect with this attribute will be rendered after opaque geometry but before transparent geometry.
CLASS ImageEffectOpaque : Attribute

END

CSRAW
}