@openglobus/og 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -46
- package/dist/@openglobus/og.esm.js +1 -20
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +1 -20
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/dist/@openglobus/res/fonts/Karla-Bold.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Bold.ttf.cfg +920 -0
- package/dist/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Karla-Light.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Light.ttf.cfg +830 -0
- package/dist/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.ttf.cfg +1196 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.json +3332 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +1370 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.json +37147 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +1340 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/arial.json +4321 -0
- package/dist/@openglobus/res/fonts/arial.ttf.cfg +1570 -0
- package/dist/@openglobus/res/fonts/arial.ttf.png +0 -0
- package/dist/@openglobus/res/night-4326.png +0 -0
- package/dist/@openglobus/res/night.png +0 -0
- package/dist/@openglobus/res/spec.png +0 -0
- package/package.json +25 -23
- package/src/{og/Clock.js → Clock.ts} +100 -78
- package/src/Deferred.ts +17 -0
- package/src/Events.ts +200 -0
- package/src/{og/Extent.js → Extent.ts} +324 -352
- package/src/Globe.ts +363 -0
- package/src/{og/ImageCanvas.js → ImageCanvas.ts} +244 -236
- package/src/Lock.ts +41 -0
- package/src/{og/LonLat.js → LonLat.ts} +50 -47
- package/src/{og/Object3d.js → Object3d.ts} +89 -55
- package/src/Popup.ts +228 -0
- package/src/{og/QueueArray.js → QueueArray.ts} +76 -75
- package/src/{og/Rectangle.js → Rectangle.ts} +115 -111
- package/src/Stack.ts +58 -0
- package/src/{og/astro/astro.js → astro/astro.ts} +49 -51
- package/src/{og/astro/earth.js → astro/earth.ts} +8 -9
- package/src/{og/astro/jd.js → astro/jd.ts} +92 -111
- package/src/{og/astro/orbit.js → astro/orbit.ts} +35 -37
- package/src/{og/astro/rotation.js → astro/rotation.ts} +4 -6
- package/src/{og/bv/Box.js → bv/Box.ts} +21 -17
- package/src/{og/bv/Sphere.js → bv/Sphere.ts} +21 -19
- package/src/bv/index.ts +4 -0
- package/src/{og/camera/Camera.js → camera/Camera.ts} +254 -197
- package/src/{og/camera/Frustum.js → camera/Frustum.ts} +137 -111
- package/src/{og/camera/PlanetCamera.js → camera/PlanetCamera.ts} +248 -185
- package/src/camera/index.ts +4 -0
- package/src/{og/cons.js → cons.ts} +14 -18
- package/src/{og/control/Atmosphere.js → control/Atmosphere.ts} +50 -50
- package/src/{og/control/CompassButton.js → control/CompassButton.ts} +27 -30
- package/src/{og/control/Control.js → control/Control.ts} +76 -70
- package/src/{og/control/DebugInfo.js → control/DebugInfo.ts} +130 -62
- package/src/{og/control/DrawingSwitcher.js → control/DrawingSwitcher.ts} +16 -22
- package/src/control/EarthCoordinates.ts +222 -0
- package/src/control/EarthNavigation.ts +293 -0
- package/src/{og/control/GeoImageDragControl.js → control/GeoImageDragControl.ts} +37 -29
- package/src/control/KeyboardNavigation.ts +168 -0
- package/src/{og/control/LayerAnimation.js → control/LayerAnimation.ts} +74 -90
- package/src/control/LayerSwitcher.ts +76 -0
- package/src/{og/control/Lighting.js → control/Lighting.ts} +158 -120
- package/src/control/MouseNavigation.ts +468 -0
- package/src/control/MouseWheelZoomControl.ts +269 -0
- package/src/{og/control/RulerSwitcher.js → control/RulerSwitcher.ts} +18 -20
- package/src/control/ScaleControl.ts +131 -0
- package/src/control/SegmentBoundVisualization.ts +50 -0
- package/src/control/ShowFps.ts +28 -0
- package/src/control/SimpleNavigation.ts +118 -0
- package/src/{og/control/SimpleSkyBackground.js → control/SimpleSkyBackground.ts} +36 -38
- package/src/{og/control/Sun.js → control/Sun.ts} +56 -64
- package/src/control/ToggleWireframe.ts +35 -0
- package/src/control/TouchNavigation.ts +368 -0
- package/src/control/ZoomControl.ts +111 -0
- package/src/control/drawing/DrawingControl.ts +45 -0
- package/src/{og/control/drawing/LineStringDrawingScene.js → control/drawing/LineStringDrawingScene.ts} +28 -35
- package/src/{og/control/drawing/PolygonDrawingScene.js → control/drawing/PolygonDrawingScene.ts} +148 -201
- package/src/{og/control/elevationProfile/ElevationProfile.js → control/elevationProfile/ElevationProfile.ts} +70 -36
- package/src/control/heightRuler/HeightRuler.ts +16 -0
- package/src/{og/control/heightRuler/HeightRulerScene.js → control/heightRuler/HeightRulerScene.ts} +92 -87
- package/src/{og/control/heightRuler/HeightRulerSwitcher.js → control/heightRuler/HeightRulerSwitcher.ts} +3 -3
- package/src/control/index.ts +45 -0
- package/src/control/ruler/Ruler.ts +35 -0
- package/src/{og/control/ruler/RulerScene.js → control/ruler/RulerScene.ts} +163 -121
- package/src/{og/control/selection/Selection.js → control/selection/Selection.ts} +23 -21
- package/src/{og/control/selection/SelectionScene.js → control/selection/SelectionScene.ts} +64 -50
- package/src/{og/control/timeline/TimelineControl.js → control/timeline/TimelineControl.ts} +37 -28
- package/src/{og/control/timeline/TimelineModel.js → control/timeline/TimelineModel.ts} +50 -35
- package/src/{og/control/timeline/TimelineView.js → control/timeline/TimelineView.ts} +162 -113
- package/src/{og/control/timeline/timelineUtils.js → control/timeline/timelineUtils.ts} +11 -10
- package/src/{og/control → control}/visibleExtent/Segment.js +5 -5
- package/src/{og/control → control}/visibleExtent/VisibleExtent.js +8 -15
- package/src/{og/control/visibleExtent/drawnode.js → control/visibleExtent/drawnode.ts} +1 -3
- package/src/{og/ellipsoid/Ellipsoid.js → ellipsoid/Ellipsoid.ts} +113 -59
- package/src/ellipsoid/index.ts +4 -0
- package/src/{og/ellipsoid/wgs84.js → ellipsoid/wgs84.ts} +1 -3
- package/src/{og/entity/BaseBillboard.js → entity/BaseBillboard.ts} +128 -102
- package/src/entity/BaseBillboardHandler.ts +772 -0
- package/src/{og/entity/Billboard.js → entity/Billboard.ts} +77 -47
- package/src/entity/BillboardHandler.ts +135 -0
- package/src/{og/entity/Entity.js → entity/Entity.ts} +285 -226
- package/src/{og/entity/EntityCollection.js → entity/EntityCollection.ts} +340 -247
- package/src/{og/entity/GeoObject.js → entity/GeoObject.ts} +122 -67
- package/src/{og/entity/GeoObjectHandler.js → entity/GeoObjectHandler.ts} +273 -198
- package/src/entity/Geometry.ts +486 -0
- package/src/{og/entity/GeometryHandler.js → entity/GeometryHandler.ts} +383 -541
- package/src/{og/entity/Label.js → entity/Label.ts} +131 -83
- package/src/{og/entity/LabelHandler.js → entity/LabelHandler.ts} +289 -255
- package/src/{og/entity/LabelWorker.js → entity/LabelWorker.ts} +26 -36
- package/src/{og/entity/PointCloud.js → entity/PointCloud.ts} +200 -164
- package/src/entity/PointCloudHandler.ts +125 -0
- package/src/{og/entity/Polyline.js → entity/Polyline.ts} +517 -539
- package/src/{og/entity/PolylineHandler.js → entity/PolylineHandler.ts} +29 -31
- package/src/{og/entity/Ray.js → entity/Ray.ts} +89 -60
- package/src/{og/entity/RayHandler.js → entity/RayHandler.ts} +201 -306
- package/src/{og/entity/Strip.js → entity/Strip.ts} +143 -100
- package/src/{og/entity/StripHandler.js → entity/StripHandler.ts} +76 -72
- package/src/entity/index.ts +12 -0
- package/src/index.ts +173 -0
- package/src/input/KeyboardHandler.ts +196 -0
- package/src/{og/input/MouseHandler.js → input/MouseHandler.ts} +46 -35
- package/src/input/TouchHandler.ts +54 -0
- package/src/{og/input/input.js → input/input.ts} +1 -3
- package/src/{og/layer/BaseGeoImage.js → layer/BaseGeoImage.ts} +174 -107
- package/src/{og/layer/CanvasTiles.js → layer/CanvasTiles.ts} +139 -105
- package/src/{og/layer/GeoImage.js → layer/GeoImage.ts} +62 -52
- package/src/layer/GeoTexture2d.ts +56 -0
- package/src/{og/layer/GeoVideo.js → layer/GeoVideo.ts} +53 -53
- package/src/{og/layer/KML.js → layer/KML.ts} +63 -74
- package/src/{og/layer/Layer.js → layer/Layer.ts} +399 -223
- package/src/{og/layer/Material.js → layer/Material.ts} +40 -35
- package/src/{og/layer/Vector.js → layer/Vector.ts} +319 -267
- package/src/{og/layer/WMS.js → layer/WMS.ts} +76 -64
- package/src/{og/layer/XYZ.js → layer/XYZ.ts} +123 -98
- package/src/layer/index.ts +12 -0
- package/src/{og/light/LightSource.js → light/LightSource.ts} +132 -93
- package/src/{og/math/Line2.js → math/Line2.ts} +11 -8
- package/src/{og/math/Line3.js → math/Line3.ts} +49 -27
- package/src/{og/math/Mat3.js → math/Mat3.ts} +43 -27
- package/src/{og/math/Mat4.js → math/Mat4.ts} +110 -77
- package/src/{og/math/Plane.js → math/Plane.ts} +28 -23
- package/src/{og/math/Quat.js → math/Quat.ts} +238 -222
- package/src/{og/math/Ray.js → math/Ray.ts} +59 -63
- package/src/{og/math/Vec2.js → math/Vec2.ts} +85 -76
- package/src/{og/math/Vec3.js → math/Vec3.ts} +141 -140
- package/src/{og/math/Vec4.js → math/Vec4.ts} +64 -53
- package/src/{og/math/coder.js → math/coder.ts} +30 -27
- package/src/math/index.ts +26 -0
- package/src/{og/math.js → math.ts} +46 -49
- package/src/{og/mercator.js → mercator.ts} +143 -149
- package/src/{og/proj/EPSG3857.js → proj/EPSG3857.ts} +1 -3
- package/src/{og/proj/EPSG4326.js → proj/EPSG4326.ts} +11 -13
- package/src/{og/proj/Proj.js → proj/Proj.ts} +27 -23
- package/src/{og/quadTree/EPSG4326QuadTreeStrategy.js → quadTree/EPSG4326QuadTreeStrategy.ts} +10 -13
- package/src/{og/quadTree/EarthQuadTreeStrategy.js → quadTree/EarthQuadTreeStrategy.ts} +11 -13
- package/src/quadTree/EntityCollectionNode.ts +395 -0
- package/src/{og/quadTree/MarsQuadTreeStrategy.js → quadTree/MarsQuadTreeStrategy.ts} +10 -13
- package/src/{og/quadTree/Node.js → quadTree/Node.ts} +283 -191
- package/src/{og/quadTree/QuadTreeStrategy.js → quadTree/QuadTreeStrategy.ts} +35 -29
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +22 -0
- package/src/quadTree/index.ts +14 -0
- package/src/{og/quadTree/quadTree.js → quadTree/quadTree.ts} +75 -77
- package/src/{og/renderer/Renderer.js → renderer/Renderer.ts} +454 -298
- package/src/{og/renderer/RendererEvents.js → renderer/RendererEvents.ts} +347 -270
- package/src/{og/scene/Axes.js → scene/Axes.ts} +26 -22
- package/src/{og/scene/BaseNode.js → scene/BaseNode.ts} +53 -47
- package/src/{og/scene/Planet.js → scene/Planet.ts} +777 -595
- package/src/{og/scene/RenderNode.js → scene/RenderNode.ts} +105 -91
- package/src/{og/scene/SkyBox.js → scene/SkyBox.ts} +29 -25
- package/src/scene/index.ts +6 -0
- package/src/{og/segment/Segment.js → segment/Segment.ts} +497 -371
- package/src/{og/segment/SegmentLonLat.js → segment/SegmentLonLat.ts} +81 -87
- package/src/{og/segment/SegmentLonLatWgs84.js → segment/SegmentLonLatWgs84.ts} +9 -16
- package/src/{og/segment/Slice.js → segment/Slice.ts} +15 -9
- package/src/{og/segment/segmentHelper.js → segment/segmentHelper.ts} +57 -49
- package/src/{og/shaders/atmos.js → shaders/atmos.ts} +4 -6
- package/src/{og/shaders/billboard.js → shaders/billboard.ts} +3 -5
- package/src/{og/shaders/bloom.js → shaders/bloom.ts} +2 -4
- package/src/{og/shaders/blur.js → shaders/blur.ts} +4 -7
- package/src/{og/shaders/depth.js → shaders/depth.ts} +1 -3
- package/src/{og/shaders/drawnode.js → shaders/drawnode.ts} +19 -21
- package/src/{og/shaders/geoObject.js → shaders/geoObject.ts} +17 -19
- package/src/{og/shaders/label.js → shaders/label.ts} +4 -6
- package/src/{og/shaders/lumFilter.js → shaders/lumFilter.ts} +2 -4
- package/src/{og/shaders/pickingMask.js → shaders/pickingMask.ts} +2 -4
- package/src/{og/shaders/pointCloud.js → shaders/pointCloud.ts} +7 -10
- package/src/{og/shaders/polyline.js → shaders/polyline.ts} +3 -200
- package/src/{og/shaders/ray.js → shaders/ray.ts} +2 -4
- package/src/{og/shaders/screenFrame.js → shaders/screenFrame.ts} +2 -4
- package/src/{og/shaders/skybox.js → shaders/skybox.ts} +7 -9
- package/src/{og/shaders/toneMapping.js → shaders/toneMapping.ts} +2 -4
- package/src/{og/shaders/utils.js → shaders/utils.ts} +0 -2
- package/src/{og/terrain/BilTerrain.js → terrain/BilTerrain.ts} +38 -32
- package/src/terrain/EmptyTerrain.ts +230 -0
- package/src/{og/terrain/Geoid.js → terrain/Geoid.ts} +67 -41
- package/src/{og/terrain/GlobusTerrain.js → terrain/GlobusTerrain.ts} +159 -153
- package/src/{og/terrain/MapboxTerrain.js → terrain/MapboxTerrain.ts} +58 -61
- package/src/terrain/index.ts +6 -0
- package/src/ui/Button.ts +121 -0
- package/src/ui/ButtonGroup.ts +63 -0
- package/src/ui/Dialog.ts +244 -0
- package/src/ui/Slider.ts +188 -0
- package/src/ui/ToggleButton.ts +68 -0
- package/src/{og/ui/View.js → ui/View.ts} +66 -59
- package/src/utils/BaseWorker.ts +60 -0
- package/src/utils/FontAtlas.ts +356 -0
- package/src/{og/utils/GeoImageCreator.js → utils/GeoImageCreator.ts} +45 -29
- package/src/{og/utils/ImagesCacheManager.js → utils/ImagesCacheManager.ts} +85 -70
- package/src/utils/Loader.ts +247 -0
- package/src/{og/utils/NormalMapCreator.js → utils/NormalMapCreator.ts} +114 -77
- package/src/{og/utils/PlainSegmentWorker.js → utils/PlainSegmentWorker.ts} +41 -24
- package/src/{og/utils/TerrainWorker.js → utils/TerrainWorker.ts} +51 -36
- package/src/utils/TextureAtlas.ts +322 -0
- package/src/{og/utils/VectorTileCreator.js → utils/VectorTileCreator.ts} +67 -52
- package/src/{og/utils/colorTable.js → utils/colorTable.ts} +142 -144
- package/src/{og/utils/earcut.js → utils/earcut.ts} +664 -661
- package/src/{og/utils/objParser.js → utils/objParser.ts} +66 -37
- package/src/{og/utils/shared.js → utils/shared.ts} +267 -206
- package/src/utils/units.ts +78 -0
- package/src/webgl/BaseFramebuffer.ts +125 -0
- package/src/webgl/Framebuffer.ts +206 -0
- package/src/webgl/Handler.ts +1414 -0
- package/src/webgl/Multisample.ts +153 -0
- package/src/webgl/Program.ts +451 -0
- package/src/{og/webgl/ProgramController.js → webgl/ProgramController.ts} +44 -43
- package/src/webgl/index.ts +13 -0
- package/src/{og/webgl/types.js → webgl/types.ts} +29 -31
- package/src/webgl/variableHandlers.ts +114 -0
- package/src/og/Deferred.js +0 -11
- package/src/og/Events.js +0 -185
- package/src/og/Globe.js +0 -342
- package/src/og/Lock.js +0 -44
- package/src/og/Popup.js +0 -187
- package/src/og/Stack.js +0 -49
- package/src/og/bv/index.js +0 -4
- package/src/og/camera/index.js +0 -4
- package/src/og/control/EarthCoordinates.js +0 -214
- package/src/og/control/EarthNavigation.js +0 -258
- package/src/og/control/KeyboardNavigation.js +0 -149
- package/src/og/control/LayerSwitcher.js +0 -424
- package/src/og/control/MouseNavigation.js +0 -436
- package/src/og/control/MouseWheelZoomControl.js +0 -253
- package/src/og/control/ScaleControl.js +0 -119
- package/src/og/control/SegmentBoundVisualization.js +0 -54
- package/src/og/control/ShowFps.js +0 -40
- package/src/og/control/SimpleNavigation.js +0 -123
- package/src/og/control/ToggleWireframe.js +0 -35
- package/src/og/control/TouchNavigation.js +0 -350
- package/src/og/control/ZoomControl.js +0 -115
- package/src/og/control/drawing/DrawingControl.js +0 -51
- package/src/og/control/heightRuler/HeightRuler.js +0 -12
- package/src/og/control/index.js +0 -56
- package/src/og/control/ruler/Ruler.js +0 -39
- package/src/og/ellipsoid/index.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -883
- package/src/og/entity/Geometry.js +0 -320
- package/src/og/entity/PointCloudHandler.js +0 -122
- package/src/og/entity/index.js +0 -9
- package/src/og/index.js +0 -112
- package/src/og/input/KeyboardHandler.js +0 -128
- package/src/og/input/TouchHandler.js +0 -59
- package/src/og/layer/GeoTexture2d.js +0 -50
- package/src/og/layer/index.js +0 -11
- package/src/og/math/index.js +0 -23
- package/src/og/quadTree/EntityCollectionNode.js +0 -391
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +0 -27
- package/src/og/quadTree/index.js +0 -14
- package/src/og/res/images.js +0 -8
- package/src/og/scene/index.js +0 -5
- package/src/og/terrain/EmptyTerrain.js +0 -174
- package/src/og/terrain/index.js +0 -6
- package/src/og/ui/Button.js +0 -107
- package/src/og/ui/ButtonGroup.js +0 -57
- package/src/og/ui/Dialog.js +0 -239
- package/src/og/ui/Slider.js +0 -170
- package/src/og/ui/ToggleButton.js +0 -51
- package/src/og/ui/UIhelpers.js +0 -155
- package/src/og/utils/BaseWorker.js +0 -46
- package/src/og/utils/FontAtlas.js +0 -218
- package/src/og/utils/Loader.js +0 -188
- package/src/og/utils/TextureAtlas.js +0 -291
- package/src/og/utils/functionComposition.js +0 -13
- package/src/og/utils/units.js +0 -78
- package/src/og/webgl/Framebuffer.js +0 -311
- package/src/og/webgl/Handler.js +0 -1168
- package/src/og/webgl/Multisample.js +0 -275
- package/src/og/webgl/Program.js +0 -407
- package/src/og/webgl/callbacks.js +0 -98
- package/src/og/webgl/index.js +0 -13
- package/src/og.jsdoc +0 -3
- package/types/Clock.d.ts +0 -99
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -78
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -108
- package/types/ImageCanvas.d.ts +0 -128
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -127
- package/types/Object3d.d.ts +0 -35
- package/types/Popup.d.ts +0 -29
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/arial.d.ts +0 -49
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -314
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -219
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/Atmosphere.d.ts +0 -15
- package/types/control/CompassButton.d.ts +0 -16
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -19
- package/types/control/DrawingSwitcher.d.ts +0 -13
- package/types/control/EarthCoordinates.d.ts +0 -44
- package/types/control/EarthNavigation.d.ts +0 -43
- package/types/control/GeoImageDragControl.d.ts +0 -14
- package/types/control/KeyboardNavigation.d.ts +0 -24
- package/types/control/LayerAnimation.d.ts +0 -73
- package/types/control/LayerSwitcher.d.ts +0 -64
- package/types/control/Lighting.d.ts +0 -41
- package/types/control/MouseNavigation.d.ts +0 -49
- package/types/control/MouseWheelZoomControl.d.ts +0 -46
- package/types/control/ScaleControl.d.ts +0 -23
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -26
- package/types/control/SimpleSkyBackground.d.ts +0 -15
- package/types/control/Sun.d.ts +0 -53
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -54
- package/types/control/ZoomControl.d.ts +0 -26
- package/types/control/drawing/DrawingControl.d.ts +0 -14
- package/types/control/drawing/LineStringDrawingScene.d.ts +0 -5
- package/types/control/drawing/PolygonDrawingScene.d.ts +0 -99
- package/types/control/heightRuler/HeightRuler.d.ts +0 -6
- package/types/control/heightRuler/HeightRulerScene.d.ts +0 -23
- package/types/control/index.d.ts +0 -27
- package/types/control/ruler/Ruler.d.ts +0 -13
- package/types/control/ruler/RulerScene.d.ts +0 -51
- package/types/control/selection/Selection.d.ts +0 -49
- package/types/control/selection/SelectionScene.d.ts +0 -32
- package/types/control/timeline/TimelineControl.d.ts +0 -10
- package/types/control/timeline/TimelineModel.d.ts +0 -33
- package/types/control/timeline/TimelineView.d.ts +0 -57
- package/types/control/timeline/timelineUtils.d.ts +0 -9
- package/types/ellipsoid/Ellipsoid.d.ts +0 -170
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -215
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -75
- package/types/entity/Entity.d.ts +0 -340
- package/types/entity/EntityCollection.d.ts +0 -303
- package/types/entity/GeoObject.d.ts +0 -117
- package/types/entity/GeoObjectHandler.d.ts +0 -41
- package/types/entity/Geometry.d.ts +0 -79
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -190
- package/types/entity/LabelHandler.d.ts +0 -31
- package/types/entity/LabelWorker.d.ts +0 -9
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -307
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -122
- package/types/entity/RayHandler.d.ts +0 -63
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.d.ts +0 -53
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -42
- package/types/layer/BaseGeoImage.d.ts +0 -116
- package/types/layer/CanvasTiles.d.ts +0 -73
- package/types/layer/GeoImage.d.ts +0 -51
- package/types/layer/GeoTexture2d.d.ts +0 -7
- package/types/layer/GeoVideo.d.ts +0 -47
- package/types/layer/KML.d.ts +0 -93
- package/types/layer/Layer.d.ts +0 -320
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -211
- package/types/layer/WMS.d.ts +0 -66
- package/types/layer/XYZ.d.ts +0 -122
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -472
- package/types/math/Vec4.d.ts +0 -161
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -268
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EPSG4326QuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/EarthQuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/EntityCollectionNode.d.ts +0 -41
- package/types/quadTree/MarsQuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/Node.d.ts +0 -58
- package/types/quadTree/QuadTreeStrategy.d.ts +0 -21
- package/types/quadTree/Wgs84QuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/index.d.ts +0 -12
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -291
- package/types/renderer/RendererEvents.d.ts +0 -255
- package/types/res/images.d.ts +0 -2
- package/types/scene/Axes.d.ts +0 -10
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -595
- package/types/scene/RenderNode.d.ts +0 -152
- package/types/scene/SkyBox.d.ts +0 -9
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -273
- package/types/segment/SegmentLonLat.d.ts +0 -22
- package/types/segment/SegmentLonLatWgs84.d.ts +0 -4
- package/types/segment/Slice.d.ts +0 -10
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/atmos.d.ts +0 -4
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -8
- package/types/shaders/geoObject.d.ts +0 -3
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pickingMask.d.ts +0 -2
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shaders/utils.d.ts +0 -1
- package/types/terrain/BilTerrain.d.ts +0 -14
- package/types/terrain/EmptyTerrain.d.ts +0 -87
- package/types/terrain/Geoid.d.ts +0 -17
- package/types/terrain/GlobusTerrain.d.ts +0 -122
- package/types/terrain/MapboxTerrain.d.ts +0 -14
- package/types/terrain/index.d.ts +0 -5
- package/types/ui/Button.d.ts +0 -21
- package/types/ui/ButtonGroup.d.ts +0 -12
- package/types/ui/Dialog.d.ts +0 -41
- package/types/ui/Slider.d.ts +0 -33
- package/types/ui/ToggleButton.d.ts +0 -10
- package/types/ui/UIhelpers.d.ts +0 -13
- package/types/ui/View.d.ts +0 -33
- package/types/ui/icons.d.ts +0 -1
- package/types/utils/BaseWorker.d.ts +0 -14
- package/types/utils/FontAtlas.d.ts +0 -16
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -31
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -8
- package/types/utils/TerrainWorker.d.ts +0 -7
- package/types/utils/TextureAtlas.d.ts +0 -113
- package/types/utils/VectorTileCreator.d.ts +0 -14
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/functionComposition.d.ts +0 -5
- package/types/utils/objParser.d.ts +0 -8
- package/types/utils/shared.d.ts +0 -241
- package/types/utils/units.d.ts +0 -20
- package/types/webgl/Framebuffer.d.ts +0 -134
- package/types/webgl/Handler.d.ts +0 -403
- package/types/webgl/Multisample.d.ts +0 -91
- package/types/webgl/Program.d.ts +0 -163
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
- /package/{src/og → dist/@openglobus/res/fonts}/arial.js +0 -0
- /package/src/{og/ui/icons.js → ui/icons.ts} +0 -0
|
@@ -1,31 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
1
|
+
import * as math from "../math";
|
|
2
|
+
import * as segmentHelper from "../segment/segmentHelper";
|
|
3
|
+
import * as shaders from "../shaders/drawnode";
|
|
4
|
+
import * as utils from "../utils/shared";
|
|
5
|
+
import {Atmosphere} from "../control/Atmosphere";
|
|
6
|
+
import {Control} from "../control/Control";
|
|
7
|
+
import {createColorRGB, isUndef} from "../utils/shared";
|
|
8
|
+
import {createEvents, EventsHandler} from "../Events";
|
|
9
|
+
import {decodeFloatFromRGBAArr} from "../math/coder";
|
|
10
|
+
import {EarthQuadTreeStrategy} from "../quadTree/EarthQuadTreeStrategy";
|
|
11
|
+
import {EmptyTerrain} from "../terrain/EmptyTerrain";
|
|
12
|
+
import {Extent} from "../Extent";
|
|
13
|
+
import {Entity} from "../entity/Entity";
|
|
14
|
+
import {Ellipsoid} from "../ellipsoid/Ellipsoid";
|
|
15
|
+
import {EntityCollection} from "../entity/EntityCollection";
|
|
16
|
+
import {Geoid, GeoidModel} from "../terrain/Geoid";
|
|
17
|
+
import {GeoImageCreator} from "../utils/GeoImageCreator";
|
|
18
|
+
import {IBaseInputState} from "../renderer/RendererEvents";
|
|
19
|
+
import {Key, Lock} from "../Lock";
|
|
20
|
+
import {Layer} from "../layer/Layer";
|
|
21
|
+
import {Loader} from "../utils/Loader";
|
|
22
|
+
import {LonLat} from "../LonLat";
|
|
23
|
+
import {Node} from "../quadTree/Node";
|
|
24
|
+
import {NormalMapCreator} from "../utils/NormalMapCreator";
|
|
25
|
+
import {PlainSegmentWorker} from "../utils/PlainSegmentWorker";
|
|
26
|
+
import {PlanetCamera} from "../camera/PlanetCamera";
|
|
27
|
+
import {Quat} from "../math/Quat";
|
|
28
|
+
import {QuadTreeStrategy} from "../quadTree/QuadTreeStrategy";
|
|
29
|
+
import {Ray} from "../math/Ray";
|
|
30
|
+
import {RenderNode} from "./RenderNode";
|
|
31
|
+
import {SimpleSkyBackground} from "../control/SimpleSkyBackground";
|
|
32
|
+
import {Sun} from "../control/Sun";
|
|
33
|
+
import {TerrainWorker} from "../utils/TerrainWorker";
|
|
34
|
+
import {Vec2, Vec3, Vec4, NumberArray2, NumberArray3, NumberArray4} from "../math/index";
|
|
35
|
+
import {Vector} from "../layer/Vector";
|
|
36
|
+
import {VectorTileCreator} from "../utils/VectorTileCreator";
|
|
37
|
+
import {wgs84} from "../ellipsoid/wgs84";
|
|
38
|
+
import {WebGLBufferExt, WebGLTextureExt, IDefaultTextureParams} from "../webgl/Handler";
|
|
39
|
+
import Constructor = jest.Constructor;
|
|
40
|
+
|
|
41
|
+
export interface IPlanetParams {
|
|
42
|
+
name?: string;
|
|
43
|
+
ellipsoid?: Ellipsoid;
|
|
44
|
+
minAltitude?: number;
|
|
45
|
+
maxAltitude?: number;
|
|
46
|
+
frustums?: NumberArray2[];
|
|
47
|
+
maxEqualZoomAltitude?: number;
|
|
48
|
+
minEqualZoomAltitude?: number;
|
|
49
|
+
minEqualZoomCameraSlope?: number;
|
|
50
|
+
quadTreeStrategyPrototype?: typeof QuadTreeStrategy;
|
|
51
|
+
ambient?: string | NumberArray3 | Vec3;
|
|
52
|
+
diffuse?: string | NumberArray3 | Vec3;
|
|
53
|
+
specular?: string | NumberArray3 | Vec3;
|
|
54
|
+
shininess?: number;
|
|
55
|
+
nightTextureSrc?: string | null;
|
|
56
|
+
specularTextureSrc?: string | null;
|
|
57
|
+
maxGridSize?: number;
|
|
58
|
+
maxLoadingRequests?: number;
|
|
59
|
+
atmosphereEnabled?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type PlanetEventsList = [
|
|
63
|
+
"draw",
|
|
64
|
+
"layeradd",
|
|
65
|
+
"baselayerchange",
|
|
66
|
+
"layerremove",
|
|
67
|
+
"layervisibilitychange",
|
|
68
|
+
"rendercompleted",
|
|
69
|
+
"terraincompleted",
|
|
70
|
+
"layerloadend"
|
|
71
|
+
];
|
|
29
72
|
|
|
30
73
|
const CUR_LOD_SIZE = 250; //px
|
|
31
74
|
const MIN_LOD_SIZE = 312; //px
|
|
@@ -46,292 +89,411 @@ const MAX_NODES = 200;
|
|
|
46
89
|
|
|
47
90
|
const HORIZON_TANGENT = 0.81;
|
|
48
91
|
|
|
49
|
-
|
|
92
|
+
type IndexBufferCacheData = { buffer: WebGLBufferExt | null };
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Main class for rendering planet
|
|
96
|
+
* @class
|
|
97
|
+
* @extends {RenderNode}
|
|
98
|
+
* @param {string} [options.name="Earth"] - Planet name(Earth by default)
|
|
99
|
+
* @param {Ellipsoid} [options.ellipsoid] - Planet ellipsoid(WGS84 by default)
|
|
100
|
+
* @param {Number} [options.maxGridSize=128] - Segment maximal grid size
|
|
101
|
+
* @param {Number} [options.maxEqualZoomAltitude=15000000.0] - Maximal altitude since segments on the screen become the same zoom level
|
|
102
|
+
* @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen become the same zoom level
|
|
103
|
+
* @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen become the same zoom level
|
|
104
|
+
*
|
|
105
|
+
* @fires EventsHandler<PlanetEventList>#draw
|
|
106
|
+
* @fires EventsHandler<PlanetEventList>#layeradd
|
|
107
|
+
* @fires EventsHandler<PlanetEventList>#baselayerchange
|
|
108
|
+
* @fires EventsHandler<PlanetEventList>#layerremove
|
|
109
|
+
* @fires EventsHandler<PlanetEventList>#layervisibilitychange
|
|
110
|
+
* @fires EventsHandler<PlanetEventList>#geoimageadd
|
|
111
|
+
*/
|
|
112
|
+
export class Planet extends RenderNode {
|
|
113
|
+
|
|
114
|
+
public events: EventsHandler<PlanetEventsList>;
|
|
115
|
+
|
|
50
116
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
117
|
+
* @public
|
|
118
|
+
* @type {Ellipsoid}
|
|
53
119
|
*/
|
|
54
|
-
|
|
120
|
+
public ellipsoid: Ellipsoid;
|
|
55
121
|
|
|
56
122
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
123
|
+
* @public
|
|
124
|
+
* @override
|
|
125
|
+
* @type {Boolean}
|
|
59
126
|
*/
|
|
60
|
-
|
|
127
|
+
public override lightEnabled: boolean;
|
|
61
128
|
|
|
62
129
|
/**
|
|
63
|
-
*
|
|
64
|
-
* @
|
|
130
|
+
* Squared ellipsoid radius.
|
|
131
|
+
* @public
|
|
132
|
+
* @type {number}
|
|
65
133
|
*/
|
|
66
|
-
|
|
134
|
+
public _planetRadius2: number;
|
|
67
135
|
|
|
68
136
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
137
|
+
* Layers array.
|
|
138
|
+
* @public
|
|
139
|
+
* @type {Array.<Layer>}
|
|
71
140
|
*/
|
|
72
|
-
|
|
141
|
+
public _layers: Layer[];
|
|
73
142
|
|
|
74
143
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @
|
|
144
|
+
* Flag to trigger layer update in a next frame
|
|
145
|
+
* @type {boolean}
|
|
146
|
+
* @protected
|
|
77
147
|
*/
|
|
78
|
-
|
|
148
|
+
protected _updateLayer: boolean;
|
|
79
149
|
|
|
80
150
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @
|
|
151
|
+
* Current visible imagery tile layers array.
|
|
152
|
+
* @public
|
|
153
|
+
* @type {Array.<Layer>}
|
|
83
154
|
*/
|
|
84
|
-
|
|
155
|
+
public visibleTileLayers: Layer[];
|
|
85
156
|
|
|
86
157
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @
|
|
158
|
+
* Current visible vector layers array.
|
|
159
|
+
* @protected
|
|
160
|
+
* @type {Array.<Layer>}
|
|
89
161
|
*/
|
|
90
|
-
|
|
162
|
+
protected visibleVectorLayers: Layer[];
|
|
163
|
+
|
|
164
|
+
protected _visibleTileLayerSlices: Layer[][];
|
|
91
165
|
|
|
92
166
|
/**
|
|
93
|
-
*
|
|
94
|
-
* @
|
|
167
|
+
* Vector layers visible nodes with collections.
|
|
168
|
+
* @protected
|
|
169
|
+
* @type {Array.<EntityCollection>}
|
|
95
170
|
*/
|
|
96
|
-
|
|
97
|
-
];
|
|
171
|
+
protected _frustumEntityCollections: EntityCollection[];
|
|
98
172
|
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
173
|
+
/**
|
|
174
|
+
* There is only one base layer on the globe when layer.isBaseLayer is true.
|
|
175
|
+
* @public
|
|
176
|
+
* @type {Layer}
|
|
177
|
+
*/
|
|
178
|
+
public baseLayer: Layer | null;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Terrain provider.
|
|
182
|
+
* @public
|
|
183
|
+
* @type {EmptyTerrain}
|
|
184
|
+
*/
|
|
185
|
+
public terrain: EmptyTerrain | null;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Camera is this.renderer.activeCamera pointer.
|
|
189
|
+
* @public
|
|
190
|
+
* @type {PlanetCamera}
|
|
191
|
+
*/
|
|
192
|
+
public camera: PlanetCamera;
|
|
193
|
+
|
|
194
|
+
public maxEqualZoomAltitude: number;
|
|
195
|
+
public minEqualZoomAltitude: number;
|
|
196
|
+
public minEqualZoomCameraSlope: number;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Screen mouse pointer projected to planet cartesian position.
|
|
200
|
+
* @public
|
|
201
|
+
* @type {Vec3}
|
|
202
|
+
*/
|
|
203
|
+
public mousePositionOnEarth: Vec3;
|
|
204
|
+
|
|
205
|
+
public emptyTexture: WebGLTextureExt | null;
|
|
206
|
+
public transparentTexture: WebGLTextureExt | null;
|
|
207
|
+
public defaultTexture: WebGLTextureExt | null;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Current visible minimal zoom index planet segment.
|
|
211
|
+
* @public
|
|
212
|
+
* @type {number}
|
|
213
|
+
*/
|
|
214
|
+
public minCurrZoom: number;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Current visible maximal zoom index planet segment.
|
|
218
|
+
* @public
|
|
219
|
+
* @type {number}
|
|
220
|
+
*/
|
|
221
|
+
public maxCurrZoom: number;
|
|
222
|
+
|
|
223
|
+
public _viewExtent: Extent;
|
|
224
|
+
|
|
225
|
+
protected _initialViewExtent: Extent | null;
|
|
226
|
+
|
|
227
|
+
public _createdNodesCount: number;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Planet's segments collected for rendering frame.
|
|
231
|
+
* @public
|
|
232
|
+
* @type {Node}
|
|
233
|
+
*/
|
|
234
|
+
public _renderedNodes: Node[];
|
|
235
|
+
|
|
236
|
+
public _renderedNodesInFrustum: Node[][];
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Current visible mercator segments tree nodes array.
|
|
240
|
+
* @public
|
|
241
|
+
* @type {Node}
|
|
242
|
+
*
|
|
243
|
+
* @todo
|
|
244
|
+
* _visibleNodes, _visibleNodesNorth and _visibleNodesSouth should
|
|
245
|
+
* be replaced to strategy and Vector layer reworked in collecting methods.
|
|
246
|
+
* _visibleNodes, and _visibleNodesNorth and South are used in Vector
|
|
247
|
+
* layer only, for entity terrain collision
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
public _visibleNodes: Record<number, Node>;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Current visible north pole nodes tree nodes array.
|
|
254
|
+
* @public
|
|
255
|
+
* @type {Node}
|
|
256
|
+
* @todo
|
|
257
|
+
*/
|
|
258
|
+
public _visibleNodesNorth: Record<number, Node>;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Current visible south pole nodes tree nodes array.
|
|
262
|
+
* @public
|
|
263
|
+
* @type {Node}
|
|
264
|
+
* @todo
|
|
265
|
+
*/
|
|
266
|
+
public _visibleNodesSouth: Record<number, Node>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Layers activity lock.
|
|
270
|
+
* @public
|
|
271
|
+
* @type {Lock}
|
|
272
|
+
*/
|
|
273
|
+
public layerLock: Lock;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Terrain providers activity lock.
|
|
277
|
+
* @public
|
|
278
|
+
* @type {Lock}
|
|
279
|
+
*/
|
|
280
|
+
public terrainLock: Lock;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Height scale factor. 1 - is normal elevation scale.
|
|
284
|
+
* @public
|
|
285
|
+
* @type {number}
|
|
286
|
+
*/
|
|
287
|
+
public _heightFactor: number;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Precomputed indexes array for different grid size segments.
|
|
291
|
+
* @protected
|
|
292
|
+
* @type {Array.<Array.<number>>}
|
|
293
|
+
*/
|
|
294
|
+
public _indexesCache: IndexBufferCacheData[][][][][];
|
|
295
|
+
|
|
296
|
+
protected _indexesCacheToRemove: IndexBufferCacheData[];
|
|
297
|
+
public _indexesCacheToRemoveCounter: number;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Precomputed texture coordinates buffers for different grid size segments.
|
|
301
|
+
* @public
|
|
302
|
+
* @type {Array.<Array.<number>>}
|
|
303
|
+
*/
|
|
304
|
+
public _textureCoordsBufferCache: WebGLBufferExt[];
|
|
305
|
+
|
|
306
|
+
public quadTreeStrategy: QuadTreeStrategy;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Night glowing gl texture.
|
|
310
|
+
* @protected
|
|
311
|
+
*/
|
|
312
|
+
protected _nightTexture: WebGLTextureExt | null;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Specular mask gl texture.
|
|
316
|
+
* @protected
|
|
317
|
+
*/
|
|
318
|
+
protected _specularTexture: WebGLTextureExt | null;
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
public _ambient: Float32Array;
|
|
322
|
+
public _diffuse: Float32Array;
|
|
323
|
+
public _specular: Float32Array;
|
|
324
|
+
|
|
325
|
+
protected _maxGridSize: number;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Segment multiple textures size.(4 - convenient value for the most devices)
|
|
329
|
+
* @const
|
|
330
|
+
* @public
|
|
331
|
+
*/
|
|
332
|
+
public SLICE_SIZE: number;
|
|
333
|
+
public SLICE_SIZE_4: number;
|
|
334
|
+
public SLICE_SIZE_3: number;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Level of details of visible segments.
|
|
338
|
+
* @protected
|
|
339
|
+
* @type {number}
|
|
340
|
+
*/
|
|
341
|
+
protected _lodSize: number;
|
|
342
|
+
protected _curLodSize: number;
|
|
343
|
+
protected _minLodSize: number;
|
|
344
|
+
public _maxLodSize: number;
|
|
345
|
+
|
|
346
|
+
public _pickingColorArr: Float32Array;
|
|
347
|
+
public _samplerArr: Int32Array;
|
|
348
|
+
public _pickingMaskArr: Int32Array;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* GeoImage creator.
|
|
352
|
+
* @public
|
|
353
|
+
* @type{GeoImageCreator}
|
|
354
|
+
*/
|
|
355
|
+
public _geoImageCreator: GeoImageCreator;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* VectorTileCreator creator.
|
|
359
|
+
* @public
|
|
360
|
+
* @type{VectorTileCreator}
|
|
361
|
+
*/
|
|
362
|
+
public _vectorTileCreator: VectorTileCreator;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* NormalMapCreator creator.
|
|
366
|
+
* @public
|
|
367
|
+
* @type{NormalMapCreator}
|
|
368
|
+
*/
|
|
369
|
+
public _normalMapCreator: NormalMapCreator;
|
|
370
|
+
|
|
371
|
+
public _terrainWorker: TerrainWorker;
|
|
372
|
+
|
|
373
|
+
public _plainSegmentWorker: PlainSegmentWorker;
|
|
374
|
+
|
|
375
|
+
public _tileLoader: Loader<Layer>;
|
|
376
|
+
|
|
377
|
+
protected _memKey: Key;
|
|
378
|
+
|
|
379
|
+
public _distBeforeMemClear: number;
|
|
380
|
+
|
|
381
|
+
protected _prevCamEye: Vec3;
|
|
382
|
+
|
|
383
|
+
protected _initialized: boolean;
|
|
384
|
+
|
|
385
|
+
protected always: any[];
|
|
386
|
+
|
|
387
|
+
public _renderCompleted: boolean
|
|
388
|
+
public _renderCompletedActivated: boolean;
|
|
389
|
+
|
|
390
|
+
public _terrainCompleted: boolean;
|
|
391
|
+
public _terrainCompletedActivated: boolean;
|
|
392
|
+
|
|
393
|
+
protected _collectRenderNodesIsActive: boolean;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Night texture brightness coefficient
|
|
397
|
+
* @type {number}
|
|
398
|
+
*/
|
|
399
|
+
public nightTextureCoefficient: number;
|
|
400
|
+
|
|
401
|
+
protected _renderScreenNodesPASS: Function;
|
|
402
|
+
|
|
403
|
+
protected _atmosphereEnabled: boolean;
|
|
404
|
+
protected _atmosphereMaxMinOpacity: Float32Array;
|
|
119
405
|
|
|
120
|
-
|
|
406
|
+
public solidTextureOne: WebGLTextureExt | null;
|
|
407
|
+
public solidTextureTwo: WebGLTextureExt | null;
|
|
408
|
+
|
|
409
|
+
protected _skipPreRender: boolean;
|
|
410
|
+
|
|
411
|
+
protected _nightTextureSrc: string | null;
|
|
412
|
+
protected _specularTextureSrc: string | null;
|
|
413
|
+
|
|
414
|
+
constructor(options: IPlanetParams = {}) {
|
|
415
|
+
super(options.name);
|
|
121
416
|
|
|
122
|
-
/**
|
|
123
|
-
* @public
|
|
124
|
-
* @type {Ellipsoid}
|
|
125
|
-
*/
|
|
126
417
|
this.ellipsoid = options.ellipsoid || wgs84;
|
|
127
418
|
|
|
128
|
-
/**
|
|
129
|
-
* @public
|
|
130
|
-
* @type {Boolean}
|
|
131
|
-
*/
|
|
132
419
|
this.lightEnabled = true;
|
|
133
420
|
|
|
134
|
-
/**
|
|
135
|
-
* Squared ellipsoid radius.
|
|
136
|
-
* @protected
|
|
137
|
-
* @type {number}
|
|
138
|
-
*/
|
|
139
421
|
this._planetRadius2 = this.ellipsoid.getPolarSize() * this.ellipsoid.getPolarSize();
|
|
140
422
|
|
|
141
|
-
/**
|
|
142
|
-
* Layers array.
|
|
143
|
-
* @protected
|
|
144
|
-
* @type {Array.<Layer>}
|
|
145
|
-
*/
|
|
146
423
|
this._layers = [];
|
|
147
424
|
|
|
148
|
-
/**
|
|
149
|
-
* Flag to trigger layer update in a next frame
|
|
150
|
-
* @type {boolean}
|
|
151
|
-
* @private
|
|
152
|
-
*/
|
|
153
425
|
this._updateLayer = false;
|
|
154
426
|
|
|
155
|
-
/**
|
|
156
|
-
* Current visible imagery tile layers array.
|
|
157
|
-
* @public
|
|
158
|
-
* @type {Array.<Layer>}
|
|
159
|
-
*/
|
|
160
427
|
this.visibleTileLayers = [];
|
|
161
428
|
|
|
162
|
-
/**
|
|
163
|
-
* Current visible vector layers array.
|
|
164
|
-
* @protected
|
|
165
|
-
* @type {Array.<layer.Vector>}
|
|
166
|
-
*/
|
|
167
429
|
this.visibleVectorLayers = [];
|
|
168
430
|
|
|
169
431
|
this._visibleTileLayerSlices = [];
|
|
170
432
|
|
|
171
|
-
/**
|
|
172
|
-
* Vector layers visible nodes with collections.
|
|
173
|
-
* @protected
|
|
174
|
-
* @type {Array.<EntityCollection>}
|
|
175
|
-
*/
|
|
176
433
|
this._frustumEntityCollections = [];
|
|
177
434
|
|
|
178
|
-
/**
|
|
179
|
-
* There is only one base layer on the globe when layer.isBaseLayer is true.
|
|
180
|
-
* @public
|
|
181
|
-
* @type {Layer}
|
|
182
|
-
*/
|
|
183
435
|
this.baseLayer = null;
|
|
184
436
|
|
|
185
|
-
/**
|
|
186
|
-
* Terrain provider.
|
|
187
|
-
* @public
|
|
188
|
-
* @type {Terrain}
|
|
189
|
-
*/
|
|
190
437
|
this.terrain = null;
|
|
191
438
|
|
|
192
|
-
/**
|
|
193
|
-
* Terrain provider Pool.
|
|
194
|
-
* @public
|
|
195
|
-
* @type {Terrain}
|
|
196
|
-
*/
|
|
197
|
-
this._terrainPool = null;
|
|
198
|
-
|
|
199
|
-
this._minAltitude = options.minAltitude;
|
|
200
|
-
this._maxAltitude = options.maxAltitude;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Camera is this.renderer.activeCamera pointer.
|
|
204
|
-
* @public
|
|
205
|
-
* @type {PlanetCamera}
|
|
206
|
-
*/
|
|
207
439
|
this.camera = new PlanetCamera(this, {
|
|
208
|
-
frustums:
|
|
440
|
+
frustums: options.frustums,
|
|
209
441
|
eye: new Vec3(25000000, 0, 0),
|
|
210
442
|
look: Vec3.ZERO,
|
|
211
443
|
up: Vec3.NORTH,
|
|
212
|
-
minAltitude:
|
|
213
|
-
maxAltitude:
|
|
444
|
+
minAltitude: options.minAltitude,
|
|
445
|
+
maxAltitude: options.maxAltitude
|
|
214
446
|
});
|
|
215
447
|
|
|
216
448
|
this.maxEqualZoomAltitude = options.maxEqualZoomAltitude || 15000000.0;
|
|
217
449
|
this.minEqualZoomAltitude = options.minEqualZoomAltitude || 10000.0;
|
|
218
450
|
this.minEqualZoomCameraSlope = options.minEqualZoomCameraSlope || 0.8;
|
|
219
451
|
|
|
220
|
-
/**
|
|
221
|
-
* Screen mouse pointer projected to planet cartesian position.
|
|
222
|
-
* @public
|
|
223
|
-
* @type {Vec3}
|
|
224
|
-
*/
|
|
225
452
|
this.mousePositionOnEarth = new Vec3();
|
|
226
453
|
|
|
227
454
|
this.emptyTexture = null;
|
|
228
455
|
this.transparentTexture = null;
|
|
229
456
|
this.defaultTexture = null;
|
|
230
457
|
|
|
231
|
-
/**
|
|
232
|
-
* Current visible minimal zoom index planet segment.
|
|
233
|
-
* @public
|
|
234
|
-
* @type {number}
|
|
235
|
-
*/
|
|
236
458
|
this.minCurrZoom = math.MAX;
|
|
237
459
|
|
|
238
|
-
/**
|
|
239
|
-
* Current visible maximal zoom index planet segment.
|
|
240
|
-
* @public
|
|
241
|
-
* @type {number}
|
|
242
|
-
*/
|
|
243
460
|
this.maxCurrZoom = math.MIN;
|
|
244
461
|
|
|
245
462
|
this._viewExtent = new Extent(new LonLat(180, 180), new LonLat(-180, -180));
|
|
246
463
|
|
|
464
|
+
this._skipPreRender = false;
|
|
465
|
+
|
|
247
466
|
this._initialViewExtent = null;
|
|
248
467
|
|
|
249
|
-
/**
|
|
250
|
-
* @protected
|
|
251
|
-
*/
|
|
252
468
|
this._createdNodesCount = 0;
|
|
253
469
|
|
|
254
|
-
/**
|
|
255
|
-
* Planet's segments collected for rendering frame.
|
|
256
|
-
* @protected
|
|
257
|
-
* @type {quadTree.Node}
|
|
258
|
-
*/
|
|
259
470
|
this._renderedNodes = [];
|
|
260
471
|
this._renderedNodesInFrustum = [];
|
|
261
472
|
|
|
262
|
-
/**
|
|
263
|
-
* Current visible mercator segments tree nodes array.
|
|
264
|
-
* @protected
|
|
265
|
-
* @type {quadTree.Node}
|
|
266
|
-
*/
|
|
267
473
|
this._visibleNodes = {};
|
|
268
474
|
|
|
269
|
-
/**
|
|
270
|
-
* Current visible north pole nodes tree nodes array.
|
|
271
|
-
* @protected
|
|
272
|
-
* @type {quadTree.Node}
|
|
273
|
-
*/
|
|
274
475
|
this._visibleNodesNorth = {};
|
|
275
476
|
|
|
276
|
-
/**
|
|
277
|
-
* Current visible south pole nodes tree nodes array.
|
|
278
|
-
* @protected
|
|
279
|
-
* @type {quadTree.Node}
|
|
280
|
-
*/
|
|
281
477
|
this._visibleNodesSouth = {};
|
|
282
478
|
|
|
283
|
-
/**
|
|
284
|
-
* Layers activity lock.
|
|
285
|
-
* @public
|
|
286
|
-
* @type {idle.Lock}
|
|
287
|
-
*/
|
|
288
479
|
this.layerLock = new Lock();
|
|
289
480
|
|
|
290
|
-
/**
|
|
291
|
-
* Terrain providers activity lock.
|
|
292
|
-
* @public
|
|
293
|
-
* @type {idle.Lock}
|
|
294
|
-
*/
|
|
295
481
|
this.terrainLock = new Lock();
|
|
296
482
|
|
|
297
|
-
/**
|
|
298
|
-
* Height scale factor. 1 - is normal elevation scale.
|
|
299
|
-
* @protected
|
|
300
|
-
* @type {number}
|
|
301
|
-
*/
|
|
302
483
|
this._heightFactor = 1.0;
|
|
303
484
|
|
|
304
|
-
/**
|
|
305
|
-
* Precomputed indexes array for differrent grid size segments.
|
|
306
|
-
* @protected
|
|
307
|
-
* @type {Array.<Array.<number>>}
|
|
308
|
-
*/
|
|
309
485
|
this._indexesCache = [];
|
|
310
486
|
this._indexesCacheToRemove = [];
|
|
311
487
|
this._indexesCacheToRemoveCounter = 0;
|
|
312
488
|
|
|
313
|
-
/**
|
|
314
|
-
* Precomputed texture coordinates buffers for differrent grid size segments.
|
|
315
|
-
* @protected
|
|
316
|
-
* @type {Array.<Array.<number>>}
|
|
317
|
-
*/
|
|
318
489
|
this._textureCoordsBufferCache = [];
|
|
319
490
|
|
|
320
|
-
this.quadTreeStrategy = options.quadTreeStrategyPrototype ? new options.quadTreeStrategyPrototype(
|
|
491
|
+
this.quadTreeStrategy = options.quadTreeStrategyPrototype ? new options.quadTreeStrategyPrototype(this) : new EarthQuadTreeStrategy(this);
|
|
321
492
|
|
|
322
|
-
/**
|
|
323
|
-
* Night glowing gl texture.
|
|
324
|
-
* @protected
|
|
325
|
-
*/
|
|
326
493
|
this._nightTexture = null;
|
|
327
494
|
|
|
328
|
-
/**
|
|
329
|
-
* Specular mask gl texture.
|
|
330
|
-
* @protected
|
|
331
|
-
*/
|
|
332
495
|
this._specularTexture = null;
|
|
333
496
|
|
|
334
|
-
//TODO: replace to a function
|
|
335
497
|
let a = utils.createColorRGB(options.ambient, new Vec3(0.2, 0.2, 0.3));
|
|
336
498
|
let d = utils.createColorRGB(options.diffuse, new Vec3(1.0, 1.0, 1.0));
|
|
337
499
|
let s = utils.createColorRGB(options.specular, new Vec3(0.00063, 0.00055, 0.00032));
|
|
@@ -341,36 +503,12 @@ export class Planet extends RenderNode {
|
|
|
341
503
|
this._diffuse = new Float32Array([d.x, d.y, d.z]);
|
|
342
504
|
this._specular = new Float32Array([s.x, s.y, s.z, shininess]);
|
|
343
505
|
|
|
344
|
-
/**
|
|
345
|
-
* True for rendering night glowing texture.
|
|
346
|
-
* @protected
|
|
347
|
-
* @type {boolean}
|
|
348
|
-
*/
|
|
349
|
-
this._useNightTexture = isUndef(options.useNightTexture) ? true : options.useNightTexture;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* True for rendering specular mask texture.
|
|
353
|
-
* @protected
|
|
354
|
-
* @type {boolean}
|
|
355
|
-
*/
|
|
356
|
-
this._useSpecularTexture = isUndef(options.useSpecularTexture) ? true : options.useSpecularTexture;
|
|
357
|
-
|
|
358
506
|
this._maxGridSize = Math.log2(options.maxGridSize || 128);
|
|
359
507
|
|
|
360
|
-
/**
|
|
361
|
-
* Segment multiple textures size.(4 - convinient value for the most devices)
|
|
362
|
-
* @const
|
|
363
|
-
* @public
|
|
364
|
-
*/
|
|
365
508
|
this.SLICE_SIZE = 4;
|
|
366
509
|
this.SLICE_SIZE_4 = this.SLICE_SIZE * 4;
|
|
367
510
|
this.SLICE_SIZE_3 = this.SLICE_SIZE * 3;
|
|
368
511
|
|
|
369
|
-
/**
|
|
370
|
-
* Level of the visible segment detalization.
|
|
371
|
-
* @public
|
|
372
|
-
* @type {number}
|
|
373
|
-
*/
|
|
374
512
|
this._lodSize = CUR_LOD_SIZE;
|
|
375
513
|
this._curLodSize = CUR_LOD_SIZE;
|
|
376
514
|
this._minLodSize = MIN_LOD_SIZE;
|
|
@@ -380,25 +518,10 @@ export class Planet extends RenderNode {
|
|
|
380
518
|
this._samplerArr = new Int32Array(this.SLICE_SIZE);
|
|
381
519
|
this._pickingMaskArr = new Int32Array(this.SLICE_SIZE);
|
|
382
520
|
|
|
383
|
-
/**
|
|
384
|
-
* GeoImage creator.
|
|
385
|
-
* @protected
|
|
386
|
-
* @type{GeoImageCreator}
|
|
387
|
-
*/
|
|
388
521
|
this._geoImageCreator = new GeoImageCreator(this);
|
|
389
522
|
|
|
390
|
-
/**
|
|
391
|
-
* VectorTileCreator creator.
|
|
392
|
-
* @protected
|
|
393
|
-
* @type{VectorTileCreator}
|
|
394
|
-
*/
|
|
395
523
|
this._vectorTileCreator = new VectorTileCreator(this);
|
|
396
524
|
|
|
397
|
-
/**
|
|
398
|
-
* NormalMapCreator creator.
|
|
399
|
-
* @protected
|
|
400
|
-
* @type{NormalMapCreator}
|
|
401
|
-
*/
|
|
402
525
|
this._normalMapCreator = new NormalMapCreator(this);
|
|
403
526
|
|
|
404
527
|
this._terrainWorker = new TerrainWorker(3);
|
|
@@ -409,7 +532,7 @@ export class Planet extends RenderNode {
|
|
|
409
532
|
|
|
410
533
|
this._memKey = new Key();
|
|
411
534
|
|
|
412
|
-
this.events
|
|
535
|
+
this.events = createEvents<PlanetEventsList>(PLANET_EVENTS);
|
|
413
536
|
|
|
414
537
|
this._distBeforeMemClear = 0.0;
|
|
415
538
|
|
|
@@ -426,107 +549,123 @@ export class Planet extends RenderNode {
|
|
|
426
549
|
this._terrainCompletedActivated = false;
|
|
427
550
|
this._collectRenderNodesIsActive = true;
|
|
428
551
|
|
|
429
|
-
/**
|
|
430
|
-
* Night texture brightness coefficient
|
|
431
|
-
* @type {number}
|
|
432
|
-
*/
|
|
433
552
|
this.nightTextureCoefficient = 2.0;
|
|
434
553
|
|
|
435
554
|
this._renderScreenNodesPASS = this._renderScreenNodesPASSNoAtmos;
|
|
436
555
|
|
|
437
556
|
this._atmosphereEnabled = options.atmosphereEnabled || false;
|
|
438
557
|
this._atmosphereMaxMinOpacity = new Float32Array([1.0, 0.41]);
|
|
558
|
+
|
|
559
|
+
this.solidTextureOne = null;
|
|
560
|
+
this.solidTextureTwo = null;
|
|
561
|
+
|
|
562
|
+
this._nightTextureSrc = options.nightTextureSrc || null;
|
|
563
|
+
this._specularTextureSrc = options.specularTextureSrc || null;
|
|
439
564
|
}
|
|
440
565
|
|
|
441
|
-
|
|
566
|
+
public get maxGridSize(): number {
|
|
567
|
+
return this._maxGridSize;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
public getNorthFrameRotation(cartesian: Vec3): Quat {
|
|
442
571
|
return this.ellipsoid.getNorthFrameRotation(cartesian);
|
|
443
572
|
}
|
|
444
573
|
|
|
445
|
-
set atmosphereMaxOpacity(opacity) {
|
|
574
|
+
public set atmosphereMaxOpacity(opacity: number) {
|
|
446
575
|
this._atmosphereMaxMinOpacity[0] = opacity;
|
|
447
576
|
}
|
|
448
577
|
|
|
449
|
-
get atmosphereMaxOpacity() {
|
|
578
|
+
public get atmosphereMaxOpacity(): number {
|
|
450
579
|
return this._atmosphereMaxMinOpacity[0];
|
|
451
580
|
}
|
|
452
581
|
|
|
453
|
-
set atmosphereMinOpacity(opacity) {
|
|
582
|
+
public set atmosphereMinOpacity(opacity: number) {
|
|
454
583
|
this._atmosphereMaxMinOpacity[1] = opacity;
|
|
455
584
|
}
|
|
456
585
|
|
|
457
|
-
get atmosphereMinOpacity() {
|
|
586
|
+
public get atmosphereMinOpacity(): number {
|
|
458
587
|
return this._atmosphereMaxMinOpacity[1];
|
|
459
588
|
}
|
|
460
589
|
|
|
461
|
-
|
|
462
|
-
set atmosphereEnabled(enabled) {
|
|
590
|
+
public set atmosphereEnabled(enabled: boolean) {
|
|
463
591
|
if (enabled != this._atmosphereEnabled) {
|
|
464
592
|
this._atmosphereEnabled = enabled;
|
|
465
593
|
this._initializeAtmosphere();
|
|
466
594
|
}
|
|
467
595
|
}
|
|
468
596
|
|
|
469
|
-
get atmosphereEnabled() {
|
|
597
|
+
public get atmosphereEnabled(): boolean {
|
|
470
598
|
return this._atmosphereEnabled;
|
|
471
599
|
}
|
|
472
600
|
|
|
473
|
-
set diffuse(rgb) {
|
|
601
|
+
public set diffuse(rgb: string | NumberArray3 | Vec3) {
|
|
474
602
|
let vec = createColorRGB(rgb);
|
|
475
603
|
this._diffuse = new Float32Array(vec.toArray());
|
|
476
604
|
}
|
|
477
605
|
|
|
478
|
-
set ambient(rgb) {
|
|
606
|
+
public set ambient(rgb: string | NumberArray3 | Vec3) {
|
|
479
607
|
let vec = createColorRGB(rgb);
|
|
480
608
|
this._ambient = new Float32Array(vec.toArray());
|
|
481
609
|
}
|
|
482
610
|
|
|
483
|
-
set specular(rgb) {
|
|
611
|
+
public set specular(rgb: string | NumberArray3 | Vec3) {
|
|
484
612
|
let vec = createColorRGB(rgb);
|
|
485
613
|
this._specular = new Float32Array([vec.x, vec.y, vec.y, this._specular[3]]);
|
|
486
614
|
}
|
|
487
615
|
|
|
488
|
-
set shininess(v) {
|
|
616
|
+
public set shininess(v: number) {
|
|
489
617
|
this._specular[3] = v;
|
|
490
618
|
}
|
|
491
619
|
|
|
492
|
-
get normalMapCreator() {
|
|
620
|
+
public get normalMapCreator(): NormalMapCreator {
|
|
493
621
|
return this._normalMapCreator;
|
|
494
622
|
}
|
|
495
623
|
|
|
496
|
-
get layers() {
|
|
624
|
+
public get layers(): Layer[] {
|
|
497
625
|
return [...this._layers];
|
|
498
626
|
}
|
|
499
627
|
|
|
500
|
-
|
|
501
|
-
|
|
628
|
+
/**
|
|
629
|
+
* @todo: remove after tests
|
|
630
|
+
* Get the collection of layers associated with this planet.
|
|
631
|
+
* @return {Array.<Layer>} Layers array.
|
|
632
|
+
* @public
|
|
633
|
+
*/
|
|
634
|
+
public getLayers(): Layer[] {
|
|
635
|
+
return this.layers;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
public get sunPos(): Vec3 {
|
|
640
|
+
return (this.renderer!.controls.sun as Sun).sunlight.getPosition();
|
|
502
641
|
}
|
|
503
642
|
|
|
504
643
|
/**
|
|
505
644
|
* Add the given control to the renderer of the planet scene.
|
|
506
|
-
* @param {
|
|
645
|
+
* @param {Control} control - Control.
|
|
507
646
|
*/
|
|
508
|
-
addControl(control) {
|
|
647
|
+
public addControl(control: Control) {
|
|
509
648
|
control.planet = this;
|
|
510
|
-
control.addTo(this.renderer);
|
|
649
|
+
control.addTo(this.renderer!);
|
|
511
650
|
}
|
|
512
651
|
|
|
513
|
-
get lodSize() {
|
|
652
|
+
public get lodSize(): number {
|
|
514
653
|
return this._lodSize;
|
|
515
654
|
}
|
|
516
655
|
|
|
517
|
-
setLodSize(currentLodSize, minLodSize, maxLodSize) {
|
|
656
|
+
public setLodSize(currentLodSize: number, minLodSize?: number, maxLodSize?: number) {
|
|
518
657
|
this._maxLodSize = maxLodSize || this._maxLodSize;
|
|
519
658
|
this._minLodSize = minLodSize || this._minLodSize;
|
|
520
|
-
this._curLodSize = currentLodSize
|
|
659
|
+
this._curLodSize = currentLodSize;
|
|
521
660
|
this._renderCompletedActivated = false;
|
|
522
661
|
this._terrainCompletedActivated = false;
|
|
523
662
|
}
|
|
524
663
|
|
|
525
664
|
/**
|
|
526
665
|
* Add the given controls array to the renderer of the planet.
|
|
527
|
-
* @param {Array.<
|
|
666
|
+
* @param {Array.<Control>} cArr - Control array.
|
|
528
667
|
*/
|
|
529
|
-
addControls(cArr) {
|
|
668
|
+
public addControls(cArr: Control[]) {
|
|
530
669
|
for (let i = 0; i < cArr.length; i++) {
|
|
531
670
|
this.addControl(cArr[i]);
|
|
532
671
|
}
|
|
@@ -538,7 +677,7 @@ export class Planet extends RenderNode {
|
|
|
538
677
|
* @public
|
|
539
678
|
* @returns {Layer} -
|
|
540
679
|
*/
|
|
541
|
-
getLayerByName(name) {
|
|
680
|
+
public getLayerByName(name: string): Layer | undefined {
|
|
542
681
|
for (let i = 0, len = this._layers.length; i < len; i++) {
|
|
543
682
|
if (name === this._layers[i].name) {
|
|
544
683
|
return this._layers[i];
|
|
@@ -547,20 +686,20 @@ export class Planet extends RenderNode {
|
|
|
547
686
|
}
|
|
548
687
|
|
|
549
688
|
/**
|
|
550
|
-
* Adds
|
|
689
|
+
* Adds layer to the planet.
|
|
551
690
|
* @param {Layer} layer - Layer object.
|
|
552
691
|
* @public
|
|
553
692
|
*/
|
|
554
|
-
addLayer(layer) {
|
|
693
|
+
public addLayer(layer: Layer) {
|
|
555
694
|
layer.addTo(this);
|
|
556
695
|
}
|
|
557
696
|
|
|
558
697
|
/**
|
|
559
698
|
* Dispatch layer visibility changing event.
|
|
560
699
|
* @param {Layer} layer - Changed layer.
|
|
561
|
-
* @
|
|
700
|
+
* @public
|
|
562
701
|
*/
|
|
563
|
-
_onLayerVisibilityChanged(layer) {
|
|
702
|
+
public _onLayerVisibilityChanged(layer: Layer) {
|
|
564
703
|
this.events.dispatch(this.events.layervisibilitychange, layer);
|
|
565
704
|
}
|
|
566
705
|
|
|
@@ -569,7 +708,7 @@ export class Planet extends RenderNode {
|
|
|
569
708
|
* @param {Array.<Layer>} layers - Layers array.
|
|
570
709
|
* @public
|
|
571
710
|
*/
|
|
572
|
-
addLayers(layers) {
|
|
711
|
+
public addLayers(layers: Layer[]) {
|
|
573
712
|
for (let i = 0, len = layers.length; i < len; i++) {
|
|
574
713
|
this.addLayer(layers[i]);
|
|
575
714
|
}
|
|
@@ -578,38 +717,27 @@ export class Planet extends RenderNode {
|
|
|
578
717
|
/**
|
|
579
718
|
* Removes the given layer from the planet.
|
|
580
719
|
* @param {Layer} layer - Layer to remove.
|
|
581
|
-
* @return {Layer|undefined} The removed layer or undefined if the layer was not found.
|
|
582
720
|
* @public
|
|
583
721
|
*/
|
|
584
|
-
removeLayer(layer) {
|
|
585
|
-
|
|
722
|
+
public removeLayer(layer: Layer) {
|
|
723
|
+
layer.remove();
|
|
586
724
|
}
|
|
587
725
|
|
|
588
726
|
/**
|
|
589
727
|
*
|
|
590
|
-
* @
|
|
728
|
+
* @public
|
|
591
729
|
* @param {Layer} layer - Material layer.
|
|
592
730
|
*/
|
|
593
|
-
_clearLayerMaterial(layer) {
|
|
731
|
+
public _clearLayerMaterial(layer: Layer) {
|
|
594
732
|
this.quadTreeStrategy.clearLayerMaterial(layer);
|
|
595
733
|
}
|
|
596
734
|
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Get the collection of layers associated with this planet.
|
|
600
|
-
* @return {Array.<Layer>} Layers array.
|
|
601
|
-
* @public
|
|
602
|
-
*/
|
|
603
|
-
getLayers() {
|
|
604
|
-
return this.layers;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
735
|
/**
|
|
608
736
|
* Sets base layer coverage to the planet.
|
|
609
737
|
* @param {Layer} layer - Layer object.
|
|
610
738
|
* @public
|
|
611
739
|
*/
|
|
612
|
-
setBaseLayer(layer) {
|
|
740
|
+
public setBaseLayer(layer: Layer) {
|
|
613
741
|
if (this.baseLayer) {
|
|
614
742
|
if (!this.baseLayer.isEqual(layer)) {
|
|
615
743
|
this.baseLayer.setVisibility(false);
|
|
@@ -628,13 +756,15 @@ export class Planet extends RenderNode {
|
|
|
628
756
|
* Sets elevation scale. 1.0 is default.
|
|
629
757
|
* @param {number} factor - Elevation scale.
|
|
630
758
|
*/
|
|
631
|
-
setHeightFactor(factor) {
|
|
759
|
+
public setHeightFactor(factor: number) {
|
|
632
760
|
this._renderCompletedActivated = false;
|
|
633
761
|
this._terrainCompletedActivated = false;
|
|
634
762
|
|
|
635
763
|
if (this._heightFactor !== factor) {
|
|
636
764
|
this._heightFactor = factor;
|
|
637
765
|
this.quadTreeStrategy.destroyBranches();
|
|
766
|
+
this._clearRenderedNodeList();
|
|
767
|
+
this._clearRenderNodesInFrustum();
|
|
638
768
|
}
|
|
639
769
|
}
|
|
640
770
|
|
|
@@ -642,16 +772,16 @@ export class Planet extends RenderNode {
|
|
|
642
772
|
* Gets elevation scale.
|
|
643
773
|
* @returns {number} Terrain elevation scale
|
|
644
774
|
*/
|
|
645
|
-
getHeightFactor() {
|
|
775
|
+
public getHeightFactor(): number {
|
|
646
776
|
return this._heightFactor;
|
|
647
777
|
}
|
|
648
778
|
|
|
649
779
|
/**
|
|
650
780
|
* Sets terrain provider
|
|
651
781
|
* @public
|
|
652
|
-
* @param {
|
|
782
|
+
* @param {EmptyTerrain} terrain - Terrain provider.
|
|
653
783
|
*/
|
|
654
|
-
setTerrain(terrain) {
|
|
784
|
+
public setTerrain(terrain: EmptyTerrain) {
|
|
655
785
|
this._renderCompletedActivated = false;
|
|
656
786
|
this._terrainCompletedActivated = false;
|
|
657
787
|
|
|
@@ -674,9 +804,9 @@ export class Planet extends RenderNode {
|
|
|
674
804
|
this._plainSegmentWorker.setGeoid(terrain.getGeoid());
|
|
675
805
|
terrain._isReady = true;
|
|
676
806
|
} else {
|
|
677
|
-
Geoid.loadModel(terrain.
|
|
678
|
-
.then((m) => {
|
|
679
|
-
terrain.
|
|
807
|
+
Geoid.loadModel(terrain.geoid.src)
|
|
808
|
+
.then((m: GeoidModel | null) => {
|
|
809
|
+
terrain.geoid.setModel(m);
|
|
680
810
|
this._plainSegmentWorker.setGeoid(terrain.getGeoid());
|
|
681
811
|
terrain._isReady = true;
|
|
682
812
|
})
|
|
@@ -686,8 +816,8 @@ export class Planet extends RenderNode {
|
|
|
686
816
|
}
|
|
687
817
|
}
|
|
688
818
|
|
|
689
|
-
_initializeAtmosphere() {
|
|
690
|
-
let h = this.renderer
|
|
819
|
+
protected _initializeAtmosphere() {
|
|
820
|
+
let h = this.renderer!.handler;
|
|
691
821
|
h.removeProgram("drawnode_screen_wl");
|
|
692
822
|
|
|
693
823
|
if (this._atmosphereEnabled) {
|
|
@@ -700,29 +830,28 @@ export class Planet extends RenderNode {
|
|
|
700
830
|
h.addProgram(shaders.drawnode_screen_wl_webgl1NoAtmos(), true);
|
|
701
831
|
}
|
|
702
832
|
|
|
703
|
-
if (!this.renderer
|
|
833
|
+
if (!this.renderer!.controls.Atmosphere) {
|
|
704
834
|
this.addControl(new Atmosphere());
|
|
705
835
|
} else {
|
|
706
|
-
this.renderer
|
|
836
|
+
this.renderer!.controls.Atmosphere.activate();
|
|
707
837
|
}
|
|
708
838
|
|
|
709
|
-
if (this.renderer
|
|
710
|
-
this.renderer
|
|
839
|
+
if (this.renderer!.controls.SimpleSkyBackground) {
|
|
840
|
+
this.renderer!.controls.SimpleSkyBackground.deactivate();
|
|
711
841
|
}
|
|
712
842
|
|
|
713
843
|
} else {
|
|
714
844
|
|
|
715
845
|
this._renderScreenNodesPASS = this._renderScreenNodesPASSNoAtmos;
|
|
716
846
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
this.renderer.controls.Atmosphere.deactivate();
|
|
847
|
+
if (this.renderer!.controls.Atmosphere) {
|
|
848
|
+
this.renderer!.controls.Atmosphere.deactivate();
|
|
720
849
|
}
|
|
721
850
|
|
|
722
|
-
if (!this.renderer
|
|
851
|
+
if (!this.renderer!.controls.SimpleSkyBackground) {
|
|
723
852
|
this.addControl(new SimpleSkyBackground());
|
|
724
853
|
} else {
|
|
725
|
-
this.renderer
|
|
854
|
+
this.renderer!.controls.SimpleSkyBackground.activate();
|
|
726
855
|
}
|
|
727
856
|
|
|
728
857
|
if (h.isWebGl2()) {
|
|
@@ -733,37 +862,30 @@ export class Planet extends RenderNode {
|
|
|
733
862
|
}
|
|
734
863
|
}
|
|
735
864
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
* @protected
|
|
739
|
-
*/
|
|
740
|
-
_initializeShaders() {
|
|
741
|
-
let h = this.renderer.handler;
|
|
865
|
+
protected _initializeShaders() {
|
|
866
|
+
let h = this.renderer!.handler;
|
|
742
867
|
|
|
743
868
|
h.addProgram(shaders.drawnode_screen_nl(), true);
|
|
744
869
|
h.addProgram(shaders.drawnode_colorPicking(), true);
|
|
745
870
|
h.addProgram(shaders.drawnode_depth(), true);
|
|
746
871
|
h.addProgram(shaders.drawnode_heightPicking(), true);
|
|
747
872
|
|
|
748
|
-
this.renderer
|
|
749
|
-
this.renderer
|
|
750
|
-
this.renderer
|
|
873
|
+
this.renderer!.addPickingCallback(this, this._renderColorPickingFramebufferPASS);
|
|
874
|
+
this.renderer!.addDepthCallback(this, this._renderDepthFramebufferPASS);
|
|
875
|
+
this.renderer!.addDistanceCallback(this, this._renderDistanceFramebufferPASS);
|
|
751
876
|
}
|
|
752
877
|
|
|
753
|
-
_onLayerLoadend(layer) {
|
|
878
|
+
protected _onLayerLoadend(layer: Layer) {
|
|
754
879
|
this.events.dispatch(this.events.layerloadend, layer);
|
|
755
880
|
}
|
|
756
881
|
|
|
757
|
-
|
|
758
|
-
* @virtual
|
|
759
|
-
* @public
|
|
760
|
-
*/
|
|
761
|
-
init() {
|
|
882
|
+
public override init() {
|
|
762
883
|
|
|
763
884
|
this._tileLoader.events.on("layerloadend", this._onLayerLoadend, this);
|
|
764
885
|
|
|
765
886
|
// Initialization indexes table
|
|
766
887
|
segmentHelper.getInstance().setMaxGridSize(this._maxGridSize);
|
|
888
|
+
|
|
767
889
|
const TABLESIZE = this._maxGridSize;
|
|
768
890
|
|
|
769
891
|
let kk = 0;
|
|
@@ -777,16 +899,14 @@ export class Planet extends RenderNode {
|
|
|
777
899
|
for (let m = 0; m <= TABLESIZE; m++) {
|
|
778
900
|
!this._indexesCache[i][j][k][m] && (this._indexesCache[i][j][k][m] = new Array(TABLESIZE));
|
|
779
901
|
for (let q = 0; q <= TABLESIZE; q++) {
|
|
780
|
-
|
|
902
|
+
|
|
903
|
+
let ptr: IndexBufferCacheData = {
|
|
781
904
|
buffer: null
|
|
782
905
|
};
|
|
783
906
|
|
|
784
907
|
if (i >= 1 && i === j && i === k && i === m && i === q) {
|
|
785
|
-
let indexes = segmentHelper
|
|
786
|
-
|
|
787
|
-
.createSegmentIndexes(i, [j, k, m, q]);
|
|
788
|
-
ptr.buffer = this.renderer.handler.createElementArrayBuffer(indexes, 1);
|
|
789
|
-
indexes = null;
|
|
908
|
+
let indexes = segmentHelper.getInstance().createSegmentIndexes(i, [j, k, m, q]);
|
|
909
|
+
ptr.buffer = this.renderer!.handler.createElementArrayBuffer(indexes, 1);
|
|
790
910
|
} else {
|
|
791
911
|
this._indexesCacheToRemove[kk++] = ptr;
|
|
792
912
|
}
|
|
@@ -798,7 +918,7 @@ export class Planet extends RenderNode {
|
|
|
798
918
|
}
|
|
799
919
|
}
|
|
800
920
|
|
|
801
|
-
this.renderer
|
|
921
|
+
this.renderer!.events.on("resize", () => {
|
|
802
922
|
this._renderCompletedActivated = false;
|
|
803
923
|
this._terrainCompletedActivated = false;
|
|
804
924
|
});
|
|
@@ -809,19 +929,16 @@ export class Planet extends RenderNode {
|
|
|
809
929
|
let texCoordCache = segmentHelper.getInstance().initTextureCoordsTable(TABLESIZE + 1);
|
|
810
930
|
|
|
811
931
|
for (let i = 0; i <= TABLESIZE; i++) {
|
|
812
|
-
this._textureCoordsBufferCache[i] = this.renderer
|
|
932
|
+
this._textureCoordsBufferCache[i] = this.renderer!.handler.createArrayBuffer(texCoordCache[i], 2, ((1 << i) + 1) * ((1 << i) + 1));
|
|
813
933
|
}
|
|
814
934
|
|
|
815
|
-
texCoordCache = null;
|
|
816
|
-
|
|
817
935
|
// creating empty textures
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
that.solidTextureTwo = t;
|
|
936
|
+
this.renderer!.handler.createDefaultTexture(null, (t: WebGLTextureExt) => {
|
|
937
|
+
this.solidTextureOne = t;
|
|
938
|
+
this.solidTextureTwo = t;
|
|
822
939
|
});
|
|
823
940
|
|
|
824
|
-
this.transparentTexture = this.renderer
|
|
941
|
+
this.transparentTexture = this.renderer!.handler.transparentTexture;
|
|
825
942
|
|
|
826
943
|
this._renderedNodesInFrustum = new Array(this.camera.frustums.length);
|
|
827
944
|
for (let i = 0, len = this._renderedNodesInFrustum.length; i < len; i++) {
|
|
@@ -831,7 +948,7 @@ export class Planet extends RenderNode {
|
|
|
831
948
|
// Creating quad trees nodes
|
|
832
949
|
this.quadTreeStrategy.init();
|
|
833
950
|
|
|
834
|
-
this.drawMode = this.renderer
|
|
951
|
+
this.drawMode = this.renderer!.handler.gl!.TRIANGLE_STRIP;
|
|
835
952
|
|
|
836
953
|
// Applying shaders
|
|
837
954
|
this._initializeShaders();
|
|
@@ -840,16 +957,35 @@ export class Planet extends RenderNode {
|
|
|
840
957
|
|
|
841
958
|
this._updateVisibleLayers();
|
|
842
959
|
|
|
843
|
-
this.renderer
|
|
960
|
+
this.renderer!.addPickingCallback(this, this._frustumEntityCollectionPickingCallback);
|
|
844
961
|
|
|
845
962
|
// loading Earth night glowing texture
|
|
846
|
-
if (this.
|
|
847
|
-
|
|
963
|
+
if (this._nightTextureSrc) {
|
|
964
|
+
|
|
965
|
+
let img = new Image();
|
|
966
|
+
img.onload = () => {
|
|
967
|
+
this._nightTexture = this.renderer!.handler.createTextureDefault(img)!;
|
|
968
|
+
this._nightTexture.default = true;
|
|
969
|
+
};
|
|
970
|
+
img.src = this._nightTextureSrc;
|
|
971
|
+
|
|
972
|
+
// createImageBitmap(NIGHT).then((e: ImageBitmap) => {
|
|
973
|
+
// this._nightTexture = this.renderer!.handler!.createTextureDefault(e);
|
|
974
|
+
// });
|
|
848
975
|
}
|
|
849
976
|
|
|
850
977
|
// load water specular mask
|
|
851
|
-
if (this.
|
|
852
|
-
|
|
978
|
+
if (this._specularTextureSrc) {
|
|
979
|
+
let img = new Image();
|
|
980
|
+
img.onload = () => {
|
|
981
|
+
this._specularTexture = this.renderer!.handler.createTextureDefault(img)!;
|
|
982
|
+
this._specularTexture.default = true;
|
|
983
|
+
};
|
|
984
|
+
img.src = this._specularTextureSrc;
|
|
985
|
+
|
|
986
|
+
// createImageBitmap(SPECULAR).then((e: ImageBitmap) => {
|
|
987
|
+
// this._specularTexture = this.renderer!.handler!.createTexture_l(e);
|
|
988
|
+
// });
|
|
853
989
|
}
|
|
854
990
|
|
|
855
991
|
this._geoImageCreator.init();
|
|
@@ -858,12 +994,12 @@ export class Planet extends RenderNode {
|
|
|
858
994
|
|
|
859
995
|
this._normalMapCreator.init();
|
|
860
996
|
|
|
861
|
-
this.renderer
|
|
997
|
+
this.renderer!.events.on("draw", this._globalPreDraw, this, -100);
|
|
862
998
|
|
|
863
999
|
// Loading first nodes for better viewing if you have started on a lower altitude.
|
|
864
1000
|
this._preRender();
|
|
865
1001
|
|
|
866
|
-
this.renderer
|
|
1002
|
+
this.renderer!.events.on("postdraw", () => {
|
|
867
1003
|
this._checkRendercompleted();
|
|
868
1004
|
});
|
|
869
1005
|
|
|
@@ -871,7 +1007,6 @@ export class Planet extends RenderNode {
|
|
|
871
1007
|
|
|
872
1008
|
this._initialized = true;
|
|
873
1009
|
|
|
874
|
-
|
|
875
1010
|
//
|
|
876
1011
|
// after init
|
|
877
1012
|
//
|
|
@@ -879,12 +1014,12 @@ export class Planet extends RenderNode {
|
|
|
879
1014
|
this.viewExtent(this._initialViewExtent);
|
|
880
1015
|
}
|
|
881
1016
|
|
|
882
|
-
this.renderer
|
|
883
|
-
this.camera.bindRenderer(this.renderer);
|
|
1017
|
+
this.renderer!.activeCamera = this.camera;
|
|
1018
|
+
this.camera.bindRenderer(this.renderer!);
|
|
884
1019
|
this.camera.update();
|
|
885
1020
|
}
|
|
886
1021
|
|
|
887
|
-
initLayers() {
|
|
1022
|
+
public initLayers() {
|
|
888
1023
|
let temp = [...this._layers];
|
|
889
1024
|
for (let i = 0; i < temp.length; i++) {
|
|
890
1025
|
this.removeLayer(temp[i]);
|
|
@@ -892,62 +1027,59 @@ export class Planet extends RenderNode {
|
|
|
892
1027
|
}
|
|
893
1028
|
}
|
|
894
1029
|
|
|
895
|
-
|
|
1030
|
+
protected _clearIndexesCache() {
|
|
896
1031
|
this._indexesCacheToRemoveCounter = 0;
|
|
897
|
-
let c = this._indexesCacheToRemove,
|
|
1032
|
+
let c = this._indexesCacheToRemove,
|
|
1033
|
+
gl = this.renderer!.handler.gl!;
|
|
898
1034
|
for (let i = 0, len = c.length; i < len; i++) {
|
|
899
1035
|
let ci = c[i];
|
|
900
|
-
gl.deleteBuffer(ci.buffer);
|
|
1036
|
+
gl.deleteBuffer(ci.buffer as WebGLBuffer);
|
|
901
1037
|
ci.buffer = null;
|
|
902
1038
|
}
|
|
903
1039
|
}
|
|
904
1040
|
|
|
905
|
-
_preRender() {
|
|
1041
|
+
protected _preRender() {
|
|
906
1042
|
this.quadTreeStrategy.preRender();
|
|
907
|
-
|
|
908
1043
|
this._preLoad();
|
|
909
1044
|
}
|
|
910
1045
|
|
|
911
|
-
_preLoad() {
|
|
1046
|
+
protected _preLoad() {
|
|
912
1047
|
this._clearRenderedNodeList();
|
|
913
|
-
|
|
914
1048
|
this._skipPreRender = false;
|
|
915
|
-
|
|
916
1049
|
this.quadTreeStrategy.preLoad();
|
|
917
1050
|
}
|
|
918
1051
|
|
|
919
1052
|
/**
|
|
920
|
-
* Creates default textures first for
|
|
1053
|
+
* Creates default textures first for the North Pole and whole globe and second for the South Pole.
|
|
921
1054
|
* @public
|
|
922
|
-
* @param{
|
|
923
|
-
* @param{
|
|
924
|
-
*/
|
|
925
|
-
createDefaultTextures(param0, param1) {
|
|
926
|
-
this.renderer
|
|
927
|
-
this.renderer
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
that.solidTextureOne = t;
|
|
1055
|
+
* @param{IDefaultTextureParams} param0 -
|
|
1056
|
+
* @param{IDefaultTextureParams} param1 -
|
|
1057
|
+
*/
|
|
1058
|
+
public createDefaultTextures(param0: IDefaultTextureParams, param1: IDefaultTextureParams) {
|
|
1059
|
+
this.renderer!.handler.gl!.deleteTexture(this.solidTextureOne!);
|
|
1060
|
+
this.renderer!.handler.gl!.deleteTexture(this.solidTextureTwo!);
|
|
1061
|
+
this.renderer!.handler.createDefaultTexture(param0, (texture: WebGLTextureExt) => {
|
|
1062
|
+
this.solidTextureOne = texture;
|
|
931
1063
|
});
|
|
932
|
-
this.renderer
|
|
933
|
-
|
|
1064
|
+
this.renderer!.handler.createDefaultTexture(param1, (texture: WebGLTextureExt) => {
|
|
1065
|
+
this.solidTextureTwo = texture;
|
|
934
1066
|
});
|
|
935
1067
|
}
|
|
936
1068
|
|
|
937
|
-
_getLayerAttributionHTML(layer) {
|
|
938
|
-
return `<div class="og-attribution__layer">${layer.
|
|
1069
|
+
protected _getLayerAttributionHTML(layer: Layer) {
|
|
1070
|
+
return `<div class="og-attribution__layer">${layer.getAttribution()}</div>`;
|
|
939
1071
|
}
|
|
940
1072
|
|
|
941
1073
|
/**
|
|
942
1074
|
* Updates attribution lists
|
|
943
1075
|
* @public
|
|
944
1076
|
*/
|
|
945
|
-
updateAttributionsList() {
|
|
1077
|
+
public updateAttributionsList() {
|
|
946
1078
|
let html = "";
|
|
947
1079
|
for (let i = 0, len = this._layers.length; i < len; i++) {
|
|
948
1080
|
let li = this._layers[i];
|
|
949
|
-
if (li.
|
|
950
|
-
if (li.
|
|
1081
|
+
if (li.getVisibility()) {
|
|
1082
|
+
if (li.getAttribution().length) {
|
|
951
1083
|
html += this._getLayerAttributionHTML(li);
|
|
952
1084
|
}
|
|
953
1085
|
}
|
|
@@ -955,15 +1087,11 @@ export class Planet extends RenderNode {
|
|
|
955
1087
|
this._applyAttribution(html)
|
|
956
1088
|
}
|
|
957
1089
|
|
|
958
|
-
updateVisibleLayers() {
|
|
1090
|
+
public updateVisibleLayers() {
|
|
959
1091
|
this._updateLayer = true;
|
|
960
1092
|
}
|
|
961
1093
|
|
|
962
|
-
|
|
963
|
-
* Updates visible layers.
|
|
964
|
-
* @public
|
|
965
|
-
*/
|
|
966
|
-
_updateVisibleLayers() {
|
|
1094
|
+
protected _updateVisibleLayers() {
|
|
967
1095
|
this.visibleTileLayers = [];
|
|
968
1096
|
this.visibleTileLayers.length = 0;
|
|
969
1097
|
|
|
@@ -973,9 +1101,9 @@ export class Planet extends RenderNode {
|
|
|
973
1101
|
let html = "";
|
|
974
1102
|
for (let i = 0, len = this._layers.length; i < len; i++) {
|
|
975
1103
|
let li = this._layers[i];
|
|
976
|
-
if (li.
|
|
977
|
-
if (li.
|
|
978
|
-
this.createDefaultTextures(li._defaultTextures[0]
|
|
1104
|
+
if (li.getVisibility()) {
|
|
1105
|
+
if (li.isBaseLayer()) {
|
|
1106
|
+
this.createDefaultTextures(li._defaultTextures[0]!, li._defaultTextures[1]!);
|
|
979
1107
|
this.baseLayer = li;
|
|
980
1108
|
}
|
|
981
1109
|
|
|
@@ -987,7 +1115,7 @@ export class Planet extends RenderNode {
|
|
|
987
1115
|
this.visibleVectorLayers.push(li);
|
|
988
1116
|
}
|
|
989
1117
|
|
|
990
|
-
if (li.
|
|
1118
|
+
if (li.getAttribution().length) {
|
|
991
1119
|
html += this._getLayerAttributionHTML(li);
|
|
992
1120
|
}
|
|
993
1121
|
|
|
@@ -1009,18 +1137,16 @@ export class Planet extends RenderNode {
|
|
|
1009
1137
|
|
|
1010
1138
|
/**
|
|
1011
1139
|
* Apply to render list of layer attributions
|
|
1012
|
-
* @
|
|
1140
|
+
* @protected
|
|
1013
1141
|
*/
|
|
1014
|
-
_applyAttribution(html) {
|
|
1015
|
-
if (this.renderer) {
|
|
1142
|
+
protected _applyAttribution(html: string) {
|
|
1143
|
+
if (this.renderer && this.renderer.div) {
|
|
1016
1144
|
if (html.length) {
|
|
1017
|
-
if (this.renderer.div.attributions
|
|
1018
|
-
|
|
1019
|
-
this.renderer.div.attributions.innerHTML = html;
|
|
1145
|
+
if (this.renderer.div.attributions!.innerHTML !== html) {
|
|
1146
|
+
this.renderer.div.attributions!.innerHTML = html;
|
|
1020
1147
|
}
|
|
1021
1148
|
} else {
|
|
1022
|
-
|
|
1023
|
-
this.renderer.div.attributions.innerHTML = "";
|
|
1149
|
+
this.renderer.div.attributions!.innerHTML = "";
|
|
1024
1150
|
}
|
|
1025
1151
|
}
|
|
1026
1152
|
}
|
|
@@ -1029,35 +1155,35 @@ export class Planet extends RenderNode {
|
|
|
1029
1155
|
* Sort visible layer - preparing for rendering.
|
|
1030
1156
|
* @protected
|
|
1031
1157
|
*/
|
|
1032
|
-
_sortLayers() {
|
|
1033
|
-
|
|
1158
|
+
protected _sortLayers() {
|
|
1159
|
+
|
|
1160
|
+
this.visibleVectorLayers.sort((a, b) => (a.getZIndex() - b.getZIndex()) || (a.getHeight() - b.getHeight()));
|
|
1034
1161
|
|
|
1035
1162
|
this._visibleTileLayerSlices = [];
|
|
1036
1163
|
this._visibleTileLayerSlices.length = 0;
|
|
1037
1164
|
|
|
1038
1165
|
if (this.visibleTileLayers.length) {
|
|
1039
|
-
this.visibleTileLayers.sort((a, b) => (a.
|
|
1166
|
+
this.visibleTileLayers.sort((a, b) => (a.getHeight() - b.getHeight()) || (a.getZIndex() - b.getZIndex()));
|
|
1040
1167
|
|
|
1041
|
-
|
|
1042
|
-
|
|
1168
|
+
let k = -1;
|
|
1169
|
+
let currHeight = this.visibleTileLayers[0].getHeight();
|
|
1043
1170
|
for (let i = 0, len = this.visibleTileLayers.length; i < len; i++) {
|
|
1044
|
-
if (i % this.SLICE_SIZE === 0 || this.visibleTileLayers[i].
|
|
1171
|
+
if (i % this.SLICE_SIZE === 0 || this.visibleTileLayers[i].getHeight() !== currHeight) {
|
|
1045
1172
|
k++;
|
|
1046
1173
|
this._visibleTileLayerSlices[k] = [];
|
|
1047
|
-
currHeight = this.visibleTileLayers[i].
|
|
1174
|
+
currHeight = this.visibleTileLayers[i].getHeight();
|
|
1048
1175
|
}
|
|
1049
1176
|
this._visibleTileLayerSlices[k].push(this.visibleTileLayers[i]);
|
|
1050
1177
|
}
|
|
1051
1178
|
}
|
|
1052
1179
|
}
|
|
1053
1180
|
|
|
1054
|
-
_clearRenderedNodeList() {
|
|
1055
|
-
// clearing all node list
|
|
1181
|
+
protected _clearRenderedNodeList() {
|
|
1056
1182
|
this._renderedNodes.length = 0;
|
|
1057
1183
|
this._renderedNodes = [];
|
|
1058
1184
|
}
|
|
1059
1185
|
|
|
1060
|
-
_clearRenderNodesInFrustum() {
|
|
1186
|
+
protected _clearRenderNodesInFrustum() {
|
|
1061
1187
|
for (let i = 0, len = this._renderedNodesInFrustum.length; i < len; i++) {
|
|
1062
1188
|
this._renderedNodesInFrustum[i].length = 0;
|
|
1063
1189
|
this._renderedNodesInFrustum[i] = [];
|
|
@@ -1068,9 +1194,10 @@ export class Planet extends RenderNode {
|
|
|
1068
1194
|
* Collects visible quad nodes.
|
|
1069
1195
|
* @protected
|
|
1070
1196
|
*/
|
|
1071
|
-
_collectRenderNodes() {
|
|
1197
|
+
protected _collectRenderNodes() {
|
|
1072
1198
|
let cam = this.camera;
|
|
1073
1199
|
this._lodSize = math.lerp(cam.slope < 0.0 ? 0.0 : cam.slope, this._curLodSize, this._minLodSize);
|
|
1200
|
+
|
|
1074
1201
|
cam._insideSegment = null;
|
|
1075
1202
|
|
|
1076
1203
|
// clear first
|
|
@@ -1099,7 +1226,7 @@ export class Planet extends RenderNode {
|
|
|
1099
1226
|
this._renderedNodes = [];
|
|
1100
1227
|
|
|
1101
1228
|
for (let i = 0, len = temp.length; i < len; i++) {
|
|
1102
|
-
|
|
1229
|
+
let ri = temp[i];
|
|
1103
1230
|
let ht = ri.segment.centerNormal.dot(cam._b);
|
|
1104
1231
|
if (ri.segment.tileZoom === this.maxCurrZoom || ht < HORIZON_TANGENT) {
|
|
1105
1232
|
this._renderedNodes.push(ri);
|
|
@@ -1122,12 +1249,12 @@ export class Planet extends RenderNode {
|
|
|
1122
1249
|
}
|
|
1123
1250
|
}
|
|
1124
1251
|
|
|
1125
|
-
_globalPreDraw() {
|
|
1252
|
+
protected _globalPreDraw() {
|
|
1126
1253
|
let cam = this.camera;
|
|
1127
1254
|
|
|
1128
1255
|
// Might be it's better to replace it in setTerrain,
|
|
1129
1256
|
// but we have to be sure that setTerrain exists with renderer insttance
|
|
1130
|
-
this.renderer
|
|
1257
|
+
this.renderer!.__useDistanceFramebuffer__ = !this.terrain!.isEmpty;
|
|
1131
1258
|
|
|
1132
1259
|
this._distBeforeMemClear += this._prevCamEye.distance(cam.eye);
|
|
1133
1260
|
this._prevCamEye.copy(cam.eye);
|
|
@@ -1135,12 +1262,12 @@ export class Planet extends RenderNode {
|
|
|
1135
1262
|
|
|
1136
1263
|
// free memory
|
|
1137
1264
|
if (this._createdNodesCount > MAX_NODES && this._distBeforeMemClear > 1000.0) {
|
|
1138
|
-
this.terrain
|
|
1265
|
+
this.terrain!.clearCache();
|
|
1139
1266
|
this.memClear();
|
|
1140
1267
|
}
|
|
1141
1268
|
|
|
1142
1269
|
if (this._indexesCacheToRemoveCounter > 600) {
|
|
1143
|
-
this.
|
|
1270
|
+
this._clearIndexesCache();
|
|
1144
1271
|
}
|
|
1145
1272
|
}
|
|
1146
1273
|
|
|
@@ -1148,7 +1275,7 @@ export class Planet extends RenderNode {
|
|
|
1148
1275
|
* Render node callback.
|
|
1149
1276
|
* @public
|
|
1150
1277
|
*/
|
|
1151
|
-
preFrame() {
|
|
1278
|
+
public override preFrame() {
|
|
1152
1279
|
|
|
1153
1280
|
if (this._updateLayer) {
|
|
1154
1281
|
this._updateLayer = false;
|
|
@@ -1161,6 +1288,7 @@ export class Planet extends RenderNode {
|
|
|
1161
1288
|
if (this._skipPreRender && this._collectRenderNodesIsActive) {
|
|
1162
1289
|
this._collectRenderNodes();
|
|
1163
1290
|
}
|
|
1291
|
+
|
|
1164
1292
|
this._skipPreRender = true;
|
|
1165
1293
|
|
|
1166
1294
|
this.transformLights();
|
|
@@ -1171,14 +1299,14 @@ export class Planet extends RenderNode {
|
|
|
1171
1299
|
// Creating geoImages textures.
|
|
1172
1300
|
this._geoImageCreator.frame();
|
|
1173
1301
|
|
|
1174
|
-
// Vector tiles
|
|
1302
|
+
// Vector tiles rasterization
|
|
1175
1303
|
this._vectorTileCreator.frame();
|
|
1176
1304
|
|
|
1177
1305
|
this.camera.checkTerrainCollision();
|
|
1178
1306
|
this.camera.update();
|
|
1179
1307
|
|
|
1180
1308
|
// Here is the planet node dispatches a draw event before
|
|
1181
|
-
// rendering begins and we have got render nodes.
|
|
1309
|
+
// rendering begins, and we have got render nodes.
|
|
1182
1310
|
this.events.dispatch(this.events.draw, this);
|
|
1183
1311
|
|
|
1184
1312
|
// Collect entity collections from vector layers
|
|
@@ -1191,12 +1319,13 @@ export class Planet extends RenderNode {
|
|
|
1191
1319
|
/**
|
|
1192
1320
|
* Render node callback.
|
|
1193
1321
|
* @public
|
|
1322
|
+
* @override
|
|
1194
1323
|
*/
|
|
1195
|
-
frame() {
|
|
1324
|
+
public override frame() {
|
|
1196
1325
|
this._renderScreenNodesPASS();
|
|
1197
1326
|
}
|
|
1198
1327
|
|
|
1199
|
-
_checkRendercompleted() {
|
|
1328
|
+
protected _checkRendercompleted() {
|
|
1200
1329
|
if (this._renderCompleted) {
|
|
1201
1330
|
if (!this._renderCompletedActivated) {
|
|
1202
1331
|
this._renderCompletedActivated = true;
|
|
@@ -1219,23 +1348,23 @@ export class Planet extends RenderNode {
|
|
|
1219
1348
|
this._terrainCompleted = true;
|
|
1220
1349
|
}
|
|
1221
1350
|
|
|
1222
|
-
lockQuadTree() {
|
|
1351
|
+
public lockQuadTree() {
|
|
1223
1352
|
this._collectRenderNodesIsActive = false;
|
|
1224
1353
|
this.camera.setTerrainCollisionActivity(false);
|
|
1225
1354
|
}
|
|
1226
1355
|
|
|
1227
|
-
unlockQuadTree() {
|
|
1356
|
+
public unlockQuadTree() {
|
|
1228
1357
|
this._collectRenderNodesIsActive = true;
|
|
1229
1358
|
this.camera.setTerrainCollisionActivity(true);
|
|
1230
1359
|
}
|
|
1231
1360
|
|
|
1232
|
-
_renderScreenNodesPASSNoAtmos() {
|
|
1361
|
+
protected _renderScreenNodesPASSNoAtmos() {
|
|
1233
1362
|
|
|
1234
1363
|
let sh, shu;
|
|
1235
|
-
let renderer = this.renderer
|
|
1364
|
+
let renderer = this.renderer!;
|
|
1236
1365
|
let h = renderer.handler;
|
|
1237
|
-
let gl = h.gl
|
|
1238
|
-
let cam = renderer.activeCamera
|
|
1366
|
+
let gl = h.gl!;
|
|
1367
|
+
let cam = (renderer.activeCamera as PlanetCamera)!;
|
|
1239
1368
|
let firstPass = cam.isFirstPass;
|
|
1240
1369
|
let frustumIndex = cam.currentFrustumIndex;
|
|
1241
1370
|
|
|
@@ -1268,11 +1397,11 @@ export class Planet extends RenderNode {
|
|
|
1268
1397
|
// Night and specular
|
|
1269
1398
|
//
|
|
1270
1399
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE);
|
|
1271
|
-
gl.bindTexture(gl.TEXTURE_2D, this._nightTexture || this.transparentTexture);
|
|
1400
|
+
gl.bindTexture(gl.TEXTURE_2D, this._nightTexture as WebGLTextureExt || this.transparentTexture as WebGLTextureExt);
|
|
1272
1401
|
gl.uniform1i(shu.nightTexture, this.SLICE_SIZE);
|
|
1273
1402
|
|
|
1274
1403
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE + 1);
|
|
1275
|
-
gl.bindTexture(gl.TEXTURE_2D, this._specularTexture || this.transparentTexture);
|
|
1404
|
+
gl.bindTexture(gl.TEXTURE_2D, this._specularTexture as WebGLTextureExt || this.transparentTexture as WebGLTexture);
|
|
1276
1405
|
gl.uniform1i(shu.specularTexture, this.SLICE_SIZE + 1);
|
|
1277
1406
|
|
|
1278
1407
|
gl.uniform1f(shu.camHeight, cam.getHeight());
|
|
@@ -1304,8 +1433,8 @@ export class Planet extends RenderNode {
|
|
|
1304
1433
|
}
|
|
1305
1434
|
}
|
|
1306
1435
|
|
|
1307
|
-
let isEq = this.terrain
|
|
1308
|
-
|
|
1436
|
+
let isEq = this.terrain!.equalizeVertices;
|
|
1437
|
+
let i = rn.length;
|
|
1309
1438
|
while (i--) {
|
|
1310
1439
|
let s = rn[i].segment;
|
|
1311
1440
|
isEq && s.equalize();
|
|
@@ -1334,16 +1463,13 @@ export class Planet extends RenderNode {
|
|
|
1334
1463
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1335
1464
|
}
|
|
1336
1465
|
|
|
1337
|
-
|
|
1338
|
-
* @protected
|
|
1339
|
-
*/
|
|
1340
|
-
_renderScreenNodesPASSAtmos() {
|
|
1466
|
+
protected _renderScreenNodesPASSAtmos() {
|
|
1341
1467
|
|
|
1342
1468
|
let sh, shu;
|
|
1343
|
-
let renderer = this.renderer
|
|
1469
|
+
let renderer = this.renderer!;
|
|
1344
1470
|
let h = renderer.handler;
|
|
1345
|
-
let gl = h.gl
|
|
1346
|
-
let cam = renderer.activeCamera
|
|
1471
|
+
let gl = h.gl!;
|
|
1472
|
+
let cam = (renderer.activeCamera as PlanetCamera)!;
|
|
1347
1473
|
let firstPass = cam.isFirstPass;
|
|
1348
1474
|
let frustumIndex = cam.currentFrustumIndex;
|
|
1349
1475
|
|
|
@@ -1378,23 +1504,22 @@ export class Planet extends RenderNode {
|
|
|
1378
1504
|
// Night and specular
|
|
1379
1505
|
//
|
|
1380
1506
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE);
|
|
1381
|
-
gl.bindTexture(gl.TEXTURE_2D, this._nightTexture || this.transparentTexture);
|
|
1507
|
+
gl.bindTexture(gl.TEXTURE_2D, this._nightTexture as WebGLTexture || this.transparentTexture as WebGLTexture);
|
|
1382
1508
|
gl.uniform1i(shu.nightTexture, this.SLICE_SIZE);
|
|
1383
1509
|
|
|
1384
1510
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE + 1);
|
|
1385
|
-
gl.bindTexture(gl.TEXTURE_2D, this._specularTexture || this.transparentTexture);
|
|
1511
|
+
gl.bindTexture(gl.TEXTURE_2D, this._specularTexture as WebGLTexture || this.transparentTexture as WebGLTexture);
|
|
1386
1512
|
gl.uniform1i(shu.specularTexture, this.SLICE_SIZE + 1);
|
|
1387
1513
|
|
|
1388
|
-
|
|
1389
1514
|
//
|
|
1390
1515
|
// atmos precomputed textures
|
|
1391
1516
|
//
|
|
1392
1517
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE + 4);
|
|
1393
|
-
gl.bindTexture(gl.TEXTURE_2D,
|
|
1518
|
+
gl.bindTexture(gl.TEXTURE_2D, (renderer.controls.Atmosphere as Atmosphere)._transmittanceBuffer!.textures[0]);
|
|
1394
1519
|
gl.uniform1i(shu.transmittanceTexture, this.SLICE_SIZE + 4);
|
|
1395
1520
|
|
|
1396
1521
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE + 5);
|
|
1397
|
-
gl.bindTexture(gl.TEXTURE_2D,
|
|
1522
|
+
gl.bindTexture(gl.TEXTURE_2D, (renderer.controls.Atmosphere as Atmosphere)._scatteringBuffer!.textures[0]);
|
|
1398
1523
|
gl.uniform1i(shu.scatteringTexture, this.SLICE_SIZE + 5);
|
|
1399
1524
|
|
|
1400
1525
|
gl.uniform1f(shu.camHeight, cam.getHeight());
|
|
@@ -1426,8 +1551,8 @@ export class Planet extends RenderNode {
|
|
|
1426
1551
|
}
|
|
1427
1552
|
}
|
|
1428
1553
|
|
|
1429
|
-
let isEq = this.terrain
|
|
1430
|
-
|
|
1554
|
+
let isEq = this.terrain!.equalizeVertices;
|
|
1555
|
+
let i = rn.length;
|
|
1431
1556
|
while (i--) {
|
|
1432
1557
|
let s = rn[i].segment;
|
|
1433
1558
|
isEq && s.equalize();
|
|
@@ -1454,24 +1579,21 @@ export class Planet extends RenderNode {
|
|
|
1454
1579
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1455
1580
|
}
|
|
1456
1581
|
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
*/
|
|
1460
|
-
_renderDistanceFramebufferPASS() {
|
|
1461
|
-
if (!this.terrain.isEmpty) {
|
|
1582
|
+
protected _renderDistanceFramebufferPASS() {
|
|
1583
|
+
if (!this.terrain!.isEmpty) {
|
|
1462
1584
|
|
|
1463
1585
|
let sh;
|
|
1464
|
-
let renderer = this.renderer
|
|
1586
|
+
let renderer = this.renderer!;
|
|
1465
1587
|
let h = renderer.handler;
|
|
1466
|
-
let gl = h.gl
|
|
1467
|
-
let cam = renderer.activeCamera
|
|
1588
|
+
let gl = h.gl!;
|
|
1589
|
+
let cam = (renderer.activeCamera as PlanetCamera)!;
|
|
1468
1590
|
|
|
1469
1591
|
h.programs.drawnode_heightPicking.activate();
|
|
1470
1592
|
sh = h.programs.drawnode_heightPicking._program;
|
|
1471
1593
|
let shu = sh.uniforms;
|
|
1472
1594
|
|
|
1473
|
-
gl.uniformMatrix4fv(shu.viewMatrix, false,
|
|
1474
|
-
gl.uniformMatrix4fv(shu.projectionMatrix, false,
|
|
1595
|
+
gl.uniformMatrix4fv(shu.viewMatrix, false, cam.getViewMatrix());
|
|
1596
|
+
gl.uniformMatrix4fv(shu.projectionMatrix, false, cam.getProjectionMatrix());
|
|
1475
1597
|
|
|
1476
1598
|
gl.uniform3fv(shu.eyePositionHigh, cam.eyeHigh);
|
|
1477
1599
|
gl.uniform3fv(shu.eyePositionLow, cam.eyeLow);
|
|
@@ -1487,18 +1609,15 @@ export class Planet extends RenderNode {
|
|
|
1487
1609
|
}
|
|
1488
1610
|
}
|
|
1489
1611
|
|
|
1490
|
-
|
|
1491
|
-
* @protected
|
|
1492
|
-
*/
|
|
1493
|
-
_renderColorPickingFramebufferPASS() {
|
|
1612
|
+
protected _renderColorPickingFramebufferPASS() {
|
|
1494
1613
|
let sh;
|
|
1495
|
-
let renderer = this.renderer
|
|
1614
|
+
let renderer = this.renderer!;
|
|
1496
1615
|
let h = renderer.handler;
|
|
1497
|
-
let gl = h.gl
|
|
1616
|
+
let gl = h.gl!;
|
|
1498
1617
|
h.programs.drawnode_colorPicking.activate();
|
|
1499
1618
|
sh = h.programs.drawnode_colorPicking._program;
|
|
1500
1619
|
let shu = sh.uniforms;
|
|
1501
|
-
let cam = renderer.activeCamera
|
|
1620
|
+
let cam = renderer.activeCamera!;
|
|
1502
1621
|
|
|
1503
1622
|
// Special blend
|
|
1504
1623
|
// gl.enable(gl.BLEND);
|
|
@@ -1533,18 +1652,15 @@ export class Planet extends RenderNode {
|
|
|
1533
1652
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1534
1653
|
}
|
|
1535
1654
|
|
|
1536
|
-
|
|
1537
|
-
* @protected
|
|
1538
|
-
*/
|
|
1539
|
-
_renderDepthFramebufferPASS() {
|
|
1655
|
+
protected _renderDepthFramebufferPASS() {
|
|
1540
1656
|
let sh;
|
|
1541
|
-
let renderer = this.renderer
|
|
1657
|
+
let renderer = this.renderer!;
|
|
1542
1658
|
let h = renderer.handler;
|
|
1543
|
-
let gl = h.gl
|
|
1659
|
+
let gl = h.gl!;
|
|
1544
1660
|
h.programs.drawnode_depth.activate();
|
|
1545
1661
|
sh = h.programs.drawnode_depth._program;
|
|
1546
1662
|
let shu = sh.uniforms;
|
|
1547
|
-
let cam = renderer.activeCamera
|
|
1663
|
+
let cam = renderer.activeCamera!;
|
|
1548
1664
|
|
|
1549
1665
|
gl.disable(gl.BLEND);
|
|
1550
1666
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
@@ -1569,13 +1685,13 @@ export class Planet extends RenderNode {
|
|
|
1569
1685
|
gl.enable(gl.BLEND);
|
|
1570
1686
|
}
|
|
1571
1687
|
|
|
1572
|
-
_collectVectorLayerCollections() {
|
|
1688
|
+
protected _collectVectorLayerCollections() {
|
|
1573
1689
|
this._frustumEntityCollections.length = 0;
|
|
1574
1690
|
this._frustumEntityCollections = [];
|
|
1575
1691
|
|
|
1576
1692
|
let i = this.visibleVectorLayers.length;
|
|
1577
1693
|
while (i--) {
|
|
1578
|
-
let vi = this.visibleVectorLayers[i];
|
|
1694
|
+
let vi = this.visibleVectorLayers[i] as Vector;
|
|
1579
1695
|
|
|
1580
1696
|
if (vi._fading && vi._refreshFadingOpacity()) {
|
|
1581
1697
|
this.visibleVectorLayers.splice(i, 1);
|
|
@@ -1586,11 +1702,7 @@ export class Planet extends RenderNode {
|
|
|
1586
1702
|
}
|
|
1587
1703
|
}
|
|
1588
1704
|
|
|
1589
|
-
|
|
1590
|
-
* Vector layers picking pass.
|
|
1591
|
-
* @protected
|
|
1592
|
-
*/
|
|
1593
|
-
_frustumEntityCollectionPickingCallback() {
|
|
1705
|
+
protected _frustumEntityCollectionPickingCallback() {
|
|
1594
1706
|
this.drawPickingEntityCollections(this._frustumEntityCollections);
|
|
1595
1707
|
}
|
|
1596
1708
|
|
|
@@ -1598,7 +1710,7 @@ export class Planet extends RenderNode {
|
|
|
1598
1710
|
* Starts clear memory thread.
|
|
1599
1711
|
* @public
|
|
1600
1712
|
*/
|
|
1601
|
-
memClear() {
|
|
1713
|
+
public memClear() {
|
|
1602
1714
|
this._distBeforeMemClear = 0;
|
|
1603
1715
|
|
|
1604
1716
|
this.camera._insideSegment = null;
|
|
@@ -1608,7 +1720,7 @@ export class Planet extends RenderNode {
|
|
|
1608
1720
|
this._normalMapCreator.lock(this._memKey);
|
|
1609
1721
|
|
|
1610
1722
|
this._normalMapCreator.clear();
|
|
1611
|
-
this.terrain
|
|
1723
|
+
this.terrain!.abortLoading();
|
|
1612
1724
|
this._tileLoader.abortAll();
|
|
1613
1725
|
|
|
1614
1726
|
this.quadTreeStrategy.clear();
|
|
@@ -1621,141 +1733,130 @@ export class Planet extends RenderNode {
|
|
|
1621
1733
|
|
|
1622
1734
|
/**
|
|
1623
1735
|
* Returns ray vector hit ellipsoid coordinates.
|
|
1624
|
-
* If the ray doesn't hit
|
|
1736
|
+
* If the ray doesn't hit ellipsoid it returns 'undefined'.
|
|
1625
1737
|
* @public
|
|
1626
|
-
* @param {Ray} ray - Ray
|
|
1627
|
-
* @returns {Vec3} -
|
|
1738
|
+
* @param {Ray} ray - Ray.
|
|
1739
|
+
* @returns {Vec3 | undefined} -
|
|
1628
1740
|
*/
|
|
1629
|
-
getRayIntersectionEllipsoid(ray) {
|
|
1741
|
+
public getRayIntersectionEllipsoid(ray: Ray): Vec3 | undefined {
|
|
1630
1742
|
return this.ellipsoid.hitRay(ray.origin, ray.direction);
|
|
1631
1743
|
}
|
|
1632
1744
|
|
|
1633
1745
|
/**
|
|
1634
|
-
*
|
|
1746
|
+
* Project screen coordinates to the planet ellipsoid.
|
|
1635
1747
|
* @public
|
|
1636
|
-
* @param {
|
|
1637
|
-
* @returns {Vec3} -
|
|
1748
|
+
* @param {Vec2 | IBaseInputState } px - Screen coordinates.
|
|
1749
|
+
* @returns {Vec3 | undefined} - Cartesian coordinates.
|
|
1638
1750
|
*/
|
|
1639
|
-
getCartesianFromPixelEllipsoid(px) {
|
|
1640
|
-
|
|
1751
|
+
public getCartesianFromPixelEllipsoid(px: Vec2 | IBaseInputState): Vec3 | undefined {
|
|
1752
|
+
let cam = this.renderer!.activeCamera!;
|
|
1641
1753
|
return this.ellipsoid.hitRay(cam.eye, cam.unproject(px.x, px.y));
|
|
1642
1754
|
}
|
|
1643
1755
|
|
|
1644
1756
|
/**
|
|
1645
|
-
*
|
|
1757
|
+
* Project screen coordinates to the planet ellipsoid.
|
|
1646
1758
|
* @public
|
|
1647
|
-
* @param {
|
|
1648
|
-
* @returns {LonLat} -
|
|
1759
|
+
* @param {Vec2 | IBaseInputState} px - Screen coordinates.
|
|
1760
|
+
* @returns {LonLat | undefined} - Geodetic coordinates.
|
|
1649
1761
|
*/
|
|
1650
|
-
getLonLatFromPixelEllipsoid(px) {
|
|
1651
|
-
|
|
1762
|
+
public getLonLatFromPixelEllipsoid(px: Vec2): LonLat | undefined {
|
|
1763
|
+
let coords = this.getCartesianFromPixelEllipsoid(px);
|
|
1652
1764
|
if (coords) {
|
|
1653
1765
|
return this.ellipsoid.cartesianToLonLat(coords);
|
|
1654
1766
|
}
|
|
1655
|
-
return null;
|
|
1656
1767
|
}
|
|
1657
1768
|
|
|
1658
1769
|
/**
|
|
1659
|
-
* Returns
|
|
1660
|
-
* position or null if mouse cursor is outside the planet.
|
|
1770
|
+
* Returns mouse position cartesian coordinates on the current terrain.
|
|
1661
1771
|
* @public
|
|
1662
|
-
* @returns {Vec3} -
|
|
1772
|
+
* @returns {Vec3 | undefined} -
|
|
1663
1773
|
*/
|
|
1664
|
-
getCartesianFromMouseTerrain() {
|
|
1665
|
-
|
|
1666
|
-
|
|
1774
|
+
public getCartesianFromMouseTerrain(): Vec3 | undefined {
|
|
1775
|
+
let ms = this.renderer!.events.mouseState;
|
|
1776
|
+
let distance = this.getDistanceFromPixel(ms);
|
|
1667
1777
|
if (distance) {
|
|
1668
|
-
return ms.direction.scaleTo(distance).addA(this.renderer
|
|
1778
|
+
return ms.direction.scaleTo(distance).addA(this.renderer!.activeCamera!.eye);
|
|
1669
1779
|
}
|
|
1670
|
-
return null;
|
|
1671
1780
|
}
|
|
1672
1781
|
|
|
1673
1782
|
/**
|
|
1674
|
-
* Returns
|
|
1783
|
+
* Returns screen coordinates cartesian coordinates on the current terrain.
|
|
1675
1784
|
* position or null if input coordinates is outside the planet.
|
|
1676
1785
|
* @public
|
|
1677
1786
|
* @param {Vec2} px - Pixel screen 2d coordinates.
|
|
1678
|
-
* @
|
|
1679
|
-
* @returns {Vec3 | null} -
|
|
1787
|
+
* @returns {Vec3 | undefined} -
|
|
1680
1788
|
*/
|
|
1681
|
-
getCartesianFromPixelTerrain(px) {
|
|
1682
|
-
|
|
1789
|
+
public getCartesianFromPixelTerrain(px: Vec2 | IBaseInputState): Vec3 | undefined {
|
|
1790
|
+
let distance = this.getDistanceFromPixel(px);
|
|
1683
1791
|
if (distance) {
|
|
1684
|
-
|
|
1685
|
-
return direction.scaleTo(distance).addA(this.renderer
|
|
1792
|
+
let direction = (px as IBaseInputState).direction || this.renderer!.activeCamera!.unproject(px.x, px.y);
|
|
1793
|
+
return direction.scaleTo(distance).addA(this.renderer!.activeCamera!.eye);
|
|
1686
1794
|
}
|
|
1687
|
-
return null;
|
|
1688
1795
|
}
|
|
1689
1796
|
|
|
1690
1797
|
/**
|
|
1691
|
-
* Returns
|
|
1798
|
+
* Returns geodetic coordinates on the current terrain planet by its screen coordinates.
|
|
1692
1799
|
* position or null if input coordinates is outside the planet.
|
|
1693
1800
|
* @public
|
|
1694
|
-
* @param {Vec2} px - Pixel screen 2d coordinates.
|
|
1695
|
-
* @
|
|
1696
|
-
* @returns {LonLat} -
|
|
1801
|
+
* @param {Vec2 | IBaseInputState} px - Pixel screen 2d coordinates.
|
|
1802
|
+
* @returns {LonLat | undefined} -
|
|
1697
1803
|
*/
|
|
1698
|
-
getLonLatFromPixelTerrain(px) {
|
|
1699
|
-
|
|
1804
|
+
public getLonLatFromPixelTerrain(px: Vec2 | IBaseInputState): LonLat | undefined {
|
|
1805
|
+
let coords = this.getCartesianFromPixelTerrain(px);
|
|
1700
1806
|
if (coords) {
|
|
1701
1807
|
return this.ellipsoid.cartesianToLonLat(coords);
|
|
1702
1808
|
}
|
|
1703
|
-
return null;
|
|
1704
1809
|
}
|
|
1705
1810
|
|
|
1706
1811
|
/**
|
|
1707
|
-
*
|
|
1812
|
+
* Project cartesian coordinates to screen space.
|
|
1708
1813
|
* @public
|
|
1709
1814
|
* @param {Vec3} coords - Cartesian coordinates.
|
|
1710
|
-
* @returns {Vec2} -
|
|
1815
|
+
* @returns {Vec2} - Screen coordinates.
|
|
1711
1816
|
*/
|
|
1712
|
-
getPixelFromCartesian(coords) {
|
|
1713
|
-
return this.renderer
|
|
1817
|
+
public getPixelFromCartesian(coords: Vec3): Vec2 {
|
|
1818
|
+
return this.renderer!.activeCamera!.project(coords);
|
|
1714
1819
|
}
|
|
1715
1820
|
|
|
1716
1821
|
/**
|
|
1717
|
-
*
|
|
1822
|
+
* Project geodetic coordinates to screen space.
|
|
1718
1823
|
* @public
|
|
1719
|
-
* @param {LonLat} lonlat -
|
|
1720
|
-
* @returns {Vec2} -
|
|
1824
|
+
* @param {LonLat} lonlat - Geodetic coordinates.
|
|
1825
|
+
* @returns {Vec2 | undefined} - Screen coordinates.
|
|
1721
1826
|
*/
|
|
1722
|
-
getPixelFromLonLat(lonlat) {
|
|
1723
|
-
|
|
1827
|
+
public getPixelFromLonLat(lonlat: LonLat): Vec2 | undefined {
|
|
1828
|
+
let coords = this.ellipsoid.lonLatToCartesian(lonlat);
|
|
1724
1829
|
if (coords) {
|
|
1725
|
-
return this.renderer
|
|
1830
|
+
return this.renderer!.activeCamera!.project(coords);
|
|
1726
1831
|
}
|
|
1727
|
-
return null;
|
|
1728
1832
|
}
|
|
1729
1833
|
|
|
1730
1834
|
/**
|
|
1731
|
-
* Returns distance from active camera to the
|
|
1732
|
-
* coordinates unprojected by 2d screen coordinates, or null if screen coordinates outside the planet.
|
|
1835
|
+
* Returns distance from an active (screen) camera to the planet ellipsoid.
|
|
1733
1836
|
* @public
|
|
1734
1837
|
* @param {Vec2} px - Screen coordinates.
|
|
1735
1838
|
* @returns {number} -
|
|
1736
1839
|
*/
|
|
1737
|
-
getDistanceFromPixelEllipsoid(px) {
|
|
1738
|
-
|
|
1739
|
-
|
|
1840
|
+
public getDistanceFromPixelEllipsoid(px: Vec2 | IBaseInputState): number | undefined {
|
|
1841
|
+
let coords = this.getCartesianFromPixelEllipsoid(px);
|
|
1842
|
+
if (coords) {
|
|
1843
|
+
return coords.distance(this.renderer!.activeCamera!.eye);
|
|
1844
|
+
}
|
|
1740
1845
|
}
|
|
1741
1846
|
|
|
1742
1847
|
/**
|
|
1743
|
-
* Returns distance from active camera to the
|
|
1744
|
-
* by 2d screen coordinates, or null if screen coordinates outside the planet.
|
|
1745
|
-
* If screen coordinates inside the planet but relief is not exists in the
|
|
1746
|
-
* point than function returns distance to the planet ellipsoid.
|
|
1848
|
+
* Returns distance from active (screen) camera to the planet terrain by screen coordinates.
|
|
1747
1849
|
* @public
|
|
1748
|
-
* @param {Vec2} px - Screen coordinates.
|
|
1749
|
-
* @
|
|
1750
|
-
* @returns {number} -
|
|
1850
|
+
* @param {Vec2 | IBaseInputState} px - Screen coordinates.
|
|
1851
|
+
* @returns {number | undefined} -
|
|
1751
1852
|
*/
|
|
1752
|
-
getDistanceFromPixel(px) {
|
|
1753
|
-
if (this.terrain
|
|
1853
|
+
public getDistanceFromPixel(px: Vec2 | IBaseInputState): number {
|
|
1854
|
+
if (this.terrain!.isEmpty) {
|
|
1754
1855
|
return this.getDistanceFromPixelEllipsoid(px) || 0;
|
|
1755
1856
|
} else {
|
|
1756
1857
|
|
|
1757
|
-
let r = this.renderer
|
|
1758
|
-
let cnv =
|
|
1858
|
+
let r = this.renderer!;
|
|
1859
|
+
let cnv = r.handler!.canvas!;
|
|
1759
1860
|
|
|
1760
1861
|
let spx = px.x / cnv.width;
|
|
1761
1862
|
let spy = (cnv.height - px.y) / cnv.height;
|
|
@@ -1771,17 +1872,17 @@ export class Planet extends RenderNode {
|
|
|
1771
1872
|
if (!(_tempPickingPix_[0] || _tempPickingPix_[1] || _tempPickingPix_[2])) {
|
|
1772
1873
|
dist = this.getDistanceFromPixelEllipsoid(px) || 0;
|
|
1773
1874
|
} else if (dist < DEPTH_DISTANCE) {
|
|
1774
|
-
r.screenDepthFramebuffer
|
|
1875
|
+
r.screenDepthFramebuffer!.activate();
|
|
1775
1876
|
|
|
1776
1877
|
//if (r.screenDepthFramebuffer.isComplete()) {
|
|
1777
|
-
r.screenDepthFramebuffer
|
|
1878
|
+
r.screenDepthFramebuffer!.readPixels(_tempDepthColor_, spx, spy);
|
|
1778
1879
|
let screenPos = new Vec4(spx * 2.0 - 1.0, spy * 2.0 - 1.0, (_tempDepthColor_[0] / 255.0) * 2.0 - 1.0, 1.0 * 2.0 - 1.0);
|
|
1779
|
-
let viewPosition = this.camera.frustums[0].
|
|
1780
|
-
let dir = px.direction ||
|
|
1781
|
-
dist = -(viewPosition.z / viewPosition.w) / dir.dot(
|
|
1880
|
+
let viewPosition = this.camera.frustums[0].inverseProjectionMatrix.mulVec4(screenPos);
|
|
1881
|
+
let dir = (px as IBaseInputState).direction || r.activeCamera!.unproject(px.x, px.y);
|
|
1882
|
+
dist = -(viewPosition.z / viewPosition.w) / dir.dot(r.activeCamera!.getForward());
|
|
1782
1883
|
//}
|
|
1783
1884
|
|
|
1784
|
-
r.screenDepthFramebuffer
|
|
1885
|
+
r.screenDepthFramebuffer!.deactivate();
|
|
1785
1886
|
}
|
|
1786
1887
|
return dist;
|
|
1787
1888
|
}
|
|
@@ -1792,7 +1893,7 @@ export class Planet extends RenderNode {
|
|
|
1792
1893
|
* @public
|
|
1793
1894
|
* @param {Extent} extent - Geographical extent.
|
|
1794
1895
|
*/
|
|
1795
|
-
viewExtent(extent) {
|
|
1896
|
+
public viewExtent(extent: Extent) {
|
|
1796
1897
|
if (this.camera) {
|
|
1797
1898
|
this.camera.viewExtent(extent);
|
|
1798
1899
|
} else {
|
|
@@ -1801,96 +1902,120 @@ export class Planet extends RenderNode {
|
|
|
1801
1902
|
}
|
|
1802
1903
|
|
|
1803
1904
|
/**
|
|
1804
|
-
*
|
|
1905
|
+
* Fits camera position for the view extent.
|
|
1805
1906
|
* @public
|
|
1806
1907
|
* @param {Array.<number>} extentArr - Geographical extent array, (exactly 4 entries)
|
|
1807
1908
|
* where index 0 - southwest longitude, 1 - latitude southwest, 2 - longitude northeast, 3 - latitude northeast.
|
|
1808
1909
|
*/
|
|
1809
|
-
viewExtentArr(extentArr) {
|
|
1910
|
+
public viewExtentArr(extentArr: NumberArray4) {
|
|
1810
1911
|
this.viewExtent(new Extent(new LonLat(extentArr[0], extentArr[1]), new LonLat(extentArr[2], extentArr[3])));
|
|
1811
1912
|
}
|
|
1812
1913
|
|
|
1813
1914
|
/**
|
|
1814
|
-
* Gets current
|
|
1915
|
+
* Gets current camera view extent.
|
|
1815
1916
|
* @public
|
|
1816
1917
|
* @returns {Extent} -
|
|
1817
1918
|
*/
|
|
1818
|
-
getViewExtent() {
|
|
1919
|
+
public getViewExtent(): Extent {
|
|
1819
1920
|
return this._viewExtent;
|
|
1820
1921
|
}
|
|
1821
1922
|
|
|
1822
1923
|
/**
|
|
1823
1924
|
* Sets camera to the planet geographical position.
|
|
1824
1925
|
* @public
|
|
1825
|
-
* @param {LonLat} lonlat -
|
|
1826
|
-
* @param {
|
|
1926
|
+
* @param {LonLat} lonlat - Camera position.
|
|
1927
|
+
* @param {LonLat} [lookLonLat] - Viewpoint.
|
|
1928
|
+
* @param {Vec3} [up] - Camera up vector.
|
|
1827
1929
|
*/
|
|
1828
|
-
viewLonLat(lonlat, up) {
|
|
1829
|
-
this.
|
|
1930
|
+
public viewLonLat(lonlat: LonLat, lookLonLat?: LonLat, up?: Vec3) {
|
|
1931
|
+
this.camera.setLonLat(lonlat, lookLonLat, up);
|
|
1830
1932
|
}
|
|
1831
1933
|
|
|
1832
1934
|
/**
|
|
1833
|
-
* Fly camera to the
|
|
1935
|
+
* Fly active camera to the view extent.
|
|
1834
1936
|
* @public
|
|
1835
1937
|
* @param {Extent} extent - Geographical extent.
|
|
1836
1938
|
* @param {Number} [height] - Height on the end of the flight route.
|
|
1837
1939
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1838
1940
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
1839
|
-
* @param {
|
|
1840
|
-
* @param {
|
|
1941
|
+
* @param {Function} [startCallback] - Callback that calls before the flying begins.
|
|
1942
|
+
* @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
|
|
1841
1943
|
*/
|
|
1842
|
-
flyExtent(
|
|
1944
|
+
public flyExtent(
|
|
1945
|
+
extent: Extent,
|
|
1946
|
+
height?: number,
|
|
1947
|
+
up?: Vec3,
|
|
1948
|
+
ampl?: number,
|
|
1949
|
+
completeCallback?: Function,
|
|
1950
|
+
startCallback?: Function
|
|
1951
|
+
) {
|
|
1843
1952
|
this.camera.flyExtent(extent, height, up, ampl, completeCallback, startCallback);
|
|
1844
1953
|
}
|
|
1845
1954
|
|
|
1846
1955
|
/**
|
|
1847
|
-
* Fly camera to the
|
|
1956
|
+
* Fly camera to the point.
|
|
1848
1957
|
* @public
|
|
1849
|
-
* @param {Vec3} cartesian -
|
|
1958
|
+
* @param {Vec3} cartesian - Point coordinates.
|
|
1850
1959
|
* @param {Vec3} [look] - Camera "look at" point.
|
|
1851
1960
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1852
1961
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
1853
|
-
* @param [completeCallback]
|
|
1854
|
-
* @param [startCallback]
|
|
1855
|
-
* @param [frameCallback]
|
|
1962
|
+
* @param {Function} [completeCallback] - Call the function in the end of flight
|
|
1963
|
+
* @param {Function} [startCallback] - Call the function in the beginning
|
|
1964
|
+
* @param {Function} [frameCallback] - Each frame callback
|
|
1856
1965
|
*/
|
|
1857
|
-
flyCartesian(
|
|
1966
|
+
public flyCartesian(
|
|
1967
|
+
cartesian: Vec3,
|
|
1968
|
+
look?: Vec3 | null,
|
|
1969
|
+
up?: Vec3 | null,
|
|
1970
|
+
ampl?: number,
|
|
1971
|
+
completeCallback?: Function | null,
|
|
1972
|
+
startCallback?: Function | null,
|
|
1973
|
+
frameCallback?: Function | null
|
|
1974
|
+
) {
|
|
1858
1975
|
this.camera.flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback);
|
|
1859
1976
|
}
|
|
1860
1977
|
|
|
1861
1978
|
/**
|
|
1862
|
-
* Fly camera to the
|
|
1979
|
+
* Fly camera to the geodetic position.
|
|
1863
1980
|
* @public
|
|
1864
1981
|
* @param {LonLat} lonlat - Fly geographical coordinates.
|
|
1865
|
-
* @param {Vec3} [look] - Camera
|
|
1982
|
+
* @param {Vec3 | LonLat} [look] - Camera viewpoint in the end of the flight.
|
|
1866
1983
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1867
1984
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
1868
1985
|
* @param [completeCallback]
|
|
1869
1986
|
* @param [startCallback]
|
|
1870
1987
|
* @param [frameCallback]
|
|
1871
1988
|
*/
|
|
1872
|
-
flyLonLat(
|
|
1989
|
+
public flyLonLat(
|
|
1990
|
+
lonlat: LonLat,
|
|
1991
|
+
look?: Vec3 | LonLat,
|
|
1992
|
+
up?: Vec3,
|
|
1993
|
+
ampl?: number,
|
|
1994
|
+
completeCallback?: Function,
|
|
1995
|
+
startCallback?: Function,
|
|
1996
|
+
frameCallback?: Function
|
|
1997
|
+
) {
|
|
1873
1998
|
this.camera.flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback);
|
|
1874
1999
|
}
|
|
1875
2000
|
|
|
1876
2001
|
/**
|
|
1877
|
-
*
|
|
2002
|
+
* Stop current flight.
|
|
1878
2003
|
* @public
|
|
1879
2004
|
*/
|
|
1880
|
-
stopFlying() {
|
|
2005
|
+
public stopFlying() {
|
|
1881
2006
|
this.camera.stopFlying();
|
|
1882
2007
|
}
|
|
1883
2008
|
|
|
1884
|
-
updateBillboardsTexCoords() {
|
|
2009
|
+
public override updateBillboardsTexCoords() {
|
|
1885
2010
|
for (let i = 0; i < this.entityCollections.length; i++) {
|
|
1886
2011
|
this.entityCollections[i].billboardHandler.refreshTexCoordsArr();
|
|
1887
2012
|
}
|
|
1888
2013
|
|
|
1889
|
-
let readyCollections = {};
|
|
2014
|
+
let readyCollections: Record<number, boolean> = {};
|
|
1890
2015
|
for (let i = 0; i < this._layers.length; i++) {
|
|
1891
2016
|
let li = this._layers[i];
|
|
1892
2017
|
if (li instanceof Vector) {
|
|
1893
|
-
li.each(function (e) {
|
|
2018
|
+
(li as Vector).each(function (e: Entity) {
|
|
1894
2019
|
if (e._entityCollection && !readyCollections[e._entityCollection.id]) {
|
|
1895
2020
|
e._entityCollection.billboardHandler.refreshTexCoordsArr();
|
|
1896
2021
|
readyCollections[e._entityCollection.id] = true;
|
|
@@ -1900,7 +2025,7 @@ export class Planet extends RenderNode {
|
|
|
1900
2025
|
}
|
|
1901
2026
|
}
|
|
1902
2027
|
|
|
1903
|
-
getEntityTerrainPoint(entity, res) {
|
|
2028
|
+
public getEntityTerrainPoint(entity: Entity, res: Vec3) {
|
|
1904
2029
|
let n = this._renderedNodes, i = n.length;
|
|
1905
2030
|
while (i--) {
|
|
1906
2031
|
if (n[i].segment.isEntityInside(entity)) {
|
|
@@ -1909,25 +2034,82 @@ export class Planet extends RenderNode {
|
|
|
1909
2034
|
}
|
|
1910
2035
|
}
|
|
1911
2036
|
|
|
1912
|
-
async getHeightDefault(lonLat) {
|
|
1913
|
-
return new Promise((resolve
|
|
1914
|
-
this.terrain
|
|
1915
|
-
|
|
1916
|
-
|
|
2037
|
+
public async getHeightDefault(lonLat: LonLat): Promise<number> {
|
|
2038
|
+
return new Promise<number>((resolve: Function) => {
|
|
2039
|
+
if (this.terrain) {
|
|
2040
|
+
this.terrain.getHeightAsync(lonLat.clone(), (alt: number) => {
|
|
2041
|
+
resolve(alt);
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
resolve(0);
|
|
1917
2045
|
});
|
|
1918
2046
|
}
|
|
1919
2047
|
|
|
1920
|
-
async getHeightAboveELL(lonLat) {
|
|
1921
|
-
return new Promise((resolve
|
|
1922
|
-
this.terrain
|
|
1923
|
-
|
|
1924
|
-
|
|
2048
|
+
public async getHeightAboveELL(lonLat: LonLat): Promise<number> {
|
|
2049
|
+
return new Promise<number>((resolve: Function) => {
|
|
2050
|
+
if (this.terrain) {
|
|
2051
|
+
this.terrain.getHeightAsync(lonLat.clone(), (alt: number) => {
|
|
2052
|
+
resolve(alt + this.terrain!.geoid.getHeightLonLat(lonLat));
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
resolve(0);
|
|
1925
2056
|
});
|
|
1926
2057
|
}
|
|
1927
2058
|
|
|
1928
|
-
onremove() {
|
|
2059
|
+
public override onremove() {
|
|
1929
2060
|
this.memClear();
|
|
1930
2061
|
this.quadTreeStrategy.destroyBranches();
|
|
1931
2062
|
this._renderedNodes = [];
|
|
1932
2063
|
}
|
|
1933
2064
|
}
|
|
2065
|
+
|
|
2066
|
+
const PLANET_EVENTS: PlanetEventsList = [
|
|
2067
|
+
/**
|
|
2068
|
+
* Triggered before globe frame begins to render.
|
|
2069
|
+
* @event og.scene.Planet#draw
|
|
2070
|
+
*/
|
|
2071
|
+
"draw",
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* Triggered when layer has added to the planet.
|
|
2075
|
+
* @event og.scene.Planet#layeradd
|
|
2076
|
+
*/
|
|
2077
|
+
"layeradd",
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* Triggered when base layer changed.
|
|
2081
|
+
* @event og.scene.Planet#baselayerchange
|
|
2082
|
+
*/
|
|
2083
|
+
"baselayerchange",
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Triggered when layer has removed from the planet.
|
|
2087
|
+
* @event og.scene.Planet#layerremove
|
|
2088
|
+
*/
|
|
2089
|
+
"layerremove",
|
|
2090
|
+
|
|
2091
|
+
/**
|
|
2092
|
+
* Triggered when some layer visibility changed.
|
|
2093
|
+
* @event og.scene.Planet#layervisibilitychange
|
|
2094
|
+
*/
|
|
2095
|
+
"layervisibilitychange",
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* Triggered when all data is loaded
|
|
2099
|
+
* @event og.scene.Planet#rendercompleted
|
|
2100
|
+
*/
|
|
2101
|
+
"rendercompleted",
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* Triggered when all data is loaded
|
|
2105
|
+
* @event og.scene.Planet#terraincompleted
|
|
2106
|
+
*/
|
|
2107
|
+
"terraincompleted",
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* Triggered when layer data is laded
|
|
2111
|
+
* @event og.scene.Planet#terraincompleted
|
|
2112
|
+
*/
|
|
2113
|
+
"layerloadend"
|
|
2114
|
+
];
|
|
2115
|
+
|