x_ite 5.0.2 → 6.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 (340) hide show
  1. package/.vscode/settings.json +12 -5
  2. package/.vscode/tasks.json +21 -0
  3. package/Makefile +10 -15
  4. package/README.md +6 -11
  5. package/build/bin/dist.pl +0 -6
  6. package/build/bin/version.pl +1 -4
  7. package/dist/assets/components/annotation.js +2 -2
  8. package/dist/assets/components/annotation.min.js +1 -1
  9. package/dist/assets/components/cad-geometry.js +2 -2
  10. package/dist/assets/components/cad-geometry.min.js +1 -1
  11. package/dist/assets/components/cube-map-texturing.js +6 -19
  12. package/dist/assets/components/cube-map-texturing.min.js +1 -1
  13. package/dist/assets/components/dis.js +2 -2
  14. package/dist/assets/components/dis.min.js +1 -1
  15. package/dist/assets/components/event-utilities.js +3 -3
  16. package/dist/assets/components/event-utilities.min.js +1 -1
  17. package/dist/assets/components/geometry2d.js +4 -4
  18. package/dist/assets/components/geometry2d.min.js +1 -1
  19. package/dist/assets/components/geospatial.js +32 -1685
  20. package/dist/assets/components/geospatial.min.js +1 -1
  21. package/dist/assets/components/h-anim.js +70 -77
  22. package/dist/assets/components/h-anim.min.js +1 -1
  23. package/dist/assets/components/key-device-sensor.js +3 -3
  24. package/dist/assets/components/key-device-sensor.min.js +1 -1
  25. package/dist/assets/components/layout.js +38 -52
  26. package/dist/assets/components/layout.min.js +1 -1
  27. package/dist/assets/components/nurbs.js +277 -194
  28. package/dist/assets/components/nurbs.min.js +1 -1
  29. package/dist/assets/components/particle-systems.js +1918 -1658
  30. package/dist/assets/components/particle-systems.min.js +1 -1
  31. package/dist/assets/components/picking.js +33 -41
  32. package/dist/assets/components/picking.min.js +1 -1
  33. package/dist/assets/components/projective-texture-mapping.js +72 -86
  34. package/dist/assets/components/projective-texture-mapping.min.js +1 -1
  35. package/dist/assets/components/rigid-body-physics.js +36 -57
  36. package/dist/assets/components/rigid-body-physics.min.js +1 -1
  37. package/dist/assets/components/scripting.js +2 -2
  38. package/dist/assets/components/scripting.min.js +1 -1
  39. package/dist/assets/components/texturing-3d.js +26 -75
  40. package/dist/assets/components/texturing-3d.min.js +3 -3
  41. package/dist/assets/components/volume-rendering.js +10 -10
  42. package/dist/assets/components/volume-rendering.min.js +1 -1
  43. package/dist/assets/components/x_ite.js +2 -2
  44. package/dist/assets/components/x_ite.min.js +1 -1
  45. package/dist/assets/linetype/1.png +0 -0
  46. package/dist/assets/linetype/10.png +0 -0
  47. package/dist/assets/linetype/11.png +0 -0
  48. package/dist/assets/linetype/12.png +0 -0
  49. package/dist/assets/linetype/13.png +0 -0
  50. package/dist/assets/linetype/14.png +0 -0
  51. package/dist/assets/linetype/15.png +0 -0
  52. package/dist/assets/linetype/16.png +0 -0
  53. package/dist/assets/linetype/2.png +0 -0
  54. package/dist/assets/linetype/3.png +0 -0
  55. package/dist/assets/linetype/4.png +0 -0
  56. package/dist/assets/linetype/5.png +0 -0
  57. package/dist/assets/linetype/6.png +0 -0
  58. package/dist/assets/linetype/7.png +0 -0
  59. package/dist/assets/linetype/8.png +0 -0
  60. package/dist/assets/linetype/9.png +0 -0
  61. package/dist/assets/shaders/webgl1/Line.fs +0 -21
  62. package/dist/assets/shaders/webgl1/Line.vs +0 -10
  63. package/dist/assets/shaders/webgl1/PBR.vs +1 -1
  64. package/dist/assets/shaders/webgl2/Depth.vs +29 -1
  65. package/dist/assets/shaders/webgl2/Gouraud.vs +31 -3
  66. package/dist/assets/shaders/webgl2/Line.fs +24 -12
  67. package/dist/assets/shaders/webgl2/Line.vs +36 -11
  68. package/dist/assets/shaders/webgl2/LineTransform.fs +4 -0
  69. package/dist/assets/shaders/webgl2/LineTransform.vs +57 -0
  70. package/dist/assets/shaders/webgl2/PBR.vs +35 -7
  71. package/dist/assets/shaders/webgl2/Phong.vs +31 -3
  72. package/dist/assets/shaders/webgl2/Point.vs +29 -1
  73. package/dist/assets/shaders/webgl2/Unlit.vs +31 -3
  74. package/dist/example.html +6 -6
  75. package/dist/x_ite.css +180 -208
  76. package/dist/x_ite.js +16477 -16629
  77. package/dist/x_ite.min.js +17 -17
  78. package/dist/x_ite.zip +0 -0
  79. package/docs/404.md +6 -0
  80. package/docs/Accessing-the-External-Browser.md +20 -14
  81. package/docs/Browser-Support.md +6 -0
  82. package/docs/Custom-Shaders.md +17 -24
  83. package/docs/Features.md +7 -1
  84. package/docs/Gemfile +44 -0
  85. package/docs/Gemfile.lock +122 -0
  86. package/docs/Glossary.md +6 -0
  87. package/docs/How-To-Configure-Your-Web-Server.md +6 -0
  88. package/docs/Supported-Nodes.md +9 -1
  89. package/docs/What's-New.md +31 -0
  90. package/docs/XHTML-DOM-Integration.md +6 -0
  91. package/docs/_config.yml +1 -1
  92. package/docs/assets/css/main.scss +26 -0
  93. package/docs/index.md +38 -46
  94. package/docs/reference/Browser-Services.md +9 -3
  95. package/docs/reference/Constants-Services.md +6 -0
  96. package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +6 -0
  97. package/docs/reference/Field-Services-and-Objects.md +6 -0
  98. package/docs/reference/Prototype-Services.md +6 -0
  99. package/docs/reference/Route-Services.md +6 -0
  100. package/docs/reference/Scene-Services.md +8 -2
  101. package/docs/reference/Script-Node-Authoring-Interface.md +7 -1
  102. package/docs/tutorials/Adding-backgrounds.md +6 -0
  103. package/docs/tutorials/Adding-fog.md +6 -0
  104. package/docs/tutorials/Adding-sound.md +6 -0
  105. package/docs/tutorials/Animating-transforms.md +6 -0
  106. package/docs/tutorials/Basic-Nodes.md +6 -0
  107. package/docs/tutorials/Building-a-X3D-world.md +6 -0
  108. package/docs/tutorials/Building-elevation-grids.md +6 -0
  109. package/docs/tutorials/Building-extruded-shapes.md +6 -0
  110. package/docs/tutorials/Building-primitive-shapes.md +6 -0
  111. package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +6 -0
  112. package/docs/tutorials/Controlling-appearance-with-materials.md +6 -0
  113. package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +6 -0
  114. package/docs/tutorials/Controlling-detail.md +6 -0
  115. package/docs/tutorials/Controlling-how-textures-are-mapped.md +6 -0
  116. package/docs/tutorials/Controlling-navigation.md +6 -0
  117. package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +6 -0
  118. package/docs/tutorials/Controlling-the-viewpoint.md +6 -0
  119. package/docs/tutorials/Creating-new-node-types.md +6 -0
  120. package/docs/tutorials/Grouping-nodes.md +6 -0
  121. package/docs/tutorials/Hello,-World!.md +6 -0
  122. package/docs/tutorials/Improving-Performance.md +6 -0
  123. package/docs/tutorials/Increasing-Rendering-Speed.md +6 -0
  124. package/docs/tutorials/Introducing-X3D.md +6 -0
  125. package/docs/tutorials/Introducing-animation.md +6 -0
  126. package/docs/tutorials/Introducing-script-use.md +6 -0
  127. package/docs/tutorials/Lighting-your-world.md +6 -0
  128. package/docs/tutorials/Mapping-textures.md +6 -0
  129. package/docs/tutorials/Naming-nodes.md +6 -0
  130. package/docs/tutorials/Providing-information-about-your-world.md +6 -0
  131. package/docs/tutorials/Sensing-the-viewer.md +6 -0
  132. package/docs/tutorials/Sensing-viewer-actions.md +6 -0
  133. package/docs/tutorials/Transforming-Shapes.md +6 -0
  134. package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +6 -0
  135. package/docs/tutorials/index.md +6 -0
  136. package/package.json +6 -7
  137. package/src/assets/components/geometry2d.js +1 -1
  138. package/src/assets/components/key-device-sensor.js +1 -1
  139. package/src/assets/components/layout.js +1 -1
  140. package/src/assets/components/particle-systems.js +1 -1
  141. package/src/assets/components/volume-rendering.js +1 -1
  142. package/src/assets/linetype/1.png +0 -0
  143. package/src/assets/linetype/10.png +0 -0
  144. package/src/assets/linetype/11.png +0 -0
  145. package/src/assets/linetype/12.png +0 -0
  146. package/src/assets/linetype/13.png +0 -0
  147. package/src/assets/linetype/14.png +0 -0
  148. package/src/assets/linetype/15.png +0 -0
  149. package/src/assets/linetype/16.png +0 -0
  150. package/src/assets/linetype/2.png +0 -0
  151. package/src/assets/linetype/3.png +0 -0
  152. package/src/assets/linetype/4.png +0 -0
  153. package/src/assets/linetype/5.png +0 -0
  154. package/src/assets/linetype/6.png +0 -0
  155. package/src/assets/linetype/7.png +0 -0
  156. package/src/assets/linetype/8.png +0 -0
  157. package/src/assets/linetype/9.png +0 -0
  158. package/src/assets/shaders/Types.glsl +1 -9
  159. package/src/assets/shaders/webgl1/Line.fs +3 -28
  160. package/src/assets/shaders/webgl1/Line.vs +5 -19
  161. package/src/assets/shaders/webgl1/PBR.vs +1 -1
  162. package/src/assets/shaders/webgl1/Point.vs +2 -3
  163. package/src/assets/shaders/webgl2/Depth.vs +4 -1
  164. package/src/assets/shaders/webgl2/Gouraud.vs +5 -3
  165. package/src/assets/shaders/webgl2/Line.fs +11 -17
  166. package/src/assets/shaders/webgl2/Line.vs +16 -20
  167. package/src/assets/shaders/webgl2/LineTransform.fs +6 -0
  168. package/src/assets/shaders/webgl2/LineTransform.vs +77 -0
  169. package/src/assets/shaders/webgl2/PBR.vs +10 -7
  170. package/src/assets/shaders/webgl2/Phong.vs +6 -3
  171. package/src/assets/shaders/webgl2/Point.vs +6 -6
  172. package/src/assets/shaders/webgl2/Unlit.vs +6 -3
  173. package/src/assets/shaders/webgl2/include/Line2.glsl +20 -0
  174. package/src/assets/shaders/webgl2/include/Particle.glsl +36 -0
  175. package/src/example.html +6 -6
  176. package/src/standard/Math/Algorithm.js +12 -28
  177. package/src/standard/Math/Geometry/Plane3.js +0 -2
  178. package/src/standard/Math/Geometry/ViewVolume.js +88 -83
  179. package/src/standard/Math/Numbers/Color3.js +6 -0
  180. package/src/standard/Math/Numbers/Color4.js +7 -0
  181. package/src/standard/Math/Numbers/Complex.js +5 -0
  182. package/src/standard/Math/Numbers/Matrix2.js +20 -2
  183. package/src/standard/Math/Numbers/Matrix3.js +129 -110
  184. package/src/standard/Math/Numbers/Matrix4.js +138 -119
  185. package/src/standard/Math/Numbers/Quaternion.js +7 -0
  186. package/src/standard/Math/Numbers/Rotation4.js +7 -0
  187. package/src/standard/Math/Numbers/Vector2.js +8 -5
  188. package/src/standard/Math/Numbers/Vector3.js +16 -10
  189. package/src/standard/Math/Numbers/Vector4.js +12 -7
  190. package/src/standard/Math/Utility/BVH.js +45 -17
  191. package/src/tests.js +6 -1
  192. package/src/x_ite/Base/X3DBaseNode.js +22 -11
  193. package/src/x_ite/Base/X3DField.js +1 -1
  194. package/src/x_ite/Browser/Core/BrowserOptions.js +2 -2
  195. package/src/x_ite/Browser/Core/BrowserTimings.js +4 -2
  196. package/src/x_ite/Browser/Core/Context.js +185 -0
  197. package/src/x_ite/Browser/Core/ContextMenu.js +299 -193
  198. package/src/x_ite/Browser/Core/Notification.js +1 -0
  199. package/src/x_ite/Browser/Core/X3DCoreContext.js +35 -146
  200. package/src/x_ite/Browser/Layout/ScreenText.js +11 -4
  201. package/src/x_ite/Browser/Layout/X3DLayoutContext.js +4 -15
  202. package/src/x_ite/Browser/Navigation/ExamineViewer.js +12 -19
  203. package/src/x_ite/Browser/Navigation/LookAtViewer.js +0 -3
  204. package/src/x_ite/Browser/Navigation/PlaneViewer.js +0 -3
  205. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +14 -7
  206. package/src/x_ite/Browser/Navigation/X3DViewer.js +12 -20
  207. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +11 -7
  208. package/src/x_ite/Browser/ParticleSystems/BVH.glsl +183 -0
  209. package/src/x_ite/Browser/ParticleSystems/Box3.glsl +47 -0
  210. package/src/x_ite/Browser/ParticleSystems/GeometryTypes.js +66 -0
  211. package/src/x_ite/Browser/ParticleSystems/Line3.glsl +55 -0
  212. package/src/x_ite/Browser/ParticleSystems/Plane3.glsl +160 -0
  213. package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +27 -3
  214. package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +37 -37
  215. package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +19 -13
  216. package/src/x_ite/Browser/Shaders/Shader.js +33 -12
  217. package/src/x_ite/Browser/Shaders/ShaderSource.js +6 -0
  218. package/src/x_ite/Browser/Shaders/ShaderTest.js +16 -10
  219. package/src/x_ite/Browser/Shape/X3DShapeContext.js +50 -9
  220. package/src/x_ite/Browser/Text/X3DTextContext.js +4 -13
  221. package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +23 -33
  222. package/src/x_ite/Browser/Texturing3D/DICOMParser.js +2 -2
  223. package/src/x_ite/Browser/Time/X3DTimeContext.js +3 -1
  224. package/src/x_ite/Browser/VERSION.js +1 -1
  225. package/src/x_ite/Browser/X3DBrowser.js +7 -6
  226. package/src/x_ite/Browser/X3DBrowserContext.js +35 -10
  227. package/src/x_ite/Components/Core/X3DNode.js +4 -0
  228. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +0 -2
  229. package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +3 -4
  230. package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +1 -12
  231. package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +0 -1
  232. package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +1 -1
  233. package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +76 -77
  234. package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +2 -9
  235. package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +51 -65
  236. package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +1 -1
  237. package/src/x_ite/Components/Followers/X3DChaserNode.js +18 -32
  238. package/src/x_ite/Components/Followers/X3DDamperNode.js +1 -6
  239. package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +1 -1
  240. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +12 -4
  241. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +4 -4
  242. package/src/x_ite/Components/Geospatial/GeoCoordinate.js +10 -27
  243. package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +5 -10
  244. package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +9 -16
  245. package/src/x_ite/Components/Geospatial/GeoTransform.js +6 -18
  246. package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +20 -27
  247. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +8 -8
  248. package/src/x_ite/Components/Grouping/X3DTransformNode.js +0 -4
  249. package/src/x_ite/Components/HAnim/HAnimHumanoid.js +68 -75
  250. package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +4 -11
  251. package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +1 -1
  252. package/src/x_ite/Components/Layout/LayoutGroup.js +4 -9
  253. package/src/x_ite/Components/Layout/ScreenFontStyle.js +1 -1
  254. package/src/x_ite/Components/Layout/ScreenGroup.js +18 -23
  255. package/src/x_ite/Components/Lighting/DirectionalLight.js +28 -36
  256. package/src/x_ite/Components/Lighting/PointLight.js +32 -47
  257. package/src/x_ite/Components/Lighting/SpotLight.js +33 -48
  258. package/src/x_ite/Components/Navigation/Billboard.js +49 -56
  259. package/src/x_ite/Components/Navigation/LOD.js +1 -1
  260. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +82 -111
  261. package/src/x_ite/Components/Networking/Anchor.js +10 -4
  262. package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -6
  263. package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +44 -36
  264. package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +26 -17
  265. package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +20 -7
  266. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +461 -876
  267. package/src/x_ite/Components/ParticleSystems/PointEmitter.js +39 -35
  268. package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +112 -128
  269. package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +105 -112
  270. package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +138 -176
  271. package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +16 -11
  272. package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +807 -217
  273. package/src/x_ite/Components/Picking/LinePickSensor.js +31 -39
  274. package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +90 -107
  275. package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +48 -55
  276. package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +53 -70
  277. package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +8 -15
  278. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +43 -50
  279. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +32 -39
  280. package/src/x_ite/Components/Rendering/ClipPlane.js +3 -11
  281. package/src/x_ite/Components/Rendering/Color.js +12 -37
  282. package/src/x_ite/Components/Rendering/ColorRGBA.js +13 -38
  283. package/src/x_ite/Components/Rendering/IndexedLineSet.js +12 -4
  284. package/src/x_ite/Components/Rendering/LineSet.js +21 -13
  285. package/src/x_ite/Components/Rendering/PointSet.js +21 -13
  286. package/src/x_ite/Components/Rendering/X3DColorNode.js +13 -0
  287. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +13 -5
  288. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +248 -325
  289. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +305 -134
  290. package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +99 -122
  291. package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +24 -38
  292. package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +10 -17
  293. package/src/x_ite/Components/Shaders/ComposedShader.js +35 -75
  294. package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +5 -15
  295. package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +7 -24
  296. package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +7 -24
  297. package/src/x_ite/Components/Shaders/ShaderPart.js +1 -10
  298. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +219 -209
  299. package/src/x_ite/Components/Shaders/X3DShaderNode.js +1 -1
  300. package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +23 -1
  301. package/src/x_ite/Components/Shape/Appearance.js +12 -0
  302. package/src/x_ite/Components/Shape/FillProperties.js +12 -1
  303. package/src/x_ite/Components/Shape/LineProperties.js +33 -1
  304. package/src/x_ite/Components/Shape/PointProperties.js +23 -1
  305. package/src/x_ite/Components/Shape/Shape.js +27 -34
  306. package/src/x_ite/Components/Sound/Sound.js +30 -40
  307. package/src/x_ite/Components/Text/Text.js +6 -20
  308. package/src/x_ite/Components/Texturing/TextureCoordinate.js +5 -26
  309. package/src/x_ite/Components/Texturing/TextureProperties.js +4 -4
  310. package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +21 -0
  311. package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +5 -4
  312. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +24 -33
  313. package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +5 -26
  314. package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +5 -26
  315. package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +12 -19
  316. package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +7 -7
  317. package/src/x_ite/Components.js +2 -2
  318. package/src/x_ite/Fallback.js +9 -3
  319. package/src/x_ite/Fields/SFColor.js +4 -0
  320. package/src/x_ite/Fields/SFColorRGBA.js +4 -0
  321. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +4 -0
  322. package/src/x_ite/Fields/SFRotation.js +4 -0
  323. package/src/x_ite/Fields/SFString.js +4 -0
  324. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +4 -0
  325. package/src/x_ite/Parser/XMLParser.js +1 -1
  326. package/src/x_ite/Rendering/TextureBuffer.js +43 -36
  327. package/src/x_ite/Rendering/VertexArray.js +101 -0
  328. package/src/x_ite/Rendering/X3DRenderObject.js +123 -144
  329. package/src/x_ite/X3D.js +32 -26
  330. package/src/x_ite.config.js +0 -5
  331. package/src/x_ite.css +200 -162
  332. package/src/x_ite.html +26 -10
  333. package/src/x_ite.js +42 -0
  334. package/x_ite.min.html +26 -10
  335. package/dist/assets/hatching/0.png +0 -0
  336. package/dist/assets/linetype/0.png +0 -0
  337. package/src/assets/hatching/0.png +0 -0
  338. package/src/assets/linetype/0.png +0 -0
  339. package/src/spinner.css +0 -67
  340. package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  precision highp float;
