x_ite 4.7.12 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (759) hide show
  1. package/.vscode/settings.json +9 -2
  2. package/Makefile +27 -24
  3. package/build/bin/version-number.pl +1 -1
  4. package/build/bin/version.pl +3 -3
  5. package/build/parts/default.start.frag.js +2 -2
  6. package/build/parts/x_ite.end.frag.js +1 -2
  7. package/build/parts/x_ite.start.frag.js +4 -7
  8. package/dist/assets/components/annotation.js +312 -312
  9. package/dist/assets/components/annotation.min.js +1 -1
  10. package/dist/assets/components/cad-geometry.js +536 -538
  11. package/dist/assets/components/cad-geometry.min.js +1 -1
  12. package/dist/assets/components/cube-map-texturing.js +797 -796
  13. package/dist/assets/components/cube-map-texturing.min.js +1 -1
  14. package/dist/assets/components/dis.js +487 -472
  15. package/dist/assets/components/dis.min.js +1 -1
  16. package/dist/assets/components/event-utilities.js +486 -505
  17. package/dist/assets/components/event-utilities.min.js +1 -1
  18. package/dist/assets/components/geometry2d.js +1221 -1271
  19. package/dist/assets/components/geometry2d.min.js +1 -1
  20. package/dist/assets/components/geospatial.js +2657 -2653
  21. package/dist/assets/components/geospatial.min.js +1 -2
  22. package/dist/assets/components/h-anim.js +640 -640
  23. package/dist/assets/components/h-anim.min.js +1 -1
  24. package/dist/assets/components/key-device-sensor.js +547 -549
  25. package/dist/assets/components/key-device-sensor.min.js +1 -1
  26. package/dist/assets/components/layout.js +1435 -1433
  27. package/dist/assets/components/layout.min.js +1 -1
  28. package/dist/assets/components/nurbs.js +3942 -3964
  29. package/dist/assets/components/nurbs.min.js +1 -2
  30. package/dist/assets/components/particle-systems.js +3227 -3238
  31. package/dist/assets/components/particle-systems.min.js +1 -2
  32. package/dist/assets/components/picking.js +1704 -1712
  33. package/dist/assets/components/picking.min.js +1 -1
  34. package/dist/assets/components/projective-texture-mapping.js +553 -553
  35. package/dist/assets/components/projective-texture-mapping.min.js +1 -1
  36. package/dist/assets/components/rigid-body-physics.js +3255 -3265
  37. package/dist/assets/components/rigid-body-physics.min.js +1 -59
  38. package/dist/assets/components/scripting.js +544 -549
  39. package/dist/assets/components/scripting.min.js +1 -1
  40. package/dist/assets/components/texturing-3d.js +2716 -2651
  41. package/dist/assets/components/texturing-3d.min.js +131 -48
  42. package/dist/assets/components/volume-rendering.js +2815 -2804
  43. package/dist/assets/components/volume-rendering.min.js +1 -3
  44. package/dist/assets/components/x_ite.js +142 -144
  45. package/dist/assets/components/x_ite.min.js +1 -1
  46. package/dist/assets/shaders/webgl1/Gouraud.fs +52 -15
  47. package/dist/assets/shaders/webgl1/Gouraud.vs +8 -9
  48. package/dist/assets/shaders/webgl1/{Wireframe.fs → Line.fs} +0 -0
  49. package/dist/assets/shaders/webgl1/{Wireframe.vs → Line.vs} +1 -1
  50. package/dist/assets/shaders/webgl1/PBR.fs +785 -0
  51. package/dist/assets/shaders/webgl1/PBR.vs +37 -0
  52. package/dist/assets/shaders/webgl1/Phong.fs +204 -32
  53. package/dist/assets/shaders/webgl1/Phong.vs +2 -3
  54. package/dist/assets/shaders/webgl1/{PointSet.fs → Point.fs} +59 -33
  55. package/dist/assets/shaders/webgl1/{PointSet.vs → Point.vs} +2 -2
  56. package/dist/assets/shaders/webgl1/Unlit.fs +73 -18
  57. package/dist/assets/shaders/webgl1/Unlit.vs +2 -3
  58. package/dist/assets/shaders/webgl2/Gouraud.fs +31 -19
  59. package/dist/assets/shaders/webgl2/Gouraud.vs +8 -9
  60. package/dist/assets/shaders/webgl2/{Wireframe.fs → Line.fs} +0 -0
  61. package/dist/assets/shaders/webgl2/{Wireframe.vs → Line.vs} +1 -1
  62. package/dist/assets/shaders/webgl2/PBR.fs +913 -0
  63. package/dist/assets/shaders/webgl2/PBR.vs +37 -0
  64. package/dist/assets/shaders/webgl2/Phong.fs +196 -35
  65. package/dist/assets/shaders/webgl2/Phong.vs +2 -3
  66. package/dist/assets/shaders/webgl2/{PointSet.fs → Point.fs} +87 -86
  67. package/dist/assets/shaders/webgl2/{PointSet.vs → Point.vs} +2 -2
  68. package/dist/assets/shaders/webgl2/Unlit.fs +55 -22
  69. package/dist/assets/shaders/webgl2/Unlit.vs +2 -3
  70. package/dist/example.html +2 -2
  71. package/dist/x_ite.css +316 -328
  72. package/dist/x_ite.js +55663 -52034
  73. package/dist/x_ite.min.js +79 -41
  74. package/dist/x_ite.zip +0 -0
  75. package/docs/Custom-Shaders.md +4 -3
  76. package/docs/_config.yml +1 -1
  77. package/docs/index.md +60 -7
  78. package/package.json +20 -20
  79. package/src/assets/components/annotation.js +24 -24
  80. package/src/assets/components/cad-geometry.js +24 -25
  81. package/src/assets/components/cube-map-texturing.js +18 -19
  82. package/src/assets/components/dis.js +22 -23
  83. package/src/assets/components/event-utilities.js +28 -29
  84. package/src/assets/components/geometry2d.js +28 -29
  85. package/src/assets/components/geospatial.js +34 -35
  86. package/src/assets/components/h-anim.js +22 -22
  87. package/src/assets/components/key-device-sensor.js +18 -19
  88. package/src/assets/components/layout.js +24 -25
  89. package/src/assets/components/nurbs.js +44 -45
  90. package/src/assets/components/particle-systems.js +36 -37
  91. package/src/assets/components/picking.js +25 -25
  92. package/src/assets/components/projective-texture-mapping.js +16 -16
  93. package/src/assets/components/rigid-body-physics.js +48 -48
  94. package/src/assets/components/scripting.js +14 -15
  95. package/src/assets/components/texturing-3d.js +26 -27
  96. package/src/assets/components/volume-rendering.js +46 -46
  97. package/src/assets/components/x_ite.js +12 -12
  98. package/src/assets/shaders/Types.glsl +230 -51
  99. package/src/assets/shaders/webgl1/Background.fs +2 -2
  100. package/src/assets/shaders/webgl1/Background.vs +4 -4
  101. package/src/assets/shaders/webgl1/Depth.fs +2 -2
  102. package/src/assets/shaders/webgl1/Depth.vs +3 -3
  103. package/src/assets/shaders/webgl1/Fallback.fs +15 -15
  104. package/src/assets/shaders/webgl1/Fallback.vs +5 -5
  105. package/src/assets/shaders/webgl1/FallbackUnlit.fs +4 -4
  106. package/src/assets/shaders/webgl1/FallbackUnlit.vs +3 -3
  107. package/src/assets/shaders/webgl1/Gouraud.fs +14 -14
  108. package/src/assets/shaders/webgl1/Gouraud.vs +54 -69
  109. package/src/assets/shaders/webgl1/Line.fs +74 -0
  110. package/src/assets/shaders/webgl1/Line.vs +63 -0
  111. package/src/assets/shaders/webgl1/PBR.fs +364 -0
  112. package/src/assets/shaders/webgl1/PBR.vs +46 -0
  113. package/src/assets/shaders/webgl1/Phong.fs +207 -84
  114. package/src/assets/shaders/webgl1/Phong.vs +17 -18
  115. package/src/assets/shaders/webgl1/Point.fs +88 -0
  116. package/src/assets/shaders/webgl1/Point.vs +70 -0
  117. package/src/assets/shaders/webgl1/Unlit.fs +53 -28
  118. package/src/assets/shaders/webgl1/Unlit.vs +17 -18
  119. package/src/assets/shaders/webgl1/include/ClipPlanes.glsl +7 -7
  120. package/src/assets/shaders/webgl1/include/Colors.glsl +27 -0
  121. package/src/assets/shaders/webgl1/include/Fog.glsl +17 -17
  122. package/src/assets/shaders/webgl1/include/Hatch.glsl +8 -8
  123. package/src/assets/shaders/webgl1/include/Normal.glsl +44 -0
  124. package/src/assets/shaders/webgl1/include/Pack.glsl +11 -11
  125. package/src/assets/shaders/webgl1/include/Perlin.glsl +19 -19
  126. package/src/assets/shaders/webgl1/include/Shadow.glsl +212 -212
  127. package/src/assets/shaders/webgl1/include/SpotFactor.glsl +12 -0
  128. package/src/assets/shaders/webgl1/include/Texture.glsl +444 -393
  129. package/src/assets/shaders/webgl2/Background.fs +2 -2
  130. package/src/assets/shaders/webgl2/Background.vs +4 -4
  131. package/src/assets/shaders/webgl2/Depth.fs +2 -2
  132. package/src/assets/shaders/webgl2/Depth.vs +3 -3
  133. package/src/assets/shaders/webgl2/Gouraud.fs +14 -14
  134. package/src/assets/shaders/webgl2/Gouraud.vs +54 -69
  135. package/src/assets/shaders/webgl2/Line.fs +73 -0
  136. package/src/assets/shaders/webgl2/Line.vs +64 -0
  137. package/src/assets/shaders/webgl2/PBR.fs +370 -0
  138. package/src/assets/shaders/webgl2/PBR.vs +48 -0
  139. package/src/assets/shaders/webgl2/Phong.fs +219 -84
  140. package/src/assets/shaders/webgl2/Phong.vs +17 -18
  141. package/src/assets/shaders/webgl2/Point.fs +87 -0
  142. package/src/assets/shaders/webgl2/Point.vs +71 -0
  143. package/src/assets/shaders/webgl2/Unlit.fs +56 -28
  144. package/src/assets/shaders/webgl2/Unlit.vs +17 -18
  145. package/src/assets/shaders/webgl2/include/ClipPlanes.glsl +7 -7
  146. package/src/assets/shaders/webgl2/include/Colors.glsl +27 -0
  147. package/src/assets/shaders/webgl2/include/Fog.glsl +34 -34
  148. package/src/assets/shaders/webgl2/include/Hatch.glsl +8 -8
  149. package/src/assets/shaders/webgl2/include/Normal.glsl +46 -0
  150. package/src/assets/shaders/webgl2/include/Pack.glsl +11 -11
  151. package/src/assets/shaders/webgl2/include/Perlin.glsl +19 -20
  152. package/src/assets/shaders/webgl2/include/Shadow.glsl +226 -226
  153. package/src/assets/shaders/webgl2/include/SpotFactor.glsl +12 -0
  154. package/src/assets/shaders/webgl2/include/Texture.glsl +557 -537
  155. package/src/bookmarks.js +92 -92
  156. package/src/examples.js +147 -147
  157. package/src/lib/ammojs/AmmoJS.js +2 -2
  158. package/src/lib/ammojs/Makefile +14 -15
  159. package/src/lib/jquery.fullscreen-min.js +2 -2
  160. package/src/lib/nurbs/extras/sample.js +215 -215
  161. package/src/lib/nurbs/nurbs.js +326 -326
  162. package/src/lib/nurbs/src/evaluate.js +405 -405
  163. package/src/lib/nurbs/src/numerical-derivative.js +48 -48
  164. package/src/lib/nurbs/src/support.js +143 -143
  165. package/src/lib/nurbs/src/transform.js +70 -70
  166. package/src/lib/nurbs/src/utils/accessor-preamble.js +23 -23
  167. package/src/lib/nurbs/src/utils/bisection-search.js +18 -18
  168. package/src/lib/nurbs/src/utils/cache-key.js +49 -50
  169. package/src/lib/nurbs/src/utils/create-accessors.js +101 -101
  170. package/src/lib/nurbs/src/utils/infer-type.js +43 -43
  171. package/src/lib/nurbs/src/utils/is-array-like.js +5 -5
  172. package/src/lib/nurbs/src/utils/is-ndarray-like.js +11 -11
  173. package/src/lib/nurbs/src/utils/is-ndarray.js +13 -13
  174. package/src/lib/nurbs/src/utils/ndloop.js +18 -18
  175. package/src/lib/nurbs/src/utils/size-getter.js +15 -15
  176. package/src/lib/nurbs/src/utils/variable.js +25 -25
  177. package/src/lib/opentype.js/bin/ot +27 -27
  178. package/src/lib/opentype.js/dist/opentype.js +5 -5
  179. package/src/lib/opentype.js/font-inspector.html +1 -1
  180. package/src/lib/opentype.js/site.css +1 -3
  181. package/src/locale/gettext.js +73 -73
  182. package/src/spinner.css +40 -43
  183. package/src/standard/Geospatial/Geodetic.js +195 -195
  184. package/src/standard/Geospatial/ReferenceEllipsoids.js +43 -43
  185. package/src/standard/Geospatial/UniversalTransverseMercator.js +159 -159
  186. package/src/standard/Math/Algorithm.js +199 -187
  187. package/src/standard/Math/Algorithms/Bezier.js +80 -80
  188. package/src/standard/Math/Algorithms/MergeSort.js +49 -49
  189. package/src/standard/Math/Algorithms/PartialSort.js +36 -36
  190. package/src/standard/Math/Algorithms/QuickSort.js +51 -51
  191. package/src/standard/Math/Algorithms/SAT.js +62 -62
  192. package/src/standard/Math/Algorithms/eigendecomposition.js +141 -141
  193. package/src/standard/Math/Geometry/Box2.js +205 -205
  194. package/src/standard/Math/Geometry/Box3.js +624 -624
  195. package/src/standard/Math/Geometry/Camera.js +68 -68
  196. package/src/standard/Math/Geometry/Cylinder3.js +112 -112
  197. package/src/standard/Math/Geometry/Line3.js +188 -153
  198. package/src/standard/Math/Geometry/Plane3.js +120 -120
  199. package/src/standard/Math/Geometry/Sphere3.js +148 -148
  200. package/src/standard/Math/Geometry/Spheroid3.js +38 -38
  201. package/src/standard/Math/Geometry/Triangle2.js +19 -19
  202. package/src/standard/Math/Geometry/Triangle3.js +148 -148
  203. package/src/standard/Math/Geometry/ViewVolume.js +359 -359
  204. package/src/standard/Math/Numbers/Color3.js +219 -214
  205. package/src/standard/Math/Numbers/Color4.js +148 -142
  206. package/src/standard/Math/Numbers/Complex.js +139 -139
  207. package/src/standard/Math/Numbers/Matrix2.js +193 -193
  208. package/src/standard/Math/Numbers/Matrix3.js +679 -679
  209. package/src/standard/Math/Numbers/Matrix4.js +883 -883
  210. package/src/standard/Math/Numbers/Quaternion.js +496 -496
  211. package/src/standard/Math/Numbers/Rotation4.js +421 -415
  212. package/src/standard/Math/Numbers/Vector2.js +220 -220
  213. package/src/standard/Math/Numbers/Vector3.js +280 -280
  214. package/src/standard/Math/Numbers/Vector4.js +296 -296
  215. package/src/standard/Math/Utility/BVH.js +303 -303
  216. package/src/standard/Math/Utility/MatrixStack.js +64 -64
  217. package/src/standard/Networking/BinaryTransport.js +67 -67
  218. package/src/standard/Time/MicroTime.js +22 -22
  219. package/src/standard/Utility/DataStorage.js +85 -81
  220. package/src/standard/Utility/MapUtilities.js +14 -1
  221. package/src/standard/Utility/ObjectCache.js +24 -24
  222. package/src/standard/Utility/Shuffle.js +13 -13
  223. package/src/tests.js +355 -384
  224. package/src/x_ite/Base/Events.js +64 -55
  225. package/src/x_ite/{Basic/X3DArrayField.js → Base/FieldArray.js} +19 -12
  226. package/src/x_ite/Base/FieldDefinitionArray.js +75 -0
  227. package/src/x_ite/{Basic/FieldDefinitionArray.js → Base/X3DArrayField.js} +35 -59
  228. package/src/x_ite/Base/X3DBaseNode.js +588 -0
  229. package/src/x_ite/{Bits → Base}/X3DCast.js +23 -22
  230. package/src/x_ite/Base/X3DChildObject.js +68 -62
  231. package/src/x_ite/{Bits → Base}/X3DConstants.js +85 -85
  232. package/src/x_ite/Base/X3DEventObject.js +73 -68
  233. package/src/x_ite/Base/X3DField.js +450 -0
  234. package/src/x_ite/Base/X3DFieldDefinition.js +78 -0
  235. package/src/x_ite/Base/X3DInfoArray.js +291 -0
  236. package/src/x_ite/Base/X3DObject.js +152 -109
  237. package/src/x_ite/Base/X3DObjectArrayField.js +573 -0
  238. package/src/x_ite/Base/X3DTypedArrayField.js +866 -0
  239. package/src/x_ite/Browser/Core/BrowserOptions.js +376 -394
  240. package/src/x_ite/Browser/Core/BrowserProperties.js +38 -38
  241. package/src/x_ite/Browser/Core/BrowserTimings.js +173 -172
  242. package/src/x_ite/Browser/Core/ContextMenu.js +547 -551
  243. package/src/x_ite/Browser/Core/Notification.js +57 -56
  244. package/src/x_ite/Browser/Core/PrimitiveQuality.js +8 -8
  245. package/src/x_ite/Browser/Core/RenderingProperties.js +55 -55
  246. package/src/x_ite/Browser/Core/Shading.js +10 -10
  247. package/src/x_ite/Browser/Core/TextureQuality.js +8 -8
  248. package/src/x_ite/Browser/Core/X3DCoreContext.js +746 -724
  249. package/src/x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext.js +33 -25
  250. package/src/x_ite/Browser/Followers/X3DArrayChaserTemplate.js +23 -23
  251. package/src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +127 -127
  252. package/src/x_ite/Browser/Geometry2D/Arc2DOptions.js +25 -25
  253. package/src/x_ite/Browser/Geometry2D/ArcClose2DOptions.js +25 -25
  254. package/src/x_ite/Browser/Geometry2D/Circle2DOptions.js +56 -55
  255. package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +116 -116
  256. package/src/x_ite/Browser/Geometry2D/Rectangle2DOptions.js +59 -59
  257. package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +80 -77
  258. package/src/x_ite/Browser/Geometry3D/BoxOptions.js +70 -70
  259. package/src/x_ite/Browser/Geometry3D/ConeOptions.js +26 -26
  260. package/src/x_ite/Browser/Geometry3D/CylinderOptions.js +27 -27
  261. package/src/x_ite/Browser/Geometry3D/IcoSphere.js +357 -357
  262. package/src/x_ite/Browser/Geometry3D/IcoSphereOptions.js +61 -61
  263. package/src/x_ite/Browser/Geometry3D/QuadSphereOptions.js +243 -241
  264. package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +37 -34
  265. package/src/x_ite/Browser/Geospatial/Geocentric.js +27 -27
  266. package/src/x_ite/Browser/Geospatial/Geospatial.js +157 -156
  267. package/src/x_ite/Browser/Grouping/X3DGroupingContext.js +38 -33
  268. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +128 -130
  269. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +39 -41
  270. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator2.js +3 -3
  271. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator3.js +3 -3
  272. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +54 -56
  273. package/src/x_ite/Browser/Interpolation/SquatInterpolator.js +54 -56
  274. package/src/x_ite/Browser/KeyDeviceSensor/X3DKeyDeviceSensorContext.js +44 -41
  275. package/src/x_ite/Browser/Layering/X3DLayeringContext.js +20 -18
  276. package/src/x_ite/Browser/Layout/ScreenText.js +406 -405
  277. package/src/x_ite/Browser/Layout/X3DLayoutContext.js +36 -30
  278. package/src/x_ite/Browser/Lighting/X3DLightingContext.js +54 -50
  279. package/src/x_ite/Browser/NURBS/NURBS.js +417 -417
  280. package/src/x_ite/Browser/Navigation/ExamineViewer.js +753 -753
  281. package/src/x_ite/Browser/Navigation/FlyViewer.js +39 -39
  282. package/src/x_ite/Browser/Navigation/LookAtViewer.js +461 -461
  283. package/src/x_ite/Browser/Navigation/NoneViewer.js +18 -18
  284. package/src/x_ite/Browser/Navigation/PlaneViewer.js +193 -193
  285. package/src/x_ite/Browser/Navigation/WalkViewer.js +61 -61
  286. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +709 -710
  287. package/src/x_ite/Browser/Navigation/X3DNavigationContext.js +188 -182
  288. package/src/x_ite/Browser/Navigation/X3DViewer.js +160 -160
  289. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +152 -143
  290. package/src/x_ite/Browser/Networking/urls.js +31 -31
  291. package/src/x_ite/Browser/ParticleSystems/X3DParticleSystemsContext.js +17 -13
  292. package/src/x_ite/Browser/Picking/IntersectionType.js +7 -7
  293. package/src/x_ite/Browser/Picking/MatchCriterion.js +8 -8
  294. package/src/x_ite/Browser/Picking/SortOrder.js +9 -9
  295. package/src/x_ite/Browser/Picking/VolumePicker.js +138 -138
  296. package/src/x_ite/Browser/Picking/X3DPickingContext.js +80 -69
  297. package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +208 -209
  298. package/src/x_ite/Browser/PointingDeviceSensor/PointingDeviceSensorContainer.js +34 -34
  299. package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +269 -263
  300. package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +132 -119
  301. package/src/x_ite/Browser/RigidBodyPhysics/AppliedParametersType.js +14 -14
  302. package/src/x_ite/Browser/Scripting/X3DScriptingContext.js +20 -19
  303. package/src/x_ite/Browser/Scripting/evaluate.js +7 -7
  304. package/src/x_ite/Browser/Shaders/Shader.js +152 -159
  305. package/src/x_ite/Browser/Shaders/ShaderSource.js +81 -63
  306. package/src/x_ite/Browser/Shaders/ShaderTest.js +97 -98
  307. package/src/x_ite/Browser/Shaders/X3DShadersContext.js +256 -249
  308. package/src/x_ite/Browser/Shape/AlphaMode.js +9 -9
  309. package/src/x_ite/Browser/Shape/X3DShapeContext.js +111 -89
  310. package/src/x_ite/Browser/Sound/X3DSoundContext.js +11 -11
  311. package/src/x_ite/Browser/Text/PolygonText.js +319 -319
  312. package/src/x_ite/Browser/Text/TextAlignment.js +9 -9
  313. package/src/x_ite/Browser/Text/X3DTextContext.js +72 -65
  314. package/src/x_ite/Browser/Text/X3DTextGeometry.js +506 -506
  315. package/src/x_ite/Browser/Texturing/MultiTextureFunctionType.js +8 -8
  316. package/src/x_ite/Browser/Texturing/MultiTextureModeType.js +25 -25
  317. package/src/x_ite/Browser/Texturing/MultiTextureSourceType.js +9 -9
  318. package/src/x_ite/Browser/Texturing/TextureCoordinateGeneratorModeType.js +17 -17
  319. package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +259 -224
  320. package/src/x_ite/Browser/Texturing3D/DICOMParser.js +1066 -1066
  321. package/src/x_ite/Browser/Texturing3D/NRRDParser.js +641 -630
  322. package/src/x_ite/Browser/Time/X3DTimeContext.js +54 -37
  323. package/src/x_ite/Browser/VERSION.js +1 -1
  324. package/src/x_ite/Browser/VolumeRendering/VolumeStyle.fs +55 -55
  325. package/src/x_ite/Browser/VolumeRendering/VolumeStyle.vs +5 -5
  326. package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +52 -41
  327. package/src/x_ite/Browser/X3DBrowser.js +819 -755
  328. package/src/x_ite/Browser/X3DBrowserContext.js +253 -220
  329. package/src/x_ite/Components/Annotation/AnnotationLayer.js +43 -43
  330. package/src/x_ite/Components/Annotation/AnnotationTarget.js +38 -38
  331. package/src/x_ite/Components/Annotation/GroupAnnotation.js +48 -48
  332. package/src/x_ite/Components/Annotation/IconAnnotation.js +46 -46
  333. package/src/x_ite/Components/Annotation/TextAnnotation.js +39 -39
  334. package/src/x_ite/Components/Annotation/URLAnnotation.js +38 -38
  335. package/src/x_ite/Components/Annotation/X3DAnnotationNode.js +16 -16
  336. package/src/x_ite/Components/CADGeometry/CADAssembly.js +41 -41
  337. package/src/x_ite/Components/CADGeometry/CADFace.js +189 -189
  338. package/src/x_ite/Components/CADGeometry/CADLayer.js +38 -38
  339. package/src/x_ite/Components/CADGeometry/CADPart.js +46 -46
  340. package/src/x_ite/Components/CADGeometry/IndexedQuadSet.js +67 -67
  341. package/src/x_ite/Components/CADGeometry/QuadSet.js +64 -63
  342. package/src/x_ite/Components/CADGeometry/X3DProductStructureChildNode.js +13 -15
  343. package/src/x_ite/Components/Core/MetadataBoolean.js +38 -40
  344. package/src/x_ite/Components/Core/MetadataDouble.js +38 -40
  345. package/src/x_ite/Components/Core/MetadataFloat.js +38 -40
  346. package/src/x_ite/Components/Core/MetadataInteger.js +38 -40
  347. package/src/x_ite/Components/Core/MetadataSet.js +38 -40
  348. package/src/x_ite/Components/Core/MetadataString.js +38 -40
  349. package/src/x_ite/Components/Core/WorldInfo.js +42 -42
  350. package/src/x_ite/Components/Core/X3DBindableNode.js +20 -20
  351. package/src/x_ite/Components/Core/X3DChildNode.js +38 -40
  352. package/src/x_ite/Components/Core/X3DInfoNode.js +13 -15
  353. package/src/x_ite/Components/Core/X3DMetadataObject.js +11 -13
  354. package/src/x_ite/Components/Core/X3DNode.js +795 -14
  355. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +585 -479
  356. package/src/x_ite/Components/Core/X3DSensorNode.js +13 -15
  357. package/src/x_ite/Components/Core.js +39 -39
  358. package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +193 -200
  359. package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +209 -206
  360. package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +213 -219
  361. package/src/x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode.js +69 -60
  362. package/src/x_ite/Components/DIS/DISEntityManager.js +38 -40
  363. package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +59 -41
  364. package/src/x_ite/Components/DIS/EspduTransform.js +128 -128
  365. package/src/x_ite/Components/DIS/ReceiverPdu.js +68 -68
  366. package/src/x_ite/Components/DIS/SignalPdu.js +68 -68
  367. package/src/x_ite/Components/DIS/TransmitterPdu.js +84 -84
  368. package/src/x_ite/Components/EnvironmentalEffects/Background.js +87 -89
  369. package/src/x_ite/Components/EnvironmentalEffects/Fog.js +59 -59
  370. package/src/x_ite/Components/EnvironmentalEffects/FogCoordinate.js +78 -78
  371. package/src/x_ite/Components/EnvironmentalEffects/LocalFog.js +56 -56
  372. package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +86 -88
  373. package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +582 -589
  374. package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +105 -105
  375. package/src/x_ite/Components/EnvironmentalEffects.js +25 -25
  376. package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +229 -229
  377. package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +256 -256
  378. package/src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +114 -114
  379. package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +71 -71
  380. package/src/x_ite/Components/EnvironmentalSensor.js +19 -19
  381. package/src/x_ite/Components/EventUtilities/BooleanFilter.js +50 -52
  382. package/src/x_ite/Components/EventUtilities/BooleanSequencer.js +50 -52
  383. package/src/x_ite/Components/EventUtilities/BooleanToggle.js +43 -45
  384. package/src/x_ite/Components/EventUtilities/BooleanTrigger.js +42 -44
  385. package/src/x_ite/Components/EventUtilities/IntegerSequencer.js +50 -52
  386. package/src/x_ite/Components/EventUtilities/IntegerTrigger.js +43 -45
  387. package/src/x_ite/Components/EventUtilities/TimeTrigger.js +43 -45
  388. package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +92 -94
  389. package/src/x_ite/Components/EventUtilities/X3DTriggerNode.js +13 -15
  390. package/src/x_ite/Components/Followers/ColorChaser.js +78 -78
  391. package/src/x_ite/Components/Followers/ColorDamper.js +78 -78
  392. package/src/x_ite/Components/Followers/CoordinateChaser.js +46 -46
  393. package/src/x_ite/Components/Followers/CoordinateDamper.js +48 -48
  394. package/src/x_ite/Components/Followers/OrientationChaser.js +64 -64
  395. package/src/x_ite/Components/Followers/OrientationDamper.js +61 -61
  396. package/src/x_ite/Components/Followers/PositionChaser.js +42 -42
  397. package/src/x_ite/Components/Followers/PositionChaser2D.js +42 -42
  398. package/src/x_ite/Components/Followers/PositionDamper.js +44 -44
  399. package/src/x_ite/Components/Followers/PositionDamper2D.js +44 -44
  400. package/src/x_ite/Components/Followers/ScalarChaser.js +70 -70
  401. package/src/x_ite/Components/Followers/ScalarDamper.js +60 -60
  402. package/src/x_ite/Components/Followers/TexCoordChaser2D.js +46 -46
  403. package/src/x_ite/Components/Followers/TexCoordDamper2D.js +48 -48
  404. package/src/x_ite/Components/Followers/X3DChaserNode.js +194 -194
  405. package/src/x_ite/Components/Followers/X3DDamperNode.js +120 -120
  406. package/src/x_ite/Components/Followers/X3DFollowerNode.js +83 -83
  407. package/src/x_ite/Components/Followers.js +45 -45
  408. package/src/x_ite/Components/Geometry2D/Arc2D.js +99 -113
  409. package/src/x_ite/Components/Geometry2D/ArcClose2D.js +164 -166
  410. package/src/x_ite/Components/Geometry2D/Circle2D.js +59 -67
  411. package/src/x_ite/Components/Geometry2D/Disk2D.js +207 -211
  412. package/src/x_ite/Components/Geometry2D/Polyline2D.js +43 -52
  413. package/src/x_ite/Components/Geometry2D/Polypoint2D.js +43 -60
  414. package/src/x_ite/Components/Geometry2D/Rectangle2D.js +76 -73
  415. package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +69 -71
  416. package/src/x_ite/Components/Geometry3D/Box.js +90 -86
  417. package/src/x_ite/Components/Geometry3D/Cone.js +185 -187
  418. package/src/x_ite/Components/Geometry3D/Cylinder.js +246 -246
  419. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +383 -384
  420. package/src/x_ite/Components/Geometry3D/Extrusion.js +653 -647
  421. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +437 -445
  422. package/src/x_ite/Components/Geometry3D/Sphere.js +72 -74
  423. package/src/x_ite/Components/Geometry3D.js +25 -25
  424. package/src/x_ite/Components/Geospatial/GeoCoordinate.js +189 -191
  425. package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +381 -383
  426. package/src/x_ite/Components/Geospatial/GeoLOD.js +397 -397
  427. package/src/x_ite/Components/Geospatial/GeoLocation.js +56 -56
  428. package/src/x_ite/Components/Geospatial/GeoMetadata.js +54 -36
  429. package/src/x_ite/Components/Geospatial/GeoOrigin.js +50 -52
  430. package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +81 -83
  431. package/src/x_ite/Components/Geospatial/GeoProximitySensor.js +95 -97
  432. package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +77 -79
  433. package/src/x_ite/Components/Geospatial/GeoTransform.js +79 -79
  434. package/src/x_ite/Components/Geospatial/GeoViewpoint.js +278 -278
  435. package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +216 -218
  436. package/src/x_ite/Components/Grouping/Group.js +37 -37
  437. package/src/x_ite/Components/Grouping/StaticGroup.js +245 -245
  438. package/src/x_ite/Components/Grouping/Switch.js +234 -234
  439. package/src/x_ite/Components/Grouping/Transform.js +42 -42
  440. package/src/x_ite/Components/Grouping/X3DBoundedObject.js +93 -93
  441. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +654 -649
  442. package/src/x_ite/Components/Grouping/X3DTransformMatrix3DNode.js +99 -99
  443. package/src/x_ite/Components/Grouping/X3DTransformNode.js +31 -31
  444. package/src/x_ite/Components/Grouping.js +27 -27
  445. package/src/x_ite/Components/HAnim/HAnimDisplacer.js +35 -35
  446. package/src/x_ite/Components/HAnim/HAnimHumanoid.js +293 -293
  447. package/src/x_ite/Components/HAnim/HAnimJoint.js +137 -137
  448. package/src/x_ite/Components/HAnim/HAnimMotion.js +50 -50
  449. package/src/x_ite/Components/HAnim/HAnimSegment.js +44 -44
  450. package/src/x_ite/Components/HAnim/HAnimSite.js +43 -43
  451. package/src/x_ite/Components/Interpolation/ColorInterpolator.js +61 -63
  452. package/src/x_ite/Components/Interpolation/CoordinateInterpolator.js +60 -62
  453. package/src/x_ite/Components/Interpolation/CoordinateInterpolator2D.js +57 -59
  454. package/src/x_ite/Components/Interpolation/EaseInEaseOut.js +79 -80
  455. package/src/x_ite/Components/Interpolation/NormalInterpolator.js +96 -93
  456. package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +70 -70
  457. package/src/x_ite/Components/Interpolation/PositionInterpolator.js +57 -59
  458. package/src/x_ite/Components/Interpolation/PositionInterpolator2D.js +57 -59
  459. package/src/x_ite/Components/Interpolation/ScalarInterpolator.js +53 -55
  460. package/src/x_ite/Components/Interpolation/SplinePositionInterpolator.js +78 -80
  461. package/src/x_ite/Components/Interpolation/SplinePositionInterpolator2D.js +77 -79
  462. package/src/x_ite/Components/Interpolation/SplineScalarInterpolator.js +78 -80
  463. package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +66 -66
  464. package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +67 -69
  465. package/src/x_ite/Components/Interpolation.js +39 -39
  466. package/src/x_ite/Components/KeyDeviceSensor/KeySensor.js +304 -306
  467. package/src/x_ite/Components/KeyDeviceSensor/StringSensor.js +102 -104
  468. package/src/x_ite/Components/KeyDeviceSensor/X3DKeyDeviceSensorNode.js +51 -51
  469. package/src/x_ite/Components/Layering/Layer.js +50 -50
  470. package/src/x_ite/Components/Layering/LayerSet.js +160 -161
  471. package/src/x_ite/Components/Layering/Viewport.js +118 -118
  472. package/src/x_ite/Components/Layering/X3DLayerNode.js +322 -322
  473. package/src/x_ite/Components/Layering/X3DViewportNode.js +13 -13
  474. package/src/x_ite/Components/Layering.js +21 -21
  475. package/src/x_ite/Components/Layout/Layout.js +576 -578
  476. package/src/x_ite/Components/Layout/LayoutGroup.js +126 -126
  477. package/src/x_ite/Components/Layout/LayoutLayer.js +53 -53
  478. package/src/x_ite/Components/Layout/ScreenFontStyle.js +48 -48
  479. package/src/x_ite/Components/Layout/ScreenGroup.js +136 -136
  480. package/src/x_ite/Components/Layout/X3DLayoutNode.js +12 -14
  481. package/src/x_ite/Components/Lighting/DirectionalLight.js +239 -246
  482. package/src/x_ite/Components/Lighting/PointLight.js +296 -303
  483. package/src/x_ite/Components/Lighting/SpotLight.js +321 -316
  484. package/src/x_ite/Components/Lighting/X3DLightNode.js +153 -153
  485. package/src/x_ite/Components/Lighting.js +19 -19
  486. package/src/x_ite/Components/NURBS/Contour2D.js +81 -83
  487. package/src/x_ite/Components/NURBS/ContourPolyline2D.js +100 -102
  488. package/src/x_ite/Components/NURBS/CoordinateDouble.js +32 -34
  489. package/src/x_ite/Components/NURBS/NurbsCurve.js +167 -169
  490. package/src/x_ite/Components/NURBS/NurbsCurve2D.js +149 -149
  491. package/src/x_ite/Components/NURBS/NurbsOrientationInterpolator.js +166 -166
  492. package/src/x_ite/Components/NURBS/NurbsPatchSurface.js +45 -47
  493. package/src/x_ite/Components/NURBS/NurbsPositionInterpolator.js +154 -154
  494. package/src/x_ite/Components/NURBS/NurbsSet.js +125 -125
  495. package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +128 -130
  496. package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +120 -122
  497. package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +120 -122
  498. package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +93 -93
  499. package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +88 -90
  500. package/src/x_ite/Components/NURBS/X3DNurbsControlCurveNode.js +13 -15
  501. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +339 -339
  502. package/src/x_ite/Components/NURBS/X3DParametricGeometryNode.js +18 -20
  503. package/src/x_ite/Components/Navigation/Billboard.js +132 -132
  504. package/src/x_ite/Components/Navigation/Collision.js +116 -116
  505. package/src/x_ite/Components/Navigation/LOD.js +308 -308
  506. package/src/x_ite/Components/Navigation/NavigationInfo.js +279 -285
  507. package/src/x_ite/Components/Navigation/OrthoViewpoint.js +258 -258
  508. package/src/x_ite/Components/Navigation/Viewpoint.js +137 -137
  509. package/src/x_ite/Components/Navigation/ViewpointGroup.js +169 -171
  510. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +450 -453
  511. package/src/x_ite/Components/Navigation.js +27 -27
  512. package/src/x_ite/Components/Networking/Anchor.js +140 -128
  513. package/src/x_ite/Components/Networking/Inline.js +156 -197
  514. package/src/x_ite/Components/Networking/LoadSensor.js +193 -195
  515. package/src/x_ite/Components/Networking/X3DNetworkSensorNode.js +13 -15
  516. package/src/x_ite/Components/Networking/X3DUrlObject.js +170 -116
  517. package/src/x_ite/Components/Networking.js +21 -21
  518. package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +62 -64
  519. package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +81 -83
  520. package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +59 -61
  521. package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +42 -44
  522. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +1433 -1433
  523. package/src/x_ite/Components/ParticleSystems/PointEmitter.js +77 -79
  524. package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +196 -196
  525. package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +195 -195
  526. package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +250 -250
  527. package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +69 -71
  528. package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +346 -346
  529. package/src/x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode.js +15 -17
  530. package/src/x_ite/Components/Picking/LinePickSensor.js +284 -286
  531. package/src/x_ite/Components/Picking/PickableGroup.js +155 -155
  532. package/src/x_ite/Components/Picking/PointPickSensor.js +272 -272
  533. package/src/x_ite/Components/Picking/PrimitivePickSensor.js +207 -209
  534. package/src/x_ite/Components/Picking/VolumePickSensor.js +182 -184
  535. package/src/x_ite/Components/Picking/X3DPickSensorNode.js +382 -382
  536. package/src/x_ite/Components/Picking/X3DPickableObject.js +28 -30
  537. package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +257 -259
  538. package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +245 -247
  539. package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +173 -175
  540. package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +61 -63
  541. package/src/x_ite/Components/PointingDeviceSensor/X3DDragSensorNode.js +14 -16
  542. package/src/x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode.js +57 -59
  543. package/src/x_ite/Components/PointingDeviceSensor/X3DTouchSensorNode.js +19 -21
  544. package/src/x_ite/Components/PointingDeviceSensor.js +25 -25
  545. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +191 -191
  546. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +162 -162
  547. package/src/x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode.js +156 -156
  548. package/src/x_ite/Components/Rendering/ClipPlane.js +120 -120
  549. package/src/x_ite/Components/Rendering/Color.js +112 -112
  550. package/src/x_ite/Components/Rendering/ColorRGBA.js +114 -114
  551. package/src/x_ite/Components/Rendering/Coordinate.js +33 -35
  552. package/src/x_ite/Components/Rendering/IndexedLineSet.js +236 -243
  553. package/src/x_ite/Components/Rendering/IndexedTriangleFanSet.js +102 -102
  554. package/src/x_ite/Components/Rendering/IndexedTriangleSet.js +55 -55
  555. package/src/x_ite/Components/Rendering/IndexedTriangleStripSet.js +110 -110
  556. package/src/x_ite/Components/Rendering/LineSet.js +172 -179
  557. package/src/x_ite/Components/Rendering/Normal.js +100 -100
  558. package/src/x_ite/Components/Rendering/PointSet.js +142 -154
  559. package/src/x_ite/Components/Rendering/TriangleFanSet.js +73 -73
  560. package/src/x_ite/Components/Rendering/TriangleSet.js +51 -53
  561. package/src/x_ite/Components/Rendering/TriangleStripSet.js +76 -76
  562. package/src/x_ite/Components/Rendering/X3DColorNode.js +25 -27
  563. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +318 -321
  564. package/src/x_ite/Components/Rendering/X3DCoordinateNode.js +132 -132
  565. package/src/x_ite/Components/Rendering/X3DGeometricPropertyNode.js +13 -15
  566. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +1190 -1171
  567. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +231 -189
  568. package/src/x_ite/Components/Rendering/X3DNormalNode.js +13 -15
  569. package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +267 -0
  570. package/src/x_ite/Components/Rendering.js +53 -53
  571. package/src/x_ite/Components/RigidBodyPhysics/BallJoint.js +149 -149
  572. package/src/x_ite/Components/RigidBodyPhysics/CollidableOffset.js +229 -229
  573. package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +465 -465
  574. package/src/x_ite/Components/RigidBodyPhysics/CollisionCollection.js +152 -154
  575. package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +223 -223
  576. package/src/x_ite/Components/RigidBodyPhysics/CollisionSpace.js +117 -117
  577. package/src/x_ite/Components/RigidBodyPhysics/Contact.js +54 -56
  578. package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +245 -245
  579. package/src/x_ite/Components/RigidBodyPhysics/MotorJoint.js +68 -70
  580. package/src/x_ite/Components/RigidBodyPhysics/RigidBody.js +453 -453
  581. package/src/x_ite/Components/RigidBodyPhysics/RigidBodyCollection.js +326 -326
  582. package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +171 -171
  583. package/src/x_ite/Components/RigidBodyPhysics/SliderJoint.js +169 -169
  584. package/src/x_ite/Components/RigidBodyPhysics/UniversalJoint.js +50 -52
  585. package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollidableNode.js +101 -101
  586. package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollisionSpaceNode.js +15 -15
  587. package/src/x_ite/Components/RigidBodyPhysics/X3DRigidJointNode.js +161 -163
  588. package/src/x_ite/Components/Scripting/Script.js +506 -510
  589. package/src/x_ite/Components/Scripting/X3DScriptNode.js +15 -15
  590. package/src/x_ite/Components/Shaders/ComposedShader.js +215 -178
  591. package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +84 -83
  592. package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +74 -74
  593. package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +73 -73
  594. package/src/x_ite/Components/Shaders/PackagedShader.js +52 -49
  595. package/src/x_ite/Components/Shaders/ProgramShader.js +36 -38
  596. package/src/x_ite/Components/Shaders/ShaderPart.js +135 -147
  597. package/src/x_ite/Components/Shaders/ShaderProgram.js +49 -46
  598. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +1259 -1255
  599. package/src/x_ite/Components/Shaders/X3DShaderNode.js +83 -93
  600. package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +13 -15
  601. package/src/x_ite/Components/Shaders.js +33 -33
  602. package/src/x_ite/{Execution/ExportedNode.js → Components/Shape/AcousticProperties.js} +41 -71
  603. package/src/x_ite/Components/Shape/Appearance.js +331 -318
  604. package/src/x_ite/Components/Shape/FillProperties.js +101 -98
  605. package/src/x_ite/Components/Shape/LineProperties.js +71 -69
  606. package/src/x_ite/Components/Shape/Material.js +344 -116
  607. package/src/x_ite/Components/Shape/PhysicalMaterial.js +310 -0
  608. package/src/x_ite/Components/Shape/PointProperties.js +79 -95
  609. package/src/x_ite/Components/Shape/Shape.js +178 -181
  610. package/src/x_ite/Components/Shape/TwoSidedMaterial.js +200 -200
  611. package/src/x_ite/Components/Shape/UnlitMaterial.js +93 -46
  612. package/src/x_ite/Components/Shape/X3DAppearanceChildNode.js +13 -15
  613. package/src/x_ite/Components/Shape/X3DAppearanceNode.js +24 -24
  614. package/src/x_ite/Components/Shape/X3DMaterialNode.js +24 -24
  615. package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +158 -54
  616. package/src/x_ite/Components/Shape/X3DShapeNode.js +147 -147
  617. package/src/x_ite/Components/Shape.js +43 -37
  618. package/src/x_ite/Components/Sound/AudioClip.js +135 -140
  619. package/src/x_ite/Components/Sound/Sound.js +246 -246
  620. package/src/x_ite/Components/Sound/X3DSoundNode.js +13 -15
  621. package/src/x_ite/Components/Sound/X3DSoundSourceNode.js +165 -179
  622. package/src/x_ite/Components/Sound.js +19 -19
  623. package/src/x_ite/Components/Text/FontStyle.js +49 -49
  624. package/src/x_ite/Components/Text/Text.js +135 -135
  625. package/src/x_ite/Components/Text/X3DFontStyleNode.js +207 -205
  626. package/src/x_ite/Components/Text.js +17 -17
  627. package/src/x_ite/Components/Texturing/ImageTexture.js +181 -194
  628. package/src/x_ite/Components/Texturing/MovieTexture.js +180 -190
  629. package/src/x_ite/Components/Texturing/MultiTexture.js +255 -262
  630. package/src/x_ite/Components/Texturing/MultiTextureCoordinate.js +124 -118
  631. package/src/x_ite/Components/Texturing/MultiTextureTransform.js +82 -76
  632. package/src/x_ite/Components/Texturing/PixelTexture.js +222 -221
  633. package/src/x_ite/Components/Texturing/TextureCoordinate.js +116 -116
  634. package/src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +90 -90
  635. package/src/x_ite/Components/Texturing/TextureProperties.js +158 -160
  636. package/src/x_ite/Components/Texturing/TextureTransform.js +99 -99
  637. package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +33 -28
  638. package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +54 -54
  639. package/src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +22 -17
  640. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +135 -124
  641. package/src/x_ite/Components/Texturing/X3DTextureCoordinateNode.js +16 -16
  642. package/src/x_ite/Components/Texturing/X3DTextureNode.js +24 -24
  643. package/src/x_ite/Components/Texturing/X3DTextureTransformNode.js +22 -22
  644. package/src/x_ite/Components/Texturing.js +45 -45
  645. package/src/x_ite/Components/Texturing3D/ComposedTexture3D.js +125 -123
  646. package/src/x_ite/Components/Texturing3D/ImageTexture3D.js +115 -131
  647. package/src/x_ite/Components/Texturing3D/PixelTexture3D.js +158 -160
  648. package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +116 -116
  649. package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +116 -116
  650. package/src/x_ite/Components/Texturing3D/TextureTransform3D.js +88 -88
  651. package/src/x_ite/Components/Texturing3D/TextureTransformMatrix3D.js +46 -46
  652. package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +135 -121
  653. package/src/x_ite/Components/Time/TimeSensor.js +155 -152
  654. package/src/x_ite/Components/Time/X3DTimeDependentNode.js +299 -302
  655. package/src/x_ite/Components/Time.js +15 -15
  656. package/src/x_ite/Components/VolumeRendering/BlendedVolumeStyle.js +338 -338
  657. package/src/x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle.js +80 -80
  658. package/src/x_ite/Components/VolumeRendering/CartoonVolumeStyle.js +228 -228
  659. package/src/x_ite/Components/VolumeRendering/ComposedVolumeStyle.js +163 -163
  660. package/src/x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle.js +117 -117
  661. package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +334 -334
  662. package/src/x_ite/Components/VolumeRendering/OpacityMapVolumeStyle.js +116 -116
  663. package/src/x_ite/Components/VolumeRendering/ProjectionVolumeStyle.js +167 -167
  664. package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +247 -247
  665. package/src/x_ite/Components/VolumeRendering/ShadedVolumeStyle.js +198 -198
  666. package/src/x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle.js +116 -116
  667. package/src/x_ite/Components/VolumeRendering/ToneMappedVolumeStyle.js +126 -126
  668. package/src/x_ite/Components/VolumeRendering/VolumeData.js +173 -173
  669. package/src/x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode.js +12 -12
  670. package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +167 -167
  671. package/src/x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode.js +70 -70
  672. package/src/x_ite/Components/X_ITE/BlendMode.js +143 -145
  673. package/src/x_ite/Components.js +47 -47
  674. package/src/x_ite/Configuration/ComponentInfo.js +47 -42
  675. package/src/x_ite/Configuration/ComponentInfoArray.js +21 -19
  676. package/src/x_ite/Configuration/ProfileInfo.js +33 -23
  677. package/src/x_ite/Configuration/ProfileInfoArray.js +26 -16
  678. package/src/x_ite/Configuration/SupportedComponents.js +311 -311
  679. package/src/x_ite/Configuration/SupportedNodes.js +53 -38
  680. package/src/x_ite/Configuration/SupportedProfiles.js +190 -190
  681. package/src/x_ite/Configuration/UnitInfo.js +60 -51
  682. package/src/x_ite/Configuration/UnitInfoArray.js +17 -10
  683. package/src/x_ite/DEBUG.js +2 -2
  684. package/src/x_ite/Execution/BindableList.js +146 -149
  685. package/src/x_ite/Execution/BindableStack.js +130 -123
  686. package/src/x_ite/Execution/ExportedNodesArray.js +75 -0
  687. package/src/x_ite/Execution/ImportedNodesArray.js +75 -0
  688. package/src/x_ite/{Basic/X3DFieldDefinition.js → Execution/NamedNodesArray.js} +20 -10
  689. package/src/x_ite/Execution/Scene.js +93 -90
  690. package/src/x_ite/Execution/X3DExecutionContext.js +957 -781
  691. package/src/x_ite/Execution/X3DExportedNode.js +152 -0
  692. package/src/x_ite/Execution/X3DImportedNode.js +393 -0
  693. package/src/x_ite/Execution/X3DScene.js +546 -493
  694. package/src/x_ite/Execution/X3DWorld.js +171 -0
  695. package/src/x_ite/Fallback.js +31 -31
  696. package/src/x_ite/Fields/ArrayFields.js +463 -443
  697. package/src/x_ite/Fields/SFBool.js +50 -47
  698. package/src/x_ite/Fields/SFColor.js +163 -160
  699. package/src/x_ite/Fields/SFColorRGBA.js +155 -152
  700. package/src/x_ite/Fields/SFDouble.js +51 -48
  701. package/src/x_ite/Fields/SFFloat.js +51 -48
  702. package/src/x_ite/Fields/SFImage.js +216 -213
  703. package/src/x_ite/Fields/SFInt32.js +47 -44
  704. package/src/x_ite/Fields/SFMatrix3.js +74 -71
  705. package/src/x_ite/Fields/SFMatrix4.js +68 -65
  706. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +98 -98
  707. package/src/x_ite/Fields/SFNode.js +392 -299
  708. package/src/x_ite/Fields/SFNodeCache.js +22 -33
  709. package/src/x_ite/Fields/SFRotation.js +178 -175
  710. package/src/x_ite/Fields/SFString.js +71 -68
  711. package/src/x_ite/Fields/SFTime.js +47 -44
  712. package/src/x_ite/Fields/SFVec2.js +73 -70
  713. package/src/x_ite/Fields/SFVec3.js +105 -102
  714. package/src/x_ite/Fields/SFVec4.js +118 -115
  715. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +94 -94
  716. package/src/x_ite/Fields.js +44 -44
  717. package/src/x_ite/InputOutput/FileLoader.js +426 -531
  718. package/src/x_ite/InputOutput/Generator.js +379 -376
  719. package/src/x_ite/{Configuration/X3DInfoArray.js → Parser/GoldenGate.js} +54 -86
  720. package/src/x_ite/Parser/HTMLSupport.js +28 -6
  721. package/src/x_ite/Parser/JSONParser.js +414 -388
  722. package/src/x_ite/Parser/VRMLParser.js +2964 -0
  723. package/src/x_ite/Parser/X3DParser.js +128 -128
  724. package/src/x_ite/Parser/XMLParser.js +1231 -1178
  725. package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +17 -27
  726. package/src/x_ite/Prototype/ProtoDeclarationArray.js +17 -27
  727. package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +279 -297
  728. package/src/x_ite/Prototype/X3DProtoDeclaration.js +264 -263
  729. package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +58 -35
  730. package/src/x_ite/Rendering/DependentRenderer.js +83 -80
  731. package/src/x_ite/Rendering/TextureBuffer.js +171 -168
  732. package/src/x_ite/{Bits → Rendering}/TraverseType.js +11 -11
  733. package/src/x_ite/Rendering/X3DRenderObject.js +895 -906
  734. package/src/x_ite/Routing/RouteArray.js +19 -71
  735. package/src/x_ite/Routing/X3DRoute.js +185 -179
  736. package/src/x_ite/Routing/X3DRoutingContext.js +60 -54
  737. package/src/x_ite/X3D.js +191 -175
  738. package/src/x_ite.config.js +83 -83
  739. package/src/x_ite.css +279 -288
  740. package/src/x_ite.html +226 -193
  741. package/src/x_ite.js +100 -127
  742. package/x_ite.min.html +220 -187
  743. package/src/assets/shaders/webgl1/PointSet.fs +0 -100
  744. package/src/assets/shaders/webgl1/PointSet.vs +0 -70
  745. package/src/assets/shaders/webgl1/Wireframe.fs +0 -74
  746. package/src/assets/shaders/webgl1/Wireframe.vs +0 -63
  747. package/src/assets/shaders/webgl2/PointSet.fs +0 -99
  748. package/src/assets/shaders/webgl2/PointSet.vs +0 -71
  749. package/src/assets/shaders/webgl2/Wireframe.fs +0 -73
  750. package/src/assets/shaders/webgl2/Wireframe.vs +0 -64
  751. package/src/x_ite/Basic/X3DBaseNode.js +0 -1253
  752. package/src/x_ite/Basic/X3DField.js +0 -370
  753. package/src/x_ite/Basic/X3DObjectArrayField.js +0 -545
  754. package/src/x_ite/Basic/X3DTypedArrayField.js +0 -839
  755. package/src/x_ite/Browser/Core/X3DCoreContext.js.~1~ +0 -714
  756. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js.~1~ +0 -209
  757. package/src/x_ite/Execution/ImportedNode.js +0 -375
  758. package/src/x_ite/Execution/World.js +0 -162
  759. package/src/x_ite/Parser/Parser.js +0 -2944
