x_ite 4.7.14 → 5.0.2

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 +55636 -52046
  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 +594 -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 +655 -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 -160
  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 +120 -83
  487. package/src/x_ite/Components/NURBS/ContourPolyline2D.js +103 -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 +129 -125
  495. package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +128 -130
  496. package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +121 -123
  497. package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +120 -122
  498. package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +94 -94
  499. package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +127 -90
  500. package/src/x_ite/Components/NURBS/X3DNurbsControlCurveNode.js +13 -15
  501. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +337 -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 +324 -116
  607. package/src/x_ite/Components/Shape/PhysicalMaterial.js +298 -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 +150 -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 -301
  708. package/src/x_ite/Fields/SFNodeCache.js +22 -32
  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 -372
  753. package/src/x_ite/Basic/X3DObjectArrayField.js +0 -551
  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
@@ -4,8 +4,8 @@
4
4
  var module = { }, exports, process;
5
5
 
6
6
  const
7
- define = X3D .define,
8
- require = X3D .require;
7
+ define = window [Symbol .for ("X_ITE.X3D-5.0.2")] .define,
8
+ require = window [Symbol .for ("X_ITE.X3D-5.0.2")] .require;
9
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
10
10
  *******************************************************************************
11
11
  *
@@ -59,16 +59,16 @@ define ('x_ite/Browser/Picking/MatchCriterion',[],function ()
59
59
  {
60
60
  "use strict";
61
61
 
62
- var i = 0;
62
+ let i = 0;
63
63
 
64
- var MatchCriterion =
65
- {
66
- MATCH_ANY: i ++,
67
- MATCH_EVERY: i ++,
68
- MATCH_ONLY_ONE: i ++,
69
- };
64
+ const MatchCriterion =
65
+ {
66
+ MATCH_ANY: i ++,
67
+ MATCH_EVERY: i ++,
68
+ MATCH_ONLY_ONE: i ++,
69
+ };
70
70
 
71
- return MatchCriterion;
71
+ return MatchCriterion;
72
72
  });
73
73
 
74
74
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -124,15 +124,15 @@ define ('x_ite/Browser/Picking/IntersectionType',[],function ()
124
124
  {
125
125
  "use strict";
126
126
 
127
- var i = 0;
127
+ let i = 0;
128
128
 
129
- var IntersectionType =
130
- {
131
- BOUNDS: i ++,
132
- GEOMETRY: i ++,
133
- };
129
+ const IntersectionType =
130
+ {
131
+ BOUNDS: i ++,
132
+ GEOMETRY: i ++,
133
+ };
134
134
 
135
- return IntersectionType;
135
+ return IntersectionType;
136
136
  });
137
137
 
138
138
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -188,17 +188,17 @@ define ('x_ite/Browser/Picking/SortOrder',[],function ()
188
188
  {
189
189
  "use strict";
190
190
 
191
- var i = 0;
191
+ let i = 0;
192
192
 
193
- var SortOrder =
194
- {
195
- ANY: i ++,
196
- CLOSEST: i ++,
197
- ALL: i ++,
198
- ALL_SORTED: i ++,
199
- };
193
+ const SortOrder =
194
+ {
195
+ ANY: i ++,
196
+ CLOSEST: i ++,
197
+ ALL: i ++,
198
+ ALL_SORTED: i ++,
199
+ };
200
200
 
201
- return SortOrder;
201
+ return SortOrder;
202
202
  });
203
203
 
