@openglobus/og 0.18.0 → 0.18.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 (476) hide show
  1. package/README.md +8 -8
  2. package/lib/@openglobus/og.esm.js +2 -0
  3. package/lib/@openglobus/og.esm.js.map +1 -0
  4. package/lib/@openglobus/og.umd.js +2 -0
  5. package/lib/@openglobus/og.umd.js.map +1 -0
  6. package/lib/js/Clock.d.ts +106 -0
  7. package/{src/Clock.ts → lib/js/Clock.js} +31 -126
  8. package/lib/js/Deferred.d.ts +6 -0
  9. package/lib/js/Deferred.js +13 -0
  10. package/lib/js/Events.d.ts +90 -0
  11. package/{src/Events.ts → lib/js/Events.js} +29 -84
  12. package/lib/js/Extent.d.ts +145 -0
  13. package/{src/Extent.ts → lib/js/Extent.js} +74 -120
  14. package/lib/js/Globe.d.ts +132 -0
  15. package/{src/Globe.ts → lib/js/Globe.js} +61 -159
  16. package/lib/js/ImageCanvas.d.ts +128 -0
  17. package/{src/ImageCanvas.ts → lib/js/ImageCanvas.js} +24 -65
  18. package/lib/js/Lock.d.ts +15 -0
  19. package/{src/Lock.ts → lib/js/Lock.js} +7 -21
  20. package/lib/js/LonLat.d.ts +128 -0
  21. package/{src/LonLat.ts → lib/js/LonLat.js} +44 -75
  22. package/lib/js/Object3d.d.ts +49 -0
  23. package/{src/Object3d.ts → lib/js/Object3d.js} +64 -184
  24. package/lib/js/Popup.d.ts +46 -0
  25. package/{src/Popup.ts → lib/js/Popup.js} +42 -110
  26. package/lib/js/QueueArray.d.ts +16 -0
  27. package/{src/QueueArray.ts → lib/js/QueueArray.js} +12 -25
  28. package/lib/js/Rectangle.d.ts +76 -0
  29. package/{src/Rectangle.ts → lib/js/Rectangle.js} +12 -50
  30. package/lib/js/Stack.d.ts +20 -0
  31. package/{src/Stack.ts → lib/js/Stack.js} +13 -29
  32. package/lib/js/astro/astro.d.ts +39 -0
  33. package/{src/astro/astro.ts → lib/js/astro/astro.js} +2 -8
  34. package/lib/js/astro/earth.d.ts +8 -0
  35. package/{src/astro/earth.ts → lib/js/astro/earth.js} +3 -39
  36. package/lib/js/astro/jd.d.ts +234 -0
  37. package/{src/astro/jd.ts → lib/js/astro/jd.js} +55 -134
  38. package/lib/js/astro/orbit.d.ts +5 -0
  39. package/{src/astro/orbit.ts → lib/js/astro/orbit.js} +26 -39
  40. package/lib/js/astro/rotation.d.ts +2 -0
  41. package/{src/astro/rotation.ts → lib/js/astro/rotation.js} +2 -11
  42. package/lib/js/bv/Box.d.ts +32 -0
  43. package/{src/bv/Box.ts → lib/js/bv/Box.js} +7 -35
  44. package/lib/js/bv/Sphere.d.ts +37 -0
  45. package/{src/bv/Sphere.ts → lib/js/bv/Sphere.js} +6 -34
  46. package/{src/bv/index.ts → lib/js/bv/index.d.ts} +0 -1
  47. package/lib/js/bv/index.js +3 -0
  48. package/lib/js/camera/Camera.d.ts +314 -0
  49. package/{src/camera/Camera.ts → lib/js/camera/Camera.js} +77 -326
  50. package/lib/js/camera/Frustum.d.ts +139 -0
  51. package/{src/camera/Frustum.ts → lib/js/camera/Frustum.js} +66 -185
  52. package/lib/js/camera/PlanetCamera.d.ts +234 -0
  53. package/{src/camera/PlanetCamera.ts → lib/js/camera/PlanetCamera.js} +65 -338
  54. package/{src/camera/index.ts → lib/js/camera/index.d.ts} +0 -1
  55. package/lib/js/camera/index.js +3 -0
  56. package/lib/js/cons.d.ts +40 -0
  57. package/{src/cons.ts → lib/js/cons.js} +10 -22
  58. package/lib/js/control/Atmosphere.d.ts +16 -0
  59. package/{src/control/Atmosphere.ts → lib/js/control/Atmosphere.js} +33 -86
  60. package/lib/js/control/CompassButton.d.ts +16 -0
  61. package/{src/control/CompassButton.ts → lib/js/control/CompassButton.js} +18 -43
  62. package/lib/js/control/Control.d.ts +100 -0
  63. package/{src/control/Control.ts → lib/js/control/Control.js} +22 -89
  64. package/lib/js/control/DebugInfo.d.ts +25 -0
  65. package/{src/control/DebugInfo.ts → lib/js/control/DebugInfo.js} +38 -84
  66. package/lib/js/control/DrawingSwitcher.d.ts +13 -0
  67. package/{src/control/DrawingSwitcher.ts → lib/js/control/DrawingSwitcher.js} +13 -30
  68. package/lib/js/control/EarthCoordinates.d.ts +41 -0
  69. package/{src/control/EarthCoordinates.ts → lib/js/control/EarthCoordinates.js} +58 -119
  70. package/lib/js/control/EarthNavigation.d.ts +50 -0
  71. package/{src/control/EarthNavigation.ts → lib/js/control/EarthNavigation.js} +70 -161
  72. package/lib/js/control/GeoImageDragControl.d.ts +22 -0
  73. package/{src/control/GeoImageDragControl.ts → lib/js/control/GeoImageDragControl.js} +26 -49
  74. package/lib/js/control/KeyboardNavigation.d.ts +28 -0
  75. package/{src/control/KeyboardNavigation.ts → lib/js/control/KeyboardNavigation.js} +67 -92
  76. package/lib/js/control/LayerAnimation.d.ts +71 -0
  77. package/{src/control/LayerAnimation.ts → lib/js/control/LayerAnimation.js} +82 -162
  78. package/lib/js/control/LayerSwitcher.d.ts +21 -0
  79. package/{src/control/LayerSwitcher.ts → lib/js/control/LayerSwitcher.js} +16 -41
  80. package/lib/js/control/Lighting.d.ts +49 -0
  81. package/{src/control/Lighting.ts → lib/js/control/Lighting.js} +106 -219
  82. package/lib/js/control/MouseNavigation.d.ts +62 -0
  83. package/{src/control/MouseNavigation.ts → lib/js/control/MouseNavigation.js} +105 -211
  84. package/lib/js/control/MouseWheelZoomControl.d.ts +44 -0
  85. package/lib/js/control/MouseWheelZoomControl.js +181 -0
  86. package/lib/js/control/RulerSwitcher.d.ts +17 -0
  87. package/{src/control/RulerSwitcher.ts → lib/js/control/RulerSwitcher.js} +13 -28
  88. package/lib/js/control/ScaleControl.d.ts +24 -0
  89. package/lib/js/control/ScaleControl.js +91 -0
  90. package/lib/js/control/SegmentBoundVisualization.d.ts +12 -0
  91. package/lib/js/control/SegmentBoundVisualization.js +37 -0
  92. package/lib/js/control/ShowFps.d.ts +9 -0
  93. package/lib/js/control/ShowFps.js +20 -0
  94. package/lib/js/control/SimpleNavigation.d.ts +25 -0
  95. package/{src/control/SimpleNavigation.ts → lib/js/control/SimpleNavigation.js} +29 -51
  96. package/lib/js/control/SimpleSkyBackground.d.ts +15 -0
  97. package/{src/control/SimpleSkyBackground.ts → lib/js/control/SimpleSkyBackground.js} +21 -48
  98. package/lib/js/control/Sun.d.ts +33 -0
  99. package/{src/control/Sun.ts → lib/js/control/Sun.js} +34 -85
  100. package/lib/js/control/ToggleWireframe.d.ts +14 -0
  101. package/lib/js/control/ToggleWireframe.js +28 -0
  102. package/lib/js/control/TouchNavigation.d.ts +52 -0
  103. package/{src/control/TouchNavigation.ts → lib/js/control/TouchNavigation.js} +88 -193
  104. package/lib/js/control/ZoomControl.d.ts +27 -0
  105. package/{src/control/ZoomControl.ts → lib/js/control/ZoomControl.js} +25 -50
  106. package/lib/js/control/drawing/DrawingControl.d.ts +12 -0
  107. package/{src/control/drawing/DrawingControl.ts → lib/js/control/drawing/DrawingControl.js} +10 -20
  108. package/lib/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
  109. package/{src/control/drawing/LineStringDrawingScene.ts → lib/js/control/drawing/LineStringDrawingScene.js} +28 -85
  110. package/lib/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
  111. package/{src/control/drawing/PolygonDrawingScene.ts → lib/js/control/drawing/PolygonDrawingScene.js} +190 -388
  112. package/lib/js/control/elevationProfile/ElevationProfile.d.ts +61 -0
  113. package/{src/control/elevationProfile/ElevationProfile.ts → lib/js/control/elevationProfile/ElevationProfile.js} +56 -148
  114. package/lib/js/control/heightRuler/HeightRuler.d.ts +7 -0
  115. package/{src/control/heightRuler/HeightRuler.ts → lib/js/control/heightRuler/HeightRuler.js} +4 -9
  116. package/lib/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
  117. package/{src/control/heightRuler/HeightRulerScene.ts → lib/js/control/heightRuler/HeightRulerScene.js} +47 -99
  118. package/lib/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
  119. package/{src/control/heightRuler/HeightRulerSwitcher.ts → lib/js/control/heightRuler/HeightRulerSwitcher.js} +2 -4
  120. package/{src/control/index.ts → lib/js/control/index.d.ts} +1 -18
  121. package/lib/js/control/index.js +28 -0
  122. package/lib/js/control/ruler/Ruler.d.ts +13 -0
  123. package/lib/js/control/ruler/Ruler.js +23 -0
  124. package/lib/js/control/ruler/RulerScene.d.ts +88 -0
  125. package/lib/js/control/ruler/RulerScene.js +324 -0
  126. package/lib/js/control/selection/Selection.d.ts +55 -0
  127. package/{src/control/selection/Selection.ts → lib/js/control/selection/Selection.js} +15 -34
  128. package/lib/js/control/selection/SelectionScene.d.ts +44 -0
  129. package/{src/control/selection/SelectionScene.ts → lib/js/control/selection/SelectionScene.js} +26 -113
  130. package/lib/js/control/timeline/TimelineControl.d.ts +18 -0
  131. package/{src/control/timeline/TimelineControl.ts → lib/js/control/timeline/TimelineControl.js} +13 -43
  132. package/lib/js/control/timeline/TimelineModel.d.ts +41 -0
  133. package/{src/control/timeline/TimelineModel.ts → lib/js/control/timeline/TimelineModel.js} +26 -74
  134. package/lib/js/control/timeline/TimelineView.d.ts +85 -0
  135. package/{src/control/timeline/TimelineView.ts → lib/js/control/timeline/TimelineView.js} +133 -281
  136. package/lib/js/control/timeline/timelineUtils.d.ts +12 -0
  137. package/lib/js/control/timeline/timelineUtils.js +112 -0
  138. package/lib/js/control/visibleExtent/Segment.d.ts +277 -0
  139. package/{src → lib/js}/control/visibleExtent/Segment.js +145 -698
  140. package/lib/js/control/visibleExtent/VisibleExtent.d.ts +5 -0
  141. package/{src → lib/js}/control/visibleExtent/VisibleExtent.js +1 -18
  142. package/lib/js/control/visibleExtent/drawnode.d.ts +7 -0
  143. package/{src/control/visibleExtent/drawnode.ts → lib/js/control/visibleExtent/drawnode.js} +1 -28
  144. package/lib/js/ellipsoid/Ellipsoid.d.ts +187 -0
  145. package/{src/ellipsoid/Ellipsoid.ts → lib/js/ellipsoid/Ellipsoid.js} +85 -267
  146. package/lib/js/ellipsoid/index.d.ts +3 -0
  147. package/lib/js/ellipsoid/index.js +3 -0
  148. package/lib/js/ellipsoid/wgs84.d.ts +6 -0
  149. package/{src/ellipsoid/wgs84.ts → lib/js/ellipsoid/wgs84.js} +1 -2
  150. package/lib/js/entity/BaseBillboard.d.ts +222 -0
  151. package/{src/entity/BaseBillboard.ts → lib/js/entity/BaseBillboard.js} +48 -165
  152. package/lib/js/entity/BaseBillboardHandler.d.ts +81 -0
  153. package/{src/entity/BaseBillboardHandler.ts → lib/js/entity/BaseBillboardHandler.js} +139 -365
  154. package/lib/js/entity/Billboard.d.ts +113 -0
  155. package/{src/entity/Billboard.ts → lib/js/entity/Billboard.js} +19 -83
  156. package/lib/js/entity/BillboardHandler.d.ts +15 -0
  157. package/{src/entity/BillboardHandler.ts → lib/js/entity/BillboardHandler.js} +27 -59
  158. package/lib/js/entity/Entity.d.ts +354 -0
  159. package/{src/entity/Entity.ts → lib/js/entity/Entity.js} +102 -374
  160. package/lib/js/entity/EntityCollection.d.ts +363 -0
  161. package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +57 -359
  162. package/lib/js/entity/GeoObject.d.ts +138 -0
  163. package/{src/entity/GeoObject.ts → lib/js/entity/GeoObject.js} +41 -146
  164. package/lib/js/entity/GeoObjectHandler.d.ts +99 -0
  165. package/{src/entity/GeoObjectHandler.ts → lib/js/entity/GeoObjectHandler.js} +162 -423
  166. package/lib/js/entity/Geometry.d.ts +111 -0
  167. package/lib/js/entity/Geometry.js +283 -0
  168. package/lib/js/entity/GeometryHandler.d.ts +84 -0
  169. package/{src/entity/GeometryHandler.ts → lib/js/entity/GeometryHandler.js} +162 -657
  170. package/lib/js/entity/Label.d.ts +207 -0
  171. package/{src/entity/Label.ts → lib/js/entity/Label.js} +63 -165
  172. package/lib/js/entity/LabelHandler.d.ts +65 -0
  173. package/{src/entity/LabelHandler.ts → lib/js/entity/LabelHandler.js} +175 -408
  174. package/lib/js/entity/LabelWorker.d.ts +15 -0
  175. package/{src/entity/LabelWorker.ts → lib/js/entity/LabelWorker.js} +24 -45
  176. package/lib/js/entity/PointCloud.d.ts +179 -0
  177. package/{src/entity/PointCloud.ts → lib/js/entity/PointCloud.js} +65 -265
  178. package/lib/js/entity/PointCloudHandler.d.ts +42 -0
  179. package/{src/entity/PointCloudHandler.ts → lib/js/entity/PointCloudHandler.js} +19 -62
  180. package/lib/js/entity/Polyline.d.ts +337 -0
  181. package/{src/entity/Polyline.ts → lib/js/entity/Polyline.js} +289 -924
  182. package/lib/js/entity/PolylineHandler.d.ts +22 -0
  183. package/{src/entity/PolylineHandler.ts → lib/js/entity/PolylineHandler.js} +12 -37
  184. package/lib/js/entity/Ray.d.ts +133 -0
  185. package/{src/entity/Ray.ts → lib/js/entity/Ray.js} +26 -146
  186. package/lib/js/entity/RayHandler.d.ts +70 -0
  187. package/{src/entity/RayHandler.ts → lib/js/entity/RayHandler.js} +102 -342
  188. package/lib/js/entity/Strip.d.ts +127 -0
  189. package/{src/entity/Strip.ts → lib/js/entity/Strip.js} +102 -372
  190. package/lib/js/entity/StripHandler.d.ts +42 -0
  191. package/{src/entity/StripHandler.ts → lib/js/entity/StripHandler.js} +22 -74
  192. package/{src/entity/index.ts → lib/js/entity/index.d.ts} +1 -2
  193. package/lib/js/entity/index.js +11 -0
  194. package/lib/js/index.d.ts +33 -0
  195. package/lib/js/index.js +33 -0
  196. package/lib/js/input/KeyboardHandler.d.ts +33 -0
  197. package/{src/input/KeyboardHandler.ts → lib/js/input/KeyboardHandler.js} +45 -84
  198. package/lib/js/input/MouseHandler.d.ts +16 -0
  199. package/{src/input/MouseHandler.ts → lib/js/input/MouseHandler.js} +12 -36
  200. package/lib/js/input/TouchHandler.d.ts +11 -0
  201. package/{src/input/TouchHandler.ts → lib/js/input/TouchHandler.js} +11 -23
  202. package/lib/js/input/input.d.ts +3 -0
  203. package/{src/input/input.ts → lib/js/input/input.js} +1 -1
  204. package/lib/js/layer/BaseGeoImage.d.ts +145 -0
  205. package/{src/layer/BaseGeoImage.ts → lib/js/layer/BaseGeoImage.js} +70 -235
  206. package/lib/js/layer/CanvasTiles.d.ts +103 -0
  207. package/{src/layer/CanvasTiles.ts → lib/js/layer/CanvasTiles.js} +54 -146
  208. package/lib/js/layer/GeoImage.d.ts +61 -0
  209. package/{src/layer/GeoImage.ts → lib/js/layer/GeoImage.js} +24 -54
  210. package/lib/js/layer/GeoTexture2d.d.ts +17 -0
  211. package/lib/js/layer/GeoTexture2d.js +37 -0
  212. package/lib/js/layer/GeoVideo.d.ts +68 -0
  213. package/{src/layer/GeoVideo.ts → lib/js/layer/GeoVideo.js} +31 -61
  214. package/lib/js/layer/KML.d.ts +72 -0
  215. package/{src/layer/KML.ts → lib/js/layer/KML.js} +94 -138
  216. package/lib/js/layer/Layer.d.ts +401 -0
  217. package/{src/layer/Layer.ts → lib/js/layer/Layer.js} +92 -443
  218. package/lib/js/layer/Material.d.ts +34 -0
  219. package/{src/layer/Material.ts → lib/js/layer/Material.js} +9 -43
  220. package/lib/js/layer/Vector.d.ts +243 -0
  221. package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +155 -426
  222. package/lib/js/layer/WMS.d.ts +75 -0
  223. package/{src/layer/WMS.ts → lib/js/layer/WMS.js} +18 -100
  224. package/lib/js/layer/XYZ.d.ts +149 -0
  225. package/{src/layer/XYZ.ts → lib/js/layer/XYZ.js} +71 -171
  226. package/lib/js/layer/index.d.ts +11 -0
  227. package/lib/js/layer/index.js +11 -0
  228. package/lib/js/light/LightSource.d.ts +174 -0
  229. package/{src/light/LightSource.ts → lib/js/light/LightSource.js} +22 -131
  230. package/lib/js/math/Line2.d.ts +11 -0
  231. package/{src/math/Line2.ts → lib/js/math/Line2.js} +5 -15
  232. package/lib/js/math/Line3.d.ts +28 -0
  233. package/lib/js/math/Line3.js +85 -0
  234. package/lib/js/math/Mat3.d.ts +77 -0
  235. package/{src/math/Mat3.ts → lib/js/math/Mat3.js} +22 -51
  236. package/lib/js/math/Mat4.d.ts +195 -0
  237. package/{src/math/Mat4.ts → lib/js/math/Mat4.js} +53 -219
  238. package/lib/js/math/Plane.d.ts +20 -0
  239. package/{src/math/Plane.ts → lib/js/math/Plane.js} +26 -40
  240. package/lib/js/math/Quat.d.ts +373 -0
  241. package/{src/math/Quat.ts → lib/js/math/Quat.js} +106 -319
  242. package/lib/js/math/Ray.d.ts +76 -0
  243. package/{src/math/Ray.ts → lib/js/math/Ray.js} +21 -66
  244. package/lib/js/math/Vec2.d.ts +310 -0
  245. package/{src/math/Vec2.ts → lib/js/math/Vec2.js} +55 -121
  246. package/lib/js/math/Vec3.d.ts +472 -0
  247. package/{src/math/Vec3.ts → lib/js/math/Vec3.js} +103 -236
  248. package/lib/js/math/Vec4.d.ts +163 -0
  249. package/{src/math/Vec4.ts → lib/js/math/Vec4.js} +23 -79
  250. package/lib/js/math/coder.d.ts +51 -0
  251. package/{src/math/coder.ts → lib/js/math/coder.js} +14 -20
  252. package/lib/js/math/index.d.ts +11 -0
  253. package/lib/js/math/index.js +11 -0
  254. package/lib/js/math.d.ts +266 -0
  255. package/{src/math.ts → lib/js/math.js} +37 -85
  256. package/lib/js/mercator.d.ts +92 -0
  257. package/{src/mercator.ts → lib/js/mercator.js} +13 -37
  258. package/lib/js/proj/EPSG3857.d.ts +9 -0
  259. package/{src/proj/EPSG3857.ts → lib/js/proj/EPSG3857.js} +0 -2
  260. package/lib/js/proj/EPSG4326.d.ts +9 -0
  261. package/{src/proj/EPSG4326.ts → lib/js/proj/EPSG4326.js} +0 -2
  262. package/lib/js/proj/Proj.d.ts +43 -0
  263. package/{src/proj/Proj.ts → lib/js/proj/Proj.js} +4 -29
  264. package/lib/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
  265. package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +17 -0
  266. package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +6 -0
  267. package/lib/js/quadTree/EarthQuadTreeStrategy.js +19 -0
  268. package/lib/js/quadTree/EntityCollectionNode.d.ts +54 -0
  269. package/{src/quadTree/EntityCollectionNode.ts → lib/js/quadTree/EntityCollectionNode.js} +83 -150
  270. package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +6 -0
  271. package/lib/js/quadTree/MarsQuadTreeStrategy.js +17 -0
  272. package/lib/js/quadTree/Node.d.ts +61 -0
  273. package/{src/quadTree/Node.ts → lib/js/quadTree/Node.js} +140 -357
  274. package/lib/js/quadTree/QuadTreeStrategy.d.ts +25 -0
  275. package/{src/quadTree/QuadTreeStrategy.ts → lib/js/quadTree/QuadTreeStrategy.js} +13 -44
  276. package/lib/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
  277. package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +15 -0
  278. package/lib/js/quadTree/index.d.ts +12 -0
  279. package/lib/js/quadTree/index.js +12 -0
  280. package/lib/js/quadTree/quadTree.d.ts +40 -0
  281. package/{src/quadTree/quadTree.ts → lib/js/quadTree/quadTree.js} +0 -9
  282. package/lib/js/renderer/Renderer.d.ts +320 -0
  283. package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +265 -622
  284. package/lib/js/renderer/RendererEvents.d.ts +239 -0
  285. package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +158 -472
  286. package/lib/js/scene/Axes.d.ts +12 -0
  287. package/lib/js/scene/Axes.js +59 -0
  288. package/lib/js/scene/BaseNode.d.ts +61 -0
  289. package/{src/scene/BaseNode.ts → lib/js/scene/BaseNode.js} +11 -57
  290. package/lib/js/scene/Planet.d.ts +623 -0
  291. package/{src/scene/Planet.ts → lib/js/scene/Planet.js} +257 -937
  292. package/lib/js/scene/RenderNode.d.ts +150 -0
  293. package/{src/scene/RenderNode.ts → lib/js/scene/RenderNode.js} +33 -138
  294. package/lib/js/scene/SkyBox.d.ts +13 -0
  295. package/{src/scene/SkyBox.ts → lib/js/scene/SkyBox.js} +16 -37
  296. package/{src/scene/index.ts → lib/js/scene/index.d.ts} +0 -1
  297. package/lib/js/scene/index.js +5 -0
  298. package/lib/js/segment/Segment.d.ts +278 -0
  299. package/{src/segment/Segment.ts → lib/js/segment/Segment.js} +242 -913
  300. package/lib/js/segment/SegmentLonLat.d.ts +48 -0
  301. package/{src/segment/SegmentLonLat.ts → lib/js/segment/SegmentLonLat.js} +58 -132
  302. package/lib/js/segment/SegmentLonLatWgs84.d.ts +10 -0
  303. package/lib/js/segment/SegmentLonLatWgs84.js +23 -0
  304. package/lib/js/segment/Slice.d.ts +13 -0
  305. package/{src/segment/Slice.ts → lib/js/segment/Slice.js} +4 -22
  306. package/lib/js/segment/segmentHelper.d.ts +18 -0
  307. package/{src/segment/segmentHelper.ts → lib/js/segment/segmentHelper.js} +30 -88
  308. package/lib/js/shaders/atmos.d.ts +4 -0
  309. package/{src/shaders/atmos.ts → lib/js/shaders/atmos.js} +8 -26
  310. package/lib/js/shaders/billboard.d.ts +3 -0
  311. package/{src/shaders/billboard.ts → lib/js/shaders/billboard.js} +9 -18
  312. package/lib/js/shaders/bloom.d.ts +2 -0
  313. package/{src/shaders/bloom.ts → lib/js/shaders/bloom.js} +5 -8
  314. package/lib/js/shaders/blur.d.ts +3 -0
  315. package/{src/shaders/blur.ts → lib/js/shaders/blur.js} +11 -19
  316. package/lib/js/shaders/depth.d.ts +2 -0
  317. package/{src/shaders/depth.ts → lib/js/shaders/depth.js} +3 -6
  318. package/lib/js/shaders/drawnode.d.ts +8 -0
  319. package/{src/shaders/drawnode.ts → lib/js/shaders/drawnode.js} +23 -75
  320. package/lib/js/shaders/geoObject.d.ts +3 -0
  321. package/{src/shaders/geoObject.ts → lib/js/shaders/geoObject.js} +51 -63
  322. package/lib/js/shaders/label.d.ts +4 -0
  323. package/{src/shaders/label.ts → lib/js/shaders/label.js} +12 -25
  324. package/lib/js/shaders/lumFilter.d.ts +2 -0
  325. package/{src/shaders/lumFilter.ts → lib/js/shaders/lumFilter.js} +4 -7
  326. package/lib/js/shaders/pickingMask.d.ts +2 -0
  327. package/{src/shaders/pickingMask.ts → lib/js/shaders/pickingMask.js} +5 -8
  328. package/lib/js/shaders/pointCloud.d.ts +2 -0
  329. package/{src/shaders/pointCloud.ts → lib/js/shaders/pointCloud.js} +4 -7
  330. package/lib/js/shaders/polyline.d.ts +3 -0
  331. package/{src/shaders/polyline.ts → lib/js/shaders/polyline.js} +7 -22
  332. package/lib/js/shaders/ray.d.ts +2 -0
  333. package/{src/shaders/ray.ts → lib/js/shaders/ray.js} +4 -7
  334. package/lib/js/shaders/screenFrame.d.ts +2 -0
  335. package/{src/shaders/screenFrame.ts → lib/js/shaders/screenFrame.js} +5 -8
  336. package/lib/js/shaders/skybox.d.ts +2 -0
  337. package/{src/shaders/skybox.ts → lib/js/shaders/skybox.js} +10 -13
  338. package/lib/js/shaders/toneMapping.d.ts +2 -0
  339. package/{src/shaders/toneMapping.ts → lib/js/shaders/toneMapping.js} +5 -8
  340. package/lib/js/shaders/utils.d.ts +1 -0
  341. package/{src/shaders/utils.ts → lib/js/shaders/utils.js} +1 -1
  342. package/lib/js/terrain/BilTerrain.d.ts +18 -0
  343. package/{src/terrain/BilTerrain.ts → lib/js/terrain/BilTerrain.js} +21 -118
  344. package/lib/js/terrain/EmptyTerrain.d.ts +106 -0
  345. package/{src/terrain/EmptyTerrain.ts → lib/js/terrain/EmptyTerrain.js} +20 -144
  346. package/lib/js/terrain/Geoid.d.ts +33 -0
  347. package/lib/js/terrain/Geoid.js +191 -0
  348. package/lib/js/terrain/GlobusTerrain.d.ts +134 -0
  349. package/{src/terrain/GlobusTerrain.ts → lib/js/terrain/GlobusTerrain.js} +84 -241
  350. package/lib/js/terrain/MapboxTerrain.d.ts +21 -0
  351. package/{src/terrain/MapboxTerrain.ts → lib/js/terrain/MapboxTerrain.js} +46 -215
  352. package/{src/terrain/index.ts → lib/js/terrain/index.d.ts} +0 -1
  353. package/lib/js/terrain/index.js +5 -0
  354. package/lib/js/ui/Button.d.ts +32 -0
  355. package/lib/js/ui/Button.js +78 -0
  356. package/lib/js/ui/ButtonGroup.d.ts +16 -0
  357. package/lib/js/ui/ButtonGroup.js +41 -0
  358. package/lib/js/ui/Dialog.d.ts +55 -0
  359. package/lib/js/ui/Dialog.js +173 -0
  360. package/lib/js/ui/Slider.d.ts +38 -0
  361. package/lib/js/ui/Slider.js +129 -0
  362. package/lib/js/ui/ToggleButton.d.ts +20 -0
  363. package/lib/js/ui/ToggleButton.js +42 -0
  364. package/lib/js/ui/View.d.ts +37 -0
  365. package/{src/ui/View.ts → lib/js/ui/View.js} +31 -77
  366. package/lib/js/ui/icons.d.ts +1 -0
  367. package/{src/ui/icons.ts → lib/js/ui/icons.js} +1 -1
  368. package/lib/js/utils/BaseWorker.d.ts +14 -0
  369. package/{src/utils/BaseWorker.ts → lib/js/utils/BaseWorker.js} +15 -28
  370. package/lib/js/utils/FontAtlas.d.ts +82 -0
  371. package/{src/utils/FontAtlas.ts → lib/js/utils/FontAtlas.js} +46 -182
  372. package/lib/js/utils/GeoImageCreator.d.ts +34 -0
  373. package/{src/utils/GeoImageCreator.ts → lib/js/utils/GeoImageCreator.js} +34 -91
  374. package/lib/js/utils/ImagesCacheManager.d.ts +22 -0
  375. package/{src/utils/ImagesCacheManager.ts → lib/js/utils/ImagesCacheManager.js} +16 -38
  376. package/lib/js/utils/Loader.d.ts +63 -0
  377. package/lib/js/utils/Loader.js +156 -0
  378. package/lib/js/utils/NormalMapCreator.d.ts +52 -0
  379. package/{src/utils/NormalMapCreator.ts → lib/js/utils/NormalMapCreator.js} +64 -195
  380. package/lib/js/utils/PlainSegmentWorker.d.ts +24 -0
  381. package/{src/utils/PlainSegmentWorker.ts → lib/js/utils/PlainSegmentWorker.js} +24 -56
  382. package/lib/js/utils/TerrainWorker.d.ts +28 -0
  383. package/{src/utils/TerrainWorker.ts → lib/js/utils/TerrainWorker.js} +19 -56
  384. package/lib/js/utils/TextureAtlas.d.ts +113 -0
  385. package/{src/utils/TextureAtlas.ts → lib/js/utils/TextureAtlas.js} +40 -131
  386. package/lib/js/utils/VectorTileCreator.d.ts +18 -0
  387. package/{src/utils/VectorTileCreator.ts → lib/js/utils/VectorTileCreator.js} +61 -147
  388. package/lib/js/utils/colorTable.d.ts +3 -0
  389. package/{src/utils/colorTable.ts → lib/js/utils/colorTable.js} +2 -2
  390. package/lib/js/utils/earcut.d.ts +7 -0
  391. package/{src/utils/earcut.ts → lib/js/utils/earcut.js} +95 -223
  392. package/lib/js/utils/objParser.d.ts +24 -0
  393. package/{src/utils/objParser.ts → lib/js/utils/objParser.js} +38 -93
  394. package/lib/js/utils/shared.d.ts +267 -0
  395. package/{src/utils/shared.ts → lib/js/utils/shared.js} +185 -342
  396. package/lib/js/utils/units.d.ts +16 -0
  397. package/lib/js/utils/units.js +61 -0
  398. package/lib/js/webgl/BaseFramebuffer.d.ts +53 -0
  399. package/{src/webgl/BaseFramebuffer.ts → lib/js/webgl/BaseFramebuffer.js} +22 -59
  400. package/lib/js/webgl/Framebuffer.d.ts +69 -0
  401. package/{src/webgl/Framebuffer.ts → lib/js/webgl/Framebuffer.js} +30 -87
  402. package/lib/js/webgl/Handler.d.ts +473 -0
  403. package/{src/webgl/Handler.ts → lib/js/webgl/Handler.js} +175 -586
  404. package/lib/js/webgl/Multisample.d.ts +27 -0
  405. package/lib/js/webgl/Multisample.js +77 -0
  406. package/lib/js/webgl/Program.d.ts +159 -0
  407. package/{src/webgl/Program.ts → lib/js/webgl/Program.js} +73 -210
  408. package/lib/js/webgl/ProgramController.d.ts +86 -0
  409. package/{src/webgl/ProgramController.ts → lib/js/webgl/ProgramController.js} +11 -45
  410. package/{src/webgl/index.ts → lib/js/webgl/index.d.ts} +1 -8
  411. package/lib/js/webgl/index.js +6 -0
  412. package/lib/js/webgl/types.d.ts +9 -0
  413. package/{src/webgl/types.ts → lib/js/webgl/types.js} +5 -8
  414. package/lib/js/webgl/variableHandlers.d.ts +22 -0
  415. package/lib/js/webgl/variableHandlers.js +78 -0
  416. package/package.json +23 -34
  417. package/dist/@openglobus/og.esm.js +0 -2
  418. package/dist/@openglobus/og.esm.js.map +0 -1
  419. package/dist/@openglobus/og.umd.js +0 -2
  420. package/dist/@openglobus/og.umd.js.map +0 -1
  421. package/src/Deferred.ts +0 -17
  422. package/src/control/MouseWheelZoomControl.ts +0 -269
  423. package/src/control/ScaleControl.ts +0 -131
  424. package/src/control/SegmentBoundVisualization.ts +0 -50
  425. package/src/control/ShowFps.ts +0 -28
  426. package/src/control/ToggleWireframe.ts +0 -35
  427. package/src/control/ruler/Ruler.ts +0 -35
  428. package/src/control/ruler/RulerScene.ts +0 -437
  429. package/src/control/timeline/timelineUtils.ts +0 -133
  430. package/src/ellipsoid/index.ts +0 -4
  431. package/src/entity/Geometry.ts +0 -486
  432. package/src/index.ts +0 -173
  433. package/src/layer/GeoTexture2d.ts +0 -56
  434. package/src/layer/index.ts +0 -12
  435. package/src/math/Line3.ts +0 -162
  436. package/src/math/index.ts +0 -26
  437. package/src/quadTree/EPSG4326QuadTreeStrategy.ts +0 -24
  438. package/src/quadTree/EarthQuadTreeStrategy.ts +0 -28
  439. package/src/quadTree/MarsQuadTreeStrategy.ts +0 -25
  440. package/src/quadTree/Wgs84QuadTreeStrategy.ts +0 -22
  441. package/src/quadTree/index.ts +0 -14
  442. package/src/scene/Axes.ts +0 -78
  443. package/src/segment/SegmentLonLatWgs84.ts +0 -33
  444. package/src/terrain/Geoid.ts +0 -273
  445. package/src/ui/Button.ts +0 -121
  446. package/src/ui/ButtonGroup.ts +0 -63
  447. package/src/ui/Dialog.ts +0 -244
  448. package/src/ui/Slider.ts +0 -188
  449. package/src/ui/ToggleButton.ts +0 -68
  450. package/src/utils/Loader.ts +0 -247
  451. package/src/utils/units.ts +0 -78
  452. package/src/webgl/Multisample.ts +0 -153
  453. package/src/webgl/variableHandlers.ts +0 -114
  454. /package/{dist → lib}/@openglobus/og.css +0 -0
  455. /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.json +0 -0
  456. /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.cfg +0 -0
  457. /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
  458. /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.json +0 -0
  459. /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.cfg +0 -0
  460. /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
  461. /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.json +0 -0
  462. /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.cfg +0 -0
  463. /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
  464. /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.json +0 -0
  465. /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +0 -0
  466. /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
  467. /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.json +0 -0
  468. /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +0 -0
  469. /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
  470. /package/{dist → lib}/@openglobus/res/fonts/arial.js +0 -0
  471. /package/{dist → lib}/@openglobus/res/fonts/arial.json +0 -0
  472. /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.cfg +0 -0
  473. /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.png +0 -0
  474. /package/{dist → lib}/@openglobus/res/night-4326.png +0 -0
  475. /package/{dist → lib}/@openglobus/res/night.png +0 -0
  476. /package/{dist → lib}/@openglobus/res/spec.png +0 -0
