x_ite 5.0.3 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/.vscode/settings.json +12 -5
  2. package/.vscode/tasks.json +25 -1
  3. package/Makefile +36 -28
  4. package/README.md +6 -11
  5. package/build/bin/dist.pl +0 -6
  6. package/build/bin/examples-and-tests.pl +75 -0
  7. package/build/bin/tests-menu.pl +57 -0
  8. package/build/bin/version.pl +7 -4
  9. package/build/parts/default.start.frag.js +3 -2
  10. package/dist/assets/components/annotation.js +3 -2
  11. package/dist/assets/components/annotation.min.js +1 -1
  12. package/dist/assets/components/cad-geometry.js +3 -2
  13. package/dist/assets/components/cad-geometry.min.js +1 -1
  14. package/dist/assets/components/cube-map-texturing.js +8 -20
  15. package/dist/assets/components/cube-map-texturing.min.js +1 -1
  16. package/dist/assets/components/dis.js +3 -2
  17. package/dist/assets/components/dis.min.js +1 -1
  18. package/dist/assets/components/event-utilities.js +4 -3
  19. package/dist/assets/components/event-utilities.min.js +1 -1
  20. package/dist/assets/components/geometry2d.js +38 -52
  21. package/dist/assets/components/geometry2d.min.js +1 -1
  22. package/dist/assets/components/geospatial.js +34 -1686
  23. package/dist/assets/components/geospatial.min.js +1 -1
  24. package/dist/assets/components/h-anim.js +71 -77
  25. package/dist/assets/components/h-anim.min.js +1 -1
  26. package/dist/assets/components/key-device-sensor.js +4 -3
  27. package/dist/assets/components/key-device-sensor.min.js +1 -1
  28. package/dist/assets/components/layout.js +101 -173
  29. package/dist/assets/components/layout.min.js +1 -1
  30. package/dist/assets/components/nurbs.js +3 -2
  31. package/dist/assets/components/nurbs.min.js +1 -1
  32. package/dist/assets/components/particle-systems.js +1926 -1669
  33. package/dist/assets/components/particle-systems.min.js +1 -1
  34. package/dist/assets/components/picking.js +34 -41
  35. package/dist/assets/components/picking.min.js +1 -1
  36. package/dist/assets/components/projective-texture-mapping.js +73 -86
  37. package/dist/assets/components/projective-texture-mapping.min.js +1 -1
  38. package/dist/assets/components/rigid-body-physics.js +37 -57
  39. package/dist/assets/components/rigid-body-physics.min.js +1 -1
  40. package/dist/assets/components/scripting.js +3 -2
  41. package/dist/assets/components/scripting.min.js +1 -1
  42. package/dist/assets/components/texturing-3d.js +27 -33
  43. package/dist/assets/components/texturing-3d.min.js +3 -3
  44. package/dist/assets/components/volume-rendering.js +12 -11
  45. package/dist/assets/components/volume-rendering.min.js +1 -1
  46. package/dist/assets/components/x_ite.js +3 -2
  47. package/dist/assets/components/x_ite.min.js +1 -1
  48. package/dist/assets/images/Shading.png +0 -0
  49. package/dist/assets/linetype/1.png +0 -0
  50. package/dist/assets/linetype/10.png +0 -0
  51. package/dist/assets/linetype/11.png +0 -0
  52. package/dist/assets/linetype/12.png +0 -0
  53. package/dist/assets/linetype/13.png +0 -0
  54. package/dist/assets/linetype/14.png +0 -0
  55. package/dist/assets/linetype/15.png +0 -0
  56. package/dist/assets/linetype/16.png +0 -0
  57. package/dist/assets/linetype/2.png +0 -0
  58. package/dist/assets/linetype/3.png +0 -0
  59. package/dist/assets/linetype/4.png +0 -0
  60. package/dist/assets/linetype/5.png +0 -0
  61. package/dist/assets/linetype/6.png +0 -0
  62. package/dist/assets/linetype/7.png +0 -0
  63. package/dist/assets/linetype/8.png +0 -0
  64. package/dist/assets/linetype/9.png +0 -0
  65. package/dist/assets/shaders/webgl1/Gouraud.vs +1 -1
  66. package/dist/assets/shaders/webgl1/Line.fs +0 -21
  67. package/dist/assets/shaders/webgl1/Line.vs +0 -10
  68. package/dist/assets/shaders/webgl1/PBR.fs +1 -1
  69. package/dist/assets/shaders/webgl1/PBR.vs +1 -1
  70. package/dist/assets/shaders/webgl1/Phong.fs +1 -1
  71. package/dist/assets/shaders/webgl1/Point.vs +1 -1
  72. package/dist/assets/shaders/webgl2/Depth.vs +29 -1
  73. package/dist/assets/shaders/webgl2/Gouraud.vs +32 -4
  74. package/dist/assets/shaders/webgl2/Line.fs +24 -12
  75. package/dist/assets/shaders/webgl2/Line.vs +36 -11
  76. package/dist/assets/shaders/webgl2/LineTransform.fs +4 -0
  77. package/dist/assets/shaders/webgl2/LineTransform.vs +57 -0
  78. package/dist/assets/shaders/webgl2/PBR.fs +1 -1
  79. package/dist/assets/shaders/webgl2/PBR.vs +35 -7
  80. package/dist/assets/shaders/webgl2/Phong.fs +1 -1
  81. package/dist/assets/shaders/webgl2/Phong.vs +31 -3
  82. package/dist/assets/shaders/webgl2/Point.vs +30 -2
  83. package/dist/assets/shaders/webgl2/Unlit.vs +31 -3
  84. package/dist/example.html +6 -6
  85. package/dist/x_ite.css +199 -224
  86. package/dist/x_ite.js +16335 -15917
  87. package/dist/x_ite.min.js +17 -17
  88. package/dist/x_ite.zip +0 -0
  89. package/docs/404.md +6 -0
  90. package/docs/Accessing-the-External-Browser.md +21 -15
  91. package/docs/Browser-Support.md +6 -0
  92. package/docs/Custom-Shaders.md +18 -25
  93. package/docs/Features.md +11 -5
  94. package/docs/Gemfile +44 -0
  95. package/docs/Gemfile.lock +122 -0
  96. package/docs/Glossary.md +6 -0
  97. package/docs/How-To-Configure-Your-Web-Server.md +6 -0
  98. package/docs/Supported-Nodes.md +9 -1
  99. package/docs/What's-New.md +93 -39
  100. package/docs/XHTML-DOM-Integration.md +6 -0
  101. package/docs/_config.yml +2 -2
  102. package/docs/assets/css/main.scss +26 -0
  103. package/docs/index.md +42 -50
  104. package/docs/reference/Browser-Services.md +9 -3
  105. package/docs/reference/Constants-Services.md +6 -0
  106. package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +12 -6
  107. package/docs/reference/Field-Services-and-Objects.md +105 -1
  108. package/docs/reference/Prototype-Services.md +11 -0
  109. package/docs/reference/Route-Services.md +9 -0
  110. package/docs/reference/Scene-Services.md +17 -2
  111. package/docs/reference/Script-Node-Authoring-Interface.md +7 -1
  112. package/docs/tutorials/Adding-backgrounds.md +6 -0
  113. package/docs/tutorials/Adding-fog.md +6 -0
  114. package/docs/tutorials/Adding-sound.md +6 -0
  115. package/docs/tutorials/Animating-transforms.md +6 -0
  116. package/docs/tutorials/Basic-Nodes.md +6 -0
  117. package/docs/tutorials/Building-a-X3D-world.md +6 -0
  118. package/docs/tutorials/Building-elevation-grids.md +6 -0
  119. package/docs/tutorials/Building-extruded-shapes.md +6 -0
  120. package/docs/tutorials/Building-primitive-shapes.md +6 -0
  121. package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +6 -0
  122. package/docs/tutorials/Controlling-appearance-with-materials.md +6 -0
  123. package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +6 -0
  124. package/docs/tutorials/Controlling-detail.md +6 -0
  125. package/docs/tutorials/Controlling-how-textures-are-mapped.md +6 -0
  126. package/docs/tutorials/Controlling-navigation.md +6 -0
  127. package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +6 -0
  128. package/docs/tutorials/Controlling-the-viewpoint.md +6 -0
  129. package/docs/tutorials/Creating-new-node-types.md +6 -0
  130. package/docs/tutorials/Grouping-nodes.md +6 -0
  131. package/docs/tutorials/Hello,-World!.md +6 -0
  132. package/docs/tutorials/Improving-Performance.md +6 -0
  133. package/docs/tutorials/Increasing-Rendering-Speed.md +6 -0
  134. package/docs/tutorials/Introducing-X3D.md +6 -0
  135. package/docs/tutorials/Introducing-animation.md +6 -0
  136. package/docs/tutorials/Introducing-script-use.md +6 -0
  137. package/docs/tutorials/Lighting-your-world.md +6 -0
  138. package/docs/tutorials/Mapping-textures.md +6 -0
  139. package/docs/tutorials/Naming-nodes.md +6 -0
  140. package/docs/tutorials/Providing-information-about-your-world.md +6 -0
  141. package/docs/tutorials/Sensing-the-viewer.md +6 -0
  142. package/docs/tutorials/Sensing-viewer-actions.md +6 -0
  143. package/docs/tutorials/Transforming-Shapes.md +6 -0
  144. package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +6 -0
  145. package/docs/tutorials/index.md +42 -36
  146. package/package.json +6 -7
  147. package/src/assets/components/geometry2d.js +1 -1
  148. package/src/assets/components/key-device-sensor.js +1 -1
  149. package/src/assets/components/layout.js +1 -1
  150. package/src/assets/components/particle-systems.js +1 -1
  151. package/src/assets/components/volume-rendering.js +1 -1
  152. package/src/assets/images/Shading.png +0 -0
  153. package/src/assets/linetype/1.png +0 -0
  154. package/src/assets/linetype/10.png +0 -0
  155. package/src/assets/linetype/11.png +0 -0
  156. package/src/assets/linetype/12.png +0 -0
  157. package/src/assets/linetype/13.png +0 -0
  158. package/src/assets/linetype/14.png +0 -0
  159. package/src/assets/linetype/15.png +0 -0
  160. package/src/assets/linetype/16.png +0 -0
  161. package/src/assets/linetype/2.png +0 -0
  162. package/src/assets/linetype/3.png +0 -0
  163. package/src/assets/linetype/4.png +0 -0
  164. package/src/assets/linetype/5.png +0 -0
  165. package/src/assets/linetype/6.png +0 -0
  166. package/src/assets/linetype/7.png +0 -0
  167. package/src/assets/linetype/8.png +0 -0
  168. package/src/assets/linetype/9.png +0 -0
  169. package/src/assets/shaders/Types.glsl +1 -9
  170. package/src/assets/shaders/webgl1/Gouraud.fs +1 -1
  171. package/src/assets/shaders/webgl1/Gouraud.vs +2 -3
  172. package/src/assets/shaders/webgl1/Line.fs +3 -28
  173. package/src/assets/shaders/webgl1/Line.vs +6 -20
  174. package/src/assets/shaders/webgl1/PBR.fs +6 -6
  175. package/src/assets/shaders/webgl1/PBR.vs +1 -1
  176. package/src/assets/shaders/webgl1/Phong.fs +10 -10
  177. package/src/assets/shaders/webgl1/Point.vs +2 -2
  178. package/src/assets/shaders/webgl1/Unlit.fs +4 -4
  179. package/src/assets/shaders/webgl1/include/Normal.glsl +1 -1
  180. package/src/assets/shaders/webgl1/include/Texture.glsl +3 -8
  181. package/src/assets/shaders/webgl2/Depth.vs +4 -1
  182. package/src/assets/shaders/webgl2/Gouraud.fs +1 -1
  183. package/src/assets/shaders/webgl2/Gouraud.vs +8 -6
  184. package/src/assets/shaders/webgl2/Line.fs +11 -17
  185. package/src/assets/shaders/webgl2/Line.vs +17 -21
  186. package/src/assets/shaders/webgl2/LineTransform.fs +6 -0
  187. package/src/assets/shaders/webgl2/LineTransform.vs +77 -0
  188. package/src/assets/shaders/webgl2/PBR.fs +6 -6
  189. package/src/assets/shaders/webgl2/PBR.vs +10 -7
  190. package/src/assets/shaders/webgl2/Phong.fs +11 -11
  191. package/src/assets/shaders/webgl2/Phong.vs +6 -3
  192. package/src/assets/shaders/webgl2/Point.vs +5 -4
  193. package/src/assets/shaders/webgl2/Unlit.fs +5 -5
  194. package/src/assets/shaders/webgl2/Unlit.vs +6 -3
  195. package/src/assets/shaders/webgl2/include/Line2.glsl +20 -0
  196. package/src/assets/shaders/webgl2/include/Normal.glsl +1 -1
  197. package/src/assets/shaders/webgl2/include/Particle.glsl +36 -0
  198. package/src/assets/shaders/webgl2/include/Texture.glsl +3 -3
  199. package/src/example.html +6 -6
  200. package/src/examples.js +5 -4
  201. package/src/standard/Math/Algorithm.js +12 -28
  202. package/src/standard/Math/Geometry/Line2.js +163 -0
  203. package/src/standard/Math/Geometry/Line3.js +3 -5
  204. package/src/standard/Math/Geometry/Plane3.js +0 -2
  205. package/src/standard/Math/Geometry/Triangle3.js +1 -1
  206. package/src/standard/Math/Geometry/ViewVolume.js +121 -103
  207. package/src/standard/Math/Numbers/Color3.js +6 -0
  208. package/src/standard/Math/Numbers/Color4.js +7 -0
  209. package/src/standard/Math/Numbers/Complex.js +48 -34
  210. package/src/standard/Math/Numbers/Matrix2.js +62 -2
  211. package/src/standard/Math/Numbers/Matrix3.js +129 -110
  212. package/src/standard/Math/Numbers/Matrix4.js +138 -119
  213. package/src/standard/Math/Numbers/Quaternion.js +12 -5
  214. package/src/standard/Math/Numbers/Rotation4.js +8 -1
  215. package/src/standard/Math/Numbers/Vector2.js +42 -9
  216. package/src/standard/Math/Numbers/Vector3.js +50 -14
  217. package/src/standard/Math/Numbers/Vector4.js +48 -11
  218. package/src/standard/Math/Utility/BVH.js +45 -17
  219. package/src/tests.js +68 -66
  220. package/src/x_ite/Base/X3DBaseNode.js +22 -11
  221. package/src/x_ite/Base/X3DField.js +1 -1
  222. package/src/x_ite/Browser/Core/BrowserOptions.js +24 -143
  223. package/src/x_ite/Browser/Core/BrowserTimings.js +6 -4
  224. package/src/x_ite/Browser/Core/Context.js +185 -0
  225. package/src/x_ite/Browser/Core/ContextMenu.js +398 -211
  226. package/src/x_ite/Browser/Core/Notification.js +1 -0
  227. package/src/x_ite/Browser/Core/X3DCoreContext.js +35 -146
  228. package/src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +1 -1
  229. package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +1 -0
  230. package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +2 -2
  231. package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +41 -2
  232. package/src/x_ite/Browser/Geospatial/Geocentric.js +2 -2
  233. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +1 -1
  234. package/src/x_ite/Browser/Layout/ScreenText.js +18 -65
  235. package/src/x_ite/Browser/Layout/X3DLayoutContext.js +59 -16
  236. package/src/x_ite/Browser/Navigation/ExamineViewer.js +13 -20
  237. package/src/x_ite/Browser/Navigation/LookAtViewer.js +1 -4
  238. package/src/x_ite/Browser/Navigation/PlaneViewer.js +0 -3
  239. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +15 -8
  240. package/src/x_ite/Browser/Navigation/X3DViewer.js +12 -20
  241. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +11 -7
  242. package/src/x_ite/Browser/ParticleSystems/BVH.glsl +183 -0
  243. package/src/x_ite/Browser/ParticleSystems/Box3.glsl +47 -0
  244. package/src/x_ite/Browser/ParticleSystems/GeometryTypes.js +66 -0
  245. package/src/x_ite/Browser/ParticleSystems/Line3.glsl +55 -0
  246. package/src/x_ite/Browser/ParticleSystems/Plane3.glsl +160 -0
  247. package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +27 -3
  248. package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +41 -37
  249. package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +21 -13
  250. package/src/x_ite/Browser/Shaders/Shader.js +33 -12
  251. package/src/x_ite/Browser/Shaders/ShaderSource.js +6 -0
  252. package/src/x_ite/Browser/Shaders/ShaderTest.js +16 -10
  253. package/src/x_ite/Browser/Shape/X3DShapeContext.js +50 -9
  254. package/src/x_ite/Browser/Text/X3DTextContext.js +4 -13
  255. package/src/x_ite/Browser/Text/X3DTextGeometry.js +2 -1
  256. package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +71 -34
  257. package/src/x_ite/Browser/Texturing3D/DICOMParser.js +2 -2
  258. package/src/x_ite/Browser/Time/X3DTimeContext.js +4 -2
  259. package/src/x_ite/Browser/VERSION.js +1 -1
  260. package/src/x_ite/Browser/X3DBrowser.js +7 -6
  261. package/src/x_ite/Browser/X3DBrowserContext.js +43 -10
  262. package/src/x_ite/Components/Core/X3DNode.js +4 -0
  263. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +0 -2
  264. package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +3 -4
  265. package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +1 -12
  266. package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +1 -2
  267. package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +1 -1
  268. package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +76 -77
  269. package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +2 -9
  270. package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +51 -65
  271. package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +1 -1
  272. package/src/x_ite/Components/Followers/ColorDamper.js +1 -1
  273. package/src/x_ite/Components/Followers/X3DChaserNode.js +18 -32
  274. package/src/x_ite/Components/Followers/X3DDamperNode.js +1 -6
  275. package/src/x_ite/Components/Followers/X3DFollowerNode.js +1 -1
  276. package/src/x_ite/Components/Geometry2D/Disk2D.js +30 -46
  277. package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +1 -1
  278. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +12 -4
  279. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +4 -4
  280. package/src/x_ite/Components/Geospatial/GeoCoordinate.js +10 -27
  281. package/src/x_ite/Components/Geospatial/GeoLOD.js +1 -1
  282. package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +5 -10
  283. package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +9 -16
  284. package/src/x_ite/Components/Geospatial/GeoTransform.js +6 -18
  285. package/src/x_ite/Components/Geospatial/GeoViewpoint.js +26 -30
  286. package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +20 -27
  287. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +8 -8
  288. package/src/x_ite/Components/Grouping/X3DTransformNode.js +0 -4
  289. package/src/x_ite/Components/HAnim/HAnimHumanoid.js +68 -75
  290. package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +4 -11
  291. package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +1 -1
  292. package/src/x_ite/Components/Layout/LayoutGroup.js +4 -9
  293. package/src/x_ite/Components/Layout/ScreenFontStyle.js +1 -1
  294. package/src/x_ite/Components/Layout/ScreenGroup.js +16 -80
  295. package/src/x_ite/Components/Lighting/DirectionalLight.js +28 -36
  296. package/src/x_ite/Components/Lighting/PointLight.js +32 -47
  297. package/src/x_ite/Components/Lighting/SpotLight.js +33 -48
  298. package/src/x_ite/Components/Navigation/Billboard.js +49 -56
  299. package/src/x_ite/Components/Navigation/LOD.js +2 -2
  300. package/src/x_ite/Components/Navigation/OrthoViewpoint.js +29 -30
  301. package/src/x_ite/Components/Navigation/Viewpoint.js +16 -20
  302. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +82 -111
  303. package/src/x_ite/Components/Networking/Anchor.js +18 -7
  304. package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -6
  305. package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +44 -36
  306. package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +26 -17
  307. package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +20 -7
  308. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +463 -882
  309. package/src/x_ite/Components/ParticleSystems/PointEmitter.js +39 -35
  310. package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +112 -128
  311. package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +105 -112
  312. package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +138 -176
  313. package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +16 -11
  314. package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +807 -217
  315. package/src/x_ite/Components/Picking/LinePickSensor.js +31 -39
  316. package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +91 -108
  317. package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +56 -59
  318. package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +54 -71
  319. package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +8 -15
  320. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +43 -50
  321. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +32 -39
  322. package/src/x_ite/Components/Rendering/ClipPlane.js +3 -11
  323. package/src/x_ite/Components/Rendering/Color.js +12 -24
  324. package/src/x_ite/Components/Rendering/ColorRGBA.js +13 -25
  325. package/src/x_ite/Components/Rendering/IndexedLineSet.js +26 -4
  326. package/src/x_ite/Components/Rendering/LineSet.js +35 -13
  327. package/src/x_ite/Components/Rendering/PointSet.js +35 -13
  328. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +13 -5
  329. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +331 -387
  330. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +350 -140
  331. package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +116 -126
  332. package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +24 -38
  333. package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +10 -17
  334. package/src/x_ite/Components/Shaders/ComposedShader.js +35 -75
  335. package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +8 -11
  336. package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +10 -14
  337. package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +10 -14
  338. package/src/x_ite/Components/Shaders/ShaderPart.js +1 -10
  339. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +220 -210
  340. package/src/x_ite/Components/Shaders/X3DShaderNode.js +28 -10
  341. package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +15 -1
  342. package/src/x_ite/Components/Shape/Appearance.js +37 -4
  343. package/src/x_ite/Components/Shape/FillProperties.js +12 -1
  344. package/src/x_ite/Components/Shape/LineProperties.js +33 -1
  345. package/src/x_ite/Components/Shape/PointProperties.js +24 -3
  346. package/src/x_ite/Components/Shape/Shape.js +30 -39
  347. package/src/x_ite/Components/Shape/TwoSidedMaterial.js +3 -1
  348. package/src/x_ite/Components/Sound/Sound.js +31 -41
  349. package/src/x_ite/Components/Text/Text.js +6 -20
  350. package/src/x_ite/Components/Texturing/ImageTexture.js +1 -1
  351. package/src/x_ite/Components/Texturing/MovieTexture.js +1 -1
  352. package/src/x_ite/Components/Texturing/PixelTexture.js +2 -2
  353. package/src/x_ite/Components/Texturing/TextureCoordinate.js +5 -5
  354. package/src/x_ite/Components/Texturing/TextureProperties.js +4 -4
  355. package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +5 -4
  356. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +24 -33
  357. package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +5 -5
  358. package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +5 -5
  359. package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +12 -19
  360. package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +8 -8
  361. package/src/x_ite/Components.js +2 -2
  362. package/src/x_ite/Fallback.js +9 -3
  363. package/src/x_ite/Fields/SFColor.js +4 -0
  364. package/src/x_ite/Fields/SFColorRGBA.js +4 -0
  365. package/src/x_ite/Fields/SFImage.js +2 -11
  366. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +4 -0
  367. package/src/x_ite/Fields/SFRotation.js +4 -0
  368. package/src/x_ite/Fields/SFString.js +4 -0
  369. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +22 -2
  370. package/src/x_ite/Parser/XMLParser.js +1 -1
  371. package/src/x_ite/Rendering/TextureBuffer.js +43 -36
  372. package/src/x_ite/Rendering/VertexArray.js +103 -0
  373. package/src/x_ite/Rendering/X3DRenderObject.js +127 -148
  374. package/src/x_ite/X3D.js +32 -26
  375. package/src/x_ite.config.js +0 -5
  376. package/src/x_ite.css +216 -175
  377. package/src/x_ite.html +15 -10
  378. package/src/x_ite.js +49 -1
  379. package/x_ite.min.html +15 -10
  380. package/dist/assets/hatching/0.png +0 -0
  381. package/dist/assets/linetype/0.png +0 -0
  382. package/src/assets/hatching/0.png +0 -0
  383. package/src/assets/linetype/0.png +0 -0
  384. package/src/spinner.css +0 -67
  385. package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
