@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
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
import * as math from "../math";
|
|
2
|
+
import { Vec3 } from "./Vec3";
|
|
3
|
+
import { Mat4 } from "./Mat4";
|
|
4
|
+
import { Mat3 } from "./Mat3";
|
|
5
|
+
/**
|
|
6
|
+
* A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
|
|
7
|
+
* @constructor
|
|
8
|
+
* @param {Number} [x=0.0] The X component.
|
|
9
|
+
* @param {Number} [y=0.0] The Y component.
|
|
10
|
+
* @param {Number} [z=0.0] The Z component.
|
|
11
|
+
* @param {Number} [w=0.0] The W component.
|
|
12
|
+
*/
|
|
13
|
+
export class Quat {
|
|
14
|
+
constructor(x = 0.0, y = 0.0, z = 0.0, w = 0.0) {
|
|
15
|
+
this.x = x;
|
|
16
|
+
this.y = y;
|
|
17
|
+
this.z = z;
|
|
18
|
+
this.w = w;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Identity Quat.
|
|
22
|
+
* @const
|
|
23
|
+
* @type {Quat}
|
|
24
|
+
*/
|
|
25
|
+
static get IDENTITY() {
|
|
26
|
+
return new Quat(0.0, 0.0, 0.0, 1.0);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns a Quat represents rotation around X axis.
|
|
30
|
+
* @static
|
|
31
|
+
* @param {number} a - The angle in radians to rotate around the axis.
|
|
32
|
+
* @returns {Quat} -
|
|
33
|
+
*/
|
|
34
|
+
static xRotation(a) {
|
|
35
|
+
a *= 0.5;
|
|
36
|
+
return new Quat(Math.sin(a), 0.0, 0.0, Math.cos(a));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns a Quat represents rotation around Y axis.
|
|
40
|
+
* @static
|
|
41
|
+
* @param {number} a - The angle in radians to rotate around the axis.
|
|
42
|
+
* @returns {Quat} -
|
|
43
|
+
*/
|
|
44
|
+
static yRotation(a) {
|
|
45
|
+
a *= 0.5;
|
|
46
|
+
return new Quat(0.0, Math.sin(a), 0.0, Math.cos(a));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns a Quat represents rotation around Z axis.
|
|
50
|
+
* @static
|
|
51
|
+
* @param {number} a - The angle in radians to rotate around the axis.
|
|
52
|
+
* @returns {Quat} -
|
|
53
|
+
*/
|
|
54
|
+
static zRotation(a) {
|
|
55
|
+
a *= 0.5;
|
|
56
|
+
return new Quat(0.0, 0.0, Math.sin(a), Math.cos(a));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Computes a Quat representing a rotation around an axis.
|
|
60
|
+
* @static
|
|
61
|
+
* @param {Vec3} axis - The axis of rotation.
|
|
62
|
+
* @param {number} [angle=0.0] The angle in radians to rotate around the axis.
|
|
63
|
+
* @returns {Quat} -
|
|
64
|
+
*/
|
|
65
|
+
static axisAngleToQuat(axis, angle = 0) {
|
|
66
|
+
let v = axis.getNormal();
|
|
67
|
+
let half_angle = angle * 0.5;
|
|
68
|
+
let sin_a = Math.sin(half_angle);
|
|
69
|
+
return new Quat(v.x * sin_a, v.y * sin_a, v.z * sin_a, Math.cos(half_angle));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Computes a rotation from the given heading and up vector.
|
|
73
|
+
* @static
|
|
74
|
+
* @param {Vec3} forward - Heading target coordinates.
|
|
75
|
+
* @param {Vec3} up - Up vector.
|
|
76
|
+
* @returns {Quat} -
|
|
77
|
+
*/
|
|
78
|
+
static getLookRotation(forward, up) {
|
|
79
|
+
let f = forward.getNormal().negate();
|
|
80
|
+
let s = up.cross(f).normalize();
|
|
81
|
+
let u = f.cross(s);
|
|
82
|
+
let z = 1.0 + s.x + u.y + f.z;
|
|
83
|
+
if (z > 0.000001) {
|
|
84
|
+
let fd = 1.0 / (2.0 * Math.sqrt(z));
|
|
85
|
+
return new Quat((f.y - u.z) * fd, (s.z - f.x) * fd, (u.x - s.y) * fd, 0.25 / fd);
|
|
86
|
+
}
|
|
87
|
+
if (s.x > u.y && s.x > f.z) {
|
|
88
|
+
let fd = 1.0 / (2.0 * Math.sqrt(1.0 + s.x - u.y - f.z));
|
|
89
|
+
return new Quat(0.25 / fd, (u.x + s.y) * fd, (s.z + f.x) * fd, (f.y - u.z) * fd);
|
|
90
|
+
}
|
|
91
|
+
if (u.y > f.z) {
|
|
92
|
+
let fd = 1.0 / (2.0 * Math.sqrt(1.0 + u.y - s.x - f.z));
|
|
93
|
+
return new Quat((u.x + s.y) * fd, 0.25 / fd, (f.y + u.z) * fd, (s.z - f.x) * fd);
|
|
94
|
+
}
|
|
95
|
+
let fd = 1.0 / (2.0 * Math.sqrt(1.0 + f.z - s.x - u.y));
|
|
96
|
+
return new Quat((s.z + f.x) * fd, (f.y + u.z) * fd, 0.25 / fd, (u.x - s.y) * fd);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Computes a Quat from source point heading to the destination point.
|
|
100
|
+
* @static
|
|
101
|
+
* @param {Vec3} sourcePoint - Source coordinate.
|
|
102
|
+
* @param {Vec3} destPoint - Destination coordinate.
|
|
103
|
+
* @returns {Quat} -
|
|
104
|
+
*/
|
|
105
|
+
static getLookAtSourceDest(sourcePoint, destPoint) {
|
|
106
|
+
let forwardVector = destPoint.subA(sourcePoint).normalize();
|
|
107
|
+
let dot = Vec3.FORWARD.dot(forwardVector);
|
|
108
|
+
if (Math.abs(dot - -1.0) < 0.000001) {
|
|
109
|
+
return Quat.axisAngleToQuat(Vec3.UP, Math.PI);
|
|
110
|
+
}
|
|
111
|
+
if (Math.abs(dot - 1.0) < 0.000001) {
|
|
112
|
+
return new Quat(0.0, 0.0, 0.0, 1.0);
|
|
113
|
+
}
|
|
114
|
+
let rotAngle = Math.acos(dot);
|
|
115
|
+
let rotAxis = Vec3.FORWARD.cross(forwardVector).normalize();
|
|
116
|
+
return Quat.axisAngleToQuat(rotAxis, rotAngle);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Compute rotation between two vectors.
|
|
120
|
+
* @static
|
|
121
|
+
* @param {Vec3} u - First vector.
|
|
122
|
+
* @param {Vec3} v - Second vector.
|
|
123
|
+
* @returns {Quat} -
|
|
124
|
+
*/
|
|
125
|
+
static getRotationBetweenVectors(u, v) {
|
|
126
|
+
let w = u.cross(v);
|
|
127
|
+
let q = new Quat(w.x, w.y, w.z, 1.0 + u.dot(v));
|
|
128
|
+
return q.normalize();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Compute rotation between two vectors.
|
|
132
|
+
* @static
|
|
133
|
+
* @param {Vec3} u - First vector.
|
|
134
|
+
* @param {Vec3} v - Second vector.
|
|
135
|
+
* @param {Quat} res
|
|
136
|
+
* @returns {Quat} -
|
|
137
|
+
*/
|
|
138
|
+
static getRotationBetweenVectorsRes(u, v, res) {
|
|
139
|
+
let w = u.cross(v);
|
|
140
|
+
res.set(w.x, w.y, w.z, 1.0 + u.dot(v));
|
|
141
|
+
return res.normalize();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Compute rotation between two vectors with around vector up
|
|
145
|
+
* for exactly opposite vectors. If vectors exactly in the same
|
|
146
|
+
* direction as returns identity Quat.
|
|
147
|
+
* @static
|
|
148
|
+
* @param {Vec3} source - First vector.
|
|
149
|
+
* @param {Vec3} dest - Second vector.
|
|
150
|
+
* @param {Vec3} up - Up vector.
|
|
151
|
+
* @returns {Quat} -
|
|
152
|
+
*/
|
|
153
|
+
static getRotationBetweenVectorsUp(source, dest, up) {
|
|
154
|
+
let dot = source.dot(dest);
|
|
155
|
+
if (Math.abs(dot + 1.0) < 0.000001) {
|
|
156
|
+
// vector source and dest point exactly in the opposite direction,
|
|
157
|
+
// so it is a 180 degrees turn around the up-axis
|
|
158
|
+
return Quat.axisAngleToQuat(up, Math.PI);
|
|
159
|
+
}
|
|
160
|
+
if (Math.abs(dot - 1.0) < 0.000001) {
|
|
161
|
+
// vector source and dest point exactly in the same direction,
|
|
162
|
+
// so we return the identity Quat
|
|
163
|
+
return new Quat(0, 0, 0, 1);
|
|
164
|
+
}
|
|
165
|
+
let rotAngle = Math.acos(dot);
|
|
166
|
+
let rotAxis = source.cross(dest).normalize();
|
|
167
|
+
return Quat.axisAngleToQuat(rotAxis, rotAngle);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Returns true if the components are zero.
|
|
171
|
+
* @public
|
|
172
|
+
* @returns {boolean} -
|
|
173
|
+
*/
|
|
174
|
+
isZero() {
|
|
175
|
+
return this.x === 0.0 && this.y === 0.0 && this.z === 0.0 && this.w === 0.0;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Clear Quat. Sets zeroes.
|
|
179
|
+
* @public
|
|
180
|
+
* @returns {Quat} -
|
|
181
|
+
*/
|
|
182
|
+
clear() {
|
|
183
|
+
this.x = this.y = this.z = this.w = 0;
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Sets Quat values.
|
|
188
|
+
* @public
|
|
189
|
+
* @param {Number} [x=0.0] The X component.
|
|
190
|
+
* @param {Number} [y=0.0] The Y component.
|
|
191
|
+
* @param {Number} [z=0.0] The Z component.
|
|
192
|
+
* @param {Number} [w=0.0] The W component.
|
|
193
|
+
* @returns {Quat} -
|
|
194
|
+
*/
|
|
195
|
+
set(x, y, z, w) {
|
|
196
|
+
this.x = x;
|
|
197
|
+
this.y = y;
|
|
198
|
+
this.z = z;
|
|
199
|
+
this.w = w;
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Copy Quat values.
|
|
204
|
+
* @public
|
|
205
|
+
* @param {Quat} q - Copy Quat.
|
|
206
|
+
* @returns {Quat} -
|
|
207
|
+
*/
|
|
208
|
+
copy(q) {
|
|
209
|
+
this.x = q.x;
|
|
210
|
+
this.y = q.y;
|
|
211
|
+
this.z = q.z;
|
|
212
|
+
this.w = q.w;
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Set current Quat instance to identity Quat.
|
|
217
|
+
* @public
|
|
218
|
+
* @returns {Quat} -
|
|
219
|
+
*/
|
|
220
|
+
setIdentity() {
|
|
221
|
+
this.x = 0.0;
|
|
222
|
+
this.y = 0.0;
|
|
223
|
+
this.z = 0.0;
|
|
224
|
+
this.w = 1.0;
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Duplicates a Quat instance.
|
|
229
|
+
* @public
|
|
230
|
+
* @returns {Quat} -
|
|
231
|
+
*/
|
|
232
|
+
clone() {
|
|
233
|
+
return new Quat(this.x, this.y, this.z, this.w);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Computes the componentwise sum of two Quats.
|
|
237
|
+
* @public
|
|
238
|
+
* @param {Quat} q - Quat to add.
|
|
239
|
+
* @returns {Quat} -
|
|
240
|
+
*/
|
|
241
|
+
add(q) {
|
|
242
|
+
return new Quat(this.x + q.x, this.y + q.y, this.z + q.z, this.w + q.w);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Computes the componentwise difference of two Quats.
|
|
246
|
+
* @public
|
|
247
|
+
* @param {Quat} q - Quat to subtract.
|
|
248
|
+
* @returns {Quat} -
|
|
249
|
+
*/
|
|
250
|
+
sub(q) {
|
|
251
|
+
return new Quat(this.x - q.x, this.y - q.y, this.z - q.z, this.w - q.w);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Multiplies the provided Quat componentwise by the provided scalar.
|
|
255
|
+
* @public
|
|
256
|
+
* @param {Number} scale - The scalar to multiply with.
|
|
257
|
+
* @returns {Quat} -
|
|
258
|
+
*/
|
|
259
|
+
scaleTo(scale) {
|
|
260
|
+
return new Quat(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Multiplies the provided Quat componentwise.
|
|
264
|
+
* @public
|
|
265
|
+
* @param {Number} scale - The scalar to multiply with.
|
|
266
|
+
* @returns {Quat} -
|
|
267
|
+
*/
|
|
268
|
+
scale(scale) {
|
|
269
|
+
this.x *= scale;
|
|
270
|
+
this.y *= scale;
|
|
271
|
+
this.z *= scale;
|
|
272
|
+
this.w *= scale;
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Converts Quat values to array.
|
|
277
|
+
* @public
|
|
278
|
+
* @returns {Array.<number>} - (exactly 4 entries)
|
|
279
|
+
*/
|
|
280
|
+
toVec() {
|
|
281
|
+
return [this.x, this.y, this.z, this.w];
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Sets current quaternion by spherical coordinates.
|
|
285
|
+
* @public
|
|
286
|
+
* @param {number} lat - Latitude.
|
|
287
|
+
* @param {number} lon - Longitude.
|
|
288
|
+
* @param {number} angle - Angle in radians.
|
|
289
|
+
* @returns {Quat} -
|
|
290
|
+
*/
|
|
291
|
+
setFromSphericalCoords(lat, lon, angle) {
|
|
292
|
+
let sin_a = Math.sin(angle / 2);
|
|
293
|
+
let cos_a = Math.cos(angle / 2);
|
|
294
|
+
let sin_lat = Math.sin(lat);
|
|
295
|
+
let cos_lat = Math.cos(lat);
|
|
296
|
+
let sin_long = Math.sin(lon);
|
|
297
|
+
let cos_long = Math.cos(lon);
|
|
298
|
+
this.x = sin_a * cos_lat * sin_long;
|
|
299
|
+
this.y = sin_a * sin_lat;
|
|
300
|
+
this.z = sin_a * sin_lat * cos_long;
|
|
301
|
+
this.w = cos_a;
|
|
302
|
+
return this;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Sets rotation with the given heading and up vectors.
|
|
306
|
+
* @static
|
|
307
|
+
* @param {Vec3} forward - Heading target coordinates.
|
|
308
|
+
* @param {Vec3} up - Up vector.
|
|
309
|
+
* @returns {Quat} -
|
|
310
|
+
*/
|
|
311
|
+
setLookRotation(forward, up) {
|
|
312
|
+
let f = forward.getNormal().negate();
|
|
313
|
+
let s = up.cross(f).normalize();
|
|
314
|
+
let u = f.cross(s);
|
|
315
|
+
let z = 1.0 + s.x + u.y + f.z;
|
|
316
|
+
if (z > 0.000001) {
|
|
317
|
+
let fd = 1.0 / (2.0 * Math.sqrt(z));
|
|
318
|
+
this.x = (f.y - u.z) * fd;
|
|
319
|
+
this.y = (s.z - f.x) * fd;
|
|
320
|
+
this.z = (u.x - s.y) * fd;
|
|
321
|
+
this.w = 0.25 / fd;
|
|
322
|
+
}
|
|
323
|
+
else if (s.x > u.y && s.x > f.z) {
|
|
324
|
+
let fd = 1.0 / (2.0 * Math.sqrt(1.0 + s.x - u.y - f.z));
|
|
325
|
+
this.x = 0.25 / fd;
|
|
326
|
+
this.y = (u.x + s.y) * fd;
|
|
327
|
+
this.z = (s.z + f.x) * fd;
|
|
328
|
+
this.w = (f.y - u.z) * fd;
|
|
329
|
+
}
|
|
330
|
+
else if (u.y > f.z) {
|
|
331
|
+
let fd = 1.0 / (2.0 * Math.sqrt(1.0 + u.y - s.x - f.z));
|
|
332
|
+
this.x = (u.x + s.y) * fd;
|
|
333
|
+
this.y = 0.25 / fd;
|
|
334
|
+
this.z = (f.y + u.z) * fd;
|
|
335
|
+
this.w = (s.z - f.x) * fd;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
let fd = 1.0 / (2.0 * Math.sqrt(1.0 + f.z - s.x - u.y));
|
|
339
|
+
this.x = (s.z + f.x) * fd;
|
|
340
|
+
this.y = (f.y + u.z) * fd;
|
|
341
|
+
this.z = 0.25 / fd;
|
|
342
|
+
this.w = (u.x - s.y) * fd;
|
|
343
|
+
}
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Gets spherical coordinates.
|
|
348
|
+
* @public
|
|
349
|
+
* @returns {Object} Returns object with latitude, longitude and alpha.
|
|
350
|
+
*/
|
|
351
|
+
toSphericalCoords() {
|
|
352
|
+
let cos_a = this.w;
|
|
353
|
+
let sin_a = Math.sqrt(1.0 - cos_a * cos_a);
|
|
354
|
+
// var angle = Math.acos(cos_a) * 2;
|
|
355
|
+
if (Math.abs(sin_a) < 0.0005) {
|
|
356
|
+
sin_a = 1;
|
|
357
|
+
}
|
|
358
|
+
let tx = this.x / sin_a;
|
|
359
|
+
let ty = this.y / sin_a;
|
|
360
|
+
let tz = this.z / sin_a;
|
|
361
|
+
let lon, lat = -Math.asin(ty);
|
|
362
|
+
if (tx * tx + tz * tz < 0.0005) {
|
|
363
|
+
lon = 0;
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
lon = Math.atan2(tx, tz);
|
|
367
|
+
}
|
|
368
|
+
if (lon < 0) {
|
|
369
|
+
lon += 360.0;
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
lat: lat,
|
|
373
|
+
lon: lon,
|
|
374
|
+
alpha: Math.acos(cos_a)
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Sets current Quat representing a rotation around an axis.
|
|
379
|
+
* @public
|
|
380
|
+
* @param {Vec3} axis - The axis of rotation.
|
|
381
|
+
* @param {number} angle The angle in radians to rotate around the axis.
|
|
382
|
+
* @returns {Quat} -
|
|
383
|
+
*/
|
|
384
|
+
setFromAxisAngle(axis, angle) {
|
|
385
|
+
let v = axis.getNormal();
|
|
386
|
+
let half_angle = angle * 0.5;
|
|
387
|
+
let sin_a = Math.sin(half_angle);
|
|
388
|
+
this.set(v.x * sin_a, v.y * sin_a, v.z * sin_a, Math.cos(half_angle));
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Returns axis and angle of the current Quat.
|
|
393
|
+
* @public
|
|
394
|
+
* @returns {Object} -
|
|
395
|
+
*/
|
|
396
|
+
getAxisAngle() {
|
|
397
|
+
let x = this.x, y = this.y, z = this.z, w = this.w;
|
|
398
|
+
let vl = Math.sqrt(x * x + y * y + z * z);
|
|
399
|
+
let axis, angle;
|
|
400
|
+
if (vl > 0.0000001) {
|
|
401
|
+
let ivl = 1.0 / vl;
|
|
402
|
+
axis = new Vec3(x * ivl, y * ivl, z * ivl);
|
|
403
|
+
if (w < 0) {
|
|
404
|
+
angle = 2.0 * Math.atan2(-vl, -w); // -PI,0
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
angle = 2.0 * Math.atan2(vl, w); // 0,PI
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
axis = new Vec3(0, 0, 0);
|
|
412
|
+
angle = 0;
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
axis: axis,
|
|
416
|
+
angle: angle
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Sets current Quat by Euler's angles.
|
|
421
|
+
* @public
|
|
422
|
+
* @param {number} pitch - Pitch angle in degrees.
|
|
423
|
+
* @param {number} yaw - Yaw angle in degrees.
|
|
424
|
+
* @param {number} roll - Roll angle in degrees.
|
|
425
|
+
* @returns {Quat} -
|
|
426
|
+
*/
|
|
427
|
+
setFromEulerAngles(pitch, yaw, roll) {
|
|
428
|
+
let ex = pitch * math.RADIANS_HALF, ey = yaw * math.RADIANS_HALF, ez = roll * math.RADIANS_HALF;
|
|
429
|
+
let cr = Math.cos(ex), cp = Math.cos(ey), cy = Math.cos(ez);
|
|
430
|
+
let sr = Math.sin(ex), sp = Math.sin(ey), sy = Math.sin(ez);
|
|
431
|
+
let cpcy = cp * cy, spsy = sp * sy;
|
|
432
|
+
this.w = cr * cpcy + sr * spsy;
|
|
433
|
+
this.x = sr * cpcy - cr * spsy;
|
|
434
|
+
this.y = cr * sp * cy + sr * cp * sy;
|
|
435
|
+
this.z = cr * cp * sy - sr * sp * cy;
|
|
436
|
+
return this.normalize();
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Returns Euler's angles of the current Quat.
|
|
440
|
+
* @public
|
|
441
|
+
* @returns {Object} -
|
|
442
|
+
*/
|
|
443
|
+
getEulerAngles() {
|
|
444
|
+
let x = this.x, y = this.y, z = this.z, w = this.w;
|
|
445
|
+
let sqy = y * y;
|
|
446
|
+
let roll = Math.atan2(2.0 * (w * x + y * z), 1.0 - 2.0 * (x * x + sqy));
|
|
447
|
+
let a = w * y - z * x;
|
|
448
|
+
if (a < -1.0) {
|
|
449
|
+
a = -1.0;
|
|
450
|
+
}
|
|
451
|
+
else if (a > 1.0) {
|
|
452
|
+
a = 1.0;
|
|
453
|
+
}
|
|
454
|
+
let pitch = Math.asin(2.0 * a);
|
|
455
|
+
let yaw = Math.atan2(2.0 * (w * z + x * y), 1.0 - 2.0 * (sqy + z * z));
|
|
456
|
+
return {
|
|
457
|
+
roll,
|
|
458
|
+
pitch,
|
|
459
|
+
yaw
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Computes a Quat from the provided 4x4 matrix instance.
|
|
464
|
+
* @public
|
|
465
|
+
* @param {Mat4} mx - The rotation matrix.
|
|
466
|
+
* @returns {Quat} -
|
|
467
|
+
*/
|
|
468
|
+
setFromMatrix4(mx) {
|
|
469
|
+
let tr, s, q = [];
|
|
470
|
+
let i, j, k;
|
|
471
|
+
let m = mx._m;
|
|
472
|
+
let nxt = [1, 2, 0];
|
|
473
|
+
tr = m[0] + m[5] + m[10];
|
|
474
|
+
if (tr > 0.0) {
|
|
475
|
+
s = Math.sqrt(tr + 1.0);
|
|
476
|
+
this.w = s / 2.0;
|
|
477
|
+
s = 0.5 / s;
|
|
478
|
+
this.x = (m[6] - m[9]) * s;
|
|
479
|
+
this.y = (m[8] - m[2]) * s;
|
|
480
|
+
this.z = (m[1] - m[4]) * s;
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
i = 0;
|
|
484
|
+
if (m[5] > m[0])
|
|
485
|
+
i = 1;
|
|
486
|
+
if (m[10] > m[i * 5])
|
|
487
|
+
i = 2;
|
|
488
|
+
j = nxt[i];
|
|
489
|
+
k = nxt[j];
|
|
490
|
+
s = Math.sqrt(m[i * 5] - (m[j * 5] + m[k * 5]) + 1.0);
|
|
491
|
+
q[i] = s * 0.5;
|
|
492
|
+
if (s !== 0.0)
|
|
493
|
+
s = 0.5 / s;
|
|
494
|
+
q[3] = (m[j * 4 + k] - m[k * 4 + j]) * s;
|
|
495
|
+
q[j] = (m[i * 4 + j] + m[j * 4 + i]) * s;
|
|
496
|
+
q[k] = (m[i * 4 + k] + m[k * 4 + i]) * s;
|
|
497
|
+
this.x = q[0];
|
|
498
|
+
this.y = q[1];
|
|
499
|
+
this.z = q[2];
|
|
500
|
+
this.w = q[3];
|
|
501
|
+
}
|
|
502
|
+
return this;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Converts current Quat to the rotation 4x4 matrix.
|
|
506
|
+
* @public
|
|
507
|
+
* @params {Mat4} [out] - Output matrix
|
|
508
|
+
* @returns {Mat4} -
|
|
509
|
+
*/
|
|
510
|
+
getMat4(out = new Mat4()) {
|
|
511
|
+
let xs = this.x + this.x;
|
|
512
|
+
let ys = this.y + this.y;
|
|
513
|
+
let zs = this.z + this.z;
|
|
514
|
+
let wx = this.w * xs;
|
|
515
|
+
let wy = this.w * ys;
|
|
516
|
+
let wz = this.w * zs;
|
|
517
|
+
let xx = this.x * xs;
|
|
518
|
+
let xy = this.x * ys;
|
|
519
|
+
let xz = this.x * zs;
|
|
520
|
+
let yy = this.y * ys;
|
|
521
|
+
let yz = this.y * zs;
|
|
522
|
+
let zz = this.z * zs;
|
|
523
|
+
return out.set([
|
|
524
|
+
1 - (yy + zz), xy - wz, xz + wy, 0,
|
|
525
|
+
xy + wz, 1 - (xx + zz), yz - wx, 0,
|
|
526
|
+
xz - wy, yz + wx, 1 - (xx + yy), 0,
|
|
527
|
+
0, 0, 0, 1
|
|
528
|
+
]);
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Converts current Quat to the rotation 3x3 matrix.
|
|
532
|
+
* @public
|
|
533
|
+
* @returns {Mat3} -
|
|
534
|
+
* @todo NOT TESTED
|
|
535
|
+
*/
|
|
536
|
+
getMat3() {
|
|
537
|
+
let m = new Mat3();
|
|
538
|
+
let mx = m._m;
|
|
539
|
+
let c = this.x, d = this.y, e = this.z, g = this.w, f = c + c, h = d + d, i = e + e, j = c * f, k = c * h;
|
|
540
|
+
c = c * i;
|
|
541
|
+
let l = d * h;
|
|
542
|
+
d = d * i;
|
|
543
|
+
e = e * i;
|
|
544
|
+
f = g * f;
|
|
545
|
+
h = g * h;
|
|
546
|
+
g = g * i;
|
|
547
|
+
mx[0] = 1 - (l + e);
|
|
548
|
+
mx[1] = k - g;
|
|
549
|
+
mx[2] = c + h;
|
|
550
|
+
mx[3] = k + g;
|
|
551
|
+
mx[4] = 1 - (j + e);
|
|
552
|
+
mx[5] = d - f;
|
|
553
|
+
mx[6] = c - h;
|
|
554
|
+
mx[7] = d + f;
|
|
555
|
+
mx[8] = 1 - (j + l);
|
|
556
|
+
return m;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Returns quaternion and vector production.
|
|
560
|
+
* @public
|
|
561
|
+
* @param {Vec3} v - 3d Vector.
|
|
562
|
+
* @returns {Vec3} -
|
|
563
|
+
*/
|
|
564
|
+
mulVec3(v) {
|
|
565
|
+
// t = 2 * cross(q.xyz, v)
|
|
566
|
+
// v' = v + q.w * t + cross(q.xyz, t)
|
|
567
|
+
let d = v.x, e = v.y, g = v.z;
|
|
568
|
+
let b = this.x, f = this.y, h = this.z, a = this.w;
|
|
569
|
+
let i = a * d + f * g - h * e, j = a * e + h * d - b * g, k = a * g + b * e - f * d;
|
|
570
|
+
d = -b * d - f * e - h * g;
|
|
571
|
+
return new Vec3(i * a + d * -b + j * -h - k * -f, j * a + d * -f + k * -b - i * -h, k * a + d * -h + i * -f - j * -b);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Computes the product of two Quats.
|
|
575
|
+
* @public
|
|
576
|
+
* @param {Quat} q - Quat to multiply.
|
|
577
|
+
* @returns {Quat} -
|
|
578
|
+
*/
|
|
579
|
+
mul(q) {
|
|
580
|
+
let d = this.x, e = this.y, g = this.z, a = this.w;
|
|
581
|
+
let f = q.x, h = q.y, i = q.z, b = q.w;
|
|
582
|
+
return new Quat(d * b + a * f + e * i - g * h, e * b + a * h + g * f - d * i, g * b + a * i + d * h - e * f, a * b - d * f - e * h - g * i);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Computes the product of two Quats.
|
|
586
|
+
* @public
|
|
587
|
+
* @param {Quat} q - Quat to multiply.
|
|
588
|
+
* @returns {Quat} -
|
|
589
|
+
*/
|
|
590
|
+
mulA(q) {
|
|
591
|
+
let d = this.x, e = this.y, g = this.z, a = this.w;
|
|
592
|
+
let f = q.x, h = q.y, i = q.z, b = q.w;
|
|
593
|
+
this.x = d * b + a * f + e * i - g * h;
|
|
594
|
+
this.y = e * b + a * h + g * f - d * i;
|
|
595
|
+
this.z = g * b + a * i + d * h - e * f;
|
|
596
|
+
this.w = a * b - d * f - e * h - g * i;
|
|
597
|
+
return this;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Gets the conjugate of the Quat.
|
|
601
|
+
* @public
|
|
602
|
+
* @returns {Quat} -
|
|
603
|
+
*/
|
|
604
|
+
conjugate() {
|
|
605
|
+
return new Quat(-this.x, -this.y, -this.z, this.w);
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Computes the inverse of the Quat.
|
|
609
|
+
* @public
|
|
610
|
+
* @returns {Quat} -
|
|
611
|
+
*/
|
|
612
|
+
inverse() {
|
|
613
|
+
let n = 1.0 / this.magnitude2();
|
|
614
|
+
return new Quat(-this.x * n, -this.y * n, -this.z * n, this.w * n);
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Computes a magnitude of the Quat.
|
|
618
|
+
* @public
|
|
619
|
+
* @returns {number} -
|
|
620
|
+
*/
|
|
621
|
+
magnitude() {
|
|
622
|
+
let b = this.x, c = this.y, d = this.z, a = this.w;
|
|
623
|
+
return Math.sqrt(b * b + c * c + d * d + a * a);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Computes a squared magnitude of the Quat.
|
|
627
|
+
* @public
|
|
628
|
+
* @returns {number} -
|
|
629
|
+
*/
|
|
630
|
+
magnitude2() {
|
|
631
|
+
let b = this.x, c = this.y, d = this.z, a = this.w;
|
|
632
|
+
return b * b + c * c + d * d + a * a;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Computes the dot (scalar) product of two Quats.
|
|
636
|
+
* @public
|
|
637
|
+
* @param {Quat} q - Second quaternion.
|
|
638
|
+
* @returns {number} -
|
|
639
|
+
*/
|
|
640
|
+
dot(q) {
|
|
641
|
+
return this.x * q.x + this.y * q.y + this.z * q.z;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Current Quat normalization.
|
|
645
|
+
* @public
|
|
646
|
+
* @returns {Quat} -
|
|
647
|
+
*/
|
|
648
|
+
normalize() {
|
|
649
|
+
let c = this.x, d = this.y, e = this.z, g = this.w, f = Math.sqrt(c * c + d * d + e * e + g * g);
|
|
650
|
+
if (f === 0.0) {
|
|
651
|
+
this.x = 0;
|
|
652
|
+
this.y = 0;
|
|
653
|
+
this.z = 0;
|
|
654
|
+
this.w = 0;
|
|
655
|
+
return this;
|
|
656
|
+
}
|
|
657
|
+
f = 1 / f;
|
|
658
|
+
this.x = c * f;
|
|
659
|
+
this.y = d * f;
|
|
660
|
+
this.z = e * f;
|
|
661
|
+
this.w = g * f;
|
|
662
|
+
return this;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Compares two Quats.
|
|
666
|
+
* @public
|
|
667
|
+
* @param {Quat} q - Second quaternion.
|
|
668
|
+
* @returns {Boolean} -
|
|
669
|
+
*/
|
|
670
|
+
isEqual(q) {
|
|
671
|
+
let matching = this.dot(q);
|
|
672
|
+
if (Math.abs(matching - 1.0) < 0.001) {
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Performs a spherical linear interpolation between two Quats.
|
|
679
|
+
* @public
|
|
680
|
+
* @param {Quat} b - The end rotation Quat.
|
|
681
|
+
* @param {number} t - interpolation amount between the two Quats.
|
|
682
|
+
* @returns {Quat} -
|
|
683
|
+
*/
|
|
684
|
+
slerp(b, t) {
|
|
685
|
+
let ax = this.x, ay = this.y, az = this.z, aw = this.w, bx = b.x, by = b.y, bz = b.z, bw = b.w;
|
|
686
|
+
let omega, cosom, sinom, scale0, scale1;
|
|
687
|
+
cosom = ax * bx + ay * by + az * bz + aw * bw;
|
|
688
|
+
if (cosom < 0.0) {
|
|
689
|
+
cosom = -cosom;
|
|
690
|
+
bx = -bx;
|
|
691
|
+
by = -by;
|
|
692
|
+
bz = -bz;
|
|
693
|
+
bw = -bw;
|
|
694
|
+
}
|
|
695
|
+
if (1.0 - cosom > 0.000001) {
|
|
696
|
+
omega = Math.acos(cosom);
|
|
697
|
+
sinom = Math.sin(omega);
|
|
698
|
+
scale0 = Math.sin((1.0 - t) * omega) / sinom;
|
|
699
|
+
scale1 = Math.sin(t * omega) / sinom;
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
scale0 = 1.0 - t;
|
|
703
|
+
scale1 = t;
|
|
704
|
+
}
|
|
705
|
+
return new Quat(scale0 * ax + scale1 * bx, scale0 * ay + scale1 * by, scale0 * az + scale1 * bz, scale0 * aw + scale1 * bw);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Returns a roll angle in radians.
|
|
709
|
+
* @public
|
|
710
|
+
* @param {Boolean} [reprojectAxis] -
|
|
711
|
+
* @returns {Number} -
|
|
712
|
+
*/
|
|
713
|
+
getRoll(reprojectAxis = false) {
|
|
714
|
+
let x = this.x, y = this.y, z = this.z, w = this.w;
|
|
715
|
+
if (reprojectAxis) {
|
|
716
|
+
let fTy = 2.0 * y;
|
|
717
|
+
let fTz = 2.0 * z;
|
|
718
|
+
let fTwz = fTz * w;
|
|
719
|
+
let fTxy = fTy * x;
|
|
720
|
+
let fTyy = fTy * y;
|
|
721
|
+
let fTzz = fTz * z;
|
|
722
|
+
return Math.atan2(fTxy + fTwz, 1.0 - (fTyy + fTzz));
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
return Math.atan2(2 * (x * y + w * z), w * w + x * x - y * y - z * z);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Returns a pitch angle in radians.
|
|
730
|
+
* @public
|
|
731
|
+
* @param {Boolean} [reprojectAxis] -
|
|
732
|
+
* @returns {number} -
|
|
733
|
+
*/
|
|
734
|
+
getPitch(reprojectAxis = false) {
|
|
735
|
+
let x = this.x, y = this.y, z = this.z, w = this.w;
|
|
736
|
+
if (reprojectAxis) {
|
|
737
|
+
let fTx = 2.0 * x;
|
|
738
|
+
let fTz = 2.0 * z;
|
|
739
|
+
let fTwx = fTx * w;
|
|
740
|
+
let fTxx = fTx * x;
|
|
741
|
+
let fTyz = fTz * y;
|
|
742
|
+
let fTzz = fTz * z;
|
|
743
|
+
return Math.atan2(fTyz + fTwx, 1.0 - (fTxx + fTzz));
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
return Math.atan2(2 * (y * z + w * x), w * w - x * x - y * y + z * z);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Returns a yaw angle in radians.
|
|
751
|
+
* @public
|
|
752
|
+
* @param {Boolean} [reprojectAxis] -
|
|
753
|
+
* @returns {number} -
|
|
754
|
+
*/
|
|
755
|
+
getYaw(reprojectAxis = false) {
|
|
756
|
+
let x = this.x, y = this.y, z = this.z, w = this.w;
|
|
757
|
+
if (reprojectAxis) {
|
|
758
|
+
let fTx = 2.0 * x;
|
|
759
|
+
let fTy = 2.0 * y;
|
|
760
|
+
let fTz = 2.0 * z;
|
|
761
|
+
let fTwy = fTy * w;
|
|
762
|
+
let fTxx = fTx * x;
|
|
763
|
+
let fTxz = fTz * x;
|
|
764
|
+
let fTyy = fTy * y;
|
|
765
|
+
return Math.atan2(fTxz + fTwy, 1.0 - (fTxx + fTyy));
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
return Math.asin(-2 * (x * z - w * y));
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Creates Quat instance.
|
|
774
|
+
* @function
|
|
775
|
+
* @param {Number} [x=0.0] The X component.
|
|
776
|
+
* @param {Number} [y=0.0] The Y component.
|
|
777
|
+
* @param {Number} [z=0.0] The Z component.
|
|
778
|
+
* @param {Number} [w=0.0] The W component.
|
|
779
|
+
* @returns {Quat} -
|
|
780
|
+
*/
|
|
781
|
+
export function quat(x = 0, y = 0, z = 0, w = 0) {
|
|
782
|
+
return new Quat(x, y, z, w);
|
|
783
|
+
}
|