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