/usr/src/castle-game-engine-4.1.1/x3d/x3dnodes_1.inc is in castle-game-engine-src 4.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | {
Copyright 2002-2013 Michalis Kamburelis.
This file is part of "Castle Game Engine".
"Castle Game Engine" is free software; see the file COPYING.txt,
included in this distribution, for details about the copyright.
"Castle Game Engine" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------------------------------------------------
}
{ VRML 1.0 specification nodes.
If a node is present in both VRML 1.0
and later (2.0 aka 97) specifications @bold(and) it's implemented using
the same class in our engine, then it goes to vrml97* or x3d* file,
not here. So this is for VRML 1.0-only nodes.
(The above doesn't concern much nodes. Most nodes in VRML 1.0 and 97
specifications are different enough that even when they have the same
name (like Group) we implement them using different classes (like
TGroupNode_1 and TGroupNode).)
Note that most VRML 1 nodes descend from TAbstractChildNode,
this way we can use them inside VRML >= 2.0 group nodes and
mix VRML 1.0 and greater versions.
} { }
{$ifdef read_interface}
{ Geometry node allowed only in VRML <= 1.0.
In VRML 1.0 shape nodes are allowed pretty everywhere,
while VRML 2.0 has different idea of how shapes are handled
(they must be inside Shape node), so no shape node
is suitable at the same time for VRML 1.0 and VRML 2.0. }
TAbstractGeometryNode_1 = class(TAbstractGeometryNode, IAbstractChildNode)
public
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
end;
TAsciiTextNode_1 = class(TAbstractGeometryNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdString: TMFString;
public property FdString: TMFString read FFdString;
private FFdSpacing: TSFFloat;
public property FdSpacing: TSFFloat read FFdSpacing;
{ Text justification.
Use consts JUSTIFICATION_XXX (declared below in this unit). }
private FFdJustification: TSFEnum;
public property FdJustification: TSFEnum read FFdJustification;
private FFdWidth: TMFFloat;
public property FdWidth: TMFFloat read FFdWidth;
function LocalBoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function VerticesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function Justify: TX3DFontJustify;
end;
TConeNode_1 = class(TAbstractGeometryNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdParts: TSFBitMask;
public property FdParts: TSFBitMask read FFdParts;
private FFdBottomRadius: TSFFloat;
public property FdBottomRadius: TSFFloat read FFdBottomRadius;
private FFdHeight: TSFFloat;
public property FdHeight: TSFFloat read FFdHeight;
function Proxy(var State: TX3DGraphTraverseState;
const OverTriangulate: boolean): TAbstractGeometryNode; override;
function BoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function LocalBoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function AutoGenerate3DTexCoords: boolean; override;
end;
TCubeNode_1 = class(TAbstractGeometryNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdWidth: TSFFloat;
public property FdWidth: TSFFloat read FFdWidth;
private FFdHeight: TSFFloat;
public property FdHeight: TSFFloat read FFdHeight;
private FFdDepth: TSFFloat;
public property FdDepth: TSFFloat read FFdDepth;
function Proxy(var State: TX3DGraphTraverseState;
const OverTriangulate: boolean): TAbstractGeometryNode; override;
function BoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function LocalBoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function AutoGenerate3DTexCoords: boolean; override;
end;
TCylinderNode_1 = class(TAbstractGeometryNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdParts: TSFBitMask;
public property FdParts: TSFBitMask read FFdParts;
private FFdRadius: TSFFloat;
public property FdRadius: TSFFloat read FFdRadius;
private FFdHeight: TSFFloat;
public property FdHeight: TSFFloat read FFdHeight;
function Proxy(var State: TX3DGraphTraverseState;
const OverTriangulate: boolean): TAbstractGeometryNode; override;
function BoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function LocalBoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function AutoGenerate3DTexCoords: boolean; override;
end;
{ Common base class for VRML 1.0 indexed nodes
(IndexedFaceSet, IndexedTriangleMesh, IndexedLineSet). }
TAbstractIndexedNode_1 = class(TAbstractGeometryNode_1)
public
procedure CreateNode; override;
private FFdCoordIndex: TMFLong;
public property FdCoordIndex: TMFLong read FFdCoordIndex;
private FFdMaterialIndex: TMFLong;
public property FdMaterialIndex: TMFLong read FFdMaterialIndex;
private FFdNormalIndex: TMFLong;
public property FdNormalIndex: TMFLong read FFdNormalIndex;
private FFdTextureCoordIndex: TMFLong;
public property FdTextureCoordIndex: TMFLong read FFdTextureCoordIndex;
function Coord(State: TX3DGraphTraverseState;
out ACoord: TMFVec3f): boolean; override;
function CoordIndex: TMFLong; override;
end;
{ Common base class for VRML 1.0 indexed polygon nodes
(IndexedFaceSet and IndexedTriangleMesh). }
TIndexedFacesOrTrianglesNode_1 = class(TAbstractIndexedNode_1)
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
end;
TIndexedFaceSetNode_1 = class(TIndexedFacesOrTrianglesNode_1)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
procedure CoordPolygons(
State: TX3DGraphTraverseState;
PolygonHandler: TIndexedPolygonHandler); override;
private FFdRadianceTransfer: TMFVec3f;
public property FdRadianceTransfer: TMFVec3f read FFdRadianceTransfer;
function TexCoord(State: TX3DGraphTraverseState;
out ATexCoord: TX3DNode): boolean; override;
end;
TIndexedLineSetNode_1 = class(TAbstractIndexedNode_1)
class function ClassNodeTypeName: string; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function TexCoord(State: TX3DGraphTraverseState;
out ATexCoord: TX3DNode): boolean; override;
{ Do we have enough normals information to render this node lit.
VRML 1.0 specification explicitly mentions that IndexedLineSet is treated
specially: it's unlit if there are not enough normals specified. }
function Lit(State: TX3DGraphTraverseState): boolean; override;
end;
TPointSetNode_1 = class(TAbstractGeometryNode_1)
private
CoordSubrange: TMFVec3f;
public
procedure CreateNode; override;
destructor Destroy; override;
class function ClassNodeTypeName: string; override;
private FFdStartIndex: TSFLong;
public property FdStartIndex: TSFLong read FFdStartIndex;
private FFdNumPoints: TSFLong;
public property FdNumPoints: TSFLong read FFdNumPoints;
function Coord(State: TX3DGraphTraverseState;
out ACoord: TMFVec3f): boolean; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function Lit(State: TX3DGraphTraverseState): boolean; override;
end;
TSphereNode_1 = class(TAbstractGeometryNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdRadius: TSFFloat;
public property FdRadius: TSFFloat read FFdRadius;
function Proxy(var State: TX3DGraphTraverseState;
const OverTriangulate: boolean): TAbstractGeometryNode; override;
function BoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function LocalBoundingBox(State: TX3DGraphTraverseState;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): TBox3D; override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
function AutoGenerate3DTexCoords: boolean; override;
end;
TCoordinate3Node_1 = class(TAbstractChildNode)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdPoint: TMFVec3f;
public property FdPoint: TMFVec3f read FFdPoint;
end;
TFontStyleNode_1 = class(TAbstractChildNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdSize: TSFFloat;
public property FdSize: TSFFloat read FFdSize;
private FFdFamily: TSFEnum;
public property FdFamily: TSFEnum read FFdFamily;
private FFdStyle: TSFBitMask;
public property FdStyle: TSFBitMask read FFdStyle;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
function Family: TX3DFontFamily;
function Bold: boolean;
function Italic: boolean;
function Font: TOutlineFont;
end;
TInfoNode_1 = class(TAbstractChildNode)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdString: TSFString;
public property FdString: TSFString read FFdString;
end;
TLODNode_1 = class(TAbstractChildNode)
protected
procedure DirectEnumerateActive(
Func: TEnumerateChildrenFunction); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdRange: TMFFloat;
public property FdRange: TMFFloat read FFdRange;
private FFdCenter: TSFVec3f;
public property FdCenter: TSFVec3f read FFdCenter;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
end;
TX3DMaterialInfo_1 = class;
TMaterialNode_1 = class(TAbstractChildNode)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdAmbientColor: TMFColor;
public property FdAmbientColor: TMFColor read FFdAmbientColor;
private FFdDiffuseColor: TMFColor;
public property FdDiffuseColor: TMFColor read FFdDiffuseColor;
private FFdSpecularColor: TMFColor;
public property FdSpecularColor: TMFColor read FFdSpecularColor;
private FFdEmissiveColor: TMFColor;
public property FdEmissiveColor: TMFColor read FFdEmissiveColor;
private FFdShininess: TMFFloat;
public property FdShininess: TMFFloat read FFdShininess;
private FFdTransparency: TMFFloat;
public property FdTransparency: TMFFloat read FFdTransparency;
{ Fields used by ray-tracers. } { }
private FFdMirror: TMFFloat;
public property FdMirror: TMFFloat read FFdMirror;
private FFdReflSpecular: TMFColor;
public property FdReflSpecular: TMFColor read FFdReflSpecular;
private FFdReflDiffuse: TMFColor;
public property FdReflDiffuse: TMFColor read FFdReflDiffuse;
private FFdTransSpecular: TMFColor;
public property FdTransSpecular: TMFColor read FFdTransSpecular;
private FFdTransDiffuse: TMFColor;
public property FdTransDiffuse: TMFColor read FFdTransDiffuse;
private FFdReflSpecularExp: TMFFloat;
public property FdReflSpecularExp: TMFFloat read FFdReflSpecularExp;
private FFdTransSpecularExp: TMFFloat;
public property FdTransSpecularExp: TMFFloat read FFdTransSpecularExp;
private FFdFogImmune: TSFBool;
public property FdFogImmune: TSFBool read FFdFogImmune;
{ Easily extract VRML 1.0 material properties.
These methods secure you from accessing non-existing material index
(will return the last existing value, or default value if field is empty).
Functions returning TVector4Single add Opacity at the last component.
Transparency and Opacity are in [0 .. 1] range.
Opacity = 1 - Transparency.
ShininessExp is the @italic(not normalized) shininess exponent
for Phong lighting equations. Normal VRML/X3D shininess field
is "normalized", that is it has to be multiplied by 128 to get
actual exponent for lighting equations.
@groupBegin }
function AmbientColor3Single(MatNum: integer): TVector3Single;
function AmbientColor4Single(MatNum: integer): TVector4Single;
function DiffuseColor3Single(MatNum: integer): TVector3Single;
function DiffuseColor4Single(MatNum: integer): TVector4Single;
function SpecularColor3Single(MatNum: integer): TVector3Single;
function SpecularColor4Single(MatNum: integer): TVector4Single;
function EmissiveColor3Single(MatNum: integer): TVector3Single;
function EmissiveColor4Single(MatNum: integer): TVector4Single;
function Transparency(MatNum: integer): Single;
function Opacity(MatNum: integer): Single;
function Shininess(MatNum: integer): Single;
function ShininessExp(MatNum: integer): Single;
function Mirror(MatNum: integer): Single;
function ReflSpecularExp (MatNum: integer): Single;
function TransSpecularExp(MatNum: integer): Single;
{ @groupEnd }
{ Only the emissive field is not empty.
This detects a special case described in VRML 1.0 specification:
when ambient, diffuse and specular are all empty (no values),
then emissiveColor should be used at the final color and shape
should be unlit.
You should use the EmissiveColor4Single in this case. }
function OnlyEmissiveMaterial: boolean;
{ All the "transparency" field values are greater than zero.
So the blending should be used when rendering.
Note that when "transparency" field is empty, then we assume
a default transparency (0) should be used. So AllMaterialsTransparent
is @false then (contrary to the strict definition of "all",
which should be true for empty sets). }
function AllMaterialsTransparent: boolean;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
function MaterialInfo(const Index: Integer): TX3DMaterialInfo_1;
end;
TX3DMaterialInfo_1 = class(TX3DMaterialInfoAbstract)
private
FNode: TMaterialNode_1;
FIndex: Integer;
public
constructor Create(Node: TMaterialNode_1; const Index: Integer);
function DiffuseColor: TVector3Single; override;
function Mirror: Single; override;
function Transparency: Single; override;
function ReflSpecular: TVector3Single; override;
function ReflDiffuse: TVector3Single; override;
function TransSpecular: TVector3Single; override;
function TransDiffuse: TVector3Single; override;
function ReflSpecularExp: Single; override;
function TransSpecularExp: Single; override;
end;
TMaterialBindingNode_1 = class(TAbstractChildNode)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdValue: TSFEnum;
public property FdValue: TSFEnum read FFdValue;
end;
TNormalBindingNode_1 = class(TAbstractChildNode)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdValue: TSFEnum;
public property FdValue: TSFEnum read FFdValue;
end;
TTexture2Node_1 = class(TAbstractTexture2DNode)
protected
{ Texture is loaded from file or inlined.
The priority has the filename, only if it's empty (or an exception
occurs during file loading) then the inlined texture will be used.
Note that in VRML 1.0 a node without any texture
(that is, when IsTextureLoaded = true and still
IsTextureImage = false) is also useful: it turns off using the previous
texture. }
procedure LoadTextureData(out CacheUsed: boolean); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdFilename: TSFString;
public property FdFilename: TSFString read FFdFilename;
private FFdImage: TSFImage;
public property FdImage: TSFImage read FFdImage;
private FFdWrapS: TSFEnum;
public property FdWrapS: TSFEnum read FFdWrapS;
private FFdWrapT: TSFEnum;
public property FdWrapT: TSFEnum read FFdWrapT;
{ Ignored fields, some unknown extensions to VRML 1.0 spec.
Some models ([http://www-vrl.umich.edu/sel_prj/EECS498/]) use them.
@groupBegin }
private FFdModel: TSFEnum;
public property FdModel: TSFEnum read FFdModel;
private FFdBlendColor: TSFVec3f;
public property FdBlendColor: TSFVec3f read FFdBlendColor;
{ @groupEnd }
function TextureDescription: string; override;
function RepeatS: boolean; override;
function RepeatT: boolean; override;
end;
TTexture2TransformNode_1 = class(TAbstractChildNode)
protected
procedure MiddleTraverse(StateStack: TX3DGraphTraverseStateStack); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdTranslation: TSFVec2f;
public property FdTranslation: TSFVec2f read FFdTranslation;
private FFdRotation: TSFFloat;
public property FdRotation: TSFFloat read FFdRotation;
private FFdScaleFactor: TSFVec2f;
public property FdScaleFactor: TSFVec2f read FFdScaleFactor;
private FFdCenter: TSFVec2f;
public property FdCenter: TSFVec2f read FFdCenter;
function TextureMatrixTransformation: TMatrix4Single;
end;
TTextureCoordinate2Node_1 = class(TAbstractChildNode)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdPoint: TMFVec2f;
public property FdPoint: TMFVec2f read FFdPoint;
end;
TShapeHintsNode_1 = class(TAbstractChildNode)
protected
function ParseNodeBodyElement(Lexer: TX3DLexer; Reader: TX3DReaderNames;
const APositionInParent: Integer): boolean; override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdVertexOrdering: TSFEnum;
public property FdVertexOrdering: TSFEnum read FFdVertexOrdering;
private FFdShapeType: TSFEnum;
public property FdShapeType: TSFEnum read FFdShapeType;
private FFdFaceType: TSFEnum;
public property FdFaceType: TSFEnum read FFdFaceType;
private FFdCreaseAngle: TSFFloat;
public property FdCreaseAngle: TSFFloat read FFdCreaseAngle;
end;
{ Common base class for all nodes that modify the modelview matrix.
In descendants you only have to override the MatrixTransform method. }
TAbstractTransformationNode_1 = class(TAbstractChildNode)
protected
procedure MiddleTraverse(StateStack: TX3DGraphTraverseStateStack); override;
public
procedure Transformation(out Matrix, InvertedMatrix: TMatrix4Single); virtual; abstract;
function TransformScale: Single; virtual; abstract;
end;
{ VRML 1.0 MatrixTransform node. }
TMatrixTransformNode_1 = class(TAbstractTransformationNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdMatrix: TSFMatrix;
public property FdMatrix: TSFMatrix read FFdMatrix;
{ Returns simply FdMatrix as transformation. Inverse is also calculated
(if matrix is invertible at all, otherwise identity is returned). }
procedure Transformation(out Matrix, InvertedMatrix: TMatrix4Single); override;
{ Return average scale for this FdMatrix.
Note that this doesn't correctly extract scale from FdMatrix,
as that is too difficcult. Insted it does simple extraction,
which will work for identity, translation and scaling matrices
(but e.g. will fail miserably (generate nonsense results) when
looking at some rotation matrices).
Ultimately, this is the reason why VRML 2.0 removed this node
from specification: extracting some features from arbitrary given
4x4 matrix is very difficult. }
function TransformScale: Single; override;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
end;
TRotationNode_1 = class(TAbstractTransformationNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdRotation: TSFRotation;
public property FdRotation: TSFRotation read FFdRotation;
procedure Transformation(out Matrix, InvertedMatrix: TMatrix4Single); override;
function TransformScale: Single; override;
end;
TScaleNode_1 = class(TAbstractTransformationNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdScaleFactor: TSFVec3f;
public property FdScaleFactor: TSFVec3f read FFdScaleFactor;
procedure Transformation(out Matrix, InvertedMatrix: TMatrix4Single); override;
function TransformScale: Single; override;
end;
TTransformNode_1 = class(TAbstractTransformationNode_1)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdTranslation: TSFVec3f;
public property FdTranslation: TSFVec3f read FFdTranslation;
private FFdRotation: TSFRotation;
public property FdRotation: TSFRotation read FFdRotation;
private FFdScaleFactor: TSFVec3f;
public property FdScaleFactor: TSFVec3f read FFdScaleFactor;
private FFdScaleOrientation: TSFRotation;
public property FdScaleOrientation: TSFRotation read FFdScaleOrientation;
private FFdCenter: TSFVec3f;
public property FdCenter: TSFVec3f read FFdCenter;
procedure Transformation(out Matrix, InvertedMatrix: TMatrix4Single); override;
function TransformScale: Single; override;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
end;
TTranslationNode_1 = class(TAbstractTransformationNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdTranslation: TSFVec3f;
public property FdTranslation: TSFVec3f read FFdTranslation;
procedure Transformation(out Matrix, InvertedMatrix: TMatrix4Single); override;
function TransformScale: Single; override;
end;
{ Common base class for all cameras in VRML 1.0. }
TAbstractCameraNode_1 = class(TAbstractViewpointNode)
public
procedure CreateNode; override;
private FFdPosition: TSFVec3f;
public property FdPosition: TSFVec3f read FFdPosition;
private FFdFocalDistance: TSFFloat;
public property FdFocalDistance: TSFFloat read FFdFocalDistance;
{ Ignored fields, some unknown extensions to VRML 1.0 spec.
Some models ([http://www-vrl.umich.edu/sel_prj/EECS498/]) use them.
@groupBegin }
private FFdNearDistance: TSFFloat;
public property FdNearDistance: TSFFloat read FFdNearDistance;
private FFdFarDistance: TSFFloat;
public property FdFarDistance: TSFFloat read FFdFarDistance;
{ @groupEnd }
function Position: TSFVec3f; override;
end;
TOrthographicCameraNode_1 = class(TAbstractCameraNode_1)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function ProjectionType: TProjectionType; override;
private FFdHeight: TSFFloat;
public property FdHeight: TSFFloat read FFdHeight;
end;
TPerspectiveCameraNode_1 = class(TAbstractCameraNode_1)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function ProjectionType: TProjectionType; override;
private FFdHeightAngle: TSFFloat;
public property FdHeightAngle: TSFFloat read FFdHeightAngle;
end;
TDirectionalLightNode_1 = class(TAbstractDirectionalLightNode)
public
procedure CreateNode; override;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
function Scope: TLightScope; override;
end;
TPointLightNode_1 = class(TAbstractPointLightNode)
public
procedure CreateNode; override;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
function HasRadius: boolean; override;
function Scope: TLightScope; override;
end;
TSpotLightNode_1 = class(TAbstractPositionalLightNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdDirection: TSFVec3f;
public property FdDirection: TSFVec3f read FFdDirection;
private FFdDropOffRate: TSFFloat;
public property FdDropOffRate: TSFFloat read FFdDropOffRate;
private FFdCutOffAngle: TSFFloat;
public property FdCutOffAngle: TSFFloat read FFdCutOffAngle;
{ Not normalized spot exponent (based on dropOffRate). }
function SpotExp: Single;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
procedure UpdateLightInstance(var LightInstance: TLightInstance); override;
function ProjectionMatrix: TMatrix4Single; override;
function ModelviewMatrix: TMatrix4Single; override;
function ModelviewRotationMatrix: TMatrix4Single; override;
function LocationLocal: TVector3Single; override;
function DirectionLocal: TVector3Single; override;
procedure Box3DDistances(const Box: TBox3D;
out MinDistance, MaxDistance: Single); override;
function HasRadius: boolean; override;
function Scope: TLightScope; override;
end;
TGroupNode_1 = class(TAbstractChildNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
end;
{ Base class for VRML 1.0 nodes that push / pop all attributes and matrices.
It is used in implementation of VRML 1.0 Separator and WWWAnchor.
Also WWWInline does the same work, when it's "separate" field is true. }
TAbstractSeparatorNode_1 = class(TAbstractChildNode)
protected
procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;
procedure AfterTraverse(StateStack: TX3DGraphTraverseStateStack); override;
public
procedure CreateNode; override;
end;
TSeparatorNode_1 = class(TAbstractSeparatorNode_1)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdRenderCulling: TSFEnum;
public property FdRenderCulling: TSFEnum read FFdRenderCulling;
end;
TSwitchNode_1 = class(TAbstractChildNode)
protected
procedure DirectEnumerateActive(
Func: TEnumerateChildrenFunction); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdWhichChild: TSFLong;
public property FdWhichChild: TSFLong read FFdWhichChild;
class function ForVRMLVersion(const Version: TX3DVersion): boolean;
override;
end;
TTransformSeparatorNode_1 = class(TAbstractChildNode)
private
OriginalTransform, OriginalInvertedTransform: TMatrix4Single;
OriginalTransformScale: Single;
protected
procedure BeforeTraverse(StateStack: TX3DGraphTraverseStateStack); override;
procedure AfterTraverse(StateStack: TX3DGraphTraverseStateStack); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
end;
TWWWAnchorNode_1 = class(TAbstractSeparatorNode_1)
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdName: TSFString;
public property FdName: TSFString read FFdName;
private FFdDescription: TSFString;
public property FdDescription: TSFString read FFdDescription;
private FFdMap: TSFEnum;
public property FdMap: TSFEnum read FFdMap;
end;
{ VRML 1.0 WWWInline node.
Implemented as a descendant of VRML 2.0/X3D Inline node
class. This way VRML 1.0 actually gets a couple of VRML 2.0/X3D extensions.
The VRML 2.0/X3D field "url" is renamed here to VRML 1.0 field "name".
(Note that this means that WWWInline.name is actually MFString,
not just SFString like VRML 1.0 spec says.) }
TWWWInlineNode_1 = class(TInlineNode)
protected
function SeparateGroup: boolean; override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
private FFdSeparate: TSFBool;
public property FdSeparate: TSFBool read FFdSeparate;
end;
{$endif read_interface}
{$ifdef read_implementation}
class function TAbstractGeometryNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TAsciiTextNode_1.CreateNode;
begin
inherited;
FFdString := TMFString.Create(Self, 'string', ['']);
FdString.ChangesAlways := [chGeometry];
Fields.Add(FFdString);
FFdSpacing := TSFFloat.Create(Self, 'spacing', 1);
FdSpacing.ChangesAlways := [chGeometry];
Fields.Add(FFdSpacing);
FFdJustification := TSFEnum.Create(Self, 'justification', ['LEFT', 'CENTER', 'RIGHT'], JUSTIFICATION_LEFT);
FdJustification.ChangesAlways := [chGeometry];
Fields.Add(FFdJustification);
FFdWidth := TMFFloat.Create(Self, 'width', [0]);
FdWidth.ChangesAlways := [chGeometry];
Fields.Add(FFdWidth);
end;
class function TAsciiTextNode_1.ClassNodeTypeName: string;
begin
result := 'AsciiText';
end;
function TAsciiTextNode_1.Justify: TX3DFontJustify;
begin
Result := TX3DFontJustify(FdJustification.Value);
end;
procedure TConeNode_1.CreateNode;
begin
inherited;
FFdParts := TSFBitMask.Create(Self, 'parts', ['SIDES', 'BOTTOM'], 'NONE', 'ALL', [true, true]);
FdParts.ChangesAlways := [chGeometry];
Fields.Add(FFdParts);
FFdBottomRadius := TSFFloat.Create(Self, 'bottomRadius', 1, true);
FdBottomRadius.ChangesAlways := [chGeometry];
Fields.Add(FFdBottomRadius);
FFdHeight := TSFFloat.Create(Self, 'height', 2, true);
FdHeight.ChangesAlways := [chGeometry];
Fields.Add(FFdHeight);
end;
class function TConeNode_1.ClassNodeTypeName: string;
begin
result := 'Cone';
end;
function TConeNode_1.AutoGenerate3DTexCoords: boolean;
begin
Result := true;
end;
procedure TCubeNode_1.CreateNode;
begin
inherited;
FFdWidth := TSFFloat.Create(Self, 'width', 2, true);
FdWidth.ChangesAlways := [chGeometry];
Fields.Add(FFdWidth);
FFdHeight := TSFFloat.Create(Self, 'height', 2, true);
FdHeight.ChangesAlways := [chGeometry];
Fields.Add(FFdHeight);
FFdDepth := TSFFloat.Create(Self, 'depth', 2, true);
FdDepth.ChangesAlways := [chGeometry];
Fields.Add(FFdDepth);
end;
class function TCubeNode_1.ClassNodeTypeName: string;
begin
result := 'Cube';
end;
function TCubeNode_1.AutoGenerate3DTexCoords: boolean;
begin
Result := true;
end;
procedure TCylinderNode_1.CreateNode;
begin
inherited;
FFdParts := TSFBitMask.Create(Self, 'parts', ['SIDES', 'TOP', 'BOTTOM'], 'NONE', 'ALL', [true, true, true]);
FdParts.ChangesAlways := [chGeometry];
Fields.Add(FFdParts);
FFdRadius := TSFFloat.Create(Self, 'radius', 1, true);
FdRadius.ChangesAlways := [chGeometry];
Fields.Add(FFdRadius);
FFdHeight := TSFFloat.Create(Self, 'height', 2, true);
FdHeight.ChangesAlways := [chGeometry];
Fields.Add(FFdHeight);
end;
class function TCylinderNode_1.ClassNodeTypeName: string;
begin
result := 'Cylinder';
end;
function TCylinderNode_1.AutoGenerate3DTexCoords: boolean;
begin
Result := true;
end;
procedure TAbstractIndexedNode_1.CreateNode;
begin
inherited;
FFdCoordIndex := TMFLong.Create(Self, 'coordIndex', [0]);
FdCoordIndex.SaveToStreamLineUptoNegative := true;
FdCoordIndex.ChangesAlways := [chGeometry];
Fields.Add(FFdCoordIndex);
FFdMaterialIndex := TMFLong.Create(Self, 'materialIndex', [-1]);
FdMaterialIndex.ChangesAlways := [chGeometry];
Fields.Add(FFdMaterialIndex);
FFdNormalIndex := TMFLong.Create(Self, 'normalIndex', [-1]);
FdNormalIndex.ChangesAlways := [chGeometry];
Fields.Add(FFdNormalIndex);
FFdTextureCoordIndex := TMFLong.Create(Self, 'textureCoordIndex', [-1]);
FdTextureCoordIndex.SaveToStreamLineUptoNegative := true;
FdTextureCoordIndex.ChangesAlways := [chGeometry];
Fields.Add(FFdTextureCoordIndex);
end;
function TAbstractIndexedNode_1.Coord(State: TX3DGraphTraverseState;
out ACoord: TMFVec3f): boolean;
begin
Result := true;
ACoord := State.LastNodes.Coordinate3.FdPoint;
end;
function TAbstractIndexedNode_1.CoordIndex: TMFLong;
begin
Result := FdCoordIndex;
end;
procedure TIndexedFaceSetNode_1.CreateNode;
begin
inherited;
FFdRadianceTransfer := TMFVec3f.Create(Self, 'radianceTransfer', []);
FdRadianceTransfer.ChangesAlways := [chGeometry];
Fields.Add(FFdRadianceTransfer);
end;
class function TIndexedFaceSetNode_1.ClassNodeTypeName: string;
begin
result := 'IndexedFaceSet';
end;
function TIndexedFaceSetNode_1.TexCoord(State: TX3DGraphTraverseState;
out ATexCoord: TX3DNode): boolean;
begin
Result := true;
ATexCoord := State.LastNodes.TextureCoordinate2;
end;
class function TIndexedLineSetNode_1.ClassNodeTypeName: string;
begin
result := 'IndexedLineSet';
end;
function TIndexedLineSetNode_1.TexCoord(State: TX3DGraphTraverseState;
out ATexCoord: TX3DNode): boolean;
begin
Result := true;
ATexCoord := State.LastNodes.TextureCoordinate2;
end;
function TIndexedLineSetNode_1.Lit(State: TX3DGraphTraverseState): boolean;
begin
{ This somewhat follows the logic of
TAbstractNormalGenerator.NorImplementationFromVRML1Binding,
answering "false" when NorImplementationFromVRML1Binding sets "niNone". }
{ for _INDEXED normal binding, check normalIndex non-empty }
case State.LastNodes.NormalBinding.FdValue.Value of
BIND_DEFAULT,
BIND_PER_VERTEX_INDEXED,
BIND_PER_PART_INDEXED,
BIND_PER_FACE_INDEXED:
Result := (FdNormalIndex.Count <> 0) and
(FdNormalIndex.Items.L[0] >= 0);
else
Result := true;
end;
{ check Normal.vector non-empty }
if State.LastNodes.Normal.FdVector.Count = 0 then
Result := false;
end;
procedure TPointSetNode_1.CreateNode;
begin
inherited;
FFdStartIndex := TSFLong.Create(Self, 'startIndex', 0);
FdStartIndex.ChangesAlways := [chGeometry];
Fields.Add(FFdStartIndex);
FFdNumPoints := TSFLong.Create(Self, 'numPoints', -1);
FdNumPoints.ChangesAlways := [chGeometry];
Fields.Add(FFdNumPoints);
CoordSubrange := TMFVec3f.Create(Self, '', []);
end;
destructor TPointSetNode_1.Destroy;
begin
FreeAndNil(CoordSubrange);
inherited;
end;
class function TPointSetNode_1.ClassNodeTypeName: string;
begin
result := 'PointSet';
end;
function TPointSetNode_1.Coord(State: TX3DGraphTraverseState;
out ACoord: TMFVec3f): boolean;
procedure CalculateRange(CoordsCount: Cardinal;
out StartIndex, NumPoints: integer);
begin
startIndex := FdStartIndex.Value;
numPoints := FdNumPoints.Value;
if startIndex >= CoordsCount then
begin
startIndex := 0;
numPoints := 0;
end else
begin
if startIndex < 0 then
begin
if numPoints >= 0 then numPoints := numPoints + startIndex;
startIndex := 0;
end;
{startIndex juz jest na pewno dobry, teraz ew. popraw numPoints}
if numPoints >= 0 then
begin
if startIndex + numPoints > CoordsCount then
numPoints := CoordsCount - startIndex;
end else
numPoints := CoordsCount - startIndex;
end;
end;
var
FullCoord: TMFVec3f;
StartIndex, NumPoints: integer;
begin
Result := true;
FullCoord := State.LastNodes.Coordinate3.FdPoint;
CalculateRange(FullCoord.Count, StartIndex, NumPoints);
if (StartIndex = 0) and (NumPoints = FullCoord.Count) then
ACoord := FullCoord else
begin
{ It's incredibly non-efficient to copy here, each time, coordinates
contents. However, it's also the simplest correct implementation
of the extremely-rare feature of startIndex / numPoints
(VRML 1.0 is rare and outdated already!).
As long as model stays static (and for strict VRML 1.0, it should
always remain static), this will not be actually often called. }
CoordSubrange.Items.Count := 0;
CoordSubrange.Items.AddListRange(FullCoord.Items, StartIndex, NumPoints);
ACoord := CoordSubrange;
end;
end;
function TPointSetNode_1.Lit(State: TX3DGraphTraverseState): boolean;
begin
Result := false;
end;
procedure TSphereNode_1.CreateNode;
begin
inherited;
FFdRadius := TSFFloat.Create(Self, 'radius', 1, true);
FdRadius.ChangesAlways := [chGeometry];
Fields.Add(FFdRadius);
end;
class function TSphereNode_1.ClassNodeTypeName: string;
begin
result := 'Sphere';
end;
function TSphereNode_1.AutoGenerate3DTexCoords: boolean;
begin
Result := true;
end;
procedure TCoordinate3Node_1.CreateNode;
begin
inherited;
FFdPoint := TMFVec3f.Create(Self, 'point', [Vector3Single(0, 0, 0)]);
FdPoint.ChangesAlways := [chCoordinate];
Fields.Add(FFdPoint);
end;
class function TCoordinate3Node_1.ClassNodeTypeName: string;
begin
result := 'Coordinate3';
end;
procedure TFontStyleNode_1.CreateNode;
begin
inherited;
FFdSize := TSFFloat.Create(Self, 'size', 10, true);
FdSize.ChangesAlways := [chGeometryVRML1State];
Fields.Add(FFdSize);
FFdFamily := TSFEnum.Create(Self, 'family', ['SERIF', 'SANS', 'TYPEWRITER'], FSFAMILY_SERIF);
FdFamily.ChangesAlways := [chGeometryVRML1State];
Fields.Add(FFdFamily);
FFdStyle := TSFBitMask.Create(Self, 'style', ['BOLD', 'ITALIC'], 'NONE', '', [false, false]);
FdStyle.ChangesAlways := [chGeometryVRML1State];
Fields.Add(FFdStyle);
end;
class function TFontStyleNode_1.ClassNodeTypeName: string;
begin
result := 'FontStyle';
end;
function TFontStyleNode_1.Font: TOutlineFont;
begin
Result := TFontStyleNode.ClassFont(Family, Bold, Italic);
end;
function TFontStyleNode_1.Family: TX3DFontFamily;
begin
Result := TX3DFontFamily(FdFamily.Value);
end;
function TFontStyleNode_1.Bold: boolean;
begin
Result := FdStyle.Flags[FSSTYLE_BOLD];
end;
function TFontStyleNode_1.Italic: boolean;
begin
Result := FdStyle.Flags[FSSTYLE_ITALIC];
end;
class function TFontStyleNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TInfoNode_1.CreateNode;
begin
inherited;
FFdString := TSFString.Create(Self, 'string', '<Undefined info>');
Fields.Add(FFdString);
end;
class function TInfoNode_1.ClassNodeTypeName: string;
begin
result := 'Info';
end;
procedure TLODNode_1.CreateNode;
begin
inherited;
FFdRange := TMFFloat.Create(Self, 'range',[]);
Fields.Add(FFdRange);
FFdCenter := TSFVec3f.Create(Self, 'center', Vector3Single(0, 0, 0));
Fields.Add(FFdCenter);
VRML1ChildrenAllowed := true;
VRML1ChildrenParsingAllowed := true;
end;
class function TLODNode_1.ClassNodeTypeName: string;
begin
result := 'LOD';
end;
procedure TLODNode_1.DirectEnumerateActive(Func: TEnumerateChildrenFunction);
begin
{ TODO: powinnismy tu uzywac odleglosci od camery ? Problem.
dla renderowania jest problem z wrzucaniem tego na display liste.
dla boundingBoxa
Wybrac ostatnie SubNode bo bedzie je nalatwiej obliczac ?
Pierwsze, bo jest dokladne ? To ktore renderujemy ?
W ostatnim przypadku, ladujemy z tym samym klopotem co RenderNKSpecific :
zapamietywanie takiego BoundingBoxa nie jest poprawne.
}
if VRML1ChildrenCount = 0 then
raise EX3DError.Create('LOD node must have at least one child');
Func(Self, VRML1Children[0]);
end;
class function TLODNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TMaterialNode_1.CreateNode;
begin
inherited;
FFdAmbientColor := TMFColor.Create(Self, 'ambientColor', [DefaultMaterial_1AmbientColor]);
FdAmbientColor.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdAmbientColor);
FFdDiffuseColor := TMFColor.Create(Self, 'diffuseColor', [DefaultMaterialDiffuseColor]);
FdDiffuseColor.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdDiffuseColor);
FFdSpecularColor := TMFColor.Create(Self, 'specularColor', [DefaultMaterialSpecularColor]);
FdSpecularColor.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdSpecularColor);
FFdEmissiveColor := TMFColor.Create(Self, 'emissiveColor', [DefaultMaterialEmissiveColor]);
FdEmissiveColor.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdEmissiveColor);
FFdShininess := TMFFloat.Create(Self, 'shininess', [DefaultMaterialShininess]);
FdShininess.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdShininess);
FFdTransparency := TMFFloat.Create(Self, 'transparency', [DefaultMaterialTransparency]);
FdTransparency.ChangesAlways := [chVisibleVRML1State, chUseBlending];
Fields.Add(FFdTransparency);
FFdMirror := TMFFloat.Create(Self, 'mirror', [DefaultMaterialMirror]);
FdMirror.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdMirror);
FFdReflSpecular := TMFColor.Create(Self, 'reflSpecular', []);
FdReflSpecular.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdReflSpecular);
FFdReflDiffuse := TMFColor.Create(Self, 'reflDiffuse', []);
FdReflDiffuse.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdReflDiffuse);
FFdTransSpecular := TMFColor.Create(Self, 'transSpecular', []);
FdTransSpecular.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdTransSpecular);
FFdTransDiffuse := TMFColor.Create(Self, 'transDiffuse', []);
FdTransDiffuse.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdTransDiffuse);
FFdReflSpecularExp := TMFFloat.Create(Self, 'reflSpecularExp', [DefaultMaterialReflSpecularExp]);
FdReflSpecularExp.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdReflSpecularExp);
FFdTransSpecularExp := TMFFloat.Create(Self, 'transSpecularExp', [DefaultMaterialTransSpecularExp]);
FdTransSpecularExp.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdTransSpecularExp);
FFdFogImmune := TSFBool.Create(Self, 'fogImmune', false);
FdFogImmune.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdFogImmune);
end;
class function TMaterialNode_1.ClassNodeTypeName: string;
begin
result := 'Material';
end;
{ Functions below return MatNum Material property. If there doesn't exist
enouch properties defined, thay return the last defined. This is useful :
for example you can give one ambient, specular, emissive color and
define multiple diffuseColors and then you can use multiple materials
without defining multiple values for each field.
VRML specification doesn't state clearly what to do when thare are not enouch
material properties - there was an idea of "cycling" mechanism but was
later deprecated. So I use the mechanism below - returning to the last defined
property number. }
{$define MATERIAL_FUNCTION_3_SINGLE:=
function TMaterialNode_1.MATERIAL_FUNCTION_NAME_3(MatNum: integer): TVector3Single;
begin
if MATERIAL_FUNCTION_FIELD.Count = 0 then
result := MATERIAL_FUNCTION_DEFAULT else
result := MATERIAL_FUNCTION_FIELD.Items.L[
min(MatNum, MATERIAL_FUNCTION_FIELD.Count - 1)];
end;
function TMaterialNode_1.MATERIAL_FUNCTION_NAME_4(MatNum: integer): TVector4Single;
var result3: TVector3Single absolute result;
begin
result3 := MATERIAL_FUNCTION_NAME_3(MatNum);
result[3] := Opacity(MatNum);
end;
}
{$define MATERIAL_FUNCTION_FIELD := FdAmbientColor}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterial_1AmbientColor}
{$define MATERIAL_FUNCTION_NAME_3 := AmbientColor3Single}
{$define MATERIAL_FUNCTION_NAME_4 := AmbientColor4Single}
MATERIAL_FUNCTION_3_SINGLE
{$define MATERIAL_FUNCTION_FIELD := FdDiffuseColor}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialDiffuseColor}
{$define MATERIAL_FUNCTION_NAME_3 := DiffuseColor3Single}
{$define MATERIAL_FUNCTION_NAME_4 := DiffuseColor4Single}
MATERIAL_FUNCTION_3_SINGLE
{$define MATERIAL_FUNCTION_FIELD := FdSpecularColor}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialSpecularColor}
{$define MATERIAL_FUNCTION_NAME_3 := SpecularColor3Single}
{$define MATERIAL_FUNCTION_NAME_4 := SpecularColor4Single}
MATERIAL_FUNCTION_3_SINGLE
{$define MATERIAL_FUNCTION_FIELD := FdEmissiveColor}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialEmissiveColor}
{$define MATERIAL_FUNCTION_NAME_3 := EmissiveColor3Single}
{$define MATERIAL_FUNCTION_NAME_4 := EmissiveColor4Single}
MATERIAL_FUNCTION_3_SINGLE
{$undef MATERIAL_FUNCTION_3_SINGLE}
{$undef MATERIAL_FUNCTION_FIELD}
{$undef MATERIAL_FUNCTION_DEFAULT}
{$undef MATERIAL_FUNCTION_NAME_3}
{$undef MATERIAL_FUNCTION_NAME_4}
{$define MATERIAL_FUNCTION_SINGLE:=
function TMaterialNode_1.MATERIAL_FUNCTION_NAME(MatNum: integer): Single;
begin
if MATERIAL_FUNCTION_FIELD.Count = 0 then
result := MATERIAL_FUNCTION_DEFAULT else
result := MATERIAL_FUNCTION_FIELD.Items.L[
min(MatNum, MATERIAL_FUNCTION_FIELD.Count-1)];
end;}
{$define MATERIAL_FUNCTION_NAME := Transparency}
{$define MATERIAL_FUNCTION_FIELD := FdTransparency}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialTransparency}
MATERIAL_FUNCTION_SINGLE
{$define MATERIAL_FUNCTION_NAME := Mirror}
{$define MATERIAL_FUNCTION_FIELD := FdMirror}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialMirror}
MATERIAL_FUNCTION_SINGLE
{$define MATERIAL_FUNCTION_NAME := ReflSpecularExp}
{$define MATERIAL_FUNCTION_FIELD := FdReflSpecularExp}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialReflSpecularExp}
MATERIAL_FUNCTION_SINGLE
{$define MATERIAL_FUNCTION_NAME := TransSpecularExp}
{$define MATERIAL_FUNCTION_FIELD := FdTransSpecularExp}
{$define MATERIAL_FUNCTION_DEFAULT := DefaultMaterialTransSpecularExp}
MATERIAL_FUNCTION_SINGLE
{$undef MATERIAL_FUNCTION_NAME}
{$undef MATERIAL_FUNCTION_FIELD}
{$undef MATERIAL_FUNCTION_DEFAULT}
{$undef MATERIAL_FUNCTION_SINGLE}
function TMaterialNode_1.Opacity(MatNum: integer): Single;
begin
result := 1 - Transparency(MatNum);
end;
function TMaterialNode_1.Shininess(MatNum: integer): Single;
begin
if FdShininess.Count = 0 then
result := DefaultMaterialShininess else
result := FdShininess.Items.L[min(MatNum, FdShininess.Count-1)];
end;
function TMaterialNode_1.ShininessExp(MatNum: integer): Single;
begin
Result := Shininess(MatNum);
{ According to VRML specification, shininess must be within 0..1 range,
and it maps uniformly to 0..128 range for OpenGL's exponent.
That's fine. We do clamp to 0..128 if for whatever small floating
point errors we'll get outside the range allowed by OpenGL,
and to secure against incorrect negative shininess values in VRML.
To encompass various incorrect VRML files we assume that
shininess > 2 means that someone didn't grok the VRML spec,
and stored actual exponent in VRML file.
This unfortunately happens, see e.g. helix.wrl test. }
if result > 2 then
result := Clamped(result, 0.0, 128.0) else
result := Clamped(result * 128.0, 0.0, 128.0);
end;
function TMaterialNode_1.OnlyEmissiveMaterial: boolean;
begin
result:=(FdAmbientColor.Count = 0) and
(FdDiffuseColor.Count = 0) and
(FdSpecularColor.Count = 0);
end;
function TMaterialNode_1.AllMaterialsTransparent: boolean;
var i: Integer;
begin
if FdTransparency.Items.Count = 0 then
result := DefaultMaterialTransparency > SingleEqualityEpsilon else
begin
for i := 0 to FdTransparency.Items.Count-1 do
if FdTransparency.Items.L[i] <= SingleEqualityEpsilon then Exit(false);
result := true;
end;
end;
class function TMaterialNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
function TMaterialNode_1.MaterialInfo(const Index: Integer): TX3DMaterialInfo_1;
begin
Result := TX3DMaterialInfo_1.Create(Self, Index);
end;
constructor TX3DMaterialInfo_1.Create(Node: TMaterialNode_1; const Index: Integer);
begin
inherited Create;
FNode := Node;
FIndex := Index;
end;
function TX3DMaterialInfo_1.DiffuseColor: TVector3Single;
begin
Result := FNode.DiffuseColor3Single(FIndex);
end;
function TX3DMaterialInfo_1.Mirror: Single;
begin
Result := FNode.Mirror(FIndex);
end;
function TX3DMaterialInfo_1.Transparency: Single;
begin
Result := FNode.Transparency(FIndex);
end;
function TX3DMaterialInfo_1.ReflSpecular: TVector3Single;
var
A: TVector3SingleList;
begin
A := FNode.FdReflSpecular.Items;
if A.Count = 0 then
CalculateReflSpecular(Result) else
Result := A.L[Min(FIndex, A.Count - 1)];
end;
function TX3DMaterialInfo_1.ReflDiffuse: TVector3Single;
var
A: TVector3SingleList;
begin
A := FNode.FdReflDiffuse.Items;
if A.Count = 0 then
CalculateReflDiffuse(Result) else
Result := A.L[Min(FIndex, A.Count - 1)];
end;
function TX3DMaterialInfo_1.TransSpecular: TVector3Single;
var
A: TVector3SingleList;
begin
A := FNode.FdTransSpecular.Items;
if A.Count = 0 then
CalculateTransSpecular(Result) else
Result := A.L[Min(FIndex, A.Count - 1)];
end;
function TX3DMaterialInfo_1.TransDiffuse: TVector3Single;
var
A: TVector3SingleList;
begin
A := FNode.FdTransDiffuse.Items;
if A.Count = 0 then
CalculateTransDiffuse(Result) else
Result := A.L[Min(FIndex, A.Count - 1)];
end;
function TX3DMaterialInfo_1.ReflSpecularExp: Single;
begin
Result := FNode.ReflSpecularExp(FIndex);
end;
function TX3DMaterialInfo_1.TransSpecularExp: Single;
begin
Result := FNode.TransSpecularExp(FIndex);
end;
procedure TMaterialBindingNode_1.CreateNode;
begin
inherited;
FFdValue := TSFEnum.Create(Self, 'value', ['DEFAULT', 'OVERALL', 'PER_PART', 'PER_PART_INDEXED', 'PER_FACE', 'PER_FACE_INDEXED', 'PER_VERTEX', 'PER_VERTEX_INDEXED'], 1);
FdValue.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdValue);
end;
class function TMaterialBindingNode_1.ClassNodeTypeName: string;
begin
result := 'MaterialBinding';
end;
procedure TNormalBindingNode_1.CreateNode;
begin
inherited;
FFdValue := TSFEnum.Create(Self, 'value', ['DEFAULT', 'OVERALL', 'PER_PART', 'PER_PART_INDEXED', 'PER_FACE', 'PER_FACE_INDEXED', 'PER_VERTEX', 'PER_VERTEX_INDEXED'], 0);
FdValue.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdValue);
end;
class function TNormalBindingNode_1.ClassNodeTypeName: string;
begin
result := 'NormalBinding';
end;
procedure TTexture2Node_1.CreateNode;
begin
inherited;
FFdFilename := TSFString.Create(Self, 'filename', '');
FdFilename.ChangesAlways := [chVisibleVRML1State, chTextureImage];
Fields.Add(FFdFilename);
FFdImage := TSFImage.Create(Self, 'image', nil);
FdImage.ChangesAlways := [chVisibleVRML1State, chTextureImage];
Fields.Add(FFdImage);
FFdWrapS := TSFEnum.Create(Self, 'wrapS', ['REPEAT', 'CLAMP'], TEXWRAP_REPEAT);
FdWrapS.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdWrapS);
FFdWrapT := TSFEnum.Create(Self, 'wrapT', ['REPEAT', 'CLAMP'], TEXWRAP_REPEAT);
FdWrapT.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdWrapT);
FFdModel := TSFEnum.Create(Self, 'model', ['DECAL'], 0);
FdModel.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdModel);
FFdBlendColor := TSFVec3f.Create(Self, 'blendColor', Vector3Single(0, 0, 0));
FdBlendColor.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdBlendColor);
end;
class function TTexture2Node_1.ClassNodeTypeName: string;
begin
result := 'Texture2';
end;
procedure TTexture2Node_1.LoadTextureData(out CacheUsed: boolean);
var
FullUrl: string;
begin
CacheUsed := false;
FTextureUsedFullUrl := '';
{ load from FdFilename }
if FdFilename.Value <> '' then
try
FullUrl := PathFromBaseUrl(FdFilename.Value);
FTextureImage := X3DCache.TextureImage_IncReference(FullUrl, FTextureDDS,
FAlphaChannelData);
FTextureUsedFullUrl := FullUrl;
CacheUsed := true;
Exit;
except
on E: Exception do
{ Remember that OnWarning *may* raise an exception. }
OnWarning(wtMinor, 'Texture', Format(SLoadError,
[E.ClassName, 'texture', URIDisplay(FullUrl), E.Message]));
end;
{ Still not loaded (so FdFilename.Value is '' or LoadImage raised exception) ?
So try to use inlined texture. }
if not FdImage.Value.IsEmpty then
FTextureImage := FdImage.Value.MakeCopy;
end;
function TTexture2Node_1.TextureDescription: string;
function InlinedDescr: string;
begin
result := Format('inlined (width = %d; height = %d; with alpha = %s)',
[ FdImage.Value.Width, FdImage.Value.Height,
BoolToStr[FdImage.Value.HasAlpha] ]);
end;
begin
if FdFilename.Value <> '' then
begin
result := 'file "' +PathFromBaseUrl(FdFilename.Value) +'"';
if not FdImage.Value.IsEmpty then result += ' (and '+InlinedDescr+')';
end else
if not FdImage.Value.IsEmpty then
result := InlinedDescr else
result := 'none';
end;
function TTexture2Node_1.RepeatS: boolean;
begin
Result := FdWrapS.Value = TEXWRAP_REPEAT;
end;
function TTexture2Node_1.RepeatT: boolean;
begin
Result := FdWrapT.Value = TEXWRAP_REPEAT;
end;
procedure TTexture2TransformNode_1.CreateNode;
begin
inherited;
FFdTranslation := TSFVec2f.Create(Self, 'translation', Vector2Single(0, 0));
FdTranslation.ChangesAlways := [chEverything];
Fields.Add(FFdTranslation);
FFdRotation := TSFFloat.Create(Self, 'rotation', 0);
FdRotation.ChangesAlways := [chEverything];
Fields.Add(FFdRotation);
FFdScaleFactor := TSFVec2f.Create(Self, 'scaleFactor', Vector2Single(1, 1));
FdScaleFactor.ChangesAlways := [chEverything];
Fields.Add(FFdScaleFactor);
FFdCenter := TSFVec2f.Create(Self, 'center', Vector2Single(0, 0));
FdCenter.ChangesAlways := [chEverything];
Fields.Add(FFdCenter);
end;
class function TTexture2TransformNode_1.ClassNodeTypeName: string;
begin
result := 'Texture2Transform';
end;
function TTexture2TransformNode_1.TextureMatrixTransformation: TMatrix4Single;
begin
result := TranslationMatrix( Vector3Single(
VectorAdd(FdTranslation.Value, FdCenter.Value) ));
result := MatrixMult(result, RotationMatrixRad(FdRotation.Value, Vector3Single(0, 0, 1)));
result := MatrixMult(result, ScalingMatrix(
Vector3Single( FdScaleFactor.Value[0], FdScaleFactor.Value[1], 1 )));
result := MatrixMult(result, TranslationMatrix(
Vector3Single( -FdCenter.Value[0], -FdCenter.Value[1], 0 )));
end;
procedure TTexture2TransformNode_1.MiddleTraverse(StateStack: TX3DGraphTraverseStateStack);
begin
inherited;
StateStack.Top.TextureTransform := MatrixMult(StateStack.Top.TextureTransform,
TextureMatrixTransformation);
end;
procedure TTextureCoordinate2Node_1.CreateNode;
begin
inherited;
FFdPoint := TMFVec2f.Create(Self, 'point', [Vector2Single(0, 0)]);
FdPoint.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdPoint);
end;
class function TTextureCoordinate2Node_1.ClassNodeTypeName: string;
begin
result := 'TextureCoordinate2';
end;
procedure TShapeHintsNode_1.CreateNode;
begin
inherited;
FFdVertexOrdering := TSFEnum.Create(Self, 'vertexOrdering', ['UNKNOWN_ORDERING', 'CLOCKWISE', 'COUNTERCLOCKWISE'], VERTORDER_UNKNOWN);
FdVertexOrdering.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdVertexOrdering);
FFdShapeType := TSFEnum.Create(Self, 'shapeType', ['UNKNOWN_SHAPE_TYPE', 'SOLID'], SHTYPE_UNKNOWN);
FdShapeType.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdShapeType);
FFdFaceType := TSFEnum.Create(Self, 'faceType', ['UNKNOWN_FACE_TYPE', 'CONVEX'], FACETYPE_CONVEX);
FdFaceType.ChangesAlways := [chGeometryVRML1State];
Fields.Add(FFdFaceType);
FFdCreaseAngle := TSFFloat.Create(Self, 'creaseAngle', DefaultVRML1CreaseAngle);
FdCreaseAngle.Angle := true;
FdCreaseAngle.ChangesAlways := [chVisibleVRML1State];
Fields.Add(FFdCreaseAngle);
end;
class function TShapeHintsNode_1.ClassNodeTypeName: string;
begin
result := 'ShapeHints';
end;
function TShapeHintsNode_1.ParseNodeBodyElement(Lexer: TX3DLexer; Reader: TX3DReaderNames;
const APositionInParent: Integer): boolean;
var
Hints: TSFBitMask;
begin
Result := inherited;
if not Result then
begin
Result := (Lexer.Version.Major = 0) and
(Lexer.Token = vtName) and
(Lexer.TokenName = 'hints');
if Result then
begin
Hints := TSFBitMask.Create(Self, 'hints',
['SOLID', 'ORDERED', 'CONVEX'], 'NONE', '',
[ false, true, true]);
try
Lexer.NextToken;
Hints.Parse(Lexer, Reader, false);
if Hints.Flags[0] then
FdShapeType.Value := SHTYPE_SOLID else
FdShapeType.Value := SHTYPE_UNKNOWN;
if Hints.Flags[1] then
FdVertexOrdering.Value := VERTORDER_COUNTERCLOCKWISE else
FdVertexOrdering.Value := VERTORDER_UNKNOWN;
if Hints.Flags[2] then
FdFaceType.Value := FACETYPE_CONVEX else
FdFaceType.Value := FACETYPE_UNKNOWN;
finally Hints.Free end;
end;
end;
end;
procedure TAbstractTransformationNode_1.MiddleTraverse(StateStack: TX3DGraphTraverseStateStack);
var
M, IM: TMatrix4Single;
begin
inherited;
Transformation(M, IM);
StateStack.Top.Transform := MatrixMult(StateStack.Top.Transform, M);
StateStack.Top.InvertedTransform := MatrixMult(IM, StateStack.Top.InvertedTransform);
StateStack.Top.TransformScale *= TransformScale;
end;
procedure TMatrixTransformNode_1.CreateNode;
begin
inherited;
FFdMatrix := TSFMatrix.Create(Self, 'matrix', IdentityMatrix4Single);
FdMatrix.ChangesAlways := [chEverything];
Fields.Add(FFdMatrix);
end;
class function TMatrixTransformNode_1.ClassNodeTypeName: string;
begin
result := 'MatrixTransform';
end;
procedure TMatrixTransformNode_1.Transformation(
out Matrix, InvertedMatrix: TMatrix4Single);
begin
Matrix := FdMatrix.Value;
if not TryMatrixInverse(Matrix, InvertedMatrix) then
begin
if Log then
WritelnLogMultiline('Matrix',
'Cannot invert matrix:' + NL + MatrixToRawStr(Matrix, ' '));
InvertedMatrix := IdentityMatrix4Single;
end;
end;
function TMatrixTransformNode_1.TransformScale: Single;
begin
Result := FdMatrix.TransformScale;
end;
class function TMatrixTransformNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TRotationNode_1.CreateNode;
begin
inherited;
FFdRotation := TSFRotation.Create(Self, 'rotation', Vector3Single(0, 0, 1), 0);
FdRotation.ChangesAlways := [chEverything];
Fields.Add(FFdRotation);
end;
class function TRotationNode_1.ClassNodeTypeName: string;
begin
result := 'Rotation';
end;
procedure TRotationNode_1.Transformation(
out Matrix, InvertedMatrix: TMatrix4Single);
begin
{ We don't check here for FdRotation.Axis = zero, RotationMatricesRad
will set both matrices for identity in such case. }
RotationMatricesRad(FdRotation.RotationRad, FdRotation.Axis,
Matrix, InvertedMatrix);
end;
function TRotationNode_1.TransformScale: Single;
begin
Result := 1;
end;
procedure TScaleNode_1.CreateNode;
begin
inherited;
FFdScaleFactor := TSFVec3f.Create(Self, 'scaleFactor', Vector3Single(1, 1, 1));
FdScaleFactor.ChangesAlways := [chEverything];
Fields.Add(FFdScaleFactor);
end;
class function TScaleNode_1.ClassNodeTypeName: string;
begin
result := 'Scale';
end;
procedure TScaleNode_1.Transformation(out Matrix, InvertedMatrix: TMatrix4Single);
begin
ScalingMatrices(FdScaleFactor.Value, true, Matrix, InvertedMatrix);
end;
function TScaleNode_1.TransformScale: Single;
begin
Result := ( FdScaleFactor.Value[0] +
FdScaleFactor.Value[1] +
FdScaleFactor.Value[2] ) / 3;
end;
procedure TTransformNode_1.CreateNode;
begin
inherited;
FFdTranslation := TSFVec3f.Create(Self, 'translation', Vector3Single(0, 0, 0));
FdTranslation.ChangesAlways := [chEverything];
Fields.Add(FFdTranslation);
FFdRotation := TSFRotation.Create(Self, 'rotation', Vector3Single(0, 0, 1), 0);
FdRotation.ChangesAlways := [chEverything];
Fields.Add(FFdRotation);
FFdScaleFactor := TSFVec3f.Create(Self, 'scaleFactor', Vector3Single(1, 1, 1));
FdScaleFactor.ChangesAlways := [chEverything];
Fields.Add(FFdScaleFactor);
FFdScaleOrientation := TSFRotation.Create(Self, 'scaleOrientation', Vector3Single(0, 0, 1), 0);
FdScaleOrientation.ChangesAlways := [chEverything];
Fields.Add(FFdScaleOrientation);
FFdCenter := TSFVec3f.Create(Self, 'center', Vector3Single(0, 0, 0));
FdCenter.ChangesAlways := [chEverything];
Fields.Add(FFdCenter);
end;
class function TTransformNode_1.ClassNodeTypeName: string;
begin
result := 'Transform';
end;
procedure TTransformNode_1.Transformation(out Matrix, InvertedMatrix: TMatrix4Single);
var
M, IM, MRotateScaleOrient, IMRotateScaleOrient: TMatrix4Single;
begin
TranslationMatrices(VectorAdd(FdTranslation.Value, FdCenter.Value),
Matrix, InvertedMatrix);
{ Note that even Axis = zero is OK, both M and IM will be identity in
this case. }
RotationMatricesRad(FdRotation.RotationRad, FdRotation.Axis, M, IM);
Matrix := MatrixMult(Matrix, M);
InvertedMatrix := MatrixMult(IM, InvertedMatrix);
if (FdScaleFactor.Value[0] <> 1) or
(FdScaleFactor.Value[1] <> 1) or
(FdScaleFactor.Value[2] <> 1) then
begin
RotationMatricesRad(FdScaleOrientation.RotationRad, FdScaleOrientation.Axis,
MRotateScaleOrient, IMRotateScaleOrient);
Matrix := MatrixMult(Matrix, MRotateScaleOrient);
InvertedMatrix := MatrixMult(IMRotateScaleOrient, InvertedMatrix);
{ For scaling, we explicitly request that if ScalingFactor contains
zero, IM will be forced to be identity. That's because VRML allows
scaling factor to have 0 components (we need InvertedTransform only
for special tricks). }
ScalingMatrices(FdScaleFactor.Value, true, M, IM);
Matrix := MatrixMult(Matrix, M);
InvertedMatrix := MatrixMult(IM, InvertedMatrix);
Matrix := MatrixMult(Matrix, IMRotateScaleOrient);
InvertedMatrix := MatrixMult(MRotateScaleOrient, InvertedMatrix);
end;
TranslationMatrices(VectorNegate(FdCenter.Value), M, IM);
Matrix := MatrixMult(Matrix, M);
InvertedMatrix := MatrixMult(IM, InvertedMatrix);
end;
function TTransformNode_1.TransformScale: Single;
begin
Result := ( FdScaleFactor.Value[0] +
FdScaleFactor.Value[1] +
FdScaleFactor.Value[2] ) / 3;
end;
class function TTransformNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TTranslationNode_1.CreateNode;
begin
inherited;
FFdTranslation := TSFVec3f.Create(Self, 'translation', Vector3Single(0, 0, 0));
FdTranslation.ChangesAlways := [chEverything];
Fields.Add(FFdTranslation);
end;
class function TTranslationNode_1.ClassNodeTypeName: string;
begin
result := 'Translation';
end;
procedure TTranslationNode_1.Transformation(
out Matrix, InvertedMatrix: TMatrix4Single);
begin
TranslationMatrices(FdTranslation.Value, Matrix, InvertedMatrix);
end;
function TTranslationNode_1.TransformScale: Single;
begin
Result := 1;
end;
procedure TAbstractCameraNode_1.CreateNode;
begin
inherited;
{ Note that the default "position" value for VRML 1.0 is different
than for VRML >= 2.0 (where is (0, 0, 10)). }
FFdPosition := TSFVec3f.Create(Self, 'position', Vector3Single(0, 0, 1));
FdPosition.ChangesAlways := [chViewpointVectors];
Fields.Add(FFdPosition);
FFdFocalDistance := TSFFloat.Create(Self, 'focalDistance', 5, true);
Fields.Add(FFdFocalDistance);
FFdNearDistance := TSFFloat.Create(Self, 'nearDistance', 0);
FdNearDistance.ChangesAlways := [chViewpointProjection];
Fields.Add(FFdNearDistance);
FFdFarDistance := TSFFloat.Create(Self, 'farDistance', 0);
FdFarDistance.ChangesAlways := [chViewpointProjection];
Fields.Add(FFdFarDistance);
end;
function TAbstractCameraNode_1.Position: TSFVec3f;
begin
Result := FdPosition;
end;
procedure TOrthographicCameraNode_1.CreateNode;
begin
inherited;
FFdHeight := TSFFloat.Create(Self, 'height', 2, true);
Fields.Add(FFdHeight);
end;
class function TOrthographicCameraNode_1.ClassNodeTypeName: string;
begin
result := 'OrthographicCamera';
end;
class function TOrthographicCameraNode_1.ProjectionType: TProjectionType;
begin
result := ptOrthographic;
end;
procedure TPerspectiveCameraNode_1.CreateNode;
begin
inherited;
FFdHeightAngle := TSFFloat.Create(Self, 'heightAngle', Pi / 4, true);
Fields.Add(FFdHeightAngle);
end;
class function TPerspectiveCameraNode_1.ClassNodeTypeName: string;
begin
result := 'PerspectiveCamera';
end;
class function TPerspectiveCameraNode_1.ProjectionType: TProjectionType;
begin
result := ptPerspective;
end;
procedure TDirectionalLightNode_1.CreateNode;
begin
inherited;
{ Default ambientIntensity value for VRML 1.0.
See http://castle-engine.sourceforge.net/x3d_extensions.php#ext_light_attenuation }
FdAmbientIntensity.Value := -1;
FdAmbientIntensity.DefaultValue := -1;
end;
class function TDirectionalLightNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
function TDirectionalLightNode_1.Scope: TLightScope;
begin
if FdGlobal.Value then
Result := lsGlobal else
Result := lsLocalVRML1;
end;
procedure TPointLightNode_1.CreateNode;
begin
inherited;
{ Default ambientIntensity value for VRML 1.0.
See http://castle-engine.sourceforge.net/x3d_extensions.php#ext_light_attenuation }
FdAmbientIntensity.Value := -1;
FdAmbientIntensity.DefaultValue := -1;
{ Default location value for VRML 1.0, was changed in VRML >= 2.0 }
FdLocation.Value := Vector3Single(0, 0, 1);
FdLocation.DefaultValue := Vector3Single(0, 0, 1);
end;
class function TPointLightNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
function TPointLightNode_1.HasRadius: boolean;
begin
Result := false;
end;
function TPointLightNode_1.Scope: TLightScope;
begin
if FdGlobal.Value then
Result := lsGlobal else
Result := lsLocalVRML1;
end;
procedure TSpotLightNode_1.CreateNode;
begin
inherited;
{ Default ambientIntensity value for VRML 1.0.
See http://castle-engine.sourceforge.net/x3d_extensions.php#ext_light_attenuation }
FdAmbientIntensity.Value := -1;
FdAmbientIntensity.DefaultValue := -1;
{ Default location value for VRML 1.0, was changed in VRML >= 2.0 }
FdLocation.Value := Vector3Single(0, 0, 1);
FdLocation.DefaultValue := Vector3Single(0, 0, 1);
FFdDirection := TSFVec3f.Create(Self, 'direction', Vector3Single(0, 0, -1));
FdDirection.ChangesAlways := [chLightInstanceProperty, chLightLocationDirection];
Fields.Add(FFdDirection);
FFdDropOffRate := TSFFloat.Create(Self, 'dropOffRate', 0);
FdDropOffRate.ChangesAlways := [chVisibleNonGeometry];
Fields.Add(FFdDropOffRate);
FFdCutOffAngle := TSFFloat.Create(Self, 'cutOffAngle', Pi / 4);
FdCutOffAngle.ChangesAlways := [chVisibleNonGeometry];
Fields.Add(FFdCutOffAngle);
end;
class function TSpotLightNode_1.ClassNodeTypeName: string;
begin
result := 'SpotLight';
end;
function TSpotLightNode_1.SpotExp: Single;
begin
result := FdDropOffRate.Value * 128.0;
end;
class function TSpotLightNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TSpotLightNode_1.UpdateLightInstance(var LightInstance: TLightInstance);
begin
inherited;
LightInstance.Direction := Normalized(MatrixMultDirection(
LightInstance.Transform, FdDirection.Value));
end;
function TSpotLightNode_1.ProjectionMatrix: TMatrix4Single;
var
Angle, N, F: Single;
begin
{ If author didn't provide and X3DShadowMaps unit didn't calculate
values for some fields, then use FallbackProjection* defaults here. }
{ Implementation just like for TSpotLightNode,
except I was too lazy to add here projectionAngle. }
Angle := 2 * FdCutOffAngle.Value;
N := FdProjectionNear.Value;
if N = 0 then N := FallbackProjectionNear;
F := FdProjectionFar.Value;
if F = 0 then F := FallbackProjectionFar;
Result := PerspectiveProjMatrixRad(Angle, 1, N, F);
end;
function TSpotLightNode_1.ModelviewMatrix: TMatrix4Single;
var
Pos, Dir, Up: TVector3Single;
begin
GetView(Pos, Dir, Up);
Result := LookDirMatrix(Pos, Dir, Up);
end;
function TSpotLightNode_1.ModelviewRotationMatrix: TMatrix4Single;
var
Pos, Dir, Up: TVector3Single;
begin
GetView(Pos, Dir, Up);
Result := LookDirMatrix(ZeroVector3Single, Dir, Up);
end;
function TSpotLightNode_1.LocationLocal: TVector3Single;
begin
Result := FdLocation.Value;
end;
function TSpotLightNode_1.DirectionLocal: TVector3Single;
begin
Result := FdDirection.Value;
end;
function TSpotLightNode_1.HasRadius: boolean;
begin
Result := false;
end;
procedure TSpotLightNode_1.Box3DDistances(const Box: TBox3D;
out MinDistance, MaxDistance: Single);
begin
{ TODO: MaxDistance should be a little larger, as spot light rays
are not parallel. }
Box.DirectionDistances(Location, Direction, MinDistance, MaxDistance);
end;
function TSpotLightNode_1.Scope: TLightScope;
begin
if FdGlobal.Value then
Result := lsGlobal else
Result := lsLocalVRML1;
end;
procedure TGroupNode_1.CreateNode;
begin
inherited;
VRML1ChildrenAllowed := true;
VRML1ChildrenParsingAllowed := true;
end;
class function TGroupNode_1.ClassNodeTypeName: string;
begin
result := 'Group';
end;
class function TGroupNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TAbstractSeparatorNode_1.CreateNode;
begin
inherited;
VRML1ChildrenAllowed := true;
VRML1ChildrenParsingAllowed := true;
end;
type
TVRML1SeparatorEnumerator = class
State: TX3DGraphTraverseState;
procedure Enumerate(Node, Child: TX3DNode);
end;
procedure TVRML1SeparatorEnumerator.Enumerate(Node, Child: TX3DNode);
begin
if Child is TLocalFogNode then
State.LocalFog := TLocalFogNode(Child);
end;
procedure TAbstractSeparatorNode_1.BeforeTraverse(StateStack: TX3DGraphTraverseStateStack);
var
Enumerator: TVRML1SeparatorEnumerator;
begin
inherited;
StateStack.Push;
{ Use TVRML1SeparatorEnumerator, to propagate LocalFog into children,
just like VRML >= 2 grouping nodes. Otherwise LocalFog would
not never work in VRML 1.0. }
Enumerator := TVRML1SeparatorEnumerator.Create;
try
Enumerator.State := StateStack.Top;
DirectEnumerateActive(@Enumerator.Enumerate);
finally FreeAndNil(Enumerator) end;
end;
procedure TAbstractSeparatorNode_1.AfterTraverse(StateStack: TX3DGraphTraverseStateStack);
begin
StateStack.Pop;
inherited;
end;
procedure TSeparatorNode_1.CreateNode;
begin
inherited;
FFdRenderCulling := TSFEnum.Create(Self, 'renderCulling', ['ON', 'OFF', 'AUTO'], 2);
Fields.Add(FFdRenderCulling);
end;
class function TSeparatorNode_1.ClassNodeTypeName: string;
begin
result := 'Separator';
end;
procedure TSwitchNode_1.CreateNode;
begin
inherited;
FFdWhichChild := TSFLong.Create(Self, 'whichChild', -1);
FdWhichChild.ChangesAlways := [chEverything];
Fields.Add(FFdWhichChild);
VRML1ChildrenAllowed := true;
VRML1ChildrenParsingAllowed := true;
end;
class function TSwitchNode_1.ClassNodeTypeName: string;
begin
result := 'Switch';
end;
procedure TSwitchNode_1.DirectEnumerateActive(Func: TEnumerateChildrenFunction);
begin
if FdWhichChild.Value = -3 then
begin
{ Enumerate all.
Note : value -3 is already deprecated in VRML 1.0;
but I support it, at least for now. }
inherited;
end else
begin
{ Jezeli whichChild jest nieprawidlowe to w rezultacie nie wejdziemy w
zadne Child. Wpp. wejdziemy w jedno wyznaczone child. I o to chodzi.
(note : value -1 is no special value; any value that doesn't specify
valid child number and is not -3 instructs Switch to not enter
into any child. This is conforming with the VRML 97 specification) }
if Between(FdWhichChild.Value, 0, VRML1ChildrenCount - 1) then
Func(Self, VRML1Children[FdWhichChild.Value]);
end;
end;
class function TSwitchNode_1.ForVRMLVersion(const Version: TX3DVersion): boolean;
begin
Result := Version.Major <= 1;
end;
procedure TTransformSeparatorNode_1.CreateNode;
begin
inherited;
VRML1ChildrenAllowed := true;
VRML1ChildrenParsingAllowed := true;
end;
class function TTransformSeparatorNode_1.ClassNodeTypeName: string;
begin
result := 'TransformSeparator';
end;
procedure TTransformSeparatorNode_1.BeforeTraverse(StateStack: TX3DGraphTraverseStateStack);
begin
inherited;
{ We don't copy whole State here, as changes to other properties of
state should "leak out" from TransformSeparator node. }
OriginalTransform := StateStack.Top.Transform;
OriginalInvertedTransform := StateStack.Top.InvertedTransform;
OriginalTransformScale := StateStack.Top.TransformScale;
end;
procedure TTransformSeparatorNode_1.AfterTraverse(StateStack: TX3DGraphTraverseStateStack);
begin
StateStack.Top.Transform := OriginalTransform;
StateStack.Top.InvertedTransform := OriginalInvertedTransform;
StateStack.Top.TransformScale := OriginalTransformScale;
inherited;
end;
procedure TWWWAnchorNode_1.CreateNode;
begin
inherited;
FFdName := TSFString.Create(Self, 'name', '');
Fields.Add(FFdName);
FFdDescription := TSFString.Create(Self, 'description', '');
Fields.Add(FFdDescription);
FFdMap := TSFEnum.Create(Self, 'map', ['NONE', 'POINT'], 0);
Fields.Add(FFdMap);
end;
class function TWWWAnchorNode_1.ClassNodeTypeName: string;
begin
result := 'WWWAnchor';
end;
procedure TWWWInlineNode_1.CreateNode;
begin
inherited;
{ change "url" field to "name", with default value being an empty string }
FdUrl.AddAlternativeName('name', 1);
FdUrl.Items.Add('');
FdUrl.AssignDefaultValueFromValue;
{ bboxSize is (0, 0, 0) in VRMl 1.0 (in VRML 2.0/X3D it's (-1, -1, -1)) }
FFdBboxSize.Value := Vector3Single(0, 0, 0);
FFdBboxSize.AssignDefaultValueFromValue;
FFdSeparate := TSFBool.Create(Self, 'separate', true);
FdSeparate.ChangesAlways := [chEverything];
Fields.Add(FFdSeparate);
end;
class function TWWWInlineNode_1.ClassNodeTypeName: string;
begin
result := 'WWWInline';
end;
function TWWWInlineNode_1.SeparateGroup: boolean;
begin
Result := FdSeparate.Value;
end;
procedure RegisterVRML1Nodes;
begin
NodesManager.RegisterNodeClasses([
TAsciiTextNode_1, TConeNode_1, TCubeNode_1, TCylinderNode_1,
TIndexedFaceSetNode_1, TIndexedLineSetNode_1,
TPointSetNode_1, TSphereNode_1,
TCoordinate3Node_1, TFontStyleNode_1, TInfoNode_1, TLODNode_1, TMaterialNode_1,
TMaterialBindingNode_1, TNormalBindingNode_1, TTexture2Node_1,
TTexture2TransformNode_1,
TTextureCoordinate2Node_1, TShapeHintsNode_1,
TMatrixTransformNode_1, TRotationNode_1,
TScaleNode_1, TTransformNode_1,
TTranslationNode_1,
TOrthographicCameraNode_1, TPerspectiveCameraNode_1,
TDirectionalLightNode_1, TPointLightNode_1, TSpotLightNode_1,
TGroupNode_1, TSeparatorNode_1, TSwitchNode_1, TTransformSeparatorNode_1,
TWWWAnchorNode_1,
TWWWInlineNode_1
]);
end;
{$endif read_implementation}
|