4
4
  precision highp int;
5
+ precision highp sampler2D;
5
6
 
6
7
  uniform mat3 x3d_NormalMatrix;
7
8
  uniform mat4 x3d_ProjectionMatrix;
@@ -39,10 +40,12 @@ out vec4 texCoord1; // texCoord1
39
40
  out float depth;
40
41
  #endif
41
42
 
43
+ #pragma X3D include "include/Particle.glsl"
44
+
42
45
  void
43
46
  main ()
44
47
  {
45
- vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
48
+ vec4 position = x3d_ModelViewMatrix * getVertex (x3d_Vertex);
46
49
 
47
50
  fogDepth = x3d_FogDepth;
48
51
  color = x3d_Color;
@@ -52,11 +55,11 @@ main ()
52
55
  localVertex = x3d_Vertex .xyz;
53
56
 
54
57
  #if x3d_MaxTextures > 0
55
- texCoord0 = x3d_TexCoord0;
58
+ texCoord0 = getTexCoord (x3d_TexCoord0);
56
59
  #endif
57
60
 
58
61
  #if x3d_MaxTextures > 1
59
- texCoord1 = x3d_TexCoord1;
62
+ texCoord1 = getTexCoord (x3d_TexCoord1);
60
63
  #endif
61
64
 
62
65
  gl_Position = x3d_ProjectionMatrix * position;
@@ -2,12 +2,12 @@
2
2
 
3
3
  precision highp float;
4
4
  precision highp int;
5
+ precision highp sampler2D;
5
6
 
6
7
  uniform x3d_PointPropertiesParameters x3d_PointProperties;
7
8
 
8
9
  uniform bool x3d_ColorMaterial; // true if a X3DColorNode is attached, otherwise false
9
10
  uniform x3d_UnlitMaterialParameters x3d_Material;
10
- uniform int x3d_NumTextures;
11
11
 
12
12
  uniform mat4 x3d_ProjectionMatrix;
13
13
  uniform mat4 x3d_ModelViewMatrix;
@@ -25,12 +25,12 @@ out vec3 vertex; // point on geometry
25
25
  out float depth;
26
26
  #endif
27
27
 
28
+ #pragma X3D include "include/Particle.glsl"
29
+
28
30
  void
29
31
  main ()
30
32
  {
31
- // Determine varyings.
32
-
33
- vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
33
+ vec4 position = x3d_ModelViewMatrix * getVertex (x3d_Vertex);
34
34
 
35
35
  fogDepth = x3d_FogDepth;
36
36
  vertex = position .xyz;
@@ -49,10 +49,10 @@ main ()
49
49
  float dL = length (vertex);
50
50
 
51
51
  pointSize = x3d_PointProperties .pointSizeScaleFactor;
52
- pointSize *= 1.0 / (pointSizeAttenuation [0] + pointSizeAttenuation [1] * dL + pointSizeAttenuation [2] * (dL * dL));
52
+ pointSize /= pointSizeAttenuation [0] + pointSizeAttenuation [1] * dL + pointSizeAttenuation [2] * (dL * dL);
53
53
  pointSize = clamp (pointSize, pointSizeMinValue, pointSizeMaxValue);
54
54
 
55
- gl_PointSize = pointSize > 1.0 && x3d_NumTextures == 0 ? pointSize + 1.0 : pointSize;
55
+ gl_PointSize = pointSize > 1.0 ? pointSize + 1.0 : pointSize;
56
56
 
57
57
  // Determine color.
58
58
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  precision highp float;
4
4
  precision highp int;
5
+ precision highp sampler2D;
5
6
 
6
7
  uniform mat3 x3d_NormalMatrix;
7
8
  uniform mat4 x3d_ProjectionMatrix;
@@ -39,10 +40,12 @@ out vec4 texCoord1; // texCoord1
39
40
  out float depth;
40
41
  #endif
41
42
 
43
+ #pragma X3D include "include/Particle.glsl"
44
+
42
45
  void
43
46
  main ()
44
47
  {
45
- vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
48
+ vec4 position = x3d_ModelViewMatrix * getVertex (x3d_Vertex);
46
49
 
47
50
  fogDepth = x3d_FogDepth;
48
51
  color = x3d_Color;
@@ -52,11 +55,11 @@ main ()
52
55
  localVertex = x3d_Vertex .xyz;
53
56
 
54
57
  #if x3d_MaxTextures > 0
55
- texCoord0 = x3d_TexCoord0;
58
+ texCoord0 = getTexCoord (x3d_TexCoord0);
56
59
  #endif
57
60
 
58
61
  #if x3d_MaxTextures > 1
59
- texCoord1 = x3d_TexCoord1;
62
+ texCoord1 = getTexCoord (x3d_TexCoord1);
60
63
  #endif
61
64
 
62
65
  gl_Position = x3d_ProjectionMatrix * position;
@@ -0,0 +1,20 @@
1
+ struct Line2
2
+ {
3
+ vec2 point;
4
+ vec2 direction;
5
+ };
6
+
7
+ Line2
8
+ line2 (const in vec2 point1, const in vec2 point2)
9
+ {
10
+ return Line2 (point1, normalize (point2 - point1));
11
+ }
12
+
13
+ vec2
14
+ closest_point (const in Line2 line, const in vec2 point)
15
+ {
16
+ vec2 r = point - line .point;
17
+ float d = dot (r, line .direction);
18
+
19
+ return line .direction * d + line .point;
20
+ }
@@ -0,0 +1,36 @@
1
+ in vec4 x3d_Particle;
2
+ in mat4 x3d_ParticleMatrix;
3
+
4
+ uniform sampler2D x3d_TexCoordRamp;
5
+
6
+ vec4
7
+ texelFetch (const in sampler2D sampler, const in int index, const in int lod)
8
+ {
9
+ int x = textureSize (sampler, lod) .x;
10
+ ivec2 p = ivec2 (index % x, index / x);
11
+ vec4 t = texelFetch (sampler, p, lod);
12
+
13
+ return t;
14
+ }
15
+
16
+ vec4
17
+ getVertex (const in vec4 vertex)
18
+ {
19
+ if (x3d_Particle [0] == 0.0)
20
+ return vertex;
21
+
22
+ return x3d_ParticleMatrix * vertex;
23
+ }
24
+
25
+ vec4
26
+ getTexCoord (const in vec4 texCoord)
27
+ {
28
+ int index0 = int (x3d_Particle [3]);
29
+
30
+ if (x3d_Particle [0] == 0.0 || index0 == -1)
31
+ return texCoord;
32
+
33
+ const int map [6] = int [6] (0, 1, 2, 0, 2, 3);
34
+
35
+ return texelFetch (x3d_TexCoordRamp, index0 + map [gl_VertexID % 6], 0);
36
+ }
package/src/example.html CHANGED
@@ -2,19 +2,19 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8"/>
5
- <link rel="stylesheet" type="text/css" href="https://create3000.github.io/code/x_ite/latest/dist/x_ite.css"/>
6
- <script type="text/javascript" src="https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"></script>
5
+ <script type="text/javascript" src="x_ite.min.js"></script>
6
+ <!-- <script type="text/javascript" src="https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"></script> -->
7
7
  <style>
8
- X3DCanvas {
8
+ x3d-canvas {
9
9
  width: 1000px;
10
10
  height: 563px;
11
11
  }
12
12
  </style>
13
13
  </head>
14
14
  <body>
15
- <X3DCanvas src="https://cdn.rawgit.com/create3000/Library/main/Examples/X_ITE/info.x3d">
15
+ <x3d-canvas src="https://create3000.github.io/media/x_ite/info/info.x3d">
16
16
  <p>Your browser may not support all features required by X_ITE!</p>
17
- </X3DCanvas>
18
- <p>If the page is not running <a href="https://github.com/create3000/x_ite/wiki#using-firefox-chrome-and-opera-with-local-files">consider setup a localhost server</a>.</p>
17
+ </x3d-canvas>
18
+ <p>If local files are not loaded <a href="https://create3000.github.io/x_ite/#using-firefox-chrome-and-opera-with-local-files">consider setup a localhost server</a>.</p>
19
19
  </body>
20
20
  </html>
@@ -70,7 +70,7 @@ define (function ()
70
70
  },
71
71
  fract: function (value)
72
72
  {
73
- return value > 0 ? value - Math .floor (value) : value - Math .ceil (value);
73
+ return value % 1;
74
74
  },
75
75
  clamp: function (value, min, max)
76
76
  {
@@ -96,23 +96,21 @@ define (function ()
96
96
  {
97
97
  let cosom = source .dot (destination);
98
98
 
99
- if (cosom <= -1)
100
- throw new Error ("slerp is not possible: vectors are inverse collinear.");
99
+ // if (cosom <= -1) ... vectors are inverse colinear.
101
100
 
102
- if (cosom >= 1) // both normal vectors are equal
101
+ if (cosom >= 1) // Both normal vectors are equal.
103
102
  return source;
104
103
 
105
104
  if (cosom < 0)
106
105
  {
107
- // Reverse signs so we travel the short way round
106
+ // Reverse signs so we travel the short way round.
108
107
  cosom = -cosom;
109
108
  destination .negate ();
110
109
  }
111
110
 
112
111
  const
113
- omega = Math .acos (cosom),
114
- sinom = Math .sin (omega),
115
-
112
+ omega = Math .acos (cosom),
113
+ sinom = Math .sin (omega),
116
114
  scale0 = Math .sin ((1 - t) * omega) / sinom,
117
115
  scale1 = Math .sin (t * omega) / sinom;
118
116
 
@@ -127,16 +125,14 @@ define (function ()
127
125
  {
128
126
  const cosom = source .dot (destination);
129
127
 
130
- if (cosom <= -1)
131
- throw new Error ("slerp is not possible: vectors are inverse collinear.");
128
+ // if (cosom <= -1) ... vectors are inverse colinear.
132
129
 
133
- if (cosom >= 1) // both normal vectors are equal
130
+ if (cosom >= 1) // Both normal vectors are equal.
134
131
  return source;
135
132
 
136
133
  const
137
- omega = Math .acos (cosom),
138
- sinom = Math .sin (omega),
139
-
134
+ omega = Math .acos (cosom),
135
+ sinom = Math .sin (omega),
140
136
  scale0 = Math .sin ((1 - t) * omega) / sinom,
141
137
  scale1 = Math .sin (t * omega) / sinom;
142
138
 
@@ -172,7 +168,7 @@ define (function ()
172
168
  {
173
169
  return lhs > rhs;
174
170
  },
175
- lowerBound: function (array, first, last, value, comp)
171
+ lowerBound: function (array, first, last, value, comp = this .less)
176
172
  {
177
173
  // http://en.cppreference.com/w/cpp/algorithm/lower_bound
178
174
 
@@ -197,7 +193,7 @@ define (function ()
197
193
 
198
194
  return first;
199
195
  },
200
- upperBound: function (array, first, last, value, comp)
196
+ upperBound: function (array, first, last, value, comp = this .less)
201
197
  {
202
198
  // http://en.cppreference.com/w/cpp/algorithm/upper_bound
203
199
 
@@ -233,18 +229,6 @@ define (function ()
233
229
  result .add (key);
234
230
  }
235
231
 
236
- return result;
237
- },
238
- map_difference: function (lhs, rhs, result)
239
- {
240
- for (const [key, value] of lhs)
241
- {
242
- if (rhs .has (key))
243
- continue;
244
-
245
- result .set (key, value);
246
- }
247
-
248
232
  return result;
249
233
  },
250
234
  };
@@ -90,7 +90,6 @@ function (Vector3,
90
90
  return this;
91
91
  },
92
92
  multRight: function (matrix)
93
- //throw
94
93
  {
95
94
  // Taken from Inventor:
96
95
 
@@ -116,7 +115,6 @@ function (Vector3,
116
115
  return this;
117
116
  },
118
117
  multLeft: function (matrix)
119
- //throw
120
118
  {
121
119
  // Taken from Inventor:
122
120
 
@@ -136,66 +136,57 @@ function (Plane3,
136
136
 
137
137
  return function (projectionMatrix, viewport, scissor)
138
138
  {
139
- try
140
- {
141
- this .viewport .assign (viewport);
142
- this .scissor .assign (scissor);
143
-
144
- const points = this .points;
145
-
146
- const
147
- p0 = points [0],
148
- p1 = points [1],
149
- p2 = points [2],
150
- p3 = points [3],
151
- p4 = points [4],
152
- p5 = points [5],
153
- p6 = points [6],
154
- p7 = points [7];
155
-
156
- const
157
- x1 = scissor [0],
158
- x2 = x1 + scissor [2],
159
- y1 = scissor [1],
160
- y2 = y1 + scissor [3];
161
-
162
- matrix .assign (projectionMatrix) .inverse ();
163
-
164
- ViewVolume .unProjectPointMatrix (x1, y1, 0, matrix, viewport, p0),
165
- ViewVolume .unProjectPointMatrix (x2, y1, 0, matrix, viewport, p1),
166
- ViewVolume .unProjectPointMatrix (x2, y2, 0, matrix, viewport, p2),
167
- ViewVolume .unProjectPointMatrix (x1, y2, 0, matrix, viewport, p3),
168
- ViewVolume .unProjectPointMatrix (x1, y1, 1, matrix, viewport, p4),
169
- ViewVolume .unProjectPointMatrix (x2, y1, 1, matrix, viewport, p5);
170
- ViewVolume .unProjectPointMatrix (x2, y2, 1, matrix, viewport, p6);
171
- ViewVolume .unProjectPointMatrix (x1, y2, 1, matrix, viewport, p7);
172
-
173
- const normals = this .normals;
174
-
175
- Triangle3 .normal (p0, p1, p2, normals [0]); // front
176
- Triangle3 .normal (p7, p4, p0, normals [1]); // left
177
- Triangle3 .normal (p6, p2, p1, normals [2]); // right
178
- Triangle3 .normal (p2, p6, p7, normals [3]); // top
179
- Triangle3 .normal (p1, p0, p4, normals [4]); // bottom
180
- Triangle3 .normal (p4, p7, p6, normals [5]); // back
181
-
182
- const planes = this .planes;
183
-
184
- planes [0] .set (p1, normals [0]); // front
185
- planes [1] .set (p4, normals [1]); // left
186
- planes [2] .set (p2, normals [2]); // right
187
- planes [3] .set (p6, normals [3]); // top
188
- planes [4] .set (p0, normals [4]); // bottom
189
- planes [5] .set (p7, normals [5]); // back
190
-
191
- this .edges .tainted = true;
192
- this .valid = true;
193
- }
194
- catch (error)
195
- {
196
- this .valid = false;
197
- //console .log (error);
198
- }
139
+ this .viewport .assign (viewport);
140
+ this .scissor .assign (scissor);
141
+
142
+ const points = this .points;
143
+
144
+ const
145
+ p0 = points [0],
146
+ p1 = points [1],
147
+ p2 = points [2],
148
+ p3 = points [3],
149
+ p4 = points [4],
150
+ p5 = points [5],
151
+ p6 = points [6],
152
+ p7 = points [7];
153
+
154
+ const
155
+ x1 = scissor [0],
156
+ x2 = x1 + scissor [2],
157
+ y1 = scissor [1],
158
+ y2 = y1 + scissor [3];
159
+
160
+ matrix .assign (projectionMatrix) .inverse ();
161
+
162
+ ViewVolume .unProjectPointMatrix (x1, y1, 0, matrix, viewport, p0),
163
+ ViewVolume .unProjectPointMatrix (x2, y1, 0, matrix, viewport, p1),
164
+ ViewVolume .unProjectPointMatrix (x2, y2, 0, matrix, viewport, p2),
165
+ ViewVolume .unProjectPointMatrix (x1, y2, 0, matrix, viewport, p3),
166
+ ViewVolume .unProjectPointMatrix (x1, y1, 1, matrix, viewport, p4),
167
+ ViewVolume .unProjectPointMatrix (x2, y1, 1, matrix, viewport, p5);
168
+ ViewVolume .unProjectPointMatrix (x2, y2, 1, matrix, viewport, p6);
169
+ ViewVolume .unProjectPointMatrix (x1, y2, 1, matrix, viewport, p7);
170
+
171
+ const normals = this .normals;
172
+
173
+ Triangle3 .normal (p0, p1, p2, normals [0]); // front
174
+ Triangle3 .normal (p7, p4, p0, normals [1]); // left
175
+ Triangle3 .normal (p6, p2, p1, normals [2]); // right
176
+ Triangle3 .normal (p2, p6, p7, normals [3]); // top
177
+ Triangle3 .normal (p1, p0, p4, normals [4]); // bottom
178
+ Triangle3 .normal (p4, p7, p6, normals [5]); // back
179
+
180
+ const planes = this .planes;
181
+
182
+ planes [0] .set (p1, normals [0]); // front
183
+ planes [1] .set (p4, normals [1]); // left
184
+ planes [2] .set (p2, normals [2]); // right
185
+ planes [3] .set (p6, normals [3]); // top
186
+ planes [4] .set (p0, normals [4]); // bottom
187
+ planes [5] .set (p7, normals [5]); // back
188
+
189
+ this .edges .tainted = true;
199
190
 
200
191
  return this;
201
192
  };
@@ -237,28 +228,25 @@ function (Plane3,
237
228
  },
238
229
  intersectsSphere: function (radius, center)
239
230
  {
240
- if (this .valid)
241
- {
242
- const planes = this .planes;
231
+ const planes = this .planes;
243
232
 
244
- if (planes [0] .getDistanceToPoint (center) > radius)
245
- return false;
233
+ if (planes [0] .getDistanceToPoint (center) > radius)
234
+ return false;
246
235
 
247
- if (planes [1] .getDistanceToPoint (center) > radius)
248
- return false;
236
+ if (planes [1] .getDistanceToPoint (center) > radius)
237
+ return false;
249
238
 
250
- if (planes [2] .getDistanceToPoint (center) > radius)
251
- return false;
239
+ if (planes [2] .getDistanceToPoint (center) > radius)
240
+ return false;
252
241
 
253
- if (planes [3] .getDistanceToPoint (center) > radius)
254
- return false;
242
+ if (planes [3] .getDistanceToPoint (center) > radius)
243
+ return false;
255
244
 
256
- if (planes [4] .getDistanceToPoint (center) > radius)
257
- return false;
245
+ if (planes [4] .getDistanceToPoint (center) > radius)
246
+ return false;
258
247
 
259
- if (planes [5] .getDistanceToPoint (center) > radius)
260
- return false;
261
- }
248
+ if (planes [5] .getDistanceToPoint (center) > radius)
249
+ return false;
262
250
 
263
251
  return true;
264
252
  },
@@ -361,12 +349,9 @@ function (Plane3,
361
349
  //Objects coordinates
362
350
  invModelViewProjection .multVecMatrix (vin);
363
351
 
364
- if (vin .w === 0)
365
- throw new Error ("Couldn't unproject point: divisor is 0.");
366
-
367
352
  const d = 1 / vin .w;
368
353
 
369
- return point .set (vin .x * d, vin .y * d, vin .z * d);
354
+ return point .set (vin .x * d, vin .y * d, vin .z * d, 1);
370
355
  };
371
356
  })(),
372
357
  unProjectRay: (function ()
@@ -392,12 +377,32 @@ function (Plane3,
392
377
 
393
378
  return function (point, modelViewMatrix, projectionMatrix, viewport, vout)
394
379
  {
395
- vin .set (point .x, point .y, point .z, 1);
380
+ if (point .length === 4)
381
+ vin .assign (point);
382
+ else
383
+ vin .set (point .x, point .y, point .z, 1);
396
384
 
397
385
  projectionMatrix .multVecMatrix (modelViewMatrix .multVecMatrix (vin));
398
386
 
399
- if (vin .w === 0)
400
- throw new Error ("Couldn't project point: divisor is 0.");
387
+ const d = 1 / (2 * vin .w);
388
+
389
+ return vout .set ((vin .x * d + 0.5) * viewport [2] + viewport [0],
390
+ (vin .y * d + 0.5) * viewport [3] + viewport [1],
391
+ (vin .z * d + 0.5));
392
+ };
393
+ })(),
394
+ projectPointMatrix: (function ()
395
+ {
396
+ const vin = new Vector4 (0, 0, 0, 0);
397
+
398
+ return function (point, modelViewProjectionMatrix, viewport, vout)
399
+ {
400
+ if (point .length === 4)
401
+ vin .assign (point);
402
+ else
403
+ vin .set (point .x, point .y, point .z, 1);
404
+
405
+ modelViewProjectionMatrix .multVecMatrix (vin);
401
406
 
402
407
  const d = 1 / (2 * vin .w);
403
408
 
@@ -81,6 +81,12 @@ function (Algorithm)
81
81
  {
82
82
  constructor: Color3,
83
83
  length: 3,
84
+ [Symbol .iterator]: function* ()
85
+ {
86
+ yield this [_r];
87
+ yield this [_g];
88
+ yield this [_b];
89
+ },
84
90
  copy: function ()
85
91
  {
86
92
  const copy = Object .create (Color3 .prototype);
@@ -85,6 +85,13 @@ function (Color3, Algorithm)
85
85
  {
86
86
  constructor: Color4,
87
87
  length: 4,
88
+ [Symbol .iterator]: function* ()
89
+ {
90
+ yield this [_r];
91
+ yield this [_g];
92
+ yield this [_b];
93
+ yield this [_a];
94
+ },
88
95
  copy: function ()
89
96
  {
90
97
  const copy = Object .create (Color4 .prototype);
@@ -60,6 +60,11 @@ define (function ()
60
60
  Complex .prototype =
61
61
  {
62
62
  constructor: Complex,
63
+ [Symbol .iterator]: function* ()
64
+ {
65
+ yield this .real;
66
+ yield this .imag;
67
+ },
63
68
  copy: function ()
64
69
  {
65
70
  const copy = Object .create (Complex .prototype);
@@ -76,6 +76,13 @@ function (Vector2,
76
76
  constructor: Matrix2,
77
77
  order: 2,
78
78
  length: 4,
79
+ [Symbol .iterator]: function* ()
80
+ {
81
+ const length = this .length;
82
+
83
+ for (let i = 0; i < length; ++ i)
84
+ yield this [i];
85
+ },
79
86
  copy: function ()
80
87
  {
81
88
  const copy = Object .create (Matrix2 .prototype);
@@ -154,8 +161,7 @@ function (Vector2,
154
161
  D = this [3],
155
162
  d = A * D - B * C;
156
163
 
157
- if (d === 0)
158
- throw new Error ("Matrix2 .inverse: determinant is 0.");
164
+ // if (d === 0) ... determinant is zero.
159
165
 
160
166
  this [0] = D / d;
161
167
  this [1] = -B / d;
@@ -220,6 +226,18 @@ function (Vector2,
220
226
  configurable: false
221
227
  });
222
228
 
229
+ Object .defineProperty (Matrix2 .prototype, "y",
230
+ {
231
+ get: (function ()
232
+ {
233
+ const vector = new Vector2 (0, 0);
234
+
235
+ return function () { return vector .set (this [2], this [3]); };
236
+ })(),
237
+ enumerable: false,
238
+ configurable: false
239
+ });
240
+
223
241
  Object .defineProperty (Matrix2 .prototype, "xAxis",
224
242
  {
225
243
  get: function () { return this [0]; },