@@ -4,1272 +4,9 @@
4
4
  var module = { }, exports, process;
5
5
 
6
6
  const
7
- define = window [Symbol .for ("X_ITE.X3D-5.0.3")] .define,
8
- require = window [Symbol .for ("X_ITE.X3D-5.0.3")] .require;
9
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
10
- *******************************************************************************
11
- *
12
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13
- *
14
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
15
- *
16
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
17
- *
18
- * The copyright notice above does not evidence any actual of intended
19
- * publication of such source code, and is an unpublished work by create3000.
20
- * This material contains CONFIDENTIAL INFORMATION that is the property of
21
- * create3000.
22
- *
23
- * No permission is granted to copy, distribute, or create derivative works from
24
- * the contents of this software, in whole or in part, without the prior written
25
- * permission of create3000.
26
- *
27
- * NON-MILITARY USE ONLY
28
- *
29
- * All create3000 software are effectively free software with a non-military use
30
- * restriction. It is free. Well commented source is provided. You may reuse the
31
- * source in any way you please with the exception anything that uses it must be
32
- * marked to indicate is contains 'non-military use only' components.
33
- *
34
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35
- *
36
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
37
- *
38
- * This file is part of the X_ITE Project.
39
- *
40
- * X_ITE is free software: you can redistribute it and/or modify it under the
41
- * terms of the GNU General Public License version 3 only, as published by the
42
- * Free Software Foundation.
43
- *
44
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
45
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
46
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
47
- * details (a copy is included in the LICENSE file that accompanied this code).
48
- *
49
- * You should have received a copy of the GNU General Public License version 3
50
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
51
- * copy of the GPLv3 License.
52
- *
53
- * For Silvio, Joy and Adi.
54
- *
55
- ******************************************************************************/
56
-
57
-
58
- define ('standard/Math/Geometry/Spheroid3',[],function ()
59
- {
60
- "use strict";
61
-
62
- function Spheroid3 (semiMajorAxis, semiMinorAxis)
63
- {
64
- switch (arguments .length)
65
- {
66
- case 0:
67
- this .semiMajorAxis = 0; // a
68
- this .semiMinorAxis = 0; // c
69
- break;
70
- case 2:
71
- this .semiMajorAxis = semiMajorAxis; // a
72
- this .semiMinorAxis = semiMinorAxis; // c
73
- break;
74
- case 3:
75
- const f_1 = arguments [1];
76
- this .semiMajorAxis = semiMajorAxis; // a
77
- this .semiMinorAxis = semiMajorAxis * (1 - 1 / f_1); // c
78
- break;
79
- }
80
- }
81
-
82
- Spheroid3 .prototype =
83
- {
84
- constructor: Spheroid3,
85
- getSemiMajorAxis: function ()
86
- {
87
- // Returns the semi-major axis (a)
88
- return this .semiMajorAxis; // a
89
- },
90
- getSemiMinorAxis: function ()
91
- {
92
- // Returns the semi-minor axis (c)
93
- return this .semiMinorAxis; // c
94
- },
95
- toString: function ()
96
- {
97
- return this .semiMajorAxis + " " + this .semiMinorAxis;
98
- },
99
- };
100
-
101
- return Spheroid3;
102
- });
103
-
104
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
105
- *******************************************************************************
106
- *
107
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
108
- *
109
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
110
- *
111
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
112
- *
113
- * The copyright notice above does not evidence any actual of intended
114
- * publication of such source code, and is an unpublished work by create3000.
115
- * This material contains CONFIDENTIAL INFORMATION that is the property of
116
- * create3000.
117
- *
118
- * No permission is granted to copy, distribute, or create derivative works from
119
- * the contents of this software, in whole or in part, without the prior written
120
- * permission of create3000.
121
- *
122
- * NON-MILITARY USE ONLY
123
- *
124
- * All create3000 software are effectively free software with a non-military use
125
- * restriction. It is free. Well commented source is provided. You may reuse the
126
- * source in any way you please with the exception anything that uses it must be
127
- * marked to indicate is contains 'non-military use only' components.
128
- *
129
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
130
- *
131
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
132
- *
133
- * This file is part of the X_ITE Project.
134
- *
135
- * X_ITE is free software: you can redistribute it and/or modify it under the
136
- * terms of the GNU General Public License version 3 only, as published by the
137
- * Free Software Foundation.
138
- *
139
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
140
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
141
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
142
- * details (a copy is included in the LICENSE file that accompanied this code).
143
- *
144
- * You should have received a copy of the GNU General Public License version 3
145
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
146
- * copy of the GPLv3 License.
147
- *
148
- * For Silvio, Joy and Adi.
149
- *
150
- ******************************************************************************/
151
-
152
-
153
- define ('standard/Geospatial/ReferenceEllipsoids',[
154
- "standard/Math/Geometry/Spheroid3",
155
- ],
156
- function (Spheroid3)
157
- {
158
- "use strict";
159
-
160
- const ReferenceEllipsoids =
161
- {
162
- // Earth
163
- // X3D Specification
164
- AA: new Spheroid3 (6377563.396, 299.3249646, true), // Airy 1830
165
- AM: new Spheroid3 (6377340.189, 299.3249646, true), // Modified Airy
166
- AN: new Spheroid3 (6378160, 298.25, true), // Australian National
167
- BN: new Spheroid3 (6377483.865, 299.1528128, true), // Bessel 1841 (Namibia)
168
- BR: new Spheroid3 (6377397.155, 299.1528128, true), // Bessel 1841 (Ethiopia Indonesia...)
169
- CC: new Spheroid3 (6378206.4, 294.9786982, true), // Clarke 1866
170
- CD: new Spheroid3 (6378249.145, 293.465, true), // Clarke 1880
171
- EA: new Spheroid3 (6377276.345, 300.8017, true), // Everest (India 1830)
172
- EB: new Spheroid3 (6377298.556, 300.8017, true), // Everest (Sabah & Sarawak)
173
- EC: new Spheroid3 (6377301.243, 300.8017, true), // Everest (India 1956)
174
- ED: new Spheroid3 (6377295.664, 300.8017, true), // Everest (W. Malaysia 1969)
175
- EE: new Spheroid3 (6377304.063, 300.8017, true), // Everest (W. Malaysia & Singapore 1948)
176
- EF: new Spheroid3 (6377309.613, 300.8017, true), // Everest (Pakistan)
177
- FA: new Spheroid3 (6378155, 298.3, true), // Modified Fischer 1960
178
- HE: new Spheroid3 (6378200, 298.3, true), // Helmert 1906
179
- HO: new Spheroid3 (6378270, 297, true), // Hough 1960
180
- ID: new Spheroid3 (6378160, 298.247, true), // Indonesian 1974
181
- IN: new Spheroid3 (6378388, 297, true), // International 1924
182
- KA: new Spheroid3 (6378245, 298.3, true), // Krassovsky 1940
183
- RF: new Spheroid3 (6378137, 298.257222101, true), // Geodetic Reference System 1980 (GRS 80)
184
- SA: new Spheroid3 (6378160, 298.25, true), // South American 1969
185
- WD: new Spheroid3 (6378135, 298.26, true), // WGS 72
186
- WE: new Spheroid3 (6378137, 298.257223563, true), // WGS 84
187
- // Solar System
188
- // http://en.wikipedia.de
189
- // Can someone give me more accurate parameters.
190
- SUN: new Spheroid3 (696342000, 1 / 9e-6, true),
191
- MERCURY: new Spheroid3 (2439700, 2439700),
192
- VENUS: new Spheroid3 (6051800, 6051800),
193
- MOON: new Spheroid3 (1738140, 1735970),
194
- MARS: new Spheroid3 (3395428, 3377678), // http://adsabs.harvard.edu/abs/2010EM%26P..106....1A
195
- JUPITER: new Spheroid3 (71492000, 66854000),
196
- SATURN: new Spheroid3 (60268000, 54364000),
197
- URANUS: new Spheroid3 (2555000, 24973000),
198
- NEPTUNE: new Spheroid3 (24764000, 24341000),
199
- PLUTO: new Spheroid3 (1153000, 1153000),
200
- };
201
-
202
- return ReferenceEllipsoids;
203
- });
204
-
205
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
206
- *******************************************************************************
207
- *
208
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
209
- *
210
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
211
- *
212
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
213
- *
214
- * The copyright notice above does not evidence any actual of intended
215
- * publication of such source code, and is an unpublished work by create3000.
216
- * This material contains CONFIDENTIAL INFORMATION that is the property of
217
- * create3000.
218
- *
219
- * No permission is granted to copy, distribute, or create derivative works from
220
- * the contents of this software, in whole or in part, without the prior written
221
- * permission of create3000.
222
- *
223
- * NON-MILITARY USE ONLY
224
- *
225
- * All create3000 software are effectively free software with a non-military use
226
- * restriction. It is free. Well commented source is provided. You may reuse the
227
- * source in any way you please with the exception anything that uses it must be
228
- * marked to indicate is contains 'non-military use only' components.
229
- *
230
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
231
- *
232
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
233
- *
234
- * This file is part of the X_ITE Project.
235
- *
236
- * X_ITE is free software: you can redistribute it and/or modify it under the
237
- * terms of the GNU General Public License version 3 only, as published by the
238
- * Free Software Foundation.
239
- *
240
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
241
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
242
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
243
- * details (a copy is included in the LICENSE file that accompanied this code).
244
- *
245
- * You should have received a copy of the GNU General Public License version 3
246
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
247
- * copy of the GPLv3 License.
248
- *
249
- * For Silvio, Joy and Adi.
250
- *
251
- ******************************************************************************/
252
-
253
-
254
- define ('standard/Geospatial/Geodetic',[
255
- "standard/Math/Numbers/Vector3",
256
- "standard/Math/Algorithm",
257
- ],
258
- function (Vector3,
259
- Algorithm)
260
- {
261
- "use strict";
262
-
263
- const
264
- EPS_H = 1e-3,
265
- EPS_P = 1e-10,
266
- IMAX = 30;
267
-
268
- function Geodetic (spheroid, latitudeFirst, radians)
269
- {
270
- this .longitudeFirst = ! latitudeFirst;
271
- this .degrees = ! radians;
272
- this .a = spheroid .getSemiMajorAxis ();
273
- this .c = spheroid .getSemiMinorAxis ();
274
- this .c2a2 = Math .pow (spheroid .getSemiMinorAxis () / this .a, 2);
275
- this .ecc2 = 1 - this .c2a2;
276
- }
277
-
278
- Geodetic .prototype =
279
- {
280
- constructor: Geodetic,
281
- convert: function (geodetic, result)
282
- {
283
- const elevation = geodetic .z;
284
-
285
- if (this .longitudeFirst)
286
- {
287
- var
288
- latitude = geodetic .y,
289
- longitude = geodetic .x;
290
- }
291
- else
292
- {
293
- var
294
- latitude = geodetic .x,
295
- longitude = geodetic .y;
296
- }
297
-
298
- if (this .degrees)
299
- {
300
- latitude *= Math .PI / 180;
301
- longitude *= Math .PI / 180;
302
- }
303
-
304
- return this .convertRadians (latitude, longitude, elevation, result);
305
- },
306
- convertRadians: function (latitude, longitude, elevation, result)
307
- {
308
- const
309
- slat = Math .sin (latitude),
310
- slat2 = Math .pow (slat, 2),
311
- clat = Math .cos (latitude),
312
- N = this .a / Math .sqrt (1 - this .ecc2 * slat2),
313
- Nhl = (N + elevation) * clat;
314
-
315
- return result .set (Nhl * Math .cos (longitude),
316
- Nhl * Math .sin (longitude),
317
- (N * this .c2a2 + elevation) * slat);
318
- },
319
- apply: function (geocentric, result)
320
- {
321
- this .applyRadians (geocentric, result);
322
-
323
- if (this .degrees)
324
- {
325
- result .x *= 180 / Math .PI; // latitude
326
- result .y *= 180 / Math .PI; // longitude
327
- }
328
-
329
- if (this .longitudeFirst)
330
- {
331
- const tmp = result .x;
332
-
333
- result .x = result .y; // latitude
334
- result .y = tmp; // longitude
335
- }
336
-
337
- return result;
338
- },
339
- applyRadians: function (geocentric, result)
340
- {
341
- const
342
- x = geocentric .x,
343
- y = geocentric .y,
344
- z = geocentric .z;
345
-
346
- const P = Math .sqrt (x * x + y * y);
347
-
348
- // Handle pole case.
349
- if (P == 0)
350
- return result .set (Math .PI, 0, z - this .c);
351
-
352
- let
353
- latitude = 0,
354
- longitude = Math .atan2 (y, x),
355
- elevation = 0;
356
-
357
- let
358
- a = this .a,
359
- N = a,
360
- ecc2 = this .ecc2;
361
-
362
- for (let i = 0; i < IMAX; ++ i)
363
- {
364
- const
365
- h0 = elevation,
366
- b0 = latitude;
367
-
368
- latitude = Math .atan (z / P / (1 - ecc2 * N / (N + elevation)));
369
-
370
- const sin_p = Math .sin (latitude);
371
-
372
- N = a / Math .sqrt (1 - ecc2 * sin_p * sin_p);
373
- elevation = P / Math .cos (latitude) - N;
374
-
375
- if (Math .abs (elevation - h0) < EPS_H && Math .abs (latitude - b0) < EPS_P)
376
- break;
377
- }
378
-
379
- return result .set (latitude, longitude, elevation);
380
- },
381
- normal: function (geocentric, result)
382
- {
383
- const geodetic = this .applyRadians (geocentric, result);
384
-
385
- const
386
- latitude = geodetic .x,
387
- longitude = geodetic .y;
388
-
389
- const clat = Math .cos (latitude);
390
-
391
- const
392
- nx = Math .cos (longitude) * clat,
393
- ny = Math .sin (longitude) * clat,
394
- nz = Math .sin (latitude);
395
-
396
- return result .set (nx, ny, nz);
397
- },
398
- /*
399
- lerp: function (s, d, t)
400
- {
401
- var
402
- source = this .source .assign (s),
403
- destination = this .destination .assign (d);
404
-
405
- var
406
- RANGE = this .degrees ? 180 : M_PI,
407
- RANGE1_2 = RANGE / 2,
408
- RANGE2 = RANGE * 2;
409
-
410
- var range = 0;
411
-
412
- if (this .longitudeFirst)
413
- {
414
- source .x = Algorithm .interval (source .x, -RANGE, RANGE);
415
- source .y = Algorithm .interval (source .y, -RANGE1_2, RANGE1_2);
416
-
417
- destination .x = Algorithm .interval (destination .x, -RANGE, RANGE);
418
- destination .y = Algorithm .interval (destination .y, -RANGE1_2, RANGE1_2);
419
-
420
- range = Math .abs (destination .x - source .x);
421
- }
422
- else
423
- {
424
- source .x = Algorithm .interval (source .x, -RANGE1_2, RANGE1_2);
425
- source .y = Algorithm .interval (source .y, -RANGE, RANGE);
426
-
427
- destination .x = Algorithm .interval (destination .x, -RANGE1_2, RANGE1_2);
428
- destination .y = Algorithm .interval (destination .y, -RANGE, RANGE);
429
-
430
- range = Math .abs (destination .y - source .y);
431
- }
432
-
433
- if (range <= RANGE)
434
- return source .lerp (destination, t);
435
-
436
- var step = (RANGE2 - range) * t;
437
-
438
- if (this .longitudeFirst)
439
- {
440
- var longitude = source .x < destination .x ? source .x - step : source .x + step;
441
-
442
- if (longitude < -RANGE)
443
- longitude += RANGE2;
444
-
445
- else if (longitude > RANGE)
446
- longitude -= RANGE2;
447
-
448
- return source .set (longitude,
449
- source .y + t * (destination .y - source .y),
450
- source .z + t * (destination .z - source .z));
451
- }
452
-
453
- var longitude = source .y < destination .y ? source .y - step : source .y + step;
454
-
455
- if (longitude < -RANGE)
456
- longitude += RANGE2;
457
-
458
- else if (longitude > RANGE)
459
- longitude -= RANGE2;
460
-
461
- return source .set (source .x + t * (destination .x - source .x),
462
- longitude,
463
- source .z + t * (destination .z - source .z));
464
- },
465
- source: new Vector3 (0, 0, 0),
466
- destination: new Vector3 (0, 0, 0),
467
- */
468
- };
469
-
470
- return Geodetic;
471
- });
472
-
473
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
474
- *******************************************************************************
475
- *
476
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
477
- *
478
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
479
- *
480
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
481
- *
482
- * The copyright notice above does not evidence any actual of intended
483
- * publication of such source code, and is an unpublished work by create3000.
484
- * This material contains CONFIDENTIAL INFORMATION that is the property of
485
- * create3000.
486
- *
487
- * No permission is granted to copy, distribute, or create derivative works from
488
- * the contents of this software, in whole or in part, without the prior written
489
- * permission of create3000.
490
- *
491
- * NON-MILITARY USE ONLY
492
- *
493
- * All create3000 software are effectively free software with a non-military use
494
- * restriction. It is free. Well commented source is provided. You may reuse the
495
- * source in any way you please with the exception anything that uses it must be
496
- * marked to indicate is contains 'non-military use only' components.
497
- *
498
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
499
- *
500
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
501
- *
502
- * This file is part of the X_ITE Project.
503
- *
504
- * X_ITE is free software: you can redistribute it and/or modify it under the
505
- * terms of the GNU General Public License version 3 only, as published by the
506
- * Free Software Foundation.
507
- *
508
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
509
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
510
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
511
- * details (a copy is included in the LICENSE file that accompanied this code).
512
- *
513
- * You should have received a copy of the GNU General Public License version 3
514
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
515
- * copy of the GPLv3 License.
516
- *
517
- * For Silvio, Joy and Adi.
518
- *
519
- ******************************************************************************/
520
-
521
-
522
- define ('standard/Geospatial/UniversalTransverseMercator',[
523
- "standard/Geospatial/Geodetic",
524
- "standard/Math/Numbers/Vector3",
525
- "standard/Math/Algorithm",
526
- ],
527
- function (Geodetic,
528
- Vector3,
529
- Algorithm)
530
- {
531
- "use strict";
532
-
533
- const
534
- N0 = 1.0e7,
535
- E0 = 5.0e5,
536
- k0 = 0.9996;
537
-
538
- function UniversalTransverseMercator (spheroid, zone, northernHemisphere, northingFirst)
539
- {
540
- const
541
- a = spheroid .getSemiMajorAxis (),
542
- ecc2 = 1 - Math .pow (spheroid .getSemiMinorAxis () / a, 2),
543
- EE = ecc2 / (1 - ecc2),
544
- e1 = (1 - Math .sqrt (1 - ecc2)) / (1 + Math .sqrt (1 - ecc2));
545
-
546
- this .southernHemisphere = ! northernHemisphere;
547
- this .eastingFirst = ! northingFirst;
548
- this .a = a;
549
- this .ecc2 = ecc2;
550
- this .EE = EE;
551
- this .E8 = 8 * EE;
552
- this .E9 = 9 * EE;
553
- this .E252 = 252 * EE;
554
- this .e1 = e1;
555
- this .A = k0 * (a * (1 - ecc2 / 4 - 3 * ecc2 * ecc2 / 64 - 5 * ecc2 * ecc2 * ecc2 / 256));
556
- this .B = 3 * e1 / 2 - 7 * e1 * e1 * e1 / 32;
557
- this .C = 21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32;
558
- this .D = 151 * e1 * e1 * e1 / 96;
559
- this .E = a * (1 - ecc2);
560
- this .W = 1 - ecc2 / 4 - 3 * ecc2 * ecc2 / 64 - 5 * ecc2 * ecc2 * ecc2 / 256;
561
- this .X = 3 * ecc2 / 8 + 3 * ecc2 * ecc2 / 32 + 45 * ecc2 * ecc2 * ecc2 / 1024;
562
- this .Y = 15 * ecc2 * ecc2 / 256 + 45 * ecc2 * ecc2 * ecc2 / 1024;
563
- this .Z = 35 * ecc2 * ecc2 * ecc2 / 3072;
564
- this .longitude0 = Algorithm .radians (zone * 6 - 183);
565
- this .geodeticConverter = new Geodetic (spheroid, true, true);
566
- }
567
-
568
- UniversalTransverseMercator .prototype =
569
- {
570
- constructor: UniversalTransverseMercator,
571
- convert: function (utm, result)
572
- {
573
- // https://gist.github.com/duedal/840476
574
-
575
- if (this .eastingFirst)
576
- {
577
- var
578
- northing = utm .y,
579
- easting = utm .x;
580
- }
581
- else
582
- {
583
- var
584
- northing = utm .x,
585
- easting = utm .y;
586
- }
587
-
588
- // Check for southern hemisphere and remove offset from easting.
589
-
590
- let S = this .southernHemisphere;
591
-
592
- if (northing < 0)
593
- {
594
- S = ! this .southernHemisphere;
595
- northing = -northing;
596
- }
597
-
598
- if (S)
599
- northing -= N0;
600
-
601
- easting -= E0;
602
-
603
- // Begin calculation.
604
-
605
- const
606
- mu = northing / this .A,
607
- phi1 = mu + this .B * Math .sin (2 * mu) + this .C * Math .sin (4 * mu) + this .D * Math .sin (6 * mu);
608
-
609
- const
610
- sinphi1 = Math .pow (Math .sin (phi1), 2),
611
- cosphi1 = Math .cos (phi1),
612
- tanphi1 = Math .tan (phi1);
613
-
614
- const
615
- N1 = this .a / Math .sqrt (1 - this .ecc2 * sinphi1),
616
- T2 = Math .pow (tanphi1, 2),
617
- T8 = Math .pow (tanphi1, 8),
618
- C1 = this .EE * T2,
619
- C2 = C1 * C1,
620
- R1 = this .E / Math .pow (1 - this .ecc2 * sinphi1, 1.5),
621
- I = easting / (N1 * k0);
622
-
623
- const
624
- J = (5 + 3 * T2 + 10 * C1 - 4 * C2 - this .E9) * Math .pow (I, 4) / 24,
625
- K = (61 + 90 * T2 + 298 * C1 + 45 * T8 - this .E252 - 3 * C2) * Math .pow (I, 6) / 720,
626
- L = (5 - 2 * C1 + 28 * T2 - 3 * C2 + this .E8 + 24 * T8) * Math .pow (I, 5) / 120;
627
-
628
- const
629
- latitude = phi1 - (N1 * tanphi1 / R1) * (I * I / 2 - J + K),
630
- longitude = this .longitude0 + (I - (1 + 2 * T2 + C1) * Math .pow (I, 3) / 6 + L) / cosphi1;
631
-
632
- return this .geodeticConverter .convertRadians (latitude, longitude, utm .z, result);
633
- },
634
- apply: function (geocentric, result)
635
- {
636
- // https://gist.github.com/duedal/840476
637
-
638
- const
639
- geodetic = this .geodeticConverter .applyRadians (geocentric, result),
640
- latitude = geodetic .x,
641
- longitude = geodetic .y;
642
-
643
- const
644
- tanlat = Math .tan (latitude),
645
- coslat = Math .cos (latitude);
646
-
647
- const
648
- EE = this .EE,
649
- N = this .a / Math .sqrt (1 - this .ecc2 * Math .pow (Math .sin (latitude), 2)),
650
- T = tanlat * tanlat,
651
- T6 = T * T * T,
652
- C = EE * coslat * coslat,
653
- A = coslat * (longitude - this .longitude0);
654
-
655
- const M = this .a * (this .W * latitude
656
- - this .X * Math .sin (2 * latitude)
657
- + this .Y * Math .sin (4 * latitude)
658
- - this .Z * Math .sin (6 * latitude));
659
-
660
- const easting = k0 * N * (A + (1 - T + C) * Math .pow (A, 3) / 6
661
- + (5 - 18 * T6 + 72 * C - 58 * EE) * Math .pow (A, 5) / 120)
662
- + E0;
663
-
664
- let northing = k0 * (M + N * tanlat * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * Math .pow (A, 4) / 24
665
- + (61 - 58 * T6 + 600 * C - 330 * EE) * Math .pow (A, 6) / 720));
666
-
667
- if (latitude < 0)
668
- {
669
- northing += N0;
670
-
671
- if (! this .southernHemisphere)
672
- northing = -northing;
673
- }
674
- else
675
- {
676
- if (this .southernHemisphere)
677
- northing = -northing;
678
- }
679
-
680
- if (this .eastingFirst)
681
- return result .set (easting, northing, geodetic .z);
682
-
683
- return result .set (northing, easting, geodetic .z);
684
- },
685
- //lerp: Vector3 .lerp,
686
- };
687
-
688
- return UniversalTransverseMercator;
689
- });
690
-
691
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
692
- *******************************************************************************
693
- *
694
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
695
- *
696
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
697
- *
698
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
699
- *
700
- * The copyright notice above does not evidence any actual of intended
701
- * publication of such source code, and is an unpublished work by create3000.
702
- * This material contains CONFIDENTIAL INFORMATION that is the property of
703
- * create3000.
704
- *
705
- * No permission is granted to copy, distribute, or create derivative works from
706
- * the contents of this software, in whole or in part, without the prior written
707
- * permission of create3000.
708
- *
709
- * NON-MILITARY USE ONLY
710
- *
711
- * All create3000 software are effectively free software with a non-military use
712
- * restriction. It is free. Well commented source is provided. You may reuse the
713
- * source in any way you please with the exception anything that uses it must be
714
- * marked to indicate is contains 'non-military use only' components.
715
- *
716
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
717
- *
718
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
719
- *
720
- * This file is part of the X_ITE Project.
721
- *
722
- * X_ITE is free software: you can redistribute it and/or modify it under the
723
- * terms of the GNU General Public License version 3 only, as published by the
724
- * Free Software Foundation.
725
- *
726
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
727
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
728
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
729
- * details (a copy is included in the LICENSE file that accompanied this code).
730
- *
731
- * You should have received a copy of the GNU General Public License version 3
732
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
733
- * copy of the GPLv3 License.
734
- *
735
- * For Silvio, Joy and Adi.
736
- *
737
- ******************************************************************************/
738
-
739
-
740
- define ('x_ite/Browser/Geospatial/Geocentric',[
741
- "standard/Math/Numbers/Vector3",
742
- "standard/Math/Algorithm",
743
- ],
744
- function (Vector3,
745
- Algorithm)
746
- {
747
- "use strict";
748
-
749
- function Geocentric () { }
750
-
751
- Geocentric .prototype =
752
- {
753
- constructor: Geocentric,
754
- convert: function (geocentric, result)
755
- {
756
- return result .assign (geocentric);
757
- },
758
- apply: function (geocentric, result)
759
- {
760
- return result .assign (geocentric);
761
- },
762
- slerp: function (source, destination, t)
763
- {
764
- const
765
- sourceLength = source .abs (),
766
- destinationLength = destination .abs ();
767
-
768
- source .normalize ();
769
- destination .normalize ();
770
-
771
- return Algorithm .simpleSlerp (source, destination, t) .multiply (Algorithm .lerp (sourceLength, destinationLength, t));
772
- },
773
- };
774
-
775
- return Geocentric;
776
- });
777
-
778
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
779
- *******************************************************************************
780
- *
781
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
782
- *
783
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
784
- *
785
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
786
- *
787
- * The copyright notice above does not evidence any actual of intended
788
- * publication of such source code, and is an unpublished work by create3000.
789
- * This material contains CONFIDENTIAL INFORMATION that is the property of
790
- * create3000.
791
- *
792
- * No permission is granted to copy, distribute, or create derivative works from
793
- * the contents of this software, in whole or in part, without the prior written
794
- * permission of create3000.
795
- *
796
- * NON-MILITARY USE ONLY
797
- *
798
- * All create3000 software are effectively free software with a non-military use
799
- * restriction. It is free. Well commented source is provided. You may reuse the
800
- * source in any way you please with the exception anything that uses it must be
801
- * marked to indicate is contains 'non-military use only' components.
802
- *
803
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
804
- *
805
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
806
- *
807
- * This file is part of the X_ITE Project.
808
- *
809
- * X_ITE is free software: you can redistribute it and/or modify it under the
810
- * terms of the GNU General Public License version 3 only, as published by the
811
- * Free Software Foundation.
812
- *
813
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
814
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
815
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
816
- * details (a copy is included in the LICENSE file that accompanied this code).
817
- *
818
- * You should have received a copy of the GNU General Public License version 3
819
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
820
- * copy of the GPLv3 License.
821
- *
822
- * For Silvio, Joy and Adi.
823
- *
824
- ******************************************************************************/
825
-
826
-
827
- define ('x_ite/Browser/Geospatial/Geospatial',[
828
- "standard/Geospatial/ReferenceEllipsoids",
829
- "standard/Geospatial/Geodetic",
830
- "standard/Geospatial/UniversalTransverseMercator",
831
- "x_ite/Browser/Geospatial/Geocentric",
832
- ],
833
- function (ReferenceEllipsoids,
834
- Geodetic,
835
- UniversalTransverseMercator,
836
- Geocentric)
837
- {
838
- "use strict";
839
-
840
- let i = 0;
841
-
842
- const
843
- GD = i ++,
844
- UTM = i ++,
845
- GC = i ++;
846
-
847
- const CoordinateSystems = {
848
- GD: GD,
849
- GDC: GD,
850
- UTM: UTM,
851
- GC: GC,
852
- GCC: GC,
853
- GS: GC,
854
- };
855
-
856
- const Zone = /^Z(\d+)$/;
857
-
858
- const Geospatial =
859
- {
860
- GD: GD,
861
- UTM: UTM,
862
- GC: GC,
863
- getReferenceFrame: function (geoSystem, radians)
864
- {
865
- switch (this .getCoordinateSystem (geoSystem))
866
- {
867
- case GD:
868
- {
869
- return new Geodetic (this .getEllipsoid (geoSystem),
870
- this .getLatitudeFirst (geoSystem),
871
- radians);
872
- }
873
- case UTM:
874
- {
875
- return new UniversalTransverseMercator (this .getEllipsoid (geoSystem),
876
- this .getZone (geoSystem),
877
- this .getNorthernHemisphere (geoSystem),
878
- this .getNorthingFirst (geoSystem));
879
- }
880
- case GC:
881
- {
882
- return new Geocentric ();
883
- }
884
- }
885
-
886
- return new Geodetic (ReferenceEllipsoids .WE, true, radians);
887
- },
888
- getElevationFrame: function (geoSystem, radians)
889
- {
890
- return new Geodetic (this .getEllipsoid (geoSystem), true, radians);
891
- },
892
- getCoordinateSystem: function (geoSystem)
893
- {
894
- for (const gs of geoSystem)
895
- {
896
- const coordinateSystem = CoordinateSystems [gs];
897
-
898
- if (coordinateSystem !== undefined)
899
- return coordinateSystem;
900
- }
901
-
902
- return GD;
903
- },
904
- getEllipsoid: function (geoSystem)
905
- {
906
- for (const gs of geoSystem)
907
- {
908
- const ellipsoid = ReferenceEllipsoids [gs];
909
-
910
- if (ellipsoid !== undefined)
911
- return ellipsoid;
912
- }
913
-
914
- return ReferenceEllipsoids .WE;
915
- },
916
- getEllipsoidString: function (geoSystem)
917
- {
918
- for (const gs of geoSystem)
919
- {
920
- const ellipsoid = ReferenceEllipsoids [gs];
921
-
922
- if (ellipsoid !== undefined)
923
- return gs;
924
- }
925
-
926
- return "WE";
927
- },
928
- isStandardOrder: function (geoSystem)
929
- {
930
- switch (this .getCoordinateSystem (geoSystem))
931
- {
932
- case GD:
933
- {
934
- return this .getLatitudeFirst (geoSystem);
935
- }
936
- case UTM:
937
- {
938
- return this .getNorthingFirst (geoSystem);
939
- }
940
- case GC:
941
- {
942
- return true;
943
- }
944
- }
945
-
946
- return this .getLatitudeFirst (geoSystem);
947
- },
948
- getLatitudeFirst: function (geoSystem)
949
- {
950
- for (const gs of geoSystem)
951
- {
952
- if (gs === "longitude_first")
953
- return false;
954
- }
955
-
956
- return true;
957
- },
958
- getNorthingFirst: function (geoSystem)
959
- {
960
- for (const gs of geoSystem)
961
- {
962
- if (gs === "easting_first")
963
- return false;
964
- }
965
-
966
- return true;
967
- },
968
- getZone: function (geoSystem)
969
- {
970
- for (const gs of geoSystem)
971
- {
972
- const match = gs .match (Zone);
973
-
974
- if (match)
975
- return parseInt (match [1]);
976
- }
977
-
978
- return 1;
979
- },
980
- getNorthernHemisphere: function (geoSystem)
981
- {
982
- for (const gs of geoSystem)
983
- {
984
- if (gs === "S")
985
- return false;
986
- }
987
-
988
- return true;
989
- },
990
- };
991
-
992
- return Geospatial;
993
- });
994
-
995
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
996
- *******************************************************************************
997
- *
998
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
999
- *
1000
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
1001
- *
1002
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
1003
- *
1004
- * The copyright notice above does not evidence any actual of intended
1005
- * publication of such source code, and is an unpublished work by create3000.
1006
- * This material contains CONFIDENTIAL INFORMATION that is the property of
1007
- * create3000.
1008
- *
1009
- * No permission is granted to copy, distribute, or create derivative works from
1010
- * the contents of this software, in whole or in part, without the prior written
1011
- * permission of create3000.
1012
- *
1013
- * NON-MILITARY USE ONLY
1014
- *
1015
- * All create3000 software are effectively free software with a non-military use
1016
- * restriction. It is free. Well commented source is provided. You may reuse the
1017
- * source in any way you please with the exception anything that uses it must be
1018
- * marked to indicate is contains 'non-military use only' components.
1019
- *
1020
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1021
- *
1022
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
1023
- *
1024
- * This file is part of the X_ITE Project.
1025
- *
1026
- * X_ITE is free software: you can redistribute it and/or modify it under the
1027
- * terms of the GNU General Public License version 3 only, as published by the
1028
- * Free Software Foundation.
1029
- *
1030
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
1031
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1032
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
1033
- * details (a copy is included in the LICENSE file that accompanied this code).
1034
- *
1035
- * You should have received a copy of the GNU General Public License version 3
1036
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
1037
- * copy of the GPLv3 License.
1038
- *
1039
- * For Silvio, Joy and Adi.
1040
- *
1041
- ******************************************************************************/
1042
-
1043
-
1044
- define ('x_ite/Components/Geospatial/X3DGeospatialObject',[
1045
- "x_ite/Base/X3DConstants",
1046
- "x_ite/Browser/Geospatial/Geospatial",
1047
- "x_ite/Base/X3DCast",
1048
- "standard/Math/Numbers/Vector3",
1049
- "standard/Math/Numbers/Matrix4",
1050
- ],
1051
- function (X3DConstants,
1052
- Geospatial,
1053
- X3DCast,
1054
- Vector3,
1055
- Matrix4)
1056
- {
1057
- "use strict";
1058
-
1059
- var
1060
- vector = new Vector3 (0, 0, 0),
1061
- result = new Vector3 (0, 0, 0),
1062
- t = new Vector3 (0, 0, 0),
1063
- x = new Vector3 (0, 0, 0),
1064
- y = new Vector3 (0, 0, 0),
1065
- z = new Vector3 (0, 0, 0);
1066
-
1067
- function X3DGeospatialObject (executionContext)
1068
- {
1069
- this .addType (X3DConstants .X3DGeospatialObject);
1070
-
1071
- this .radians = false;
1072
- this .origin = new Vector3 (0, 0, 0);
1073
- this .originMatrix = new Matrix4 ();
1074
- this .invOriginMatrix = new Matrix4 ();
1075
- }
1076
-
1077
- X3DGeospatialObject .prototype =
1078
- {
1079
- constructor: X3DGeospatialObject,
1080
- initialize: function ()
1081
- {
1082
- this ._geoSystem .addInterest ("set_geoSystem__", this);
1083
- this ._geoOrigin .addInterest ("set_geoOrigin__", this);
1084
-
1085
- this .set_geoSystem__ ();
1086
- this .set_geoOrigin__ ();
1087
- },
1088
- set_geoSystem__: function ()
1089
- {
1090
- this .coordinateSystem = Geospatial .getCoordinateSystem (this ._geoSystem);
1091
- this .referenceFrame = Geospatial .getReferenceFrame (this ._geoSystem, this .radians);
1092
- this .elevationFrame = Geospatial .getElevationFrame (this ._geoSystem, this .radians);
1093
- this .standardOrder = Geospatial .isStandardOrder (this ._geoSystem);
1094
- },
1095
- set_geoOrigin__: function ()
1096
- {
1097
- if (this .geoOriginNode)
1098
- {
1099
- this .geoOriginNode .removeInterest ("set_origin__", this);
1100
- this .geoOriginNode .removeInterest ("set_rotateYUp__", this);
1101
- this .geoOriginNode .removeInterest ("addNodeEvent", this);
1102
- }
1103
-
1104
- this .geoOriginNode = X3DCast (X3DConstants .GeoOrigin, this ._geoOrigin);
1105
-
1106
- if (this .geoOriginNode)
1107
- {
1108
- this .geoOriginNode .addInterest ("set_origin__", this);
1109
- this .geoOriginNode .addInterest ("set_rotateYUp__", this);
1110
- this .geoOriginNode .addInterest ("addNodeEvent", this);
1111
- }
1112
-
1113
- this .set_origin__ ();
1114
- this .set_rotateYUp__ ();
1115
- },
1116
- set_origin__: function ()
1117
- {
1118
- if (this .geoOriginNode)
1119
- this .geoOriginNode .getOrigin (this .origin);
1120
- else
1121
- this .origin .set (0, 0, 0);
1122
-
1123
- this .set_originMatrix__ ();
1124
- },
1125
- set_originMatrix__: function ()
1126
- {
1127
- try
1128
- {
1129
- if (this .geoOriginNode)
1130
- {
1131
- // Position
1132
- var t = this .origin;
1133
-
1134
- // Let's work out the orientation at that location in order
1135
- // to maintain a view where +Y is in the direction of gravitional
1136
- // up for that region of the planet's surface. This will be the
1137
- // value of the rotation matrix for the transform.
1138
-
1139
- this .elevationFrame .normal (t, y);
1140
-
1141
- x .set (0, 0, 1) .cross (y);
1142
-
1143
- // Handle pole cases.
1144
- if (x .equals (Vector3 .Zero))
1145
- x .set (1, 0, 0);
1146
-
1147
- z .assign (x) .cross (y);
1148
-
1149
- x .normalize ();
1150
- z .normalize ();
1151
-
1152
- this .originMatrix .set (x .x, x .y, x .z, 0,
1153
- y .x, y .y, y .z, 0,
1154
- z .x, z .y, z .z, 0,
1155
- t .x, t .y, t .z, 1);
1156
-
1157
- this .invOriginMatrix .assign (this .originMatrix) .inverse ();
1158
- }
1159
- }
1160
- catch (error)
1161
- {
1162
- /// ???
1163
- }
1164
- },
1165
- set_rotateYUp__: function ()
1166
- {
1167
- if (this .geoOriginNode && this .geoOriginNode ._rotateYUp .getValue ())
1168
- {
1169
- this .getCoord = getCoordRotateYUp;
1170
- this .getGeoCoord = getGeoCoordRotateYUp;
1171
- this .getGeoUpVector = getGeoUpVectorRotateYUp;
1172
- this .getLocationMatrix = getLocationMatrixRotateYUp;
1173
- }
1174
- else
1175
- {
1176
- delete this .getCoord;
1177
- delete this .getGeoCoord;
1178
- delete this .getGeoUpVector;
1179
- delete this .getLocationMatrix;
1180
- }
1181
- },
1182
- getReferenceFrame: function ()
1183
- {
1184
- return this .referenceFrame;
1185
- },
1186
- getStandardOrder: function ()
1187
- {
1188
- return this .standardOrder;
1189
- },
1190
- getCoord: function (geoPoint, result)
1191
- {
1192
- return this .referenceFrame .convert (geoPoint, result) .subtract (this .origin);
1193
- },
1194
- getGeoCoord: function (point, result)
1195
- {
1196
- return this .referenceFrame .apply (vector .assign (point) .add (this .origin), result);
1197
- },
1198
- getGeoElevation: function (point)
1199
- {
1200
- return this .getGeoCoord (point, result) .z;
1201
- },
1202
- getGeoUpVector: function (point, result)
1203
- {
1204
- return this .elevationFrame .normal (vector .assign (point) .add (this .origin), result);
1205
- },
1206
- getLocationMatrix: function (geoPoint, result)
1207
- {
1208
- var
1209
- origin = this .origin,
1210
- locationMatrix = getStandardLocationMatrix .call (this, geoPoint, result);
1211
-
1212
- // translateRight (-origin)
1213
- locationMatrix [12] -= origin .x;
1214
- locationMatrix [13] -= origin .y;
1215
- locationMatrix [14] -= origin .z;
1216
-
1217
- return locationMatrix;
1218
- },
1219
- };
1220
-
1221
- function getCoordRotateYUp (geoPoint, result)
1222
- {
1223
- return this .invOriginMatrix .multVecMatrix (this .referenceFrame .convert (geoPoint, result));
1224
- }
1225
-
1226
- function getGeoCoordRotateYUp (point, result)
1227
- {
1228
- return this .referenceFrame .apply (this .originMatrix .multVecMatrix (vector .assign (point)), result);
1229
- }
1230
-
1231
- function getGeoUpVectorRotateYUp (point, result)
1232
- {
1233
- return this .invOriginMatrix .multDirMatrix (this .elevationFrame .normal (this .originMatrix .multVecMatrix (vector .assign (point)), result));
1234
- }
1235
-
1236
- function getLocationMatrixRotateYUp (geoPoint, result)
1237
- {
1238
- return getStandardLocationMatrix .call (this, geoPoint, result) .multRight (this .invOriginMatrix);
1239
- }
1240
-
1241
- function getStandardLocationMatrix (geoPoint, result)
1242
- {
1243
- // Position
1244
- this .referenceFrame .convert (geoPoint, t);
1245
-
1246
- // Let's work out the orientation at that location in order
1247
- // to maintain a view where +Y is in the direction of gravitional
1248
- // up for that region of the planet's surface. This will be the
1249
- // value of the rotation matrix for the transform.
1250
-
1251
- this .elevationFrame .normal (t, y);
1252
-
1253
- x .set (0, 0, 1) .cross (y);
1254
-
1255
- // Handle pole cases.
1256
- if (x .equals (Vector3 .Zero))
1257
- x .set (1, 0, 0);
1258
-
1259
- z .assign (x) .cross (y);
1260
-
1261
- x .normalize ();
1262
- z .normalize ();
1263
-
1264
- return result .set (x .x, x .y, x .z, 0,
1265
- y .x, y .y, y .z, 0,
1266
- z .x, z .y, z .z, 0,
1267
- t .x, t .y, t .z, 1);
1268
- }
1269
-
1270
- return X3DGeospatialObject;
1271
- });
1272
-
7
+ X3D = window [Symbol .for ("X_ITE.X3D-6.1.0")],
8
+ define = X3D .define,
9
+ require = X3D .require;
1273
10
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1274
11
  *******************************************************************************