204
204
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -251,16 +251,16 @@ define ('x_ite/Browser/Picking/SortOrder',[],function ()
251
251
 
252
252
 
253
253
  define ('x_ite/Components/Picking/X3DPickSensorNode',[
254
- "x_ite/Fields",
255
- "x_ite/Components/Core/X3DSensorNode",
256
- "x_ite/Bits/TraverseType",
257
- "x_ite/Bits/X3DConstants",
258
- "x_ite/Browser/Picking/MatchCriterion",
259
- "x_ite/Browser/Picking/IntersectionType",
260
- "x_ite/Browser/Picking/SortOrder",
261
- "standard/Math/Numbers/Matrix4",
262
- "standard/Math/Algorithms/QuickSort",
263
- "standard/Utility/ObjectCache",
254
+ "x_ite/Fields",
255
+ "x_ite/Components/Core/X3DSensorNode",
256
+ "x_ite/Rendering/TraverseType",
257
+ "x_ite/Base/X3DConstants",
258
+ "x_ite/Browser/Picking/MatchCriterion",
259
+ "x_ite/Browser/Picking/IntersectionType",
260
+ "x_ite/Browser/Picking/SortOrder",
261
+ "standard/Math/Numbers/Matrix4",
262
+ "standard/Math/Algorithms/QuickSort",
263
+ "standard/Utility/ObjectCache",
264
264
  ],
265
265
  function (Fields,
266
266
  X3DSensorNode,
@@ -275,378 +275,378 @@ function (Fields,
275
275
  {
276
276
  "use strict";
277
277
 
278
- var ModelMatrixCache = ObjectCache (Matrix4);
279
-
280
- function compareDistance (lhs, rhs) { return lhs .distance < rhs .distance; }
281
-
282
- function X3DPickSensorNode (executionContext)
283
- {
284
- X3DSensorNode .call (this, executionContext);
285
-
286
- this .addType (X3DConstants .X3DPickSensorNode);
287
-
288
- this .objectType = new Set ();
289
- this .intersectionType = IntersectionType .BOUNDS;
290
- this .sortOrder = SortOrder .CLOSEST;
291
- this .pickTargetNodes = new Set ();
292
- this .modelMatrices = [ ];
293
- this .targets = [ ];
294
- this .targets .size = 0;
295
- this .pickedTargets = [ ];
296
- this .pickedTargetsSorter = new QuickSort (this .pickedTargets, compareDistance);
297
- this .pickedGeometries = new Fields .MFNode (); // Must be unique for each X3DPickSensorNode.
298
- }
299
-
300
- X3DPickSensorNode .prototype = Object .assign (Object .create (X3DSensorNode .prototype),
301
- {
302
- constructor: X3DPickSensorNode,
303
- initialize: function ()
304
- {
305
- this .isLive () .addInterest ("set_live__", this);
306
-
307
- this .enabled_ .addInterest ("set_live__", this);
308
- this .objectType_ .addInterest ("set_objectType__", this);
309
- this .matchCriterion_ .addInterest ("set_matchCriterion__", this);
310
- this .intersectionType_ .addInterest ("set_intersectionType__", this);
311
- this .sortOrder_ .addInterest ("set_sortOrder__", this);
312
- this .pickTarget_ .addInterest ("set_pickTarget__", this);
313
-
314
- this .set_objectType__ ();
315
- this .set_matchCriterion__ ();
316
- this .set_intersectionType__ ();
317
- this .set_sortOrder__ ();
318
- this .set_pickTarget__ ();
319
- },
320
- getObjectType: function ()
321
- {
322
- return this .objectType;
323
- },
324
- getMatchCriterion: function ()
325
- {
326
- return this .matchCriterion;
327
- },
328
- getIntersectionType: function ()
329
- {
330
- return this .intersectionType;
331
- },
332
- getSortOrder: function ()
333
- {
334
- return this .sortOrder;
335
- },
336
- getModelMatrices: function ()
337
- {
338
- return this .modelMatrices;
339
- },
340
- getTargets: function ()
341
- {
342
- return this .targets;
343
- },
344
- getPickShape: (function ()
345
- {
346
- var pickShapes = new WeakMap ();
347
-
348
- return function (geometryNode)
349
- {
350
- var pickShape = pickShapes .get (geometryNode);
351
-
352
- if (pickShape !== undefined)
353
- return pickShape;
354
-
355
- var
356
- shapeNode = this .getExecutionContext () .createNode ("Shape", false),
357
- collidableShapeNode = this .getExecutionContext () .createNode ("CollidableShape", false);
358
-
359
- shapeNode .setPrivate (true);
360
- collidableShapeNode .setPrivate (true);
361
- collidableShapeNode .setConvex (true);
362
-
363
- shapeNode .geometry_ = geometryNode;
364
- collidableShapeNode .shape_ = shapeNode;
365
-
366
- shapeNode .setup ();
367
- collidableShapeNode .setup ();
368
-
369
- pickShapes .set (geometryNode, collidableShapeNode);
370
-
371
- return collidableShapeNode;
372
- };
373
- })(),
374
- getPickedGeometries: (function ()
375
- {
376
- return function ()
377
- {
378
- var
379
- targets = this .targets,
380
- numTargets = targets .size,
381
- pickedTargets = this .pickedTargets,
382
- pickedGeometries = this .pickedGeometries;
383
-
384
- // Filter intersecting targets.
385
-
386
- pickedTargets .length = 0;
387
-
388
- for (var i = 0; i < numTargets; ++ i)
389
- {
390
- var target = targets [i];
391
-
392
- if (target .intersected)
393
- pickedTargets .push (target);
394
- }
395
-
396
- // No pickedTargets, return.
397
-
398
- if (pickedTargets .length === 0)
399
- {
400
- pickedGeometries .length = 0;
401
-
402
- return pickedGeometries;
403
- }
404
-
405
- // Return sorted pickedTargets.
406
-
407
- switch (this .sortOrder)
408
- {
409
- case SortOrder .ANY:
410
- {
411
- pickedTargets .length = 1;
412
- pickedGeometries [0] = this .getPickedGeometry (pickedTargets [0]);
413
- pickedGeometries .length = 1;
414
- break;
415
- }
416
- case SortOrder .CLOSEST:
417
- {
418
- this .pickedTargetsSorter .sort (0, pickedTargets .length);
419
-
420
- pickedTargets .length = 1;
421
- pickedGeometries [0] = this .getPickedGeometry (pickedTargets [0]);
422
- pickedGeometries .length = 1;
423
- break;
424
- }
425
- case SortOrder .ALL:
426
- {
427
- for (var i = 0, length = pickedTargets .length; i < length; ++ i)
428
- pickedGeometries [i] = this .getPickedGeometry (pickedTargets [i]);
429
-
430
- pickedGeometries .length = length;
431
- break;
432
- }
433
- case SortOrder .ALL_SORTED:
434
- {
435
- this .pickedTargetsSorter .sort (0, pickedTargets .length);
436
-
437
- for (var i = 0, length = pickedTargets .length; i < length; ++ i)
438
- pickedGeometries [i] = this .getPickedGeometry (pickedTargets [i]);
439
-
440
- pickedGeometries .length = length;
441
- break;
442
- }
443
- }
444
-
445
- return pickedGeometries;
446
- };
447
- })(),
448
- getPickedGeometry: function (target)
449
- {
450
- var
451
- executionContext = this .getExecutionContext (),
452
- geometryNode = target .geometryNode;
453
-
454
- if (geometryNode .getExecutionContext () === executionContext)
455
- return geometryNode;
456
-
457
- var instance = geometryNode .getExecutionContext ();
458
-
459
- if (instance .getType () .indexOf (X3DConstants .X3DPrototypeInstance) !== -1 && instance .getExecutionContext () === executionContext)
460
- return instance;
461
-
462
- var pickingHierarchy = target .pickingHierarchy;
463
-
464
- for (var i = pickingHierarchy .length - 1; i >= 0; -- i)
465
- {
466
- var node = pickingHierarchy [i];
467
-
468
- if (node .getExecutionContext () === executionContext)
469
- return node;
470
-
471
- var instance = node .getExecutionContext ();
472
-
473
- if (instance .getType () .indexOf (X3DConstants .X3DPrototypeInstance) !== -1 && instance .getExecutionContext () === executionContext)
474
- return instance;
475
- }
476
-
477
- return null;
478
- },
479
- getPickedTargets: function ()
480
- {
481
- return this .pickedTargets;
482
- },
483
- set_live__: function ()
484
- {
485
- if (this .isLive () .getValue () && this .enabled_ .getValue () && ! this .objectType .has ("NONE"))
486
- {
487
- this .getBrowser () .addPickSensor (this);
488
- this .setPickableObject (true);
489
- }
490
- else
491
- {
492
- this .getBrowser () .removePickSensor (this);
493
- this .setPickableObject (false);
494
- }
495
- },
496
- set_objectType__: function ()
497
- {
498
- this .objectType .clear ();
499
-
500
- for (var i = 0, length = this .objectType_ .length; i < length; ++ i)
501
- {
502
- this .objectType .add (this .objectType_ [i]);
503
- }
504
-
505
- this .set_live__ ();
506
- },
507
- set_matchCriterion__: (function ()
508
- {
509
- var matchCriterions = new Map ([
510
- ["MATCH_ANY", MatchCriterion .MATCH_ANY],
511
- ["MATCH_EVERY", MatchCriterion .MATCH_EVERY],
512
- ["MATCH_ONLY_ONE", MatchCriterion .MATCH_ONLY_ONE],
513
- ]);
514
-
515
- return function ()
516
- {
517
- this .matchCriterion = matchCriterions .get (this .matchCriterion_ .getValue ());
518
-
519
- if (this .matchCriterion === undefined)
520
- this .matchCriterion = MatchCriterionType .MATCH_ANY;
521
- };
522
- })(),
523
- set_intersectionType__: (function ()
524
- {
525
- var intersectionTypes = new Map ([
526
- ["BOUNDS", IntersectionType .BOUNDS],
527
- ["GEOMETRY", IntersectionType .GEOMETRY],
528
- ]);
529
-
530
- return function ()
531
- {
532
- this .intersectionType = intersectionTypes .get (this .intersectionType_ .getValue ());
533
-
534
- if (this .intersectionType === undefined)
535
- this .intersectionType = IntersectionType .BOUNDS;
536
- };
537
- })(),
538
- set_sortOrder__: (function ()
539
- {
540
- var sortOrders = new Map ([
541
- ["ANY", SortOrder .ANY],
542
- ["CLOSEST", SortOrder .CLOSEST],
543
- ["ALL", SortOrder .ALL],
544
- ["ALL_SORTED", SortOrder .ALL_SORTED],
545
- ]);
546
-
547
- return function ()
548
- {
549
- this .sortOrder = sortOrders .get (this .sortOrder_ .getValue ());
550
-
551
- if (this .sortOrder === undefined)
552
- this .sortOrder = SortOrder .CLOSEST;
553
- };
554
- })(),
555
- set_pickTarget__: function ()
556
- {
557
- this .pickTargetNodes .clear ();
558
-
559
- for (var i = 0, length = this .pickTarget_ .length; i < length; ++ i)
560
- {
561
- try
562
- {
563
- var
564
- node = this .pickTarget_ [i] .getValue () .getInnerNode (),
565
- type = node .getType ();
566
-
567
- for (var t = type .length - 1; t >= 0; -- t)
568
- {
569
- switch (type [t])
570
- {
571
- case X3DConstants .Inline:
572
- case X3DConstants .Shape:
573
- case X3DConstants .X3DGroupingNode:
574
- {
575
- this .pickTargetNodes .add (node);
576
- break;
577
- }
578
- default:
579
- continue;
580
- }
581
- }
582
- }
583
- catch (error)
584
- { }
585
- }
586
- },
587
- traverse: function (type, renderObject)
588
- {
589
- // X3DPickSensorNode nodes are sorted out and only traversed during PICKING, except if is child of a LOD or Switch node.
590
-
591
- if (type !== TraverseType .PICKING)
592
- return;
593
-
594
- if (this .getPickableObject ())
595
- this .modelMatrices .push (ModelMatrixCache .pop () .assign (renderObject .getModelViewMatrix () .get ()));
596
- },
597
- collect: function (geometryNode, modelMatrix, pickingHierarchy)
598
- {
599
- var pickTargetNodes = this .pickTargetNodes;
600
-
601
- var haveTarget = pickingHierarchy .some (function (node)
602
- {
603
- return pickTargetNodes .has (node);
604
- });
605
-
606
- if (haveTarget)
607
- {
608
- var targets = this .targets;
609
-
610
- if (targets .size < targets .length)
611
- {
612
- var target = targets [targets .size];
613
- }
614
- else
615
- {
616
- var target = { modelMatrix: new Matrix4 (), pickingHierarchy: [ ], pickedPoint: [ ], intersections: [ ] };
617
-
618
- targets .push (target);
619
- }
620
-
621
- ++ targets .size;
622
-
623
- target .intersected = false;
624
- target .geometryNode = geometryNode;
625
- target .pickedPoint .length = 0;
626
- target .intersections .length = 0;
627
- target .modelMatrix .assign (modelMatrix);
628
-
629
- var destPickingHierarchy = target .pickingHierarchy;
630
-
631
- for (var i = 0, length = pickingHierarchy .length; i < length; ++ i)
632
- destPickingHierarchy [i] = pickingHierarchy [i];
633
-
634
- destPickingHierarchy .length = length;
635
- }
636
- },
637
- process: function ()
638
- {
639
- var modelMatrices = this .modelMatrices;
640
-
641
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
642
- ModelMatrixCache .push (modelMatrices [m]);
643
-
644
- this .modelMatrices .length = 0;
645
- this .targets .size = 0;
646
- },
647
- });
648
-
649
- return X3DPickSensorNode;
278
+ var ModelMatrixCache = ObjectCache (Matrix4);
279
+
280
+ function compareDistance (lhs, rhs) { return lhs .distance < rhs .distance; }
281
+
282
+ function X3DPickSensorNode (executionContext)
283
+ {
284
+ X3DSensorNode .call (this, executionContext);
285
+
286
+ this .addType (X3DConstants .X3DPickSensorNode);
287
+
288
+ this .objectType = new Set ();
289
+ this .intersectionType = IntersectionType .BOUNDS;
290
+ this .sortOrder = SortOrder .CLOSEST;
291
+ this .pickTargetNodes = new Set ();
292
+ this .modelMatrices = [ ];
293
+ this .targets = [ ];
294
+ this .targets .size = 0;
295
+ this .pickedTargets = [ ];
296
+ this .pickedTargetsSorter = new QuickSort (this .pickedTargets, compareDistance);
297
+ this .pickedGeometries = new Fields .MFNode (); // Must be unique for each X3DPickSensorNode.
298
+ }
299
+
300
+ X3DPickSensorNode .prototype = Object .assign (Object .create (X3DSensorNode .prototype),
301
+ {
302
+ constructor: X3DPickSensorNode,
303
+ initialize: function ()
304
+ {
305
+ this .isLive () .addInterest ("set_live__", this);
306
+
307
+ this ._enabled .addInterest ("set_live__", this);
308
+ this ._objectType .addInterest ("set_objectType__", this);
309
+ this ._matchCriterion .addInterest ("set_matchCriterion__", this);
310
+ this ._intersectionType .addInterest ("set_intersectionType__", this);
311
+ this ._sortOrder .addInterest ("set_sortOrder__", this);
312
+ this ._pickTarget .addInterest ("set_pickTarget__", this);
313
+
314
+ this .set_objectType__ ();
315
+ this .set_matchCriterion__ ();
316
+ this .set_intersectionType__ ();
317
+ this .set_sortOrder__ ();
318
+ this .set_pickTarget__ ();
319
+ },
320
+ getObjectType: function ()
321
+ {
322
+ return this .objectType;
323
+ },
324
+ getMatchCriterion: function ()
325
+ {
326
+ return this .matchCriterion;
327
+ },
328
+ getIntersectionType: function ()
329
+ {
330
+ return this .intersectionType;
331
+ },
332
+ getSortOrder: function ()
333
+ {
334
+ return this .sortOrder;
335
+ },
336
+ getModelMatrices: function ()
337
+ {
338
+ return this .modelMatrices;
339
+ },
340
+ getTargets: function ()
341
+ {
342
+ return this .targets;
343
+ },
344
+ getPickShape: (function ()
345
+ {
346
+ var pickShapes = new WeakMap ();
347
+
348
+ return function (geometryNode)
349
+ {
350
+ var pickShape = pickShapes .get (geometryNode);
351
+
352
+ if (pickShape !== undefined)
353
+ return pickShape;
354
+
355
+ var
356
+ shapeNode = this .getExecutionContext () .createNode ("Shape", false),
357
+ collidableShapeNode = this .getExecutionContext () .createNode ("CollidableShape", false);
358
+
359
+ shapeNode .setPrivate (true);
360
+ collidableShapeNode .setPrivate (true);
361
+ collidableShapeNode .setConvex (true);
362
+
363
+ shapeNode ._geometry = geometryNode;
364
+ collidableShapeNode ._shape = shapeNode;
365
+
366
+ shapeNode .setup ();
367
+ collidableShapeNode .setup ();
368
+
369
+ pickShapes .set (geometryNode, collidableShapeNode);
370
+
371
+ return collidableShapeNode;
372
+ };
373
+ })(),
374
+ getPickedGeometries: (function ()
375
+ {
376
+ return function ()
377
+ {
378
+ var
379
+ targets = this .targets,
380
+ numTargets = targets .size,
381
+ pickedTargets = this .pickedTargets,
382
+ pickedGeometries = this .pickedGeometries;
383
+
384
+ // Filter intersecting targets.
385
+
386
+ pickedTargets .length = 0;
387
+
388
+ for (var i = 0; i < numTargets; ++ i)
389
+ {
390
+ var target = targets [i];
391
+
392
+ if (target .intersected)
393
+ pickedTargets .push (target);
394
+ }
395
+
396
+ // No pickedTargets, return.
397
+
398
+ if (pickedTargets .length === 0)
399
+ {
400
+ pickedGeometries .length = 0;
401
+
402
+ return pickedGeometries;
403
+ }
404
+
405
+ // Return sorted pickedTargets.
406
+
407
+ switch (this .sortOrder)
408
+ {
409
+ case SortOrder .ANY:
410
+ {
411
+ pickedTargets .length = 1;
412
+ pickedGeometries [0] = this .getPickedGeometry (pickedTargets [0]);
413
+ pickedGeometries .length = 1;
414
+ break;
415
+ }
416
+ case SortOrder .CLOSEST:
417
+ {
418
+ this .pickedTargetsSorter .sort (0, pickedTargets .length);
419
+
420
+ pickedTargets .length = 1;
421
+ pickedGeometries [0] = this .getPickedGeometry (pickedTargets [0]);
422
+ pickedGeometries .length = 1;
423
+ break;
424
+ }
425
+ case SortOrder .ALL:
426
+ {
427
+ for (var i = 0, length = pickedTargets .length; i < length; ++ i)
428
+ pickedGeometries [i] = this .getPickedGeometry (pickedTargets [i]);
429
+
430
+ pickedGeometries .length = length;
431
+ break;
432
+ }
433
+ case SortOrder .ALL_SORTED:
434
+ {
435
+ this .pickedTargetsSorter .sort (0, pickedTargets .length);
436
+
437
+ for (var i = 0, length = pickedTargets .length; i < length; ++ i)
438
+ pickedGeometries [i] = this .getPickedGeometry (pickedTargets [i]);
439
+
440
+ pickedGeometries .length = length;
441
+ break;
442
+ }
443
+ }
444
+
445
+ return pickedGeometries;
446
+ };
447
+ })(),
448
+ getPickedGeometry: function (target)
449
+ {
450
+ var
451
+ executionContext = this .getExecutionContext (),
452
+ geometryNode = target .geometryNode;
453
+
454
+ if (geometryNode .getExecutionContext () === executionContext)
455
+ return geometryNode;
456
+
457
+ var instance = geometryNode .getExecutionContext ();
458
+
459
+ if (instance .getType () .indexOf (X3DConstants .X3DPrototypeInstance) !== -1 && instance .getExecutionContext () === executionContext)
460
+ return instance;
461
+
462
+ var pickingHierarchy = target .pickingHierarchy;
463
+
464
+ for (var i = pickingHierarchy .length - 1; i >= 0; -- i)
465
+ {
466
+ var node = pickingHierarchy [i];
467
+
468
+ if (node .getExecutionContext () === executionContext)
469
+ return node;
470
+
471
+ var instance = node .getExecutionContext ();
472
+
473
+ if (instance .getType () .indexOf (X3DConstants .X3DPrototypeInstance) !== -1 && instance .getExecutionContext () === executionContext)
474
+ return instance;
475
+ }
476
+
477
+ return null;
478
+ },
479
+ getPickedTargets: function ()
480
+ {
481
+ return this .pickedTargets;
482
+ },
483
+ set_live__: function ()
484
+ {
485
+ if (this .isLive () .getValue () && this ._enabled .getValue () && ! this .objectType .has ("NONE"))
486
+ {
487
+ this .getBrowser () .addPickSensor (this);
488
+ this .setPickableObject (true);
489
+ }
490
+ else
491
+ {
492
+ this .getBrowser () .removePickSensor (this);
493
+ this .setPickableObject (false);
494
+ }
495
+ },
496
+ set_objectType__: function ()
497
+ {
498
+ this .objectType .clear ();
499
+
500
+ for (var i = 0, length = this ._objectType .length; i < length; ++ i)
501
+ {
502
+ this .objectType .add (this ._objectType [i]);
503
+ }
504
+
505
+ this .set_live__ ();
506
+ },
507
+ set_matchCriterion__: (function ()
508
+ {
509
+ var matchCriterions = new Map ([
510
+ ["MATCH_ANY", MatchCriterion .MATCH_ANY],
511
+ ["MATCH_EVERY", MatchCriterion .MATCH_EVERY],
512
+ ["MATCH_ONLY_ONE", MatchCriterion .MATCH_ONLY_ONE],
513
+ ]);
514
+
515
+ return function ()
516
+ {
517
+ this .matchCriterion = matchCriterions .get (this ._matchCriterion .getValue ());
518
+
519
+ if (this .matchCriterion === undefined)
520
+ this .matchCriterion = MatchCriterionType .MATCH_ANY;
521
+ };
522
+ })(),
523
+ set_intersectionType__: (function ()
524
+ {
525
+ var intersectionTypes = new Map ([
526
+ ["BOUNDS", IntersectionType .BOUNDS],
527
+ ["GEOMETRY", IntersectionType .GEOMETRY],
528
+ ]);
529
+
530
+ return function ()
531
+ {
532
+ this .intersectionType = intersectionTypes .get (this ._intersectionType .getValue ());
533
+
534
+ if (this .intersectionType === undefined)
535
+ this .intersectionType = IntersectionType .BOUNDS;
536
+ };
537
+ })(),
538
+ set_sortOrder__: (function ()
539
+ {
540
+ var sortOrders = new Map ([
541
+ ["ANY", SortOrder .ANY],
542
+ ["CLOSEST", SortOrder .CLOSEST],
543
+ ["ALL", SortOrder .ALL],
544
+ ["ALL_SORTED", SortOrder .ALL_SORTED],
545
+ ]);
546
+
547
+ return function ()
548
+ {
549
+ this .sortOrder = sortOrders .get (this ._sortOrder .getValue ());
550
+
551
+ if (this .sortOrder === undefined)
552
+ this .sortOrder = SortOrder .CLOSEST;
553
+ };
554
+ })(),
555
+ set_pickTarget__: function ()
556
+ {
557
+ this .pickTargetNodes .clear ();
558
+
559
+ for (var i = 0, length = this ._pickTarget .length; i < length; ++ i)
560
+ {
561
+ try
562
+ {
563
+ var
564
+ node = this ._pickTarget [i] .getValue () .getInnerNode (),
565
+ type = node .getType ();
566
+
567
+ for (var t = type .length - 1; t >= 0; -- t)
568
+ {
569
+ switch (type [t])
570
+ {
571
+ case X3DConstants .Inline:
572
+ case X3DConstants .Shape:
573
+ case X3DConstants .X3DGroupingNode:
574
+ {
575
+ this .pickTargetNodes .add (node);
576
+ break;
577
+ }
578
+ default:
579
+ continue;
580
+ }
581
+ }
582
+ }
583
+ catch (error)
584
+ { }
585
+ }
586
+ },
587
+ traverse: function (type, renderObject)
588
+ {
589
+ // X3DPickSensorNode nodes are sorted out and only traversed during PICKING, except if is child of a LOD or Switch node.
590
+
591
+ if (type !== TraverseType .PICKING)
592
+ return;
593
+
594
+ if (this .getPickableObject ())
595
+ this .modelMatrices .push (ModelMatrixCache .pop () .assign (renderObject .getModelViewMatrix () .get ()));
596
+ },
597
+ collect: function (geometryNode, modelMatrix, pickingHierarchy)
598
+ {
599
+ var pickTargetNodes = this .pickTargetNodes;
600
+
601
+ var haveTarget = pickingHierarchy .some (function (node)
602
+ {
603
+ return pickTargetNodes .has (node);
604
+ });
605
+
606
+ if (haveTarget)
607
+ {
608
+ var targets = this .targets;
609
+
610
+ if (targets .size < targets .length)
611
+ {
612
+ var target = targets [targets .size];
613
+ }
614
+ else
615
+ {
616
+ var target = { modelMatrix: new Matrix4 (), pickingHierarchy: [ ], pickedPoint: [ ], intersections: [ ] };
617
+
618
+ targets .push (target);
619
+ }
620
+
621
+ ++ targets .size;
622
+
623
+ target .intersected = false;
624
+ target .geometryNode = geometryNode;
625
+ target .pickedPoint .length = 0;
626
+ target .intersections .length = 0;
627
+ target .modelMatrix .assign (modelMatrix);
628
+
629
+ var destPickingHierarchy = target .pickingHierarchy;
630
+
631
+ for (var i = 0, length = pickingHierarchy .length; i < length; ++ i)
632
+ destPickingHierarchy [i] = pickingHierarchy [i];
633
+
634
+ destPickingHierarchy .length = length;
635
+ }
636
+ },
637
+ process: function ()
638
+ {
639
+ var modelMatrices = this .modelMatrices;
640
+
641
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
642
+ ModelMatrixCache .push (modelMatrices [m]);
643
+
644
+ this .modelMatrices .length = 0;
645
+ this .targets .size = 0;
646
+ },
647
+ });
648
+
649
+ return X3DPickSensorNode;
650
650
  });
651
651
 
652
652
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -699,21 +699,21 @@ function (Fields,
699
699
 
700
700
 
701
701
  define ('x_ite/Components/Picking/LinePickSensor',[
702
- "x_ite/Fields",
703
- "x_ite/Basic/X3DFieldDefinition",
704
- "x_ite/Basic/FieldDefinitionArray",
705
- "x_ite/Components/Picking/X3DPickSensorNode",
706
- "x_ite/Bits/X3DConstants",
707
- "x_ite/Browser/Picking/IntersectionType",
708
- "standard/Math/Numbers/Vector3",
709
- "standard/Math/Numbers/Matrix4",
710
- "standard/Math/Geometry/Box3",
711
- "standard/Math/Geometry/Line3",
702
+ "x_ite/Fields",
703
+ "x_ite/Base/X3DFieldDefinition",
704
+ "x_ite/Base/FieldDefinitionArray",
705
+ "x_ite/Components/Picking/X3DPickSensorNode",
706
+ "x_ite/Base/X3DConstants",
707
+ "x_ite/Browser/Picking/IntersectionType",
708
+ "standard/Math/Numbers/Vector3",
709
+ "standard/Math/Numbers/Matrix4",
710
+ "standard/Math/Geometry/Box3",
711
+ "standard/Math/Geometry/Line3",
712
712
  ],
713
713
  function (Fields,
714
714
  X3DFieldDefinition,
715
715
  FieldDefinitionArray,
716
- X3DPickSensorNode,
716
+ X3DPickSensorNode,
717
717
  X3DConstants,
718
718
  IntersectionType,
719
719
  Vector3,
@@ -723,283 +723,281 @@ function (Fields,
723
723
  {
724
724
  "use strict";
725
725
 
726
- function LinePickSensor (executionContext)
727
- {
728
- X3DPickSensorNode .call (this, executionContext);
729
-
730
- this .addType (X3DConstants .LinePickSensor);
731
-
732
- this .pickingGeometryNode = null;
733
- }
734
-
735
- LinePickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
736
- {
737
- constructor: LinePickSensor,
738
- fieldDefinitions: new FieldDefinitionArray ([
739
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
740
- new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
741
- new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
742
- new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
743
- new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
744
- new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
745
- new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
746
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedTextureCoordinate", new Fields .MFVec3f ()),
747
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedNormal", new Fields .MFVec3f ()),
748
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedPoint", new Fields .MFVec3f ()),
749
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
750
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
751
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
752
- ]),
753
- getTypeName: function ()
754
- {
755
- return "LinePickSensor";
756
- },
757
- getComponentName: function ()
758
- {
759
- return "Picking";
760
- },
761
- getContainerField: function ()
762
- {
763
- return "children";
764
- },
765
- initialize: function ()
766
- {
767
- X3DPickSensorNode .prototype .initialize .call (this);
768
-
769
- this .pickingGeometry_ .addInterest ("set_pickingGeometry__", this);
770
-
771
- this .set_pickingGeometry__ ();
772
- },
773
- set_pickingGeometry__: function ()
774
- {
775
- this .pickingGeometryNode = null;
776
-
777
- try
778
- {
779
- var
780
- node = this .pickingGeometry_ .getValue () .getInnerNode (),
781
- type = node .getType ();
782
-
783
- for (var t = type .length - 1; t >= 0; -- t)
784
- {
785
- switch (type [t])
786
- {
787
- case X3DConstants .IndexedLineSet:
788
- case X3DConstants .LineSet:
789
- {
790
- this .pickingGeometryNode = node;
791
- break;
792
- }
793
- default:
794
- continue;
795
- }
796
- }
797
- }
798
- catch (error)
799
- { }
800
- },
801
- process: (function ()
802
- {
803
- var
804
- pickingBBox = new Box3 (),
805
- targetBBox = new Box3 (),
806
- pickingCenter = new Vector3 (0, 0, 0),
807
- targetCenter = new Vector3 (0, 0, 0),
808
- matrix = new Matrix4 (),
809
- point1 = new Vector3 (0, 0, 0),
810
- point2 = new Vector3 (0, 0, 0),
811
- line = new Line3 (Vector3 .Zero, Vector3 .zAxis),
812
- a = new Vector3 (0, 0, 0),
813
- b = new Vector3 (0, 0, 0),
814
- clipPlanes = [ ],
815
- intersections = [ ],
816
- texCoord = new Vector3 (0, 0, 0),
817
- pickedTextureCoordinate = new Fields .MFVec3f (),
818
- pickedNormal = new Fields .MFVec3f (),
819
- pickedPoint = new Fields .MFVec3f ();
820
-
821
- return function ()
822
- {
823
- if (this .pickingGeometryNode)
824
- {
825
- var
826
- modelMatrices = this .getModelMatrices (),
827
- targets = this .getTargets ();
828
-
829
- switch (this .getIntersectionType ())
830
- {
831
- case IntersectionType .BOUNDS:
832
- {
833
- // Intersect bboxes.
834
-
835
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
836
- {
837
- var modelMatrix = modelMatrices [m];
838
-
839
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
840
-
841
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
842
- {
843
- var target = targets [t];
844
-
845
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
846
-
847
- if (pickingBBox .intersectsBox (targetBBox))
848
- {
849
- pickingCenter .assign (pickingBBox .center);
850
- targetCenter .assign (targetBBox .center);
851
-
852
- target .intersected = true;
853
- target .distance = pickingCenter .distance (targetCenter);
854
- }
855
- }
856
- }
857
-
858
- // Send events.
859
-
860
- var
861
- pickedGeometries = this .getPickedGeometries (),
862
- active = Boolean (pickedGeometries .length);
863
-
864
- pickedGeometries .remove (0, pickedGeometries .length, null);
865
-
866
- if (active !== this .isActive_ .getValue ())
867
- this .isActive_ = active;
868
-
869
- if (! this .pickedGeometry_ .equals (pickedGeometries))
870
- this .pickedGeometry_ = pickedGeometries;
871
-
872
- break;
873
- }
874
- case IntersectionType .GEOMETRY:
875
- {
876
- // Intersect geometry.
877
-
878
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
879
- {
880
- var modelMatrix = modelMatrices [m];
881
-
882
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
883
-
884
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
885
- {
886
- try
887
- {
888
- var
889
- target = targets [t],
890
- geometryNode = target .geometryNode,
891
- vertices = this .pickingGeometryNode .getVertices ();
892
-
893
- targetBBox .assign (geometryNode .getBBox ()) .multRight (target .modelMatrix);
894
- matrix .assign (target .modelMatrix) .inverse () .multLeft (modelMatrix);
895
-
896
- for (var v = 0, vLength = vertices .length; v < vLength; v += 8)
897
- {
898
- matrix .multVecMatrix (point1 .set (vertices [v + 0], vertices [v + 1], vertices [v + 2]));
899
- matrix .multVecMatrix (point2 .set (vertices [v + 4], vertices [v + 5], vertices [v + 6]));
900
- line .setPoints (point1, point2);
901
-
902
- intersections .length = 0;
903
-
904
- if (geometryNode .intersectsLine (line, clipPlanes, target .modelMatrix, intersections))
905
- {
906
- for (var i = 0, iLength = intersections .length; i < iLength; ++ i)
907
- {
908
- // Test if intersection.point is between point1 and point2.
909
-
910
- var intersection = intersections [i];
911
-
912
- a .assign (intersection .point) .subtract (point1);
913
- b .assign (intersection .point) .subtract (point2);
914
-
915
- var
916
- c = a .add (b) .abs (),
917
- s = point1 .distance (point2);
918
-
919
- if (c <= s)
920
- target .intersections .push (intersection);
921
- }
922
- }
923
- }
924
-
925
- if (target .intersections .length)
926
- {
927
- pickingCenter .assign (pickingBBox .center);
928
- targetCenter .assign (targetBBox .center);
929
-
930
- target .intersected = true;
931
- target .distance = pickingCenter .distance (targetCenter);
932
- }
933
- }
934
- catch (error)
935
- {
936
- // Catch inverse.
937
- console .log (error);
938
- }
939
- }
940
- }
941
-
942
- // Send events.
943
-
944
- var
945
- pickedGeometries = this .getPickedGeometries (),
946
- active = Boolean (pickedGeometries .length);
947
-
948
- pickedGeometries .remove (0, pickedGeometries .length, null);
949
-
950
- if (active !== this .isActive_ .getValue ())
951
- this .isActive_ = active;
952
-
953
- if (! this .pickedGeometry_ .equals (pickedGeometries))
954
- this .pickedGeometry_ = pickedGeometries;
955
-
956
- var pickedTargets = this .getPickedTargets ();
957
-
958
- pickedTextureCoordinate .length = 0;
959
- pickedNormal .length = 0;
960
- pickedPoint .length = 0;
961
-
962
- for (var t = 0, tLength = pickedTargets .length; t < tLength; ++ t)
963
- {
964
- var pickedIntersections = pickedTargets [t] .intersections;
965
-
966
- for (var i = 0, iLength = pickedIntersections .length; i < iLength; ++ i)
967
- {
968
- var
969
- intersection = pickedIntersections [i],
970
- t = intersection .texCoord;
971
-
972
- texCoord .set (t .x, t .y, t .z);
973
-
974
- pickedTextureCoordinate .push (texCoord);
975
- pickedNormal .push (intersection .normal);
976
- pickedPoint .push (intersection .point);
977
- }
978
- }
979
-
980
- if (! this .pickedTextureCoordinate_ .equals (pickedTextureCoordinate))
981
- this .pickedTextureCoordinate_ = pickedTextureCoordinate;
982
-
983
- if (! this .pickedNormal_ .equals (pickedNormal))
984
- this .pickedNormal_ = pickedNormal;
985
-
986
- if (! this .pickedPoint_ .equals (pickedPoint))
987
- this .pickedPoint_ = pickedPoint;
988
-
989
- break;
990
- }
991
- }
992
- }
993
-
994
- X3DPickSensorNode .prototype .process .call (this);
995
- };
996
- })(),
997
- });
998
-
999
- return LinePickSensor;
1000
- });
726
+ function LinePickSensor (executionContext)
727
+ {
728
+ X3DPickSensorNode .call (this, executionContext);
729
+
730
+ this .addType (X3DConstants .LinePickSensor);
731
+
732
+ this .pickingGeometryNode = null;
733
+ }
734
+
735
+ LinePickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
736
+ {
737
+ constructor: LinePickSensor,
738
+ [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
739
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
740
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
741
+ new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
742
+ new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
743
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
744
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
745
+ new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
746
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedTextureCoordinate", new Fields .MFVec3f ()),
747
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedNormal", new Fields .MFVec3f ()),
748
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedPoint", new Fields .MFVec3f ()),
749
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
750
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
751
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
752
+ ]),
753
+ getTypeName: function ()
754
+ {
755
+ return "LinePickSensor";
756
+ },
757
+ getComponentName: function ()
758
+ {
759
+ return "Picking";
760
+ },
761
+ getContainerField: function ()
762
+ {
763
+ return "children";
764
+ },
765
+ initialize: function ()
766
+ {
767
+ X3DPickSensorNode .prototype .initialize .call (this);
768
+
769
+ this ._pickingGeometry .addInterest ("set_pickingGeometry__", this);
770
+
771
+ this .set_pickingGeometry__ ();
772
+ },
773
+ set_pickingGeometry__: function ()
774
+ {
775
+ this .pickingGeometryNode = null;
776
+
777
+ try
778
+ {
779
+ var
780
+ node = this ._pickingGeometry .getValue () .getInnerNode (),
781
+ type = node .getType ();
782
+
783
+ for (var t = type .length - 1; t >= 0; -- t)
784
+ {
785
+ switch (type [t])
786
+ {
787
+ case X3DConstants .IndexedLineSet:
788
+ case X3DConstants .LineSet:
789
+ {
790
+ this .pickingGeometryNode = node;
791
+ break;
792
+ }
793
+ default:
794
+ continue;
795
+ }
796
+ }
797
+ }
798
+ catch (error)
799
+ { }
800
+ },
801
+ process: (function ()
802
+ {
803
+ var
804
+ pickingBBox = new Box3 (),
805
+ targetBBox = new Box3 (),
806
+ pickingCenter = new Vector3 (0, 0, 0),
807
+ targetCenter = new Vector3 (0, 0, 0),
808
+ matrix = new Matrix4 (),
809
+ point1 = new Vector3 (0, 0, 0),
810
+ point2 = new Vector3 (0, 0, 0),
811
+ line = new Line3 (Vector3 .Zero, Vector3 .zAxis),
812
+ a = new Vector3 (0, 0, 0),
813
+ b = new Vector3 (0, 0, 0),
814
+ clipPlanes = [ ],
815
+ intersections = [ ],
816
+ texCoord = new Vector3 (0, 0, 0),
817
+ pickedTextureCoordinate = new Fields .MFVec3f (),
818
+ pickedNormal = new Fields .MFVec3f (),
819
+ pickedPoint = new Fields .MFVec3f ();
820
+
821
+ return function ()
822
+ {
823
+ if (this .pickingGeometryNode)
824
+ {
825
+ var
826
+ modelMatrices = this .getModelMatrices (),
827
+ targets = this .getTargets ();
828
+
829
+ switch (this .getIntersectionType ())
830
+ {
831
+ case IntersectionType .BOUNDS:
832
+ {
833
+ // Intersect bboxes.
834
+
835
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
836
+ {
837
+ var modelMatrix = modelMatrices [m];
838
+
839
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
840
+
841
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
842
+ {
843
+ var target = targets [t];
844
+
845
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
846
+
847
+ if (pickingBBox .intersectsBox (targetBBox))
848
+ {
849
+ pickingCenter .assign (pickingBBox .center);
850
+ targetCenter .assign (targetBBox .center);
851
+
852
+ target .intersected = true;
853
+ target .distance = pickingCenter .distance (targetCenter);
854
+ }
855
+ }
856
+ }
857
+
858
+ // Send events.
859
+
860
+ var
861
+ pickedGeometries = this .getPickedGeometries (),
862
+ active = Boolean (pickedGeometries .length);
863
+
864
+ pickedGeometries .remove (0, pickedGeometries .length, null);
865
+
866
+ if (active !== this ._isActive .getValue ())
867
+ this ._isActive = active;
868
+
869
+ if (! this ._pickedGeometry .equals (pickedGeometries))
870
+ this ._pickedGeometry = pickedGeometries;
871
+
872
+ break;
873
+ }
874
+ case IntersectionType .GEOMETRY:
875
+ {
876
+ // Intersect geometry.
877
+
878
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
879
+ {
880
+ var modelMatrix = modelMatrices [m];
881
+
882
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
883
+
884
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
885
+ {
886
+ try
887
+ {
888
+ var
889
+ target = targets [t],
890
+ geometryNode = target .geometryNode,
891
+ vertices = this .pickingGeometryNode .getVertices ();
892
+
893
+ targetBBox .assign (geometryNode .getBBox ()) .multRight (target .modelMatrix);
894
+ matrix .assign (target .modelMatrix) .inverse () .multLeft (modelMatrix);
895
+
896
+ for (var v = 0, vLength = vertices .length; v < vLength; v += 8)
897
+ {
898
+ matrix .multVecMatrix (point1 .set (vertices [v + 0], vertices [v + 1], vertices [v + 2]));
899
+ matrix .multVecMatrix (point2 .set (vertices [v + 4], vertices [v + 5], vertices [v + 6]));
900
+ line .setPoints (point1, point2);
901
+
902
+ intersections .length = 0;
903
+
904
+ if (geometryNode .intersectsLine (line, clipPlanes, target .modelMatrix, intersections))
905
+ {
906
+ for (var i = 0, iLength = intersections .length; i < iLength; ++ i)
907
+ {
908
+ // Test if intersection.point is between point1 and point2.
909
+
910
+ var intersection = intersections [i];
911
+
912
+ a .assign (intersection .point) .subtract (point1);
913
+ b .assign (intersection .point) .subtract (point2);
914
+
915
+ var
916
+ c = a .add (b) .abs (),
917
+ s = point1 .distance (point2);
918
+
919
+ if (c <= s)
920
+ target .intersections .push (intersection);
921
+ }
922
+ }
923
+ }
924
+
925
+ if (target .intersections .length)
926
+ {
927
+ pickingCenter .assign (pickingBBox .center);
928
+ targetCenter .assign (targetBBox .center);
929
+
930
+ target .intersected = true;
931
+ target .distance = pickingCenter .distance (targetCenter);
932
+ }
933
+ }
934
+ catch (error)
935
+ {
936
+ // Catch inverse.
937
+ console .error (error);
938
+ }
939
+ }
940
+ }
941
+
942
+ // Send events.
943
+
944
+ var
945
+ pickedGeometries = this .getPickedGeometries (),
946
+ active = Boolean (pickedGeometries .length);
947
+
948
+ pickedGeometries .remove (0, pickedGeometries .length, null);
949
+
950
+ if (active !== this ._isActive .getValue ())
951
+ this ._isActive = active;
952
+
953
+ if (! this ._pickedGeometry .equals (pickedGeometries))
954
+ this ._pickedGeometry = pickedGeometries;
955
+
956
+ var pickedTargets = this .getPickedTargets ();
957
+
958
+ pickedTextureCoordinate .length = 0;
959
+ pickedNormal .length = 0;
960
+ pickedPoint .length = 0;
1001
961
 
962
+ for (var t = 0, tLength = pickedTargets .length; t < tLength; ++ t)
963
+ {
964
+ var pickedIntersections = pickedTargets [t] .intersections;
1002
965
 
966
+ for (var i = 0, iLength = pickedIntersections .length; i < iLength; ++ i)
967
+ {
968
+ var
969
+ intersection = pickedIntersections [i],
970
+ t = intersection .texCoord;
971
+
972
+ texCoord .set (t .x, t .y, t .z);
973
+
974
+ pickedTextureCoordinate .push (texCoord);
975
+ pickedNormal .push (intersection .normal);
976
+ pickedPoint .push (intersection .point);
977
+ }
978
+ }
979
+
980
+ if (! this ._pickedTextureCoordinate .equals (pickedTextureCoordinate))
981
+ this ._pickedTextureCoordinate = pickedTextureCoordinate;
982
+
983
+ if (! this ._pickedNormal .equals (pickedNormal))
984
+ this ._pickedNormal = pickedNormal;
985
+
986
+ if (! this ._pickedPoint .equals (pickedPoint))
987
+ this ._pickedPoint = pickedPoint;
988
+
989
+ break;
990
+ }
991
+ }
992
+ }
993
+
994
+ X3DPickSensorNode .prototype .process .call (this);
995
+ };
996
+ })(),
997
+ });
998
+
999
+ return LinePickSensor;
1000
+ });
1003
1001
 
1004
1002
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1005
1003
  *******************************************************************************
@@ -1051,48 +1049,46 @@ function (Fields,
1051
1049
 
1052
1050
 
1053
1051
  define ('x_ite/Components/Picking/X3DPickableObject',[
1054
- "x_ite/Bits/X3DConstants",
1052
+ "x_ite/Base/X3DConstants",
1055
1053
  ],
1056
1054
  function (X3DConstants)
1057
1055
  {
1058
1056
  "use strict";
1059
1057
 
1060
- function X3DPickableObject (executionContext)
1061
- {
1062
- this .addType (X3DConstants .X3DPickableObject);
1063
-
1064
- this .objectType = new Set ();
1065
- }
1066
-
1067
- X3DPickableObject .prototype =
1068
- {
1069
- constructor: X3DPickableObject,
1070
- initialize: function ()
1071
- {
1072
- this .objectType_ .addInterest ("set_objectType__", this);
1073
-
1074
- this .set_objectType__ ();
1075
- },
1076
- getObjectType: function ()
1077
- {
1078
- return this .objectType;
1079
- },
1080
- set_objectType__: function ()
1081
- {
1082
- this .objectType .clear ();
1083
-
1084
- for (var i = 0, length = this .objectType_ .length; i < length; ++ i)
1085
- {
1086
- this .objectType .add (this .objectType_ [i]);
1087
- }
1088
- },
1089
- };
1090
-
1091
- return X3DPickableObject;
1058
+ function X3DPickableObject (executionContext)
1059
+ {
1060
+ this .addType (X3DConstants .X3DPickableObject);
1061
+
1062
+ this .objectType = new Set ();
1063
+ }
1064
+
1065
+ X3DPickableObject .prototype =
1066
+ {
1067
+ constructor: X3DPickableObject,
1068
+ initialize: function ()
1069
+ {
1070
+ this ._objectType .addInterest ("set_objectType__", this);
1071
+
1072
+ this .set_objectType__ ();
1073
+ },
1074
+ getObjectType: function ()
1075
+ {
1076
+ return this .objectType;
1077
+ },
1078
+ set_objectType__: function ()
1079
+ {
1080
+ this .objectType .clear ();
1081
+
1082
+ for (var i = 0, length = this ._objectType .length; i < length; ++ i)
1083
+ {
1084
+ this .objectType .add (this ._objectType [i]);
1085
+ }
1086
+ },
1087
+ };
1088
+
1089
+ return X3DPickableObject;
1092
1090
  });
1093
1091
 
1094
-
1095
-
1096
1092
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1097
1093
  *******************************************************************************
1098
1094
  *
@@ -1143,14 +1139,14 @@ function (X3DConstants)
1143
1139
 
1144
1140
 
1145
1141
  define ('x_ite/Components/Picking/PickableGroup',[
1146
- "x_ite/Fields",
1147
- "x_ite/Basic/X3DFieldDefinition",
1148
- "x_ite/Basic/FieldDefinitionArray",
1149
- "x_ite/Components/Grouping/X3DGroupingNode",
1150
- "x_ite/Components/Picking/X3DPickableObject",
1151
- "x_ite/Browser/Picking/MatchCriterion",
1152
- "x_ite/Bits/X3DConstants",
1153
- "x_ite/Bits/TraverseType",
1142
+ "x_ite/Fields",
1143
+ "x_ite/Base/X3DFieldDefinition",
1144
+ "x_ite/Base/FieldDefinitionArray",
1145
+ "x_ite/Components/Grouping/X3DGroupingNode",
1146
+ "x_ite/Components/Picking/X3DPickableObject",
1147
+ "x_ite/Browser/Picking/MatchCriterion",
1148
+ "x_ite/Base/X3DConstants",
1149
+ "x_ite/Rendering/TraverseType",
1154
1150
  ],
1155
1151
  function (Fields,
1156
1152
  X3DFieldDefinition,
@@ -1163,153 +1159,153 @@ function (Fields,
1163
1159
  {
1164
1160
  "use strict";
1165
1161
 
1166
- function PickableGroup (executionContext)
1167
- {
1168
- X3DGroupingNode .call (this, executionContext);
1169
- X3DPickableObject .call (this, executionContext);
1170
-
1171
- this .addType (X3DConstants .PickableGroup);
1172
- }
1173
-
1174
- PickableGroup .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
1175
- X3DPickableObject .prototype,
1176
- {
1177
- constructor: PickableGroup,
1178
- fieldDefinitions: new FieldDefinitionArray ([
1179
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1180
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickable", new Fields .SFBool (true)),
1181
- new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
1182
- new X3DFieldDefinition (X3DConstants .inputOutput, "visible", new Fields .SFBool (true)),
1183
- new X3DFieldDefinition (X3DConstants .inputOutput, "bboxDisplay", new Fields .SFBool ()),
1184
- new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxSize", new Fields .SFVec3f (-1, -1, -1)),
1185
- new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxCenter", new Fields .SFVec3f ()),
1186
- new X3DFieldDefinition (X3DConstants .inputOnly, "addChildren", new Fields .MFNode ()),
1187
- new X3DFieldDefinition (X3DConstants .inputOnly, "removeChildren", new Fields .MFNode ()),
1188
- new X3DFieldDefinition (X3DConstants .inputOutput, "children", new Fields .MFNode ()),
1189
- ]),
1190
- getTypeName: function ()
1191
- {
1192
- return "PickableGroup";
1193
- },
1194
- getComponentName: function ()
1195
- {
1196
- return "Picking";
1197
- },
1198
- getContainerField: function ()
1199
- {
1200
- return "children";
1201
- },
1202
- initialize: function ()
1203
- {
1204
- X3DGroupingNode .prototype .initialize .call (this);
1205
- X3DPickableObject .prototype .initialize .call (this);
1206
-
1207
- this .pickable_ .addInterest ("set_pickable__", this);
1208
-
1209
- this .set_pickable__ ();
1210
- },
1211
- set_pickableObjects__: function ()
1212
- {
1213
- this .set_pickable__ ();
1214
- },
1215
- set_pickable__: function ()
1216
- {
1217
- this .setPickableObject (Boolean (this .pickable_ .getValue () || this .getTransformSensors () .size));
1218
- },
1219
- traverse: (function ()
1220
- {
1221
- const pickSensorNodes = new Set ();
1222
-
1223
- return function (type, renderObject)
1224
- {
1225
- if (type === TraverseType .PICKING)
1226
- {
1227
- if (this .pickable_ .getValue ())
1228
- {
1229
- if (this .getObjectType () .has ("NONE"))
1230
- return;
1231
-
1232
- const
1233
- browser = renderObject .getBrowser (),
1234
- pickableStack = browser .getPickable ();
1235
-
1236
- if (this .getObjectType () .has ("ALL"))
1237
- {
1238
- pickableStack .push (true);
1239
- X3DGroupingNode .prototype .traverse .call (this, type, renderObject);
1240
- pickableStack .pop ();
1241
- }
1242
- else
1243
- {
1244
- // Filter pick sensors.
1245
-
1246
- const pickSensorStack = browser .getPickSensors ();
1247
-
1248
- for (const pickSensorNode of pickSensorStack .at (-1))
1249
- {
1250
- if (! pickSensorNode .getObjectType () .has ("ALL"))
1251
- {
1252
- let intersection = 0;
1253
-
1254
- for (const objectType of this .getObjectType ())
1255
- {
1256
- if (pickSensorNode .getObjectType () .has (objectType))
1257
- {
1258
- ++ intersection;
1259
- break;
1260
- }
1261
- }
1262
-
1263
- switch (pickSensorNode .getMatchCriterion ())
1264
- {
1265
- case MatchCriterion .MATCH_ANY:
1266
- {
1267
- if (intersection === 0)
1268
- continue;
1269
-
1270
- break;
1271
- }
1272
- case MatchCriterion .MATCH_EVERY:
1273
- {
1274
- if (intersection !== pickSensor .getObjectType () .size)
1275
- continue;
1276
-
1277
- break;
1278
- }
1279
- case MatchCriterion .MATCH_ONLY_ONE:
1280
- {
1281
- if (intersection !== 1)
1282
- continue;
1283
-
1284
- break;
1285
- }
1286
- }
1287
- }
1288
-
1289
- pickSensorNodes .add (pickSensorNode);
1290
- }
1291
-
1292
- pickableStack .push (true);
1293
- pickSensorStack .push (pickSensorNodes);
1294
-
1295
- X3DGroupingNode .prototype .traverse .call (this, type, renderObject);
1296
-
1297
- pickSensorStack .pop ();
1298
- pickableStack .pop ();
1299
-
1300
- pickSensorNodes .clear ();
1301
- }
1302
- }
1303
- }
1304
- else
1305
- {
1306
- X3DGroupingNode .prototype .traverse .call (this, type, renderObject);
1307
- }
1308
- };
1309
- })(),
1310
- });
1311
-
1312
- return PickableGroup;
1162
+ function PickableGroup (executionContext)
1163
+ {
1164
+ X3DGroupingNode .call (this, executionContext);
1165
+ X3DPickableObject .call (this, executionContext);
1166
+
1167
+ this .addType (X3DConstants .PickableGroup);
1168
+ }
1169
+
1170
+ PickableGroup .prototype = Object .assign (Object .create (X3DGroupingNode .prototype),
1171
+ X3DPickableObject .prototype,
1172
+ {
1173
+ constructor: PickableGroup,
1174
+ [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
1175
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1176
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickable", new Fields .SFBool (true)),
1177
+ new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
1178
+ new X3DFieldDefinition (X3DConstants .inputOutput, "visible", new Fields .SFBool (true)),
1179
+ new X3DFieldDefinition (X3DConstants .inputOutput, "bboxDisplay", new Fields .SFBool ()),
1180
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxSize", new Fields .SFVec3f (-1, -1, -1)),
1181
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxCenter", new Fields .SFVec3f ()),
1182
+ new X3DFieldDefinition (X3DConstants .inputOnly, "addChildren", new Fields .MFNode ()),
1183
+ new X3DFieldDefinition (X3DConstants .inputOnly, "removeChildren", new Fields .MFNode ()),
1184
+ new X3DFieldDefinition (X3DConstants .inputOutput, "children", new Fields .MFNode ()),
1185
+ ]),
1186
+ getTypeName: function ()
1187
+ {
1188
+ return "PickableGroup";
1189
+ },
1190
+ getComponentName: function ()
1191
+ {
1192
+ return "Picking";
1193
+ },
1194
+ getContainerField: function ()
1195
+ {
1196
+ return "children";
1197
+ },
1198
+ initialize: function ()
1199
+ {
1200
+ X3DGroupingNode .prototype .initialize .call (this);
1201
+ X3DPickableObject .prototype .initialize .call (this);
1202
+
1203
+ this ._pickable .addInterest ("set_pickable__", this);
1204
+
1205
+ this .set_pickable__ ();
1206
+ },
1207
+ set_pickableObjects__: function ()
1208
+ {
1209
+ this .set_pickable__ ();
1210
+ },
1211
+ set_pickable__: function ()
1212
+ {
1213
+ this .setPickableObject (Boolean (this ._pickable .getValue () || this .getTransformSensors () .size));
1214
+ },
1215
+ traverse: (function ()
1216
+ {
1217
+ const pickSensorNodes = new Set ();
1218
+
1219
+ return function (type, renderObject)
1220
+ {
1221
+ if (type === TraverseType .PICKING)
1222
+ {
1223
+ if (this ._pickable .getValue ())
1224
+ {
1225
+ if (this .getObjectType () .has ("NONE"))
1226
+ return;
1227
+
1228
+ const
1229
+ browser = renderObject .getBrowser (),
1230
+ pickableStack = browser .getPickable ();
1231
+
1232
+ if (this .getObjectType () .has ("ALL"))
1233
+ {
1234
+ pickableStack .push (true);
1235
+ X3DGroupingNode .prototype .traverse .call (this, type, renderObject);
1236
+ pickableStack .pop ();
1237
+ }
1238
+ else
1239
+ {
1240
+ // Filter pick sensors.
1241
+
1242
+ const pickSensorStack = browser .getPickSensors ();
1243
+
1244
+ for (const pickSensorNode of pickSensorStack .at (-1))
1245
+ {
1246
+ if (! pickSensorNode .getObjectType () .has ("ALL"))
1247
+ {
1248
+ let intersection = 0;
1249
+
1250
+ for (const objectType of this .getObjectType ())
1251
+ {
1252
+ if (pickSensorNode .getObjectType () .has (objectType))
1253
+ {
1254
+ ++ intersection;
1255
+ break;
1256
+ }
1257
+ }
1258
+
1259
+ switch (pickSensorNode .getMatchCriterion ())
1260
+ {
1261
+ case MatchCriterion .MATCH_ANY:
1262
+ {
1263
+ if (intersection === 0)
1264
+ continue;
1265
+
1266
+ break;
1267
+ }
1268
+ case MatchCriterion .MATCH_EVERY:
1269
+ {
1270
+ if (intersection !== pickSensor .getObjectType () .size)
1271
+ continue;
1272
+
1273
+ break;
1274
+ }
1275
+ case MatchCriterion .MATCH_ONLY_ONE:
1276
+ {
1277
+ if (intersection !== 1)
1278
+ continue;
1279
+
1280
+ break;
1281
+ }
1282
+ }
1283
+ }
1284
+
1285
+ pickSensorNodes .add (pickSensorNode);
1286
+ }
1287
+
1288
+ pickableStack .push (true);
1289
+ pickSensorStack .push (pickSensorNodes);
1290
+
1291
+ X3DGroupingNode .prototype .traverse .call (this, type, renderObject);
1292
+
1293
+ pickSensorStack .pop ();
1294
+ pickableStack .pop ();
1295
+
1296
+ pickSensorNodes .clear ();
1297
+ }
1298
+ }
1299
+ }
1300
+ else
1301
+ {
1302
+ X3DGroupingNode .prototype .traverse .call (this, type, renderObject);
1303
+ }
1304
+ };
1305
+ })(),
1306
+ });
1307
+
1308
+ return PickableGroup;
1313
1309
  });
1314
1310
 
1315
1311
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -1362,10 +1358,10 @@ function (Fields,
1362
1358
 
1363
1359
 
1364
1360
  define ('x_ite/Browser/Picking/VolumePicker',[
1365
- "standard/Math/Numbers/Vector3",
1366
- "standard/Math/Numbers/Rotation4",
1367
- "standard/Math/Numbers/Matrix4",
1368
- require .getComponentUrl ("rigid-body-physics"),
1361
+ "standard/Math/Numbers/Vector3",
1362
+ "standard/Math/Numbers/Rotation4",
1363
+ "standard/Math/Numbers/Matrix4",
1364
+ require .getComponentUrl ("rigid-body-physics"),
1369
1365
  ],
1370
1366
  function (Vector3,
1371
1367
  Rotation4,
@@ -1374,140 +1370,140 @@ function (Vector3,
1374
1370
  {
1375
1371
  "use strict";
1376
1372
 
1377
- var Ammo = RigidBodyPhysics .Ammo;
1378
-
1379
- function VolumePicker ()
1380
- {
1381
- this .broadphase = new Ammo .btDbvtBroadphase ();
1382
- this .collisionConfiguration = new Ammo .btDefaultCollisionConfiguration ();
1383
- this .dispatcher = new Ammo .btCollisionDispatcher (this .collisionConfiguration);
1384
- this .collisionWorld = new Ammo .btCollisionWorld (this .dispatcher, this .broadphase, this .collisionConfiguration);
1385
-
1386
- this .compoundShape1 = new Ammo .btCompoundShape ();
1387
- this .motionState1 = new Ammo .btDefaultMotionState ();
1388
- this .constructionInfo1 = new Ammo .btRigidBodyConstructionInfo (0, this .motionState1, this .compoundShape1);
1389
- this .rigidBody1 = new Ammo .btRigidBody (this .constructionInfo1);
1390
-
1391
- this .compoundShape2 = new Ammo .btCompoundShape ();
1392
- this .motionState2 = new Ammo .btDefaultMotionState ();
1393
- this .constructionInfo2 = new Ammo .btRigidBodyConstructionInfo (0, this .motionState2, this .compoundShape2);
1394
- this .rigidBody2 = new Ammo .btRigidBody (this .constructionInfo2);
1395
-
1396
- this .collisionWorld .addCollisionObject (this .rigidBody1);
1397
- this .collisionWorld .addCollisionObject (this .rigidBody2);
1398
- }
1399
-
1400
- VolumePicker .prototype =
1401
- {
1402
- constuctor: VolumePicker,
1403
- setChildShape1: function (matrix, childShape)
1404
- {
1405
- this .setChildShape (this .compoundShape1, matrix, childShape);
1406
- },
1407
- setChildShape2: function (matrix, childShape)
1408
- {
1409
- this .setChildShape (this .compoundShape2, matrix, childShape);
1410
- },
1411
- setChildShape1Components: function (transform, localScaling, childShape)
1412
- {
1413
- this .setChildShapeComponents (this .compoundShape1, transform, localScaling, childShape);
1414
- },
1415
- setChildShape2Components: function (transform, localScaling, childShape)
1416
- {
1417
- this .setChildShapeComponents (this .compoundShape2, transform, localScaling, childShape);
1418
- },
1419
- setChildShape: (function ()
1420
- {
1421
- var
1422
- translation = new Vector3 (0, 0, 0),
1423
- rotation = new Rotation4 (0, 0, 1, 0),
1424
- scale = new Vector3 (1, 1, 1),
1425
- s = new Ammo .btVector3 (0, 0, 0);
1426
-
1427
- return function (compoundShape, matrix, childShape)
1428
- {
1429
- try
1430
- {
1431
- if (compoundShape .getNumChildShapes ())
1432
- compoundShape .removeChildShapeByIndex (0);
1433
-
1434
- if (childShape .getNumChildShapes ())
1435
- {
1436
- matrix .get (translation, rotation, scale);
1437
-
1438
- s .setValue (scale .x, scale .y, scale .z);
1439
-
1440
- childShape .setLocalScaling (s);
1441
- compoundShape .addChildShape (this .getTransform (translation, rotation), childShape);
1442
- }
1443
- }
1444
- catch (error)
1445
- {
1446
- // matrix .get
1447
- }
1448
- };
1449
- })(),
1450
- setChildShapeComponents: function (compoundShape, transform, localScaling, childShape)
1451
- {
1452
- if (compoundShape .getNumChildShapes ())
1453
- compoundShape .removeChildShapeByIndex (0);
1454
-
1455
- if (childShape .getNumChildShapes ())
1456
- {
1457
- childShape .setLocalScaling (localScaling);
1458
- compoundShape .addChildShape (transform, childShape);
1459
- }
1460
- },
1461
- contactTest: function ()
1462
- {
1463
- this .collisionWorld .performDiscreteCollisionDetection ();
1464
-
1465
- var numManifolds = this .dispatcher .getNumManifolds ();
1466
-
1467
- for (var i = 0; i < numManifolds; ++ i)
1468
- {
1469
- var
1470
- contactManifold = this .dispatcher .getManifoldByIndexInternal (i),
1471
- numContacts = contactManifold .getNumContacts ();
1472
-
1473
- for (var j = 0; j < numContacts; ++ j)
1474
- {
1475
- var pt = contactManifold .getContactPoint (j);
1476
-
1477
- if (pt .getDistance () <= 0)
1478
- return true;
1479
- }
1480
- }
1481
-
1482
- return false;
1483
- },
1484
- getTransform: (function ()
1485
- {
1486
- var
1487
- T = new Ammo .btTransform (),
1488
- o = new Ammo .btVector3 (0, 0, 0),
1489
- m = new Matrix4 ();
1490
-
1491
- return function (translation, rotation, transform)
1492
- {
1493
- var t = transform || T;
1494
-
1495
- m .set (translation, rotation);
1496
-
1497
- o .setValue (m [12], m [13], m [14]);
1498
-
1499
- t .getBasis () .setValue (m [0], m [4], m [8],
1500
- m [1], m [5], m [9],
1501
- m [2], m [6], m [10]);
1502
-
1503
- t .setOrigin (o);
1504
-
1505
- return t;
1506
- };
1507
- })(),
1508
- };
1509
-
1510
- return VolumePicker;
1373
+ const Ammo = RigidBodyPhysics .Ammo;
1374
+
1375
+ function VolumePicker ()
1376
+ {
1377
+ this .broadphase = new Ammo .btDbvtBroadphase ();
1378
+ this .collisionConfiguration = new Ammo .btDefaultCollisionConfiguration ();
1379
+ this .dispatcher = new Ammo .btCollisionDispatcher (this .collisionConfiguration);
1380
+ this .collisionWorld = new Ammo .btCollisionWorld (this .dispatcher, this .broadphase, this .collisionConfiguration);
1381
+
1382
+ this .compoundShape1 = new Ammo .btCompoundShape ();
1383
+ this .motionState1 = new Ammo .btDefaultMotionState ();
1384
+ this .constructionInfo1 = new Ammo .btRigidBodyConstructionInfo (0, this .motionState1, this .compoundShape1);
1385
+ this .rigidBody1 = new Ammo .btRigidBody (this .constructionInfo1);
1386
+
1387
+ this .compoundShape2 = new Ammo .btCompoundShape ();
1388
+ this .motionState2 = new Ammo .btDefaultMotionState ();
1389
+ this .constructionInfo2 = new Ammo .btRigidBodyConstructionInfo (0, this .motionState2, this .compoundShape2);
1390
+ this .rigidBody2 = new Ammo .btRigidBody (this .constructionInfo2);
1391
+
1392
+ this .collisionWorld .addCollisionObject (this .rigidBody1);
1393
+ this .collisionWorld .addCollisionObject (this .rigidBody2);
1394
+ }
1395
+
1396
+ VolumePicker .prototype =
1397
+ {
1398
+ constuctor: VolumePicker,
1399
+ setChildShape1: function (matrix, childShape)
1400
+ {
1401
+ this .setChildShape (this .compoundShape1, matrix, childShape);
1402
+ },
1403
+ setChildShape2: function (matrix, childShape)
1404
+ {
1405
+ this .setChildShape (this .compoundShape2, matrix, childShape);
1406
+ },
1407
+ setChildShape1Components: function (transform, localScaling, childShape)
1408
+ {
1409
+ this .setChildShapeComponents (this .compoundShape1, transform, localScaling, childShape);
1410
+ },
1411
+ setChildShape2Components: function (transform, localScaling, childShape)
1412
+ {
1413
+ this .setChildShapeComponents (this .compoundShape2, transform, localScaling, childShape);
1414
+ },
1415
+ setChildShape: (function ()
1416
+ {
1417
+ const
1418
+ translation = new Vector3 (0, 0, 0),
1419
+ rotation = new Rotation4 (0, 0, 1, 0),
1420
+ scale = new Vector3 (1, 1, 1),
1421
+ s = new Ammo .btVector3 (0, 0, 0);
1422
+
1423
+ return function (compoundShape, matrix, childShape)
1424
+ {
1425
+ try
1426
+ {
1427
+ if (compoundShape .getNumChildShapes ())
1428
+ compoundShape .removeChildShapeByIndex (0);
1429
+
1430
+ if (childShape .getNumChildShapes ())
1431
+ {
1432
+ matrix .get (translation, rotation, scale);
1433
+
1434
+ s .setValue (scale .x, scale .y, scale .z);
1435
+
1436
+ childShape .setLocalScaling (s);
1437
+ compoundShape .addChildShape (this .getTransform (translation, rotation), childShape);
1438
+ }
1439
+ }
1440
+ catch (error)
1441
+ {
1442
+ // matrix .get
1443
+ }
1444
+ };
1445
+ })(),
1446
+ setChildShapeComponents: function (compoundShape, transform, localScaling, childShape)
1447
+ {
1448
+ if (compoundShape .getNumChildShapes ())
1449
+ compoundShape .removeChildShapeByIndex (0);
1450
+
1451
+ if (childShape .getNumChildShapes ())
1452
+ {
1453
+ childShape .setLocalScaling (localScaling);
1454
+ compoundShape .addChildShape (transform, childShape);
1455
+ }
1456
+ },
1457
+ contactTest: function ()
1458
+ {
1459
+ this .collisionWorld .performDiscreteCollisionDetection ();
1460
+
1461
+ const numManifolds = this .dispatcher .getNumManifolds ();
1462
+
1463
+ for (let i = 0; i < numManifolds; ++ i)
1464
+ {
1465
+ const
1466
+ contactManifold = this .dispatcher .getManifoldByIndexInternal (i),
1467
+ numContacts = contactManifold .getNumContacts ();
1468
+
1469
+ for (let j = 0; j < numContacts; ++ j)
1470
+ {
1471
+ const pt = contactManifold .getContactPoint (j);
1472
+
1473
+ if (pt .getDistance () <= 0)
1474
+ return true;
1475
+ }
1476
+ }
1477
+
1478
+ return false;
1479
+ },
1480
+ getTransform: (function ()
1481
+ {
1482
+ const
1483
+ T = new Ammo .btTransform (),
1484
+ o = new Ammo .btVector3 (0, 0, 0),
1485
+ m = new Matrix4 ();
1486
+
1487
+ return function (translation, rotation, transform)
1488
+ {
1489
+ const t = transform || T;
1490
+
1491
+ m .set (translation, rotation);
1492
+
1493
+ o .setValue (m [12], m [13], m [14]);
1494
+
1495
+ t .getBasis () .setValue (m [0], m [4], m [8],
1496
+ m [1], m [5], m [9],
1497
+ m [2], m [6], m [10]);
1498
+
1499
+ t .setOrigin (o);
1500
+
1501
+ return t;
1502
+ };
1503
+ })(),
1504
+ };
1505
+
1506
+ return VolumePicker;
1511
1507
  });
1512
1508
 
1513
1509
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -1560,18 +1556,18 @@ function (Vector3,
1560
1556
 
1561
1557
 
1562
1558
  define ('x_ite/Components/Picking/PointPickSensor',[
1563
- "x_ite/Fields",
1564
- "x_ite/Basic/X3DFieldDefinition",
1565
- "x_ite/Basic/FieldDefinitionArray",
1566
- "x_ite/Components/Picking/X3DPickSensorNode",
1567
- "x_ite/Bits/X3DCast",
1568
- "x_ite/Bits/X3DConstants",
1569
- "x_ite/Browser/Picking/IntersectionType",
1570
- "x_ite/Browser/Picking/VolumePicker",
1571
- "standard/Math/Numbers/Vector3",
1572
- "standard/Math/Numbers/Rotation4",
1573
- "standard/Math/Geometry/Box3",
1574
- require .getComponentUrl ("rigid-body-physics"),
1559
+ "x_ite/Fields",
1560
+ "x_ite/Base/X3DFieldDefinition",
1561
+ "x_ite/Base/FieldDefinitionArray",
1562
+ "x_ite/Components/Picking/X3DPickSensorNode",
1563
+ "x_ite/Base/X3DCast",
1564
+ "x_ite/Base/X3DConstants",
1565
+ "x_ite/Browser/Picking/IntersectionType",
1566
+ "x_ite/Browser/Picking/VolumePicker",
1567
+ "standard/Math/Numbers/Vector3",
1568
+ "standard/Math/Numbers/Rotation4",
1569
+ "standard/Math/Geometry/Box3",
1570
+ require .getComponentUrl ("rigid-body-physics"),
1575
1571
  ],
1576
1572
  function (Fields,
1577
1573
  X3DFieldDefinition,
@@ -1588,283 +1584,283 @@ function (Fields,
1588
1584
  {
1589
1585
  "use strict";
1590
1586
 
1591
- var Ammo = RigidBodyPhysics .Ammo;
1592
-
1593
- function PointPickSensor (executionContext)
1594
- {
1595
- X3DPickSensorNode .call (this, executionContext);
1596
-
1597
- this .addType (X3DConstants .PointPickSensor);
1598
-
1599
- this .pickingGeometryNode = null;
1600
- this .picker = new VolumePicker ();
1601
- this .compoundShapes = [ ];
1602
- }
1603
-
1604
- PointPickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
1605
- {
1606
- constructor: PointPickSensor,
1607
- fieldDefinitions: new FieldDefinitionArray ([
1608
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1609
- new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1610
- new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
1611
- new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
1612
- new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
1613
- new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
1614
- new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
1615
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedPoint", new Fields .MFVec3f ()),
1616
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
1617
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
1618
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
1619
- ]),
1620
- getTypeName: function ()
1621
- {
1622
- return "PointPickSensor";
1623
- },
1624
- getComponentName: function ()
1625
- {
1626
- return "Picking";
1627
- },
1628
- getContainerField: function ()
1629
- {
1630
- return "children";
1631
- },
1632
- initialize: function ()
1633
- {
1634
- X3DPickSensorNode .prototype .initialize .call (this);
1635
-
1636
- this .pickingGeometry_ .addInterest ("set_pickingGeometry__", this);
1637
-
1638
- this .set_pickingGeometry__ ();
1639
- },
1640
- set_pickingGeometry__: function ()
1641
- {
1642
- if (this .pickingGeometryNode)
1643
- this .pickingGeometryNode .rebuild_ .removeInterest ("set_geometry__", this);
1644
-
1645
- this .pickingGeometryNode = X3DCast (X3DConstants .PointSet, this .pickingGeometry_);
1646
-
1647
- if (this .pickingGeometryNode)
1648
- this .pickingGeometryNode .rebuild_ .addInterest ("set_geometry__", this);
1649
-
1650
- this .set_geometry__ ();
1651
- },
1652
- set_geometry__: (function ()
1653
- {
1654
- var
1655
- defaultScale = new Ammo .btVector3 (1, 1, 1),
1656
- o = new Ammo .btVector3 (),
1657
- t = new Ammo .btTransform ();
1658
-
1659
- return function ()
1660
- {
1661
- var compoundShapes = this .compoundShapes;
1662
-
1663
- if (this .pickingGeometryNode)
1664
- {
1665
- var coord = this .pickingGeometryNode .getCoord ();
1666
-
1667
- if (coord)
1668
- {
1669
- for (var i = 0, length = coord .getSize (); i < length; ++ i)
1670
- {
1671
- if (i < compoundShapes .length)
1672
- {
1673
- var
1674
- compoundShape = compoundShapes [i],
1675
- point = coord .get1Point (i, compoundShape .point);
1676
-
1677
- o .setValue (point .x, point .y, point .z);
1678
- t .setOrigin (o);
1679
-
1680
- compoundShape .setLocalScaling (defaultScale);
1681
- compoundShape .updateChildTransform (0, t);
1682
- }
1683
- else
1684
- {
1685
- var
1686
- compoundShape = new Ammo .btCompoundShape (),
1687
- sphereShape = new Ammo .btSphereShape (0),
1688
- point = coord .get1Point (i, new Vector3 (0, 0, 0));
1689
-
1690
- compoundShape .point = point;
1691
-
1692
- o .setValue (point .x, point .y, point .z);
1693
- t .setOrigin (o);
1694
-
1695
- compoundShape .addChildShape (t, sphereShape);
1696
- compoundShapes .push (compoundShape);
1697
- }
1698
- }
1699
-
1700
- compoundShapes .length = length;
1701
- }
1702
- else
1703
- {
1704
- compoundShapes .length = 0;
1705
- }
1706
- }
1707
- else
1708
- {
1709
- compoundShapes .length = 0;
1710
- }
1711
- };
1712
- })(),
1713
- process: (function ()
1714
- {
1715
- var
1716
- pickingBBox = new Box3 (),
1717
- targetBBox = new Box3 (),
1718
- pickingCenter = new Vector3 (0, 0, 0),
1719
- targetCenter = new Vector3 (0, 0, 0),
1720
- transform = new Ammo .btTransform (),
1721
- localScaling = new Ammo .btVector3 (),
1722
- translation = new Vector3 (0, 0, 0),
1723
- rotation = new Rotation4 (0, 0, 1, 0),
1724
- scale = new Vector3 (1, 1, 1),
1725
- pickedPoint = new Fields .MFVec3f ();
1726
-
1727
- return function ()
1728
- {
1729
- if (this .pickingGeometryNode)
1730
- {
1731
- var
1732
- modelMatrices = this .getModelMatrices (),
1733
- targets = this .getTargets ();
1734
-
1735
- switch (this .getIntersectionType ())
1736
- {
1737
- case IntersectionType .BOUNDS:
1738
- {
1739
- // Intersect bboxes.
1740
-
1741
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
1742
- {
1743
- var modelMatrix = modelMatrices [m];
1744
-
1745
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
1746
-
1747
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
1748
- {
1749
- var target = targets [t];
1750
-
1751
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
1752
-
1753
- if (pickingBBox .intersectsBox (targetBBox))
1754
- {
1755
- pickingCenter .assign (pickingBBox .center);
1756
- targetCenter .assign (targetBBox .center);
1757
-
1758
- target .intersected = true;
1759
- target .distance = pickingCenter .distance (targetCenter);
1760
- }
1761
- }
1762
- }
1763
-
1764
- // Send events.
1765
-
1766
- var
1767
- pickedGeometries = this .getPickedGeometries (),
1768
- active = Boolean (pickedGeometries .length);
1769
-
1770
- pickedGeometries .remove (0, pickedGeometries .length, null);
1771
-
1772
- if (active !== this .isActive_ .getValue ())
1773
- this .isActive_ = active;
1774
-
1775
- if (! this .pickedGeometry_ .equals (pickedGeometries))
1776
- this .pickedGeometry_ = pickedGeometries;
1777
-
1778
- break;
1779
- }
1780
- case IntersectionType .GEOMETRY:
1781
- {
1782
- // Intersect geometry.
1783
-
1784
- var
1785
- picker = this .picker,
1786
- compoundShapes = this .compoundShapes;
1787
-
1788
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
1789
- {
1790
- var modelMatrix = modelMatrices [m];
1791
-
1792
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
1793
-
1794
- modelMatrix .get (translation, rotation, scale);
1795
-
1796
- picker .getTransform (translation, rotation, transform);
1797
- localScaling .setValue (scale .x, scale .y, scale .z);
1798
-
1799
- for (var c = 0, cLength = compoundShapes .length; c < cLength; ++ c)
1800
- {
1801
- var compoundShape = compoundShapes [c];
1802
-
1803
- picker .setChildShape1Components (transform, localScaling, compoundShape);
1804
-
1805
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
1806
- {
1807
- var
1808
- target = targets [t],
1809
- targetShape = this .getPickShape (target .geometryNode);
1587
+ var Ammo = RigidBodyPhysics .Ammo;
1588
+
1589
+ function PointPickSensor (executionContext)
1590
+ {
1591
+ X3DPickSensorNode .call (this, executionContext);
1592
+
1593
+ this .addType (X3DConstants .PointPickSensor);
1594
+
1595
+ this .pickingGeometryNode = null;
1596
+ this .picker = new VolumePicker ();
1597
+ this .compoundShapes = [ ];
1598
+ }
1599
+
1600
+ PointPickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
1601
+ {
1602
+ constructor: PointPickSensor,
1603
+ [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
1604
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1605
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1606
+ new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
1607
+ new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
1608
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
1609
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
1610
+ new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
1611
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedPoint", new Fields .MFVec3f ()),
1612
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
1613
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
1614
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
1615
+ ]),
1616
+ getTypeName: function ()
1617
+ {
1618
+ return "PointPickSensor";
1619
+ },
1620
+ getComponentName: function ()
1621
+ {
1622
+ return "Picking";
1623
+ },
1624
+ getContainerField: function ()
1625
+ {
1626
+ return "children";
1627
+ },
1628
+ initialize: function ()
1629
+ {
1630
+ X3DPickSensorNode .prototype .initialize .call (this);
1631
+
1632
+ this ._pickingGeometry .addInterest ("set_pickingGeometry__", this);
1633
+
1634
+ this .set_pickingGeometry__ ();
1635
+ },
1636
+ set_pickingGeometry__: function ()
1637
+ {
1638
+ if (this .pickingGeometryNode)
1639
+ this .pickingGeometryNode ._rebuild .removeInterest ("set_geometry__", this);
1640
+
1641
+ this .pickingGeometryNode = X3DCast (X3DConstants .PointSet, this ._pickingGeometry);
1642
+
1643
+ if (this .pickingGeometryNode)
1644
+ this .pickingGeometryNode ._rebuild .addInterest ("set_geometry__", this);
1645
+
1646
+ this .set_geometry__ ();
1647
+ },
1648
+ set_geometry__: (function ()
1649
+ {
1650
+ var
1651
+ defaultScale = new Ammo .btVector3 (1, 1, 1),
1652
+ o = new Ammo .btVector3 (),
1653
+ t = new Ammo .btTransform ();
1654
+
1655
+ return function ()
1656
+ {
1657
+ var compoundShapes = this .compoundShapes;
1658
+
1659
+ if (this .pickingGeometryNode)
1660
+ {
1661
+ var coord = this .pickingGeometryNode .getCoord ();
1662
+
1663
+ if (coord)
1664
+ {
1665
+ for (var i = 0, length = coord .getSize (); i < length; ++ i)
1666
+ {
1667
+ if (i < compoundShapes .length)
1668
+ {
1669
+ var
1670
+ compoundShape = compoundShapes [i],
1671
+ point = coord .get1Point (i, compoundShape .point);
1672
+
1673
+ o .setValue (point .x, point .y, point .z);
1674
+ t .setOrigin (o);
1675
+
1676
+ compoundShape .setLocalScaling (defaultScale);
1677
+ compoundShape .updateChildTransform (0, t);
1678
+ }
1679
+ else
1680
+ {
1681
+ var
1682
+ compoundShape = new Ammo .btCompoundShape (),
1683
+ sphereShape = new Ammo .btSphereShape (0),
1684
+ point = coord .get1Point (i, new Vector3 (0, 0, 0));
1685
+
1686
+ compoundShape .point = point;
1687
+
1688
+ o .setValue (point .x, point .y, point .z);
1689
+ t .setOrigin (o);
1690
+
1691
+ compoundShape .addChildShape (t, sphereShape);
1692
+ compoundShapes .push (compoundShape);
1693
+ }
1694
+ }
1695
+
1696
+ compoundShapes .length = length;
1697
+ }
1698
+ else
1699
+ {
1700
+ compoundShapes .length = 0;
1701
+ }
1702
+ }
1703
+ else
1704
+ {
1705
+ compoundShapes .length = 0;
1706
+ }
1707
+ };
1708
+ })(),
1709
+ process: (function ()
1710
+ {
1711
+ var
1712
+ pickingBBox = new Box3 (),
1713
+ targetBBox = new Box3 (),
1714
+ pickingCenter = new Vector3 (0, 0, 0),
1715
+ targetCenter = new Vector3 (0, 0, 0),
1716
+ transform = new Ammo .btTransform (),
1717
+ localScaling = new Ammo .btVector3 (),
1718
+ translation = new Vector3 (0, 0, 0),
1719
+ rotation = new Rotation4 (0, 0, 1, 0),
1720
+ scale = new Vector3 (1, 1, 1),
1721
+ pickedPoint = new Fields .MFVec3f ();
1722
+
1723
+ return function ()
1724
+ {
1725
+ if (this .pickingGeometryNode)
1726
+ {
1727
+ var
1728
+ modelMatrices = this .getModelMatrices (),
1729
+ targets = this .getTargets ();
1730
+
1731
+ switch (this .getIntersectionType ())
1732
+ {
1733
+ case IntersectionType .BOUNDS:
1734
+ {
1735
+ // Intersect bboxes.
1736
+
1737
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
1738
+ {
1739
+ var modelMatrix = modelMatrices [m];
1740
+
1741
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
1742
+
1743
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
1744
+ {
1745
+ var target = targets [t];
1746
+
1747
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
1748
+
1749
+ if (pickingBBox .intersectsBox (targetBBox))
1750
+ {
1751
+ pickingCenter .assign (pickingBBox .center);
1752
+ targetCenter .assign (targetBBox .center);
1753
+
1754
+ target .intersected = true;
1755
+ target .distance = pickingCenter .distance (targetCenter);
1756
+ }
1757
+ }
1758
+ }
1759
+
1760
+ // Send events.
1761
+
1762
+ var
1763
+ pickedGeometries = this .getPickedGeometries (),
1764
+ active = Boolean (pickedGeometries .length);
1765
+
1766
+ pickedGeometries .remove (0, pickedGeometries .length, null);
1767
+
1768
+ if (active !== this ._isActive .getValue ())
1769
+ this ._isActive = active;
1770
+
1771
+ if (! this ._pickedGeometry .equals (pickedGeometries))
1772
+ this ._pickedGeometry = pickedGeometries;
1773
+
1774
+ break;
1775
+ }
1776
+ case IntersectionType .GEOMETRY:
1777
+ {
1778
+ // Intersect geometry.
1779
+
1780
+ var
1781
+ picker = this .picker,
1782
+ compoundShapes = this .compoundShapes;
1783
+
1784
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
1785
+ {
1786
+ var modelMatrix = modelMatrices [m];
1787
+
1788
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
1789
+
1790
+ modelMatrix .get (translation, rotation, scale);
1791
+
1792
+ picker .getTransform (translation, rotation, transform);
1793
+ localScaling .setValue (scale .x, scale .y, scale .z);
1794
+
1795
+ for (var c = 0, cLength = compoundShapes .length; c < cLength; ++ c)
1796
+ {
1797
+ var compoundShape = compoundShapes [c];
1798
+
1799
+ picker .setChildShape1Components (transform, localScaling, compoundShape);
1800
+
1801
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
1802
+ {
1803
+ var
1804
+ target = targets [t],
1805
+ targetShape = this .getPickShape (target .geometryNode);
1810
1806
 
1811
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
1807
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
1812
1808
 
1813
- picker .setChildShape2 (target .modelMatrix, targetShape .getCompoundShape ());
1809
+ picker .setChildShape2 (target .modelMatrix, targetShape .getCompoundShape ());
1814
1810
 
1815
- if (picker .contactTest ())
1816
- {
1817
- pickingCenter .assign (pickingBBox .center);
1818
- targetCenter .assign (targetBBox .center);
1811
+ if (picker .contactTest ())
1812
+ {
1813
+ pickingCenter .assign (pickingBBox .center);
1814
+ targetCenter .assign (targetBBox .center);
1819
1815
 
1820
- target .intersected = true;
1821
- target .distance = pickingCenter .distance (targetCenter);
1822
- target .pickedPoint .push (compoundShape .point);
1823
- }
1824
- }
1825
- }
1826
- }
1816
+ target .intersected = true;
1817
+ target .distance = pickingCenter .distance (targetCenter);
1818
+ target .pickedPoint .push (compoundShape .point);
1819
+ }
1820
+ }
1821
+ }
1822
+ }
1827
1823
 
1828
- // Send events.
1824
+ // Send events.
1829
1825
 
1830
- var
1831
- pickedGeometries = this .getPickedGeometries (),
1832
- active = Boolean (pickedGeometries .length);
1826
+ var
1827
+ pickedGeometries = this .getPickedGeometries (),
1828
+ active = Boolean (pickedGeometries .length);
1833
1829
 
1834
- pickedGeometries .remove (0, pickedGeometries .length, null);
1830
+ pickedGeometries .remove (0, pickedGeometries .length, null);
1835
1831
 
1836
- if (active !== this .isActive_ .getValue ())
1837
- this .isActive_ = active;
1832
+ if (active !== this ._isActive .getValue ())
1833
+ this ._isActive = active;
1838
1834
 
1839
- if (! this .pickedGeometry_ .equals (pickedGeometries))
1840
- this .pickedGeometry_ = pickedGeometries;
1835
+ if (! this ._pickedGeometry .equals (pickedGeometries))
1836
+ this ._pickedGeometry = pickedGeometries;
1841
1837
 
1842
- var pickedTargets = this .getPickedTargets ();
1838
+ var pickedTargets = this .getPickedTargets ();
1843
1839
 
1844
- pickedPoint .length = 0;
1840
+ pickedPoint .length = 0;
1845
1841
 
1846
- for (var t = 0, tLength = pickedTargets .length; t < tLength; ++ t)
1847
- {
1848
- var pp = pickedTargets [t] .pickedPoint;
1842
+ for (var t = 0, tLength = pickedTargets .length; t < tLength; ++ t)
1843
+ {
1844
+ var pp = pickedTargets [t] .pickedPoint;
1849
1845
 
1850
- for (var p = 0, pLength = pp .length; p < pLength; ++ p)
1851
- pickedPoint .push (pp [p]);
1852
- }
1846
+ for (var p = 0, pLength = pp .length; p < pLength; ++ p)
1847
+ pickedPoint .push (pp [p]);
1848
+ }
1853
1849
 
1854
- if (! this .pickedPoint_ .equals (pickedPoint))
1855
- this .pickedPoint_ = pickedPoint;
1850
+ if (! this ._pickedPoint .equals (pickedPoint))
1851
+ this ._pickedPoint = pickedPoint;
1856
1852
 
1857
- break;
1858
- }
1859
- }
1860
- }
1853
+ break;
1854
+ }
1855
+ }
1856
+ }
1861
1857
 
1862
- X3DPickSensorNode .prototype .process .call (this);
1863
- };
1864
- })(),
1865
- });
1858
+ X3DPickSensorNode .prototype .process .call (this);
1859
+ };
1860
+ })(),
1861
+ });
1866
1862
 
1867
- return PointPickSensor;
1863
+ return PointPickSensor;
1868
1864
  });
1869
1865
 
1870
1866
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
@@ -1917,20 +1913,20 @@ function (Fields,
1917
1913
 
1918
1914
 
1919
1915
  define ('x_ite/Components/Picking/PrimitivePickSensor',[
1920
- "x_ite/Fields",
1921
- "x_ite/Basic/X3DFieldDefinition",
1922
- "x_ite/Basic/FieldDefinitionArray",
1923
- "x_ite/Components/Picking/X3DPickSensorNode",
1924
- "x_ite/Bits/X3DConstants",
1925
- "x_ite/Browser/Picking/IntersectionType",
1926
- "x_ite/Browser/Picking/VolumePicker",
1927
- "standard/Math/Numbers/Vector3",
1928
- "standard/Math/Geometry/Box3",
1916
+ "x_ite/Fields",
1917
+ "x_ite/Base/X3DFieldDefinition",
1918
+ "x_ite/Base/FieldDefinitionArray",
1919
+ "x_ite/Components/Picking/X3DPickSensorNode",
1920
+ "x_ite/Base/X3DConstants",
1921
+ "x_ite/Browser/Picking/IntersectionType",
1922
+ "x_ite/Browser/Picking/VolumePicker",
1923
+ "standard/Math/Numbers/Vector3",
1924
+ "standard/Math/Geometry/Box3",
1929
1925
  ],
1930
1926
  function (Fields,
1931
1927
  X3DFieldDefinition,
1932
1928
  FieldDefinitionArray,
1933
- X3DPickSensorNode,
1929
+ X3DPickSensorNode,
1934
1930
  X3DConstants,
1935
1931
  IntersectionType,
1936
1932
  VolumePicker,
@@ -1939,207 +1935,205 @@ function (Fields,
1939
1935
  {
1940
1936
  "use strict";
1941
1937
 
1942
- function PrimitivePickSensor (executionContext)
1943
- {
1944
- X3DPickSensorNode .call (this, executionContext);
1945
-
1946
- this .addType (X3DConstants .PrimitivePickSensor);
1947
-
1948
- this .pickingGeometryNode = null;
1949
- this .picker = new VolumePicker ();
1950
- }
1951
-
1952
- PrimitivePickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
1953
- {
1954
- constructor: PrimitivePickSensor,
1955
- fieldDefinitions: new FieldDefinitionArray ([
1956
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1957
- new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1958
- new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
1959
- new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
1960
- new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
1961
- new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
1962
- new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
1963
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
1964
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
1965
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
1966
- ]),
1967
- getTypeName: function ()
1968
- {
1969
- return "PrimitivePickSensor";
1970
- },
1971
- getComponentName: function ()
1972
- {
1973
- return "Picking";
1974
- },
1975
- getContainerField: function ()
1976
- {
1977
- return "children";
1978
- },
1979
- initialize: function ()
1980
- {
1981
- X3DPickSensorNode .prototype .initialize .call (this);
1982
-
1983
- this .pickingGeometry_ .addInterest ("set_pickingGeometry__", this);
1984
-
1985
- this .set_pickingGeometry__ ();
1986
- },
1987
- set_pickingGeometry__: function ()
1988
- {
1989
- this .pickingGeometryNode = null;
1990
-
1991
- try
1992
- {
1993
- var
1994
- node = this .pickingGeometry_ .getValue () .getInnerNode (),
1995
- type = node .getType ();
1996
-
1997
- for (var t = type .length - 1; t >= 0; -- t)
1998
- {
1999
- switch (type [t])
2000
- {
2001
- case X3DConstants .Box:
2002
- case X3DConstants .Cone:
2003
- case X3DConstants .Cylinder:
2004
- case X3DConstants .Sphere:
2005
- {
2006
- this .pickingGeometryNode = node;
2007
- break;
2008
- }
2009
- default:
2010
- continue;
2011
- }
2012
- }
2013
- }
2014
- catch (error)
2015
- { }
2016
- },
2017
- process: (function ()
2018
- {
2019
- var
2020
- pickingBBox = new Box3 (),
2021
- targetBBox = new Box3 (),
2022
- pickingCenter = new Vector3 (0, 0, 0),
2023
- targetCenter = new Vector3 (0, 0, 0);
2024
-
2025
- return function ()
2026
- {
2027
- if (this .pickingGeometryNode)
2028
- {
2029
- var
2030
- modelMatrices = this .getModelMatrices (),
2031
- targets = this .getTargets ();
2032
-
2033
- switch (this .getIntersectionType ())
2034
- {
2035
- case IntersectionType .BOUNDS:
2036
- {
2037
- // Intersect bboxes.
2038
-
2039
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2040
- {
2041
- var modelMatrix = modelMatrices [m];
2042
-
2043
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2044
-
2045
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2046
- {
2047
- var target = targets [t];
2048
-
2049
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2050
-
2051
- if (pickingBBox .intersectsBox (targetBBox))
2052
- {
2053
- pickingCenter .assign (pickingBBox .center);
2054
- targetCenter .assign (targetBBox .center);
2055
-
2056
- target .intersected = true;
2057
- target .distance = pickingCenter .distance (targetCenter);
2058
- }
2059
- }
2060
- }
2061
-
2062
- // Send events.
2063
-
2064
- var
2065
- pickedGeometries = this .getPickedGeometries (),
2066
- active = Boolean (pickedGeometries .length);
2067
-
2068
- pickedGeometries .remove (0, pickedGeometries .length, null);
2069
-
2070
- if (active !== this .isActive_ .getValue ())
2071
- this .isActive_ = active;
2072
-
2073
- if (! this .pickedGeometry_ .equals (pickedGeometries))
2074
- this .pickedGeometry_ = pickedGeometries;
2075
-
2076
- break;
2077
- }
2078
- case IntersectionType .GEOMETRY:
2079
- {
2080
- // Intersect geometry.
2081
-
2082
- var picker = this .picker;
2083
-
2084
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2085
- {
2086
- var
2087
- modelMatrix = modelMatrices [m],
2088
- pickingShape = this .getPickShape (this .pickingGeometryNode);
2089
-
2090
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2091
-
2092
- picker .setChildShape1 (modelMatrix, pickingShape .getCompoundShape ());
2093
-
2094
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2095
- {
2096
- var
2097
- target = targets [t],
2098
- targetShape = this .getPickShape (target .geometryNode);
2099
-
2100
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2101
-
2102
- picker .setChildShape2 (target .modelMatrix, targetShape .getCompoundShape ());
2103
-
2104
- if (picker .contactTest ())
2105
- {
2106
- pickingCenter .assign (pickingBBox .center);
2107
- targetCenter .assign (targetBBox .center);
2108
-
2109
- target .intersected = true;
2110
- target .distance = pickingCenter .distance (targetCenter);
2111
- }
2112
- }
2113
- }
2114
-
2115
- // Send events.
2116
-
2117
- var
2118
- pickedGeometries = this .getPickedGeometries (),
2119
- active = Boolean (pickedGeometries .length);
2120
-
2121
- pickedGeometries .remove (0, pickedGeometries .length, null);
2122
-
2123
- if (active !== this .isActive_ .getValue ())
2124
- this .isActive_ = active;
2125
-
2126
- if (! this .pickedGeometry_ .equals (pickedGeometries))
2127
- this .pickedGeometry_ = pickedGeometries;
2128
-
2129
- break;
2130
- }
2131
- }
2132
- }
2133
-
2134
- X3DPickSensorNode .prototype .process .call (this);
2135
- };
2136
- })(),
2137
- });
2138
-
2139
- return PrimitivePickSensor;
2140
- });
1938
+ function PrimitivePickSensor (executionContext)
1939
+ {
1940
+ X3DPickSensorNode .call (this, executionContext);
1941
+
1942
+ this .addType (X3DConstants .PrimitivePickSensor);
1943
+
1944
+ this .pickingGeometryNode = null;
1945
+ this .picker = new VolumePicker ();
1946
+ }
1947
+
1948
+ PrimitivePickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
1949
+ {
1950
+ constructor: PrimitivePickSensor,
1951
+ [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
1952
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1953
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1954
+ new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
1955
+ new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
1956
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
1957
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
1958
+ new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
1959
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
1960
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
1961
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
1962
+ ]),
1963
+ getTypeName: function ()
1964
+ {
1965
+ return "PrimitivePickSensor";
1966
+ },
1967
+ getComponentName: function ()
1968
+ {
1969
+ return "Picking";
1970
+ },
1971
+ getContainerField: function ()
1972
+ {
1973
+ return "children";
1974
+ },
1975
+ initialize: function ()
1976
+ {
1977
+ X3DPickSensorNode .prototype .initialize .call (this);
1978
+
1979
+ this ._pickingGeometry .addInterest ("set_pickingGeometry__", this);
1980
+
1981
+ this .set_pickingGeometry__ ();
1982
+ },
1983
+ set_pickingGeometry__: function ()
1984
+ {
1985
+ this .pickingGeometryNode = null;
1986
+
1987
+ try
1988
+ {
1989
+ var
1990
+ node = this ._pickingGeometry .getValue () .getInnerNode (),
1991
+ type = node .getType ();
1992
+
1993
+ for (var t = type .length - 1; t >= 0; -- t)
1994
+ {
1995
+ switch (type [t])
1996
+ {
1997
+ case X3DConstants .Box:
1998
+ case X3DConstants .Cone:
1999
+ case X3DConstants .Cylinder:
2000
+ case X3DConstants .Sphere:
2001
+ {
2002
+ this .pickingGeometryNode = node;
2003
+ break;
2004
+ }
2005
+ default:
2006
+ continue;
2007
+ }
2008
+ }
2009
+ }
2010
+ catch (error)
2011
+ { }
2012
+ },
2013
+ process: (function ()
2014
+ {
2015
+ var
2016
+ pickingBBox = new Box3 (),
2017
+ targetBBox = new Box3 (),
2018
+ pickingCenter = new Vector3 (0, 0, 0),
2019
+ targetCenter = new Vector3 (0, 0, 0);
2020
+
2021
+ return function ()
2022
+ {
2023
+ if (this .pickingGeometryNode)
2024
+ {
2025
+ var
2026
+ modelMatrices = this .getModelMatrices (),
2027
+ targets = this .getTargets ();
2028
+
2029
+ switch (this .getIntersectionType ())
2030
+ {
2031
+ case IntersectionType .BOUNDS:
2032
+ {
2033
+ // Intersect bboxes.
2034
+
2035
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2036
+ {
2037
+ var modelMatrix = modelMatrices [m];
2038
+
2039
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2040
+
2041
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2042
+ {
2043
+ var target = targets [t];
2044
+
2045
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2046
+
2047
+ if (pickingBBox .intersectsBox (targetBBox))
2048
+ {
2049
+ pickingCenter .assign (pickingBBox .center);
2050
+ targetCenter .assign (targetBBox .center);
2051
+
2052
+ target .intersected = true;
2053
+ target .distance = pickingCenter .distance (targetCenter);
2054
+ }
2055
+ }
2056
+ }
2057
+
2058
+ // Send events.
2059
+
2060
+ var
2061
+ pickedGeometries = this .getPickedGeometries (),
2062
+ active = Boolean (pickedGeometries .length);
2063
+
2064
+ pickedGeometries .remove (0, pickedGeometries .length, null);
2065
+
2066
+ if (active !== this ._isActive .getValue ())
2067
+ this ._isActive = active;
2068
+
2069
+ if (! this ._pickedGeometry .equals (pickedGeometries))
2070
+ this ._pickedGeometry = pickedGeometries;
2071
+
2072
+ break;
2073
+ }
2074
+ case IntersectionType .GEOMETRY:
2075
+ {
2076
+ // Intersect geometry.
2077
+
2078
+ var picker = this .picker;
2079
+
2080
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2081
+ {
2082
+ var
2083
+ modelMatrix = modelMatrices [m],
2084
+ pickingShape = this .getPickShape (this .pickingGeometryNode);
2085
+
2086
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2087
+
2088
+ picker .setChildShape1 (modelMatrix, pickingShape .getCompoundShape ());
2089
+
2090
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2091
+ {
2092
+ var
2093
+ target = targets [t],
2094
+ targetShape = this .getPickShape (target .geometryNode);
2095
+
2096
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2097
+
2098
+ picker .setChildShape2 (target .modelMatrix, targetShape .getCompoundShape ());
2099
+
2100
+ if (picker .contactTest ())
2101
+ {
2102
+ pickingCenter .assign (pickingBBox .center);
2103
+ targetCenter .assign (targetBBox .center);
2104
+
2105
+ target .intersected = true;
2106
+ target .distance = pickingCenter .distance (targetCenter);
2107
+ }
2108
+ }
2109
+ }
2110
+
2111
+ // Send events.
2141
2112
 
2113
+ var
2114
+ pickedGeometries = this .getPickedGeometries (),
2115
+ active = Boolean (pickedGeometries .length);
2142
2116
 
2117
+ pickedGeometries .remove (0, pickedGeometries .length, null);
2118
+
2119
+ if (active !== this ._isActive .getValue ())
2120
+ this ._isActive = active;
2121
+
2122
+ if (! this ._pickedGeometry .equals (pickedGeometries))
2123
+ this ._pickedGeometry = pickedGeometries;
2124
+
2125
+ break;
2126
+ }
2127
+ }
2128
+ }
2129
+
2130
+ X3DPickSensorNode .prototype .process .call (this);
2131
+ };
2132
+ })(),
2133
+ });
2134
+
2135
+ return PrimitivePickSensor;
2136
+ });
2143
2137
 
2144
2138
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
2145
2139
  *******************************************************************************
@@ -2191,21 +2185,21 @@ function (Fields,
2191
2185
 
2192
2186
 
2193
2187
  define ('x_ite/Components/Picking/VolumePickSensor',[
2194
- "x_ite/Fields",
2195
- "x_ite/Basic/X3DFieldDefinition",
2196
- "x_ite/Basic/FieldDefinitionArray",
2197
- "x_ite/Components/Picking/X3DPickSensorNode",
2198
- "x_ite/Bits/X3DCast",
2199
- "x_ite/Bits/X3DConstants",
2200
- "x_ite/Browser/Picking/IntersectionType",
2201
- "x_ite/Browser/Picking/VolumePicker",
2202
- "standard/Math/Numbers/Vector3",
2203
- "standard/Math/Geometry/Box3",
2188
+ "x_ite/Fields",
2189
+ "x_ite/Base/X3DFieldDefinition",
2190
+ "x_ite/Base/FieldDefinitionArray",
2191
+ "x_ite/Components/Picking/X3DPickSensorNode",
2192
+ "x_ite/Base/X3DCast",
2193
+ "x_ite/Base/X3DConstants",
2194
+ "x_ite/Browser/Picking/IntersectionType",
2195
+ "x_ite/Browser/Picking/VolumePicker",
2196
+ "standard/Math/Numbers/Vector3",
2197
+ "standard/Math/Geometry/Box3",
2204
2198
  ],
2205
2199
  function (Fields,
2206
2200
  X3DFieldDefinition,
2207
2201
  FieldDefinitionArray,
2208
- X3DPickSensorNode,
2202
+ X3DPickSensorNode,
2209
2203
  X3DCast,
2210
2204
  X3DConstants,
2211
2205
  IntersectionType,
@@ -2215,181 +2209,179 @@ function (Fields,
2215
2209
  {
2216
2210
  "use strict";
2217
2211
 
2218
- function VolumePickSensor (executionContext)
2219
- {
2220
- X3DPickSensorNode .call (this, executionContext);
2221
-
2222
- this .addType (X3DConstants .VolumePickSensor);
2223
-
2224
- this .pickingGeometryNode = null;
2225
- this .picker = new VolumePicker ();
2226
- }
2227
-
2228
- VolumePickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
2229
- {
2230
- constructor: VolumePickSensor,
2231
- fieldDefinitions: new FieldDefinitionArray ([
2232
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
2233
- new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
2234
- new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
2235
- new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
2236
- new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
2237
- new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
2238
- new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
2239
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
2240
- new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
2241
- new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
2242
- ]),
2243
- getTypeName: function ()
2244
- {
2245
- return "VolumePickSensor";
2246
- },
2247
- getComponentName: function ()
2248
- {
2249
- return "Picking";
2250
- },
2251
- getContainerField: function ()
2252
- {
2253
- return "children";
2254
- },
2255
- initialize: function ()
2256
- {
2257
- X3DPickSensorNode .prototype .initialize .call (this);
2258
-
2259
- this .pickingGeometry_ .addInterest ("set_pickingGeometry__", this);
2260
-
2261
- this .set_pickingGeometry__ ();
2262
- },
2263
- set_pickingGeometry__: function ()
2264
- {
2265
- this .pickingGeometryNode = X3DCast (X3DConstants .X3DGeometryNode, this .pickingGeometry_);
2266
- },
2267
- process: (function ()
2268
- {
2269
- var
2270
- pickingBBox = new Box3 (),
2271
- targetBBox = new Box3 (),
2272
- pickingCenter = new Vector3 (0, 0, 0),
2273
- targetCenter = new Vector3 (0, 0, 0);
2274
-
2275
- return function ()
2276
- {
2277
- if (this .pickingGeometryNode)
2278
- {
2279
- var
2280
- modelMatrices = this .getModelMatrices (),
2281
- targets = this .getTargets ();
2282
-
2283
- switch (this .getIntersectionType ())
2284
- {
2285
- case IntersectionType .BOUNDS:
2286
- {
2287
- // Intersect bboxes.
2288
-
2289
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2290
- {
2291
- var modelMatrix = modelMatrices [m];
2292
-
2293
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2294
-
2295
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2296
- {
2297
- var target = targets [t];
2298
-
2299
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2300
-
2301
- if (pickingBBox .intersectsBox (targetBBox))
2302
- {
2303
- pickingCenter .assign (pickingBBox .center);
2304
- targetCenter .assign (targetBBox .center);
2305
-
2306
- target .intersected = true;
2307
- target .distance = pickingCenter .distance (targetCenter);
2308
- }
2309
- }
2310
- }
2311
-
2312
- // Send events.
2313
-
2314
- var
2315
- pickedGeometries = this .getPickedGeometries (),
2316
- active = Boolean (pickedGeometries .length);
2317
-
2318
- pickedGeometries .remove (0, pickedGeometries .length, null);
2319
-
2320
- if (active !== this .isActive_ .getValue ())
2321
- this .isActive_ = active;
2322
-
2323
- if (! this .pickedGeometry_ .equals (pickedGeometries))
2324
- this .pickedGeometry_ = pickedGeometries;
2325
-
2326
- break;
2327
- }
2328
- case IntersectionType .GEOMETRY:
2329
- {
2330
- // Intersect geometry.
2331
-
2332
- var picker = this .picker;
2333
-
2334
- for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2335
- {
2336
- var
2337
- modelMatrix = modelMatrices [m],
2338
- pickingShape = this .getPickShape (this .pickingGeometryNode);
2339
-
2340
- pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2341
-
2342
- picker .setChildShape1 (modelMatrix, pickingShape .getCompoundShape ());
2343
-
2344
- for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2345
- {
2346
- var
2347
- target = targets [t],
2348
- targetShape = this .getPickShape (target .geometryNode);
2349
-
2350
- targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2351
-
2352
- picker .setChildShape2 (target .modelMatrix, targetShape .getCompoundShape ());
2353
-
2354
- if (picker .contactTest ())
2355
- {
2356
- pickingCenter .assign (pickingBBox .center);
2357
- targetCenter .assign (targetBBox .center);
2358
-
2359
- target .intersected = true;
2360
- target .distance = pickingCenter .distance (targetCenter);
2361
- }
2362
- }
2363
- }
2364
-
2365
- // Send events.
2366
-
2367
- var
2368
- pickedGeometries = this .getPickedGeometries (),
2369
- active = Boolean (pickedGeometries .length);
2370
-
2371
- pickedGeometries .remove (0, pickedGeometries .length, null);
2372
-
2373
- if (active !== this .isActive_ .getValue ())
2374
- this .isActive_ = active;
2375
-
2376
- if (! this .pickedGeometry_ .equals (pickedGeometries))
2377
- this .pickedGeometry_ = pickedGeometries;
2378
-
2379
- break;
2380
- }
2381
- }
2382
- }
2383
-
2384
- X3DPickSensorNode .prototype .process .call (this);
2385
- };
2386
- })(),
2387
- });
2388
-
2389
- return VolumePickSensor;
2390
- });
2212
+ function VolumePickSensor (executionContext)
2213
+ {
2214
+ X3DPickSensorNode .call (this, executionContext);
2215
+
2216
+ this .addType (X3DConstants .VolumePickSensor);
2217
+
2218
+ this .pickingGeometryNode = null;
2219
+ this .picker = new VolumePicker ();
2220
+ }
2221
+
2222
+ VolumePickSensor .prototype = Object .assign (Object .create (X3DPickSensorNode .prototype),
2223
+ {
2224
+ constructor: VolumePickSensor,
2225
+ [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
2226
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
2227
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
2228
+ new X3DFieldDefinition (X3DConstants .inputOutput, "objectType", new Fields .MFString ("ALL")),
2229
+ new X3DFieldDefinition (X3DConstants .inputOutput, "matchCriterion", new Fields .SFString ("MATCH_ANY")),
2230
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "intersectionType", new Fields .SFString ("BOUNDS")),
2231
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "sortOrder", new Fields .SFString ("CLOSEST")),
2232
+ new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
2233
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickingGeometry", new Fields .SFNode ()),
2234
+ new X3DFieldDefinition (X3DConstants .inputOutput, "pickTarget", new Fields .MFNode ()),
2235
+ new X3DFieldDefinition (X3DConstants .outputOnly, "pickedGeometry", new Fields .MFNode ()),
2236
+ ]),
2237
+ getTypeName: function ()
2238
+ {
2239
+ return "VolumePickSensor";
2240
+ },
2241
+ getComponentName: function ()
2242
+ {
2243
+ return "Picking";
2244
+ },
2245
+ getContainerField: function ()
2246
+ {
2247
+ return "children";
2248
+ },
2249
+ initialize: function ()
2250
+ {
2251
+ X3DPickSensorNode .prototype .initialize .call (this);
2252
+
2253
+ this ._pickingGeometry .addInterest ("set_pickingGeometry__", this);
2254
+
2255
+ this .set_pickingGeometry__ ();
2256
+ },
2257
+ set_pickingGeometry__: function ()
2258
+ {
2259
+ this .pickingGeometryNode = X3DCast (X3DConstants .X3DGeometryNode, this ._pickingGeometry);
2260
+ },
2261
+ process: (function ()
2262
+ {
2263
+ var
2264
+ pickingBBox = new Box3 (),
2265
+ targetBBox = new Box3 (),
2266
+ pickingCenter = new Vector3 (0, 0, 0),
2267
+ targetCenter = new Vector3 (0, 0, 0);
2268
+
2269
+ return function ()
2270
+ {
2271
+ if (this .pickingGeometryNode)
2272
+ {
2273
+ var
2274
+ modelMatrices = this .getModelMatrices (),
2275
+ targets = this .getTargets ();
2276
+
2277
+ switch (this .getIntersectionType ())
2278
+ {
2279
+ case IntersectionType .BOUNDS:
2280
+ {
2281
+ // Intersect bboxes.
2282
+
2283
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2284
+ {
2285
+ var modelMatrix = modelMatrices [m];
2286
+
2287
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2288
+
2289
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2290
+ {
2291
+ var target = targets [t];
2292
+
2293
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2294
+
2295
+ if (pickingBBox .intersectsBox (targetBBox))
2296
+ {
2297
+ pickingCenter .assign (pickingBBox .center);
2298
+ targetCenter .assign (targetBBox .center);
2299
+
2300
+ target .intersected = true;
2301
+ target .distance = pickingCenter .distance (targetCenter);
2302
+ }
2303
+ }
2304
+ }
2305
+
2306
+ // Send events.
2307
+
2308
+ var
2309
+ pickedGeometries = this .getPickedGeometries (),
2310
+ active = Boolean (pickedGeometries .length);
2311
+
2312
+ pickedGeometries .remove (0, pickedGeometries .length, null);
2313
+
2314
+ if (active !== this ._isActive .getValue ())
2315
+ this ._isActive = active;
2316
+
2317
+ if (! this ._pickedGeometry .equals (pickedGeometries))
2318
+ this ._pickedGeometry = pickedGeometries;
2319
+
2320
+ break;
2321
+ }
2322
+ case IntersectionType .GEOMETRY:
2323
+ {
2324
+ // Intersect geometry.
2325
+
2326
+ var picker = this .picker;
2327
+
2328
+ for (var m = 0, mLength = modelMatrices .length; m < mLength; ++ m)
2329
+ {
2330
+ var
2331
+ modelMatrix = modelMatrices [m],
2332
+ pickingShape = this .getPickShape (this .pickingGeometryNode);
2333
+
2334
+ pickingBBox .assign (this .pickingGeometryNode .getBBox ()) .multRight (modelMatrix);
2335
+
2336
+ picker .setChildShape1 (modelMatrix, pickingShape .getCompoundShape ());
2337
+
2338
+ for (var t = 0, tLength = targets .size; t < tLength; ++ t)
2339
+ {
2340
+ var
2341
+ target = targets [t],
2342
+ targetShape = this .getPickShape (target .geometryNode);
2343
+
2344
+ targetBBox .assign (target .geometryNode .getBBox ()) .multRight (target .modelMatrix);
2345
+
2346
+ picker .setChildShape2 (target .modelMatrix, targetShape .getCompoundShape ());
2347
+
2348
+ if (picker .contactTest ())
2349
+ {
2350
+ pickingCenter .assign (pickingBBox .center);
2351
+ targetCenter .assign (targetBBox .center);
2391
2352
 
2353
+ target .intersected = true;
2354
+ target .distance = pickingCenter .distance (targetCenter);
2355
+ }
2356
+ }
2357
+ }
2392
2358
 
2359
+ // Send events.
2360
+
2361
+ var
2362
+ pickedGeometries = this .getPickedGeometries (),
2363
+ active = Boolean (pickedGeometries .length);
2364
+
2365
+ pickedGeometries .remove (0, pickedGeometries .length, null);
2366
+
2367
+ if (active !== this ._isActive .getValue ())
2368
+ this ._isActive = active;
2369
+
2370
+ if (! this ._pickedGeometry .equals (pickedGeometries))
2371
+ this ._pickedGeometry = pickedGeometries;
2372
+
2373
+ break;
2374
+ }
2375
+ }
2376
+ }
2377
+
2378
+ X3DPickSensorNode .prototype .process .call (this);
2379
+ };
2380
+ })(),
2381
+ });
2382
+
2383
+ return VolumePickSensor;
2384
+ });
2393
2385
 
