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