1275
12
  *
@@ -1374,27 +111,10 @@ function (Fields,
1374
111
  {
1375
112
  X3DCoordinateNode .prototype .initialize .call (this);
1376
113
  X3DGeospatialObject .prototype .initialize .call (this);
1377
-
1378
- this ._point .addInterest ("set_point__", this);
1379
-
1380
- this .set_point__ ();
1381
- },
1382
- set_point__: function ()
1383
- {
1384
- this .point = this ._point .getValue ();
1385
- this .length = this ._point .length;
1386
- },
1387
- isEmpty: function ()
1388
- {
1389
- return this .length === 0;
1390
- },
1391
- getSize: function ()
1392
- {
1393
- return this .length;
1394
114
  },
1395
115
  set1Point: (function ()
1396
116
  {
1397
- var result = new Vector3 (0, 0, 0);
117
+ const result = new Vector3 (0, 0, 0);
1398
118
 
1399
119
  return function (index, point)
1400
120
  {
@@ -1403,7 +123,7 @@ function (Fields,
1403
123
  })(),
1404
124
  get1Point: (function ()
1405
125
  {
1406
- var p = new Vector3 (0, 0, 0);
126
+ const p = new Vector3 (0, 0, 0);
1407
127
 
1408
128
  return function (index, result)
1409
129
  {
@@ -1423,7 +143,7 @@ function (Fields,
1423
143
  })(),
1424
144
  addPoint: (function ()
1425
145
  {
1426
- var
146
+ const
1427
147
  p = new Vector3 (0, 0, 0),
1428
148
  g = new Vector3 (0, 0, 0);
1429
149
 
@@ -1447,7 +167,7 @@ function (Fields,
1447
167
  })(),
1448
168
  addPoints: (function ()
1449
169
  {
1450
- var
170
+ const
1451
171
  p = new Vector3 (0, 0, 0),
1452
172
  g = new Vector3 (0, 0, 0);
1453
173
 
@@ -1455,20 +175,20 @@ function (Fields,
1455
175
  {
1456
176
  const point = this .point;
1457
177
 
1458
- for (var index = 0, length = this .length * 3; index < length; index += 3)
178
+ for (let index = 0, length = this .length * 3; index < length; index += 3)
1459
179
  {
1460
180
  this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), g);
1461
181
 
1462
182
  array .push (g [0], g [1], g [2], 1);
1463
183
  }
1464
184
 
1465
- for (var index = length, length = min * 3; index < length; index += 3)
185
+ for (let index = this .length * 3, length = min * 3; index < length; index += 3)
1466
186
  array .push (0, 0, 0, 1);
1467
187
  };
1468
188
  })(),
1469
189
  getNormal: (function ()
1470
190
  {
1471
- var
191
+ const
1472
192
  point1 = new Vector3 (0, 0, 0),
1473
193
  point2 = new Vector3 (0, 0, 0),
1474
194
  point3 = new Vector3 (0, 0, 0);
@@ -1477,7 +197,7 @@ function (Fields,
1477
197
  {
1478
198
  // The index[1,2,3] cannot be less than 0.
1479
199
 
1480
- var length = this .length;
200
+ const length = this .length;
1481
201
 
1482
202
  if (index1 < length && index2 < length && index3 < length)
1483
203
  {
@@ -1492,7 +212,7 @@ function (Fields,
1492
212
  })(),
1493
213
  getQuadNormal: (function ()
1494
214
  {
1495
- var
215
+ const
1496
216
  point1 = new Vector3 (0, 0, 0),
1497
217
  point2 = new Vector3 (0, 0, 0),
1498
218
  point3 = new Vector3 (0, 0, 0),
@@ -1502,7 +222,7 @@ function (Fields,
1502
222
  {
1503
223
  // The index[1,2,3,4] cannot be less than 0.
1504
224
 
1505
- var length = this .length;
225
+ const length = this .length;
1506
226
 
1507
227
  if (index1 < length && index2 < length && index3 < length && index4 < length)
1508
228
  {
@@ -2276,7 +996,7 @@ function (Fields,
2276
996
  {
2277
997
  modelViewMatrix .translate (this .getCoord (this ._center .getValue (), center));
2278
998
 
2279
- return modelViewMatrix .origin .abs ();
999
+ return modelViewMatrix .origin .magnitude ();
2280
1000
  },
2281
1001
  traverse: function (type, renderObject)
2282
1002
  {
@@ -2926,18 +1646,13 @@ function (Fields,
2926
1646
  },
2927
1647
  interpolate: function (index0, index1, weight)
2928
1648
  {
2929
- try
2930
- {
2931
- this .getCoord (this ._keyValue [index0] .getValue (), this .keyValue0);
2932
- this .getCoord (this ._keyValue [index1] .getValue (), this .keyValue1);
1649
+ this .getCoord (this ._keyValue [index0] .getValue (), this .keyValue0);
1650
+ this .getCoord (this ._keyValue [index1] .getValue (), this .keyValue1);
2933
1651
 
2934
- var coord = this .geocentric .slerp (this .keyValue0, this .keyValue1, weight);
1652
+ var coord = this .geocentric .slerp (this .keyValue0, this .keyValue1, weight);
2935
1653
 
2936
- this ._geovalue_changed = this .getGeoCoord (coord, this .geovalue);
2937
- this ._value_changed = coord;
2938
- }
2939
- catch (error)
2940
- { }
1654
+ this ._geovalue_changed = this .getGeoCoord (coord, this .geovalue);
1655
+ this ._value_changed = coord;
2941
1656
  },
2942
1657
  });
2943
1658
 
@@ -3224,25 +1939,18 @@ function (Fields,
3224
1939
  },
3225
1940
  set_over__: function (over, hit, modelViewMatrix, projectionMatrix, viewport)
3226
1941
  {
3227
- try
3228
- {
3229
- X3DTouchSensorNode .prototype .set_over__ .call (this, over, hit, modelViewMatrix, projectionMatrix, viewport);
1942
+ X3DTouchSensorNode .prototype .set_over__ .call (this, over, hit, modelViewMatrix, projectionMatrix, viewport);
3230
1943
 
3231
- if (this ._isOver .getValue ())
3232
- {
3233
- var intersection = hit .intersection;
1944
+ if (this ._isOver .getValue ())
1945
+ {
1946
+ var intersection = hit .intersection;
3234
1947
 
3235
- invModelViewMatrix .assign (modelViewMatrix) .inverse ();
1948
+ invModelViewMatrix .assign (modelViewMatrix) .inverse ();
3236
1949
 
3237
- this ._hitTexCoord_changed = intersection .texCoord;
3238
- this ._hitNormal_changed = modelViewMatrix .multMatrixDir (intersection .normal .copy ()) .normalize ();
3239
- this ._hitPoint_changed = invModelViewMatrix .multVecMatrix (intersection .point .copy ());
3240
- this ._hitGeoCoord_changed = this .getGeoCoord (this ._hitPoint_changed .getValue (), geoCoords);
3241
- }
3242
- }
3243
- catch (error)
3244
- {
3245
- console .error (error);
1950
+ this ._hitTexCoord_changed = intersection .texCoord;
1951
+ this ._hitNormal_changed = modelViewMatrix .multMatrixDir (intersection .normal .copy ()) .normalize ();
1952
+ this ._hitPoint_changed = invModelViewMatrix .multVecMatrix (intersection .point .copy ());
1953
+ this ._hitGeoCoord_changed = this .getGeoCoord (this ._hitPoint_changed .getValue (), geoCoords);
3246
1954
  }
3247
1955
  },
3248
1956
  });
@@ -3376,380 +2084,20 @@ function (Fields,
3376
2084
  },
3377
2085
  eventsProcessed: function ()
3378
2086
  {
3379
- try
3380
- {
3381
- this .setHidden (this ._scale .x === 0 ||
3382
- this ._scale .y === 0 ||
3383
- this ._scale .z === 0);
2087
+ this .getLocationMatrix (this ._geoCenter .getValue (), locationMatrix);
3384
2088
 
3385
- this .getLocationMatrix (this ._geoCenter .getValue (), locationMatrix);
2089
+ matrix .set (this ._translation .getValue (),
2090
+ this ._rotation .getValue (),
2091
+ this ._scale .getValue (),
2092
+ this ._scaleOrientation .getValue ());
3386
2093
 
3387
- matrix .set (this ._translation .getValue (),
3388
- this ._rotation .getValue (),
3389
- this ._scale .getValue (),
3390
- this ._scaleOrientation .getValue ());
3391
-
3392
- this .setMatrix (matrix .multRight (locationMatrix) .multLeft (locationMatrix .inverse ()));
3393
- }
3394
- catch (error)
3395
- {
3396
- // Should normally not happen.
3397
- this .setHidden (true);
3398
- }
2094
+ this .setMatrix (matrix .multRight (locationMatrix) .multLeft (locationMatrix .inverse ()));
3399
2095
  },
3400
2096
  });
3401
2097
 
3402
2098
  return GeoTransform;
3403
2099
  });
3404
2100
 
3405
- /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
3406
- *******************************************************************************
3407
- *
3408
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3409
- *
3410
- * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
3411
- *
3412
- * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
3413
- *
3414
- * The copyright notice above does not evidence any actual of intended
3415
- * publication of such source code, and is an unpublished work by create3000.
3416
- * This material contains CONFIDENTIAL INFORMATION that is the property of
3417
- * create3000.
3418
- *
3419
- * No permission is granted to copy, distribute, or create derivative works from
3420
- * the contents of this software, in whole or in part, without the prior written
3421
- * permission of create3000.
3422
- *
3423
- * NON-MILITARY USE ONLY
3424
- *
3425
- * All create3000 software are effectively free software with a non-military use
3426
- * restriction. It is free. Well commented source is provided. You may reuse the
3427
- * source in any way you please with the exception anything that uses it must be
3428
- * marked to indicate is contains 'non-military use only' components.
3429
- *
3430
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3431
- *
3432
- * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
3433
- *
3434
- * This file is part of the X_ITE Project.
3435
- *
3436
- * X_ITE is free software: you can redistribute it and/or modify it under the
3437
- * terms of the GNU General Public License version 3 only, as published by the
3438
- * Free Software Foundation.
3439
- *
3440
- * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
3441
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
3442
- * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
3443
- * details (a copy is included in the LICENSE file that accompanied this code).
3444
- *
3445
- * You should have received a copy of the GNU General Public License version 3
3446
- * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
3447
- * copy of the GPLv3 License.
3448
- *
3449
- * For Silvio, Joy and Adi.
3450
- *
3451
- ******************************************************************************/
3452
-
3453
-
3454
- define ('x_ite/Components/Geospatial/GeoViewpoint',[
3455
- "x_ite/Fields",
3456
- "x_ite/Base/X3DFieldDefinition",
3457
- "x_ite/Base/FieldDefinitionArray",
3458
- "x_ite/Components/Navigation/X3DViewpointNode",
3459
- "x_ite/Components/Geospatial/X3DGeospatialObject",
3460
- "x_ite/Components/Interpolation/ScalarInterpolator",
3461
- "x_ite/Components/Navigation/NavigationInfo",
3462
- "x_ite/Base/X3DConstants",
3463
- "standard/Math/Geometry/Camera",
3464
- "standard/Math/Numbers/Vector2",
3465
- "standard/Math/Numbers/Vector3",
3466
- "standard/Math/Numbers/Rotation4",
3467
- "standard/Math/Numbers/Matrix4",
3468
- "standard/Math/Algorithm",
3469
- ],
3470
- function (Fields,
3471
- X3DFieldDefinition,
3472
- FieldDefinitionArray,
3473
- X3DViewpointNode,
3474
- X3DGeospatialObject,
3475
- ScalarInterpolator,
3476
- NavigationInfo,
3477
- X3DConstants,
3478
- Camera,
3479
- Vector2,
3480
- Vector3,
3481
- Rotation4,
3482
- Matrix4,
3483
- Algorithm)
3484
- {
3485
- "use strict";
3486
-
3487
- function traverse (type, renderObject)
3488
- {
3489
- X3DViewpointNode .prototype .traverse .call (this, type, renderObject);
3490
-
3491
- this .navigationInfoNode .traverse (type, renderObject);
3492
- }
3493
-
3494
- function GeoViewpoint (executionContext)
3495
- {
3496
- X3DViewpointNode .call (this, executionContext);
3497
- X3DGeospatialObject .call (this, executionContext);
3498
-
3499
- this .addType (X3DConstants .GeoViewpoint);
3500
-
3501
- this ._centerOfRotation .setUnit ("length");
3502
- this ._fieldOfView .setUnit ("angle");
3503
-
3504
- this .navigationInfoNode = new NavigationInfo (executionContext);
3505
- this .fieldOfViewInterpolator = new ScalarInterpolator (this .getBrowser () .getPrivateScene ());
3506
- this .projectionMatrix = new Matrix4 ();
3507
- this .elevation = 0;
3508
-
3509
- switch (executionContext .specificationVersion)
3510
- {
3511
- case "2.0":
3512
- case "3.0":
3513
- case "3.1":
3514
- case "3.2":
3515
- this .traverse = traverse;
3516
- break;
3517
- }
3518
- }
3519
-
3520
- GeoViewpoint .prototype = Object .assign (Object .create (X3DViewpointNode .prototype),
3521
- X3DGeospatialObject .prototype,
3522
- {
3523
- constructor: GeoViewpoint,
3524
- [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
3525
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
3526
- new X3DFieldDefinition (X3DConstants .initializeOnly, "geoOrigin", new Fields .SFNode ()),
3527
- new X3DFieldDefinition (X3DConstants .initializeOnly, "geoSystem", new Fields .MFString ("GD", "WE")),
3528
- new X3DFieldDefinition (X3DConstants .inputOnly, "set_bind", new Fields .SFBool ()),
3529
- new X3DFieldDefinition (X3DConstants .inputOutput, "description", new Fields .SFString ()),
3530
- new X3DFieldDefinition (X3DConstants .inputOutput, "position", new Fields .SFVec3d (0, 0, 100000)),
3531
- new X3DFieldDefinition (X3DConstants .inputOutput, "orientation", new Fields .SFRotation ()),
3532
- new X3DFieldDefinition (X3DConstants .inputOutput, "centerOfRotation", new Fields .SFVec3d ()),
3533
- new X3DFieldDefinition (X3DConstants .inputOutput, "fieldOfView", new Fields .SFFloat (0.7854)),
3534
- new X3DFieldDefinition (X3DConstants .inputOutput, "jump", new Fields .SFBool (true)),
3535
- new X3DFieldDefinition (X3DConstants .inputOutput, "retainUserOffsets", new Fields .SFBool ()),
3536
- new X3DFieldDefinition (X3DConstants .inputOutput, "navType", new Fields .MFString ("EXAMINE", "ANY")),
3537
- new X3DFieldDefinition (X3DConstants .inputOutput, "headlight", new Fields .SFBool (true)),
3538
- new X3DFieldDefinition (X3DConstants .initializeOnly, "speedFactor", new Fields .SFFloat (1)),
3539
- new X3DFieldDefinition (X3DConstants .outputOnly, "isBound", new Fields .SFBool ()),
3540
- new X3DFieldDefinition (X3DConstants .outputOnly, "bindTime", new Fields .SFTime ()),
3541
- ]),
3542
- getTypeName: function ()
3543
- {
3544
- return "GeoViewpoint";
3545
- },
3546
- getComponentName: function ()
3547
- {
3548
- return "Geospatial";
3549
- },
3550
- getContainerField: function ()
3551
- {
3552
- return "children";
3553
- },
3554
- initialize: function ()
3555
- {
3556
- X3DViewpointNode .prototype .initialize .call (this);
3557
- X3DGeospatialObject .prototype .initialize .call (this);
3558
-
3559
- this ._position .addInterest ("set_position__", this);
3560
- this ._positionOffset .addInterest ("set_position__", this);
3561
- this ._navType .addFieldInterest (this .navigationInfoNode ._type);
3562
- this ._headlight .addFieldInterest (this .navigationInfoNode ._headlight);
3563
-
3564
- this .navigationInfoNode .setup ();
3565
-
3566
- this .set_position__ ();
3567
-
3568
- // Setup interpolators
3569
-
3570
- this .fieldOfViewInterpolator ._key = [ 0, 1 ];
3571
- this .fieldOfViewInterpolator .setup ();
3572
-
3573
- this .getEaseInEaseOut () ._modifiedFraction_changed .addFieldInterest (this .fieldOfViewInterpolator ._set_fraction);
3574
- this .fieldOfViewInterpolator ._value_changed .addFieldInterest (this ._fieldOfViewScale);
3575
- },
3576
- setInterpolators: function (fromViewpointNode, toViewpointNode)
3577
- {
3578
- if (fromViewpointNode .getType () .indexOf (X3DConstants .Viewpoint) >= 0)
3579
- {
3580
- const scale = fromViewpointNode .getFieldOfView () / toViewpointNode .getFieldOfView ();
3581
-
3582
- this .fieldOfViewInterpolator ._keyValue = new Fields .MFFloat (scale, toViewpointNode ._fieldOfViewScale .getValue ());
3583
-
3584
- this ._fieldOfViewScale = scale;
3585
- }
3586
- else
3587
- {
3588
- this .fieldOfViewInterpolator ._keyValue = new Fields .MFFloat (toViewpointNode ._fieldOfViewScale .getValue (), toViewpointNode ._fieldOfViewScale .getValue ());
3589
-
3590
- this ._fieldOfViewScale = toViewpointNode ._fieldOfViewScale .getValue ();
3591
- }
3592
- },
3593
- setPosition: (function ()
3594
- {
3595
- var geoPosition = new Vector3 (0, 0, 0);
3596
-
3597
- return function (value)
3598
- {
3599
- this ._position .setValue (this .getGeoCoord (value, geoPosition));
3600
- };
3601
- })(),
3602
- getPosition: (function ()
3603
- {
3604
- var position = new Vector3 (0, 0, 0);
3605
-
3606
- return function ()
3607
- {
3608
- return this .getCoord (this ._position .getValue (), position);
3609
- };
3610
- })(),
3611
- set_position__: (function ()
3612
- {
3613
- var position = new Vector3 (0, 0, 0);
3614
-
3615
- return function ()
3616
- {
3617
- this .getCoord (this ._position .getValue (), position);
3618
-
3619
- this .elevation = this .getGeoElevation (position .add (this ._positionOffset .getValue ()));
3620
- };
3621
- })(),
3622
- setOrientation: (function ()
3623
- {
3624
- var
3625
- locationMatrix = new Matrix4 (),
3626
- geoOrientation = new Rotation4 (0, 0, 1, 0);
3627
-
3628
- return function (value)
3629
- {
3630
- /// Returns the resulting orientation for this viewpoint.
3631
-
3632
- var rotationMatrix = this .getLocationMatrix (this ._position .getValue (), locationMatrix) .submatrix;
3633
-
3634
- geoOrientation .setMatrix (rotationMatrix);
3635
-
3636
- this ._orientation .setValue (geoOrientation .inverse () .multLeft (value));
3637
- };
3638
- })(),
3639
- getOrientation: (function ()
3640
- {
3641
- var
3642
- locationMatrix = new Matrix4 (),
3643
- orientation = new Rotation4 (0, 0, 1, 0);
3644
-
3645
- return function ()
3646
- {
3647
- /// Returns the resulting orientation for this viewpoint.
3648
-
3649
- var rotationMatrix = this .getLocationMatrix (this ._position .getValue (), locationMatrix) .submatrix;
3650
-
3651
- orientation .setMatrix (rotationMatrix);
3652
-
3653
- return orientation .multLeft (this ._orientation .getValue ());
3654
- };
3655
- })(),
3656
- getCenterOfRotation: (function ()
3657
- {
3658
- var centerOfRotation = new Vector3 (0, 0, 0);
3659
-
3660
- return function ()
3661
- {
3662
- return this .getCoord (this ._centerOfRotation .getValue (), centerOfRotation);
3663
- };
3664
- })(),
3665
- getFieldOfView: function ()
3666
- {
3667
- var fov = this ._fieldOfView * this ._fieldOfViewScale;
3668
-
3669
- return fov > 0 && fov < Math .PI ? fov : Math .PI / 4;
3670
- },
3671
- getMaxFarValue: function ()
3672
- {
3673
- return this .getBrowser () .getRenderingProperty ("LogarithmicDepthBuffer") ? 1e10 : 1e9;
3674
- },
3675
- getUpVector: (function ()
3676
- {
3677
- var
3678
- position = new Vector3 (0, 0, 0),
3679
- upVector = new Vector3 (0, 0, 0);
3680
-
3681
- return function ()
3682
- {
3683
- this .getCoord (this ._position .getValue (), position);
3684
-
3685
- return this .getGeoUpVector .call (this, position .add (this ._positionOffset .getValue ()), upVector);
3686
- };
3687
- })(),
3688
- getSpeedFactor: function ()
3689
- {
3690
- return (Math .max (this .elevation, 0.0) + 10) / 10 * this ._speedFactor .getValue ();
3691
- },
3692
- getScreenScale: (function ()
3693
- {
3694
- var screenScale = new Vector3 (0, 0, 0);
3695
-
3696
- return function (point, viewport)
3697
- {
3698
- // Returns the screen scale in meter/pixel for on pixel.
3699
-
3700
- var
3701
- width = viewport [2],
3702
- height = viewport [3],
3703
- size = Math .abs (point .z) * Math .tan (this .getFieldOfView () / 2) * 2;
3704
-
3705
- if (width > height)
3706
- size /= height;
3707
- else
3708
- size /= width;
3709
-
3710
- return screenScale .set (size, size, size);
3711
- };
3712
- })(),
3713
- getViewportSize: (function ()
3714
- {
3715
- var viewportSize = new Vector2 (0, 0);
3716
-
3717
- return function (viewport, nearValue)
3718
- {
3719
- var
3720
- width = viewport [2],
3721
- height = viewport [3],
3722
- size = nearValue * Math .tan (this .getFieldOfView () / 2) * 2,
3723
- aspect = width / height;
3724
-
3725
- if (aspect > 1)
3726
- return viewportSize .set (size * aspect, size);
3727
-
3728
- return viewportSize .set (size, size / aspect);
3729
- };
3730
- })(),
3731
- getLookAtDistance: function (bbox)
3732
- {
3733
- return (bbox .size .abs () / 2) / Math .tan (this .getFieldOfView () / 2);
3734
- },
3735
- getProjectionMatrixWithLimits: function (nearValue, farValue, viewport, limit)
3736
- {
3737
- if (limit || this .getBrowser () .getRenderingProperty ("LogarithmicDepthBuffer"))
3738
- return Camera .perspective (this .getFieldOfView (), nearValue, farValue, viewport [2], viewport [3], this .projectionMatrix);
3739
-
3740
- // Linear interpolate nearValue and farValue
3741
-
3742
- var
3743
- geoZNear = Math .max (Algorithm .lerp (Math .min (nearValue, 1e4), 1e4, this .elevation / 1e7), 1),
3744
- geoZFar = Math .max (Algorithm .lerp (1e6, Math .max (farValue, 1e6), this .elevation / 1e7), 1e6);
3745
-
3746
- return Camera .perspective (this .getFieldOfView (), geoZNear, geoZFar, viewport [2], viewport [3], this .projectionMatrix);
3747
- },
3748
- });
3749
-
3750
- return GeoViewpoint;
3751
- });
3752
-
3753
2101
  /*******************************************************************************
3754
2102
  *
3755
2103
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.