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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>Kicad Plugins</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
/* Default font. */
body {
font-family: Georgia,serif;
}
/* Title font. */
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
#toctitle,
#author, #revnumber, #revdate, #revremark,
#footer {
font-family: Arial,Helvetica,sans-serif;
}
body {
margin: 1em 5% 1em 5%;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: fuchsia;
}
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
h5 {
font-size: 1.0em;
}
div.sectionbody {
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
ul > li { color: #aaa; }
ul > li > * { color: black; }
pre {
padding: 0;
margin: 0;
}
#author {
color: #527bbd;
font-weight: bold;
font-size: 1.1em;
}
#email {
}
#revnumber, #revdate, #revremark {
}
#footer {
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
#footer-text {
float: left;
padding-bottom: 0.5em;
}
#footer-badges {
float: right;
padding-bottom: 0.5em;
}
#preamble {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.0em;
margin-bottom: 2.0em;
margin-right: 10%;
color: #606060;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid #dddddd;
border-left: 4px solid #f0f0f0;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid #dddddd;
border-left: 5px solid #f0f0f0;
background: #f8f8f8;
padding: 0.5em;
}
div.quoteblock, div.verseblock {
padding-left: 1.0em;
margin-left: 1.0em;
margin-right: 10%;
border-left: 5px solid #f0f0f0;
color: #777777;
}
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock > pre.content {
font-family: inherit;
font-size: inherit;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 3px solid #dddddd;
}
div.exampleblock > div.content {
border-left: 3px solid #dddddd;
padding-left: 0.5em;
}
div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
a.image:visited { color: white; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
.comment {
background: yellow;
}
.footnote, .footnoteref {
font-size: 0.8em;
}
span.footnote, span.footnoteref {
vertical-align: super;
}
#footnotes {
margin: 20px 0 20px 0;
padding: 7px 0 0 0;
}
#footnotes div.footnote {
margin: 0 0 5px 0;
}
#footnotes hr {
border: none;
border-top: 1px solid silver;
height: 1px;
text-align: left;
margin-left: 0;
width: 20%;
min-width: 100px;
}
div.colist td {
padding-right: 0.5em;
padding-bottom: 0.3em;
vertical-align: top;
}
div.colist td img {
margin-top: 0.3em;
}
@media print {
#footer-badges { display: none; }
}
#toc {
margin-bottom: 2.5em;
}
#toctitle {
color: #527bbd;
font-size: 1.1em;
font-weight: bold;
margin-top: 1.0em;
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
span.aqua { color: aqua; }
span.black { color: black; }
span.blue { color: blue; }
span.fuchsia { color: fuchsia; }
span.gray { color: gray; }
span.green { color: green; }
span.lime { color: lime; }
span.maroon { color: maroon; }
span.navy { color: navy; }
span.olive { color: olive; }
span.purple { color: purple; }
span.red { color: red; }
span.silver { color: silver; }
span.teal { color: teal; }
span.white { color: white; }
span.yellow { color: yellow; }
span.aqua-background { background: aqua; }
span.black-background { background: black; }
span.blue-background { background: blue; }
span.fuchsia-background { background: fuchsia; }
span.gray-background { background: gray; }
span.green-background { background: green; }
span.lime-background { background: lime; }
span.maroon-background { background: maroon; }
span.navy-background { background: navy; }
span.olive-background { background: olive; }
span.purple-background { background: purple; }
span.red-background { background: red; }
span.silver-background { background: silver; }
span.teal-background { background: teal; }
span.white-background { background: white; }
span.yellow-background { background: yellow; }
span.big { font-size: 2em; }
span.small { font-size: 0.6em; }
span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }
/*
* xhtml11 specific
*
* */
tt {
font-family: monospace;
font-size: inherit;
color: navy;
}
div.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead, p.table.header {
font-weight: bold;
color: #527bbd;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
/*
* html5 specific
*
* */
.monospaced {
font-family: monospace;
font-size: inherit;
color: navy;
}
table.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
thead, p.tableblock.header {
font-weight: bold;
color: #527bbd;
}
p.tableblock {
margin-top: 0;
}
table.tableblock {
border-width: 3px;
border-spacing: 0px;
border-style: solid;
border-color: #527bbd;
border-collapse: collapse;
}
th.tableblock, td.tableblock {
border-width: 1px;
padding: 4px;
border-style: solid;
border-color: #527bbd;
}
table.tableblock.frame-topbot {
border-left-style: hidden;
border-right-style: hidden;
}
table.tableblock.frame-sides {
border-top-style: hidden;
border-bottom-style: hidden;
}
table.tableblock.frame-none {
border-style: hidden;
}
th.tableblock.halign-left, td.tableblock.halign-left {
text-align: left;
}
th.tableblock.halign-center, td.tableblock.halign-center {
text-align: center;
}
th.tableblock.halign-right, td.tableblock.halign-right {
text-align: right;
}
th.tableblock.valign-top, td.tableblock.valign-top {
vertical-align: top;
}
th.tableblock.valign-middle, td.tableblock.valign-middle {
vertical-align: middle;
}
th.tableblock.valign-bottom, td.tableblock.valign-bottom {
vertical-align: bottom;
}
/*
* manpage specific
*
* */
body.manpage h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
body.manpage h2 {
border-style: none;
}
body.manpage div.sectionbody {
margin-left: 3em;
}
@media print {
body.manpage div#toc { display: none; }
}
/*
* Theme specific overrides of the preceding (asciidoc.css) CSS.
*
*/
body {
font-family: Garamond, Georgia, serif;
font-size: 17px;
color: #3E4349;
line-height: 1.3em;
}
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
#toctitle,
#author, #revnumber, #revdate, #revremark,
#footer {
font-family: Garmond, Georgia, serif;
font-weight: normal;
border-bottom-width: 0;
color: #3E4349;
}
div.title, caption.title { color: #596673; font-weight: bold; }
h1 { font-size: 240%; }
h2 { font-size: 180%; }
h3 { font-size: 150%; }
h4 { font-size: 130%; }
h5 { font-size: 115%; }
h6 { font-size: 100%; }
#header h1 { margin-top: 0; }
#toc {
color: #444444;
line-height: 1.5;
padding-top: 1.5em;
}
#toctitle {
font-size: 20px;
}
#toc a {
border-bottom: 1px dotted #999999;
color: #444444 !important;
text-decoration: none !important;
}
#toc a:hover {
border-bottom: 1px solid #6D4100;
color: #6D4100 !important;
text-decoration: none !important;
}
div.toclevel1 { margin-top: 0.2em; font-size: 16px; }
div.toclevel2 { margin-top: 0.15em; font-size: 14px; }
em, dt, td.hdlist1 { color: black; }
strong { color: #3E4349; }
a { color: #004B6B; text-decoration: none; border-bottom: 1px dotted #004B6B; }
a:visited { color: #615FA0; border-bottom: 1px dotted #615FA0; }
a:hover { color: #6D4100; border-bottom: 1px solid #6D4100; }
div.tableblock > table, table.tableblock { border: 3px solid #E8E8E8; }
th.tableblock, td.tableblock { border: 1px solid #E8E8E8; }
ul > li > * { color: #3E4349; }
pre, tt, .monospaced { font-family: Consolas,Menlo,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace; }
tt, .monospaced { font-size: 0.9em; color: black;
}
div.exampleblock > div.content, div.sidebarblock > div.content, div.listingblock > div.content { border-width: 0 0 0 3px; border-color: #E8E8E8; }
div.verseblock { border-left-width: 0; margin-left: 3em; }
div.quoteblock { border-left-width: 3px; margin-left: 0; margin-right: 0;}
div.admonitionblock td.content { border-left: 3px solid #E8E8E8; }
@media screen {
body {
max-width: 50em; /* approximately 80 characters wide */
margin-left: 16em;
}
#toc {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 13em;
padding: 0.5em;
padding-bottom: 1.5em;
margin: 0;
overflow: auto;
border-right: 3px solid #f8f8f8;
background-color: white;
}
#toc .toclevel1 {
margin-top: 0.5em;
}
#toc .toclevel2 {
margin-top: 0.25em;
display: list-item;
color: #aaaaaa;
}
#toctitle {
margin-top: 0.5em;
}
}
</style>
<script type="text/javascript">
/*<+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
var iterate = function (el) {
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
var mo = re.exec(i.tagName);
if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
}
iterate(i);
}
}
}
iterate(el);
return result;
}
var toc = document.getElementById("toc");
if (!toc) {
return;
}
// Delete existing TOC entries in case we're reloading the TOC.
var tocEntriesToRemove = [];
var i;
for (i = 0; i < toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
if (entry.nodeName.toLowerCase() == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
}
for (i = 0; i < tocEntriesToRemove.length; i++) {
toc.removeChild(tocEntriesToRemove[i]);
}
// Rebuild TOC entries.
var entries = tocEntries(document.getElementById("content"), toclevels);
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
if (entry.element.id == "")
entry.element.id = "_toc_" + i;
var a = document.createElement("a");
a.href = "#" + entry.element.id;
a.appendChild(document.createTextNode(entry.text));
var div = document.createElement("div");
div.appendChild(a);
div.className = "toclevel" + entry.toclevel;
toc.appendChild(div);
}
if (entries.length == 0)
toc.parentNode.removeChild(toc);
},
/////////////////////////////////////////////////////////////////////
// Footnotes generator
/////////////////////////////////////////////////////////////////////
/* Based on footnote generation code from:
* http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
*/
footnotes: function () {
// Delete existing footnote entries in case we're reloading the footnodes.
var i;
var noteholder = document.getElementById("footnotes");
if (!noteholder) {
return;
}
var entriesToRemove = [];
for (i = 0; i < noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
entriesToRemove.push(entry);
}
for (i = 0; i < entriesToRemove.length; i++) {
noteholder.removeChild(entriesToRemove[i]);
}
// Rebuild footnote entries.
var cont = document.getElementById("content");
var spans = cont.getElementsByTagName("span");
var refs = {};
var n = 0;
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnote") {
n++;
var note = spans[i].getAttribute("data-note");
if (!note) {
// Use [\s\S] in place of . so multi-line matches work.
// Because JavaScript has no s (dotall) regex flag.
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
spans[i].innerHTML =
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
spans[i].setAttribute("data-note", note);
}
noteholder.innerHTML +=
"<div class='footnote' id='_footnote_" + n + "'>" +
"<a href='#_footnoteref_" + n + "' title='Return to text'>" +
n + "</a>. " + note + "</div>";
var id =spans[i].getAttribute("id");
if (id != null) refs["#"+id] = n;
}
}
if (n == 0)
noteholder.parentNode.removeChild(noteholder);
else {
// Process footnoterefs.
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnoteref") {
var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
href = href.match(/#.*/)[0]; // Because IE return full URL.
n = refs[href];
spans[i].innerHTML =
"[<a href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
}
}
}
},
install: function(toclevels) {
var timerId;
function reinstall() {
asciidoc.footnotes();
if (toclevels) {
asciidoc.toc(toclevels);
}
}
function reinstallAndRemoveTimer() {
clearInterval(timerId);
reinstall();
}
timerId = setInterval(reinstall, 500);
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
else
window.onload = reinstallAndRemoveTimer;
}
}
asciidoc.install(2);
/*]]>*/
</script>
</head>
<body class="article">
<div id="header">
<h1>Kicad Plugins</h1>
<span id="author">The KiCad Team</span><br>
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</div>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p><em>KiCad Plugin System</em></p></div>
<div class="paragraph" id="copyright"><p><strong>Copyright</strong></p></div>
<div class="paragraph"><p>This document is Copyright © 2016 by it’s contributors as listed below.
You may distribute it and/or modify it under the terms of either the GNU
General Public License (<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>), version 3
or later, or the Creative Commons Attribution License
(<a href="http://creativecommons.org/licenses/by/3.0/">http://creativecommons.org/licenses/by/3.0/</a>), version 3.0 or later.</p></div>
<div class="paragraph"><p>All trademarks within this guide belong to their legitimate owners.</p></div>
<div class="paragraph" id="contributors"><p><strong>Contributors</strong></p></div>
<div class="paragraph"><p>Cirilo Bernardo</p></div>
<div class="paragraph" id="feedback"><p><strong>Feedback</strong></p></div>
<div class="paragraph"><p>Please direct any bug reports, suggestions or new versions to here:</p></div>
<div class="ulist"><ul>
<li>
<p>
About KiCad document: <a href="https://github.com/KiCad/kicad-doc/issues">https://github.com/KiCad/kicad-doc/issues</a>
</p>
</li>
<li>
<p>
About KiCad software: <a href="https://bugs.launchpad.net/kicad">https://bugs.launchpad.net/kicad</a>
</p>
</li>
<li>
<p>
About KiCad software i18n: <a href="https://github.com/KiCad/kicad-i18n/issues">https://github.com/KiCad/kicad-i18n/issues</a>
</p>
</li>
</ul></div>
<div class="paragraph" id="publication_date_and_software_version"><p><strong>Publication date and software version</strong></p></div>
<div class="paragraph"><p>Published on January 29, 2016.</p></div>
<div style="page-break-after:always"></div>
</div>
</div>
<div class="sect1">
<h2 id="_introduction_to_the_kicad_plugin_system">1. Introduction to the KiCad plugin system</h2>
<div class="sectionbody">
<div class="paragraph"><p>The KiCad plugin system is a framework for extending the capabilities
of KiCad using shared libraries. One of the main advantages of using
a plugin is that it is not necessary to rebuild the KiCad suite while
developing a plugin; in fact plugins can be built with the aid of a
very small set of headers from the KiCad source tree. Removing the
requirement to build KiCad during plugin development greatly increases
productivity by ensuring that the developer only compiles code directly
related to the plugin which is being developed and thus reducing the
time required for each build and test cycle.</p></div>
<div class="paragraph"><p>Plugins were initially developed for the 3D model viewer to make it
possible to support more types of 3D models without requiring major
changes to the KiCad source for each new model supported. The plugin
framework was later generalized so that in the future developers can
create different classes of plugins. Currently only 3D plugins are
implemented within KiCad but it is envisioned that a PCB plugin will
eventually be developed to make it possible for users to implement
data Importers and Exporters.</p></div>
<div class="sect2">
<h3 id="REF:PLUGIN_CLASSES">1.1. Plugin Classes</h3>
<div class="paragraph"><p>Plugins are divided into Plugin Classes since each plugin addresses
problems in a specific domain and therefore requires an interface
unique to that domain. For example, the 3D model plugins load 3D
model data from files and translate that data into a format which
can be displayed by the 3D viewer while a PCB Import/Export plugin
would take PCB data and export to other electronics or mechanical
data formats or translate a foreign format into a KiCad PCB. At
the moment only the 3D Plugin Class has been developed and this
will be the focus of this document.</p></div>
<div class="paragraph"><p>Implementing a Plugin Class requires creating code within the KiCad
source tree which manages the loading of plugin code. Within the
KiCad source tree, the file plugins/ldr/pluginldr.h declares the
base class for all plugin loaders. This class declares the most
basic functions which we would expect to find in any KiCad plugin
(boilerplate code) and its implementation provides basic checks
on version compatibility between the plugin loader and the
available plugins. The header plugins/ldr/3d/pluginldr3D.h declares
a loader for the 3D Plugin Class. The loader is responsible for
loading a given plugin and making its functions available to KiCad.
Each instance of a plugin loader represents an actual plugin
implementation and acts as a transparent bridge between kicad and
the plugin’s features. The loader is not the only code required within
KiCad to support plugins; we also need code to discover the plugins
and code to invoke the functions of the plugins via the plugin loader.
In the case of the 3D plugins the discovery and invocation functions
are all contained within the S3D_CACHE class.</p></div>
<div class="paragraph"><p>Plugin developers do not need to be concerned with the details of
KiCad’s internal code for managing plugins unless a new Plugin
Class is being developed; a plugin only needs to define the functions
declared by their specific plugin class.</p></div>
<div class="paragraph"><p>The header include/plugins/kicad_plugin.h declares the generic
functions required of all KiCad plugins; these functions identify
the Plugin Class, provide the name of the specific plugin, provide
version information for the Plugin Class API, provide version
information for the specific plugin, and provides a basic version
compatibility check on the Plugin Class API. In brief, these
functions are:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/* Return a UTF-8 string naming the Plugin Class */</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginClass</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Return version information for the Plugin Class API */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetClassVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Return true if the version check implemented in the plugin</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> determines that the given Plugin Class API is compatible.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CheckClassVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Major<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Minor<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Return the name of the specific plugin, for example "PLUGIN_3D_VRML" */</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginName</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Return version information for the specific plugin */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPluginVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">);</span></tt></pre></div></div>
<div class="sect3">
<h4 id="REF:CLASS_PLUGIN_3D">1.1.1. Plugin Class: PLUGIN_3D</h4>
<div class="paragraph"><p>The header include/plugins/3d/3d_plugin.h declares the functions
which must be implemented by all 3D plugins and defines a number of
functions which are required by the plugin and which the user must
not reimplement. The defined functions which the user must not
reimplement are:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/* Returns the Plugin Class name "PLUGIN_3D" */</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginClass</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Return version information for the PLUGIN_3D API */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetClassVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Performs basic version checks enforced by the developers of</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> the loader for the PLUGIN_3D class and returns true if the</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> checks pass</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CheckClassVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Revision <span style="color: #990000">);</span></tt></pre></div></div>
<div class="paragraph"><p>The functions which the user must implement are as follows:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/* Return the number of extension strings supported by the plugin */</span></span>
<span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">GetNExtensions</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Return the requested extension string; valid values are 0 to</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> GetNExtensions() - 1</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetModelExtension</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Return the total number of file filters supported by the plugin */</span></span>
<span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">GetNFilters</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Return the file filter requested; valid values are 0 to</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> GetNFilters() - 1</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetFileFilter</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Return true if the plugin can render this type of 3D model.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> In some cases a plugin may not yet provide a visual model</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> and must return false.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CanRender</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Load the specified model and return a pointer to its visual model data */</span></span>
SCENEGRAPH<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">Load</span></span><span style="color: #990000">(</span> <span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> aFileName <span style="color: #990000">);</span></tt></pre></div></div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_tutorials_3d_plugin_class">2. Tutorials: 3D Plugin Class</h2>
<div class="sectionbody">
<div class="paragraph"><p>This section contains a description of two very simple plugins of the
PLUGIN_3D class and walks the user through the setup and building of
the code.</p></div>
<div class="sect2">
<h3 id="_tutorial_3d_plugin_demo_1">2.1. Tutorial: 3D Plugin, Demo 1</h3>
<div class="paragraph"><p>This tutorial walks the user through the development of a very basic
3D plugin named “PLUGIN_3D_DEMO1”. The purpose of the tutorial is
to demonstrate the construction of a very basic 3D plugin which does
nothing other than provide a few filter strings which permit the
KiCad user to filter file names while browsing for 3D models. The
code demonstrated here is the absolute minimum requirement for any
3D plugin and can be used as a template for creating more functional
plugins.</p></div>
<div class="paragraph"><p>In order to build the demo project we require the following:</p></div>
<div class="ulist"><ul>
<li>
<p>
CMake
</p>
</li>
<li>
<p>
KiCad plugin headers
</p>
</li>
<li>
<p>
KiCad Scene Graph library, kicad_3dsg
</p>
</li>
</ul></div>
<div class="paragraph"><p>To automatically detect the KiCad headers and library we shall use a
CMake FindPackage script; the script supplied in this tutorial should
work on Linux and MSWindows if the relevant header files are installed
to <span class="monospaced">${KICAD_ROOT_DIR}/kicad</span> and the KiCad Scene Graph library is
installed in <span class="monospaced">${KICAD_ROOT_DIR}/lib</span>.</p></div>
<div class="paragraph"><p>To start let’s create a project directory and the FindPackage script:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>mkdir demo <span style="color: #990000">&&</span> cd demo
<span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">DEMO_ROOT</span><span style="color: #990000">=</span><span style="color: #009900">${PWD}</span>
mkdir CMakeModules <span style="color: #990000">&&</span> cd CMakeModules
cat <span style="color: #990000">></span> FindKICAD<span style="color: #990000">.</span>cmake <span style="color: #990000"><<</span> _EOF
find_path<span style="color: #990000">(</span> KICAD_INCLUDE_DIR kicad/plugins/kicad_plugin<span style="color: #990000">.</span>h
PATHS <span style="color: #009900">${KICAD_ROOT_DIR}</span>/include <span style="color: #009900">$ENV</span>{KICAD_ROOT_DIR}/include
DOC <span style="color: #FF0000">"Kicad plugins header path."</span>
<span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT <span style="color: #009900">${KICAD_INCLUDE_DIR}</span> STREQUAL <span style="color: #FF0000">"KICAD_INCLUDE_DIR-NOTFOUND"</span> <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># attempt to extract the version information from sg_version.h</span></span>
find_file<span style="color: #990000">(</span> KICAD_SGVERSION sg_version<span style="color: #990000">.</span>h
PATHS <span style="color: #009900">${KICAD_INCLUDE_DIR}</span>
PATH_SUFFIXES kicad/plugins<span style="color: #990000">/</span>3dapi
NO_DEFAULT_PATH <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT <span style="color: #009900">${KICAD_SGVERSION}</span> STREQUAL <span style="color: #FF0000">"KICAD_SGVERSION-NOTFOUND"</span> <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># extract the "#define KICADSG_VERSION*" lines</span></span>
file<span style="color: #990000">(</span> STRINGS <span style="color: #009900">${KICAD_SGVERSION}</span> _version REGEX <span style="color: #FF0000">"^#define.*KICADSG_VERSION.*"</span> <span style="color: #990000">)</span>
foreach<span style="color: #990000">(</span> SVAR <span style="color: #009900">${_version}</span> <span style="color: #990000">)</span>
string<span style="color: #990000">(</span> REGEX MATCH KICADSG_VERSION_<span style="color: #990000">[</span>M<span style="color: #990000">,</span>A<span style="color: #990000">,</span>J<span style="color: #990000">,</span>O<span style="color: #990000">,</span>R<span style="color: #990000">,</span>I<span style="color: #990000">,</span>N<span style="color: #990000">,</span>P<span style="color: #990000">,</span>T<span style="color: #990000">,</span>C<span style="color: #990000">,</span>H<span style="color: #990000">,</span>E<span style="color: #990000">,</span>V<span style="color: #990000">,</span>I<span style="color: #990000">,</span>S<span style="color: #990000">]*</span> _VARNAME <span style="color: #009900">${SVAR}</span> <span style="color: #990000">)</span>
string<span style="color: #990000">(</span> REGEX MATCH <span style="color: #990000">[</span><span style="color: #993399">0</span>-<span style="color: #993399">9</span><span style="color: #990000">]+</span> _VALUE <span style="color: #009900">${SVAR}</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT <span style="color: #009900">${_VARNAME}</span> STREQUAL <span style="color: #FF0000">""</span> AND NOT <span style="color: #009900">${_VALUE}</span> STREQUAL <span style="color: #FF0000">""</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> _<span style="color: #009900">${_VARNAME}</span> <span style="color: #009900">${_VALUE}</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
<span style="font-weight: bold"><span style="color: #000000">endforeach()</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#ensure that NOT SG3D_VERSION* will evaluate to '0'</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT _KICADSG_VERSION_MAJOR <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> _KICADSG_VERSION_MAJOR <span style="color: #993399">0</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT _KICADSG_VERSION_MINOR <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> _KICADSG_VERSION_MINOR <span style="color: #993399">0</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT _KICADSG_VERSION_PATCH <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> _KICADSG_VERSION_PATCH <span style="color: #993399">0</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> NOT _KICADSG_VERSION_REVISION <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> _KICADSG_VERSION_REVISION <span style="color: #993399">0</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> KICAD_VERSION <span style="color: #009900">${_KICADSG_VERSION_MAJOR}.${_KICADSG_VERSION_MINOR}.${_KICADSG_VERSION_PATCH}.${_KICADSG_VERSION_REVISION}</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">unset</span></span><span style="color: #990000">(</span> KICAD_SGVERSION CACHE <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
<span style="font-weight: bold"><span style="color: #000000">endif()</span></span>
find_library<span style="color: #990000">(</span> KICAD_LIBRARY
NAMES kicad_3dsg
PATHS
<span style="color: #009900">${KICAD_ROOT_DIR}</span>/lib <span style="color: #009900">$ENV</span>{KICAD_ROOT_DIR}/lib
<span style="color: #009900">${KICAD_ROOT_DIR}</span>/bin <span style="color: #009900">$ENV</span>{KICAD_ROOT_DIR}/bin
DOC <span style="color: #FF0000">"Kicad scenegraph library path."</span>
<span style="color: #990000">)</span>
include<span style="color: #990000">(</span> FindPackageHandleStandardArgs <span style="color: #990000">)</span>
FIND_PACKAGE_HANDLE_STANDARD_ARGS<span style="color: #990000">(</span> KICAD
REQUIRED_VARS
KICAD_INCLUDE_DIR
KICAD_LIBRARY
KICAD_VERSION
VERSION_VAR KICAD_VERSION <span style="color: #990000">)</span>
mark_as_advanced<span style="color: #990000">(</span> KICAD_INCLUDE_DIR <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> KICAD_VERSION_MAJOR <span style="color: #009900">${_KICADSG_VERSION_MAJOR}</span> CACHE INTERNAL <span style="color: #FF0000">""</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> KICAD_VERSION_MINOR <span style="color: #009900">${_KICADSG_VERSION_MINOR}</span> CACHE INTERNAL <span style="color: #FF0000">""</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> KICAD_VERSION_PATCH <span style="color: #009900">${_KICADSG_VERSION_PATCH}</span> CACHE INTERNAL <span style="color: #FF0000">""</span> <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> KICAD_VERSION_TWEAK <span style="color: #009900">${_KICADSG_VERSION_REVISION}</span> CACHE INTERNAL <span style="color: #FF0000">""</span> <span style="color: #990000">)</span>
_EOF</tt></pre></div></div>
<div class="paragraph"><p>Kicad and its plugin headers must be installed; if they are installed
to a user directory or under <span class="monospaced">/opt</span> on Linux, or you are using Windows,
you will need to set the <span class="monospaced">KICAD_ROOT_DIR</span> environment variable to
point to the directory containing the kicad <span class="monospaced">include</span> and <span class="monospaced">lib</span>
directories. For OSX the FindPackage script presented here may require
some adjustments.</p></div>
<div class="paragraph"><p>To configure and build the tutorial code we will use CMake and
create a CMakeLists.txt script file:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cd <span style="color: #009900">${DEMO_ROOT}</span>
cat <span style="color: #990000">></span> CMakeLists<span style="color: #990000">.</span>txt <span style="color: #990000"><<</span> _EOF
<span style="font-style: italic"><span style="color: #9A1900"># declare the name of the project</span></span>
project<span style="color: #990000">(</span> PLUGIN_DEMO <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># check that we have a version of CMake with all required features</span></span>
cmake_minimum_required<span style="color: #990000">(</span> VERSION <span style="color: #993399">2.8</span><span style="color: #990000">.</span><span style="color: #993399">12</span> FATAL_ERROR <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># inform CMake of where to find the FindKICAD script</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">set</span></span><span style="color: #990000">(</span> CMAKE_MODULE_PATH <span style="color: #009900">${PROJECT_SOURCE_DIR}</span>/CMakeModules <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># attempt to discover the installed kicad headers and library</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># and set the variables:</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># KICAD_INCLUDE_DIR</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># KICAD_LIBRARY</span></span>
find_package<span style="color: #990000">(</span> KICAD <span style="color: #993399">1.0</span> REQUIRED <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># add the kicad include directory to the compiler's search path</span></span>
include_directories<span style="color: #990000">(</span> <span style="color: #009900">${KICAD_INCLUDE_DIR}</span>/kicad <span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># create a plugin named s3d_plugin_demo1</span></span>
add_library<span style="color: #990000">(</span> s3d_plugin_demo1 MODULE
src/s3d_plugin_demo1<span style="color: #990000">.</span>cpp
<span style="color: #990000">)</span>
_EOF</tt></pre></div></div>
<div class="paragraph"><p>The first demo project is very basic; it consists of a single file
with no external link dependencies other than the compiler defaults.
We start by creating a source directory:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cd <span style="color: #009900">${DEMO_ROOT}</span>
mkdir src <span style="color: #990000">&&</span> cd src
<span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">DEMO_SRC</span><span style="color: #990000">=</span><span style="color: #009900">${PWD}</span></tt></pre></div></div>
<div class="paragraph"><p>Now we create the plugin source itself:</p></div>
<div class="listingblock">
<div class="title">s3d_plugin_demo1.cpp</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000"><iostream></span>
<span style="font-style: italic"><span style="color: #9A1900">// the 3d_plugin.h header defines the functions required of 3D plugins</span></span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"plugins/3d/3d_plugin.h"</span>
<span style="font-style: italic"><span style="color: #9A1900">// define the version information of this plugin; do not confuse this</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// with the Plugin Class version which is defined in 3d_plugin.h</span></span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO1_MAJOR <span style="color: #993399">1</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO1_MINOR <span style="color: #993399">0</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO1_PATCH <span style="color: #993399">0</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO1_REVNO <span style="color: #993399">0</span>
<span style="font-style: italic"><span style="color: #9A1900">// implement the function which provides users with this plugin's name</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginName</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> <span style="color: #FF0000">"PLUGIN_3D_DEMO1"</span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// implement the function which provides users with this plugin's version</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPluginVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Major <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Major <span style="color: #990000">=</span> PLUGIN_3D_DEMO1_MAJOR<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Minor <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Minor <span style="color: #990000">=</span> PLUGIN_3D_DEMO1_MINOR<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Patch <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Patch <span style="color: #990000">=</span> PLUGIN_3D_DEMO1_PATCH<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Revision <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Revision <span style="color: #990000">=</span> PLUGIN_3D_DEMO1_REVNO<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// number of extensions supported; on *NIX systems the extensions are</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// provided twice - once in lower case and once in upper case letters</span></span>
<span style="font-weight: bold"><span style="color: #000080">#ifdef</span></span> _WIN32
<span style="font-weight: bold"><span style="color: #000080"> #define</span></span> NEXTS <span style="color: #993399">7</span>
<span style="font-weight: bold"><span style="color: #000080">#else</span></span>
<span style="font-weight: bold"><span style="color: #000080"> #define</span></span> NEXTS <span style="color: #993399">14</span>
<span style="font-weight: bold"><span style="color: #000080">#endif</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// number of filter sets supported</span></span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> NFILS <span style="color: #993399">5</span>
<span style="font-style: italic"><span style="color: #9A1900">// define the extension strings and filter strings which this</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// plugin will supply to the user</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext0<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"wrl"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext1<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"x3d"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext2<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"emn"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext3<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"iges"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext4<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"igs"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext5<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"stp"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext6<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"step"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#ifdef</span></span> _WIN32
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil0<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"VRML 1.0/2.0 (*.wrl)|*.wrl"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil1<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"X3D (*.x3d)|*.x3d"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil2<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"IDF 2.0/3.0 (*.emn)|*.emn"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil3<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"IGESv5.3 (*.igs;*.iges)|*.igs;*.iges"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil4<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"STEP (*.stp;*.step)|*.stp;*.step"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#else</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext7<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"WRL"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext8<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"X3D"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext9<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"EMN"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext10<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"IGES"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext11<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"IGS"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext12<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"STP"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext13<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"STEP"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil0<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"VRML 1.0/2.0 (*.wrl;*.WRL)|*.wrl;*.WRL"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil1<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"X3D (*.x3d;*.X3D)|*.x3d;*.X3D"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil2<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"IDF 2.0/3.0 (*.emn;*.EMN)|*.emn;*.EMN"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil3<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"IGESv5.3 (*.igs;*.iges;*.IGS;*.IGES)|*.igs;*.iges;*.IGS;*.IGES"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil4<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"STEP (*.stp;*.step;*.STP;*.STEP)|*.stp;*.step;*.STP;*.STEP"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#endif</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// instantiate a convenient data structure for accessing the</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// lists of extension and filter strings</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="font-weight: bold"><span style="color: #0000FF">struct</span></span> <span style="color: #008080">FILE_DATA</span>
<span style="color: #FF0000">{</span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> extensions<span style="color: #990000">[</span>NEXTS<span style="color: #990000">];</span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> filters<span style="color: #990000">[</span>NFILS<span style="color: #990000">];</span>
<span style="font-weight: bold"><span style="color: #000000">FILE_DATA</span></span><span style="color: #990000">()</span>
<span style="color: #FF0000">{</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext0<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext1<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext2<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext3<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">4</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext4<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">5</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext5<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">6</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext6<span style="color: #990000">;</span>
filters<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> fil0<span style="color: #990000">;</span>
filters<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> fil1<span style="color: #990000">;</span>
filters<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> fil2<span style="color: #990000">;</span>
filters<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> fil3<span style="color: #990000">;</span>
filters<span style="color: #990000">[</span><span style="color: #993399">4</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> fil4<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#ifndef</span></span> _WIN32
extensions<span style="color: #990000">[</span><span style="color: #993399">7</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext7<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">8</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext8<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">9</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext9<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">10</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext10<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">11</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext11<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">12</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext12<span style="color: #990000">;</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">13</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext13<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#endif</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="color: #FF0000">}</span> file_data<span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">// return the number of extensions supported by this plugin</span></span>
<span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">GetNExtensions</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NEXTS<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// return the indexed extension string</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetModelExtension</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> aIndex <span style="color: #990000"><</span> <span style="color: #993399">0</span> <span style="color: #990000">||</span> aIndex <span style="color: #990000">>=</span> NEXTS <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NULL<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> file_data<span style="color: #990000">.</span>extensions<span style="color: #990000">[</span>aIndex<span style="color: #990000">];</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// return the number of filter strings provided by this plugin</span></span>
<span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">GetNFilters</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NFILS<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// return the indexed filter string</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetFileFilter</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> aIndex <span style="color: #990000"><</span> <span style="color: #993399">0</span> <span style="color: #990000">||</span> aIndex <span style="color: #990000">>=</span> NFILS <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NULL<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> file_data<span style="color: #990000">.</span>filters<span style="color: #990000">[</span>aIndex<span style="color: #990000">];</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// return false since this plugin does not provide visualization data</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CanRender</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> false<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// return NULL since this plugin does not provide visualization data</span></span>
SCENEGRAPH<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">Load</span></span><span style="color: #990000">(</span> <span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> aFileName <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-style: italic"><span style="color: #9A1900">// this dummy plugin does not support rendering of any models</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NULL<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span></tt></pre></div></div>
<div class="paragraph"><p>This source file meets all the minimum requirements to implement
a 3D plugin. The plugin does not produce any data for rendering
models but it can provide KiCad with a list of supported model
file extensions and file extension filters to enhance the 3D
model file selection dialog. Within KiCad the extension strings
are used to select the plugins which may be used to load a
specified model; for example if the plugin is <span class="monospaced">wrl</span> then KiCad
will invoke each plugin which claims to support the extension
<span class="monospaced">wrl</span> in turn until a plugin returns visualization data. The
file filters provided by each plugin are passed onto the 3D
file selector dialogs to improve the browsing UI.</p></div>
<div class="paragraph"><p>To build the plugin:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cd <span style="color: #009900">${DEMO_ROOT}</span>
<span style="font-style: italic"><span style="color: #9A1900"># export KICAD_ROOT_DIR if necessary</span></span>
mkdir build <span style="color: #990000">&&</span> cd build
cmake <span style="color: #990000">..</span> <span style="color: #990000">&&</span> make</tt></pre></div></div>
<div class="paragraph"><p>The plugin will be built but not installed; you may copy the
plugin to the same directory in which the kicad installation
has its plugins if you wish to load the plugin.</p></div>
</div>
<div class="sect2">
<h3 id="_tutorial_3d_plugin_demo_2">2.2. Tutorial: 3D Plugin, Demo 2</h3>
<div class="paragraph"><p>This tutorial walks the user through the development of a 3D plugin
named “PLUGIN_3D_DEMO2”. The purpose of the tutorial is to demonstrate
the construction of a very basic scene graph which the kicad previewer
can render. The plugin claims to handle files of type <span class="monospaced">txt</span>. Although
the file must exist in order for the cache manager to invoke the
plugin, the file contents are not processed by this plugin; instead,
the plugin simply creates a scene graph containing a pair of tetrahedra.
This tutorial assumes that the first tutorial had been completed and
that the CMakeLists.txt and FindKICAD.cmake script files have been
created.</p></div>
<div class="paragraph"><p>The new source file shall be placed in the same directory as the
previous tutorial’s source file and we shall extend the previous
tutorial’s CMakeLists.txt file to build this tutorial. Since this
plugin will create a scene graph for KiCad we need to link to
KiCad’s scene graph library <span class="monospaced">kicad_3dsg</span>. KiCad’s Scene Graph
Library provides a set of classes which can be used to build the
Scene Graph Object; the Scene Graph Object is an intermediate
data visualization format used by the 3D Cache Manager. All plugins
which support model visualization must translate the model data into
a scene graph via this library.</p></div>
<div class="paragraph"><p>First step: extend CMakeLists.txt to build this tutorial project:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cd <span style="color: #009900">${DEMO_ROOT}</span>
cat <span style="color: #990000">>></span> CMakeLists<span style="color: #990000">.</span>txt <span style="color: #990000"><<</span> _EOF
add_library<span style="color: #990000">(</span> s3d_plugin_demo2 MODULE
src/s3d_plugin_demo2<span style="color: #990000">.</span>cpp
<span style="color: #990000">)</span>
target_link_libraries<span style="color: #990000">(</span> s3d_plugin_demo2 <span style="color: #009900">${KICAD_LIBRARY}</span> <span style="color: #990000">)</span>
_EOF</tt></pre></div></div>
<div class="paragraph"><p>Now we change to the source directory and create the source file:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cd <span style="color: #009900">${DEMO_SRC}</span></tt></pre></div></div>
<div class="listingblock">
<div class="title">s3d_plugin_demo2.cpp</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000"><cmath></span>
<span style="font-style: italic"><span style="color: #9A1900">// 3D Plugin Class declarations</span></span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"plugins/3d/3d_plugin.h"</span>
<span style="font-style: italic"><span style="color: #9A1900">// interface to KiCad Scene Graph Library</span></span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"plugins/3dapi/ifsg_all.h"</span>
<span style="font-style: italic"><span style="color: #9A1900">// version information for this plugin</span></span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO2_MAJOR <span style="color: #993399">1</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO2_MINOR <span style="color: #993399">0</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO2_PATCH <span style="color: #993399">0</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> PLUGIN_3D_DEMO2_REVNO <span style="color: #993399">0</span>
<span style="font-style: italic"><span style="color: #9A1900">// provide the name of this plugin</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginName</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> <span style="color: #FF0000">"PLUGIN_3D_DEMO2"</span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// provide the version of this plugin</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPluginVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Major <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Major <span style="color: #990000">=</span> PLUGIN_3D_DEMO2_MAJOR<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Minor <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Minor <span style="color: #990000">=</span> PLUGIN_3D_DEMO2_MINOR<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Patch <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Patch <span style="color: #990000">=</span> PLUGIN_3D_DEMO2_PATCH<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> Revision <span style="color: #990000">)</span>
<span style="color: #990000">*</span>Revision <span style="color: #990000">=</span> PLUGIN_3D_DEMO2_REVNO<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// number of extensions supported</span></span>
<span style="font-weight: bold"><span style="color: #000080">#ifdef</span></span> _WIN32
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> NEXTS <span style="color: #993399">1</span>
<span style="font-weight: bold"><span style="color: #000080">#else</span></span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> NEXTS <span style="color: #993399">2</span>
<span style="font-weight: bold"><span style="color: #000080">#endif</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// number of filter sets supported</span></span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> NFILS <span style="color: #993399">1</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext0<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"txt"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#ifdef</span></span> _WIN32
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil0<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"demo (*.txt)|*.txt"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#else</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> ext1<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"TXT"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">char</span> fil0<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"demo (*.txt;*.TXT)|*.txt;*.TXT"</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#endif</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="font-weight: bold"><span style="color: #0000FF">struct</span></span> <span style="color: #008080">FILE_DATA</span>
<span style="color: #FF0000">{</span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> extensions<span style="color: #990000">[</span>NEXTS<span style="color: #990000">];</span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> filters<span style="color: #990000">[</span>NFILS<span style="color: #990000">];</span>
<span style="font-weight: bold"><span style="color: #000000">FILE_DATA</span></span><span style="color: #990000">()</span>
<span style="color: #FF0000">{</span>
extensions<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext0<span style="color: #990000">;</span>
filters<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> fil0<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#ifndef</span></span> _WIN32
extensions<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> ext1<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">#endif</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="color: #FF0000">}</span> file_data<span style="color: #990000">;</span>
<span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">GetNExtensions</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NEXTS<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetModelExtension</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> aIndex <span style="color: #990000"><</span> <span style="color: #993399">0</span> <span style="color: #990000">||</span> aIndex <span style="color: #990000">>=</span> NEXTS <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NULL<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> file_data<span style="color: #990000">.</span>extensions<span style="color: #990000">[</span>aIndex<span style="color: #990000">];</span>
<span style="color: #FF0000">}</span>
<span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">GetNFilters</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NFILS<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetFileFilter</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span><span style="color: #990000">(</span> aIndex <span style="color: #990000"><</span> <span style="color: #993399">0</span> <span style="color: #990000">||</span> aIndex <span style="color: #990000">>=</span> NFILS <span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> NULL<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> file_data<span style="color: #990000">.</span>filters<span style="color: #990000">[</span>aIndex<span style="color: #990000">];</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// return true since this plugin can provide visualization data</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CanRender</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> true<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span>
<span style="font-style: italic"><span style="color: #9A1900">// create the visualization data</span></span>
SCENEGRAPH<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">Load</span></span><span style="color: #990000">(</span> <span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> aFileName <span style="color: #990000">)</span>
<span style="color: #FF0000">{</span>
<span style="font-style: italic"><span style="color: #9A1900">// For this demonstration we create a tetrahedron (tx1) consisting</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// of a SCENEGRAPH (VRML Transform) which in turn contains 4</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// SGSHAPE (VRML Shape) objects representing each of the sides of</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// the tetrahedron. Each Shape is associated with a color (SGAPPEARANCE)</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// and a SGFACESET (VRML Geometry->indexedFaceSet). Each SGFACESET is</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// associated with a vertex list (SGCOORDS), a per-vertex normals</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// list (SGNORMALS), and a coordinate index (SGCOORDINDEX). One shape</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// is used to represent each face so that we may use per-vertex-per-face</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// normals.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// The tetrahedron in turn is a child of a top level SCENEGRAPH (tx0)</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// which has a second SCENEGRAPH child (tx2) which is a transformation</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// of the tetrahedron tx1 (rotation + translation). This demonstrates</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// the reuse of components within the scene graph hierarchy.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// define the vertices of the tetrahedron</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// face 1: 0, 3, 1</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// face 2: 0, 2, 3</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// face 3: 1, 3, 2</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// face 4: 0, 1, 2</span></span>
<span style="color: #009900">double</span> SQ2 <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">sqrt</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.5</span> <span style="color: #990000">);</span>
<span style="color: #008080">SGPOINT</span> vert<span style="color: #990000">[</span><span style="color: #993399">4</span><span style="color: #990000">];</span>
vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">(</span> <span style="color: #993399">1.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #990000">-</span>SQ2 <span style="color: #990000">);</span>
vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">(</span> <span style="color: #990000">-</span><span style="color: #993399">1.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #990000">-</span>SQ2 <span style="color: #990000">);</span>
vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">1.0</span><span style="color: #990000">,</span> SQ2 <span style="color: #990000">);</span>
vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #990000">-</span><span style="color: #993399">1.0</span><span style="color: #990000">,</span> SQ2 <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// create the top level transform; this will hold all other</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// scenegraph objects; a transform may hold other transforms and</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// shapes</span></span>
IFSG_TRANSFORM<span style="color: #990000">*</span> tx0 <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_TRANSFORM</span></span><span style="color: #990000">(</span> true <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// create the transform which will house the shapes</span></span>
IFSG_TRANSFORM<span style="color: #990000">*</span> tx1 <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_TRANSFORM</span></span><span style="color: #990000">(</span> tx0<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">GetRawPtr</span></span><span style="color: #990000">()</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// add a shape which we will use to define one face of the tetrahedron;</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// shapes hold facesets and appearances</span></span>
IFSG_SHAPE<span style="color: #990000">*</span> shape <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_SHAPE</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>tx1 <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// add a faceset; these contain coordinate lists, coordinate indices,</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// vertex lists, vertex indices, and may also contain color lists and</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// their indices.</span></span>
IFSG_FACESET<span style="color: #990000">*</span> face <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_FACESET</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
IFSG_COORDS<span style="color: #990000">*</span> cp <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_COORDS</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// coordinate indices - note: enforce triangles;</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// in real plugins where it is not necessarily possible</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// to determine which side a triangle is visible from,</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 2 point orders must be specified for each triangle</span></span>
IFSG_COORDINDEX<span style="color: #990000">*</span> coordIdx <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_COORDINDEX</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">0</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">1</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">2</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// create an appearance; appearances are owned by shapes</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// magenta</span></span>
IFSG_APPEARANCE<span style="color: #990000">*</span> material <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_APPEARANCE</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape<span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.1</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.1</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.8</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.8</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetShininess</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.2</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// normals</span></span>
IFSG_NORMALS<span style="color: #990000">*</span> np <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_NORMALS</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
<span style="color: #008080">SGVECTOR</span> nval <span style="color: #990000">=</span> S3D<span style="color: #990000">::</span><span style="font-weight: bold"><span style="color: #000000">CalcTriNorm</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// Shape2</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// Note: we reuse the IFSG* wrappers to create and manipulate new</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// data structures.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
shape<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>tx1 <span style="color: #990000">);</span>
face<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// vertices</span></span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// indices</span></span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">0</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">1</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">2</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// normals</span></span>
nval <span style="color: #990000">=</span> S3D<span style="color: #990000">::</span><span style="font-weight: bold"><span style="color: #000000">CalcTriNorm</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// color (red)</span></span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.9</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetShininess</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.1</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// Shape3</span></span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
shape<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>tx1 <span style="color: #990000">);</span>
face<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// vertices</span></span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// indices</span></span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">0</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">1</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">2</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// normals</span></span>
nval <span style="color: #990000">=</span> S3D<span style="color: #990000">::</span><span style="font-weight: bold"><span style="color: #000000">CalcTriNorm</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">3</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// color (green)</span></span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.1</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.9</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetShininess</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.1</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// Shape4</span></span>
<span style="font-style: italic"><span style="color: #9A1900">//</span></span>
shape<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>tx1 <span style="color: #990000">);</span>
face<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>face <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// vertices</span></span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
cp<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// indices</span></span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">0</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">1</span> <span style="color: #990000">);</span>
coordIdx<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #993399">2</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// normals</span></span>
nval <span style="color: #990000">=</span> S3D<span style="color: #990000">::</span><span style="font-weight: bold"><span style="color: #000000">CalcTriNorm</span></span><span style="color: #990000">(</span> vert<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">],</span> vert<span style="color: #990000">[</span><span style="color: #993399">2</span><span style="color: #990000">]</span> <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
np<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> nval <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// color (blue)</span></span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>shape <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.1</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.0</span><span style="color: #990000">,</span> <span style="color: #993399">0.9</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span><span style="color: #990000">,</span> <span style="color: #993399">0.2</span> <span style="color: #990000">);</span>
material<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetShininess</span></span><span style="color: #990000">(</span> <span style="color: #993399">0.1</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// create a copy of the entire tetrahedron shifted Z+2 and rotated 2/3PI</span></span>
IFSG_TRANSFORM<span style="color: #990000">*</span> tx2 <span style="color: #990000">=</span> <span style="color: #008080">new</span> <span style="font-weight: bold"><span style="color: #000000">IFSG_TRANSFORM</span></span><span style="color: #990000">(</span> tx0<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">GetRawPtr</span></span><span style="color: #990000">()</span> <span style="color: #990000">);</span>
tx2<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">AddRefNode</span></span><span style="color: #990000">(</span> <span style="color: #990000">*</span>tx1 <span style="color: #990000">);</span>
tx2<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetTranslation</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">(</span> <span style="color: #993399">0</span><span style="color: #990000">,</span> <span style="color: #993399">0</span><span style="color: #990000">,</span> <span style="color: #993399">2</span> <span style="color: #990000">)</span> <span style="color: #990000">);</span>
tx2<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">SetRotation</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #000000">SGVECTOR</span></span><span style="color: #990000">(</span> <span style="color: #993399">0</span><span style="color: #990000">,</span> <span style="color: #993399">0</span><span style="color: #990000">,</span> <span style="color: #993399">1</span> <span style="color: #990000">),</span> M_PI<span style="color: #990000">*</span><span style="color: #993399">2.0</span><span style="color: #990000">/</span><span style="color: #993399">3.0</span> <span style="color: #990000">);</span>
SGNODE<span style="color: #990000">*</span> data <span style="color: #990000">=</span> tx0<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">GetRawPtr</span></span><span style="color: #990000">();</span>
<span style="font-style: italic"><span style="color: #9A1900">// delete the wrappers</span></span>
<span style="color: #008080">delete</span> shape<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> face<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> coordIdx<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> material<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> cp<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> np<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> tx0<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> tx1<span style="color: #990000">;</span>
<span style="color: #008080">delete</span> tx2<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> <span style="color: #990000">(</span>SCENEGRAPH<span style="color: #990000">*)</span>data<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span></tt></pre></div></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_application_programming_interface_api">3. Application Programming Interface (API)</h2>
<div class="sectionbody">
<div class="paragraph"><p>Plugins are implemented via Application Programming Interface (API)
implementations. Each Plugin Class has its specific API and in the
3D Plugin tutorials we have seen examples of the implementation of
the 3D Plugin API as declared by the header 3d_plugin.h. Plugins
may also rely on other APIs defined within the KiCad source tree;
in the case of 3D plugins, all plugins which support visualization
of models must interact with the Scene Graph API as declared in
the header ifsg_all.h and its included headers.</p></div>
<div class="paragraph"><p>This section describes the details of available Plugin Class APIs
and other KiCad APIs which may be required for implementations of
plugin classes.</p></div>
<div class="sect2">
<h3 id="_plugin_class_apis">3.1. Plugin Class APIs</h3>
<div class="paragraph"><p>There is currently only one plugin class declared for KiCad and
this is the 3D Plugin Class. All KiCad plugin classes must implement
a basic set of functions declared in the header file kicad_plugin.h;
these declarations shall be referred to as the Base Kicad Plugin Class.
No implementation of the Base Kicad Plugin Class exists; the header file
exists purely to ensure that plugin developers implement these
defined functions in each plugin implementation.</p></div>
<div class="paragraph"><p>Within KiCad, each instance of a Plugin Loader implements the API
presented by a plugin as though the Plugin Loader is a class providing
the plugin’s services. This is achieved by the Plugin Loader class
providing a public interface containing function names which are
similar to those implemented by the plugin; the argument lists may
vary to accommodate the need to inform the user of any problems which
may be encountered if, for example, no plugin is loaded. Internally
the Plugin Loader uses a stored pointer to each API function to
invoke each function on behalf of the user.</p></div>
<div class="sect3">
<h4 id="_api_base_kicad_plugin_class">3.1.1. API: Base Kicad Plugin Class</h4>
<div class="paragraph"><p>The Base Kicad Plugin Class is defined by the header file kicad_plugin.h.
This header must be included in the declaration of all other plugin
classes; for example see the 3D Plugin Class declaration in the
header file 3d_plugin.h. The prototypes for these functions were briefly
described in <a href="#REF:PLUGIN_CLASSES">Plugin Classes</a>. The API is implemented
by the base plugin loader as defined in pluginldr.cpp.</p></div>
<div class="paragraph"><p>To help make sense of the functions required by the base kicad plugin header
we must look at what happens in the base Plugin Loader class. The Plugin
Loader class declares a virtual function <span class="monospaced">Open()</span> which takes the full
path to the plugin to be loaded. The implementation of the <span class="monospaced">Open()</span> function
within a specific plugin class loader will initially invoke the protected
<span class="monospaced">open()</span> function of the base plugin loader; this base <span class="monospaced">open()</span> function
attempts to find the address of each of the required basic plugin functions;
once the addresses of each function have been retrieved, a number of checks
are enforced:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Plugin <span class="monospaced">GetKicadPluginClass()</span> is invoked and the result is compared to
the Plugin Class string provided by the Plugin Loader implementation; if
these strings do not match then the opened plugin is not intended for the
Plugin Loader instance.
</p>
</li>
<li>
<p>
Plugin <span class="monospaced">GetClassVersion()</span> is invoked to retrieve the Plugin Class API Version
implemented by the plugin.
</p>
</li>
<li>
<p>
Plugin Loader virtual <span class="monospaced">GetLoaderVersion()</span> function is invoked to retrieve the
Plugin Class API Version implemented by the loader
</p>
</li>
<li>
<p>
The Plugin Class API Version reported by the plugin and the loader are
required to have the same Major Version number, otherwise they are
considered incompatible. This is the most basic version test and it is
enforced by the base plugin loader.
</p>
</li>
<li>
<p>
Plugin <span class="monospaced">CheckClassVersion()</span> is invoked with the Plugin Class API Version
information of the Plugin Loader; if the Plugin supports the given version
then it returns <span class="monospaced">true</span> to indicate success, in which case the loader creates
a PluginInfo string based on the results of <span class="monospaced">GetKicadPluginName()</span> and
<span class="monospaced">GetPluginVersion()</span>, and the plugin loading procedure
continues within the Plugin Loader’s <span class="monospaced">Open()</span> implementation.
</p>
</li>
</ol></div>
</div>
<div class="sect3">
<h4 id="_api_3d_plugin_class">3.1.2. API: 3D Plugin Class</h4>
<div class="paragraph"><p>The 3D Plugin Class is declared by the header file 3d_plugin.h and it
extends the required plugin functions as described in
<a href="#REF:CLASS_PLUGIN_3D">Plugin Class: PLUGIN_3D</a>. The corresponding
Plugin Loader is defined in pluginldr3D.cpp and the loader implements
the following public functions in addition to the required API functions:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/* Open the plugin specified by the full path "aFullFileName" */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">Open</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> wxString<span style="color: #990000">&</span> aFullFileName <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Close the currently opened plugin */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">Close</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* Retrieve the Plugin Class API Version implemented by this Plugin Loader */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetLoaderVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p>The required 3D Plugin Class functions are exposed via the
following functions:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/* returns the Plugin Class or NULL if no plugin loaded */</span></span>
<span style="color: #009900">char</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginClass</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* returns false if no plugin loaded */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">GetClassVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* returns false if the class version check fails or no plugin is loaded */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CheckClassVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* returns the Plugin Name or NULL if no plugin loaded */</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetKicadPluginName</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> returns false if no plugin is loaded, otherwise the arguments</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> contain the result of GetPluginVersion()</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">GetVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> sets aPluginInfo to an empty string if no plugin is loaded,</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> otherwise aPluginInfo is set to a string of the form:</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> [NAME]:[MAJOR].[MINOR].[PATCH].[REVISION] where</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> NAME = name provided by GetKicadPluginClass()</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> MAJOR, MINOR, PATCH, REVISION = version information from</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> GetPluginVersion()</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPluginInfo</span></span><span style="color: #990000">(</span> std<span style="color: #990000">::</span>string<span style="color: #990000">&</span> aPluginInfo <span style="color: #990000">);</span></tt></pre></div></div>
<div class="paragraph"><p>In typical situations, the user would do the following:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Create an instance of <span class="monospaced">KICAD_PLUGIN_LDR_3D</span>
</p>
</li>
<li>
<p>
Invoke <span class="monospaced">Open( "/path/to/myplugin.so" )</span> to open a specific plugin;
the return value must be checked to ensure that the plugin loaded
as desired.
</p>
</li>
<li>
<p>
Invoke any of the 3D Plugin Class calls as exposed by <span class="monospaced">KICAD_PLUGIN_LDR_3D</span>
</p>
</li>
<li>
<p>
Invoke <span class="monospaced">Close()</span> to close (unlink) the plugin
</p>
</li>
<li>
<p>
Destroy the <span class="monospaced">KICAD_PLUGIN_LDR_3D</span> instance
</p>
</li>
</ol></div>
</div>
</div>
<div class="sect2">
<h3 id="_scenegraph_class_apis">3.2. Scenegraph Class APIs</h3>
<div class="paragraph"><p>The Scenegraph Class API is defined by the header <span class="monospaced">ifsg_all.h</span> and its
included headers. The API consists of a number of helper routines with
the namespace <span class="monospaced">S3D</span> as defined in <span class="monospaced">ifsg_api.h</span> and wrapper classes defined
by the various <span class="monospaced">ifsg_*.h</span> headers; the wrappers support the underlying
scene graph classes which, taken together, form a scene graph structure
which is compatible with VRML2.0 static scene graphs. The headers,
structures, classes and their public functions are as follows:</p></div>
<div class="listingblock">
<div class="title">sg_version.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Defines version information of the SceneGraph Classes.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> All plugins which use the scenegraph class should include this header</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> and check the version information against the version reported by</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> S3D::GetLibVersion() to ensure compatibility</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> KICADSG_VERSION_MAJOR <span style="color: #993399">2</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> KICADSG_VERSION_MINOR <span style="color: #993399">0</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> KICADSG_VERSION_PATCH <span style="color: #993399">0</span>
<span style="font-weight: bold"><span style="color: #000080">#define</span></span> KICADSG_VERSION_REVISION <span style="color: #993399">0</span></tt></pre></div></div>
<div class="listingblock">
<div class="title">sg_types.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> Defines the SceneGraph Class Types; these types</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> are closely related to VRML2.0 node types.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
namespace S3D
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">enum</span></span> SGTYPES
<span style="color: #FF0000">{</span>
SGTYPE_TRANSFORM <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">,</span>
SGTYPE_APPEARANCE<span style="color: #990000">,</span>
SGTYPE_COLORS<span style="color: #990000">,</span>
SGTYPE_COLORINDEX<span style="color: #990000">,</span>
SGTYPE_FACESET<span style="color: #990000">,</span>
SGTYPE_COORDS<span style="color: #990000">,</span>
SGTYPE_COORDINDEX<span style="color: #990000">,</span>
SGTYPE_NORMALS<span style="color: #990000">,</span>
SGTYPE_SHAPE<span style="color: #990000">,</span>
SGTYPE_END
<span style="color: #FF0000">}</span><span style="color: #990000">;</span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p>The <span class="monospaced">sg_base.h</span> header contains declarations of basic data types used
by the scenegraph classes.</p></div>
<div class="listingblock">
<div class="title">sg_base.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> This is an RGB color model equivalent to the VRML2.0</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> RGB model where each color may have a value within the</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> range [0..1].</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
class SGCOLOR
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">SGCOLOR</span></span><span style="color: #990000">();</span>
<span style="font-weight: bold"><span style="color: #000000">SGCOLOR</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aRVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aGVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aBVal <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetColor</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span><span style="color: #990000">&</span> aRedVal<span style="color: #990000">,</span> <span style="color: #009900">float</span><span style="color: #990000">&</span> aGreenVal<span style="color: #990000">,</span> <span style="color: #009900">float</span><span style="color: #990000">&</span> aBlueVal <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetColor</span></span><span style="color: #990000">(</span> SGCOLOR<span style="color: #990000">&</span> aColor <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetColor</span></span><span style="color: #990000">(</span> SGCOLOR<span style="color: #990000">*</span> aColor <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetColor</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aRedVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aGreenVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aBlueVal <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetColor</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">&</span> aColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetColor</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">*</span> aColor <span style="color: #990000">);</span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span>
class SGPOINT
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="color: #009900">double</span> x<span style="color: #990000">;</span>
<span style="color: #009900">double</span> y<span style="color: #990000">;</span>
<span style="color: #009900">double</span> z<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">();</span>
<span style="font-weight: bold"><span style="color: #000000">SGPOINT</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aXVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aYVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aZVal <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPoint</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span><span style="color: #990000">&</span> aXVal<span style="color: #990000">,</span> <span style="color: #009900">double</span><span style="color: #990000">&</span> aYVal<span style="color: #990000">,</span> <span style="color: #009900">double</span><span style="color: #990000">&</span> aZVal <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPoint</span></span><span style="color: #990000">(</span> SGPOINT<span style="color: #990000">&</span> aPoint <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetPoint</span></span><span style="color: #990000">(</span> SGPOINT<span style="color: #990000">*</span> aPoint <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">SetPoint</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aXVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aYVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aZVal <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">SetPoint</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> aPoint <span style="color: #990000">);</span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">/*</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> A SGVECTOR has 3 components (x,y,z) similar to a point; however</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> a vector ensures that the stored values are normalized and</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> prevents direct manipulation of the component variables.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
class SGVECTOR
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">SGVECTOR</span></span><span style="color: #990000">();</span>
<span style="font-weight: bold"><span style="color: #000000">SGVECTOR</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aXVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aYVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aZVal <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">GetVector</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span><span style="color: #990000">&</span> aXVal<span style="color: #990000">,</span> <span style="color: #009900">double</span><span style="color: #990000">&</span> aYVal<span style="color: #990000">,</span> <span style="color: #009900">double</span><span style="color: #990000">&</span> aZVal <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">SetVector</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aXVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aYVal<span style="color: #990000">,</span> <span style="color: #009900">double</span> aZVal <span style="color: #990000">);</span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">SetVector</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGVECTOR<span style="color: #990000">&</span> aVector <span style="color: #990000">);</span>
SGVECTOR<span style="color: #990000">&</span> operator<span style="color: #990000">=(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGVECTOR<span style="color: #990000">&</span> source <span style="color: #990000">);</span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p>The <span class="monospaced">IFSG_NODE</span> class is the base class for all scenegraph nodes. All
scenegraph objects implement the public functions of this class but in
some cases a particular function may have no meaning for a specific
class.</p></div>
<div class="listingblock">
<div class="title">ifsg_node.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="color: #008080">class</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_NODE</span></span><span style="color: #990000">();</span>
virtual <span style="color: #990000">~</span><span style="font-weight: bold"><span style="color: #000000">IFSG_NODE</span></span><span style="color: #990000">();</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Destroy</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * deletes the scenegraph object held by this wrapper</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">Destroy</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Attach</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * associates a given SGNODE* with this wrapper</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
virtual <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">Attach</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">)</span> <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function NewNode</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * creates a new node to associate with this wrapper</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
virtual <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">)</span> <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
virtual <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">NewNode</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">)</span> <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function GetRawPtr()</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * returns the raw internal SGNODE pointer</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGNODE<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetRawPtr</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function GetNodeType</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * returns the type of this node instance</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
S3D<span style="color: #990000">::</span><span style="color: #008080">SGTYPES</span> <span style="font-weight: bold"><span style="color: #000000">GetNodeType</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function GetParent</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * returns a pointer to the parent SGNODE of this object</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * or NULL if the object has no parent (ie. top level transform)</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * or if the wrapper is not currently associated with an SGNODE.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGNODE<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetParent</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function SetParent</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * sets the parent SGNODE of this object.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aParent [in] is the desired parent node</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> true if the operation succeeds; false if</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * the given node is not allowed to be a parent to</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * the derived object.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetParent</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function GetNodeTypeName</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * returns the text representation of the node type</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * or NULL if the node somehow has an invalid type</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span> <span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetNodeTypeName</span></span><span style="color: #990000">(</span> S3D<span style="color: #990000">::</span><span style="color: #008080">SGTYPES</span> aNodeType <span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span><span style="color: #990000">;</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function AddRefNode</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * adds a reference to an existing node which is not owned by</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * (not a child of) this node.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> true on success</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddRefNode</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddRefNode</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aNode <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function AddChildNode</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * adds a node as a child owned by this node.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> true on success</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddChildNode</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddChildNode</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aNode <span style="color: #990000">);</span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_TRANSFORM</span> is similar to a VRML2.0 Transform node; it may
contain any number of child IFSG_SHAPE and IFSG_TRANSFORM nodes
and any number of referenced IFSG_SHAPE and IFSG_TRANSFORM nodes.
A valid scenegraph must have a single <span class="monospaced">IFSG_TRANSFORM</span> object
as a root.</p></div>
<div class="listingblock">
<div class="title">ifsg_transform.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_TRANSFORM</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_TRANSFORM <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_TRANSFORM</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_TRANSFORM</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetScaleOrientation</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGVECTOR<span style="color: #990000">&</span> aScaleAxis<span style="color: #990000">,</span> <span style="color: #009900">double</span> aAngle <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetRotation</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGVECTOR<span style="color: #990000">&</span> aRotationAxis<span style="color: #990000">,</span> <span style="color: #009900">double</span> aAngle <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetScale</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> aScale <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetScale</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aScale <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetCenter</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> aCenter <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetTranslation</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> aTranslation <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_SHAPE</span> is similar to a VRML2.0 Shape node; it must contain
a single child or reference FACESET node and may contain a
single child or reference APPEARANCE node.</p></div>
<div class="listingblock">
<div class="title">ifsg_shape.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_SHAPE</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for the SGSHAPE class</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_SHAPE <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_SHAPE</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_SHAPE</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_SHAPE</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_APPEARANCE</span> is similar to a VRML2.0 Appearance node, however
at the moment it only represents the equivalent of an Appearance
node containing a Material node.</p></div>
<div class="listingblock">
<div class="title">ifsg_appearance.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="color: #008080">class</span> IFSG_APPEARANCE <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_APPEARANCE</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_APPEARANCE</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_APPEARANCE</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetEmissive</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aRVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aGVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aBVal <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetEmissive</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">*</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetEmissive</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">&</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aRVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aGVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aBVal <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">*</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetDiffuse</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">&</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aRVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aGVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aBVal <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">*</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetSpecular</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">&</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aRVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aGVal<span style="color: #990000">,</span> <span style="color: #009900">float</span> aBVal <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">*</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetAmbient</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">&</span> aRGBColor <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetShininess</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aShininess <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetTransparency</span></span><span style="color: #990000">(</span> <span style="color: #009900">float</span> aTransparency <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/* the following functions make no sense within an</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> appearance node and always return a failure code</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_FACESET</span> is similar to a VRML2.0 Geometry node which
contains an IndexedFaceSet node. It must contain a single
child or reference COORDS node, a single child COORDINDEX
node, and a single child or reference NORMALS node; in
addition there may be a single child or reference COLORS node.
A simplistic normals calculation function is provided to aid
the user in assigning normal values to surfaces. The deviations
from the VRML2.0 analogue are as follows:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
normals are always per-vertex
</p>
</li>
<li>
<p>
colors are always per vertex
</p>
</li>
<li>
<p>
the coordinate index set must describe triangular faces only
</p>
</li>
</ol></div>
<div class="listingblock">
<div class="title">ifsg_faceset.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_FACESET</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for the SGFACESET class</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_FACESET <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_FACESET</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_FACESET</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_FACESET</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">CalcNormals</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">**</span> aPtr <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="listingblock">
<div class="title">ifsg_coords.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_COORDS</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for SGCOORDS</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_COORDS <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COORDS</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COORDS</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COORDS</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">GetCoordsList</span></span><span style="color: #990000">(</span> size_t<span style="color: #990000">&</span> aListSize<span style="color: #990000">,</span> SGPOINT<span style="color: #990000">*&</span> aCoordsList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetCoordsList</span></span><span style="color: #990000">(</span> <span style="color: #008080">size_t</span> aListSize<span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">*</span> aCoordsList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aXValue<span style="color: #990000">,</span> <span style="color: #009900">double</span> aYValue<span style="color: #990000">,</span> <span style="color: #009900">double</span> aZValue <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddCoord</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> aPoint <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/* the following functions make no sense within a</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> coords node and always return a failure code</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_COORDINDEX</span> is similar to a VRML2.0 coordIdx[]
set; however it must exclusively describe triangular
faces, which implies that the total number of indices
is divisible by 3.</p></div>
<div class="listingblock">
<div class="title">ifsg_coordindex.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_COORDINDEX</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for SGCOORDINDEX</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_COORDINDEX <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_INDEX
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COORDINDEX</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COORDINDEX</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COORDINDEX</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">GetIndices</span></span><span style="color: #990000">(</span> size_t<span style="color: #990000">&</span> nIndices<span style="color: #990000">,</span> <span style="color: #009900">int</span><span style="color: #990000">*&</span> aIndexList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetIndices</span></span><span style="color: #990000">(</span> <span style="color: #008080">size_t</span> nIndices<span style="color: #990000">,</span> <span style="color: #009900">int</span><span style="color: #990000">*</span> aIndexList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddIndex</span></span><span style="color: #990000">(</span> <span style="color: #009900">int</span> aIndex <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/* the following functions make no sense within a</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> coordindex node and always return a failure code</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_NORMALS</span> is equivalent to a VRML2.0 Normals node.</p></div>
<div class="listingblock">
<div class="title">ifsg_normals.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_NORMALS</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for the SGNORMALS class</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_NORMALS <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_NORMALS</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_NORMALS</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_NORMALS</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">GetNormalList</span></span><span style="color: #990000">(</span> size_t<span style="color: #990000">&</span> aListSize<span style="color: #990000">,</span> SGVECTOR<span style="color: #990000">*&</span> aNormalList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetNormalList</span></span><span style="color: #990000">(</span> <span style="color: #008080">size_t</span> aListSize<span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGVECTOR<span style="color: #990000">*</span> aNormalList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aXValue<span style="color: #990000">,</span> <span style="color: #009900">double</span> aYValue<span style="color: #990000">,</span> <span style="color: #009900">double</span> aZValue <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddNormal</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGVECTOR<span style="color: #990000">&</span> aNormal <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/* the following functions make no sense within a</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> normals node and always return a failure code</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p><span class="monospaced">IFSG_COLORS</span> is similar to a VRML2.0 colors[] set.</p></div>
<div class="listingblock">
<div class="title">ifsg_colors.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Class IFSG_COLORS</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * is the wrapper for SGCOLORS</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">class</span> IFSG_COLORS <span style="color: #990000">:</span> <span style="color: #008080">public</span> IFSG_NODE
<span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #008080">public:</span></span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COLORS</span></span><span style="color: #990000">(</span> <span style="color: #009900">bool</span> create <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COLORS</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent <span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #000000">IFSG_COLORS</span></span><span style="color: #990000">(</span> IFSG_NODE<span style="color: #990000">&</span> aParent <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">GetColorList</span></span><span style="color: #990000">(</span> size_t<span style="color: #990000">&</span> aListSize<span style="color: #990000">,</span> SGCOLOR<span style="color: #990000">*&</span> aColorList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">SetColorList</span></span><span style="color: #990000">(</span> <span style="color: #008080">size_t</span> aListSize<span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">*</span> aColorList <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddColor</span></span><span style="color: #990000">(</span> <span style="color: #009900">double</span> aRedValue<span style="color: #990000">,</span> <span style="color: #009900">double</span> aGreenValue<span style="color: #990000">,</span> <span style="color: #009900">double</span> aBlueValue <span style="color: #990000">);</span>
<span style="color: #009900">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddColor</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGCOLOR<span style="color: #990000">&</span> aColor <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/* various base class functions not shown here */</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/* the following functions make no sense within a</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> normals node and always return a failure code</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddRefNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( SGNODE* aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> bool AddChildNode( IFSG_NODE& aNode );</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p>The remaining API functions are defined in <span class="monospaced">ifsg_api.h</span> as follows:</p></div>
<div class="listingblock">
<div class="title">ifsg_api.h</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>namespace S3D
<span style="color: #FF0000">{</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function GetLibVersion retrieves version information of the</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * kicad_3dsg library</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">GetLibVersion</span></span><span style="color: #990000">(</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Major<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Minor<span style="color: #990000">,</span>
<span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Patch<span style="color: #990000">,</span> <span style="color: #009900">unsigned</span> <span style="color: #009900">char</span><span style="color: #990000">*</span> Revision <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// functions to extract information from SGNODE pointers</span></span>
<span style="color: #008080">SGLIB_API</span> S3D<span style="color: #990000">::</span><span style="color: #008080">SGTYPES</span> <span style="font-weight: bold"><span style="color: #000000">GetSGNodeType</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="color: #008080">SGLIB_API</span> SGNODE<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetSGNodeParent</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
SGLIB_API <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddSGNodeRef</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent<span style="color: #990000">,</span> SGNODE<span style="color: #990000">*</span> aChild <span style="color: #990000">);</span>
SGLIB_API <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">AddSGNodeChild</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aParent<span style="color: #990000">,</span> SGNODE<span style="color: #990000">*</span> aChild <span style="color: #990000">);</span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">AssociateSGNodeWrapper</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aObject<span style="color: #990000">,</span> SGNODE<span style="color: #990000">**</span> aRefPtr <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function CalcTriNorm</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * returns the normal vector of a triangle described by vertices p1, p2, p3</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">SGVECTOR</span> <span style="font-weight: bold"><span style="color: #000000">CalcTriNorm</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> p1<span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> p2<span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> SGPOINT<span style="color: #990000">&</span> p3 <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function WriteCache</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * writes the SGNODE tree to a binary cache file</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aFileName is the name of the file to write</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> overwrite must be set to true to overwrite an existing file</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aNode is any node within the node tree which is to be written</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> true on success</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">WriteCache</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> aFileName<span style="color: #990000">,</span> <span style="color: #009900">bool</span> overwrite<span style="color: #990000">,</span> SGNODE<span style="color: #990000">*</span> aNode<span style="color: #990000">,</span>
<span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> aPluginInfo <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function ReadCache</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * reads a binary cache file and creates an SGNODE tree</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aFileName is the name of the binary cache file to be read</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> NULL on failure, on success a pointer to the top level SCENEGRAPH node;</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * if desired this node can be associated with an IFSG_TRANSFORM wrapper via</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * the IFSG_TRANSFORM::Attach() function.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">SGLIB_API</span> SGNODE<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">ReadCache</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> aFileName<span style="color: #990000">,</span> <span style="color: #009900">void</span><span style="color: #990000">*</span> aPluginMgr<span style="color: #990000">,</span>
<span style="color: #009900">bool</span> <span style="color: #990000">(*</span>aTagCheck<span style="color: #990000">)(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*,</span> <span style="color: #009900">void</span><span style="color: #990000">*</span> <span style="color: #990000">)</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function WriteVRML</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * writes out the given node and its subnodes to a VRML2 file</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> filename is the name of the output file</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> overwrite should be set to true to overwrite an existing VRML file</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aTopNode is a pointer to a SCENEGRAPH object representing the VRML scene</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> reuse should be set to true to make use of VRML DEF/USE features</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> true on success</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">bool</span> <span style="font-weight: bold"><span style="color: #000000">WriteVRML</span></span><span style="color: #990000">(</span> <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> <span style="color: #009900">char</span><span style="color: #990000">*</span> filename<span style="color: #990000">,</span> <span style="color: #009900">bool</span> overwrite<span style="color: #990000">,</span> SGNODE<span style="color: #990000">*</span> aTopNode<span style="color: #990000">,</span>
<span style="color: #009900">bool</span> reuse<span style="color: #990000">,</span> <span style="color: #009900">bool</span> renameNodes <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// NOTE: The following functions are used in combination to create a VRML</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// assembly which may use various instances of each SG* representation of a module.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// A typical use case would be:</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 1. invoke 'ResetNodeIndex()' to reset the global node name indices</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 2. for each model pointer provided by 'S3DCACHE->Load()', invoke 'RenameNodes()' once;</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// this ensures that all nodes have a unique name to present to the final output file.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// Internally, RenameNodes() will only rename the given node and all Child subnodes;</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// nodes which are only referenced will not be renamed. Using the pointer supplied</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// by 'S3DCACHE->Load()' ensures that all nodes but the returned node (top node) are</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// children of at least one node, so all nodes are given unique names.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 3. if SG* trees are created independently of S3DCACHE->Load() the user must invoke</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// RenameNodes() as appropriate to ensure that all nodes have a unique name</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 4. create an assembly structure by creating new IFSG_TRANSFORM nodes as appropriate</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// for each instance of a component; the component base model as returned by</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// S3DCACHE->Load() may be added to these IFSG_TRANSFORM nodes via 'AddRefNode()';</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// set the offset, rotation, etc of the IFSG_TRANSFORM node to ensure correct</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 5. Ensure that all new IFSG_TRANSFORM nodes are placed as child nodes within a</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// top level IFSG_TRANSFORM node in preparation for final node naming and output</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 6. Invoke RenameNodes() on the top level assembly node</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 7. Invoke WriteVRML() as normal, with renameNodes = false, to write the entire assembly</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// structure to a single VRML file</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// 8. Clean up by deleting any extra IFSG_TRANSFORM wrappers and their underlying SG*</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// classes which have been created solely for the assembly output</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function ResetNodeIndex</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * resets the global SG* class indices</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aNode may be any valid SGNODE</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">ResetNodeIndex</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function RenameNodes</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * renames a node and all children nodes based on the current</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * values of the global SG* class indices</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aNode is a top level node</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">RenameNodes</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function DestroyNode</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * deletes the given SG* class node. This function makes it possible</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * to safely delete an SG* node without associating the node with</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * its corresponding IFSG* wrapper.</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">DestroyNode</span></span><span style="color: #990000">(</span> SGNODE<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">// NOTE: The following functions facilitate the creation and destruction</span></span>
<span style="font-style: italic"><span style="color: #9A1900">// of data structures for rendering</span></span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function GetModel</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * creates an S3DMODEL representation of aNode (raw data, no transforms)</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> *</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@param</span><span style="font-style: italic"><span style="color: #9A1900"> aNode is the node to be transcribed into an S3DMODEL representation</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * </span></span><span style="color: #009900">@return</span><span style="font-style: italic"><span style="color: #9A1900"> an S3DMODEL representation of aNode on success, otherwise NULL</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">SGLIB_API</span> S3DMODEL<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">GetModel</span></span><span style="color: #990000">(</span> SCENEGRAPH<span style="color: #990000">*</span> aNode <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Destroy3DModel</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * frees memory used by an S3DMODEL structure and sets the pointer to</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * the structure to NULL</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">Destroy3DModel</span></span><span style="color: #990000">(</span> S3DMODEL<span style="color: #990000">**</span> aModel <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Free3DModel</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * frees memory used internally by an S3DMODEL structure</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">Free3DModel</span></span><span style="color: #990000">(</span> S3DMODEL<span style="color: #990000">&</span> aModel <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Free3DMesh</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * frees memory used internally by an SMESH structure</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">Free3DMesh</span></span><span style="color: #990000">(</span> SMESH<span style="color: #990000">&</span> aMesh <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function New3DModel</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * creates and initializes an S3DMODEL struct</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
<span style="color: #008080">SGLIB_API</span> S3DMODEL<span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #000000">New3DModel</span></span><span style="color: #990000">(</span> <span style="color: #009900">void</span> <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Init3DMaterial</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * initializes an SMATERIAL struct</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">Init3DMaterial</span></span><span style="color: #990000">(</span> SMATERIAL<span style="color: #990000">&</span> aMat <span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">/**</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * Function Init3DMesh</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> * creates and initializes an SMESH struct</span></span>
<span style="font-style: italic"><span style="color: #9A1900"> */</span></span>
SGLIB_API <span style="color: #008080">void</span> <span style="font-weight: bold"><span style="color: #000000">Init3DMesh</span></span><span style="color: #990000">(</span> SMESH<span style="color: #990000">&</span> aMesh <span style="color: #990000">);</span>
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
<div class="paragraph"><p>For examples of actual usage of the Scenegraph API see the
3D Plugin DEMO2 tutorial and the kicad VRML1, VRML2, and X3D
parsers.</p></div>
</div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
Last updated 2017-08-24 22:21:56 BST
</div>
</div>
</body>
</html>
|