@@ -48,16 +48,16 @@
48
48
 
49
49
 
50
50
  define ([
51
- "x_ite/Fields",
52
- "x_ite/Basic/X3DFieldDefinition",
53
- "x_ite/Basic/FieldDefinitionArray",
54
- "x_ite/Components/Rendering/X3DGeometryNode",
55
- "x_ite/Bits/X3DConstants",
56
- "standard/Math/Geometry/Triangle3",
57
- "standard/Math/Numbers/Vector2",
58
- "standard/Math/Numbers/Vector3",
59
- "standard/Math/Numbers/Rotation4",
60
- "standard/Math/Numbers/Matrix4",
51
+ "x_ite/Fields",
52
+ "x_ite/Base/X3DFieldDefinition",
53
+ "x_ite/Base/FieldDefinitionArray",
54
+ "x_ite/Components/Rendering/X3DGeometryNode",
55
+ "x_ite/Base/X3DConstants",
56
+ "standard/Math/Geometry/Triangle3",
57
+ "standard/Math/Numbers/Vector2",
58
+ "standard/Math/Numbers/Vector3",
59
+ "standard/Math/Numbers/Rotation4",
60
+ "standard/Math/Numbers/Matrix4",
61
61
  ],
62
62
  function (Fields,
63
63
  X3DFieldDefinition,
@@ -72,641 +72,647 @@ function (Fields,
72
72
  {
73
73
  "use strict";
74
74
 
75
- function Extrusion (executionContext)
76
- {
77
- X3DGeometryNode .call (this, executionContext);
78
-
79
- this .addType (X3DConstants .Extrusion);
80
-
81
- this .creaseAngle_ .setUnit ("angle");
82
- this .crossSection_ .setUnit ("length");
83
- this .spine_ .setUnit ("length");
84
- }
85
-
86
- Extrusion .prototype = Object .assign (Object .create (X3DGeometryNode .prototype),
87
- {
88
- constructor: Extrusion,
89
- fieldDefinitions: new FieldDefinitionArray ([
90
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
91
- new X3DFieldDefinition (X3DConstants .inputOnly, "set_crossSection", new Fields .MFVec2f ()),
92
- new X3DFieldDefinition (X3DConstants .inputOnly, "set_orientation", new Fields .MFRotation ()),
93
- new X3DFieldDefinition (X3DConstants .inputOnly, "set_scale", new Fields .MFVec2f ()),
94
- new X3DFieldDefinition (X3DConstants .inputOnly, "set_spine", new Fields .MFVec3f ()),
95
- new X3DFieldDefinition (X3DConstants .initializeOnly, "beginCap", new Fields .SFBool (true)),
96
- new X3DFieldDefinition (X3DConstants .initializeOnly, "endCap", new Fields .SFBool (true)),
97
- new X3DFieldDefinition (X3DConstants .initializeOnly, "solid", new Fields .SFBool (true)),
98
- new X3DFieldDefinition (X3DConstants .initializeOnly, "ccw", new Fields .SFBool (true)),
99
- new X3DFieldDefinition (X3DConstants .initializeOnly, "convex", new Fields .SFBool (true)),
100
- new X3DFieldDefinition (X3DConstants .initializeOnly, "creaseAngle", new Fields .SFFloat ()),
101
- new X3DFieldDefinition (X3DConstants .initializeOnly, "crossSection", new Fields .MFVec2f (new Vector2 (1, 1), new Vector2 (1, -1), new Vector2 (-1, -1), new Vector2 (-1, 1), new Vector2 (1, 1))),
102
- new X3DFieldDefinition (X3DConstants .initializeOnly, "orientation", new Fields .MFRotation (new Rotation4 ())),
103
- new X3DFieldDefinition (X3DConstants .initializeOnly, "scale", new Fields .MFVec2f (new Vector2 (1, 1))),
104
- new X3DFieldDefinition (X3DConstants .initializeOnly, "spine", new Fields .MFVec3f (new Vector3 (0, 0, 0), new Vector3 (0, 1, 0))),
105
- ]),
106
- getTypeName: function ()
107
- {
108
- return "Extrusion";
109
- },
110
- getComponentName: function ()
111
- {
112
- return "Geometry3D";
113
- },
114
- getContainerField: function ()
115
- {
116
- return "geometry";
117
- },
118
- initialize: function ()
119
- {
120
- X3DGeometryNode .prototype .initialize .call (this);
121
-
122
- this .set_crossSection_ .addFieldInterest (this .crossSection_);
123
- this .set_orientation_ .addFieldInterest (this .orientation_);
124
- this .set_scale_ .addFieldInterest (this .scale_);
125
- this .set_spine_ .addFieldInterest (this .spine_);
126
- },
127
- getClosedOrientation: function ()
128
- {
129
- var orientation = this .orientation_;
130
-
131
- if (orientation .length)
132
- {
133
- var
134
- firstOrientation = orientation [0] .getValue (),
135
- lastOrientation = orientation [orientation .length - 1] .getValue ();
136
-
137
- return firstOrientation .equals (lastOrientation);
138
- }
139
-
140
- return true;
141
- },
142
- createPoints: (function ()
143
- {
144
- var scale3 = new Vector3 (1, 1, 1);
145
-
146
- return function ()
147
- {
148
- var
149
- crossSection = this .crossSection_,
150
- orientation = this .orientation_,
151
- scale = this .scale_,
152
- spine = this .spine_,
153
- points = [ ];
154
-
155
- // calculate SCP rotations
156
-
157
- var rotations = this .createRotations ();
158
-
159
- // calculate vertices.
160
-
161
- for (var i = 0, length = spine .length; i < length; ++ i)
162
- {
163
- var matrix = rotations [i];
164
-
165
- if (orientation .length)
166
- matrix .rotate (orientation [Math .min (i, orientation .length - 1)] .getValue ());
167
-
168
- if (scale .length)
169
- {
170
- var s = scale [Math .min (i, scale .length - 1)] .getValue ();
171
- matrix .scale (scale3 .set (s .x, 1, s .y));
172
- }
173
-
174
- for (var cs = 0, csLength = crossSection .length; cs < csLength; ++ cs)
175
- {
176
- var vector = crossSection [cs] .getValue ();
177
- points .push (matrix .multVecMatrix (new Vector3 (vector .x, 0, vector .y)));
178
- }
179
- }
180
-
181
- return points;
182
- };
183
- })(),
184
- createRotations: (function ()
185
- {
186
- var rotations = [ ];
187
-
188
- var
189
- SCPxAxis = new Vector3 (0, 0, 0),
190
- SCPyAxis = new Vector3 (0, 0, 0),
191
- SCPzAxis = new Vector3 (0, 0, 0);
192
-
193
- var
194
- SCPyAxisPrevious = new Vector3 (0, 0, 0),
195
- SCPzAxisPrevious = new Vector3 (0, 0, 0);
196
-
197
- var
198
- vector3 = new Vector3 (0, 0, 0),
199
- rotation = new Rotation4 (0, 0, 1, 0);
200
-
201
- return function ()
202
- {
203
- // calculate SCP rotations
204
-
205
- var
206
- spine = this .spine_,
207
- numSpines = spine .length,
208
- firstSpine = spine [0] .getValue (),
209
- lastSpine = spine [spine .length - 1] .getValue (),
210
- closedSpine = firstSpine .equals (lastSpine) && this .getClosedOrientation ();
211
-
212
- // Extend or shrink static rotations array:
213
- for (var i = rotations .length; i < numSpines; ++ i)
214
- rotations [i] = new Matrix4 ();
215
-
216
- rotations .length = numSpines;
217
-
218
- // SCP axes:
219
- SCPxAxis .set (0, 0, 0);
220
- SCPyAxis .set (0, 0, 0);
221
- SCPzAxis .set (0, 0, 0);
222
-
223
- // SCP for the first point:
224
- if (closedSpine)
225
- {
226
- var s = firstSpine;
227
-
228
- // Find first defined Y-axis.
229
- for (var i = 1, length = numSpines - 2; i < length; ++ i)
230
- {
231
- SCPyAxis .assign (spine [i] .getValue ()) .subtract (s) .normalize ()
232
- .subtract (vector3 .assign (spine [length] .getValue ()) .subtract (s) .normalize ())
233
- .normalize ();
234
-
235
- if (! SCPyAxis .equals (Vector3 .Zero))
236
- break;
237
- }
238
-
239
- // Find first defined Z-axis.
240
- for (var i = 0, length = numSpines - 2; i < length; ++ i)
241
- {
242
- SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ())
243
- .cross (vector3 .assign (spine [length] .getValue ()) .subtract (spine [i] .getValue ()))
244
- .normalize ();
245
-
246
- if (! SCPzAxis .equals (Vector3 .Zero))
247
- break;
248
- }
249
- }
250
- else
251
- {
252
- // Find first defined Y-axis.
253
- for (var i = 0, length = numSpines - 1; i < length; ++ i)
254
- {
255
- SCPyAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ()) .normalize ();
256
-
257
- if (! SCPyAxis .equals (Vector3 .Zero))
258
- break;
259
- }
260
-
261
- // Find first defined Z-axis.
262
- for (var i = 1, length = numSpines - 1; i < length; ++ i)
263
- {
264
- SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ())
265
- .cross (vector3 .assign (spine [i - 1] .getValue ()) .subtract (spine [i] .getValue ()))
266
- .normalize ();
267
-
268
- if (! SCPzAxis .equals (Vector3 .Zero))
269
- break;
270
- }
271
- }
272
-
273
- // The entire spine is coincident:
274
- if (SCPyAxis .equals (Vector3 .Zero))
275
- SCPyAxis .set (0, 1, 0);
276
-
277
- // The entire spine is collinear:
278
- if (SCPzAxis .equals (Vector3 .Zero))
279
- rotation .setFromToVec (Vector3 .yAxis, SCPyAxis) .multVecRot (SCPzAxis .assign (Vector3 .zAxis));
280
-
281
- // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal.
282
- SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis);
283
-
284
- // Get first spine
285
- var s = firstSpine;
286
-
287
- rotations [0] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0,
288
- SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0,
289
- SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0,
290
- s .x, s .y, s .z, 1);
291
-
292
- // For all points other than the first or last:
293
-
294
- SCPyAxisPrevious .assign (SCPyAxis);
295
- SCPzAxisPrevious .assign (SCPzAxis);
296
-
297
- for (var i = 1, length = numSpines - 1; i < length; ++ i)
298
- {
299
- var s = spine [i] .getValue ();
300
-
301
- SCPyAxis .assign (spine [i + 1] .getValue ()) .subtract (s) .normalize ()
302
- .subtract (vector3 .assign (spine [i - 1] .getValue ()) .subtract (s) .normalize ())
303
- .normalize ();
304
- SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (s)
305
- .cross (vector3 .assign (spine [i - 1] .getValue ()) .subtract (s))
306
- .normalize ();
307
-
308
- // g.
309
- if (SCPzAxisPrevious .dot (SCPzAxis) < 0)
310
- SCPzAxis .negate ();
311
-
312
- // The two points used in computing the Y-axis are coincident.
313
- if (SCPyAxis .equals (Vector3 .Zero))
314
- SCPyAxis .assign (SCPyAxisPrevious);
315
- else
316
- SCPyAxisPrevious .assign (SCPyAxis);
317
-
318
- // The three points used in computing the Z-axis are collinear.
319
- if (SCPzAxis .equals (Vector3 .Zero))
320
- SCPzAxis .assign (SCPzAxisPrevious);
321
- else
322
- SCPzAxisPrevious .assign (SCPzAxis);
323
-
324
- // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal.
325
- SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis);
326
-
327
- rotations [i] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0,
328
- SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0,
329
- SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0,
330
- s .x, s .y, s .z, 1);
331
- }
332
-
333
- // SCP for the last point
334
- if (closedSpine)
335
- {
336
- // The SCPs for the first and last points are the same.
337
- rotations [numSpines - 1] .assign (rotations [0]);
338
- }
339
- else
340
- {
341
- var s = lastSpine;
342
-
343
- SCPyAxis .assign (s) .subtract (spine [numSpines - 2] .getValue ()) .normalize ();
344
-
345
- if (numSpines > 2)
346
- {
347
- SCPzAxis .assign (s) .subtract (spine [numSpines - 2] .getValue ())
348
- .cross (vector3 .assign (spine [numSpines - 3] .getValue ()) .subtract (spine [numSpines - 2] .getValue ()))
349
- .normalize ();
350
- }
351
-
352
- // g.
353
- if (SCPzAxisPrevious .dot (SCPzAxis) < 0)
354
- SCPzAxis .negate ();
355
-
356
- // The two points used in computing the Y-axis are coincident.
357
- if (SCPyAxis .equals (Vector3 .Zero))
358
- SCPyAxis .assign (SCPyAxisPrevious);
359
-
360
- // The three points used in computing the Z-axis are collinear.
361
- if (SCPzAxis .equals (Vector3 .Zero))
362
- SCPzAxis .assign (SCPzAxisPrevious);
363
-
364
- // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal.
365
- SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis);
366
-
367
- rotations [numSpines - 1] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0,
368
- SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0,
369
- SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0,
370
- s .x, s .y, s .z, 1);
371
- }
372
-
373
- return rotations;
374
- };
375
- })(),
376
- build: (function ()
377
- {
378
- var
379
- min = new Vector2 (0, 0, 0),
380
- max = new Vector2 (0, 0, 0),
381
- vector2 = new Vector2 (0, 0, 0);
382
-
383
- return function ()
384
- {
385
- var
386
- cw = ! this .ccw_ .getValue (),
387
- crossSection = this .crossSection_,
388
- spine = this .spine_,
389
- numSpines = spine .length,
390
- texCoordArray = this .getTexCoords ();
391
-
392
- if (numSpines < 2 || crossSection .length < 2)
393
- return;
394
-
395
- this .getMultiTexCoords () .push (texCoordArray);
396
-
397
- var crossSectionSize = crossSection .length; // This one is used only in the INDEX macro.
398
-
399
- function INDEX (n, k) { return n * crossSectionSize + k; }
400
-
401
- var
402
- firstSpine = spine [0] .getValue (),
403
- lastSpine = spine [numSpines - 1] .getValue (),
404
- closedSpine = firstSpine .equals (lastSpine) && this .getClosedOrientation ();
405
-
406
- var
407
- firstCrossSection = crossSection [0] .getValue (),
408
- lastCrossSection = crossSection [crossSection .length - 1] .getValue (),
409
- closedCrossSection = firstCrossSection .equals (lastCrossSection);
410
-
411
- // For caps calculation
412
-
413
- min .assign (crossSection [0] .getValue ());
414
- max .assign (crossSection [0] .getValue ());
415
-
416
- for (var k = 1, length = crossSection .length; k < length; ++ k)
417
- {
418
- min .min (crossSection [k] .getValue ());
419
- max .max (crossSection [k] .getValue ());
420
- }
421
-
422
- var
423
- capSize = vector2 .assign (max) .subtract (min),
424
- capMax = Math .max (capSize .x, capSize .y),
425
- numCapPoints = closedCrossSection ? crossSection .length - 1 : crossSection .length;
426
-
427
- // Create
428
-
429
- var
430
- normalIndex = [ ],
431
- normals = [ ],
432
- points = this .createPoints ();
433
-
434
- for (var p = 0, length = points .length; p < length; ++ p)
435
- normalIndex [p] = [ ];
436
-
437
- // Build body.
438
-
439
- var
440
- normalArray = this .getNormals (),
441
- vertexArray = this .getVertices ();
442
-
443
- var
444
- numCrossSection_1 = crossSection .length - 1,
445
- numSpine_1 = numSpines - 1;
446
-
447
- var
448
- indexLeft = INDEX (0, 0),
449
- indexRight = INDEX (0, closedCrossSection ? 0 : numCrossSection_1);
450
-
451
- for (var n = 0; n < numSpine_1; ++ n)
452
- {
453
- for (var k = 0; k < numCrossSection_1; ++ k)
454
- {
455
- var
456
- n1 = closedSpine && n === numSpines - 2 ? 0 : n + 1,
457
- k1 = closedCrossSection && k === crossSection .length - 2 ? 0 : k + 1;
458
-
459
- // k k+1
460
- //
461
- // p4 ----- p3 n+1
462
- // | / |
463
- // | / |
464
- // | / |
465
- // p1 ----- p2 n
466
-
467
- var
468
- i1 = INDEX (n, k),
469
- i2 = INDEX (n, k1),
470
- i3 = INDEX (n1, k1),
471
- i4 = INDEX (n1, k),
472
- p1 = points [i1],
473
- p2 = points [i2],
474
- p3 = points [i3],
475
- p4 = points [i4],
476
- l1 = p2 .distance (p3) >= 1e-7,
477
- l2 = p4 .distance (p1) >= 1e-7;
478
-
479
- if (cw)
480
- {
481
- var
482
- normal1 = Triangle3 .normal (p3, p2, p1, new Vector3 (0, 0, 0)),
483
- normal2 = Triangle3 .normal (p4, p3, p1, new Vector3 (0, 0, 0));
484
- }
485
- else
486
- {
487
- var
488
- normal1 = Triangle3 .normal (p1, p2, p3, new Vector3 (0, 0, 0)),
489
- normal2 = Triangle3 .normal (p1, p3, p4, new Vector3 (0, 0, 0));
490
- }
491
-
492
- // Merge points on the left and right side if spine is coincident for better normal generation.
493
-
494
- if (k == 0)
495
- {
496
- if (l2)
497
- indexLeft = i1;
498
- else
499
- {
500
- i1 = indexLeft;
501
- p1 = points [i1];
502
- }
503
- }
504
-
505
- if (k == crossSection .length - 2)
506
- {
507
- if (l1)
508
- indexRight = i2;
509
- else
510
- {
511
- i3 = indexRight;
512
- p3 = points [i3];
513
- }
514
- }
515
-
516
- // If there are coincident spine points then one length can be zero.
517
-
518
- // Triangle one
519
-
520
- if (l1)
521
- {
522
- // p1
523
- if (l2)
524
- texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1);
525
- else
526
- {
527
- // Cone case: ((texCoord1 + texCoord4) / 2)
528
- var y = (n / numSpine_1 + (n + 1) / numSpine_1) / 2;
529
-
530
- texCoordArray .push (k / numCrossSection_1, y, 0, 1);
531
- }
532
-
533
- normalIndex [i1] .push (normals .length);
534
- normals .push (normal1);
535
- vertexArray .push (p1 .x, p1 .y, p1 .z, 1);
536
-
537
- // p2
538
- texCoordArray .push ((k + 1) / numCrossSection_1, n / numSpine_1, 0, 1);
539
- normalIndex [i2] .push (normals .length);
540
- normals .push (normal1);
541
- vertexArray .push (p2 .x, p2 .y, p2 .z, 1);
542
-
543
- // p3
544
- texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
545
- normalIndex [i3] .push (normals .length);
546
- normals .push (normal1);
547
- vertexArray .push (p3 .x, p3 .y, p3 .z, 1);
548
- }
549
-
550
- // Triangle two
551
-
552
- if (l2)
553
- {
554
- // p1
555
- texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1);
556
- normalIndex [i1] .push (normals .length);
557
- normals .push (normal2);
558
- vertexArray .push (p1 .x, p1 .y, p1 .z, 1);
559
-
560
- // p3
561
- if (l1)
562
- texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
563
- else
564
- {
565
- // Cone case: ((texCoord3 + texCoord2) / 2)
566
- var y = ((n + 1) / numSpine_1 + n / numSpine_1) / 2;
567
-
568
- texCoordArray .push ((k + 1) / numCrossSection_1, y, 0, 1);
569
- }
570
-
571
- normalIndex [i3] .push (normals .length);
572
- normals .push (normal2);
573
- vertexArray .push (p3 .x, p3 .y, p3 .z, 1);
574
-
575
- // p4
576
- texCoordArray .push (k / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
577
- normalIndex [i4] .push (normals .length);
578
- normals .push (normal2);
579
- vertexArray .push (p4 .x, p4 .y, p4 .z, 1);
580
- }
581
- }
582
- }
583
-
584
- // Refine body normals and add them.
585
-
586
- normals = this .refineNormals (normalIndex, normals, this .creaseAngle_ .getValue ());
587
-
588
- for (var i = 0; i < normals .length; ++ i)
589
- {
590
- var normal = normals [i];
591
-
592
- normalArray .push (normal .x, normal .y, normal .z);
593
- }
594
-
595
- // Build caps
596
-
597
- if (capMax && numCapPoints > 2)
598
- {
599
- if (this .beginCap_ .getValue ())
600
- {
601
- var
602
- j = 0, // spine
603
- polygon = [ ],
604
- triangles = [ ];
605
-
606
- for (var k = 0; k < numCapPoints; ++ k)
607
- {
608
- var
609
- index = INDEX (j, numCapPoints - 1 - k),
610
- point = points [index] .copy ();
611
-
612
- point .index = index;
613
- point .texCoord = Vector2 .subtract (crossSection [numCapPoints - 1 - k] .getValue (), min) .divide (capMax);
614
- polygon .push (point);
615
- }
616
-
617
- if (this .convex_ .getValue ())
618
- Triangle3 .triangulateConvexPolygon (polygon, triangles);
619
-
620
- else
621
- Triangle3 .triangulatePolygon (polygon, triangles);
622
-
623
- if (triangles .length >= 3)
624
- {
625
- var normal = Triangle3 .normal (points [triangles [0] .index],
626
- points [triangles [1] .index],
627
- points [triangles [2] .index],
628
- new Vector3 (0, 0, 0));
629
-
630
- if (cw)
631
- normal .negate ();
632
-
633
- this .addCap (texCoordArray, normal, points, triangles);
634
- }
635
- }
636
-
637
- if (this .endCap_ .getValue ())
638
- {
639
- var
640
- j = numSpines - 1, // spine
641
- polygon = [ ],
642
- triangles = [ ];
643
-
644
- for (var k = 0; k < numCapPoints; ++ k)
645
- {
646
- var
647
- index = INDEX (j, k),
648
- point = points [index] .copy ();
649
-
650
- point .index = index;
651
- point .texCoord = Vector2 .subtract (crossSection [k] .getValue (), min) .divide (capMax);
652
- polygon .push (point);
653
- }
654
-
655
- if (this .convex_ .getValue ())
656
- Triangle3 .triangulateConvexPolygon (polygon, triangles);
657
-
658
- else
659
- Triangle3 .triangulatePolygon (polygon, triangles);
660
-
661
- if (triangles .length >= 3)
662
- {
663
- var normal = Triangle3 .normal (points [triangles [0] .index],
664
- points [triangles [1] .index],
665
- points [triangles [2] .index],
666
- new Vector3 (0, 0, 0));
667
-
668
- if (cw)
669
- normal .negate ();
670
-
671
- this .addCap (texCoordArray, normal, points, triangles);
672
- }
673
- }
674
- }
675
-
676
- this .setSolid (this .solid_ .getValue ());
677
- this .setCCW (this .ccw_ .getValue ());
678
- };
679
- })(),
680
- addCap: function (texCoordArray, normal, vertices, triangles)
681
- {
682
- var
683
- normalArray = this .getNormals (),
684
- vertexArray = this .getVertices ();
685
-
686
- for (var i = 0; i < triangles .length; i += 3)
687
- {
688
- var
689
- p0 = vertices [triangles [i] .index],
690
- p1 = vertices [triangles [i + 1] .index],
691
- p2 = vertices [triangles [i + 2] .index],
692
- t0 = triangles [i] .texCoord,
693
- t1 = triangles [i + 1] .texCoord,
694
- t2 = triangles [i + 2] .texCoord;
695
-
696
- texCoordArray .push (t0 .x, t0 .y, 0, 1);
697
- texCoordArray .push (t1 .x, t1 .y, 0, 1);
698
- texCoordArray .push (t2 .x, t2 .y, 0, 1);
699
-
700
- normalArray .push (normal .x, normal .y, normal .z,
701
- normal .x, normal .y, normal .z,
702
- normal .x, normal .y, normal .z);
703
-
704
- vertexArray .push (p0 .x, p0 .y, p0 .z, 1,
705
- p1 .x, p1 .y, p1 .z, 1,
706
- p2 .x, p2 .y, p2 .z, 1);
707
- }
708
- },
709
- });
710
-
711
- return Extrusion;
75
+ function Extrusion (executionContext)
76
+ {
77
+ X3DGeometryNode .call (this, executionContext);
78
+
79
+ this .addType (X3DConstants .Extrusion);
80
+
81
+ this ._creaseAngle .setUnit ("angle");
82
+ this ._crossSection .setUnit ("length");
83
+ this ._spine .setUnit ("length");
84
+ }
85
+
86
+ Extrusion .prototype = Object .assign (Object .create (X3DGeometryNode .prototype),
87
+ {
88
+ constructor: Extrusion,
89
+ [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
90
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
91
+ new X3DFieldDefinition (X3DConstants .inputOnly, "set_crossSection", new Fields .MFVec2f ()),
92
+ new X3DFieldDefinition (X3DConstants .inputOnly, "set_orientation", new Fields .MFRotation ()),
93
+ new X3DFieldDefinition (X3DConstants .inputOnly, "set_scale", new Fields .MFVec2f ()),
94
+ new X3DFieldDefinition (X3DConstants .inputOnly, "set_spine", new Fields .MFVec3f ()),
95
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "beginCap", new Fields .SFBool (true)),
96
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "endCap", new Fields .SFBool (true)),
97
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "solid", new Fields .SFBool (true)),
98
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "ccw", new Fields .SFBool (true)),
99
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "convex", new Fields .SFBool (true)),
100
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "creaseAngle", new Fields .SFFloat ()),
101
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "crossSection", new Fields .MFVec2f (new Vector2 (1, 1), new Vector2 (1, -1), new Vector2 (-1, -1), new Vector2 (-1, 1), new Vector2 (1, 1))),
102
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "orientation", new Fields .MFRotation (new Rotation4 ())),
103
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "scale", new Fields .MFVec2f (new Vector2 (1, 1))),
104
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "spine", new Fields .MFVec3f (new Vector3 (0, 0, 0), new Vector3 (0, 1, 0))),
105
+ ]),
106
+ getTypeName: function ()
107
+ {
108
+ return "Extrusion";
109
+ },
110
+ getComponentName: function ()
111
+ {
112
+ return "Geometry3D";
113
+ },
114
+ getContainerField: function ()
115
+ {
116
+ return "geometry";
117
+ },
118
+ initialize: function ()
119
+ {
120
+ X3DGeometryNode .prototype .initialize .call (this);
121
+
122
+ this ._set_crossSection .addFieldInterest (this ._crossSection);
123
+ this ._set_orientation .addFieldInterest (this ._orientation);
124
+ this ._set_scale .addFieldInterest (this ._scale);
125
+ this ._set_spine .addFieldInterest (this ._spine);
126
+ },
127
+ getClosedOrientation: function ()
128
+ {
129
+ const orientation = this ._orientation;
130
+
131
+ if (orientation .length)
132
+ {
133
+ const
134
+ firstOrientation = orientation [0] .getValue (),
135
+ lastOrientation = orientation [orientation .length - 1] .getValue ();
136
+
137
+ return firstOrientation .equals (lastOrientation);
138
+ }
139
+
140
+ return true;
141
+ },
142
+ createPoints: (function ()
143
+ {
144
+ const scale3 = new Vector3 (1, 1, 1);
145
+
146
+ return function ()
147
+ {
148
+ const
149
+ crossSection = this ._crossSection,
150
+ orientation = this ._orientation,
151
+ scale = this ._scale,
152
+ spine = this ._spine,
153
+ points = [ ];
154
+
155
+ // calculate SCP rotations
156
+
157
+ const rotations = this .createRotations ();
158
+
159
+ // calculate vertices.
160
+
161
+ for (let i = 0, length = spine .length; i < length; ++ i)
162
+ {
163
+ const matrix = rotations [i];
164
+
165
+ if (orientation .length)
166
+ matrix .rotate (orientation [Math .min (i, orientation .length - 1)] .getValue ());
167
+
168
+ if (scale .length)
169
+ {
170
+ const s = scale [Math .min (i, scale .length - 1)] .getValue ();
171
+ matrix .scale (scale3 .set (s .x, 1, s .y));
172
+ }
173
+
174
+ for (let cs = 0, csLength = crossSection .length; cs < csLength; ++ cs)
175
+ {
176
+ const vector = crossSection [cs] .getValue ();
177
+ points .push (matrix .multVecMatrix (new Vector3 (vector .x, 0, vector .y)));
178
+ }
179
+ }
180
+
181
+ return points;
182
+ };
183
+ })(),
184
+ createRotations: (function ()
185
+ {
186
+ const rotations = [ ];
187
+
188
+ const
189
+ SCPxAxis = new Vector3 (0, 0, 0),
190
+ SCPyAxis = new Vector3 (0, 0, 0),
191
+ SCPzAxis = new Vector3 (0, 0, 0);
192
+
193
+ const
194
+ SCPyAxisPrevious = new Vector3 (0, 0, 0),
195
+ SCPzAxisPrevious = new Vector3 (0, 0, 0);
196
+
197
+ const
198
+ vector3 = new Vector3 (0, 0, 0),
199
+ rotation = new Rotation4 (0, 0, 1, 0);
200
+
201
+ return function ()
202
+ {
203
+ // calculate SCP rotations
204
+
205
+ const
206
+ spine = this ._spine,
207
+ numSpines = spine .length,
208
+ firstSpine = spine [0] .getValue (),
209
+ lastSpine = spine [spine .length - 1] .getValue (),
210
+ closedSpine = firstSpine .equals (lastSpine) && this .getClosedOrientation ();
211
+
212
+ // Extend or shrink static rotations array:
213
+ for (let i = rotations .length; i < numSpines; ++ i)
214
+ rotations [i] = new Matrix4 ();
215
+
216
+ rotations .length = numSpines;
217
+
218
+ // SCP axes:
219
+ SCPxAxis .set (0, 0, 0);
220
+ SCPyAxis .set (0, 0, 0);
221
+ SCPzAxis .set (0, 0, 0);
222
+
223
+ // SCP for the first point:
224
+ if (closedSpine)
225
+ {
226
+ const s = firstSpine;
227
+
228
+ // Find first defined Y-axis.
229
+ for (let i = 1, length = numSpines - 2; i < length; ++ i)
230
+ {
231
+ SCPyAxis .assign (spine [i] .getValue ()) .subtract (s) .normalize ()
232
+ .subtract (vector3 .assign (spine [length] .getValue ()) .subtract (s) .normalize ())
233
+ .normalize ();
234
+
235
+ if (! SCPyAxis .equals (Vector3 .Zero))
236
+ break;
237
+ }
238
+
239
+ // Find first defined Z-axis.
240
+ for (let i = 0, length = numSpines - 2; i < length; ++ i)
241
+ {
242
+ SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ())
243
+ .cross (vector3 .assign (spine [length] .getValue ()) .subtract (spine [i] .getValue ()))
244
+ .normalize ();
245
+
246
+ if (! SCPzAxis .equals (Vector3 .Zero))
247
+ break;
248
+ }
249
+ }
250
+ else
251
+ {
252
+ // Find first defined Y-axis.
253
+ for (let i = 0, length = numSpines - 1; i < length; ++ i)
254
+ {
255
+ SCPyAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ()) .normalize ();
256
+
257
+ if (! SCPyAxis .equals (Vector3 .Zero))
258
+ break;
259
+ }
260
+
261
+ // Find first defined Z-axis.
262
+ for (let i = 1, length = numSpines - 1; i < length; ++ i)
263
+ {
264
+ SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ())
265
+ .cross (vector3 .assign (spine [i - 1] .getValue ()) .subtract (spine [i] .getValue ()))
266
+ .normalize ();
267
+
268
+ if (! SCPzAxis .equals (Vector3 .Zero))
269
+ break;
270
+ }
271
+ }
272
+
273
+ // The entire spine is coincident:
274
+ if (SCPyAxis .equals (Vector3 .Zero))
275
+ SCPyAxis .set (0, 1, 0);
276
+
277
+ // The entire spine is collinear:
278
+ if (SCPzAxis .equals (Vector3 .Zero))
279
+ rotation .setFromToVec (Vector3 .yAxis, SCPyAxis) .multVecRot (SCPzAxis .assign (Vector3 .zAxis));
280
+
281
+ // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal.
282
+ SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis);
283
+
284
+ // Get first spine
285
+ const s = firstSpine;
286
+
287
+ rotations [0] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0,
288
+ SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0,
289
+ SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0,
290
+ s .x, s .y, s .z, 1);
291
+
292
+ // For all points other than the first or last:
293
+
294
+ SCPyAxisPrevious .assign (SCPyAxis);
295
+ SCPzAxisPrevious .assign (SCPzAxis);
296
+
297
+ for (let i = 1, length = numSpines - 1; i < length; ++ i)
298
+ {
299
+ const s = spine [i] .getValue ();
300
+
301
+ SCPyAxis .assign (spine [i + 1] .getValue ()) .subtract (s) .normalize ()
302
+ .subtract (vector3 .assign (spine [i - 1] .getValue ()) .subtract (s) .normalize ())
303
+ .normalize ();
304
+ SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (s)
305
+ .cross (vector3 .assign (spine [i - 1] .getValue ()) .subtract (s))
306
+ .normalize ();
307
+
308
+ // g.
309
+ if (SCPzAxisPrevious .dot (SCPzAxis) < 0)
310
+ SCPzAxis .negate ();
311
+
312
+ // The two points used in computing the Y-axis are coincident.
313
+ if (SCPyAxis .equals (Vector3 .Zero))
314
+ SCPyAxis .assign (SCPyAxisPrevious);
315
+ else
316
+ SCPyAxisPrevious .assign (SCPyAxis);
317
+
318
+ // The three points used in computing the Z-axis are collinear.
319
+ if (SCPzAxis .equals (Vector3 .Zero))
320
+ SCPzAxis .assign (SCPzAxisPrevious);
321
+ else
322
+ SCPzAxisPrevious .assign (SCPzAxis);
323
+
324
+ // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal.
325
+ SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis);
326
+
327
+ rotations [i] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0,
328
+ SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0,
329
+ SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0,
330
+ s .x, s .y, s .z, 1);
331
+ }
332
+
333
+ // SCP for the last point
334
+ if (closedSpine)
335
+ {
336
+ // The SCPs for the first and last points are the same.
337
+ rotations [numSpines - 1] .assign (rotations [0]);
338
+ }
339
+ else
340
+ {
341
+ const s = lastSpine;
342
+
343
+ SCPyAxis .assign (s) .subtract (spine [numSpines - 2] .getValue ()) .normalize ();
344
+
345
+ if (numSpines > 2)
346
+ {
347
+ SCPzAxis .assign (s) .subtract (spine [numSpines - 2] .getValue ())
348
+ .cross (vector3 .assign (spine [numSpines - 3] .getValue ()) .subtract (spine [numSpines - 2] .getValue ()))
349
+ .normalize ();
350
+ }
351
+
352
+ // g.
353
+ if (SCPzAxisPrevious .dot (SCPzAxis) < 0)
354
+ SCPzAxis .negate ();
355
+
356
+ // The two points used in computing the Y-axis are coincident.
357
+ if (SCPyAxis .equals (Vector3 .Zero))
358
+ SCPyAxis .assign (SCPyAxisPrevious);
359
+
360
+ // The three points used in computing the Z-axis are collinear.
361
+ if (SCPzAxis .equals (Vector3 .Zero))
362
+ SCPzAxis .assign (SCPzAxisPrevious);
363
+
364
+ // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal.
365
+ SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis);
366
+
367
+ rotations [numSpines - 1] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0,
368
+ SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0,
369
+ SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0,
370
+ s .x, s .y, s .z, 1);
371
+ }
372
+
373
+ return rotations;
374
+ };
375
+ })(),
376
+ build: (function ()
377
+ {
378
+ const
379
+ min = new Vector2 (0, 0, 0),
380
+ max = new Vector2 (0, 0, 0),
381
+ vector2 = new Vector2 (0, 0, 0);
382
+
383
+ return function ()
384
+ {
385
+ const
386
+ cw = ! this ._ccw .getValue (),
387
+ crossSection = this ._crossSection,
388
+ spine = this ._spine,
389
+ numSpines = spine .length,
390
+ texCoordArray = this .getTexCoords ();
391
+
392
+ if (numSpines < 2 || crossSection .length < 2)
393
+ return;
394
+
395
+ this .getMultiTexCoords () .push (texCoordArray);
396
+
397
+ const crossSectionSize = crossSection .length; // This one is used only in the INDEX macro.
398
+
399
+ function INDEX (n, k) { return n * crossSectionSize + k; }
400
+
401
+ const
402
+ firstSpine = spine [0] .getValue (),
403
+ lastSpine = spine [numSpines - 1] .getValue (),
404
+ closedSpine = firstSpine .equals (lastSpine) && this .getClosedOrientation ();
405
+
406
+ const
407
+ firstCrossSection = crossSection [0] .getValue (),
408
+ lastCrossSection = crossSection [crossSection .length - 1] .getValue (),
409
+ closedCrossSection = firstCrossSection .equals (lastCrossSection);
410
+
411
+ // For caps calculation
412
+
413
+ min .assign (crossSection [0] .getValue ());
414
+ max .assign (crossSection [0] .getValue ());
415
+
416
+ for (let k = 1, length = crossSection .length; k < length; ++ k)
417
+ {
418
+ min .min (crossSection [k] .getValue ());
419
+ max .max (crossSection [k] .getValue ());
420
+ }
421
+
422
+ const
423
+ capSize = vector2 .assign (max) .subtract (min),
424
+ capMax = Math .max (capSize .x, capSize .y),
425
+ numCapPoints = closedCrossSection ? crossSection .length - 1 : crossSection .length;
426
+
427
+ // Create
428
+
429
+ const
430
+ normalIndex = [ ],
431
+ normals = [ ],
432
+ points = this .createPoints ();
433
+
434
+ for (let p = 0, length = points .length; p < length; ++ p)
435
+ normalIndex [p] = [ ];
436
+
437
+ // Build body.
438
+
439
+ const
440
+ normalArray = this .getNormals (),
441
+ vertexArray = this .getVertices ();
442
+
443
+ const
444
+ numCrossSection_1 = crossSection .length - 1,
445
+ numSpine_1 = numSpines - 1;
446
+
447
+ let
448
+ indexLeft = INDEX (0, 0),
449
+ indexRight = INDEX (0, closedCrossSection ? 0 : numCrossSection_1);
450
+
451
+ for (let n = 0; n < numSpine_1; ++ n)
452
+ {
453
+ for (let k = 0; k < numCrossSection_1; ++ k)
454
+ {
455
+ const
456
+ n1 = closedSpine && n === numSpines - 2 ? 0 : n + 1,
457
+ k1 = closedCrossSection && k === crossSection .length - 2 ? 0 : k + 1;
458
+
459
+ // k k+1
460
+ //
461
+ // p4 ----- p3 n+1
462
+ // | / |
463
+ // | / |
464
+ // | / |
465
+ // p1 ----- p2 n
466
+
467
+ let
468
+ i1 = INDEX (n, k),
469
+ i2 = INDEX (n, k1),
470
+ i3 = INDEX (n1, k1),
471
+ i4 = INDEX (n1, k),
472
+ p1 = points [i1],
473
+ p2 = points [i2],
474
+ p3 = points [i3],
475
+ p4 = points [i4],
476
+ l1 = p2 .distance (p3) >= 1e-7,
477
+ l2 = p4 .distance (p1) >= 1e-7;
478
+
479
+ if (cw)
480
+ {
481
+ var
482
+ normal1 = Triangle3 .normal (p3, p2, p1, new Vector3 (0, 0, 0)),
483
+ normal2 = Triangle3 .normal (p4, p3, p1, new Vector3 (0, 0, 0));
484
+ }
485
+ else
486
+ {
487
+ var
488
+ normal1 = Triangle3 .normal (p1, p2, p3, new Vector3 (0, 0, 0)),
489
+ normal2 = Triangle3 .normal (p1, p3, p4, new Vector3 (0, 0, 0));
490
+ }
491
+
492
+ // Merge points on the left and right side if spine is coincident for better normal generation.
493
+
494
+ if (k == 0)
495
+ {
496
+ if (l2)
497
+ {
498
+ indexLeft = i1;
499
+ }
500
+ else
501
+ {
502
+ i1 = indexLeft;
503
+ p1 = points [i1];
504
+ }
505
+ }
506
+
507
+ if (k == crossSection .length - 2)
508
+ {
509
+ if (l1)
510
+ {
511
+ indexRight = i2;
512
+ }
513
+ else
514
+ {
515
+ i3 = indexRight;
516
+ p3 = points [i3];
517
+ }
518
+ }
519
+
520
+ // If there are coincident spine points then one length can be zero.
521
+
522
+ // Triangle one
523
+
524
+ if (l1)
525
+ {
526
+ // p1
527
+ if (l2)
528
+ {
529
+ texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1);
530
+ }
531
+ else
532
+ {
533
+ // Cone case: ((texCoord1 + texCoord4) / 2)
534
+ const y = (n / numSpine_1 + (n + 1) / numSpine_1) / 2;
535
+
536
+ texCoordArray .push (k / numCrossSection_1, y, 0, 1);
537
+ }
538
+
539
+ normalIndex [i1] .push (normals .length);
540
+ normals .push (normal1);
541
+ vertexArray .push (p1 .x, p1 .y, p1 .z, 1);
542
+
543
+ // p2
544
+ texCoordArray .push ((k + 1) / numCrossSection_1, n / numSpine_1, 0, 1);
545
+ normalIndex [i2] .push (normals .length);
546
+ normals .push (normal1);
547
+ vertexArray .push (p2 .x, p2 .y, p2 .z, 1);
548
+
549
+ // p3
550
+ texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
551
+ normalIndex [i3] .push (normals .length);
552
+ normals .push (normal1);
553
+ vertexArray .push (p3 .x, p3 .y, p3 .z, 1);
554
+ }
555
+
556
+ // Triangle two
557
+
558
+ if (l2)
559
+ {
560
+ // p1
561
+ texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1);
562
+ normalIndex [i1] .push (normals .length);
563
+ normals .push (normal2);
564
+ vertexArray .push (p1 .x, p1 .y, p1 .z, 1);
565
+
566
+ // p3
567
+ if (l1)
568
+ {
569
+ texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
570
+ }
571
+ else
572
+ {
573
+ // Cone case: ((texCoord3 + texCoord2) / 2)
574
+ const y = ((n + 1) / numSpine_1 + n / numSpine_1) / 2;
575
+
576
+ texCoordArray .push ((k + 1) / numCrossSection_1, y, 0, 1);
577
+ }
578
+
579
+ normalIndex [i3] .push (normals .length);
580
+ normals .push (normal2);
581
+ vertexArray .push (p3 .x, p3 .y, p3 .z, 1);
582
+
583
+ // p4
584
+ texCoordArray .push (k / numCrossSection_1, (n + 1) / numSpine_1, 0, 1);
585
+ normalIndex [i4] .push (normals .length);
586
+ normals .push (normal2);
587
+ vertexArray .push (p4 .x, p4 .y, p4 .z, 1);
588
+ }
589
+ }
590
+ }
591
+
592
+ // Refine body normals and add them.
593
+
594
+ const refineNormals = this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ());
595
+
596
+ for (const normal of refineNormals)
597
+ {
598
+ normalArray .push (normal .x, normal .y, normal .z);
599
+ }
600
+
601
+ // Build caps
602
+
603
+ if (capMax && numCapPoints > 2)
604
+ {
605
+ if (this ._beginCap .getValue ())
606
+ {
607
+ const
608
+ j = 0, // spine
609
+ polygon = [ ],
610
+ triangles = [ ];
611
+
612
+ for (let k = 0; k < numCapPoints; ++ k)
613
+ {
614
+ const
615
+ index = INDEX (j, numCapPoints - 1 - k),
616
+ point = points [index] .copy ();
617
+
618
+ point .index = index;
619
+ point .texCoord = Vector2 .subtract (crossSection [numCapPoints - 1 - k] .getValue (), min) .divide (capMax);
620
+ polygon .push (point);
621
+ }
622
+
623
+ if (this ._convex .getValue ())
624
+ Triangle3 .triangulateConvexPolygon (polygon, triangles);
625
+
626
+ else
627
+ Triangle3 .triangulatePolygon (polygon, triangles);
628
+
629
+ if (triangles .length >= 3)
630
+ {
631
+ const normal = Triangle3 .normal (points [triangles [0] .index],
632
+ points [triangles [1] .index],
633
+ points [triangles [2] .index],
634
+ new Vector3 (0, 0, 0));
635
+
636
+ if (cw)
637
+ normal .negate ();
638
+
639
+ this .addCap (texCoordArray, normal, points, triangles);
640
+ }
641
+ }
642
+
643
+ if (this ._endCap .getValue ())
644
+ {
645
+ const
646
+ j = numSpines - 1, // spine
647
+ polygon = [ ],
648
+ triangles = [ ];
649
+
650
+ for (let k = 0; k < numCapPoints; ++ k)
651
+ {
652
+ const
653
+ index = INDEX (j, k),
654
+ point = points [index] .copy ();
655
+
656
+ point .index = index;
657
+ point .texCoord = Vector2 .subtract (crossSection [k] .getValue (), min) .divide (capMax);
658
+ polygon .push (point);
659
+ }
660
+
661
+ if (this ._convex .getValue ())
662
+ Triangle3 .triangulateConvexPolygon (polygon, triangles);
663
+
664
+ else
665
+ Triangle3 .triangulatePolygon (polygon, triangles);
666
+
667
+ if (triangles .length >= 3)
668
+ {
669
+ const normal = Triangle3 .normal (points [triangles [0] .index],
670
+ points [triangles [1] .index],
671
+ points [triangles [2] .index],
672
+ new Vector3 (0, 0, 0));
673
+
674
+ if (cw)
675
+ normal .negate ();
676
+
677
+ this .addCap (texCoordArray, normal, points, triangles);
678
+ }
679
+ }
680
+ }
681
+
682
+ this .setSolid (this ._solid .getValue ());
683
+ this .setCCW (this ._ccw .getValue ());
684
+ };
685
+ })(),
686
+ addCap: function (texCoordArray, normal, vertices, triangles)
687
+ {
688
+ const
689
+ normalArray = this .getNormals (),
690
+ vertexArray = this .getVertices ();
691
+
692
+ for (let i = 0, length = triangles .length; i < length; i += 3)
693
+ {
694
+ const
695
+ p0 = vertices [triangles [i] .index],
696
+ p1 = vertices [triangles [i + 1] .index],
697
+ p2 = vertices [triangles [i + 2] .index],
698
+ t0 = triangles [i] .texCoord,
699
+ t1 = triangles [i + 1] .texCoord,
700
+ t2 = triangles [i + 2] .texCoord;
701
+
702
+ texCoordArray .push (t0 .x, t0 .y, 0, 1);
703
+ texCoordArray .push (t1 .x, t1 .y, 0, 1);
704
+ texCoordArray .push (t2 .x, t2 .y, 0, 1);
705
+
706
+ normalArray .push (normal .x, normal .y, normal .z,
707
+ normal .x, normal .y, normal .z,
708
+ normal .x, normal .y, normal .z);
709
+
710
+ vertexArray .push (p0 .x, p0 .y, p0 .z, 1,
711
+ p1 .x, p1 .y, p1 .z, 1,
712
+ p2 .x, p2 .y, p2 .z, 1);
713
+ }
714
+ },
715
+ });
716
+
717
+ return Extrusion;
712
718
  });