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