@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.
- package/README.md +8 -8
- package/lib/@openglobus/og.esm.js +2 -0
- package/lib/@openglobus/og.esm.js.map +1 -0
- package/lib/@openglobus/og.umd.js +2 -0
- package/lib/@openglobus/og.umd.js.map +1 -0
- package/lib/js/Clock.d.ts +106 -0
- package/{src/Clock.ts → lib/js/Clock.js} +31 -126
- package/lib/js/Deferred.d.ts +6 -0
- package/lib/js/Deferred.js +13 -0
- package/lib/js/Events.d.ts +90 -0
- package/{src/Events.ts → lib/js/Events.js} +29 -84
- package/lib/js/Extent.d.ts +145 -0
- package/{src/Extent.ts → lib/js/Extent.js} +74 -120
- package/lib/js/Globe.d.ts +132 -0
- package/{src/Globe.ts → lib/js/Globe.js} +61 -159
- package/lib/js/ImageCanvas.d.ts +128 -0
- package/{src/ImageCanvas.ts → lib/js/ImageCanvas.js} +24 -65
- package/lib/js/Lock.d.ts +15 -0
- package/{src/Lock.ts → lib/js/Lock.js} +7 -21
- package/lib/js/LonLat.d.ts +128 -0
- package/{src/LonLat.ts → lib/js/LonLat.js} +44 -75
- package/lib/js/Object3d.d.ts +49 -0
- package/{src/Object3d.ts → lib/js/Object3d.js} +64 -184
- package/lib/js/Popup.d.ts +46 -0
- package/{src/Popup.ts → lib/js/Popup.js} +42 -110
- package/lib/js/QueueArray.d.ts +16 -0
- package/{src/QueueArray.ts → lib/js/QueueArray.js} +12 -25
- package/lib/js/Rectangle.d.ts +76 -0
- package/{src/Rectangle.ts → lib/js/Rectangle.js} +12 -50
- package/lib/js/Stack.d.ts +20 -0
- package/{src/Stack.ts → lib/js/Stack.js} +13 -29
- package/lib/js/astro/astro.d.ts +39 -0
- package/{src/astro/astro.ts → lib/js/astro/astro.js} +2 -8
- package/lib/js/astro/earth.d.ts +8 -0
- package/{src/astro/earth.ts → lib/js/astro/earth.js} +3 -39
- package/lib/js/astro/jd.d.ts +234 -0
- package/{src/astro/jd.ts → lib/js/astro/jd.js} +55 -134
- package/lib/js/astro/orbit.d.ts +5 -0
- package/{src/astro/orbit.ts → lib/js/astro/orbit.js} +26 -39
- package/lib/js/astro/rotation.d.ts +2 -0
- package/{src/astro/rotation.ts → lib/js/astro/rotation.js} +2 -11
- package/lib/js/bv/Box.d.ts +32 -0
- package/{src/bv/Box.ts → lib/js/bv/Box.js} +7 -35
- package/lib/js/bv/Sphere.d.ts +37 -0
- package/{src/bv/Sphere.ts → lib/js/bv/Sphere.js} +6 -34
- package/{src/bv/index.ts → lib/js/bv/index.d.ts} +0 -1
- package/lib/js/bv/index.js +3 -0
- package/lib/js/camera/Camera.d.ts +314 -0
- package/{src/camera/Camera.ts → lib/js/camera/Camera.js} +77 -326
- package/lib/js/camera/Frustum.d.ts +139 -0
- package/{src/camera/Frustum.ts → lib/js/camera/Frustum.js} +66 -185
- package/lib/js/camera/PlanetCamera.d.ts +234 -0
- package/{src/camera/PlanetCamera.ts → lib/js/camera/PlanetCamera.js} +65 -338
- package/{src/camera/index.ts → lib/js/camera/index.d.ts} +0 -1
- package/lib/js/camera/index.js +3 -0
- package/lib/js/cons.d.ts +40 -0
- package/{src/cons.ts → lib/js/cons.js} +10 -22
- package/lib/js/control/Atmosphere.d.ts +16 -0
- package/{src/control/Atmosphere.ts → lib/js/control/Atmosphere.js} +33 -86
- package/lib/js/control/CompassButton.d.ts +16 -0
- package/{src/control/CompassButton.ts → lib/js/control/CompassButton.js} +18 -43
- package/lib/js/control/Control.d.ts +100 -0
- package/{src/control/Control.ts → lib/js/control/Control.js} +22 -89
- package/lib/js/control/DebugInfo.d.ts +25 -0
- package/{src/control/DebugInfo.ts → lib/js/control/DebugInfo.js} +38 -84
- package/lib/js/control/DrawingSwitcher.d.ts +13 -0
- package/{src/control/DrawingSwitcher.ts → lib/js/control/DrawingSwitcher.js} +13 -30
- package/lib/js/control/EarthCoordinates.d.ts +41 -0
- package/{src/control/EarthCoordinates.ts → lib/js/control/EarthCoordinates.js} +58 -119
- package/lib/js/control/EarthNavigation.d.ts +50 -0
- package/{src/control/EarthNavigation.ts → lib/js/control/EarthNavigation.js} +70 -161
- package/lib/js/control/GeoImageDragControl.d.ts +22 -0
- package/{src/control/GeoImageDragControl.ts → lib/js/control/GeoImageDragControl.js} +26 -49
- package/lib/js/control/KeyboardNavigation.d.ts +28 -0
- package/{src/control/KeyboardNavigation.ts → lib/js/control/KeyboardNavigation.js} +67 -92
- package/lib/js/control/LayerAnimation.d.ts +71 -0
- package/{src/control/LayerAnimation.ts → lib/js/control/LayerAnimation.js} +82 -162
- package/lib/js/control/LayerSwitcher.d.ts +21 -0
- package/{src/control/LayerSwitcher.ts → lib/js/control/LayerSwitcher.js} +16 -41
- package/lib/js/control/Lighting.d.ts +49 -0
- package/{src/control/Lighting.ts → lib/js/control/Lighting.js} +106 -219
- package/lib/js/control/MouseNavigation.d.ts +62 -0
- package/{src/control/MouseNavigation.ts → lib/js/control/MouseNavigation.js} +105 -211
- package/lib/js/control/MouseWheelZoomControl.d.ts +44 -0
- package/lib/js/control/MouseWheelZoomControl.js +181 -0
- package/lib/js/control/RulerSwitcher.d.ts +17 -0
- package/{src/control/RulerSwitcher.ts → lib/js/control/RulerSwitcher.js} +13 -28
- package/lib/js/control/ScaleControl.d.ts +24 -0
- package/lib/js/control/ScaleControl.js +91 -0
- package/lib/js/control/SegmentBoundVisualization.d.ts +12 -0
- package/lib/js/control/SegmentBoundVisualization.js +37 -0
- package/lib/js/control/ShowFps.d.ts +9 -0
- package/lib/js/control/ShowFps.js +20 -0
- package/lib/js/control/SimpleNavigation.d.ts +25 -0
- package/{src/control/SimpleNavigation.ts → lib/js/control/SimpleNavigation.js} +29 -51
- package/lib/js/control/SimpleSkyBackground.d.ts +15 -0
- package/{src/control/SimpleSkyBackground.ts → lib/js/control/SimpleSkyBackground.js} +21 -48
- package/lib/js/control/Sun.d.ts +33 -0
- package/{src/control/Sun.ts → lib/js/control/Sun.js} +34 -85
- package/lib/js/control/ToggleWireframe.d.ts +14 -0
- package/lib/js/control/ToggleWireframe.js +28 -0
- package/lib/js/control/TouchNavigation.d.ts +52 -0
- package/{src/control/TouchNavigation.ts → lib/js/control/TouchNavigation.js} +88 -193
- package/lib/js/control/ZoomControl.d.ts +27 -0
- package/{src/control/ZoomControl.ts → lib/js/control/ZoomControl.js} +25 -50
- package/lib/js/control/drawing/DrawingControl.d.ts +12 -0
- package/{src/control/drawing/DrawingControl.ts → lib/js/control/drawing/DrawingControl.js} +10 -20
- package/lib/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
- package/{src/control/drawing/LineStringDrawingScene.ts → lib/js/control/drawing/LineStringDrawingScene.js} +28 -85
- package/lib/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
- package/{src/control/drawing/PolygonDrawingScene.ts → lib/js/control/drawing/PolygonDrawingScene.js} +190 -388
- package/lib/js/control/elevationProfile/ElevationProfile.d.ts +61 -0
- package/{src/control/elevationProfile/ElevationProfile.ts → lib/js/control/elevationProfile/ElevationProfile.js} +56 -148
- package/lib/js/control/heightRuler/HeightRuler.d.ts +7 -0
- package/{src/control/heightRuler/HeightRuler.ts → lib/js/control/heightRuler/HeightRuler.js} +4 -9
- package/lib/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
- package/{src/control/heightRuler/HeightRulerScene.ts → lib/js/control/heightRuler/HeightRulerScene.js} +47 -99
- package/lib/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
- package/{src/control/heightRuler/HeightRulerSwitcher.ts → lib/js/control/heightRuler/HeightRulerSwitcher.js} +2 -4
- package/{src/control/index.ts → lib/js/control/index.d.ts} +1 -18
- package/lib/js/control/index.js +28 -0
- package/lib/js/control/ruler/Ruler.d.ts +13 -0
- package/lib/js/control/ruler/Ruler.js +23 -0
- package/lib/js/control/ruler/RulerScene.d.ts +88 -0
- package/lib/js/control/ruler/RulerScene.js +324 -0
- package/lib/js/control/selection/Selection.d.ts +55 -0
- package/{src/control/selection/Selection.ts → lib/js/control/selection/Selection.js} +15 -34
- package/lib/js/control/selection/SelectionScene.d.ts +44 -0
- package/{src/control/selection/SelectionScene.ts → lib/js/control/selection/SelectionScene.js} +26 -113
- package/lib/js/control/timeline/TimelineControl.d.ts +18 -0
- package/{src/control/timeline/TimelineControl.ts → lib/js/control/timeline/TimelineControl.js} +13 -43
- package/lib/js/control/timeline/TimelineModel.d.ts +41 -0
- package/{src/control/timeline/TimelineModel.ts → lib/js/control/timeline/TimelineModel.js} +26 -74
- package/lib/js/control/timeline/TimelineView.d.ts +85 -0
- package/{src/control/timeline/TimelineView.ts → lib/js/control/timeline/TimelineView.js} +133 -281
- package/lib/js/control/timeline/timelineUtils.d.ts +12 -0
- package/lib/js/control/timeline/timelineUtils.js +112 -0
- package/lib/js/control/visibleExtent/Segment.d.ts +277 -0
- package/{src → lib/js}/control/visibleExtent/Segment.js +145 -698
- package/lib/js/control/visibleExtent/VisibleExtent.d.ts +5 -0
- package/{src → lib/js}/control/visibleExtent/VisibleExtent.js +1 -18
- package/lib/js/control/visibleExtent/drawnode.d.ts +7 -0
- package/{src/control/visibleExtent/drawnode.ts → lib/js/control/visibleExtent/drawnode.js} +1 -28
- package/lib/js/ellipsoid/Ellipsoid.d.ts +187 -0
- package/{src/ellipsoid/Ellipsoid.ts → lib/js/ellipsoid/Ellipsoid.js} +85 -267
- package/lib/js/ellipsoid/index.d.ts +3 -0
- package/lib/js/ellipsoid/index.js +3 -0
- package/lib/js/ellipsoid/wgs84.d.ts +6 -0
- package/{src/ellipsoid/wgs84.ts → lib/js/ellipsoid/wgs84.js} +1 -2
- package/lib/js/entity/BaseBillboard.d.ts +222 -0
- package/{src/entity/BaseBillboard.ts → lib/js/entity/BaseBillboard.js} +48 -165
- package/lib/js/entity/BaseBillboardHandler.d.ts +81 -0
- package/{src/entity/BaseBillboardHandler.ts → lib/js/entity/BaseBillboardHandler.js} +139 -365
- package/lib/js/entity/Billboard.d.ts +113 -0
- package/{src/entity/Billboard.ts → lib/js/entity/Billboard.js} +19 -83
- package/lib/js/entity/BillboardHandler.d.ts +15 -0
- package/{src/entity/BillboardHandler.ts → lib/js/entity/BillboardHandler.js} +27 -59
- package/lib/js/entity/Entity.d.ts +354 -0
- package/{src/entity/Entity.ts → lib/js/entity/Entity.js} +102 -374
- package/lib/js/entity/EntityCollection.d.ts +363 -0
- package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +57 -359
- package/lib/js/entity/GeoObject.d.ts +138 -0
- package/{src/entity/GeoObject.ts → lib/js/entity/GeoObject.js} +41 -146
- package/lib/js/entity/GeoObjectHandler.d.ts +99 -0
- package/{src/entity/GeoObjectHandler.ts → lib/js/entity/GeoObjectHandler.js} +162 -423
- package/lib/js/entity/Geometry.d.ts +111 -0
- package/lib/js/entity/Geometry.js +283 -0
- package/lib/js/entity/GeometryHandler.d.ts +84 -0
- package/{src/entity/GeometryHandler.ts → lib/js/entity/GeometryHandler.js} +162 -657
- package/lib/js/entity/Label.d.ts +207 -0
- package/{src/entity/Label.ts → lib/js/entity/Label.js} +63 -165
- package/lib/js/entity/LabelHandler.d.ts +65 -0
- package/{src/entity/LabelHandler.ts → lib/js/entity/LabelHandler.js} +175 -408
- package/lib/js/entity/LabelWorker.d.ts +15 -0
- package/{src/entity/LabelWorker.ts → lib/js/entity/LabelWorker.js} +24 -45
- package/lib/js/entity/PointCloud.d.ts +179 -0
- package/{src/entity/PointCloud.ts → lib/js/entity/PointCloud.js} +65 -265
- package/lib/js/entity/PointCloudHandler.d.ts +42 -0
- package/{src/entity/PointCloudHandler.ts → lib/js/entity/PointCloudHandler.js} +19 -62
- package/lib/js/entity/Polyline.d.ts +337 -0
- package/{src/entity/Polyline.ts → lib/js/entity/Polyline.js} +289 -924
- package/lib/js/entity/PolylineHandler.d.ts +22 -0
- package/{src/entity/PolylineHandler.ts → lib/js/entity/PolylineHandler.js} +12 -37
- package/lib/js/entity/Ray.d.ts +133 -0
- package/{src/entity/Ray.ts → lib/js/entity/Ray.js} +26 -146
- package/lib/js/entity/RayHandler.d.ts +70 -0
- package/{src/entity/RayHandler.ts → lib/js/entity/RayHandler.js} +102 -342
- package/lib/js/entity/Strip.d.ts +127 -0
- package/{src/entity/Strip.ts → lib/js/entity/Strip.js} +102 -372
- package/lib/js/entity/StripHandler.d.ts +42 -0
- package/{src/entity/StripHandler.ts → lib/js/entity/StripHandler.js} +22 -74
- package/{src/entity/index.ts → lib/js/entity/index.d.ts} +1 -2
- package/lib/js/entity/index.js +11 -0
- package/lib/js/index.d.ts +33 -0
- package/lib/js/index.js +33 -0
- package/lib/js/input/KeyboardHandler.d.ts +33 -0
- package/{src/input/KeyboardHandler.ts → lib/js/input/KeyboardHandler.js} +45 -84
- package/lib/js/input/MouseHandler.d.ts +16 -0
- package/{src/input/MouseHandler.ts → lib/js/input/MouseHandler.js} +12 -36
- package/lib/js/input/TouchHandler.d.ts +11 -0
- package/{src/input/TouchHandler.ts → lib/js/input/TouchHandler.js} +11 -23
- package/lib/js/input/input.d.ts +3 -0
- package/{src/input/input.ts → lib/js/input/input.js} +1 -1
- package/lib/js/layer/BaseGeoImage.d.ts +145 -0
- package/{src/layer/BaseGeoImage.ts → lib/js/layer/BaseGeoImage.js} +70 -235
- package/lib/js/layer/CanvasTiles.d.ts +103 -0
- package/{src/layer/CanvasTiles.ts → lib/js/layer/CanvasTiles.js} +54 -146
- package/lib/js/layer/GeoImage.d.ts +61 -0
- package/{src/layer/GeoImage.ts → lib/js/layer/GeoImage.js} +24 -54
- package/lib/js/layer/GeoTexture2d.d.ts +17 -0
- package/lib/js/layer/GeoTexture2d.js +37 -0
- package/lib/js/layer/GeoVideo.d.ts +68 -0
- package/{src/layer/GeoVideo.ts → lib/js/layer/GeoVideo.js} +31 -61
- package/lib/js/layer/KML.d.ts +72 -0
- package/{src/layer/KML.ts → lib/js/layer/KML.js} +94 -138
- package/lib/js/layer/Layer.d.ts +401 -0
- package/{src/layer/Layer.ts → lib/js/layer/Layer.js} +92 -443
- package/lib/js/layer/Material.d.ts +34 -0
- package/{src/layer/Material.ts → lib/js/layer/Material.js} +9 -43
- package/lib/js/layer/Vector.d.ts +243 -0
- package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +155 -426
- package/lib/js/layer/WMS.d.ts +75 -0
- package/{src/layer/WMS.ts → lib/js/layer/WMS.js} +18 -100
- package/lib/js/layer/XYZ.d.ts +149 -0
- package/{src/layer/XYZ.ts → lib/js/layer/XYZ.js} +71 -171
- package/lib/js/layer/index.d.ts +11 -0
- package/lib/js/layer/index.js +11 -0
- package/lib/js/light/LightSource.d.ts +174 -0
- package/{src/light/LightSource.ts → lib/js/light/LightSource.js} +22 -131
- package/lib/js/math/Line2.d.ts +11 -0
- package/{src/math/Line2.ts → lib/js/math/Line2.js} +5 -15
- package/lib/js/math/Line3.d.ts +28 -0
- package/lib/js/math/Line3.js +85 -0
- package/lib/js/math/Mat3.d.ts +77 -0
- package/{src/math/Mat3.ts → lib/js/math/Mat3.js} +22 -51
- package/lib/js/math/Mat4.d.ts +195 -0
- package/{src/math/Mat4.ts → lib/js/math/Mat4.js} +53 -219
- package/lib/js/math/Plane.d.ts +20 -0
- package/{src/math/Plane.ts → lib/js/math/Plane.js} +26 -40
- package/lib/js/math/Quat.d.ts +373 -0
- package/{src/math/Quat.ts → lib/js/math/Quat.js} +106 -319
- package/lib/js/math/Ray.d.ts +76 -0
- package/{src/math/Ray.ts → lib/js/math/Ray.js} +21 -66
- package/lib/js/math/Vec2.d.ts +310 -0
- package/{src/math/Vec2.ts → lib/js/math/Vec2.js} +55 -121
- package/lib/js/math/Vec3.d.ts +472 -0
- package/{src/math/Vec3.ts → lib/js/math/Vec3.js} +103 -236
- package/lib/js/math/Vec4.d.ts +163 -0
- package/{src/math/Vec4.ts → lib/js/math/Vec4.js} +23 -79
- package/lib/js/math/coder.d.ts +51 -0
- package/{src/math/coder.ts → lib/js/math/coder.js} +14 -20
- package/lib/js/math/index.d.ts +11 -0
- package/lib/js/math/index.js +11 -0
- package/lib/js/math.d.ts +266 -0
- package/{src/math.ts → lib/js/math.js} +37 -85
- package/lib/js/mercator.d.ts +92 -0
- package/{src/mercator.ts → lib/js/mercator.js} +13 -37
- package/lib/js/proj/EPSG3857.d.ts +9 -0
- package/{src/proj/EPSG3857.ts → lib/js/proj/EPSG3857.js} +0 -2
- package/lib/js/proj/EPSG4326.d.ts +9 -0
- package/{src/proj/EPSG4326.ts → lib/js/proj/EPSG4326.js} +0 -2
- package/lib/js/proj/Proj.d.ts +43 -0
- package/{src/proj/Proj.ts → lib/js/proj/Proj.js} +4 -29
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.js +19 -0
- package/lib/js/quadTree/EntityCollectionNode.d.ts +54 -0
- package/{src/quadTree/EntityCollectionNode.ts → lib/js/quadTree/EntityCollectionNode.js} +83 -150
- package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/MarsQuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/Node.d.ts +61 -0
- package/{src/quadTree/Node.ts → lib/js/quadTree/Node.js} +140 -357
- package/lib/js/quadTree/QuadTreeStrategy.d.ts +25 -0
- package/{src/quadTree/QuadTreeStrategy.ts → lib/js/quadTree/QuadTreeStrategy.js} +13 -44
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +15 -0
- package/lib/js/quadTree/index.d.ts +12 -0
- package/lib/js/quadTree/index.js +12 -0
- package/lib/js/quadTree/quadTree.d.ts +40 -0
- package/{src/quadTree/quadTree.ts → lib/js/quadTree/quadTree.js} +0 -9
- package/lib/js/renderer/Renderer.d.ts +320 -0
- package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +265 -622
- package/lib/js/renderer/RendererEvents.d.ts +239 -0
- package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +158 -472
- package/lib/js/scene/Axes.d.ts +12 -0
- package/lib/js/scene/Axes.js +59 -0
- package/lib/js/scene/BaseNode.d.ts +61 -0
- package/{src/scene/BaseNode.ts → lib/js/scene/BaseNode.js} +11 -57
- package/lib/js/scene/Planet.d.ts +623 -0
- package/{src/scene/Planet.ts → lib/js/scene/Planet.js} +257 -937
- package/lib/js/scene/RenderNode.d.ts +150 -0
- package/{src/scene/RenderNode.ts → lib/js/scene/RenderNode.js} +33 -138
- package/lib/js/scene/SkyBox.d.ts +13 -0
- package/{src/scene/SkyBox.ts → lib/js/scene/SkyBox.js} +16 -37
- package/{src/scene/index.ts → lib/js/scene/index.d.ts} +0 -1
- package/lib/js/scene/index.js +5 -0
- package/lib/js/segment/Segment.d.ts +278 -0
- package/{src/segment/Segment.ts → lib/js/segment/Segment.js} +242 -913
- package/lib/js/segment/SegmentLonLat.d.ts +48 -0
- package/{src/segment/SegmentLonLat.ts → lib/js/segment/SegmentLonLat.js} +58 -132
- package/lib/js/segment/SegmentLonLatWgs84.d.ts +10 -0
- package/lib/js/segment/SegmentLonLatWgs84.js +23 -0
- package/lib/js/segment/Slice.d.ts +13 -0
- package/{src/segment/Slice.ts → lib/js/segment/Slice.js} +4 -22
- package/lib/js/segment/segmentHelper.d.ts +18 -0
- package/{src/segment/segmentHelper.ts → lib/js/segment/segmentHelper.js} +30 -88
- package/lib/js/shaders/atmos.d.ts +4 -0
- package/{src/shaders/atmos.ts → lib/js/shaders/atmos.js} +8 -26
- package/lib/js/shaders/billboard.d.ts +3 -0
- package/{src/shaders/billboard.ts → lib/js/shaders/billboard.js} +9 -18
- package/lib/js/shaders/bloom.d.ts +2 -0
- package/{src/shaders/bloom.ts → lib/js/shaders/bloom.js} +5 -8
- package/lib/js/shaders/blur.d.ts +3 -0
- package/{src/shaders/blur.ts → lib/js/shaders/blur.js} +11 -19
- package/lib/js/shaders/depth.d.ts +2 -0
- package/{src/shaders/depth.ts → lib/js/shaders/depth.js} +3 -6
- package/lib/js/shaders/drawnode.d.ts +8 -0
- package/{src/shaders/drawnode.ts → lib/js/shaders/drawnode.js} +23 -75
- package/lib/js/shaders/geoObject.d.ts +3 -0
- package/{src/shaders/geoObject.ts → lib/js/shaders/geoObject.js} +51 -63
- package/lib/js/shaders/label.d.ts +4 -0
- package/{src/shaders/label.ts → lib/js/shaders/label.js} +12 -25
- package/lib/js/shaders/lumFilter.d.ts +2 -0
- package/{src/shaders/lumFilter.ts → lib/js/shaders/lumFilter.js} +4 -7
- package/lib/js/shaders/pickingMask.d.ts +2 -0
- package/{src/shaders/pickingMask.ts → lib/js/shaders/pickingMask.js} +5 -8
- package/lib/js/shaders/pointCloud.d.ts +2 -0
- package/{src/shaders/pointCloud.ts → lib/js/shaders/pointCloud.js} +4 -7
- package/lib/js/shaders/polyline.d.ts +3 -0
- package/{src/shaders/polyline.ts → lib/js/shaders/polyline.js} +7 -22
- package/lib/js/shaders/ray.d.ts +2 -0
- package/{src/shaders/ray.ts → lib/js/shaders/ray.js} +4 -7
- package/lib/js/shaders/screenFrame.d.ts +2 -0
- package/{src/shaders/screenFrame.ts → lib/js/shaders/screenFrame.js} +5 -8
- package/lib/js/shaders/skybox.d.ts +2 -0
- package/{src/shaders/skybox.ts → lib/js/shaders/skybox.js} +10 -13
- package/lib/js/shaders/toneMapping.d.ts +2 -0
- package/{src/shaders/toneMapping.ts → lib/js/shaders/toneMapping.js} +5 -8
- package/lib/js/shaders/utils.d.ts +1 -0
- package/{src/shaders/utils.ts → lib/js/shaders/utils.js} +1 -1
- package/lib/js/terrain/BilTerrain.d.ts +18 -0
- package/{src/terrain/BilTerrain.ts → lib/js/terrain/BilTerrain.js} +21 -118
- package/lib/js/terrain/EmptyTerrain.d.ts +106 -0
- package/{src/terrain/EmptyTerrain.ts → lib/js/terrain/EmptyTerrain.js} +20 -144
- package/lib/js/terrain/Geoid.d.ts +33 -0
- package/lib/js/terrain/Geoid.js +191 -0
- package/lib/js/terrain/GlobusTerrain.d.ts +134 -0
- package/{src/terrain/GlobusTerrain.ts → lib/js/terrain/GlobusTerrain.js} +84 -241
- package/lib/js/terrain/MapboxTerrain.d.ts +21 -0
- package/{src/terrain/MapboxTerrain.ts → lib/js/terrain/MapboxTerrain.js} +46 -215
- package/{src/terrain/index.ts → lib/js/terrain/index.d.ts} +0 -1
- package/lib/js/terrain/index.js +5 -0
- package/lib/js/ui/Button.d.ts +32 -0
- package/lib/js/ui/Button.js +78 -0
- package/lib/js/ui/ButtonGroup.d.ts +16 -0
- package/lib/js/ui/ButtonGroup.js +41 -0
- package/lib/js/ui/Dialog.d.ts +55 -0
- package/lib/js/ui/Dialog.js +173 -0
- package/lib/js/ui/Slider.d.ts +38 -0
- package/lib/js/ui/Slider.js +129 -0
- package/lib/js/ui/ToggleButton.d.ts +20 -0
- package/lib/js/ui/ToggleButton.js +42 -0
- package/lib/js/ui/View.d.ts +37 -0
- package/{src/ui/View.ts → lib/js/ui/View.js} +31 -77
- package/lib/js/ui/icons.d.ts +1 -0
- package/{src/ui/icons.ts → lib/js/ui/icons.js} +1 -1
- package/lib/js/utils/BaseWorker.d.ts +14 -0
- package/{src/utils/BaseWorker.ts → lib/js/utils/BaseWorker.js} +15 -28
- package/lib/js/utils/FontAtlas.d.ts +82 -0
- package/{src/utils/FontAtlas.ts → lib/js/utils/FontAtlas.js} +46 -182
- package/lib/js/utils/GeoImageCreator.d.ts +34 -0
- package/{src/utils/GeoImageCreator.ts → lib/js/utils/GeoImageCreator.js} +34 -91
- package/lib/js/utils/ImagesCacheManager.d.ts +22 -0
- package/{src/utils/ImagesCacheManager.ts → lib/js/utils/ImagesCacheManager.js} +16 -38
- package/lib/js/utils/Loader.d.ts +63 -0
- package/lib/js/utils/Loader.js +156 -0
- package/lib/js/utils/NormalMapCreator.d.ts +52 -0
- package/{src/utils/NormalMapCreator.ts → lib/js/utils/NormalMapCreator.js} +64 -195
- package/lib/js/utils/PlainSegmentWorker.d.ts +24 -0
- package/{src/utils/PlainSegmentWorker.ts → lib/js/utils/PlainSegmentWorker.js} +24 -56
- package/lib/js/utils/TerrainWorker.d.ts +28 -0
- package/{src/utils/TerrainWorker.ts → lib/js/utils/TerrainWorker.js} +19 -56
- package/lib/js/utils/TextureAtlas.d.ts +113 -0
- package/{src/utils/TextureAtlas.ts → lib/js/utils/TextureAtlas.js} +40 -131
- package/lib/js/utils/VectorTileCreator.d.ts +18 -0
- package/{src/utils/VectorTileCreator.ts → lib/js/utils/VectorTileCreator.js} +61 -147
- package/lib/js/utils/colorTable.d.ts +3 -0
- package/{src/utils/colorTable.ts → lib/js/utils/colorTable.js} +2 -2
- package/lib/js/utils/earcut.d.ts +7 -0
- package/{src/utils/earcut.ts → lib/js/utils/earcut.js} +95 -223
- package/lib/js/utils/objParser.d.ts +24 -0
- package/{src/utils/objParser.ts → lib/js/utils/objParser.js} +38 -93
- package/lib/js/utils/shared.d.ts +267 -0
- package/{src/utils/shared.ts → lib/js/utils/shared.js} +185 -342
- package/lib/js/utils/units.d.ts +16 -0
- package/lib/js/utils/units.js +61 -0
- package/lib/js/webgl/BaseFramebuffer.d.ts +53 -0
- package/{src/webgl/BaseFramebuffer.ts → lib/js/webgl/BaseFramebuffer.js} +22 -59
- package/lib/js/webgl/Framebuffer.d.ts +69 -0
- package/{src/webgl/Framebuffer.ts → lib/js/webgl/Framebuffer.js} +30 -87
- package/lib/js/webgl/Handler.d.ts +473 -0
- package/{src/webgl/Handler.ts → lib/js/webgl/Handler.js} +175 -586
- package/lib/js/webgl/Multisample.d.ts +27 -0
- package/lib/js/webgl/Multisample.js +77 -0
- package/lib/js/webgl/Program.d.ts +159 -0
- package/{src/webgl/Program.ts → lib/js/webgl/Program.js} +73 -210
- package/lib/js/webgl/ProgramController.d.ts +86 -0
- package/{src/webgl/ProgramController.ts → lib/js/webgl/ProgramController.js} +11 -45
- package/{src/webgl/index.ts → lib/js/webgl/index.d.ts} +1 -8
- package/lib/js/webgl/index.js +6 -0
- package/lib/js/webgl/types.d.ts +9 -0
- package/{src/webgl/types.ts → lib/js/webgl/types.js} +5 -8
- package/lib/js/webgl/variableHandlers.d.ts +22 -0
- package/lib/js/webgl/variableHandlers.js +78 -0
- package/package.json +23 -34
- package/dist/@openglobus/og.esm.js +0 -2
- package/dist/@openglobus/og.esm.js.map +0 -1
- package/dist/@openglobus/og.umd.js +0 -2
- package/dist/@openglobus/og.umd.js.map +0 -1
- package/src/Deferred.ts +0 -17
- package/src/control/MouseWheelZoomControl.ts +0 -269
- package/src/control/ScaleControl.ts +0 -131
- package/src/control/SegmentBoundVisualization.ts +0 -50
- package/src/control/ShowFps.ts +0 -28
- package/src/control/ToggleWireframe.ts +0 -35
- package/src/control/ruler/Ruler.ts +0 -35
- package/src/control/ruler/RulerScene.ts +0 -437
- package/src/control/timeline/timelineUtils.ts +0 -133
- package/src/ellipsoid/index.ts +0 -4
- package/src/entity/Geometry.ts +0 -486
- package/src/index.ts +0 -173
- package/src/layer/GeoTexture2d.ts +0 -56
- package/src/layer/index.ts +0 -12
- package/src/math/Line3.ts +0 -162
- package/src/math/index.ts +0 -26
- package/src/quadTree/EPSG4326QuadTreeStrategy.ts +0 -24
- package/src/quadTree/EarthQuadTreeStrategy.ts +0 -28
- package/src/quadTree/MarsQuadTreeStrategy.ts +0 -25
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +0 -22
- package/src/quadTree/index.ts +0 -14
- package/src/scene/Axes.ts +0 -78
- package/src/segment/SegmentLonLatWgs84.ts +0 -33
- package/src/terrain/Geoid.ts +0 -273
- package/src/ui/Button.ts +0 -121
- package/src/ui/ButtonGroup.ts +0 -63
- package/src/ui/Dialog.ts +0 -244
- package/src/ui/Slider.ts +0 -188
- package/src/ui/ToggleButton.ts +0 -68
- package/src/utils/Loader.ts +0 -247
- package/src/utils/units.ts +0 -78
- package/src/webgl/Multisample.ts +0 -153
- package/src/webgl/variableHandlers.ts +0 -114
- /package/{dist → lib}/@openglobus/og.css +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.js +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/night-4326.png +0 -0
- /package/{dist → lib}/@openglobus/res/night.png +0 -0
- /package/{dist → lib}/@openglobus/res/spec.png +0 -0
|
@@ -1,54 +1,33 @@
|
|
|
1
1
|
import * as mercator from "../mercator";
|
|
2
2
|
import * as segmentHelper from "../segment/segmentHelper";
|
|
3
|
-
import {Box} from "../bv/Box";
|
|
4
|
-
import {Extent} from "../Extent";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {Node} from "../quadTree/Node";
|
|
15
|
-
import {Planet} from "../scene/Planet";
|
|
16
|
-
import {PlanetCamera} from "../camera/PlanetCamera";
|
|
17
|
-
import {Program} from "../webgl/Program";
|
|
18
|
-
import {Proj} from "../proj/Proj";
|
|
19
|
-
import {NumberArray6, Sphere} from "../bv/Sphere";
|
|
20
|
-
import {Slice} from "./Slice";
|
|
21
|
-
import {Ray} from "../math/Ray";
|
|
22
|
-
import {Vec3} from "../math/Vec3";
|
|
23
|
-
import {IPlainSegmentWorkerData} from "../utils/PlainSegmentWorker";
|
|
24
|
-
|
|
3
|
+
import { Box } from "../bv/Box";
|
|
4
|
+
import { Extent } from "../Extent";
|
|
5
|
+
import { EPSG3857 } from "../proj/EPSG3857";
|
|
6
|
+
import { E, N, NOTRENDERING, OPSIDE, S, W } from "../quadTree/quadTree";
|
|
7
|
+
import { getMatrixSubArray64 } from "../utils/shared";
|
|
8
|
+
import { Layer } from "../layer/Layer";
|
|
9
|
+
import { LonLat } from "../LonLat";
|
|
10
|
+
import { Sphere } from "../bv/Sphere";
|
|
11
|
+
import { Slice } from "./Slice";
|
|
12
|
+
import { Ray } from "../math/Ray";
|
|
13
|
+
import { Vec3 } from "../math/Vec3";
|
|
25
14
|
export const TILEGROUP_COMMON = 0;
|
|
26
15
|
export const TILEGROUP_NORTH = 1;
|
|
27
16
|
export const TILEGROUP_SOUTH = 2;
|
|
28
|
-
|
|
29
17
|
let _tempHigh = new Vec3();
|
|
30
18
|
let _tempLow = new Vec3();
|
|
31
|
-
|
|
32
|
-
let
|
|
33
|
-
_v1 = new Vec3(),
|
|
34
|
-
_v2 = new Vec3(),
|
|
35
|
-
_v3 = new Vec3();
|
|
36
|
-
|
|
37
|
-
let _ray = new Ray(),
|
|
38
|
-
_rayEx = new Ray();
|
|
39
|
-
|
|
19
|
+
let _v0 = new Vec3(), _v1 = new Vec3(), _v2 = new Vec3(), _v3 = new Vec3();
|
|
20
|
+
let _ray = new Ray(), _rayEx = new Ray();
|
|
40
21
|
const _S = new Array(4);
|
|
41
22
|
_S[N] = 0;
|
|
42
23
|
_S[E] = 1;
|
|
43
24
|
_S[S] = 1;
|
|
44
25
|
_S[W] = 0;
|
|
45
|
-
|
|
46
26
|
const _V = new Array(4);
|
|
47
27
|
_V[N] = false;
|
|
48
28
|
_V[E] = true;
|
|
49
29
|
_V[S] = false;
|
|
50
30
|
_V[W] = true;
|
|
51
|
-
|
|
52
31
|
/**
|
|
53
32
|
* Planet segment Web Mercator tile class that stored and rendered with a quad-tree.
|
|
54
33
|
* @class
|
|
@@ -58,311 +37,79 @@ _V[W] = true;
|
|
|
58
37
|
* @param {Extent} extent - Segment extent.
|
|
59
38
|
*/
|
|
60
39
|
class Segment {
|
|
61
|
-
|
|
62
|
-
public _isNorth?: boolean;
|
|
63
|
-
|
|
64
|
-
public isPole: boolean;
|
|
65
|
-
|
|
66
|
-
public _tileGroup: number;
|
|
67
|
-
|
|
68
|
-
public _projection: Proj;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Quad tree node of the segment.
|
|
72
|
-
* @type {Node}
|
|
73
|
-
*/
|
|
74
|
-
public node: Node;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Planet pointer.
|
|
78
|
-
* @type {Planet}
|
|
79
|
-
*/
|
|
80
|
-
public planet: Planet;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* WebGl handler pointer.
|
|
84
|
-
* @type {Handler}
|
|
85
|
-
*/
|
|
86
|
-
public handler: Handler;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Segment bounding sphere
|
|
90
|
-
* @type {Sphere}
|
|
91
|
-
*/
|
|
92
|
-
public bsphere: Sphere;
|
|
93
|
-
|
|
94
|
-
public _plainRadius: number;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Segment bounding box.
|
|
98
|
-
* @type {Box}
|
|
99
|
-
*/
|
|
100
|
-
public bbox: Box;
|
|
101
|
-
|
|
102
|
-
public _sw: Vec3;
|
|
103
|
-
public _nw: Vec3;
|
|
104
|
-
public _se: Vec3;
|
|
105
|
-
public _ne: Vec3;
|
|
106
|
-
|
|
107
|
-
public centerNormal: Vec3;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Geographical extent.
|
|
111
|
-
* @type {Extent}
|
|
112
|
-
*/
|
|
113
|
-
public _extent: Extent;
|
|
114
|
-
|
|
115
|
-
public _extentMerc: Extent;
|
|
116
|
-
|
|
117
|
-
public _extentLonLat: Extent;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Vertices grid size.
|
|
121
|
-
* @type {number}
|
|
122
|
-
*/
|
|
123
|
-
public gridSize: number;
|
|
124
|
-
|
|
125
|
-
public fileGridSize: number;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Tile zoom index.
|
|
129
|
-
* @type {number}
|
|
130
|
-
*/
|
|
131
|
-
public tileZoom: number;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Horizontal tile index.
|
|
135
|
-
* @type {number}
|
|
136
|
-
*/
|
|
137
|
-
public tileX: number;
|
|
138
|
-
|
|
139
|
-
public tileXE: number;
|
|
140
|
-
|
|
141
|
-
public tileXW: number;
|
|
142
|
-
|
|
143
|
-
public tileYN: number;
|
|
144
|
-
|
|
145
|
-
public tileYS: number;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Vertical tile index.
|
|
149
|
-
* @type {number}
|
|
150
|
-
*/
|
|
151
|
-
public tileY: number;
|
|
152
|
-
|
|
153
|
-
public tileIndex: string;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Texture materials array.
|
|
157
|
-
* @type {Array.<Material>}
|
|
158
|
-
*
|
|
159
|
-
* @toso: Check it should be Map<number, Material> instead of array
|
|
160
|
-
*
|
|
161
|
-
*/
|
|
162
|
-
public materials: Material[];
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Plain segment vertices was created.
|
|
166
|
-
* @type {boolean}
|
|
167
|
-
*/
|
|
168
|
-
public plainReady: boolean;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Segment is ready to create plain vertices.
|
|
172
|
-
* @type {boolean}
|
|
173
|
-
*/
|
|
174
|
-
public initialized: boolean;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Normal map is allready made.
|
|
178
|
-
* @type {boolean}
|
|
179
|
-
*/
|
|
180
|
-
public normalMapReady: boolean;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Terrain is allready applied flag.
|
|
184
|
-
* @type {boolean}
|
|
185
|
-
*/
|
|
186
|
-
public terrainReady: boolean;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Terrain is loading now flag.
|
|
190
|
-
* @type {boolean}
|
|
191
|
-
*/
|
|
192
|
-
public terrainIsLoading: boolean;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Terrain existing flag.
|
|
196
|
-
* @type {boolean}
|
|
197
|
-
*/
|
|
198
|
-
public terrainExists: boolean;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Means that tree passage reach the segment, and the segment terrain is ready.
|
|
202
|
-
* @type {boolean}
|
|
203
|
-
*/
|
|
204
|
-
public passReady: boolean;
|
|
205
|
-
|
|
206
|
-
public plainVertices: Float64Array | null;
|
|
207
|
-
public plainVerticesHigh: Float32Array | null;
|
|
208
|
-
public plainVerticesLow: Float32Array | null;
|
|
209
|
-
|
|
210
|
-
public plainNormals: Float32Array | null;
|
|
211
|
-
|
|
212
|
-
public terrainVertices: Float64Array | null;
|
|
213
|
-
public terrainVerticesHigh: Float32Array | null;
|
|
214
|
-
public terrainVerticesLow: Float32Array | null;
|
|
215
|
-
public noDataVertices: Uint8Array | null;
|
|
216
|
-
|
|
217
|
-
public tempVertices: Float64Array | null;
|
|
218
|
-
public tempVerticesHigh: Float32Array | null;
|
|
219
|
-
public tempVerticesLow: Float32Array | null;
|
|
220
|
-
|
|
221
|
-
public normalMapTexture: WebGLTextureExt | null;
|
|
222
|
-
public normalMapTextureBias: Float32Array;
|
|
223
|
-
public normalMapVertices: Float64Array | null;
|
|
224
|
-
public normalMapVerticesHigh: Float32Array | null;
|
|
225
|
-
public normalMapVerticesLow: Float32Array | null;
|
|
226
|
-
public normalMapNormals: Float32Array | null;
|
|
227
|
-
|
|
228
|
-
public vertexNormalBuffer: WebGLBufferExt | null;
|
|
229
|
-
public vertexPositionBuffer: WebGLBufferExt | null;
|
|
230
|
-
public vertexPositionBufferHigh: WebGLBufferExt | null;
|
|
231
|
-
public vertexPositionBufferLow: WebGLBufferExt | null;
|
|
232
|
-
public vertexTextureCoordBuffer: WebGLBufferExt | null;
|
|
233
|
-
|
|
234
|
-
public _globalTextureCoordinates: Float32Array;
|
|
235
|
-
public _inTheQueue: boolean;
|
|
236
|
-
public _appliedNeighborsZoom: [number, number, number, number];
|
|
237
|
-
|
|
238
|
-
public _slices: Slice[];
|
|
239
|
-
|
|
240
|
-
public _indexBuffer: WebGLBufferExt | null;
|
|
241
|
-
|
|
242
|
-
public readyToEngage: boolean;
|
|
243
|
-
|
|
244
|
-
public plainProcessing: boolean;
|
|
245
|
-
|
|
246
|
-
public normalMapTexturePtr: WebGLTextureExt | null;
|
|
247
|
-
|
|
248
|
-
constructor(node: Node, planet: Planet, tileZoom: number, extent: Extent) {
|
|
40
|
+
constructor(node, planet, tileZoom, extent) {
|
|
249
41
|
this.isPole = false;
|
|
250
|
-
|
|
251
42
|
this._tileGroup = TILEGROUP_COMMON;
|
|
252
|
-
|
|
253
43
|
this._projection = EPSG3857;
|
|
254
|
-
|
|
255
44
|
this.node = node;
|
|
256
|
-
|
|
257
45
|
this.planet = planet;
|
|
258
|
-
|
|
259
|
-
this.handler = planet.renderer!.handler;
|
|
260
|
-
|
|
46
|
+
this.handler = planet.renderer.handler;
|
|
261
47
|
this.bsphere = new Sphere();
|
|
262
|
-
|
|
263
48
|
this._plainRadius = 0;
|
|
264
|
-
|
|
265
49
|
this.bbox = new Box();
|
|
266
|
-
|
|
267
50
|
this._sw = new Vec3();
|
|
268
51
|
this._nw = new Vec3();
|
|
269
52
|
this._se = new Vec3();
|
|
270
53
|
this._ne = new Vec3();
|
|
271
|
-
|
|
272
54
|
this.centerNormal = new Vec3();
|
|
273
|
-
|
|
274
55
|
this._extent = this._extentMerc = extent;
|
|
275
|
-
|
|
276
56
|
this._extentLonLat = new Extent();
|
|
277
|
-
|
|
278
|
-
this.gridSize = planet.terrain!.gridSizeByZoom[tileZoom];
|
|
279
|
-
|
|
57
|
+
this.gridSize = planet.terrain.gridSizeByZoom[tileZoom];
|
|
280
58
|
this.fileGridSize = 0;
|
|
281
|
-
|
|
282
59
|
this.tileZoom = tileZoom;
|
|
283
|
-
|
|
284
60
|
this.tileX = 0;
|
|
285
|
-
|
|
286
61
|
this.tileXE = 0;
|
|
287
|
-
|
|
288
62
|
this.tileXW = 0;
|
|
289
|
-
|
|
290
63
|
this.tileYN = 0;
|
|
291
|
-
|
|
292
64
|
this.tileYS = 0;
|
|
293
|
-
|
|
294
65
|
this.tileY = 0;
|
|
295
|
-
|
|
296
66
|
this.tileIndex = "";
|
|
297
|
-
|
|
298
67
|
this._assignTileIndexes();
|
|
299
|
-
|
|
300
68
|
/**
|
|
301
69
|
* @toso: Check it should be Map<number, Material> instead of array
|
|
302
70
|
*/
|
|
303
71
|
this.materials = [];
|
|
304
|
-
|
|
305
72
|
this.plainReady = false;
|
|
306
|
-
|
|
307
73
|
this.initialized = false;
|
|
308
|
-
|
|
309
74
|
this.normalMapReady = false;
|
|
310
|
-
|
|
311
75
|
this.terrainReady = false;
|
|
312
|
-
|
|
313
76
|
this.terrainIsLoading = false;
|
|
314
|
-
|
|
315
77
|
this.terrainExists = false;
|
|
316
|
-
|
|
317
78
|
this.passReady = false;
|
|
318
|
-
|
|
319
79
|
this.plainVertices = null;
|
|
320
80
|
this.plainVerticesHigh = null;
|
|
321
81
|
this.plainVerticesLow = null;
|
|
322
|
-
|
|
323
82
|
this.plainNormals = null;
|
|
324
|
-
|
|
325
83
|
this.terrainVertices = null;
|
|
326
84
|
this.terrainVerticesHigh = null;
|
|
327
85
|
this.terrainVerticesLow = null;
|
|
328
86
|
this.noDataVertices = null;
|
|
329
|
-
|
|
330
87
|
this.tempVertices = null;
|
|
331
88
|
this.tempVerticesHigh = null;
|
|
332
89
|
this.tempVerticesLow = null;
|
|
333
|
-
|
|
334
90
|
this.normalMapTexture = null;
|
|
335
91
|
this.normalMapTextureBias = new Float32Array(3);
|
|
336
92
|
this.normalMapVertices = null;
|
|
337
93
|
this.normalMapVerticesHigh = null;
|
|
338
94
|
this.normalMapVerticesLow = null;
|
|
339
95
|
this.normalMapNormals = null;
|
|
340
|
-
|
|
341
96
|
this.vertexNormalBuffer = null;
|
|
342
97
|
this.vertexPositionBuffer = null;
|
|
343
98
|
this.vertexPositionBufferHigh = null;
|
|
344
99
|
this.vertexPositionBufferLow = null;
|
|
345
100
|
this.vertexTextureCoordBuffer = null;
|
|
346
|
-
|
|
347
101
|
this._globalTextureCoordinates = new Float32Array(4);
|
|
348
102
|
this._inTheQueue = false;
|
|
349
103
|
this._appliedNeighborsZoom = [0, 0, 0, 0];
|
|
350
|
-
|
|
351
104
|
this._slices = [];
|
|
352
|
-
|
|
353
105
|
this._indexBuffer = null;
|
|
354
|
-
|
|
355
106
|
this.readyToEngage = false;
|
|
356
|
-
|
|
357
107
|
this.plainProcessing = false;
|
|
358
|
-
|
|
359
108
|
this.normalMapTexturePtr = null;
|
|
360
109
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
return this.tileZoom < this.planet.terrain!._maxNodeZoom;
|
|
110
|
+
checkZoom() {
|
|
111
|
+
return this.tileZoom < this.planet.terrain._maxNodeZoom;
|
|
364
112
|
}
|
|
365
|
-
|
|
366
113
|
/**
|
|
367
114
|
* Returns entity terrain point.
|
|
368
115
|
* @public
|
|
@@ -370,18 +117,15 @@ class Segment {
|
|
|
370
117
|
* @param {Vec3} res - Point coordinates.
|
|
371
118
|
* @returns {Vec3} -
|
|
372
119
|
*/
|
|
373
|
-
|
|
120
|
+
getEntityTerrainPoint(entity, res) {
|
|
374
121
|
return this.getTerrainPoint(entity._cartesian, this.getInsideLonLat(entity), res);
|
|
375
122
|
}
|
|
376
|
-
|
|
377
|
-
public getInsideLonLat(obj: Entity | PlanetCamera): LonLat {
|
|
123
|
+
getInsideLonLat(obj) {
|
|
378
124
|
return obj._lonLatMerc;
|
|
379
125
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
return this._extentLonLat!.isInside(entity._lonLat);
|
|
126
|
+
isEntityInside(entity) {
|
|
127
|
+
return this._extentLonLat.isInside(entity._lonLat);
|
|
383
128
|
}
|
|
384
|
-
|
|
385
129
|
/**
|
|
386
130
|
* Returns distance from object to terrain coordinates and terrain point that calculates out in the res parameter.
|
|
387
131
|
* @public
|
|
@@ -390,517 +134,355 @@ class Segment {
|
|
|
390
134
|
* @param {Vec3} [res] - Result cartesian coordinates on the terrain.
|
|
391
135
|
* @returns {number} -
|
|
392
136
|
*/
|
|
393
|
-
|
|
137
|
+
getTerrainPoint(xyz, insideSegmentPosition, res) {
|
|
394
138
|
let verts = this.tempVertices;
|
|
395
|
-
|
|
396
139
|
if (verts && verts.length) {
|
|
397
140
|
let norm = this.planet.ellipsoid.getSurfaceNormal3v(xyz);
|
|
398
141
|
_ray.set(xyz, norm.negateTo());
|
|
399
|
-
|
|
400
|
-
let ne =
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
let
|
|
405
|
-
ymax = ne.lat,
|
|
406
|
-
xmin = sw.lon,
|
|
407
|
-
ymin = sw.lat,
|
|
408
|
-
x = insideSegmentPosition.lon,
|
|
409
|
-
y = insideSegmentPosition.lat;
|
|
410
|
-
|
|
411
|
-
let sxn = xmax - xmin,
|
|
412
|
-
syn = ymax - ymin;
|
|
413
|
-
|
|
414
|
-
let qx = sxn / size,
|
|
415
|
-
qy = syn / size;
|
|
416
|
-
|
|
417
|
-
let xn = x - xmin,
|
|
418
|
-
yn = y - ymin;
|
|
419
|
-
|
|
420
|
-
let indX = Math.floor(xn / qx),
|
|
421
|
-
indY = Math.floor(size - yn / qy);
|
|
422
|
-
|
|
142
|
+
let ne = this._extent.northEast, sw = this._extent.southWest, size = Math.sqrt(verts.length / 3) - 1;
|
|
143
|
+
let xmax = ne.lon, ymax = ne.lat, xmin = sw.lon, ymin = sw.lat, x = insideSegmentPosition.lon, y = insideSegmentPosition.lat;
|
|
144
|
+
let sxn = xmax - xmin, syn = ymax - ymin;
|
|
145
|
+
let qx = sxn / size, qy = syn / size;
|
|
146
|
+
let xn = x - xmin, yn = y - ymin;
|
|
147
|
+
let indX = Math.floor(xn / qx), indY = Math.floor(size - yn / qy);
|
|
423
148
|
let ind_v0 = ((size + 1) * indY + indX) * 3;
|
|
424
149
|
let ind_v2 = ((size + 1) * (indY + 1) + indX) * 3;
|
|
425
|
-
|
|
426
150
|
_v0.set(verts[ind_v0], verts[ind_v0 + 1], verts[ind_v0 + 2]);
|
|
427
151
|
_v1.set(verts[ind_v0 + 3], verts[ind_v0 + 4], verts[ind_v0 + 5]);
|
|
428
152
|
_v2.set(verts[ind_v2], verts[ind_v2 + 1], verts[ind_v2 + 2]);
|
|
429
|
-
|
|
430
153
|
let d = _ray.hitTriangle(_v0, _v1, _v2, res);
|
|
431
|
-
|
|
432
154
|
if (d === Ray.INSIDE) {
|
|
433
155
|
return xyz.distance(res);
|
|
434
|
-
}
|
|
156
|
+
}
|
|
157
|
+
else if (d === Ray.AWAY) {
|
|
435
158
|
_rayEx.set(xyz, norm);
|
|
436
159
|
let d = _rayEx.hitTriangle(_v0, _v1, _v2, res);
|
|
437
160
|
if (d === Ray.INSIDE) {
|
|
438
161
|
return -xyz.distance(res);
|
|
439
162
|
}
|
|
440
163
|
}
|
|
441
|
-
|
|
442
164
|
_v3.set(verts[ind_v2 + 3], verts[ind_v2 + 4], verts[ind_v2 + 5]);
|
|
443
|
-
|
|
444
165
|
d = _ray.hitTriangle(_v1, _v3, _v2, res);
|
|
445
166
|
if (d === Ray.INSIDE) {
|
|
446
167
|
return xyz.distance(res);
|
|
447
|
-
}
|
|
168
|
+
}
|
|
169
|
+
else if (d === Ray.AWAY) {
|
|
448
170
|
_rayEx.set(xyz, norm);
|
|
449
171
|
let d = _rayEx.hitTriangle(_v1, _v3, _v2, res);
|
|
450
172
|
if (d === Ray.INSIDE) {
|
|
451
173
|
return -xyz.distance(res);
|
|
452
174
|
}
|
|
453
175
|
}
|
|
454
|
-
|
|
455
176
|
if (d === Ray.AWAY) {
|
|
456
177
|
return -xyz.distance(res);
|
|
457
178
|
}
|
|
458
|
-
|
|
459
179
|
return xyz.distance(res);
|
|
460
|
-
}
|
|
461
|
-
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return xyz.distance(this.planet.ellipsoid.hitRay(_ray.origin, _ray.direction));
|
|
462
183
|
}
|
|
463
184
|
}
|
|
464
|
-
|
|
465
185
|
/**
|
|
466
186
|
* Project wgs86 to segment native projection.
|
|
467
187
|
* @public
|
|
468
188
|
* @param {LonLat} lonlat - Coordinates to project.
|
|
469
189
|
* @returns {LonLat} -
|
|
470
190
|
*/
|
|
471
|
-
|
|
191
|
+
projectNative(lonlat) {
|
|
472
192
|
return lonlat.forwardMercator();
|
|
473
193
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (this.tileZoom < this.planet.terrain!.minZoom || this.planet.terrain!.isEmpty) {
|
|
194
|
+
loadTerrain(forceLoading = false) {
|
|
195
|
+
if (this.tileZoom < this.planet.terrain.minZoom || this.planet.terrain.isEmpty) {
|
|
477
196
|
this.terrainIsLoading = true;
|
|
478
|
-
|
|
479
197
|
this.elevationsNotExists();
|
|
480
|
-
|
|
481
198
|
if (!this._inTheQueue) {
|
|
482
199
|
this.planet._normalMapCreator.queue(this);
|
|
483
200
|
}
|
|
484
|
-
}
|
|
485
|
-
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (this.tileZoom > this.planet.terrain.maxZoom) {
|
|
486
204
|
this.elevationsNotExists();
|
|
487
|
-
}
|
|
488
|
-
|
|
205
|
+
}
|
|
206
|
+
else if (!this.terrainIsLoading && !this.terrainReady) {
|
|
207
|
+
this.planet.terrain.loadTerrain(this, forceLoading);
|
|
489
208
|
}
|
|
490
209
|
// if (!this.terrainIsLoading && !this.terrainReady) {
|
|
491
210
|
// this.planet.terrain.loadTerrain(this, forceLoading);
|
|
492
211
|
// }
|
|
493
212
|
}
|
|
494
213
|
}
|
|
495
|
-
|
|
496
214
|
/**
|
|
497
215
|
* Terrain obtained from server.
|
|
498
216
|
* @param {Float32Array} elevations - Elevation data.
|
|
499
217
|
*/
|
|
500
|
-
|
|
218
|
+
elevationsExists(elevations) {
|
|
501
219
|
if (this.plainReady && this.terrainIsLoading) {
|
|
502
|
-
|
|
503
220
|
let _elevations = new Float32Array(elevations.length);
|
|
504
221
|
_elevations.set(elevations);
|
|
505
|
-
|
|
506
|
-
this.planet._terrainWorker.make({segment: this, elevations: _elevations});
|
|
507
|
-
|
|
222
|
+
this.planet._terrainWorker.make({ segment: this, elevations: _elevations });
|
|
508
223
|
this.plainVerticesHigh = null;
|
|
509
224
|
this.plainVerticesLow = null;
|
|
510
|
-
|
|
511
225
|
this.normalMapVerticesHigh = null;
|
|
512
226
|
this.normalMapVerticesLow = null;
|
|
513
|
-
|
|
514
|
-
if (!this.planet.terrain!.equalizeVertices) {
|
|
227
|
+
if (!this.planet.terrain.equalizeVertices) {
|
|
515
228
|
this.tempVerticesHigh = null;
|
|
516
229
|
this.tempVerticesLow = null;
|
|
517
230
|
}
|
|
518
231
|
}
|
|
519
232
|
}
|
|
520
|
-
|
|
521
233
|
/**
|
|
522
234
|
* Keep plain elevation segment for rendering
|
|
523
235
|
*
|
|
524
236
|
* 'this.tileZoom <= this.planet.terrain.maxZoom' it means, that the segment is plain
|
|
525
237
|
*
|
|
526
238
|
*/
|
|
527
|
-
|
|
528
|
-
if (this.planet && this.tileZoom <= this.planet.terrain
|
|
529
|
-
|
|
239
|
+
elevationsNotExists() {
|
|
240
|
+
if (this.planet && this.tileZoom <= this.planet.terrain.maxNativeZoom) {
|
|
530
241
|
if (this.plainReady && this.terrainIsLoading) {
|
|
531
242
|
this.terrainIsLoading = false;
|
|
532
|
-
|
|
533
243
|
let n = this.node;
|
|
534
244
|
n.appliedTerrainNodeId = this.node.nodeId;
|
|
535
245
|
n.equalizedSideWithNodeId[N] = n.equalizedSideWithNodeId[E] = n.equalizedSideWithNodeId[S] =
|
|
536
246
|
n.equalizedSideWithNodeId[W] = n.appliedTerrainNodeId;
|
|
537
|
-
|
|
538
247
|
if (this.planet.lightEnabled && !this._inTheQueue) {
|
|
539
248
|
this.planet._normalMapCreator.queue(this);
|
|
540
249
|
}
|
|
541
|
-
|
|
542
250
|
this.readyToEngage = true;
|
|
543
251
|
}
|
|
544
|
-
|
|
545
252
|
// plain terrain only
|
|
546
253
|
this.terrainVertices = this.plainVertices;
|
|
547
254
|
this.terrainVerticesHigh = this.plainVerticesHigh;
|
|
548
255
|
this.terrainVerticesLow = this.plainVerticesLow;
|
|
549
|
-
|
|
550
256
|
this.tempVertices = this.terrainVertices;
|
|
551
257
|
this.tempVerticesHigh = this.terrainVerticesHigh;
|
|
552
258
|
this.tempVerticesLow = this.terrainVerticesLow;
|
|
553
|
-
|
|
554
259
|
this.noDataVertices = null;
|
|
555
|
-
|
|
556
|
-
this.fileGridSize = Math.sqrt(this.terrainVertices!.length / 3) - 1;
|
|
260
|
+
this.fileGridSize = Math.sqrt(this.terrainVertices.length / 3) - 1;
|
|
557
261
|
this.gridSize = this.fileGridSize;
|
|
558
262
|
this.terrainReady = true;
|
|
559
263
|
this.terrainExists = false;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
563
266
|
if (this.plainReady && this.terrainIsLoading) {
|
|
564
267
|
this.terrainIsLoading = false;
|
|
565
|
-
|
|
566
268
|
let n = this.node;
|
|
567
269
|
n.appliedTerrainNodeId = this.node.nodeId;
|
|
568
270
|
n.equalizedSideWithNodeId[N] = n.equalizedSideWithNodeId[E] = n.equalizedSideWithNodeId[S] =
|
|
569
271
|
n.equalizedSideWithNodeId[W] = n.appliedTerrainNodeId;
|
|
570
|
-
|
|
571
272
|
this.readyToEngage = true;
|
|
572
273
|
this.terrainReady = true;
|
|
573
274
|
this.passReady = true;
|
|
574
|
-
|
|
575
275
|
this.terrainExists = false;
|
|
576
276
|
}
|
|
577
277
|
}
|
|
578
278
|
}
|
|
579
|
-
|
|
580
|
-
protected _checkEqualization(neighborSide: number, neigborNode: Node): boolean {
|
|
279
|
+
_checkEqualization(neighborSide, neigborNode) {
|
|
581
280
|
return neigborNode && this.tileZoom >= neigborNode.segment.tileZoom &&
|
|
582
281
|
this.node.equalizedSideWithNodeId[neighborSide] !== neigborNode.equalizedSideWithNodeId[OPSIDE[neighborSide]];
|
|
583
282
|
}
|
|
584
|
-
|
|
585
|
-
public equalize() {
|
|
586
|
-
|
|
283
|
+
equalize() {
|
|
587
284
|
if (this.tileZoom < 8 || this.gridSize < 2) {
|
|
588
285
|
return;
|
|
589
286
|
}
|
|
590
|
-
|
|
591
287
|
this.readyToEngage = true;
|
|
592
|
-
|
|
593
288
|
let nn = this.node.neighbors;
|
|
594
|
-
|
|
595
|
-
let
|
|
596
|
-
vHigh = this.tempVerticesHigh!,
|
|
597
|
-
vLow = this.tempVerticesLow!;
|
|
598
|
-
|
|
599
|
-
let gs = this.gridSize,
|
|
600
|
-
gsOne = gs + 1;
|
|
601
|
-
|
|
289
|
+
let v = this.tempVertices, vHigh = this.tempVerticesHigh, vLow = this.tempVerticesLow;
|
|
290
|
+
let gs = this.gridSize, gsOne = gs + 1;
|
|
602
291
|
let n = nn[N][0];
|
|
603
292
|
if (this._checkEqualization(N, n)) {
|
|
604
|
-
|
|
605
293
|
this.node.equalizedSideWithNodeId[N] = n.equalizedSideWithNodeId[S];
|
|
606
|
-
|
|
607
294
|
this.readyToEngage = true;
|
|
608
|
-
|
|
609
295
|
let offset = this.node.getOffsetOppositeNeighbourSide(n, N);
|
|
610
|
-
|
|
611
|
-
let
|
|
612
|
-
nvHigh = n.segment.tempVerticesHigh!,
|
|
613
|
-
nvLow = n.segment.tempVerticesLow!;
|
|
614
|
-
|
|
615
|
-
let n_gs = n.segment.gridSize,
|
|
616
|
-
n_gsOne = n_gs + 1;
|
|
617
|
-
|
|
296
|
+
let nv = n.segment.tempVertices, nvHigh = n.segment.tempVerticesHigh, nvLow = n.segment.tempVerticesLow;
|
|
297
|
+
let n_gs = n.segment.gridSize, n_gsOne = n_gs + 1;
|
|
618
298
|
let dz = 1 / (1 << (this.tileZoom - n.segment.tileZoom));
|
|
619
|
-
|
|
620
|
-
let inc = Math.max(gs / (n_gs * dz), 1),
|
|
621
|
-
n_inc = Math.max((n_gs * dz) / gs, 1),
|
|
622
|
-
n_offset = offset * n_gs;
|
|
623
|
-
|
|
299
|
+
let inc = Math.max(gs / (n_gs * dz), 1), n_inc = Math.max((n_gs * dz) / gs, 1), n_offset = offset * n_gs;
|
|
624
300
|
for (let k = 0, nk = n_offset; k < gsOne; k += inc, nk += n_inc) {
|
|
625
301
|
const index = k * 3;
|
|
626
302
|
const n_index = (n_gsOne * n_gs + nk) * 3;
|
|
627
|
-
|
|
628
303
|
v[index] = nv[n_index];
|
|
629
304
|
v[index + 1] = nv[n_index + 1];
|
|
630
305
|
v[index + 2] = nv[n_index + 2];
|
|
631
|
-
|
|
632
306
|
vHigh[index] = nvHigh[n_index];
|
|
633
307
|
vHigh[index + 1] = nvHigh[n_index + 1];
|
|
634
308
|
vHigh[index + 2] = nvHigh[n_index + 2];
|
|
635
|
-
|
|
636
309
|
vLow[index] = nvLow[n_index];
|
|
637
310
|
vLow[index + 1] = nvLow[n_index + 1];
|
|
638
311
|
vLow[index + 2] = nvLow[n_index + 2];
|
|
639
312
|
}
|
|
640
313
|
}
|
|
641
|
-
|
|
642
314
|
n = nn[E][0];
|
|
643
315
|
if (this._checkEqualization(E, n)) {
|
|
644
|
-
|
|
645
316
|
this.node.equalizedSideWithNodeId[E] = n.equalizedSideWithNodeId[W];
|
|
646
|
-
|
|
647
317
|
this.readyToEngage = true;
|
|
648
|
-
|
|
649
318
|
let offset = this.node.getOffsetOppositeNeighbourSide(n, E);
|
|
650
|
-
|
|
651
|
-
let
|
|
652
|
-
nvHigh = n.segment.tempVerticesHigh!,
|
|
653
|
-
nvLow = n.segment.tempVerticesLow!;
|
|
654
|
-
|
|
655
|
-
let n_gs = n.segment.gridSize,
|
|
656
|
-
n_gsOne = n_gs + 1;
|
|
657
|
-
|
|
319
|
+
let nv = n.segment.tempVertices, nvHigh = n.segment.tempVerticesHigh, nvLow = n.segment.tempVerticesLow;
|
|
320
|
+
let n_gs = n.segment.gridSize, n_gsOne = n_gs + 1;
|
|
658
321
|
let dz = 1 / (1 << (this.tileZoom - n.segment.tileZoom));
|
|
659
|
-
|
|
660
|
-
let inc = Math.max(gs / (n_gs * dz), 1),
|
|
661
|
-
n_inc = Math.max((n_gs * dz) / gs, 1),
|
|
662
|
-
n_offset = offset * n_gs;
|
|
663
|
-
|
|
322
|
+
let inc = Math.max(gs / (n_gs * dz), 1), n_inc = Math.max((n_gs * dz) / gs, 1), n_offset = offset * n_gs;
|
|
664
323
|
for (let k = 0, nk = n_offset; k < gsOne; k += inc, nk += n_inc) {
|
|
665
324
|
const index = (gsOne * k + gs) * 3;
|
|
666
325
|
const n_index = n_gsOne * nk * 3;
|
|
667
|
-
|
|
668
326
|
v[index] = nv[n_index];
|
|
669
327
|
v[index + 1] = nv[n_index + 1];
|
|
670
328
|
v[index + 2] = nv[n_index + 2];
|
|
671
|
-
|
|
672
329
|
vHigh[index] = nvHigh[n_index];
|
|
673
330
|
vHigh[index + 1] = nvHigh[n_index + 1];
|
|
674
331
|
vHigh[index + 2] = nvHigh[n_index + 2];
|
|
675
|
-
|
|
676
332
|
vLow[index] = nvLow[n_index];
|
|
677
333
|
vLow[index + 1] = nvLow[n_index + 1];
|
|
678
334
|
vLow[index + 2] = nvLow[n_index + 2];
|
|
679
335
|
}
|
|
680
336
|
}
|
|
681
|
-
|
|
682
337
|
n = nn[S][0];
|
|
683
338
|
if (this._checkEqualization(S, n)) {
|
|
684
|
-
|
|
685
339
|
this.node.equalizedSideWithNodeId[S] = n.equalizedSideWithNodeId[N];
|
|
686
|
-
|
|
687
340
|
this.readyToEngage = true;
|
|
688
|
-
|
|
689
341
|
let offset = this.node.getOffsetOppositeNeighbourSide(n, S);
|
|
690
|
-
|
|
691
|
-
let nv = n.segment.tempVertices!,
|
|
692
|
-
nvHigh = n.segment.tempVerticesHigh!,
|
|
693
|
-
nvLow = n.segment.tempVerticesLow!;
|
|
694
|
-
|
|
342
|
+
let nv = n.segment.tempVertices, nvHigh = n.segment.tempVerticesHigh, nvLow = n.segment.tempVerticesLow;
|
|
695
343
|
let n_gs = n.segment.gridSize; // n_gsOne = n_gs + 1;
|
|
696
|
-
|
|
697
344
|
let dz = 1 / (1 << (this.tileZoom - n.segment.tileZoom));
|
|
698
|
-
|
|
699
|
-
let inc = Math.max(gs / (n_gs * dz), 1),
|
|
700
|
-
n_inc = Math.max((n_gs * dz) / gs, 1),
|
|
701
|
-
n_offset = offset * n_gs;
|
|
702
|
-
|
|
345
|
+
let inc = Math.max(gs / (n_gs * dz), 1), n_inc = Math.max((n_gs * dz) / gs, 1), n_offset = offset * n_gs;
|
|
703
346
|
for (let k = 0, nk = n_offset; k < gsOne; k += inc, nk += n_inc) {
|
|
704
347
|
const index = (gsOne * gs + k) * 3;
|
|
705
348
|
const n_index = nk * 3;
|
|
706
|
-
|
|
707
349
|
v[index] = nv[n_index];
|
|
708
350
|
v[index + 1] = nv[n_index + 1];
|
|
709
351
|
v[index + 2] = nv[n_index + 2];
|
|
710
|
-
|
|
711
352
|
vHigh[index] = nvHigh[n_index];
|
|
712
353
|
vHigh[index + 1] = nvHigh[n_index + 1];
|
|
713
354
|
vHigh[index + 2] = nvHigh[n_index + 2];
|
|
714
|
-
|
|
715
355
|
vLow[index] = nvLow[n_index];
|
|
716
356
|
vLow[index + 1] = nvLow[n_index + 1];
|
|
717
357
|
vLow[index + 2] = nvLow[n_index + 2];
|
|
718
358
|
}
|
|
719
359
|
}
|
|
720
|
-
|
|
721
360
|
n = nn[W][0];
|
|
722
361
|
if (this._checkEqualization(W, n)) {
|
|
723
|
-
|
|
724
362
|
this.node.equalizedSideWithNodeId[W] = n.equalizedSideWithNodeId[E];
|
|
725
|
-
|
|
726
363
|
this.readyToEngage = true;
|
|
727
|
-
|
|
728
364
|
let offset = this.node.getOffsetOppositeNeighbourSide(n, W);
|
|
729
|
-
|
|
730
|
-
let
|
|
731
|
-
nvHigh = n.segment.tempVerticesHigh!,
|
|
732
|
-
nvLow = n.segment.tempVerticesLow!;
|
|
733
|
-
|
|
734
|
-
let n_gs = n.segment.gridSize,
|
|
735
|
-
n_gsOne = n_gs + 1;
|
|
736
|
-
|
|
365
|
+
let nv = n.segment.tempVertices, nvHigh = n.segment.tempVerticesHigh, nvLow = n.segment.tempVerticesLow;
|
|
366
|
+
let n_gs = n.segment.gridSize, n_gsOne = n_gs + 1;
|
|
737
367
|
let dz = 1 / (1 << (this.tileZoom - n.segment.tileZoom));
|
|
738
|
-
|
|
739
|
-
let inc = Math.max(gs / (n_gs * dz), 1),
|
|
740
|
-
n_inc = Math.max((n_gs * dz) / gs, 1),
|
|
741
|
-
n_offset = offset * n_gs;
|
|
742
|
-
|
|
368
|
+
let inc = Math.max(gs / (n_gs * dz), 1), n_inc = Math.max((n_gs * dz) / gs, 1), n_offset = offset * n_gs;
|
|
743
369
|
for (let k = 0, nk = n_offset; k < gsOne; k += inc, nk += n_inc) {
|
|
744
370
|
const index = gsOne * k * 3;
|
|
745
371
|
const n_index = (n_gsOne * nk + n_gs) * 3;
|
|
746
|
-
|
|
747
372
|
v[index] = nv[n_index];
|
|
748
373
|
v[index + 1] = nv[n_index + 1];
|
|
749
374
|
v[index + 2] = nv[n_index + 2];
|
|
750
|
-
|
|
751
375
|
vHigh[index] = nvHigh[n_index];
|
|
752
376
|
vHigh[index + 1] = nvHigh[n_index + 1];
|
|
753
377
|
vHigh[index + 2] = nvHigh[n_index + 2];
|
|
754
|
-
|
|
755
378
|
vLow[index] = nvLow[n_index];
|
|
756
379
|
vLow[index + 1] = nvLow[n_index + 1];
|
|
757
380
|
vLow[index + 2] = nvLow[n_index + 2];
|
|
758
381
|
}
|
|
759
382
|
}
|
|
760
383
|
}
|
|
761
|
-
|
|
762
|
-
public engage() {
|
|
384
|
+
engage() {
|
|
763
385
|
this.readyToEngage = false;
|
|
764
|
-
this.createCoordsBuffers(this.tempVerticesHigh
|
|
386
|
+
this.createCoordsBuffers(this.tempVerticesHigh, this.tempVerticesLow, this.gridSize);
|
|
765
387
|
}
|
|
766
|
-
|
|
767
|
-
public _terrainWorkerCallback(data: ITerrainWorkerData) {
|
|
388
|
+
_terrainWorkerCallback(data) {
|
|
768
389
|
if (this.plainReady) {
|
|
769
390
|
this.readyToEngage = true;
|
|
770
|
-
|
|
771
391
|
this.normalMapNormals = null;
|
|
772
|
-
|
|
773
392
|
this.normalMapVertices = null;
|
|
774
393
|
this.normalMapVerticesHigh = null;
|
|
775
394
|
this.normalMapVerticesLow = null;
|
|
776
|
-
|
|
777
395
|
this.terrainVertices = null;
|
|
778
396
|
this.terrainVerticesHigh = null;
|
|
779
397
|
this.terrainVerticesLow = null;
|
|
780
398
|
this.noDataVertices = null;
|
|
781
|
-
|
|
782
399
|
this.tempVertices = null;
|
|
783
400
|
this.tempVerticesHigh = null;
|
|
784
401
|
this.tempVerticesLow = null;
|
|
785
|
-
|
|
786
402
|
this.normalMapNormals = data.normalMapNormals;
|
|
787
403
|
this.normalMapVertices = data.normalMapVertices;
|
|
788
404
|
this.normalMapVerticesHigh = data.normalMapVerticesHigh;
|
|
789
405
|
this.normalMapVerticesLow = data.normalMapVerticesLow;
|
|
790
|
-
|
|
791
406
|
this.terrainVertices = data.terrainVertices;
|
|
792
407
|
this.terrainVerticesHigh = data.terrainVerticesHigh;
|
|
793
408
|
this.terrainVerticesLow = data.terrainVerticesLow;
|
|
794
|
-
|
|
795
409
|
this.noDataVertices = data.noDataVertices;
|
|
796
|
-
|
|
797
410
|
this.tempVertices = this.terrainVertices;
|
|
798
411
|
this.tempVerticesHigh = this.terrainVerticesHigh;
|
|
799
412
|
this.tempVerticesLow = this.terrainVerticesLow;
|
|
800
|
-
|
|
801
413
|
this.setBoundingVolumeArr(data.bounds);
|
|
802
|
-
|
|
803
|
-
this.gridSize = Math.sqrt(this.terrainVertices!.length / 3) - 1;
|
|
804
|
-
|
|
414
|
+
this.gridSize = Math.sqrt(this.terrainVertices.length / 3) - 1;
|
|
805
415
|
let n = this.node;
|
|
806
416
|
n.appliedTerrainNodeId = n.nodeId;
|
|
807
417
|
n.equalizedSideWithNodeId[N] = n.equalizedSideWithNodeId[E] = n.equalizedSideWithNodeId[S] =
|
|
808
418
|
n.equalizedSideWithNodeId[W] = n.appliedTerrainNodeId;
|
|
809
|
-
|
|
810
419
|
this.terrainReady = true;
|
|
811
420
|
this.terrainIsLoading = false;
|
|
812
421
|
this.terrainExists = true;
|
|
813
|
-
|
|
814
422
|
if (!this.normalMapTexturePtr) {
|
|
815
423
|
const nmc = this.planet._normalMapCreator;
|
|
816
|
-
this.normalMapTexturePtr = this.planet.renderer
|
|
424
|
+
this.normalMapTexturePtr = this.planet.renderer.handler.createEmptyTexture_l(nmc.width, nmc.height);
|
|
817
425
|
}
|
|
818
|
-
|
|
819
426
|
if (this.planet.lightEnabled) {
|
|
820
427
|
this.planet._normalMapCreator.queue(this);
|
|
821
428
|
}
|
|
822
429
|
}
|
|
823
430
|
}
|
|
824
|
-
|
|
825
|
-
public _normalMapEdgeEqualize(side: number) {
|
|
431
|
+
_normalMapEdgeEqualize(side) {
|
|
826
432
|
let nn = this.node.neighbors;
|
|
827
|
-
let n
|
|
828
|
-
let maxZ = this.planet.terrain
|
|
829
|
-
|
|
433
|
+
let n = nn[side][0];
|
|
434
|
+
let maxZ = this.planet.terrain.maxZoom;
|
|
830
435
|
if (this.tileZoom === maxZ) {
|
|
831
436
|
if (!(nn[0].length || nn[1].length || nn[2].length || nn[3].length)) {
|
|
832
437
|
n = this.node.getEqualNeighbor(side);
|
|
833
438
|
}
|
|
834
439
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
s = this;
|
|
838
|
-
|
|
839
|
-
if (
|
|
840
|
-
n &&
|
|
440
|
+
let b = n && n.segment, s = this;
|
|
441
|
+
if (n &&
|
|
841
442
|
b &&
|
|
842
443
|
b.terrainReady &&
|
|
843
444
|
b.terrainExists &&
|
|
844
445
|
b.tileZoom <= maxZ &&
|
|
845
|
-
s._appliedNeighborsZoom[side] !== b.tileZoom
|
|
846
|
-
) {
|
|
446
|
+
s._appliedNeighborsZoom[side] !== b.tileZoom) {
|
|
847
447
|
s._appliedNeighborsZoom[side] = b.tileZoom;
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
if (!(seg_a && seg_b)) return;
|
|
853
|
-
|
|
854
|
-
let seg_a_raw = s.normalMapNormals!,
|
|
855
|
-
seg_b_raw = b.normalMapNormals!;
|
|
856
|
-
|
|
448
|
+
let seg_a = s.normalMapNormals, seg_b = b.normalMapNormals;
|
|
449
|
+
if (!(seg_a && seg_b))
|
|
450
|
+
return;
|
|
451
|
+
let seg_a_raw = s.normalMapNormals, seg_b_raw = b.normalMapNormals;
|
|
857
452
|
// let seg_a_verts = s.terrainVertices,
|
|
858
453
|
// seg_b_verts = s.terrainVertices;
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
s_gs1 = s_gs - 1;
|
|
454
|
+
let s_gs = Math.sqrt(seg_a.length / 3),
|
|
455
|
+
// b_gs = Math.sqrt(seg_b.length / 3),
|
|
456
|
+
s_gs1 = s_gs - 1;
|
|
863
457
|
// b_gs1 = b_gs - 1;
|
|
864
|
-
|
|
865
458
|
const i_a = s_gs1 * _S[side];
|
|
866
|
-
|
|
867
459
|
let nx, ny, nz, q;
|
|
868
|
-
|
|
869
460
|
if (s.tileZoom === b.tileZoom) {
|
|
870
461
|
const i_b = s_gs1 - i_a;
|
|
871
|
-
|
|
872
462
|
if (_V[side]) {
|
|
873
463
|
for (let k = 0; k < s_gs; k++) {
|
|
874
|
-
let vInd_a = (k * s_gs + i_a) * 3,
|
|
875
|
-
vInd_b = (k * s_gs + i_b) * 3;
|
|
876
|
-
|
|
464
|
+
let vInd_a = (k * s_gs + i_a) * 3, vInd_b = (k * s_gs + i_b) * 3;
|
|
877
465
|
nx = seg_a_raw[vInd_a] + seg_b_raw[vInd_b];
|
|
878
466
|
ny = seg_a_raw[vInd_a + 1] + seg_b_raw[vInd_b + 1];
|
|
879
467
|
nz = seg_a_raw[vInd_a + 2] + seg_b_raw[vInd_b + 2];
|
|
880
|
-
|
|
881
468
|
q = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
882
|
-
|
|
883
469
|
seg_b[vInd_b] = seg_a[vInd_a] = nx * q;
|
|
884
470
|
seg_b[vInd_b + 1] = seg_a[vInd_a + 1] = ny * q;
|
|
885
471
|
seg_b[vInd_b + 2] = seg_a[vInd_a + 2] = nz * q;
|
|
886
472
|
}
|
|
887
|
-
}
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
888
475
|
for (let k = 0; k < s_gs; k++) {
|
|
889
|
-
let vInd_a = (i_a * s_gs + k) * 3,
|
|
890
|
-
vInd_b = (i_b * s_gs + k) * 3;
|
|
891
|
-
|
|
476
|
+
let vInd_a = (i_a * s_gs + k) * 3, vInd_b = (i_b * s_gs + k) * 3;
|
|
892
477
|
nx = seg_a_raw[vInd_a] + seg_b_raw[vInd_b];
|
|
893
478
|
ny = seg_a_raw[vInd_a + 1] + seg_b_raw[vInd_b + 1];
|
|
894
479
|
nz = seg_a_raw[vInd_a + 2] + seg_b_raw[vInd_b + 2];
|
|
895
|
-
|
|
896
480
|
q = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
897
|
-
|
|
898
481
|
seg_b[vInd_b] = seg_a[vInd_a] = nx * q;
|
|
899
482
|
seg_b[vInd_b + 1] = seg_a[vInd_a + 1] = ny * q;
|
|
900
483
|
seg_b[vInd_b + 2] = seg_a[vInd_a + 2] = nz * q;
|
|
901
484
|
}
|
|
902
485
|
}
|
|
903
|
-
|
|
904
486
|
if (!b._inTheQueue && b._appliedNeighborsZoom[OPSIDE[side]] !== s.tileZoom) {
|
|
905
487
|
b._appliedNeighborsZoom[OPSIDE[side]] = s.tileZoom;
|
|
906
488
|
s.planet._normalMapCreator.queue(b);
|
|
@@ -908,32 +490,27 @@ class Segment {
|
|
|
908
490
|
}
|
|
909
491
|
}
|
|
910
492
|
}
|
|
911
|
-
|
|
912
|
-
public applyTerrain(elevations?: number[] | TypedArray | null) {
|
|
493
|
+
applyTerrain(elevations) {
|
|
913
494
|
if (elevations) {
|
|
914
495
|
this.elevationsExists(elevations);
|
|
915
|
-
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
916
498
|
this.elevationsNotExists();
|
|
917
499
|
}
|
|
918
500
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
gl.deleteBuffer(this.
|
|
925
|
-
gl.deleteBuffer(this.vertexPositionBuffer!);
|
|
926
|
-
gl.deleteBuffer(this.vertexPositionBufferHigh!);
|
|
927
|
-
gl.deleteBuffer(this.vertexPositionBufferLow!);
|
|
928
|
-
|
|
501
|
+
deleteBuffers() {
|
|
502
|
+
const gl = this.handler.gl;
|
|
503
|
+
gl.deleteBuffer(this.vertexNormalBuffer);
|
|
504
|
+
gl.deleteBuffer(this.vertexPositionBuffer);
|
|
505
|
+
gl.deleteBuffer(this.vertexPositionBufferHigh);
|
|
506
|
+
gl.deleteBuffer(this.vertexPositionBufferLow);
|
|
929
507
|
this.vertexNormalBuffer = null;
|
|
930
508
|
this.vertexPositionBuffer = null;
|
|
931
509
|
this.vertexPositionBufferHigh = null;
|
|
932
510
|
this.vertexPositionBufferLow = null;
|
|
933
511
|
this.vertexTextureCoordBuffer = null;
|
|
934
512
|
}
|
|
935
|
-
|
|
936
|
-
public deleteMaterials() {
|
|
513
|
+
deleteMaterials() {
|
|
937
514
|
let m = this.materials;
|
|
938
515
|
for (let i = 0; i < m.length; i++) {
|
|
939
516
|
let mi = m[i];
|
|
@@ -943,62 +520,48 @@ class Segment {
|
|
|
943
520
|
}
|
|
944
521
|
this.materials.length = 0;
|
|
945
522
|
}
|
|
946
|
-
|
|
947
|
-
public deleteElevations() {
|
|
523
|
+
deleteElevations() {
|
|
948
524
|
this.terrainExists = false;
|
|
949
525
|
this.terrainReady = false;
|
|
950
526
|
this.terrainIsLoading = false;
|
|
951
|
-
|
|
952
527
|
this.normalMapVertices = null;
|
|
953
528
|
this.normalMapVerticesHigh = null;
|
|
954
529
|
this.normalMapVerticesLow = null;
|
|
955
530
|
this.normalMapNormals = null;
|
|
956
|
-
|
|
957
531
|
this.tempVertices = null;
|
|
958
532
|
this.tempVerticesHigh = null;
|
|
959
533
|
this.tempVerticesLow = null;
|
|
960
|
-
|
|
961
534
|
this.terrainVertices = null;
|
|
962
535
|
this.terrainVerticesHigh = null;
|
|
963
536
|
this.terrainVerticesLow = null;
|
|
964
537
|
this.noDataVertices = null;
|
|
965
|
-
|
|
966
538
|
this.plainVertices = null;
|
|
967
539
|
this.plainVerticesHigh = null;
|
|
968
540
|
this.plainVerticesLow = null;
|
|
969
541
|
this.plainNormals = null;
|
|
970
|
-
|
|
971
542
|
if (this.normalMapReady) {
|
|
972
|
-
this.handler.gl
|
|
543
|
+
this.handler.gl.deleteTexture(this.normalMapTexture);
|
|
973
544
|
this.normalMapReady = false;
|
|
974
545
|
}
|
|
975
|
-
|
|
976
546
|
this._appliedNeighborsZoom = [0, 0, 0, 0];
|
|
977
|
-
|
|
978
547
|
this.normalMapTextureBias[0] = 0;
|
|
979
548
|
this.normalMapTextureBias[1] = 0;
|
|
980
549
|
this.normalMapTextureBias[2] = 1;
|
|
981
|
-
|
|
982
550
|
this._inTheQueue = false;
|
|
983
551
|
}
|
|
984
|
-
|
|
985
|
-
public clearSegment() {
|
|
552
|
+
clearSegment() {
|
|
986
553
|
this.plainReady = false;
|
|
987
554
|
this.initialized = false;
|
|
988
555
|
this.deleteBuffers();
|
|
989
556
|
this.deleteMaterials();
|
|
990
557
|
this.deleteElevations();
|
|
991
558
|
}
|
|
992
|
-
|
|
993
|
-
public destroySegment() {
|
|
994
|
-
|
|
559
|
+
destroySegment() {
|
|
995
560
|
this.clearSegment();
|
|
996
|
-
|
|
997
561
|
let i = this._slices.length;
|
|
998
562
|
while (i--) {
|
|
999
563
|
this._slices[i].clear();
|
|
1000
564
|
}
|
|
1001
|
-
|
|
1002
565
|
//@ts-ignore
|
|
1003
566
|
this._slices = null;
|
|
1004
567
|
//@ts-ignore
|
|
@@ -1015,21 +578,17 @@ class Segment {
|
|
|
1015
578
|
this._extent = null;
|
|
1016
579
|
//@ts-ignore
|
|
1017
580
|
this.materials = null;
|
|
1018
|
-
|
|
1019
581
|
this.plainVertices = null;
|
|
1020
582
|
this.plainVerticesHigh = null;
|
|
1021
583
|
this.plainVerticesLow = null;
|
|
1022
584
|
this.plainNormals = null;
|
|
1023
|
-
|
|
1024
585
|
this.terrainVertices = null;
|
|
1025
586
|
this.terrainVerticesHigh = null;
|
|
1026
587
|
this.terrainVerticesLow = null;
|
|
1027
588
|
this.noDataVertices = null;
|
|
1028
|
-
|
|
1029
589
|
this.tempVertices = null;
|
|
1030
590
|
this.tempVerticesHigh = null;
|
|
1031
591
|
this.tempVerticesLow = null;
|
|
1032
|
-
|
|
1033
592
|
//@ts-ignore
|
|
1034
593
|
this.normalMapTextureBias = null;
|
|
1035
594
|
this.normalMapTexture = null;
|
|
@@ -1037,13 +596,11 @@ class Segment {
|
|
|
1037
596
|
this.normalMapVerticesHigh = null;
|
|
1038
597
|
this.normalMapVerticesLow = null;
|
|
1039
598
|
this.normalMapNormals = null;
|
|
1040
|
-
|
|
1041
599
|
this.vertexNormalBuffer = null;
|
|
1042
600
|
this.vertexPositionBuffer = null;
|
|
1043
601
|
this.vertexPositionBufferHigh = null;
|
|
1044
602
|
this.vertexPositionBufferLow = null;
|
|
1045
603
|
this.vertexTextureCoordBuffer = null;
|
|
1046
|
-
|
|
1047
604
|
// @ts-ignore
|
|
1048
605
|
this._projection = null;
|
|
1049
606
|
// @ts-ignore
|
|
@@ -1051,54 +608,34 @@ class Segment {
|
|
|
1051
608
|
// @ts-ignore
|
|
1052
609
|
this._globalTextureCoordinates = null;
|
|
1053
610
|
}
|
|
1054
|
-
|
|
1055
611
|
/**
|
|
1056
612
|
* @todo: looks like it could be simplified in Segment contructor
|
|
1057
613
|
*/
|
|
1058
|
-
|
|
614
|
+
_setExtentLonLat() {
|
|
1059
615
|
this._extentLonLat = this._extent.inverseMercator();
|
|
1060
616
|
}
|
|
1061
|
-
|
|
1062
|
-
public createBoundsByExtent() {
|
|
617
|
+
createBoundsByExtent() {
|
|
1063
618
|
const ellipsoid = this.planet.ellipsoid;
|
|
1064
619
|
const extent = this._extentLonLat;
|
|
1065
|
-
|
|
1066
620
|
const coord_sw = ellipsoid.geodeticToCartesian(extent.southWest.lon, extent.southWest.lat);
|
|
1067
621
|
const coord_ne = ellipsoid.geodeticToCartesian(extent.northEast.lon, extent.northEast.lat);
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
extent.southWest.lon,
|
|
1071
|
-
extent.northEast.lat
|
|
1072
|
-
);
|
|
1073
|
-
|
|
1074
|
-
const coord_se = ellipsoid.geodeticToCartesian(
|
|
1075
|
-
extent.northEast.lon,
|
|
1076
|
-
extent.southWest.lat
|
|
1077
|
-
);
|
|
1078
|
-
|
|
622
|
+
const coord_nw = ellipsoid.geodeticToCartesian(extent.southWest.lon, extent.northEast.lat);
|
|
623
|
+
const coord_se = ellipsoid.geodeticToCartesian(extent.northEast.lon, extent.southWest.lat);
|
|
1079
624
|
this._sw.copy(coord_sw);
|
|
1080
625
|
this._nw.copy(coord_nw);
|
|
1081
626
|
this._ne.copy(coord_ne);
|
|
1082
627
|
this._se.copy(coord_se);
|
|
1083
|
-
|
|
1084
628
|
this.setBoundingVolume3v(coord_sw, coord_ne);
|
|
1085
629
|
}
|
|
1086
|
-
|
|
1087
|
-
public createBoundsByParent() {
|
|
630
|
+
createBoundsByParent() {
|
|
1088
631
|
let pn = this.node;
|
|
1089
|
-
|
|
1090
632
|
while (pn.parentNode && !pn.segment.terrainReady) {
|
|
1091
633
|
pn = pn.parentNode;
|
|
1092
634
|
}
|
|
1093
|
-
|
|
1094
635
|
let dZ2 = 1 << (this.tileZoom - pn.segment.tileZoom);
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
offsetY = this.tileY - pn.segment.tileY * dZ2;
|
|
1098
|
-
|
|
1099
|
-
if (pn.segment.terrainReady && pn.segment.tileZoom >= this.planet.terrain!.minZoom) {
|
|
636
|
+
let offsetX = this.tileX - pn.segment.tileX * dZ2, offsetY = this.tileY - pn.segment.tileY * dZ2;
|
|
637
|
+
if (pn.segment.terrainReady && pn.segment.tileZoom >= this.planet.terrain.minZoom) {
|
|
1100
638
|
let gridSize = pn.segment.gridSize / dZ2;
|
|
1101
|
-
|
|
1102
639
|
if (gridSize >= 1.0) {
|
|
1103
640
|
//
|
|
1104
641
|
// (*) Actually, we get parent whole bounding volume
|
|
@@ -1107,244 +644,145 @@ class Segment {
|
|
|
1107
644
|
this.bsphere.center.y = pn.segment.bsphere.center.y;
|
|
1108
645
|
this.bsphere.center.z = pn.segment.bsphere.center.z;
|
|
1109
646
|
this.bsphere.radius = pn.segment.bsphere.radius;
|
|
1110
|
-
|
|
1111
647
|
let i0 = gridSize * offsetY;
|
|
1112
648
|
let j0 = gridSize * offsetX;
|
|
1113
|
-
|
|
1114
649
|
let pnGsOne = pn.segment.gridSize + 1;
|
|
1115
|
-
|
|
1116
|
-
let
|
|
1117
|
-
|
|
1118
|
-
ind_ne = 3 * (i0 * pnGsOne + j0 + gridSize),
|
|
1119
|
-
ind_se = 3 * ((i0 + gridSize) * pnGsOne + j0 + gridSize);
|
|
1120
|
-
|
|
1121
|
-
let pVerts = pn.segment.tempVertices!;
|
|
1122
|
-
|
|
1123
|
-
let v_sw = new Vec3(pVerts[ind_sw], pVerts[ind_sw + 1], pVerts[ind_sw + 2]),
|
|
1124
|
-
v_ne = new Vec3(pVerts[ind_ne], pVerts[ind_ne + 1], pVerts[ind_ne + 2]);
|
|
1125
|
-
|
|
650
|
+
let ind_sw = 3 * ((i0 + gridSize) * pnGsOne + j0), ind_nw = 3 * (i0 * pnGsOne + j0), ind_ne = 3 * (i0 * pnGsOne + j0 + gridSize), ind_se = 3 * ((i0 + gridSize) * pnGsOne + j0 + gridSize);
|
|
651
|
+
let pVerts = pn.segment.tempVertices;
|
|
652
|
+
let v_sw = new Vec3(pVerts[ind_sw], pVerts[ind_sw + 1], pVerts[ind_sw + 2]), v_ne = new Vec3(pVerts[ind_ne], pVerts[ind_ne + 1], pVerts[ind_ne + 2]);
|
|
1126
653
|
// check for segment zoom
|
|
1127
|
-
let v_nw = new Vec3(pVerts[ind_nw], pVerts[ind_nw + 1], pVerts[ind_nw + 2]),
|
|
1128
|
-
v_se = new Vec3(pVerts[ind_se], pVerts[ind_se + 1], pVerts[ind_se + 2]);
|
|
1129
|
-
|
|
654
|
+
let v_nw = new Vec3(pVerts[ind_nw], pVerts[ind_nw + 1], pVerts[ind_nw + 2]), v_se = new Vec3(pVerts[ind_se], pVerts[ind_se + 1], pVerts[ind_se + 2]);
|
|
1130
655
|
this._sw.copy(v_sw);
|
|
1131
656
|
this._nw.copy(v_nw);
|
|
1132
657
|
this._ne.copy(v_ne);
|
|
1133
658
|
this._se.copy(v_se);
|
|
1134
|
-
|
|
1135
|
-
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
1136
661
|
let pseg = pn.segment;
|
|
1137
|
-
|
|
1138
|
-
let i0 = Math.floor(gridSize * offsetY),
|
|
1139
|
-
j0 = Math.floor(gridSize * offsetX);
|
|
1140
|
-
|
|
662
|
+
let i0 = Math.floor(gridSize * offsetY), j0 = Math.floor(gridSize * offsetX);
|
|
1141
663
|
let insideSize = 1.0 / gridSize;
|
|
1142
|
-
|
|
1143
|
-
let t_i0 = offsetY - insideSize * i0,
|
|
1144
|
-
t_j0 = offsetX - insideSize * j0;
|
|
1145
|
-
|
|
664
|
+
let t_i0 = offsetY - insideSize * i0, t_j0 = offsetX - insideSize * j0;
|
|
1146
665
|
let bigOne;
|
|
1147
666
|
if (pseg.gridSize === 1) {
|
|
1148
|
-
bigOne = pseg.tempVertices
|
|
1149
|
-
}
|
|
1150
|
-
|
|
667
|
+
bigOne = pseg.tempVertices;
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
bigOne = getMatrixSubArray64(pseg.tempVertices, pseg.gridSize, i0, j0, 1);
|
|
1151
671
|
}
|
|
1152
|
-
|
|
1153
|
-
let
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
let vn = new Vec3(
|
|
1157
|
-
bigOne[3] - bigOne[0],
|
|
1158
|
-
bigOne[4] - bigOne[1],
|
|
1159
|
-
bigOne[5] - bigOne[2]
|
|
1160
|
-
),
|
|
1161
|
-
vw = new Vec3(
|
|
1162
|
-
bigOne[6] - bigOne[0],
|
|
1163
|
-
bigOne[7] - bigOne[1],
|
|
1164
|
-
bigOne[8] - bigOne[2]
|
|
1165
|
-
),
|
|
1166
|
-
ve = new Vec3(
|
|
1167
|
-
bigOne[3] - bigOne[9],
|
|
1168
|
-
bigOne[4] - bigOne[10],
|
|
1169
|
-
bigOne[5] - bigOne[11]
|
|
1170
|
-
),
|
|
1171
|
-
vs = new Vec3(
|
|
1172
|
-
bigOne[6] - bigOne[9],
|
|
1173
|
-
bigOne[7] - bigOne[10],
|
|
1174
|
-
bigOne[8] - bigOne[11]
|
|
1175
|
-
);
|
|
1176
|
-
|
|
1177
|
-
let vi_y = t_i0,
|
|
1178
|
-
vi_x = t_j0;
|
|
1179
|
-
|
|
672
|
+
let v_lt = new Vec3(bigOne[0], bigOne[1], bigOne[2]), v_rb = new Vec3(bigOne[9], bigOne[10], bigOne[11]);
|
|
673
|
+
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]);
|
|
674
|
+
let vi_y = t_i0, vi_x = t_j0;
|
|
1180
675
|
let coords_lt, coords_rb;
|
|
1181
|
-
|
|
1182
676
|
if (vi_y + vi_x < insideSize) {
|
|
1183
|
-
coords_lt = Vec3.add(
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
).addA(
|
|
1187
|
-
} else {
|
|
1188
|
-
coords_lt = Vec3.add(
|
|
1189
|
-
vs.scaleTo(1 - vi_x / insideSize),
|
|
1190
|
-
ve.scaleTo(1 - vi_y / insideSize)
|
|
1191
|
-
).addA(v_rb);
|
|
677
|
+
coords_lt = Vec3.add(vn.scaleTo(vi_x / insideSize), vw.scaleTo(vi_y / insideSize)).addA(v_lt);
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
coords_lt = Vec3.add(vs.scaleTo(1 - vi_x / insideSize), ve.scaleTo(1 - vi_y / insideSize)).addA(v_rb);
|
|
1192
681
|
}
|
|
1193
|
-
|
|
1194
682
|
vi_y = t_i0 + 1;
|
|
1195
683
|
vi_x = t_j0 + 1;
|
|
1196
|
-
|
|
1197
684
|
if (vi_y + vi_x < insideSize) {
|
|
1198
|
-
coords_rb = Vec3.add(
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
).addA(
|
|
1202
|
-
} else {
|
|
1203
|
-
coords_rb = Vec3.add(
|
|
1204
|
-
vs.scaleTo(1 - vi_x / insideSize),
|
|
1205
|
-
ve.scaleTo(1 - vi_y / insideSize)
|
|
1206
|
-
).addA(v_rb);
|
|
685
|
+
coords_rb = Vec3.add(vn.scaleTo(vi_x / insideSize), vw.scaleTo(vi_y / insideSize)).addA(v_lt);
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
coords_rb = Vec3.add(vs.scaleTo(1 - vi_x / insideSize), ve.scaleTo(1 - vi_y / insideSize)).addA(v_rb);
|
|
1207
689
|
}
|
|
1208
|
-
|
|
1209
690
|
this.setBoundingVolume3v(coords_lt, coords_rb);
|
|
1210
691
|
}
|
|
1211
|
-
}
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
1212
694
|
this.createBoundsByExtent();
|
|
1213
695
|
}
|
|
1214
696
|
}
|
|
1215
|
-
|
|
1216
|
-
public setBoundingSphere(x: number, y: number, z: number, v: Vec3) {
|
|
697
|
+
setBoundingSphere(x, y, z, v) {
|
|
1217
698
|
this.bsphere.center.x = x;
|
|
1218
699
|
this.bsphere.center.y = y;
|
|
1219
700
|
this.bsphere.center.z = z;
|
|
1220
701
|
this.bsphere.radius = this.bsphere.center.distance(v);
|
|
1221
702
|
}
|
|
1222
|
-
|
|
1223
|
-
public setBoundingVolume(xmin: number, ymin: number, zmin: number, xmax: number, ymax: number, zmax: number) {
|
|
703
|
+
setBoundingVolume(xmin, ymin, zmin, xmax, ymax, zmax) {
|
|
1224
704
|
this.bbox.setFromBoundsArr([xmin, ymin, zmin, xmax, ymax, zmax]);
|
|
1225
|
-
|
|
1226
|
-
let x = xmin + (xmax - xmin) * 0.5,
|
|
1227
|
-
y = ymin + (ymax - ymin) * 0.5,
|
|
1228
|
-
z = zmin + (zmax - zmin) * 0.5;
|
|
1229
|
-
|
|
705
|
+
let x = xmin + (xmax - xmin) * 0.5, y = ymin + (ymax - ymin) * 0.5, z = zmin + (zmax - zmin) * 0.5;
|
|
1230
706
|
this.bsphere.center.set(x, y, z);
|
|
1231
707
|
this.bsphere.radius = this.bsphere.center.distance(new Vec3(xmin, ymin, zmin));
|
|
1232
708
|
}
|
|
1233
|
-
|
|
1234
|
-
public setBoundingVolume3v(vmin: Vec3, vmax: Vec3) {
|
|
709
|
+
setBoundingVolume3v(vmin, vmax) {
|
|
1235
710
|
this.bbox.setFromBoundsArr([vmin.x, vmin.y, vmin.z, vmax.x, vmax.y, vmax.z]);
|
|
1236
|
-
|
|
1237
|
-
let x = vmin.x + (vmax.x - vmin.x) * 0.5,
|
|
1238
|
-
y = vmin.y + (vmax.y - vmin.y) * 0.5,
|
|
1239
|
-
z = vmin.z + (vmax.z - vmin.z) * 0.5;
|
|
1240
|
-
|
|
711
|
+
let x = vmin.x + (vmax.x - vmin.x) * 0.5, y = vmin.y + (vmax.y - vmin.y) * 0.5, z = vmin.z + (vmax.z - vmin.z) * 0.5;
|
|
1241
712
|
this.bsphere.center.set(x, y, z);
|
|
1242
713
|
this.bsphere.radius = this.bsphere.center.distance(new Vec3(vmin.x, vmin.y, vmin.z));
|
|
1243
714
|
}
|
|
1244
|
-
|
|
1245
|
-
public setBoundingVolumeArr(bounds: NumberArray6) {
|
|
715
|
+
setBoundingVolumeArr(bounds) {
|
|
1246
716
|
this.bbox.setFromBoundsArr(bounds);
|
|
1247
|
-
|
|
1248
|
-
let x = bounds[0] + (bounds[3] - bounds[0]) * 0.5,
|
|
1249
|
-
y = bounds[1] + (bounds[4] - bounds[1]) * 0.5,
|
|
1250
|
-
z = bounds[2] + (bounds[5] - bounds[2]) * 0.5;
|
|
1251
|
-
|
|
717
|
+
let x = bounds[0] + (bounds[3] - bounds[0]) * 0.5, y = bounds[1] + (bounds[4] - bounds[1]) * 0.5, z = bounds[2] + (bounds[5] - bounds[2]) * 0.5;
|
|
1252
718
|
this.bsphere.center.set(x, y, z);
|
|
1253
|
-
this.bsphere.radius = this.bsphere.center.distance(
|
|
1254
|
-
new Vec3(bounds[0], bounds[1], bounds[2])
|
|
1255
|
-
);
|
|
719
|
+
this.bsphere.radius = this.bsphere.center.distance(new Vec3(bounds[0], bounds[1], bounds[2]));
|
|
1256
720
|
}
|
|
1257
|
-
|
|
1258
|
-
public createCoordsBuffers(verticesHigh: Float32Array, verticesLow: Float32Array, gridSize: number) {
|
|
721
|
+
createCoordsBuffers(verticesHigh, verticesLow, gridSize) {
|
|
1259
722
|
const gsgs = (gridSize + 1) * (gridSize + 1);
|
|
1260
723
|
const h = this.handler;
|
|
1261
|
-
|
|
1262
724
|
if (this.vertexPositionBufferHigh && this.vertexPositionBufferHigh.numItems === gsgs) {
|
|
1263
|
-
h.setStreamArrayBuffer(this.vertexPositionBufferHigh
|
|
1264
|
-
h.setStreamArrayBuffer(this.vertexPositionBufferLow
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
h.gl
|
|
1268
|
-
|
|
725
|
+
h.setStreamArrayBuffer(this.vertexPositionBufferHigh, verticesHigh);
|
|
726
|
+
h.setStreamArrayBuffer(this.vertexPositionBufferLow, verticesLow);
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
h.gl.deleteBuffer(this.vertexPositionBufferHigh);
|
|
730
|
+
h.gl.deleteBuffer(this.vertexPositionBufferLow);
|
|
1269
731
|
this.vertexTextureCoordBuffer = this.planet._textureCoordsBufferCache[Math.log2(gridSize)];
|
|
1270
|
-
|
|
1271
732
|
// @todo use it!
|
|
1272
733
|
//this.vertexPositionBufferHigh = h.createStreamArrayBuffer(3, gsgs);
|
|
1273
734
|
//h.setStreamArrayBuffer(this.vertexPositionBufferHigh, verticesHigh);
|
|
1274
735
|
//this.vertexPositionBufferLow = h.createStreamArrayBuffer(3, gsgs);
|
|
1275
736
|
//h.setStreamArrayBuffer(this.vertexPositionBufferLow, verticesLow);
|
|
1276
|
-
|
|
1277
737
|
// It works, but I'm not sure that it is correct and better use the comment above
|
|
1278
738
|
this.vertexPositionBufferHigh = h.createArrayBuffer(verticesHigh, 3, gsgs);
|
|
1279
739
|
this.vertexPositionBufferLow = h.createArrayBuffer(verticesLow, 3, gsgs);
|
|
1280
740
|
}
|
|
1281
741
|
}
|
|
1282
|
-
|
|
1283
|
-
public _addViewExtent() {
|
|
742
|
+
_addViewExtent() {
|
|
1284
743
|
const ext = this._extentLonLat;
|
|
1285
|
-
|
|
1286
744
|
let viewExt = this.planet._viewExtent;
|
|
1287
|
-
|
|
1288
745
|
if (ext.southWest.lon < viewExt.southWest.lon) {
|
|
1289
746
|
viewExt.southWest.lon = ext.southWest.lon;
|
|
1290
747
|
}
|
|
1291
|
-
|
|
1292
748
|
if (ext.northEast.lon > viewExt.northEast.lon) {
|
|
1293
749
|
viewExt.northEast.lon = ext.northEast.lon;
|
|
1294
750
|
}
|
|
1295
|
-
|
|
1296
751
|
if (ext.southWest.lat < viewExt.southWest.lat) {
|
|
1297
752
|
viewExt.southWest.lat = ext.southWest.lat;
|
|
1298
753
|
}
|
|
1299
|
-
|
|
1300
754
|
if (ext.northEast.lat > viewExt.northEast.lat) {
|
|
1301
755
|
viewExt.northEast.lat = ext.northEast.lat;
|
|
1302
756
|
}
|
|
1303
757
|
}
|
|
1304
|
-
|
|
1305
|
-
protected _assignTileIndexes() {
|
|
1306
|
-
|
|
758
|
+
_assignTileIndexes() {
|
|
1307
759
|
this._tileGroup = TILEGROUP_COMMON;
|
|
1308
|
-
|
|
1309
760
|
const tileZoom = this.tileZoom;
|
|
1310
761
|
const extent = this._extent;
|
|
1311
762
|
const pole = mercator.POLE;
|
|
1312
|
-
|
|
1313
763
|
this.tileX = Math.round(Math.abs(-pole - extent.southWest.lon) / (extent.northEast.lon - extent.southWest.lon));
|
|
1314
764
|
this.tileY = Math.round(Math.abs(pole - extent.northEast.lat) / (extent.northEast.lat - extent.southWest.lat));
|
|
1315
|
-
|
|
1316
765
|
const p2 = Math.pow(2, tileZoom);
|
|
1317
|
-
|
|
1318
766
|
this.tileXE = (this.tileX + 1) % p2;
|
|
1319
767
|
this.tileXW = (p2 + this.tileX - 1) % p2;
|
|
1320
|
-
|
|
1321
768
|
this.tileYN = this.tileY - 1;
|
|
1322
769
|
this.tileYS = this.tileY + 1;
|
|
1323
|
-
|
|
1324
770
|
this.tileIndex = Layer.getTileIndex(this.tileX, this.tileY, tileZoom);
|
|
1325
771
|
}
|
|
1326
|
-
|
|
1327
|
-
public initialize() {
|
|
772
|
+
initialize() {
|
|
1328
773
|
const p = this.planet;
|
|
1329
774
|
const n = this.node;
|
|
1330
|
-
|
|
1331
|
-
this.gridSize = p.terrain!.gridSizeByZoom[this.tileZoom] || p.terrain!.plainGridSize;
|
|
1332
|
-
|
|
775
|
+
this.gridSize = p.terrain.gridSizeByZoom[this.tileZoom] || p.terrain.plainGridSize;
|
|
1333
776
|
n.sideSizeLog2[0] = n.sideSizeLog2[1] = n.sideSizeLog2[2] = n.sideSizeLog2[3] = Math.log2(this.gridSize);
|
|
1334
|
-
|
|
1335
|
-
if (this.tileZoom <= p.terrain!.maxZoom) {
|
|
777
|
+
if (this.tileZoom <= p.terrain.maxZoom) {
|
|
1336
778
|
const nmc = this.planet._normalMapCreator;
|
|
1337
|
-
this.normalMapTexturePtr = p.renderer
|
|
779
|
+
this.normalMapTexturePtr = p.renderer.handler.createEmptyTexture_l(nmc.width, nmc.height);
|
|
1338
780
|
}
|
|
1339
|
-
|
|
1340
781
|
this.normalMapTexture = this.planet.transparentTexture;
|
|
1341
|
-
|
|
1342
782
|
this._assignGlobalTextureCoordinates();
|
|
1343
|
-
|
|
1344
783
|
this.initialized = true;
|
|
1345
784
|
}
|
|
1346
|
-
|
|
1347
|
-
protected _assignGlobalTextureCoordinates() {
|
|
785
|
+
_assignGlobalTextureCoordinates() {
|
|
1348
786
|
const e = this._extent;
|
|
1349
787
|
this._globalTextureCoordinates[0] =
|
|
1350
788
|
(e.southWest.lon + mercator.POLE) * mercator.ONE_BY_POLE_DOUBLE;
|
|
@@ -1355,52 +793,41 @@ class Segment {
|
|
|
1355
793
|
this._globalTextureCoordinates[3] =
|
|
1356
794
|
(mercator.POLE - e.southWest.lat) * mercator.ONE_BY_POLE_DOUBLE;
|
|
1357
795
|
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
let p = this.planet,
|
|
1361
|
-
t = p.terrain!;
|
|
1362
|
-
|
|
796
|
+
createPlainSegmentAsync() {
|
|
797
|
+
let p = this.planet, t = p.terrain;
|
|
1363
798
|
if (t.isReady() && !this.plainReady && this.tileZoom <= t.maxZoom) {
|
|
1364
799
|
this.plainProcessing = true;
|
|
1365
800
|
p._plainSegmentWorker.make(this);
|
|
1366
801
|
}
|
|
1367
802
|
}
|
|
1368
|
-
|
|
1369
|
-
public _plainSegmentWorkerCallback(data: IPlainSegmentWorkerData) {
|
|
803
|
+
_plainSegmentWorkerCallback(data) {
|
|
1370
804
|
this.plainProcessing = false;
|
|
1371
|
-
|
|
1372
805
|
if (this.initialized && !this.terrainReady) {
|
|
1373
806
|
this.plainReady = true;
|
|
1374
|
-
|
|
1375
807
|
this.plainVertices = data.plainVertices;
|
|
1376
808
|
this.plainVerticesHigh = data.plainVerticesHigh;
|
|
1377
809
|
this.plainVerticesLow = data.plainVerticesLow;
|
|
1378
810
|
this.plainNormals = data.plainNormals;
|
|
1379
811
|
this._plainRadius = data.plainRadius;
|
|
1380
|
-
|
|
1381
812
|
this.normalMapNormals = data.normalMapNormals;
|
|
1382
813
|
this.normalMapVertices = data.normalMapVertices;
|
|
1383
814
|
this.normalMapVerticesHigh = data.normalMapVerticesHigh;
|
|
1384
815
|
this.normalMapVerticesLow = data.normalMapVerticesLow;
|
|
1385
|
-
|
|
1386
816
|
//this.terrainVertices = this.plainVertices;
|
|
1387
817
|
//this.terrainVerticesHigh = this.plainVerticesHigh;
|
|
1388
818
|
//this.terrainVerticesLow = this.plainVerticesLow;
|
|
1389
|
-
|
|
1390
|
-
this.fileGridSize = Math.sqrt(data.normalMapVertices!.length / 3) - 1;
|
|
819
|
+
this.fileGridSize = Math.sqrt(data.normalMapVertices.length / 3) - 1;
|
|
1391
820
|
}
|
|
1392
821
|
}
|
|
1393
|
-
|
|
1394
|
-
public createPlainSegment() {
|
|
822
|
+
createPlainSegment() {
|
|
1395
823
|
this.initialize();
|
|
1396
824
|
this._createPlainVertices();
|
|
1397
825
|
this.readyToEngage = true;
|
|
1398
826
|
}
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
const gridSize = this.planet.terrain!.gridSizeByZoom[this.tileZoom];
|
|
827
|
+
_createPlainVertices() {
|
|
828
|
+
const gridSize = this.planet.terrain.gridSizeByZoom[this.tileZoom];
|
|
1402
829
|
const e = this._extent;
|
|
1403
|
-
const fgs = this.planet.terrain
|
|
830
|
+
const fgs = this.planet.terrain.plainGridSize;
|
|
1404
831
|
const lonSize = e.getWidth();
|
|
1405
832
|
const llStep = lonSize / Math.max(fgs, gridSize);
|
|
1406
833
|
const esw_lon = e.southWest.lon;
|
|
@@ -1410,99 +837,64 @@ class Segment {
|
|
|
1410
837
|
const r2 = this.planet.ellipsoid._invRadii2;
|
|
1411
838
|
const gsgs = gs * gs;
|
|
1412
839
|
const gridSize3 = (gridSize + 1) * (gridSize + 1) * 3;
|
|
1413
|
-
|
|
1414
|
-
let ind = 0,
|
|
1415
|
-
nmInd = 0;
|
|
1416
|
-
|
|
840
|
+
let ind = 0, nmInd = 0;
|
|
1417
841
|
this.plainNormals = new Float32Array(gridSize3);
|
|
1418
842
|
this.plainVertices = new Float64Array(gridSize3);
|
|
1419
843
|
this.plainVerticesHigh = new Float32Array(gridSize3);
|
|
1420
844
|
this.plainVerticesLow = new Float32Array(gridSize3);
|
|
1421
|
-
|
|
1422
845
|
this.normalMapNormals = new Float32Array(gsgs * 3);
|
|
1423
846
|
this.normalMapVertices = new Float64Array(gsgs * 3);
|
|
1424
847
|
this.normalMapVerticesHigh = new Float32Array(gsgs * 3);
|
|
1425
848
|
this.normalMapVerticesLow = new Float32Array(gsgs * 3);
|
|
1426
|
-
|
|
1427
|
-
let verts = this.plainVertices,
|
|
1428
|
-
vertsHigh = this.plainVerticesHigh,
|
|
1429
|
-
vertsLow = this.plainVerticesLow,
|
|
1430
|
-
norms = this.plainNormals,
|
|
1431
|
-
nmVerts = this.normalMapVertices,
|
|
1432
|
-
nmVertsHigh = this.normalMapVerticesHigh,
|
|
1433
|
-
nmVertsLow = this.normalMapVerticesLow,
|
|
1434
|
-
nmNorms = this.normalMapNormals;
|
|
1435
|
-
|
|
849
|
+
let verts = this.plainVertices, vertsHigh = this.plainVerticesHigh, vertsLow = this.plainVerticesLow, norms = this.plainNormals, nmVerts = this.normalMapVertices, nmVertsHigh = this.normalMapVerticesHigh, nmVertsLow = this.normalMapVerticesLow, nmNorms = this.normalMapNormals;
|
|
1436
850
|
for (let k = 0; k < gsgs; k++) {
|
|
1437
|
-
let j = k % gs,
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
let v = this.planet.ellipsoid.lonLatToCartesian(
|
|
1441
|
-
LonLat.inverseMercator(esw_lon + j * llStep, ene_lat - i * llStep)
|
|
1442
|
-
);
|
|
1443
|
-
|
|
1444
|
-
let nx = v.x * r2.x,
|
|
1445
|
-
ny = v.y * r2.y,
|
|
1446
|
-
nz = v.z * r2.z;
|
|
1447
|
-
|
|
851
|
+
let j = k % gs, i = ~~(k / gs);
|
|
852
|
+
let v = this.planet.ellipsoid.lonLatToCartesian(LonLat.inverseMercator(esw_lon + j * llStep, ene_lat - i * llStep));
|
|
853
|
+
let nx = v.x * r2.x, ny = v.y * r2.y, nz = v.z * r2.z;
|
|
1448
854
|
let l = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
1449
|
-
|
|
1450
|
-
let nxl = nx * l,
|
|
1451
|
-
nyl = ny * l,
|
|
1452
|
-
nzl = nz * l;
|
|
1453
|
-
|
|
855
|
+
let nxl = nx * l, nyl = ny * l, nzl = nz * l;
|
|
1454
856
|
Vec3.doubleToTwoFloats(v, _tempHigh, _tempLow);
|
|
1455
|
-
|
|
1456
857
|
nmVerts[nmInd] = v.x;
|
|
1457
858
|
nmVertsHigh[nmInd] = _tempHigh.x;
|
|
1458
859
|
nmVertsLow[nmInd] = _tempLow.x;
|
|
1459
860
|
nmNorms[nmInd++] = nxl;
|
|
1460
|
-
|
|
1461
861
|
nmVerts[nmInd] = v.y;
|
|
1462
862
|
nmVertsHigh[nmInd] = _tempHigh.y;
|
|
1463
863
|
nmVertsLow[nmInd] = _tempLow.y;
|
|
1464
864
|
nmNorms[nmInd++] = nyl;
|
|
1465
|
-
|
|
1466
865
|
nmVerts[nmInd] = v.z;
|
|
1467
866
|
nmVertsHigh[nmInd] = _tempHigh.z;
|
|
1468
867
|
nmVertsLow[nmInd] = _tempLow.z;
|
|
1469
868
|
nmNorms[nmInd++] = nzl;
|
|
1470
|
-
|
|
1471
869
|
if (i % dg === 0 && j % dg === 0) {
|
|
1472
870
|
verts[ind] = v.x;
|
|
1473
871
|
vertsHigh[ind] = _tempHigh.x;
|
|
1474
872
|
vertsLow[ind] = _tempLow.x;
|
|
1475
873
|
norms[ind++] = nxl;
|
|
1476
|
-
|
|
1477
874
|
verts[ind] = v.y;
|
|
1478
875
|
vertsHigh[ind] = _tempHigh.y;
|
|
1479
876
|
vertsLow[ind] = _tempLow.y;
|
|
1480
877
|
norms[ind++] = nyl;
|
|
1481
|
-
|
|
1482
878
|
verts[ind] = v.z;
|
|
1483
879
|
vertsHigh[ind] = _tempHigh.z;
|
|
1484
880
|
vertsLow[ind] = _tempLow.z;
|
|
1485
881
|
norms[ind++] = nzl;
|
|
1486
882
|
}
|
|
1487
883
|
}
|
|
1488
|
-
|
|
1489
884
|
this.terrainVertices = verts;
|
|
1490
885
|
this.terrainVerticesHigh = vertsHigh;
|
|
1491
886
|
this.terrainVerticesLow = vertsLow;
|
|
1492
|
-
|
|
1493
887
|
this.plainReady = true;
|
|
1494
888
|
}
|
|
1495
|
-
|
|
1496
889
|
/**
|
|
1497
890
|
* Gets specific layer material.
|
|
1498
891
|
* @public
|
|
1499
892
|
* @param {Layer} layer - Layer object.
|
|
1500
893
|
* @returns {Material | undefined} - Segment material.
|
|
1501
894
|
*/
|
|
1502
|
-
|
|
895
|
+
getMaterialByLayer(layer) {
|
|
1503
896
|
return this.materials[layer.__id];
|
|
1504
897
|
}
|
|
1505
|
-
|
|
1506
898
|
/**
|
|
1507
899
|
* @param layer
|
|
1508
900
|
* @protected
|
|
@@ -1510,8 +902,7 @@ class Segment {
|
|
|
1510
902
|
* @todo siplify layer._extentMerc in this.getLayerExtent(layer)
|
|
1511
903
|
*
|
|
1512
904
|
*/
|
|
1513
|
-
|
|
1514
|
-
protected _getLayerExtentOffset(layer: Layer): [number, number, number, number] {
|
|
905
|
+
_getLayerExtentOffset(layer) {
|
|
1515
906
|
const v0s = layer._extentMerc;
|
|
1516
907
|
const v0t = this._extent;
|
|
1517
908
|
const sSize_x = v0s.northEast.lon - v0s.southWest.lon;
|
|
@@ -1522,292 +913,230 @@ class Segment {
|
|
|
1522
913
|
const dSize_y = (v0t.northEast.lat - v0t.southWest.lat) / sSize_y;
|
|
1523
914
|
return [dV0s_x, dV0s_y, dSize_x, dSize_y];
|
|
1524
915
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
const gl = this.handler.gl!;
|
|
916
|
+
screenRendering(sh, layerSlice, sliceIndex, defaultTexture, isOverlay = false) {
|
|
917
|
+
const gl = this.handler.gl;
|
|
1528
918
|
const sha = sh.attributes;
|
|
1529
919
|
const shu = sh.uniforms;
|
|
1530
|
-
|
|
1531
920
|
const pm = this.materials;
|
|
1532
921
|
const p = this.planet;
|
|
1533
|
-
|
|
1534
922
|
let currHeight, li;
|
|
1535
923
|
if (layerSlice && layerSlice.length) {
|
|
1536
924
|
li = layerSlice[0];
|
|
1537
925
|
currHeight = li._height;
|
|
1538
|
-
}
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
1539
928
|
currHeight = 0;
|
|
1540
929
|
}
|
|
1541
|
-
|
|
1542
930
|
// First always draw whole planet base layer segment with solid texture.
|
|
1543
931
|
gl.activeTexture(gl.TEXTURE0 + p.SLICE_SIZE + 2);
|
|
1544
|
-
gl.bindTexture(gl.TEXTURE_2D, (defaultTexture || this.getDefaultTexture())
|
|
932
|
+
gl.bindTexture(gl.TEXTURE_2D, (defaultTexture || this.getDefaultTexture()));
|
|
1545
933
|
gl.uniform1i(shu.defaultTexture, p.SLICE_SIZE + 2);
|
|
1546
|
-
|
|
1547
|
-
let n = 0,
|
|
1548
|
-
i = 0;
|
|
1549
|
-
|
|
934
|
+
let n = 0, i = 0;
|
|
1550
935
|
let notEmpty = false;
|
|
1551
|
-
|
|
1552
936
|
let slice = this._slices[sliceIndex];
|
|
1553
|
-
|
|
1554
937
|
if (!slice) {
|
|
1555
938
|
slice = this._slices[sliceIndex] = new Slice(this);
|
|
1556
|
-
}
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
1557
941
|
//TODO: optimization!!!
|
|
1558
942
|
slice.layers = [];
|
|
1559
943
|
}
|
|
1560
|
-
|
|
1561
944
|
this._indexBuffer = this._getIndexBuffer();
|
|
1562
|
-
|
|
1563
945
|
while (li) {
|
|
1564
|
-
if (
|
|
1565
|
-
this.layerOverlap(li) &&
|
|
946
|
+
if (this.layerOverlap(li) &&
|
|
1566
947
|
((li._fading && li._fadingOpacity > 0.0) ||
|
|
1567
948
|
((li.minZoom >= p.minCurrZoom || li.maxZoom >= p.minCurrZoom) &&
|
|
1568
|
-
(li.minZoom <= p.maxCurrZoom || li.maxZoom <= p.maxCurrZoom)))
|
|
1569
|
-
) {
|
|
949
|
+
(li.minZoom <= p.maxCurrZoom || li.maxZoom <= p.maxCurrZoom)))) {
|
|
1570
950
|
notEmpty = true;
|
|
1571
|
-
|
|
1572
951
|
let m = pm[li.__id];
|
|
1573
|
-
|
|
1574
952
|
if (!m) {
|
|
1575
953
|
m = pm[li.__id] = li.createMaterial(this);
|
|
1576
954
|
}
|
|
1577
|
-
|
|
1578
955
|
if (!m.isReady) {
|
|
1579
956
|
this.planet._renderCompleted = false;
|
|
1580
957
|
}
|
|
1581
|
-
|
|
1582
958
|
slice.append(li, m);
|
|
1583
|
-
|
|
1584
959
|
p._samplerArr[n] = n;
|
|
1585
|
-
|
|
1586
960
|
gl.activeTexture(gl.TEXTURE0 + n);
|
|
1587
|
-
gl.bindTexture(gl.TEXTURE_2D, (m.texture || p.transparentTexture)
|
|
1588
|
-
|
|
961
|
+
gl.bindTexture(gl.TEXTURE_2D, (m.texture || p.transparentTexture));
|
|
1589
962
|
n++;
|
|
1590
963
|
}
|
|
1591
964
|
i++;
|
|
1592
965
|
li = layerSlice[i];
|
|
1593
966
|
}
|
|
1594
|
-
|
|
1595
967
|
if (notEmpty || !isOverlay) {
|
|
1596
968
|
gl.uniform1i(shu.samplerCount, n);
|
|
1597
969
|
gl.uniform1f(shu.height, currHeight);
|
|
1598
970
|
gl.uniform1iv(shu.samplerArr, p._samplerArr);
|
|
1599
|
-
|
|
1600
971
|
//slice.uniform(gl, shu);
|
|
1601
|
-
|
|
1602
972
|
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1603
973
|
gl.uniform1fv(shu.layerOpacityArr, slice.layerOpacityArr);
|
|
1604
974
|
//gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1605
|
-
|
|
1606
975
|
// bind normalmap texture
|
|
1607
976
|
if (p.lightEnabled) {
|
|
1608
977
|
gl.activeTexture(gl.TEXTURE0 + p.SLICE_SIZE + 3);
|
|
1609
|
-
gl.bindTexture(gl.TEXTURE_2D, (this.normalMapTexture || p.transparentTexture)
|
|
978
|
+
gl.bindTexture(gl.TEXTURE_2D, (this.normalMapTexture || p.transparentTexture));
|
|
1610
979
|
gl.uniform1i(shu.uNormalMap, p.SLICE_SIZE + 3);
|
|
1611
|
-
|
|
1612
980
|
gl.uniform3fv(shu.uNormalMapBias, this.normalMapTextureBias);
|
|
1613
|
-
|
|
1614
981
|
// bind segment specular and night material texture coordinates
|
|
1615
982
|
gl.uniform4fv(shu.uGlobalTextureCoord, this._globalTextureCoordinates);
|
|
1616
983
|
}
|
|
1617
|
-
|
|
1618
|
-
gl.
|
|
1619
|
-
gl.
|
|
1620
|
-
gl.
|
|
1621
|
-
gl.
|
|
1622
|
-
|
|
1623
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer!);
|
|
984
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
985
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
986
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
987
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
988
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer);
|
|
1624
989
|
gl.vertexAttribPointer(sha.aTextureCoord, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
1625
|
-
|
|
1626
990
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
1627
991
|
gl.drawElements(p.drawMode, this._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
1628
992
|
}
|
|
1629
993
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
const gl = this.handler.gl!;
|
|
994
|
+
heightPickingRendering(sh, layerSlice) {
|
|
995
|
+
const gl = this.handler.gl;
|
|
1633
996
|
const sha = sh.attributes;
|
|
1634
997
|
const shu = sh.uniforms;
|
|
1635
|
-
|
|
1636
998
|
// var pm = this.materials,
|
|
1637
999
|
// p = this.planet;
|
|
1638
|
-
|
|
1639
1000
|
let currHeight;
|
|
1640
1001
|
if (layerSlice && layerSlice.length) {
|
|
1641
1002
|
currHeight = layerSlice[0]._height;
|
|
1642
|
-
}
|
|
1003
|
+
}
|
|
1004
|
+
else {
|
|
1643
1005
|
currHeight = 0;
|
|
1644
1006
|
}
|
|
1645
|
-
|
|
1646
1007
|
gl.uniform1f(shu.height, currHeight);
|
|
1647
|
-
|
|
1648
|
-
gl.
|
|
1649
|
-
gl.
|
|
1650
|
-
|
|
1651
|
-
gl.bindBuffer(gl.
|
|
1652
|
-
gl.
|
|
1653
|
-
|
|
1654
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer!);
|
|
1655
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
1008
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1009
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1010
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1011
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1012
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
1013
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
1656
1014
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
const gl = this.handler.gl!;
|
|
1015
|
+
colorPickingRendering(sh, layerSlice, sliceIndex, defaultTexture, isOverlay = false) {
|
|
1016
|
+
const gl = this.handler.gl;
|
|
1660
1017
|
const sha = sh.attributes;
|
|
1661
1018
|
const shu = sh.uniforms;
|
|
1662
|
-
|
|
1663
|
-
let pm = this.materials,
|
|
1664
|
-
p = this.planet;
|
|
1665
|
-
|
|
1019
|
+
let pm = this.materials, p = this.planet;
|
|
1666
1020
|
let currHeight;
|
|
1667
1021
|
if (layerSlice && layerSlice.length) {
|
|
1668
1022
|
currHeight = layerSlice[0]._height;
|
|
1669
|
-
}
|
|
1023
|
+
}
|
|
1024
|
+
else {
|
|
1670
1025
|
currHeight = 0;
|
|
1671
1026
|
}
|
|
1672
|
-
|
|
1673
1027
|
let notEmpty = false;
|
|
1674
|
-
|
|
1675
1028
|
let slice = this._slices[sliceIndex];
|
|
1676
|
-
|
|
1677
1029
|
let len = slice.layers.length;
|
|
1678
|
-
|
|
1679
1030
|
for (let n = 0; n < len; n++) {
|
|
1680
1031
|
notEmpty = true;
|
|
1681
|
-
|
|
1682
1032
|
let li = slice.layers[n];
|
|
1683
1033
|
let n4 = n * 4;
|
|
1684
|
-
|
|
1685
1034
|
p._pickingColorArr[n4] = li._pickingColor.x / 255.0;
|
|
1686
1035
|
p._pickingColorArr[n4 + 1] = li._pickingColor.y / 255.0;
|
|
1687
1036
|
p._pickingColorArr[n4 + 2] = li._pickingColor.z / 255.0;
|
|
1688
1037
|
p._pickingColorArr[n4 + 3] = Number(li._pickingEnabled);
|
|
1689
|
-
|
|
1690
1038
|
p._samplerArr[n] = n;
|
|
1691
1039
|
gl.activeTexture(gl.TEXTURE0 + n);
|
|
1692
|
-
gl.bindTexture(gl.TEXTURE_2D, (pm[li.__id].texture || this.planet.transparentTexture)
|
|
1693
|
-
|
|
1040
|
+
gl.bindTexture(gl.TEXTURE_2D, (pm[li.__id].texture || this.planet.transparentTexture));
|
|
1694
1041
|
p._pickingMaskArr[n] = n + p.SLICE_SIZE;
|
|
1695
1042
|
gl.activeTexture(gl.TEXTURE0 + n + p.SLICE_SIZE);
|
|
1696
|
-
gl.bindTexture(gl.TEXTURE_2D, (pm[li.__id].pickingMask || this.planet.transparentTexture)
|
|
1043
|
+
gl.bindTexture(gl.TEXTURE_2D, (pm[li.__id].pickingMask || this.planet.transparentTexture));
|
|
1697
1044
|
}
|
|
1698
|
-
|
|
1699
1045
|
if (notEmpty || !isOverlay) {
|
|
1700
1046
|
gl.uniform1i(shu.samplerCount, len);
|
|
1701
1047
|
gl.uniform1f(shu.height, currHeight);
|
|
1702
1048
|
gl.uniform1iv(shu.samplerArr, p._samplerArr);
|
|
1703
1049
|
gl.uniform1iv(shu.pickingMaskArr, p._pickingMaskArr);
|
|
1704
1050
|
gl.uniform4fv(shu.pickingColorArr, p._pickingColorArr);
|
|
1705
|
-
|
|
1706
1051
|
//slice.uniform(gl, shu);
|
|
1707
|
-
|
|
1708
1052
|
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1709
1053
|
gl.uniform1fv(shu.layerOpacityArr, slice.layerOpacityArr);
|
|
1710
1054
|
//gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1711
|
-
|
|
1712
|
-
gl.
|
|
1713
|
-
gl.
|
|
1714
|
-
gl.
|
|
1715
|
-
gl.
|
|
1716
|
-
|
|
1717
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer!);
|
|
1055
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1056
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1057
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1058
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1059
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer);
|
|
1718
1060
|
gl.vertexAttribPointer(sha.aTextureCoord, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
1719
|
-
|
|
1720
|
-
gl.
|
|
1721
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
1061
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
1062
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
1722
1063
|
}
|
|
1723
1064
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
const gl = this.handler.gl!;
|
|
1065
|
+
depthRendering(sh, layerSlice) {
|
|
1066
|
+
const gl = this.handler.gl;
|
|
1727
1067
|
const sha = sh.attributes;
|
|
1728
1068
|
const shu = sh.uniforms;
|
|
1729
|
-
|
|
1730
1069
|
var currHeight;
|
|
1731
1070
|
if (layerSlice && layerSlice.length) {
|
|
1732
1071
|
currHeight = layerSlice[0]._height;
|
|
1733
|
-
}
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1734
1074
|
currHeight = 0;
|
|
1735
1075
|
}
|
|
1736
|
-
|
|
1737
1076
|
gl.uniform1f(shu.height, currHeight);
|
|
1738
|
-
|
|
1739
|
-
gl.
|
|
1740
|
-
gl.
|
|
1741
|
-
|
|
1742
|
-
gl.bindBuffer(gl.
|
|
1743
|
-
gl.
|
|
1744
|
-
|
|
1745
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer!);
|
|
1746
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
1077
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1078
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1079
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1080
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1081
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
1082
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
1747
1083
|
}
|
|
1748
|
-
|
|
1749
|
-
protected _getIndexBuffer(): WebGLBufferExt {
|
|
1084
|
+
_getIndexBuffer() {
|
|
1750
1085
|
const s = this.node.sideSizeLog2;
|
|
1751
1086
|
let cache = this.planet._indexesCache[Math.log2(this.gridSize)][s[0]][s[1]][s[2]][s[3]];
|
|
1752
1087
|
if (!cache.buffer) {
|
|
1753
1088
|
let indexes = segmentHelper.getInstance().createSegmentIndexes(Math.log2(this.gridSize), [s[0], s[1], s[2], s[3]]);
|
|
1754
|
-
cache.buffer = this.planet.renderer
|
|
1089
|
+
cache.buffer = this.planet.renderer.handler.createElementArrayBuffer(indexes, 1);
|
|
1755
1090
|
this.planet._indexesCacheToRemoveCounter++;
|
|
1756
1091
|
}
|
|
1757
1092
|
return cache.buffer;
|
|
1758
1093
|
}
|
|
1759
|
-
|
|
1760
1094
|
/**
|
|
1761
1095
|
* @todo: replace to the strategy
|
|
1762
1096
|
*/
|
|
1763
|
-
|
|
1097
|
+
_collectVisibleNodes() {
|
|
1764
1098
|
this.planet._visibleNodes[this.node.nodeId] = this.node;
|
|
1765
1099
|
}
|
|
1766
|
-
|
|
1767
|
-
public layerOverlap(layer: Layer): boolean {
|
|
1100
|
+
layerOverlap(layer) {
|
|
1768
1101
|
return this._extent.overlaps(layer._extentMerc);
|
|
1769
1102
|
}
|
|
1770
|
-
|
|
1771
|
-
public getDefaultTexture(): WebGLTextureExt | null {
|
|
1103
|
+
getDefaultTexture() {
|
|
1772
1104
|
return this.planet.solidTextureOne;
|
|
1773
1105
|
}
|
|
1774
|
-
|
|
1775
|
-
public getExtentLonLat(): Extent {
|
|
1106
|
+
getExtentLonLat() {
|
|
1776
1107
|
return this._extentLonLat;
|
|
1777
1108
|
}
|
|
1778
|
-
|
|
1779
|
-
public getExtentMerc(): Extent {
|
|
1109
|
+
getExtentMerc() {
|
|
1780
1110
|
return this._extentMerc;
|
|
1781
1111
|
}
|
|
1782
|
-
|
|
1783
|
-
public getExtent(): Extent {
|
|
1112
|
+
getExtent() {
|
|
1784
1113
|
return this._extent;
|
|
1785
1114
|
}
|
|
1786
|
-
|
|
1787
1115
|
/**
|
|
1788
1116
|
* @todo replace to the strategy
|
|
1789
1117
|
*/
|
|
1790
|
-
|
|
1118
|
+
getNodeState() {
|
|
1791
1119
|
let vn = this.planet._visibleNodes[this.node.nodeId];
|
|
1792
1120
|
return (vn && vn.state) || NOTRENDERING;
|
|
1793
1121
|
}
|
|
1794
|
-
|
|
1795
|
-
public getNeighborSide(b: Segment) {
|
|
1122
|
+
getNeighborSide(b) {
|
|
1796
1123
|
if (this.tileY === b.tileY) {
|
|
1797
1124
|
if (this.tileX === b.tileXE) {
|
|
1798
1125
|
return W;
|
|
1799
|
-
}
|
|
1126
|
+
}
|
|
1127
|
+
else if (this.tileX === b.tileXW) {
|
|
1800
1128
|
return E;
|
|
1801
1129
|
}
|
|
1802
|
-
}
|
|
1130
|
+
}
|
|
1131
|
+
else if (this.tileX === b.tileX) {
|
|
1803
1132
|
if (this.tileY === b.tileYS) {
|
|
1804
1133
|
return N;
|
|
1805
|
-
}
|
|
1134
|
+
}
|
|
1135
|
+
else if (this.tileY === b.tileYN) {
|
|
1806
1136
|
return S;
|
|
1807
1137
|
}
|
|
1808
1138
|
}
|
|
1809
1139
|
return -1;
|
|
1810
1140
|
}
|
|
1811
1141
|
}
|
|
1812
|
-
|
|
1813
|
-
export {Segment};
|
|
1142
|
+
export { Segment };
|