2394
2386
  /*******************************************************************************
2395
2387
  *
@@ -2440,15 +2432,15 @@ function (Fields,
2440
2432
 
2441
2433
 
2442
2434
  define (require .getComponentUrl ("picking"), [
2443
- "x_ite/Components",
2444
- "x_ite/Components/Picking/LinePickSensor",
2445
- "x_ite/Components/Picking/PickableGroup",
2446
- "x_ite/Components/Picking/PointPickSensor",
2447
- "x_ite/Components/Picking/PrimitivePickSensor",
2448
- "x_ite/Components/Picking/VolumePickSensor",
2449
- "x_ite/Components/Picking/X3DPickSensorNode",
2450
- "x_ite/Components/Picking/X3DPickableObject",
2451
- require .getComponentUrl ("rigid-body-physics"),
2435
+ "x_ite/Components",
2436
+ "x_ite/Components/Picking/LinePickSensor",
2437
+ "x_ite/Components/Picking/PickableGroup",
2438
+ "x_ite/Components/Picking/PointPickSensor",
2439
+ "x_ite/Components/Picking/PrimitivePickSensor",
2440
+ "x_ite/Components/Picking/VolumePickSensor",
2441
+ "x_ite/Components/Picking/X3DPickSensorNode",
2442
+ "x_ite/Components/Picking/X3DPickableObject",
2443
+ require .getComponentUrl ("rigid-body-physics"),
2452
2444
  ],
2453
2445
  function (Components,
2454
2446
  LinePickSensor,
@@ -2461,22 +2453,22 @@ function (Components,
2461
2453
  {
2462
2454
  "use strict";
2463
2455
 
2464
- Components .addComponent ({
2465
- name: "Picking",
2466
- types:
2467
- {
2468
- LinePickSensor: LinePickSensor,
2469
- PickableGroup: PickableGroup,
2470
- PointPickSensor: PointPickSensor,
2471
- PrimitivePickSensor: PrimitivePickSensor,
2472
- VolumePickSensor: VolumePickSensor,
2473
- },
2474
- abstractTypes:
2475
- {
2476
- X3DPickSensorNode: X3DPickSensorNode,
2477
- X3DPickableObject: X3DPickableObject,
2478
- },
2479
- });
2456
+ Components .addComponent ({
2457
+ name: "Picking",
2458
+ types:
2459
+ {
2460
+ LinePickSensor: LinePickSensor,
2461
+ PickableGroup: PickableGroup,
2462
+ PointPickSensor: PointPickSensor,
2463
+ PrimitivePickSensor: PrimitivePickSensor,
2464
+ VolumePickSensor: VolumePickSensor,
2465
+ },
2466
+ abstractTypes:
2467
+ {
2468
+ X3DPickSensorNode: X3DPickSensorNode,
2469
+ X3DPickableObject: X3DPickableObject,
2470
+ },
2471
+ });
2480
2472
  });
2481
2473
 
2482
2474