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