@@ -1,64 +1,24 @@
1
- import {Extent} from "../Extent";
2
- import {EPSG3857} from "../proj/EPSG3857";
3
- import {EPSG4326} from "../proj/EPSG4326";
4
- import {getMatrixSubArray32, getMatrixSubArray64, getMatrixSubArrayBoundsExt} from "../utils/shared";
5
- import {LonLat} from "../LonLat";
6
- import {MAX, MIN} from "../math";
7
- import {MAX_LAT} from "../mercator";
8
- import {Planet} from "../scene/Planet";
9
- import {Segment} from "../segment/Segment";
10
-
11
- import {Vec2} from "../math/Vec2";
12
- import {Vec3} from "../math/Vec3";
13
- import {
14
- COMSIDE,
15
- E,
16
- MAX_RENDERED_NODES,
17
- N,
18
- NE,
19
- NEIGHBOUR,
20
- NOTRENDERING,
21
- NW,
22
- OPPART,
23
- OPSIDE,
24
- PARTOFFSET,
25
- RENDERING,
26
- S,
27
- SE,
28
- SW,
29
- VISIBLE_DISTANCE,
30
- W,
31
- WALKTHROUGH
32
- } from "./quadTree";
33
-
34
- import {
35
- TILEGROUP_COMMON,
36
- TILEGROUP_NORTH,
37
- TILEGROUP_SOUTH
38
- } from "../segment/Segment";
39
-
40
- import {PlanetCamera} from "../camera/PlanetCamera";
41
-
42
- let _tempHigh = new Vec3(),
43
- _tempLow = new Vec3();
44
-
45
- const _vertOrder: Vec2[] = [
1
+ import { Extent } from "../Extent";
2
+ import { EPSG3857 } from "../proj/EPSG3857";
3
+ import { EPSG4326 } from "../proj/EPSG4326";
4
+ import { getMatrixSubArray32, getMatrixSubArray64, getMatrixSubArrayBoundsExt } from "../utils/shared";
5
+ import { LonLat } from "../LonLat";
6
+ import { MAX, MIN } from "../math";
7
+ import { MAX_LAT } from "../mercator";
8
+ import { Vec2 } from "../math/Vec2";
9
+ import { Vec3 } from "../math/Vec3";
10
+ import { E, MAX_RENDERED_NODES, N, NE, NEIGHBOUR, NOTRENDERING, NW, OPPART, OPSIDE, PARTOFFSET, RENDERING, S, SE, SW, VISIBLE_DISTANCE, W, WALKTHROUGH } from "./quadTree";
11
+ import { TILEGROUP_COMMON, TILEGROUP_NORTH, TILEGROUP_SOUTH } from "../segment/Segment";
12
+ let _tempHigh = new Vec3(), _tempLow = new Vec3();
13
+ const _vertOrder = [
46
14
  new Vec2(0, 0), new Vec2(1, 0),
47
15
  new Vec2(0, 1), new Vec2(1, 1)
48
16
  ];
49
-
50
17
  const _neGridSize = Math.sqrt(_vertOrder.length) - 1;
51
-
52
- type BoundsType = {
53
- xmin: number; ymin: number; zmin: number;
54
- xmax: number; ymax: number; zmax: number
55
- };
56
-
57
- let BOUNDS: BoundsType = {
18
+ let BOUNDS = {
58
19
  xmin: 0.0, ymin: 0.0, zmin: 0.0,
59
20
  xmax: 0.0, ymax: 0.0, zmax: 0.0
60
21
  };
61
-
62
22
  /**
63
23
  * Quad tree planet segment node.
64
24
  * @constructor
@@ -71,33 +31,8 @@ let BOUNDS: BoundsType = {
71
31
  * @param {Extent} extent - Planet segment extent.
72
32
  */
73
33
  class Node {
74
- public SegmentPrototype: typeof Segment;
75
- public planet: Planet;
76
- public parentNode: Node | null;
77
- public partId: number;
78
- public nodeId: number;
79
- public state: number | null;
80
- public appliedTerrainNodeId: number;
81
- public sideSizeLog2: [number, number, number, number];
82
- public ready: boolean;
83
- public neighbors: [Node[], Node[], Node[], Node[]];
84
- public equalizedSideWithNodeId: number[];
85
- public nodes: [Node, Node, Node, Node] | [];
86
- public segment: Segment;
87
- public _cameraInside: boolean;
88
- public inFrustum: number;
89
-
90
- constructor(
91
- SegmentPrototype: typeof Segment,
92
- planet: Planet,
93
- partId: number,
94
- parent: Node | null,
95
- id: number,
96
- tileZoom: number,
97
- extent: Extent
98
- ) {
34
+ constructor(SegmentPrototype, planet, partId, parent, id, tileZoom, extent) {
99
35
  planet._createdNodesCount++;
100
-
101
36
  this.SegmentPrototype = SegmentPrototype;
102
37
  this.planet = planet;
103
38
  this.parentNode = parent;
@@ -115,8 +50,7 @@ class Node {
115
50
  this.inFrustum = 0;
116
51
  this.createBounds();
117
52
  }
118
-
119
- public createChildrenNodes() {
53
+ createChildrenNodes() {
120
54
  this.ready = true;
121
55
  const p = this.planet;
122
56
  const ps = this.segment;
@@ -129,38 +63,30 @@ class Node {
129
63
  const id = this.nodeId * 4 + 1;
130
64
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
131
65
  const nd = this.nodes;
132
-
133
66
  nd[NW] = new Node(this.SegmentPrototype, p, NW, this, id, z, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)));
134
67
  nd[NE] = new Node(this.SegmentPrototype, p, NE, this, id, z, new Extent(c, new LonLat(ne.lon, ne.lat)));
135
68
  nd[SW] = new Node(this.SegmentPrototype, p, SW, this, id, z, new Extent(new LonLat(sw.lon, sw.lat), c));
136
69
  nd[SE] = new Node(this.SegmentPrototype, p, SE, this, id, z, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)));
137
70
  }
138
-
139
- public createBounds() {
140
-
71
+ createBounds() {
141
72
  let seg = this.segment;
142
-
143
73
  seg._setExtentLonLat();
144
-
145
74
  if (seg.tileZoom === 0) {
146
75
  seg.setBoundingSphere(0.0, 0.0, 0.0, new Vec3(0.0, 0.0, seg.planet.ellipsoid.equatorialSize));
147
- } else if (seg.tileZoom < seg.planet.terrain!.minZoom) {
76
+ }
77
+ else if (seg.tileZoom < seg.planet.terrain.minZoom) {
148
78
  seg.createBoundsByExtent();
149
- } else {
79
+ }
80
+ else {
150
81
  seg.createBoundsByParent();
151
82
  }
152
-
153
- let x = seg.bsphere.center.x,
154
- y = seg.bsphere.center.y,
155
- z = seg.bsphere.center.z;
156
-
83
+ let x = seg.bsphere.center.x, y = seg.bsphere.center.y, z = seg.bsphere.center.z;
157
84
  let length = 1.0 / Math.sqrt(x * x + y * y + z * z);
158
85
  seg.centerNormal.x = x * length;
159
86
  seg.centerNormal.y = y * length;
160
87
  seg.centerNormal.z = z * length;
161
88
  }
162
-
163
- public getState(): number | null {
89
+ getState() {
164
90
  if (this.state === -1) {
165
91
  return this.state;
166
92
  }
@@ -173,20 +99,20 @@ class Node {
173
99
  }
174
100
  return this.state;
175
101
  }
176
-
177
102
  /**
178
103
  * Returns the same deep existent neighbour node.
179
104
  * @public
180
105
  * @param {number} side - Neighbour side index e.g. og.quadTree.N, og.quadTree.W etc.
181
106
  * @returns {Node} -
182
107
  */
183
- public getEqualNeighbor(side: number): Node | undefined {
184
- let pn: Node = this;
108
+ getEqualNeighbor(side) {
109
+ let pn = this;
185
110
  let part = NEIGHBOUR[side][pn.partId];
186
111
  if (part !== -1) {
187
112
  // (!) it means that we would never ask to get head node neighbors
188
- return pn.parentNode!.nodes[part];
189
- } else {
113
+ return pn.parentNode.nodes[part];
114
+ }
115
+ else {
190
116
  let pathId = [];
191
117
  while (pn.parentNode) {
192
118
  pathId.push(pn.partId);
@@ -204,18 +130,14 @@ class Node {
204
130
  }
205
131
  }
206
132
  }
207
-
208
133
  // public isBrother(node: Node): boolean {
209
134
  // return !(this.parentNode || node.parentNode) || (this.parentNode!.nodeId === node.parentNode!.nodeId);
210
135
  // }
211
-
212
- public renderTree(cam: PlanetCamera, maxZoom?: number | null, terrainReadySegment?: Segment | null, stopLoading?: boolean) {
136
+ renderTree(cam, maxZoom, terrainReadySegment, stopLoading) {
213
137
  if (this.planet._renderedNodes.length >= MAX_RENDERED_NODES) {
214
138
  return;
215
139
  }
216
-
217
140
  this.state = WALKTHROUGH;
218
-
219
141
  // @ts-ignore
220
142
  this.neighbors[0] = null;
221
143
  // @ts-ignore
@@ -224,43 +146,36 @@ class Node {
224
146
  this.neighbors[2] = null;
225
147
  // @ts-ignore
226
148
  this.neighbors[3] = null;
227
-
228
149
  this.neighbors[0] = [];
229
150
  this.neighbors[1] = [];
230
151
  this.neighbors[2] = [];
231
152
  this.neighbors[3] = [];
232
-
233
- let seg = this.segment,
234
- planet = this.planet;
235
-
153
+ let seg = this.segment, planet = this.planet;
236
154
  this._cameraInside = false;
237
-
238
155
  // Search a node which the camera is flying over.
239
156
  if (!this.parentNode || this.parentNode._cameraInside) {
240
157
  let inside;
241
158
  if (Math.abs(cam._lonLat.lat) <= MAX_LAT && seg._projection.id === EPSG3857.id) {
242
159
  inside = seg._extent.isInside(cam._lonLatMerc);
243
- } else if (seg._projection.id === EPSG4326.id) {
160
+ }
161
+ else if (seg._projection.id === EPSG4326.id) {
244
162
  inside = seg._extent.isInside(cam._lonLat);
245
163
  }
246
-
247
164
  if (inside) {
248
165
  cam._insideSegment = seg;
249
166
  this._cameraInside = true;
250
167
  }
251
168
  }
252
-
253
169
  this.inFrustum = 0;
254
-
255
170
  let frustums = cam.frustums, numFrustums = frustums.length;
256
-
257
171
  if (seg.tileZoom < 6) {
258
172
  for (let i = 0; i < numFrustums; i++) {
259
173
  if (frustums[i].containsSphere(seg.bsphere)) {
260
174
  this.inFrustum |= 1 << i;
261
175
  }
262
176
  }
263
- } else {
177
+ }
178
+ else {
264
179
  let commonFrustumFlag = 1 << (numFrustums - 1 - 1);
265
180
  for (let i = 0; commonFrustumFlag && i < numFrustums; i++) {
266
181
  if (seg.terrainReady) {
@@ -268,7 +183,8 @@ class Node {
268
183
  commonFrustumFlag >>= 1;
269
184
  this.inFrustum |= 1 << i;
270
185
  }
271
- } else {
186
+ }
187
+ else {
272
188
  if (frustums[i].containsSphere(seg.bsphere)) {
273
189
  commonFrustumFlag >>= 1;
274
190
  this.inFrustum |= 1 << i;
@@ -276,158 +192,130 @@ class Node {
276
192
  }
277
193
  }
278
194
  }
279
-
280
195
  if (this.inFrustum || this._cameraInside || seg.tileZoom < 3) {
281
196
  let h = Math.abs(cam._lonLat.height);
282
-
283
197
  let eye = cam.eye;
284
198
  let horizonDist = eye.length2() - this.planet.ellipsoid.polarSizeSqr;
285
-
286
199
  let altVis = seg.tileZoom > 19 || (seg.tileZoom < 5 && !seg.terrainReady) || seg.tileZoom < 2;
287
-
288
200
  if (h > 21000) {
289
201
  altVis = altVis || eye.distance2(seg._sw) < horizonDist || eye.distance2(seg._nw) < horizonDist || eye.distance2(seg._ne) < horizonDist || eye.distance2(seg._se) < horizonDist;
290
- } else {
202
+ }
203
+ else {
291
204
  altVis = altVis || cam.eye.distance(seg.bsphere.center) - seg.bsphere.radius < VISIBLE_DISTANCE * Math.sqrt(h);
292
205
  }
293
-
294
206
  if ((this.inFrustum && (altVis || h > 10000.0)) || this._cameraInside) {
295
207
  //@todo: replace to the strategy
296
208
  seg._collectVisibleNodes();
297
209
  }
298
-
299
210
  if (seg.tileZoom < 2) {
300
211
  this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading);
301
- } else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize || maxZoom && ((seg.tileZoom === maxZoom) || !altVis))) {
302
-
212
+ }
213
+ else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize || maxZoom && ((seg.tileZoom === maxZoom) || !altVis))) {
303
214
  if (altVis) {
304
215
  seg.passReady = true;
305
216
  this.renderNode(this.inFrustum, !this.inFrustum, terrainReadySegment, stopLoading);
306
- } else {
217
+ }
218
+ else {
307
219
  this.state = NOTRENDERING;
308
220
  }
309
-
310
- } else if (seg.terrainReady && seg.checkZoom() && (!maxZoom || cam.projectedSize(seg.bsphere.center, seg.bsphere.radius) > this.planet._maxLodSize)) {
221
+ }
222
+ else if (seg.terrainReady && seg.checkZoom() && (!maxZoom || cam.projectedSize(seg.bsphere.center, seg.bsphere.radius) > this.planet._maxLodSize)) {
311
223
  this.traverseNodes(cam, maxZoom, seg, stopLoading);
312
- } else if (altVis) {
224
+ }
225
+ else if (altVis) {
313
226
  seg.passReady = maxZoom ? seg.terrainReady : false;
314
227
  this.renderNode(this.inFrustum, !this.inFrustum, terrainReadySegment, stopLoading);
315
- } else {
228
+ }
229
+ else {
316
230
  this.state = NOTRENDERING;
317
231
  }
318
- } else {
232
+ }
233
+ else {
319
234
  this.state = NOTRENDERING;
320
235
  }
321
236
  }
322
-
323
- public traverseNodes(cam: PlanetCamera, maxZoom?: number | null, terrainReadySegment?: Segment | null, stopLoading?: boolean) {
237
+ traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading) {
324
238
  if (!this.ready) {
325
239
  this.createChildrenNodes();
326
240
  }
327
-
328
241
  let n = this.nodes;
329
-
330
- n[0]!.renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
331
- n[1]!.renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
332
- n[2]!.renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
333
- n[3]!.renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
242
+ n[0].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
243
+ n[1].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
244
+ n[2].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
245
+ n[3].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
334
246
  }
335
-
336
- public renderNode(inFrustum: number, onlyTerrain?: boolean, terrainReadySegment?: Segment | null, stopLoading?: boolean) {
247
+ renderNode(inFrustum, onlyTerrain, terrainReadySegment, stopLoading) {
337
248
  let seg = this.segment;
338
-
339
249
  // Create and load terrain data
340
250
  if (!seg.terrainReady) {
341
251
  if (!seg.initialized) {
342
252
  seg.initialize();
343
253
  }
344
-
345
254
  this.whileTerrainLoading(terrainReadySegment);
346
-
347
255
  if (!seg.plainProcessing) {
348
256
  seg.createPlainSegmentAsync();
349
257
  }
350
-
351
258
  if (seg.plainReady && !stopLoading) {
352
259
  seg.loadTerrain();
353
260
  }
354
261
  }
355
-
356
262
  // Create normal map texture
357
263
  if (seg.planet.lightEnabled && !seg.normalMapReady) {
358
264
  this.whileNormalMapCreating();
359
265
  }
360
-
361
266
  if (onlyTerrain) {
362
267
  this.state = -1;
363
268
  return;
364
269
  }
365
-
366
270
  // Calculate minimal and maximal zoom index on the screen
367
271
  if (!this._cameraInside && seg.tileZoom > this.planet.maxCurrZoom) {
368
272
  this.planet.maxCurrZoom = seg.tileZoom;
369
273
  }
370
-
371
274
  if (seg.tileZoom < this.planet.minCurrZoom) {
372
275
  this.planet.minCurrZoom = seg.tileZoom;
373
276
  }
374
-
375
277
  seg._addViewExtent();
376
-
377
278
  // Finally this node proceeds to rendering.
378
279
  this.addToRender(inFrustum);
379
280
  }
380
-
381
281
  /**
382
282
  * Searching for neighbours and picking up current node to render processing.
383
283
  * @public
384
284
  */
385
- public addToRender(inFrustum: number) {
285
+ addToRender(inFrustum) {
386
286
  this.state = RENDERING;
387
-
388
287
  let nodes = this.planet._renderedNodes;
389
-
390
288
  for (let i = nodes.length - 1; i >= 0; --i) {
391
289
  const ni = nodes[i];
392
290
  const cs = this.getCommonSide(ni);
393
-
394
291
  if (cs !== -1) {
395
292
  const opcs = OPSIDE[cs];
396
-
397
293
  if (this.neighbors[cs].length === 0 || ni.neighbors[opcs].length === 0) {
398
294
  const ap = this.segment;
399
295
  const bp = ni.segment;
400
296
  const ld = ap.gridSize / (bp.gridSize * Math.pow(2, bp.tileZoom - ap.tileZoom));
401
-
402
- let cs_size = ap.gridSize,
403
- opcs_size = bp.gridSize;
404
-
297
+ let cs_size = ap.gridSize, opcs_size = bp.gridSize;
405
298
  if (ld > 1) {
406
299
  cs_size = Math.ceil(ap.gridSize / ld);
407
300
  opcs_size = bp.gridSize;
408
- } else if (ld < 1) {
301
+ }
302
+ else if (ld < 1) {
409
303
  cs_size = ap.gridSize;
410
304
  opcs_size = Math.ceil(bp.gridSize * ld);
411
305
  }
412
-
413
306
  this.sideSizeLog2[cs] = Math.log2(cs_size);
414
307
  ni.sideSizeLog2[opcs] = Math.log2(opcs_size);
415
308
  }
416
-
417
309
  this.neighbors[cs].push(ni);
418
310
  ni.neighbors[opcs].push(this);
419
311
  }
420
312
  }
421
-
422
313
  nodes.push(this);
423
-
424
314
  if (!this.segment.terrainReady) {
425
315
  this.planet._renderCompleted = false;
426
316
  this.planet._terrainCompleted = false;
427
317
  }
428
-
429
- let k = 0,
430
- rf = this.planet._renderedNodesInFrustum;
318
+ let k = 0, rf = this.planet._renderedNodesInFrustum;
431
319
  while (inFrustum) {
432
320
  if (inFrustum & 1) {
433
321
  rf[k].push(this);
@@ -436,52 +324,52 @@ class Node {
436
324
  inFrustum >>= 1;
437
325
  }
438
326
  }
439
-
440
- public getCommonSide(node: Node): number {
327
+ getCommonSide(node) {
441
328
  const as = this.segment;
442
329
  const bs = node.segment;
443
-
444
330
  if (as.tileZoom === bs.tileZoom && as._tileGroup === bs._tileGroup) {
445
331
  return as.getNeighborSide(bs);
446
- } else {
332
+ }
333
+ else {
447
334
  const a = as._extentLonLat;
448
335
  const b = bs._extentLonLat;
449
-
450
336
  let a_ne = a.northEast, a_sw = a.southWest, b_ne = b.northEast, b_sw = b.southWest;
451
-
452
- let a_ne_lon = a_ne.lon, a_ne_lat = a_ne.lat, a_sw_lon = a_sw.lon, a_sw_lat = a_sw.lat, b_ne_lon = b_ne.lon,
453
- b_ne_lat = b_ne.lat, b_sw_lon = b_sw.lon, b_sw_lat = b_sw.lat;
454
-
337
+ let a_ne_lon = a_ne.lon, a_ne_lat = a_ne.lat, a_sw_lon = a_sw.lon, a_sw_lat = a_sw.lat, b_ne_lon = b_ne.lon, b_ne_lat = b_ne.lat, b_sw_lon = b_sw.lon, b_sw_lat = b_sw.lat;
455
338
  if (as._tileGroup === bs._tileGroup) {
456
339
  if (a_ne_lon === b_sw_lon && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
457
340
  return E;
458
- } else if (a_sw_lon === b_ne_lon && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
341
+ }
342
+ else if (a_sw_lon === b_ne_lon && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
459
343
  return W;
460
- } else if (a_ne_lat === b_sw_lat && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
344
+ }
345
+ else if (a_ne_lat === b_sw_lat && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
461
346
  return N;
462
- } else if (a_sw_lat === b_ne_lat && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
347
+ }
348
+ else if (a_sw_lat === b_ne_lat && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
463
349
  return S;
464
- } else if (bs.tileX === 0 && as.tileX === Math.pow(2, as.tileZoom) - 1 && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
350
+ }
351
+ else if (bs.tileX === 0 && as.tileX === Math.pow(2, as.tileZoom) - 1 && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
465
352
  return E;
466
- } else if (as.tileX === 0 && bs.tileX === Math.pow(2, bs.tileZoom) - 1 && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
353
+ }
354
+ else if (as.tileX === 0 && bs.tileX === Math.pow(2, bs.tileZoom) - 1 && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
467
355
  return W;
468
356
  }
469
357
  }
470
-
471
358
  if (as._tileGroup === TILEGROUP_COMMON && bs._tileGroup === TILEGROUP_NORTH && as.tileY === 0 && bs.tileY === Math.pow(2, bs.tileZoom) - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
472
359
  return N;
473
- } else if (as._tileGroup === TILEGROUP_SOUTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === 0 && bs.tileY === Math.pow(2, bs.tileZoom) - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
360
+ }
361
+ else if (as._tileGroup === TILEGROUP_SOUTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === 0 && bs.tileY === Math.pow(2, bs.tileZoom) - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
474
362
  return N;
475
- } else if (bs._tileGroup === TILEGROUP_NORTH && as._tileGroup === TILEGROUP_COMMON && as.tileY === Math.pow(2, as.tileZoom) - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
363
+ }
364
+ else if (bs._tileGroup === TILEGROUP_NORTH && as._tileGroup === TILEGROUP_COMMON && as.tileY === Math.pow(2, as.tileZoom) - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
476
365
  return S;
477
- } else if (as._tileGroup === TILEGROUP_NORTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === Math.pow(2, as.tileZoom) - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
366
+ }
367
+ else if (as._tileGroup === TILEGROUP_NORTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === Math.pow(2, as.tileZoom) - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
478
368
  return S;
479
369
  }
480
370
  }
481
-
482
371
  return -1;
483
372
  }
484
-
485
373
  // // TODO: test test test
486
374
  // public ___getCommonSide___(b: Node) {
487
375
  // let a = this, as = a.segment, bs = b.segment;
@@ -536,233 +424,147 @@ class Node {
536
424
  //
537
425
  // return -1;
538
426
  // }
539
-
540
- public whileNormalMapCreating() {
541
-
427
+ whileNormalMapCreating() {
542
428
  const seg = this.segment;
543
-
544
429
  if (!seg.terrainIsLoading && seg.terrainExists && !seg._inTheQueue) {
545
430
  seg.planet._normalMapCreator.queue(seg);
546
431
  }
547
-
548
- let pn: Node = this;
432
+ let pn = this;
549
433
  while (pn.parentNode && !pn.segment.normalMapReady) {
550
434
  pn = pn.parentNode;
551
435
  }
552
-
553
436
  const dZ2 = 2 << (seg.tileZoom - pn.segment.tileZoom - 1);
554
-
555
437
  seg.normalMapTexture = pn.segment.normalMapTexture;
556
438
  seg.normalMapTextureBias[0] = seg.tileX - pn.segment.tileX * dZ2;
557
439
  seg.normalMapTextureBias[1] = seg.tileY - pn.segment.tileY * dZ2;
558
440
  seg.normalMapTextureBias[2] = 1.0 / dZ2;
559
441
  }
560
-
561
- public whileTerrainLoading(terrainReadySegment?: Segment | null) {
562
-
442
+ whileTerrainLoading(terrainReadySegment) {
563
443
  const seg = this.segment;
564
-
565
- let pn: Node = this;
566
-
444
+ let pn = this;
567
445
  if (terrainReadySegment && terrainReadySegment.terrainReady) {
568
446
  pn = terrainReadySegment.node;
569
- } else {
447
+ }
448
+ else {
570
449
  while (pn.parentNode && !pn.segment.terrainReady) {
571
450
  pn = pn.parentNode;
572
451
  }
573
452
  }
574
-
575
453
  if (pn.segment.terrainReady && this.appliedTerrainNodeId !== pn.nodeId) {
576
-
577
- let dZ2 = 2 << (seg.tileZoom - pn.segment.tileZoom - 1),
578
- offsetX = seg.tileX - pn.segment.tileX * dZ2,
579
- offsetY = seg.tileY - pn.segment.tileY * dZ2;
580
-
454
+ let dZ2 = 2 << (seg.tileZoom - pn.segment.tileZoom - 1), offsetX = seg.tileX - pn.segment.tileX * dZ2, offsetY = seg.tileY - pn.segment.tileY * dZ2;
581
455
  const pseg = pn.segment;
582
-
583
- let tempVertices: Float64Array,
584
- tempVerticesHigh: Float32Array,
585
- tempVerticesLow: Float32Array,
586
- noDataVertices: Uint8Array;
587
-
456
+ let tempVertices, tempVerticesHigh, tempVerticesLow, noDataVertices;
588
457
  this.appliedTerrainNodeId = pn.nodeId;
589
458
  this.equalizedSideWithNodeId[N] = this.equalizedSideWithNodeId[E] = this.equalizedSideWithNodeId[S] = this.equalizedSideWithNodeId[W] = this.appliedTerrainNodeId;
590
-
591
- let gridSize = pn.segment.gridSize / dZ2,
592
- gridSizeExt = pn.segment.fileGridSize / dZ2;
593
-
459
+ let gridSize = pn.segment.gridSize / dZ2, gridSizeExt = pn.segment.fileGridSize / dZ2;
594
460
  BOUNDS.xmin = MAX;
595
461
  BOUNDS.xmax = MIN;
596
462
  BOUNDS.ymin = MAX;
597
463
  BOUNDS.ymax = MIN;
598
464
  BOUNDS.zmin = MAX;
599
465
  BOUNDS.zmax = MIN;
600
-
601
466
  if (gridSize >= 1) {
602
467
  seg.gridSize = gridSize;
603
-
604
468
  let len = (gridSize + 1) * (gridSize + 1) * 3;
605
469
  tempVertices = new Float64Array(len);
606
470
  tempVerticesHigh = new Float32Array(len);
607
471
  tempVerticesLow = new Float32Array(len);
608
-
609
472
  if (pseg.noDataVertices) {
610
473
  noDataVertices = new Uint8Array(len / 3);
611
474
  }
612
-
613
- getMatrixSubArrayBoundsExt(
614
- pseg.terrainVertices!,
615
- pseg.terrainVerticesHigh!,
616
- pseg.terrainVerticesLow!,
617
- pseg.noDataVertices!,
618
- pseg.gridSize,
619
- gridSize * offsetY,
620
- gridSize * offsetX,
621
- gridSize,
622
- tempVertices,
623
- tempVerticesHigh,
624
- tempVerticesLow,
625
- BOUNDS,
626
- noDataVertices!
627
- );
628
-
629
- } else if (gridSizeExt >= 1 && pn.segment.terrainExists) {
630
-
475
+ getMatrixSubArrayBoundsExt(pseg.terrainVertices, pseg.terrainVerticesHigh, pseg.terrainVerticesLow, pseg.noDataVertices, pseg.gridSize, gridSize * offsetY, gridSize * offsetX, gridSize, tempVertices, tempVerticesHigh, tempVerticesLow, BOUNDS, noDataVertices);
476
+ }
477
+ else if (gridSizeExt >= 1 && pn.segment.terrainExists) {
631
478
  seg.gridSize = gridSizeExt;
632
-
633
479
  let len = (gridSizeExt + 1) * (gridSizeExt + 1) * 3;
634
480
  tempVertices = new Float64Array(len);
635
481
  tempVerticesHigh = new Float32Array(len);
636
482
  tempVerticesLow = new Float32Array(len);
637
-
638
483
  if (pseg.noDataVertices) {
639
484
  noDataVertices = new Uint8Array(len / 3);
640
485
  }
641
-
642
- getMatrixSubArrayBoundsExt(
643
- pseg.normalMapVertices!,
644
- pseg.normalMapVerticesHigh!,
645
- pseg.normalMapVerticesLow!,
646
- pseg.noDataVertices!,
647
- pn.segment.fileGridSize,
648
- gridSizeExt * offsetY,
649
- gridSizeExt * offsetX,
650
- gridSizeExt,
651
- tempVertices,
652
- tempVerticesHigh,
653
- tempVerticesLow,
654
- BOUNDS,
655
- noDataVertices!
656
- );
657
-
658
- } else {
659
-
486
+ getMatrixSubArrayBoundsExt(pseg.normalMapVertices, pseg.normalMapVerticesHigh, pseg.normalMapVerticesLow, pseg.noDataVertices, pn.segment.fileGridSize, gridSizeExt * offsetY, gridSizeExt * offsetX, gridSizeExt, tempVertices, tempVerticesHigh, tempVerticesLow, BOUNDS, noDataVertices);
487
+ }
488
+ else {
660
489
  seg.gridSize = _neGridSize;
661
-
662
- let i0 = Math.floor(gridSize * offsetY),
663
- j0 = Math.floor(gridSize * offsetX);
664
-
490
+ let i0 = Math.floor(gridSize * offsetY), j0 = Math.floor(gridSize * offsetX);
665
491
  let bigOne;
666
492
  if (pseg.gridSize === 1) {
667
- bigOne = pseg.terrainVertices!;
668
- } else {
669
- bigOne = getMatrixSubArray64(pseg.terrainVertices!, pseg.gridSize, i0, j0, 1);
493
+ bigOne = pseg.terrainVertices;
494
+ }
495
+ else {
496
+ bigOne = getMatrixSubArray64(pseg.terrainVertices, pseg.gridSize, i0, j0, 1);
670
497
  }
671
-
672
498
  let insideSize = 1.0 / gridSize;
673
-
674
499
  let t_i0 = offsetY - insideSize * i0, t_j0 = offsetX - insideSize * j0;
675
-
676
- let v_lt = new Vec3(bigOne[0], bigOne[1], bigOne[2]),
677
- v_rb = new Vec3(bigOne[9], bigOne[10], bigOne[11]);
678
-
679
- let vn = new Vec3(bigOne[3] - bigOne[0], bigOne[4] - bigOne[1], bigOne[5] - bigOne[2]),
680
- vw = new Vec3(bigOne[6] - bigOne[0], bigOne[7] - bigOne[1], bigOne[8] - bigOne[2]),
681
- ve = new Vec3(bigOne[3] - bigOne[9], bigOne[4] - bigOne[10], bigOne[5] - bigOne[11]),
682
- vs = new Vec3(bigOne[6] - bigOne[9], bigOne[7] - bigOne[10], bigOne[8] - bigOne[11]);
683
-
500
+ let v_lt = new Vec3(bigOne[0], bigOne[1], bigOne[2]), v_rb = new Vec3(bigOne[9], bigOne[10], bigOne[11]);
501
+ let vn = new Vec3(bigOne[3] - bigOne[0], bigOne[4] - bigOne[1], bigOne[5] - bigOne[2]), vw = new Vec3(bigOne[6] - bigOne[0], bigOne[7] - bigOne[1], bigOne[8] - bigOne[2]), ve = new Vec3(bigOne[3] - bigOne[9], bigOne[4] - bigOne[10], bigOne[5] - bigOne[11]), vs = new Vec3(bigOne[6] - bigOne[9], bigOne[7] - bigOne[10], bigOne[8] - bigOne[11]);
684
502
  let coords = new Vec3();
685
-
686
503
  tempVertices = new Float64Array(3 * _vertOrder.length);
687
504
  tempVerticesHigh = new Float32Array(3 * _vertOrder.length);
688
505
  tempVerticesLow = new Float32Array(3 * _vertOrder.length);
689
-
690
506
  for (let i = 0; i < _vertOrder.length; i++) {
691
507
  let vi_y = _vertOrder[i].y + t_i0, vi_x = _vertOrder[i].x + t_j0;
692
-
693
508
  let vi_x_is = vi_x * gridSize, vi_y_is = vi_y * gridSize;
694
-
695
509
  if (vi_y + vi_x < insideSize) {
696
510
  coords = vn.scaleTo(vi_x_is).addA(vw.scaleTo(vi_y_is)).addA(v_lt);
697
- } else {
511
+ }
512
+ else {
698
513
  coords = vs.scaleTo(1 - vi_x_is).addA(ve.scaleTo(1 - vi_y_is)).addA(v_rb);
699
514
  }
700
-
701
515
  Vec3.doubleToTwoFloats(coords, _tempHigh, _tempLow);
702
-
703
516
  let i3 = i * 3;
704
-
705
517
  tempVertices[i3] = coords.x;
706
518
  tempVertices[i3 + 1] = coords.y;
707
519
  tempVertices[i3 + 2] = coords.z;
708
-
709
520
  tempVerticesHigh[i3] = _tempHigh.x;
710
521
  tempVerticesHigh[i3 + 1] = _tempHigh.y;
711
522
  tempVerticesHigh[i3 + 2] = _tempHigh.z;
712
-
713
523
  tempVerticesLow[i3] = _tempLow.x;
714
524
  tempVerticesLow[i3 + 1] = _tempLow.y;
715
525
  tempVerticesLow[i3 + 2] = _tempLow.z;
716
-
717
- if (coords.x < BOUNDS.xmin) BOUNDS.xmin = coords.x;
718
- if (coords.x > BOUNDS.xmax) BOUNDS.xmax = coords.x;
719
- if (coords.y < BOUNDS.ymin) BOUNDS.ymin = coords.y;
720
- if (coords.y > BOUNDS.ymax) BOUNDS.ymax = coords.y;
721
- if (coords.z < BOUNDS.zmin) BOUNDS.zmin = coords.z;
722
- if (coords.z > BOUNDS.zmax) BOUNDS.zmax = coords.z;
526
+ if (coords.x < BOUNDS.xmin)
527
+ BOUNDS.xmin = coords.x;
528
+ if (coords.x > BOUNDS.xmax)
529
+ BOUNDS.xmax = coords.x;
530
+ if (coords.y < BOUNDS.ymin)
531
+ BOUNDS.ymin = coords.y;
532
+ if (coords.y > BOUNDS.ymax)
533
+ BOUNDS.ymax = coords.y;
534
+ if (coords.z < BOUNDS.zmin)
535
+ BOUNDS.zmin = coords.z;
536
+ if (coords.z > BOUNDS.zmax)
537
+ BOUNDS.zmax = coords.z;
723
538
  }
724
539
  }
725
-
726
540
  seg.readyToEngage = true;
727
-
728
541
  seg.terrainVertices = tempVertices;
729
542
  seg.terrainVerticesHigh = tempVerticesHigh;
730
543
  seg.terrainVerticesLow = tempVerticesLow;
731
-
732
544
  seg.tempVertices = tempVertices;
733
545
  seg.tempVerticesHigh = tempVerticesHigh;
734
546
  seg.tempVerticesLow = tempVerticesLow;
735
-
736
- seg.noDataVertices = noDataVertices!;
737
-
547
+ seg.noDataVertices = noDataVertices;
738
548
  seg.setBoundingVolume(BOUNDS.xmin, BOUNDS.ymin, BOUNDS.zmin, BOUNDS.xmax, BOUNDS.ymax, BOUNDS.zmax);
739
-
740
- if (seg.tileZoom > seg.planet.terrain!.maxZoom) {
741
- if (pn.segment.tileZoom >= seg.planet.terrain!.maxZoom) {
742
-
549
+ if (seg.tileZoom > seg.planet.terrain.maxZoom) {
550
+ if (pn.segment.tileZoom >= seg.planet.terrain.maxZoom) {
743
551
  seg._plainRadius = pn.segment._plainRadius / dZ2;
744
-
745
552
  seg.terrainReady = true;
746
553
  seg.terrainIsLoading = false;
747
-
748
554
  seg.terrainVertices = tempVertices;
749
555
  seg.terrainVerticesHigh = tempVerticesHigh;
750
556
  seg.terrainVerticesLow = tempVerticesLow;
751
-
752
557
  seg.passReady = true;
753
-
754
558
  this.appliedTerrainNodeId = this.nodeId;
755
559
  this.equalizedSideWithNodeId[N] = this.equalizedSideWithNodeId[E] = this.equalizedSideWithNodeId[S] = this.equalizedSideWithNodeId[W] = this.appliedTerrainNodeId;
756
-
757
560
  if (pn.segment.terrainExists) {
758
561
  seg.normalMapVertices = tempVertices;
759
562
  seg.fileGridSize = Math.sqrt(tempVertices.length / 3) - 1;
760
-
761
- let fgs = Math.sqrt(pseg.normalMapNormals!.length / 3) - 1, fgsZ = fgs / dZ2;
762
-
563
+ let fgs = Math.sqrt(pseg.normalMapNormals.length / 3) - 1, fgsZ = fgs / dZ2;
763
564
  if (fgs > 1) {
764
- seg.normalMapNormals = getMatrixSubArray32(pseg.normalMapNormals!, fgs, fgsZ * offsetY, fgsZ * offsetX, fgsZ);
765
- } else {
565
+ seg.normalMapNormals = getMatrixSubArray32(pseg.normalMapNormals, fgs, fgsZ * offsetY, fgsZ * offsetX, fgsZ);
566
+ }
567
+ else {
766
568
  // TODO: interpolation
767
569
  seg.normalMapNormals = pseg.normalMapNormals;
768
570
  }
@@ -771,12 +573,9 @@ class Node {
771
573
  }
772
574
  }
773
575
  }
774
-
775
- public destroy() {
776
-
576
+ destroy() {
777
577
  this.state = NOTRENDERING;
778
578
  this.segment.destroySegment();
779
-
780
579
  let n = this.neighbors;
781
580
  for (let i = 0; i < n.length; i++) {
782
581
  let ni = n[i];
@@ -796,7 +595,6 @@ class Node {
796
595
  }
797
596
  }
798
597
  }
799
-
800
598
  // @ts-ignore
801
599
  this.neighbors = null;
802
600
  // @ts-ignore
@@ -806,72 +604,57 @@ class Node {
806
604
  // @ts-ignore
807
605
  this.segment = null;
808
606
  }
809
-
810
- public clearTree() {
607
+ clearTree() {
811
608
  const state = this.getState();
812
609
  if (state === NOTRENDERING || state === RENDERING) {
813
610
  this.destroyBranches();
814
- } else {
611
+ }
612
+ else {
815
613
  for (let i = 0; i < this.nodes.length; i++) {
816
614
  this.nodes[i] && this.nodes[i].clearTree();
817
615
  }
818
616
  }
819
617
  }
820
-
821
- public clearBranches() {
618
+ clearBranches() {
822
619
  for (let i = 0; i < this.nodes.length; i++) {
823
- this.nodes[i]!.clearBranches();
824
- this.nodes[i]!.segment.deleteMaterials();
620
+ this.nodes[i].clearBranches();
621
+ this.nodes[i].segment.deleteMaterials();
825
622
  }
826
623
  }
827
-
828
- public destroyBranches() {
624
+ destroyBranches() {
829
625
  if (this.ready) {
830
- let nodesToRemove: Node[] = [],
831
- i;
832
-
626
+ let nodesToRemove = [], i;
833
627
  for (i = 0; i < this.nodes.length; i++) {
834
- nodesToRemove[i] = this.nodes[i]!;
628
+ nodesToRemove[i] = this.nodes[i];
835
629
  }
836
-
837
630
  this.ready = false;
838
631
  this.nodes = [];
839
-
840
632
  for (i = 0; i < nodesToRemove.length; i++) {
841
633
  nodesToRemove[i].destroyBranches();
842
634
  nodesToRemove[i].destroy();
843
635
  //@ts-ignore
844
636
  nodesToRemove[i] = null;
845
637
  }
846
-
847
638
  nodesToRemove.length = 0;
848
-
849
639
  // @ts-ignore
850
640
  nodesToRemove = null;
851
641
  }
852
642
  }
853
-
854
- public traverseTree(callback: Function) {
643
+ traverseTree(callback) {
855
644
  callback(this);
856
645
  if (this.ready) {
857
646
  for (let i = 0; i < this.nodes.length; i++) {
858
- this.nodes[i]!.traverseTree(callback);
647
+ this.nodes[i].traverseTree(callback);
859
648
  }
860
649
  }
861
650
  }
862
-
863
- public getOffsetOppositeNeighbourSide(neighbourNode: Node, side: number): number {
864
- let pNode: Node = this,
865
- neighbourZoom = neighbourNode.segment.tileZoom,
866
- offset = 0;
867
-
651
+ getOffsetOppositeNeighbourSide(neighbourNode, side) {
652
+ let pNode = this, neighbourZoom = neighbourNode.segment.tileZoom, offset = 0;
868
653
  while (pNode.segment.tileZoom > neighbourZoom) {
869
654
  offset += PARTOFFSET[pNode.partId][side] / (1 << (pNode.segment.tileZoom - neighbourZoom));
870
- pNode = pNode.parentNode!;
655
+ pNode = pNode.parentNode;
871
656
  }
872
-
873
657
  return offset;
874
658
  }
875
659
  }
876
-
877
- export {Node};
660
+ export { Node };