@openglobus/og 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -46
- package/dist/@openglobus/og.esm.js +1 -20
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +1 -20
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/dist/@openglobus/res/fonts/Karla-Bold.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Bold.ttf.cfg +920 -0
- package/dist/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Karla-Light.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Light.ttf.cfg +830 -0
- package/dist/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.ttf.cfg +1196 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.json +3332 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +1370 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.json +37147 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +1340 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/arial.json +4321 -0
- package/dist/@openglobus/res/fonts/arial.ttf.cfg +1570 -0
- package/dist/@openglobus/res/fonts/arial.ttf.png +0 -0
- package/dist/@openglobus/res/night-4326.png +0 -0
- package/dist/@openglobus/res/night.png +0 -0
- package/dist/@openglobus/res/spec.png +0 -0
- package/package.json +25 -23
- package/src/{og/Clock.js → Clock.ts} +100 -78
- package/src/Deferred.ts +17 -0
- package/src/Events.ts +200 -0
- package/src/{og/Extent.js → Extent.ts} +324 -352
- package/src/Globe.ts +363 -0
- package/src/{og/ImageCanvas.js → ImageCanvas.ts} +244 -236
- package/src/Lock.ts +41 -0
- package/src/{og/LonLat.js → LonLat.ts} +50 -47
- package/src/{og/Object3d.js → Object3d.ts} +89 -55
- package/src/Popup.ts +228 -0
- package/src/{og/QueueArray.js → QueueArray.ts} +76 -75
- package/src/{og/Rectangle.js → Rectangle.ts} +115 -111
- package/src/Stack.ts +58 -0
- package/src/{og/astro/astro.js → astro/astro.ts} +49 -51
- package/src/{og/astro/earth.js → astro/earth.ts} +8 -9
- package/src/{og/astro/jd.js → astro/jd.ts} +92 -111
- package/src/{og/astro/orbit.js → astro/orbit.ts} +35 -37
- package/src/{og/astro/rotation.js → astro/rotation.ts} +4 -6
- package/src/{og/bv/Box.js → bv/Box.ts} +21 -17
- package/src/{og/bv/Sphere.js → bv/Sphere.ts} +21 -19
- package/src/bv/index.ts +4 -0
- package/src/{og/camera/Camera.js → camera/Camera.ts} +254 -197
- package/src/{og/camera/Frustum.js → camera/Frustum.ts} +137 -111
- package/src/{og/camera/PlanetCamera.js → camera/PlanetCamera.ts} +246 -182
- package/src/camera/index.ts +4 -0
- package/src/{og/cons.js → cons.ts} +14 -18
- package/src/{og/control/Atmosphere.js → control/Atmosphere.ts} +50 -50
- package/src/{og/control/CompassButton.js → control/CompassButton.ts} +27 -30
- package/src/{og/control/Control.js → control/Control.ts} +76 -70
- package/src/{og/control/DebugInfo.js → control/DebugInfo.ts} +130 -62
- package/src/{og/control/DrawingSwitcher.js → control/DrawingSwitcher.ts} +16 -22
- package/src/control/EarthCoordinates.ts +222 -0
- package/src/control/EarthNavigation.ts +293 -0
- package/src/{og/control/GeoImageDragControl.js → control/GeoImageDragControl.ts} +37 -29
- package/src/control/KeyboardNavigation.ts +168 -0
- package/src/{og/control/LayerAnimation.js → control/LayerAnimation.ts} +74 -90
- package/src/control/LayerSwitcher.ts +76 -0
- package/src/{og/control/Lighting.js → control/Lighting.ts} +158 -120
- package/src/control/MouseNavigation.ts +468 -0
- package/src/control/MouseWheelZoomControl.ts +269 -0
- package/src/{og/control/RulerSwitcher.js → control/RulerSwitcher.ts} +18 -20
- package/src/control/ScaleControl.ts +131 -0
- package/src/control/SegmentBoundVisualization.ts +50 -0
- package/src/control/ShowFps.ts +28 -0
- package/src/control/SimpleNavigation.ts +118 -0
- package/src/{og/control/SimpleSkyBackground.js → control/SimpleSkyBackground.ts} +36 -38
- package/src/{og/control/Sun.js → control/Sun.ts} +56 -64
- package/src/control/ToggleWireframe.ts +35 -0
- package/src/control/TouchNavigation.ts +368 -0
- package/src/control/ZoomControl.ts +111 -0
- package/src/control/drawing/DrawingControl.ts +45 -0
- package/src/{og/control/drawing/LineStringDrawingScene.js → control/drawing/LineStringDrawingScene.ts} +28 -35
- package/src/{og/control/drawing/PolygonDrawingScene.js → control/drawing/PolygonDrawingScene.ts} +148 -201
- package/src/{og/control/elevationProfile/ElevationProfile.js → control/elevationProfile/ElevationProfile.ts} +70 -36
- package/src/control/heightRuler/HeightRuler.ts +16 -0
- package/src/{og/control/heightRuler/HeightRulerScene.js → control/heightRuler/HeightRulerScene.ts} +92 -87
- package/src/{og/control/heightRuler/HeightRulerSwitcher.js → control/heightRuler/HeightRulerSwitcher.ts} +3 -3
- package/src/control/index.ts +45 -0
- package/src/control/ruler/Ruler.ts +35 -0
- package/src/{og/control/ruler/RulerScene.js → control/ruler/RulerScene.ts} +163 -121
- package/src/{og/control/selection/Selection.js → control/selection/Selection.ts} +23 -21
- package/src/{og/control/selection/SelectionScene.js → control/selection/SelectionScene.ts} +64 -50
- package/src/{og/control/timeline/TimelineControl.js → control/timeline/TimelineControl.ts} +37 -28
- package/src/{og/control/timeline/TimelineModel.js → control/timeline/TimelineModel.ts} +50 -35
- package/src/{og/control/timeline/TimelineView.js → control/timeline/TimelineView.ts} +162 -113
- package/src/{og/control/timeline/timelineUtils.js → control/timeline/timelineUtils.ts} +11 -10
- package/src/{og/control → control}/visibleExtent/Segment.js +5 -5
- package/src/{og/control → control}/visibleExtent/VisibleExtent.js +8 -15
- package/src/{og/control/visibleExtent/drawnode.js → control/visibleExtent/drawnode.ts} +1 -3
- package/src/{og/ellipsoid/Ellipsoid.js → ellipsoid/Ellipsoid.ts} +113 -59
- package/src/ellipsoid/index.ts +4 -0
- package/src/{og/ellipsoid/wgs84.js → ellipsoid/wgs84.ts} +1 -3
- package/src/{og/entity/BaseBillboard.js → entity/BaseBillboard.ts} +128 -102
- package/src/entity/BaseBillboardHandler.ts +772 -0
- package/src/{og/entity/Billboard.js → entity/Billboard.ts} +77 -47
- package/src/entity/BillboardHandler.ts +135 -0
- package/src/{og/entity/Entity.js → entity/Entity.ts} +285 -226
- package/src/{og/entity/EntityCollection.js → entity/EntityCollection.ts} +340 -247
- package/src/{og/entity/GeoObject.js → entity/GeoObject.ts} +122 -67
- package/src/{og/entity/GeoObjectHandler.js → entity/GeoObjectHandler.ts} +273 -198
- package/src/entity/Geometry.ts +486 -0
- package/src/{og/entity/GeometryHandler.js → entity/GeometryHandler.ts} +383 -541
- package/src/{og/entity/Label.js → entity/Label.ts} +131 -83
- package/src/{og/entity/LabelHandler.js → entity/LabelHandler.ts} +289 -255
- package/src/{og/entity/LabelWorker.js → entity/LabelWorker.ts} +26 -36
- package/src/{og/entity/PointCloud.js → entity/PointCloud.ts} +200 -164
- package/src/entity/PointCloudHandler.ts +125 -0
- package/src/{og/entity/Polyline.js → entity/Polyline.ts} +517 -539
- package/src/{og/entity/PolylineHandler.js → entity/PolylineHandler.ts} +29 -31
- package/src/{og/entity/Ray.js → entity/Ray.ts} +89 -60
- package/src/{og/entity/RayHandler.js → entity/RayHandler.ts} +201 -306
- package/src/{og/entity/Strip.js → entity/Strip.ts} +143 -100
- package/src/{og/entity/StripHandler.js → entity/StripHandler.ts} +76 -72
- package/src/entity/index.ts +12 -0
- package/src/index.ts +173 -0
- package/src/input/KeyboardHandler.ts +196 -0
- package/src/{og/input/MouseHandler.js → input/MouseHandler.ts} +46 -35
- package/src/input/TouchHandler.ts +54 -0
- package/src/{og/input/input.js → input/input.ts} +1 -3
- package/src/{og/layer/BaseGeoImage.js → layer/BaseGeoImage.ts} +174 -107
- package/src/{og/layer/CanvasTiles.js → layer/CanvasTiles.ts} +139 -105
- package/src/{og/layer/GeoImage.js → layer/GeoImage.ts} +62 -52
- package/src/layer/GeoTexture2d.ts +56 -0
- package/src/{og/layer/GeoVideo.js → layer/GeoVideo.ts} +53 -53
- package/src/{og/layer/KML.js → layer/KML.ts} +63 -74
- package/src/{og/layer/Layer.js → layer/Layer.ts} +399 -223
- package/src/{og/layer/Material.js → layer/Material.ts} +40 -35
- package/src/{og/layer/Vector.js → layer/Vector.ts} +319 -267
- package/src/{og/layer/WMS.js → layer/WMS.ts} +76 -64
- package/src/{og/layer/XYZ.js → layer/XYZ.ts} +123 -98
- package/src/layer/index.ts +12 -0
- package/src/{og/light/LightSource.js → light/LightSource.ts} +132 -93
- package/src/{og/math/Line2.js → math/Line2.ts} +11 -8
- package/src/{og/math/Line3.js → math/Line3.ts} +49 -27
- package/src/{og/math/Mat3.js → math/Mat3.ts} +43 -27
- package/src/{og/math/Mat4.js → math/Mat4.ts} +110 -77
- package/src/{og/math/Plane.js → math/Plane.ts} +28 -23
- package/src/{og/math/Quat.js → math/Quat.ts} +238 -222
- package/src/{og/math/Ray.js → math/Ray.ts} +59 -63
- package/src/{og/math/Vec2.js → math/Vec2.ts} +85 -76
- package/src/{og/math/Vec3.js → math/Vec3.ts} +141 -140
- package/src/{og/math/Vec4.js → math/Vec4.ts} +64 -53
- package/src/{og/math/coder.js → math/coder.ts} +30 -27
- package/src/math/index.ts +26 -0
- package/src/{og/math.js → math.ts} +46 -49
- package/src/{og/mercator.js → mercator.ts} +143 -149
- package/src/{og/proj/EPSG3857.js → proj/EPSG3857.ts} +1 -3
- package/src/{og/proj/EPSG4326.js → proj/EPSG4326.ts} +11 -13
- package/src/{og/proj/Proj.js → proj/Proj.ts} +27 -23
- package/src/{og/quadTree/EPSG4326QuadTreeStrategy.js → quadTree/EPSG4326QuadTreeStrategy.ts} +10 -13
- package/src/{og/quadTree/EarthQuadTreeStrategy.js → quadTree/EarthQuadTreeStrategy.ts} +11 -13
- package/src/quadTree/EntityCollectionNode.ts +395 -0
- package/src/{og/quadTree/MarsQuadTreeStrategy.js → quadTree/MarsQuadTreeStrategy.ts} +10 -13
- package/src/{og/quadTree/Node.js → quadTree/Node.ts} +283 -191
- package/src/{og/quadTree/QuadTreeStrategy.js → quadTree/QuadTreeStrategy.ts} +35 -29
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +22 -0
- package/src/quadTree/index.ts +14 -0
- package/src/{og/quadTree/quadTree.js → quadTree/quadTree.ts} +75 -77
- package/src/{og/renderer/Renderer.js → renderer/Renderer.ts} +454 -298
- package/src/{og/renderer/RendererEvents.js → renderer/RendererEvents.ts} +347 -256
- package/src/{og/scene/Axes.js → scene/Axes.ts} +26 -22
- package/src/{og/scene/BaseNode.js → scene/BaseNode.ts} +53 -47
- package/src/{og/scene/Planet.js → scene/Planet.ts} +776 -592
- package/src/{og/scene/RenderNode.js → scene/RenderNode.ts} +105 -91
- package/src/{og/scene/SkyBox.js → scene/SkyBox.ts} +29 -25
- package/src/scene/index.ts +6 -0
- package/src/{og/segment/Segment.js → segment/Segment.ts} +497 -371
- package/src/{og/segment/SegmentLonLat.js → segment/SegmentLonLat.ts} +81 -87
- package/src/{og/segment/SegmentLonLatWgs84.js → segment/SegmentLonLatWgs84.ts} +9 -16
- package/src/{og/segment/Slice.js → segment/Slice.ts} +15 -9
- package/src/{og/segment/segmentHelper.js → segment/segmentHelper.ts} +57 -49
- package/src/{og/shaders/atmos.js → shaders/atmos.ts} +4 -6
- package/src/{og/shaders/billboard.js → shaders/billboard.ts} +3 -5
- package/src/{og/shaders/bloom.js → shaders/bloom.ts} +2 -4
- package/src/{og/shaders/blur.js → shaders/blur.ts} +4 -7
- package/src/{og/shaders/depth.js → shaders/depth.ts} +1 -3
- package/src/{og/shaders/drawnode.js → shaders/drawnode.ts} +19 -21
- package/src/{og/shaders/geoObject.js → shaders/geoObject.ts} +17 -19
- package/src/{og/shaders/label.js → shaders/label.ts} +4 -6
- package/src/{og/shaders/lumFilter.js → shaders/lumFilter.ts} +2 -4
- package/src/{og/shaders/pickingMask.js → shaders/pickingMask.ts} +2 -4
- package/src/{og/shaders/pointCloud.js → shaders/pointCloud.ts} +7 -10
- package/src/{og/shaders/polyline.js → shaders/polyline.ts} +3 -200
- package/src/{og/shaders/ray.js → shaders/ray.ts} +2 -4
- package/src/{og/shaders/screenFrame.js → shaders/screenFrame.ts} +2 -4
- package/src/{og/shaders/skybox.js → shaders/skybox.ts} +7 -9
- package/src/{og/shaders/toneMapping.js → shaders/toneMapping.ts} +2 -4
- package/src/{og/shaders/utils.js → shaders/utils.ts} +0 -2
- package/src/{og/terrain/BilTerrain.js → terrain/BilTerrain.ts} +38 -32
- package/src/terrain/EmptyTerrain.ts +230 -0
- package/src/{og/terrain/Geoid.js → terrain/Geoid.ts} +67 -41
- package/src/{og/terrain/GlobusTerrain.js → terrain/GlobusTerrain.ts} +159 -153
- package/src/{og/terrain/MapboxTerrain.js → terrain/MapboxTerrain.ts} +58 -61
- package/src/terrain/index.ts +6 -0
- package/src/ui/Button.ts +121 -0
- package/src/ui/ButtonGroup.ts +63 -0
- package/src/ui/Dialog.ts +244 -0
- package/src/ui/Slider.ts +188 -0
- package/src/ui/ToggleButton.ts +68 -0
- package/src/{og/ui/View.js → ui/View.ts} +66 -59
- package/src/utils/BaseWorker.ts +60 -0
- package/src/utils/FontAtlas.ts +356 -0
- package/src/{og/utils/GeoImageCreator.js → utils/GeoImageCreator.ts} +45 -29
- package/src/{og/utils/ImagesCacheManager.js → utils/ImagesCacheManager.ts} +85 -70
- package/src/utils/Loader.ts +247 -0
- package/src/{og/utils/NormalMapCreator.js → utils/NormalMapCreator.ts} +114 -77
- package/src/{og/utils/PlainSegmentWorker.js → utils/PlainSegmentWorker.ts} +41 -24
- package/src/{og/utils/TerrainWorker.js → utils/TerrainWorker.ts} +51 -36
- package/src/utils/TextureAtlas.ts +322 -0
- package/src/{og/utils/VectorTileCreator.js → utils/VectorTileCreator.ts} +67 -52
- package/src/{og/utils/colorTable.js → utils/colorTable.ts} +142 -144
- package/src/{og/utils/earcut.js → utils/earcut.ts} +664 -661
- package/src/{og/utils/objParser.js → utils/objParser.ts} +66 -37
- package/src/{og/utils/shared.js → utils/shared.ts} +267 -206
- package/src/utils/units.ts +78 -0
- package/src/webgl/BaseFramebuffer.ts +125 -0
- package/src/webgl/Framebuffer.ts +206 -0
- package/src/webgl/Handler.ts +1414 -0
- package/src/webgl/Multisample.ts +153 -0
- package/src/webgl/Program.ts +451 -0
- package/src/{og/webgl/ProgramController.js → webgl/ProgramController.ts} +44 -43
- package/src/webgl/index.ts +13 -0
- package/src/{og/webgl/types.js → webgl/types.ts} +29 -31
- package/src/webgl/variableHandlers.ts +114 -0
- package/src/og/Deferred.js +0 -11
- package/src/og/Events.js +0 -185
- package/src/og/Globe.js +0 -342
- package/src/og/Lock.js +0 -44
- package/src/og/Popup.js +0 -187
- package/src/og/Stack.js +0 -49
- package/src/og/bv/index.js +0 -4
- package/src/og/camera/index.js +0 -4
- package/src/og/control/EarthCoordinates.js +0 -214
- package/src/og/control/EarthNavigation.js +0 -258
- package/src/og/control/KeyboardNavigation.js +0 -172
- package/src/og/control/LayerSwitcher.js +0 -424
- package/src/og/control/MouseNavigation.js +0 -436
- package/src/og/control/MouseWheelZoomControl.js +0 -253
- package/src/og/control/ScaleControl.js +0 -119
- package/src/og/control/SegmentBoundVisualization.js +0 -54
- package/src/og/control/ShowFps.js +0 -40
- package/src/og/control/SimpleNavigation.js +0 -123
- package/src/og/control/ToggleWireframe.js +0 -35
- package/src/og/control/TouchNavigation.js +0 -350
- package/src/og/control/ZoomControl.js +0 -115
- package/src/og/control/drawing/DrawingControl.js +0 -51
- package/src/og/control/heightRuler/HeightRuler.js +0 -12
- package/src/og/control/index.js +0 -56
- package/src/og/control/ruler/Ruler.js +0 -39
- package/src/og/ellipsoid/index.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -883
- package/src/og/entity/Geometry.js +0 -320
- package/src/og/entity/PointCloudHandler.js +0 -122
- package/src/og/entity/index.js +0 -9
- package/src/og/index.js +0 -112
- package/src/og/input/KeyboardHandler.js +0 -195
- package/src/og/input/TouchHandler.js +0 -59
- package/src/og/layer/GeoTexture2d.js +0 -50
- package/src/og/layer/index.js +0 -11
- package/src/og/math/index.js +0 -23
- package/src/og/quadTree/EntityCollectionNode.js +0 -391
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +0 -27
- package/src/og/quadTree/index.js +0 -14
- package/src/og/res/images.js +0 -8
- package/src/og/scene/index.js +0 -5
- package/src/og/terrain/EmptyTerrain.js +0 -174
- package/src/og/terrain/index.js +0 -6
- package/src/og/ui/Button.js +0 -107
- package/src/og/ui/ButtonGroup.js +0 -57
- package/src/og/ui/Dialog.js +0 -239
- package/src/og/ui/Slider.js +0 -170
- package/src/og/ui/ToggleButton.js +0 -51
- package/src/og/ui/UIhelpers.js +0 -155
- package/src/og/utils/BaseWorker.js +0 -46
- package/src/og/utils/FontAtlas.js +0 -218
- package/src/og/utils/Loader.js +0 -188
- package/src/og/utils/TextureAtlas.js +0 -291
- package/src/og/utils/functionComposition.js +0 -13
- package/src/og/utils/units.js +0 -78
- package/src/og/webgl/Framebuffer.js +0 -311
- package/src/og/webgl/Handler.js +0 -1170
- package/src/og/webgl/Multisample.js +0 -275
- package/src/og/webgl/Program.js +0 -407
- package/src/og/webgl/callbacks.js +0 -98
- package/src/og/webgl/index.js +0 -13
- package/src/og.jsdoc +0 -3
- package/types/Clock.d.ts +0 -99
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -78
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -108
- package/types/ImageCanvas.d.ts +0 -128
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -127
- package/types/Object3d.d.ts +0 -35
- package/types/Popup.d.ts +0 -29
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/arial.d.ts +0 -49
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -314
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -219
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/Atmosphere.d.ts +0 -15
- package/types/control/CompassButton.d.ts +0 -16
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -19
- package/types/control/DrawingSwitcher.d.ts +0 -13
- package/types/control/EarthCoordinates.d.ts +0 -44
- package/types/control/EarthNavigation.d.ts +0 -43
- package/types/control/GeoImageDragControl.d.ts +0 -14
- package/types/control/KeyboardNavigation.d.ts +0 -24
- package/types/control/LayerAnimation.d.ts +0 -73
- package/types/control/LayerSwitcher.d.ts +0 -64
- package/types/control/Lighting.d.ts +0 -41
- package/types/control/MouseNavigation.d.ts +0 -49
- package/types/control/MouseWheelZoomControl.d.ts +0 -46
- package/types/control/ScaleControl.d.ts +0 -23
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -26
- package/types/control/SimpleSkyBackground.d.ts +0 -15
- package/types/control/Sun.d.ts +0 -53
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -54
- package/types/control/ZoomControl.d.ts +0 -26
- package/types/control/drawing/DrawingControl.d.ts +0 -14
- package/types/control/drawing/LineStringDrawingScene.d.ts +0 -5
- package/types/control/drawing/PolygonDrawingScene.d.ts +0 -99
- package/types/control/heightRuler/HeightRuler.d.ts +0 -6
- package/types/control/heightRuler/HeightRulerScene.d.ts +0 -23
- package/types/control/index.d.ts +0 -27
- package/types/control/ruler/Ruler.d.ts +0 -13
- package/types/control/ruler/RulerScene.d.ts +0 -51
- package/types/control/selection/Selection.d.ts +0 -49
- package/types/control/selection/SelectionScene.d.ts +0 -32
- package/types/control/timeline/TimelineControl.d.ts +0 -10
- package/types/control/timeline/TimelineModel.d.ts +0 -33
- package/types/control/timeline/TimelineView.d.ts +0 -57
- package/types/control/timeline/timelineUtils.d.ts +0 -9
- package/types/ellipsoid/Ellipsoid.d.ts +0 -170
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -215
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -75
- package/types/entity/Entity.d.ts +0 -340
- package/types/entity/EntityCollection.d.ts +0 -303
- package/types/entity/GeoObject.d.ts +0 -117
- package/types/entity/GeoObjectHandler.d.ts +0 -41
- package/types/entity/Geometry.d.ts +0 -79
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -190
- package/types/entity/LabelHandler.d.ts +0 -31
- package/types/entity/LabelWorker.d.ts +0 -9
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -307
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -122
- package/types/entity/RayHandler.d.ts +0 -63
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.d.ts +0 -53
- package/types/input/KeyboardHandler.d.ts +0 -17
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -42
- package/types/layer/BaseGeoImage.d.ts +0 -116
- package/types/layer/CanvasTiles.d.ts +0 -73
- package/types/layer/GeoImage.d.ts +0 -51
- package/types/layer/GeoTexture2d.d.ts +0 -7
- package/types/layer/GeoVideo.d.ts +0 -47
- package/types/layer/KML.d.ts +0 -93
- package/types/layer/Layer.d.ts +0 -320
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -211
- package/types/layer/WMS.d.ts +0 -66
- package/types/layer/XYZ.d.ts +0 -122
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -472
- package/types/math/Vec4.d.ts +0 -161
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -268
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EPSG4326QuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/EarthQuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/EntityCollectionNode.d.ts +0 -41
- package/types/quadTree/MarsQuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/Node.d.ts +0 -58
- package/types/quadTree/QuadTreeStrategy.d.ts +0 -21
- package/types/quadTree/Wgs84QuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/index.d.ts +0 -12
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -291
- package/types/renderer/RendererEvents.d.ts +0 -241
- package/types/res/images.d.ts +0 -2
- package/types/scene/Axes.d.ts +0 -10
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -594
- package/types/scene/RenderNode.d.ts +0 -152
- package/types/scene/SkyBox.d.ts +0 -9
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -273
- package/types/segment/SegmentLonLat.d.ts +0 -22
- package/types/segment/SegmentLonLatWgs84.d.ts +0 -4
- package/types/segment/Slice.d.ts +0 -10
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/atmos.d.ts +0 -4
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -8
- package/types/shaders/geoObject.d.ts +0 -3
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pickingMask.d.ts +0 -2
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shaders/utils.d.ts +0 -1
- package/types/terrain/BilTerrain.d.ts +0 -14
- package/types/terrain/EmptyTerrain.d.ts +0 -87
- package/types/terrain/Geoid.d.ts +0 -17
- package/types/terrain/GlobusTerrain.d.ts +0 -122
- package/types/terrain/MapboxTerrain.d.ts +0 -14
- package/types/terrain/index.d.ts +0 -5
- package/types/ui/Button.d.ts +0 -21
- package/types/ui/ButtonGroup.d.ts +0 -12
- package/types/ui/Dialog.d.ts +0 -41
- package/types/ui/Slider.d.ts +0 -33
- package/types/ui/ToggleButton.d.ts +0 -10
- package/types/ui/UIhelpers.d.ts +0 -13
- package/types/ui/View.d.ts +0 -33
- package/types/ui/icons.d.ts +0 -1
- package/types/utils/BaseWorker.d.ts +0 -14
- package/types/utils/FontAtlas.d.ts +0 -16
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -31
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -8
- package/types/utils/TerrainWorker.d.ts +0 -7
- package/types/utils/TextureAtlas.d.ts +0 -113
- package/types/utils/VectorTileCreator.d.ts +0 -14
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/functionComposition.d.ts +0 -5
- package/types/utils/objParser.d.ts +0 -8
- package/types/utils/shared.d.ts +0 -241
- package/types/utils/units.d.ts +0 -20
- package/types/webgl/Framebuffer.d.ts +0 -134
- package/types/webgl/Handler.d.ts +0 -403
- package/types/webgl/Multisample.d.ts +0 -91
- package/types/webgl/Program.d.ts +0 -163
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
- /package/{src/og → dist/@openglobus/res/fonts}/arial.js +0 -0
- /package/src/{og/ui/icons.js → ui/icons.ts} +0 -0
|
@@ -1,13 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
import * as math from "../math";
|
|
2
|
+
import {Events, EventsHandler, createEvents} from "../Events";
|
|
3
|
+
import {Frustum} from "./Frustum";
|
|
4
|
+
import {Mat3, NumberArray9} from "../math/Mat3";
|
|
5
|
+
import {Mat4, NumberArray16} from "../math/Mat4";
|
|
6
|
+
import {Renderer} from "../renderer/Renderer";
|
|
7
|
+
import {Vec2, NumberArray2} from "../math/Vec2";
|
|
8
|
+
import {Vec3} from "../math/Vec3";
|
|
9
|
+
import {Vec4} from "../math/Vec4";
|
|
10
|
+
|
|
11
|
+
type CameraEvents = ["viewchange", "moveend"];
|
|
12
|
+
|
|
13
|
+
const EVENT_NAMES: CameraEvents = [
|
|
14
|
+
/**
|
|
15
|
+
* When camera has been updated.
|
|
16
|
+
* @event og.Camera#viewchange
|
|
17
|
+
*/
|
|
18
|
+
"viewchange",
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Camera is stopped.
|
|
22
|
+
* @event og.Camera#moveend
|
|
23
|
+
*/
|
|
24
|
+
"moveend"
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export interface ICameraParams {
|
|
28
|
+
eye?: Vec3;
|
|
29
|
+
aspect?: number;
|
|
30
|
+
viewAngle?: number;
|
|
31
|
+
look?: Vec3;
|
|
32
|
+
up?: Vec3;
|
|
33
|
+
frustums?: NumberArray2[]
|
|
34
|
+
}
|
|
11
35
|
|
|
12
36
|
/**
|
|
13
37
|
* Camera class.
|
|
@@ -17,107 +41,152 @@ import { Frustum } from "./Frustum.js";
|
|
|
17
41
|
* @param {Object} [options.name] - Camera name.
|
|
18
42
|
* @param {number} [options.viewAngle=47] - Camera angle of view. Default is 47.0
|
|
19
43
|
* @param {number} [options.near=1] - Camera near plane distance. Default is 1.0
|
|
20
|
-
* @param {number} [options.far=og.math.MAX] - Camera far plane distance.
|
|
44
|
+
* @param {number} [options.far=og.math.MAX] - Camera far plane distance. Default is og.math.MAX
|
|
21
45
|
* @param {Vec3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
|
|
22
46
|
* @param {Vec3} [options.look=[0,0,0]] - Camera look position. Default (0,0,0)
|
|
23
47
|
* @param {Vec3} [options.up=[0,1,0]] - Camera eye position. Default (0,1,0)
|
|
24
48
|
*
|
|
25
|
-
* @fires
|
|
49
|
+
* @fires EventsHandler<CameraEvents>#viewchange
|
|
50
|
+
* @fires EventsHandler<CameraEvents>#moveend
|
|
26
51
|
*/
|
|
27
52
|
class Camera {
|
|
53
|
+
|
|
28
54
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
55
|
+
* Assigned renderer
|
|
56
|
+
* @public
|
|
57
|
+
* @type {Renderer}
|
|
58
|
+
*/
|
|
59
|
+
public renderer: Renderer | null;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Camera events handler
|
|
63
|
+
* @public
|
|
64
|
+
* @type {Events}
|
|
65
|
+
*/
|
|
66
|
+
public events: EventsHandler<CameraEvents>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Camera position.
|
|
70
|
+
* @public
|
|
71
|
+
* @type {Vec3}
|
|
72
|
+
*/
|
|
73
|
+
public eye: Vec3;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Camera RTE high position
|
|
77
|
+
* @public
|
|
78
|
+
* @type {Float32Array}
|
|
79
|
+
*/
|
|
80
|
+
public eyeHigh: Float32Array;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Camera RTE low position
|
|
84
|
+
* @public
|
|
85
|
+
* @type {Float32Array}
|
|
86
|
+
*/
|
|
87
|
+
public eyeLow: Float32Array;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Aspect ratio.
|
|
91
|
+
* @protected
|
|
92
|
+
* @type {Number}
|
|
31
93
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
94
|
+
protected _aspect: number;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Camera view angle in degrees
|
|
98
|
+
* @protected
|
|
99
|
+
* @type {Number}
|
|
100
|
+
*/
|
|
101
|
+
protected _viewAngle: number;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Camera view matrix.
|
|
105
|
+
* @protected
|
|
106
|
+
* @type {Mat4}
|
|
107
|
+
*/
|
|
108
|
+
protected _viewMatrix: Mat4;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Camera normal matrix.
|
|
112
|
+
* @protected
|
|
113
|
+
* @type {Mat3}
|
|
114
|
+
*/
|
|
115
|
+
protected _normalMatrix: Mat3;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Camera right vector.
|
|
119
|
+
* @public
|
|
120
|
+
* @type {Vec3}
|
|
121
|
+
*/
|
|
122
|
+
public _r: Vec3;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Camera up vector.
|
|
126
|
+
* @public
|
|
127
|
+
* @type {Vec3}
|
|
128
|
+
*/
|
|
129
|
+
public _u: Vec3;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Camera backward vector.
|
|
133
|
+
* @public
|
|
134
|
+
* @type {Vec3}
|
|
135
|
+
*/
|
|
136
|
+
public _b: Vec3;
|
|
137
|
+
|
|
138
|
+
protected _pr: Vec3;
|
|
139
|
+
protected _pu: Vec3;
|
|
140
|
+
protected _pb: Vec3;
|
|
141
|
+
protected _peye: Vec3;
|
|
142
|
+
|
|
143
|
+
public isMoving: boolean;
|
|
144
|
+
|
|
145
|
+
protected _tanViewAngle_hrad: number;
|
|
146
|
+
|
|
147
|
+
public _tanViewAngle_hradOneByHeight: number;
|
|
148
|
+
|
|
149
|
+
protected _projSizeConst: number;
|
|
150
|
+
|
|
151
|
+
public frustums: Frustum[];
|
|
152
|
+
|
|
153
|
+
public frustumColors: number[];
|
|
154
|
+
|
|
155
|
+
public FARTHEST_FRUSTUM_INDEX: number;
|
|
156
|
+
|
|
157
|
+
public currentFrustumIndex: number;
|
|
158
|
+
|
|
159
|
+
public isFirstPass: boolean;
|
|
160
|
+
|
|
161
|
+
constructor(renderer: Renderer | null, options: ICameraParams = {}) {
|
|
38
162
|
this.renderer = renderer;
|
|
39
163
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* @public
|
|
43
|
-
* @type {Events}
|
|
44
|
-
*/
|
|
45
|
-
this.events = new Events(EVENT_NAMES, this);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Camera position.
|
|
49
|
-
* @public
|
|
50
|
-
* @type {Vec3}
|
|
51
|
-
*/
|
|
164
|
+
this.events = createEvents<CameraEvents>(EVENT_NAMES, this);
|
|
165
|
+
|
|
52
166
|
this.eye = options.eye || new Vec3();
|
|
53
167
|
|
|
54
|
-
/**
|
|
55
|
-
* Camera RTE high position
|
|
56
|
-
* @public
|
|
57
|
-
* @type {Vec3}
|
|
58
|
-
*/
|
|
59
168
|
this.eyeHigh = new Float32Array(3);
|
|
60
169
|
|
|
61
|
-
/**
|
|
62
|
-
* Camera RTE low position
|
|
63
|
-
* @public
|
|
64
|
-
* @type {Vec3}
|
|
65
|
-
*/
|
|
66
170
|
this.eyeLow = new Float32Array(3);
|
|
67
171
|
|
|
68
|
-
/**
|
|
69
|
-
* Aspect ratio.
|
|
70
|
-
* @protected
|
|
71
|
-
* @type {Number}
|
|
72
|
-
*/
|
|
73
172
|
this._aspect = options.aspect || 1.0;
|
|
74
173
|
|
|
75
|
-
/**
|
|
76
|
-
* Camera view angle in degrees
|
|
77
|
-
* @protected
|
|
78
|
-
* @type {Number}
|
|
79
|
-
*/
|
|
80
174
|
this._viewAngle = options.viewAngle || 47.0;
|
|
81
175
|
|
|
82
|
-
/**
|
|
83
|
-
* Camera view matrix.
|
|
84
|
-
* @protected
|
|
85
|
-
* @type {Mat4}
|
|
86
|
-
*/
|
|
87
176
|
this._viewMatrix = new Mat4();
|
|
88
177
|
|
|
89
|
-
/**
|
|
90
|
-
* Camera normal matrix.
|
|
91
|
-
* @protected
|
|
92
|
-
* @type {Mat3}
|
|
93
|
-
*/
|
|
94
178
|
this._normalMatrix = new Mat3();
|
|
95
179
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this._r = new Vec3(1.0, 0.0, 0.0); // up x n
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Camera up vector.
|
|
105
|
-
* @protected
|
|
106
|
-
* @type {Vec3}
|
|
107
|
-
*/
|
|
108
|
-
this._u = new Vec3(0.0, 1.0, 0.0); // n x u - UP
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Camera forward vector.
|
|
112
|
-
* @protected
|
|
113
|
-
* @type {Vec3}
|
|
114
|
-
*/
|
|
115
|
-
this._b = new Vec3(0.0, 0.0, 1.0); // eye - look - FORWARD
|
|
180
|
+
this._r = new Vec3(1.0, 0.0, 0.0);
|
|
181
|
+
|
|
182
|
+
this._u = new Vec3(0.0, 1.0, 0.0);
|
|
183
|
+
|
|
184
|
+
this._b = new Vec3(0.0, 0.0, 1.0);
|
|
116
185
|
|
|
117
186
|
// Previous frame values
|
|
118
|
-
this.
|
|
119
|
-
this.
|
|
120
|
-
this.
|
|
187
|
+
this._pr = this._r.clone();
|
|
188
|
+
this._pu = this._u.clone();
|
|
189
|
+
this._pb = this._b.clone();
|
|
121
190
|
this._peye = this.eye.clone();
|
|
122
191
|
this.isMoving = false;
|
|
123
192
|
|
|
@@ -126,8 +195,6 @@ class Camera {
|
|
|
126
195
|
|
|
127
196
|
this.frustums = [];
|
|
128
197
|
|
|
129
|
-
this.nearFarArr = [];
|
|
130
|
-
|
|
131
198
|
this.frustumColors = [];
|
|
132
199
|
|
|
133
200
|
if (options.frustums) {
|
|
@@ -141,10 +208,10 @@ class Camera {
|
|
|
141
208
|
far: fi[1]
|
|
142
209
|
});
|
|
143
210
|
|
|
144
|
-
fr.
|
|
211
|
+
fr.cameraFrustumIndex = this.frustums.length;
|
|
145
212
|
this.frustums.push(fr);
|
|
146
|
-
this.
|
|
147
|
-
this.frustumColors.push
|
|
213
|
+
//this.frustumColors.push.apply(this.frustumColors, fr._pickingColorU);
|
|
214
|
+
this.frustumColors.push(fr._pickingColorU[0], fr._pickingColorU[1], fr._pickingColorU[2]);
|
|
148
215
|
}
|
|
149
216
|
} else {
|
|
150
217
|
let near = 1.0,
|
|
@@ -157,10 +224,10 @@ class Camera {
|
|
|
157
224
|
far: far
|
|
158
225
|
});
|
|
159
226
|
|
|
160
|
-
fr.
|
|
227
|
+
fr.cameraFrustumIndex = this.frustums.length;
|
|
161
228
|
this.frustums.push(fr);
|
|
162
|
-
this.
|
|
163
|
-
this.frustumColors.push
|
|
229
|
+
//this.frustumColors.push.apply(this.frustumColors, fr._pickingColorU);
|
|
230
|
+
this.frustumColors.push(fr._pickingColorU[0], fr._pickingColorU[1], fr._pickingColorU[2]);
|
|
164
231
|
}
|
|
165
232
|
|
|
166
233
|
this.FARTHEST_FRUSTUM_INDEX = this.frustums.length - 1;
|
|
@@ -169,6 +236,8 @@ class Camera {
|
|
|
169
236
|
|
|
170
237
|
this.isFirstPass = false;
|
|
171
238
|
|
|
239
|
+
this._projSizeConst = 0;
|
|
240
|
+
|
|
172
241
|
this.set(
|
|
173
242
|
options.eye || new Vec3(0.0, 0.0, 1.0),
|
|
174
243
|
options.look || new Vec3(),
|
|
@@ -176,13 +245,13 @@ class Camera {
|
|
|
176
245
|
);
|
|
177
246
|
}
|
|
178
247
|
|
|
179
|
-
checkMoveEnd() {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
248
|
+
public checkMoveEnd() {
|
|
249
|
+
let r = this._r,
|
|
250
|
+
u = this._u,
|
|
251
|
+
b = this._b,
|
|
183
252
|
eye = this.eye;
|
|
184
253
|
|
|
185
|
-
if (this._peye.equal(eye) && this.
|
|
254
|
+
if (this._peye.equal(eye) && this._pr.equal(r) && this._pu.equal(u) && this._pb.equal(b)) {
|
|
186
255
|
if (this.isMoving) {
|
|
187
256
|
this.events.dispatch(this.events.moveend, this);
|
|
188
257
|
}
|
|
@@ -191,16 +260,16 @@ class Camera {
|
|
|
191
260
|
this.isMoving = true;
|
|
192
261
|
}
|
|
193
262
|
|
|
263
|
+
this._pr.copy(r);
|
|
194
264
|
this._pu.copy(u);
|
|
195
|
-
this.
|
|
196
|
-
this._pn.copy(n);
|
|
265
|
+
this._pb.copy(b);
|
|
197
266
|
this._peye.copy(eye);
|
|
198
267
|
}
|
|
199
268
|
|
|
200
|
-
bindRenderer(renderer) {
|
|
269
|
+
public bindRenderer(renderer: Renderer) {
|
|
201
270
|
this.renderer = renderer;
|
|
202
271
|
for (let i = 0; i < this.frustums.length; i++) {
|
|
203
|
-
this.renderer.assignPickingColor(this.frustums[i]);
|
|
272
|
+
this.renderer.assignPickingColor<Frustum>(this.frustums[i]);
|
|
204
273
|
}
|
|
205
274
|
this._aspect = this.renderer.handler.getClientAspect();
|
|
206
275
|
|
|
@@ -210,16 +279,15 @@ class Camera {
|
|
|
210
279
|
/**
|
|
211
280
|
* Camera initialization.
|
|
212
281
|
* @public
|
|
213
|
-
* @param {Renderer} renderer - OpenGlobus renderer object.
|
|
214
282
|
* @param {Object} [options] - Camera options:
|
|
215
283
|
* @param {number} [options.viewAngle] - Camera angle of view.
|
|
216
284
|
* @param {number} [options.near] - Camera near plane distance. Default is 1.0
|
|
217
|
-
* @param {number} [options.far] - Camera far plane distance.
|
|
285
|
+
* @param {number} [options.far] - Camera far plane distance. Default is math.MAX
|
|
218
286
|
* @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
|
|
219
287
|
* @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
|
|
220
288
|
* @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
|
|
221
289
|
*/
|
|
222
|
-
_init(options) {
|
|
290
|
+
protected _init(options: ICameraParams) {
|
|
223
291
|
|
|
224
292
|
this._setProj(this._viewAngle, this._aspect);
|
|
225
293
|
|
|
@@ -230,27 +298,27 @@ class Camera {
|
|
|
230
298
|
);
|
|
231
299
|
}
|
|
232
300
|
|
|
233
|
-
getUp() {
|
|
301
|
+
public getUp(): Vec3 {
|
|
234
302
|
return this._u.clone();
|
|
235
303
|
}
|
|
236
304
|
|
|
237
|
-
getDown() {
|
|
305
|
+
public getDown(): Vec3 {
|
|
238
306
|
return this._u.negateTo();
|
|
239
307
|
}
|
|
240
308
|
|
|
241
|
-
getRight() {
|
|
309
|
+
public getRight(): Vec3 {
|
|
242
310
|
return this._r.clone();
|
|
243
311
|
}
|
|
244
312
|
|
|
245
|
-
getLeft() {
|
|
313
|
+
public getLeft(): Vec3 {
|
|
246
314
|
return this._r.negateTo();
|
|
247
315
|
}
|
|
248
316
|
|
|
249
|
-
getForward() {
|
|
317
|
+
public getForward(): Vec3 {
|
|
250
318
|
return this._b.negateTo();
|
|
251
319
|
}
|
|
252
320
|
|
|
253
|
-
getBackward() {
|
|
321
|
+
public getBackward(): Vec3 {
|
|
254
322
|
return this._b.clone();
|
|
255
323
|
}
|
|
256
324
|
|
|
@@ -259,8 +327,8 @@ class Camera {
|
|
|
259
327
|
* @public
|
|
260
328
|
* @virtual
|
|
261
329
|
*/
|
|
262
|
-
update() {
|
|
263
|
-
|
|
330
|
+
public update() {
|
|
331
|
+
let u = this._r,
|
|
264
332
|
v = this._u,
|
|
265
333
|
n = this._b,
|
|
266
334
|
eye = this.eye;
|
|
@@ -274,7 +342,7 @@ class Camera {
|
|
|
274
342
|
-eye.dot(u), -eye.dot(v), -eye.dot(n), 1.0
|
|
275
343
|
]);
|
|
276
344
|
|
|
277
|
-
// do not
|
|
345
|
+
// do not clean up, someday it will be using
|
|
278
346
|
//this._normalMatrix = this._viewMatrix.toMatrix3(); // this._viewMatrix.toInverseMatrix3().transposeTo();
|
|
279
347
|
|
|
280
348
|
for (let i = 0, len = this.frustums.length; i < len; i++) {
|
|
@@ -288,7 +356,7 @@ class Camera {
|
|
|
288
356
|
* Refresh camera matrices
|
|
289
357
|
* @public
|
|
290
358
|
*/
|
|
291
|
-
refresh() {
|
|
359
|
+
public refresh() {
|
|
292
360
|
this._setProj(this._viewAngle, this._aspect);
|
|
293
361
|
this.update();
|
|
294
362
|
}
|
|
@@ -298,7 +366,7 @@ class Camera {
|
|
|
298
366
|
* @public
|
|
299
367
|
* @param {Number} aspect - Camera aspect ratio
|
|
300
368
|
*/
|
|
301
|
-
setAspectRatio(aspect) {
|
|
369
|
+
public setAspectRatio(aspect: number) {
|
|
302
370
|
this._aspect = aspect;
|
|
303
371
|
this.refresh();
|
|
304
372
|
}
|
|
@@ -308,23 +376,23 @@ class Camera {
|
|
|
308
376
|
* @public
|
|
309
377
|
* @returns {number} - Aspect ratio
|
|
310
378
|
*/
|
|
311
|
-
getAspectRatio() {
|
|
379
|
+
public getAspectRatio(): number {
|
|
312
380
|
return this._aspect;
|
|
313
381
|
}
|
|
314
382
|
|
|
315
383
|
/**
|
|
316
384
|
* Sets up camera projection
|
|
317
385
|
* @public
|
|
318
|
-
* @param {
|
|
319
|
-
* @param {number} aspect - Screen aspect
|
|
386
|
+
* @param {number} angle - Camera view angle
|
|
387
|
+
* @param {number} aspect - Screen aspect ratio
|
|
320
388
|
*/
|
|
321
|
-
_setProj(angle, aspect) {
|
|
389
|
+
protected _setProj(angle: number, aspect: number) {
|
|
322
390
|
this._viewAngle = angle;
|
|
323
391
|
this._aspect = aspect;
|
|
324
392
|
this._tanViewAngle_hrad = Math.tan(angle * math.RADIANS_HALF);
|
|
325
393
|
this._tanViewAngle_hradOneByHeight =
|
|
326
|
-
this._tanViewAngle_hrad * this.renderer
|
|
327
|
-
|
|
394
|
+
this._tanViewAngle_hrad * this.renderer!.handler._oneByHeight;
|
|
395
|
+
let c = this.renderer!.handler.canvas!;
|
|
328
396
|
this._projSizeConst = Math.min(c.clientWidth < 512 ? 512 : c.clientWidth, c.clientHeight < 512 ? 512 : c.clientHeight) / (angle * math.RADIANS);
|
|
329
397
|
for (let i = 0, len = this.frustums.length; i < len; i++) {
|
|
330
398
|
this.frustums[i].setProjectionMatrix(
|
|
@@ -341,7 +409,7 @@ class Camera {
|
|
|
341
409
|
* @public
|
|
342
410
|
* @param {number} angle - View angle
|
|
343
411
|
*/
|
|
344
|
-
setViewAngle(angle) {
|
|
412
|
+
public setViewAngle(angle: number) {
|
|
345
413
|
this._viewAngle = angle;
|
|
346
414
|
this.refresh();
|
|
347
415
|
}
|
|
@@ -351,7 +419,11 @@ class Camera {
|
|
|
351
419
|
* @public
|
|
352
420
|
* @returns {number} angle -
|
|
353
421
|
*/
|
|
354
|
-
getViewAngle() {
|
|
422
|
+
public getViewAngle(): number {
|
|
423
|
+
return this._viewAngle;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
public get viewAngle(): number {
|
|
355
427
|
return this._viewAngle;
|
|
356
428
|
}
|
|
357
429
|
|
|
@@ -363,7 +435,7 @@ class Camera {
|
|
|
363
435
|
* @param {Vec3} up - Camera up vector
|
|
364
436
|
* @returns {Camera} - This camera
|
|
365
437
|
*/
|
|
366
|
-
set(eye, look, up) {
|
|
438
|
+
public set(eye: Vec3, look?: Vec3, up?: Vec3): this {
|
|
367
439
|
this.eye.x = eye.x;
|
|
368
440
|
this.eye.y = eye.y;
|
|
369
441
|
this.eye.z = eye.z;
|
|
@@ -385,7 +457,7 @@ class Camera {
|
|
|
385
457
|
* @param {Vec3} look - Look point
|
|
386
458
|
* @param {Vec3} [up] - Camera up vector otherwise camera current up vector(this._u)
|
|
387
459
|
*/
|
|
388
|
-
look(look, up) {
|
|
460
|
+
public look(look: Vec3, up?: Vec3) {
|
|
389
461
|
this._b.set(this.eye.x - look.x, this.eye.y - look.y, this.eye.z - look.z);
|
|
390
462
|
this._r.copy((up || this._u).cross(this._b));
|
|
391
463
|
this._b.normalize();
|
|
@@ -400,7 +472,7 @@ class Camera {
|
|
|
400
472
|
* @param {number} dv - delta Y
|
|
401
473
|
* @param {number} dn - delta Z
|
|
402
474
|
*/
|
|
403
|
-
slide(du, dv, dn) {
|
|
475
|
+
public slide(du: number, dv: number, dn: number) {
|
|
404
476
|
this.eye.x += du * this._r.x + dv * this._u.x + dn * this._b.x;
|
|
405
477
|
this.eye.y += du * this._r.y + dv * this._u.y + dn * this._b.y;
|
|
406
478
|
this.eye.z += du * this._r.z + dv * this._u.z + dn * this._b.z;
|
|
@@ -411,10 +483,10 @@ class Camera {
|
|
|
411
483
|
* @public
|
|
412
484
|
* @param {number} angle - Delta roll angle in degrees
|
|
413
485
|
*/
|
|
414
|
-
roll(angle) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
486
|
+
public roll(angle: number) {
|
|
487
|
+
let cs = Math.cos(math.RADIANS * angle);
|
|
488
|
+
let sn = Math.sin(math.RADIANS * angle);
|
|
489
|
+
let t = this._r.clone();
|
|
418
490
|
this._r.set(
|
|
419
491
|
cs * t.x - sn * this._u.x,
|
|
420
492
|
cs * t.y - sn * this._u.y,
|
|
@@ -432,10 +504,10 @@ class Camera {
|
|
|
432
504
|
* @public
|
|
433
505
|
* @param {number} angle - Delta pitch angle in degrees
|
|
434
506
|
*/
|
|
435
|
-
pitch(angle) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
507
|
+
public pitch(angle: number) {
|
|
508
|
+
let cs = Math.cos(math.RADIANS * angle);
|
|
509
|
+
let sn = Math.sin(math.RADIANS * angle);
|
|
510
|
+
let t = this._b.clone();
|
|
439
511
|
this._b.set(
|
|
440
512
|
cs * t.x - sn * this._u.x,
|
|
441
513
|
cs * t.y - sn * this._u.y,
|
|
@@ -453,10 +525,10 @@ class Camera {
|
|
|
453
525
|
* @public
|
|
454
526
|
* @param {number} angle - Delta yaw angle in degrees
|
|
455
527
|
*/
|
|
456
|
-
yaw(angle) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
528
|
+
public yaw(angle: number) {
|
|
529
|
+
let cs = Math.cos(math.RADIANS * angle);
|
|
530
|
+
let sn = Math.sin(math.RADIANS * angle);
|
|
531
|
+
let t = this._r.clone();
|
|
460
532
|
this._r.set(
|
|
461
533
|
cs * t.x - sn * this._b.x,
|
|
462
534
|
cs * t.y - sn * this._b.y,
|
|
@@ -470,22 +542,22 @@ class Camera {
|
|
|
470
542
|
}
|
|
471
543
|
|
|
472
544
|
/**
|
|
473
|
-
* Returns normal vector direction to
|
|
545
|
+
* Returns normal vector direction to the unprojected screen point from camera eye
|
|
474
546
|
* @public
|
|
475
|
-
* @param {number} x -
|
|
476
|
-
* @param {number} y -
|
|
547
|
+
* @param {number} x - Screen X coordinate
|
|
548
|
+
* @param {number} y - Screen Y coordinate
|
|
477
549
|
* @returns {Vec3} - Direction vector
|
|
478
550
|
*/
|
|
479
|
-
unproject(x, y) {
|
|
480
|
-
|
|
551
|
+
public unproject(x: number, y: number) {
|
|
552
|
+
let c = this.renderer!.handler.canvas!,
|
|
481
553
|
w = c.width * 0.5,
|
|
482
554
|
h = c.height * 0.5;
|
|
483
555
|
|
|
484
|
-
|
|
556
|
+
let px = (x - w) / w,
|
|
485
557
|
py = -(y - h) / h;
|
|
486
558
|
|
|
487
|
-
|
|
488
|
-
world2 = this.frustums[0].
|
|
559
|
+
let world1 = this.frustums[0].inverseProjectionViewMatrix.mulVec4(new Vec4(px, py, -1.0, 1.0)).affinity(),
|
|
560
|
+
world2 = this.frustums[0].inverseProjectionViewMatrix.mulVec4(new Vec4(px, py, 0.0, 1.0)).affinity();
|
|
489
561
|
|
|
490
562
|
return world2.subA(world1).toVec3().normalize();
|
|
491
563
|
}
|
|
@@ -496,9 +568,9 @@ class Camera {
|
|
|
496
568
|
* @param {Vec3} v - Cartesian 3d coordinates
|
|
497
569
|
* @returns {Vec2} - Screen point coordinates
|
|
498
570
|
*/
|
|
499
|
-
project(v) {
|
|
500
|
-
|
|
501
|
-
c = this.renderer
|
|
571
|
+
public project(v: Vec3): Vec2 {
|
|
572
|
+
let r = this.frustums[0].projectionViewMatrix.mulVec4(v.toVec4()),
|
|
573
|
+
c = this.renderer!.handler.canvas!;
|
|
502
574
|
return new Vec2((1 + r.x / r.w) * c.width * 0.5, (1 - r.y / r.w) * c.height * 0.5);
|
|
503
575
|
}
|
|
504
576
|
|
|
@@ -506,20 +578,19 @@ class Camera {
|
|
|
506
578
|
* Rotates camera around center point
|
|
507
579
|
* @public
|
|
508
580
|
* @param {number} angle - Rotation angle in radians
|
|
509
|
-
* @param {boolean} isArc - If true camera up vector gets from current up vector every frame,
|
|
581
|
+
* @param {boolean} [isArc] - If true camera up vector gets from current up vector every frame,
|
|
510
582
|
* otherwise up is always input parameter.
|
|
511
|
-
* @param {Vec3} center - Point that the camera rotates around
|
|
512
|
-
* @param {
|
|
583
|
+
* @param {Vec3} [center] - Point that the camera rotates around
|
|
584
|
+
* @param {Vec3} [up] - Camera up vector
|
|
513
585
|
*/
|
|
514
|
-
rotateAround(angle, isArc, center, up) {
|
|
586
|
+
public rotateAround(angle: number, isArc?: boolean, center?: Vec3 | null, up?: Vec3 | null) {
|
|
515
587
|
center = center || Vec3.ZERO;
|
|
516
588
|
up = up || Vec3.UP;
|
|
517
589
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
var trm = tr.mul(rot).mul(ntr);
|
|
590
|
+
let rot = new Mat4().setRotation(isArc ? this._u : up, angle);
|
|
591
|
+
let tr = new Mat4().setIdentity().translate(center);
|
|
592
|
+
let ntr = new Mat4().setIdentity().translate(center.negateTo());
|
|
593
|
+
let trm = tr.mul(rot).mul(ntr);
|
|
523
594
|
|
|
524
595
|
this.eye = trm.mulVec3(this.eye);
|
|
525
596
|
this._u = rot.mulVec3(this._u).normalize();
|
|
@@ -531,21 +602,21 @@ class Camera {
|
|
|
531
602
|
* Rotates camera around center point by horizontal.
|
|
532
603
|
* @public
|
|
533
604
|
* @param {number} angle - Rotation angle in radians.
|
|
534
|
-
* @param {
|
|
605
|
+
* @param {boolean} [isArc] - If true camera up vector gets from current up vector every frame,
|
|
535
606
|
* otherwise up is always input parameter.
|
|
536
|
-
* @param {Vec3} center - Point that the camera rotates around.
|
|
607
|
+
* @param {Vec3} [center] - Point that the camera rotates around.
|
|
537
608
|
* @param {Vec3} [up] - Camera up vector.
|
|
538
609
|
*/
|
|
539
|
-
rotateHorizontal(angle, isArc, center, up
|
|
610
|
+
public rotateHorizontal(angle: number, isArc?: boolean, center?: Vec3 | null, up?: Vec3 | null) {
|
|
540
611
|
this.rotateAround(angle, isArc, center, up);
|
|
541
612
|
}
|
|
542
613
|
|
|
543
614
|
/**
|
|
544
|
-
* Rotates camera around center point by
|
|
615
|
+
* Rotates camera around center point by vertical.
|
|
545
616
|
* @param {number} angle - Rotation angle in radians.
|
|
546
|
-
* @param {Vec3} center - Point that the camera rotates around.
|
|
617
|
+
* @param {Vec3} [center] - Point that the camera rotates around.
|
|
547
618
|
*/
|
|
548
|
-
rotateVertical(angle, center) {
|
|
619
|
+
public rotateVertical(angle: number, center?: Vec3) {
|
|
549
620
|
this.rotateAround(angle, false, center, this._r);
|
|
550
621
|
}
|
|
551
622
|
|
|
@@ -556,38 +627,38 @@ class Camera {
|
|
|
556
627
|
* @param {Vec3} r - Far point.
|
|
557
628
|
* @returns {number} - Size factor.
|
|
558
629
|
*/
|
|
559
|
-
projectedSize(p, r) {
|
|
630
|
+
public projectedSize(p: Vec3, r: number): number {
|
|
560
631
|
return Math.atan(r / this.eye.distance(p)) * this._projSizeConst;
|
|
561
632
|
}
|
|
562
633
|
|
|
563
634
|
/**
|
|
564
635
|
* Returns model matrix.
|
|
565
636
|
* @public
|
|
566
|
-
* @returns {
|
|
637
|
+
* @returns {NumberArray16} - View matrix.
|
|
567
638
|
*/
|
|
568
|
-
getViewMatrix() {
|
|
639
|
+
public getViewMatrix(): NumberArray16 {
|
|
569
640
|
return this._viewMatrix._m;
|
|
570
641
|
}
|
|
571
642
|
|
|
572
643
|
/**
|
|
573
644
|
* Returns normal matrix.
|
|
574
645
|
* @public
|
|
575
|
-
* @returns {
|
|
646
|
+
* @returns {NumberArray9} - Normal matrix.
|
|
576
647
|
*/
|
|
577
|
-
getNormalMatrix() {
|
|
648
|
+
public getNormalMatrix(): NumberArray9 {
|
|
578
649
|
return this._normalMatrix._m;
|
|
579
650
|
}
|
|
580
651
|
|
|
581
|
-
setCurrentFrustum(k) {
|
|
652
|
+
public setCurrentFrustum(k: number) {
|
|
582
653
|
this.currentFrustumIndex = k;
|
|
583
654
|
this.isFirstPass = k === this.FARTHEST_FRUSTUM_INDEX;
|
|
584
655
|
}
|
|
585
656
|
|
|
586
|
-
getCurrentFrustum() {
|
|
657
|
+
public getCurrentFrustum(): number {
|
|
587
658
|
return this.currentFrustumIndex;
|
|
588
659
|
}
|
|
589
660
|
|
|
590
|
-
get frustum() {
|
|
661
|
+
public get frustum(): Frustum {
|
|
591
662
|
return this.frustums[this.currentFrustumIndex];
|
|
592
663
|
}
|
|
593
664
|
|
|
@@ -596,8 +667,8 @@ class Camera {
|
|
|
596
667
|
* @public
|
|
597
668
|
* @returns {Mat4} - Projection matrix.
|
|
598
669
|
*/
|
|
599
|
-
getProjectionMatrix() {
|
|
600
|
-
return this.frustum.
|
|
670
|
+
public getProjectionMatrix(): NumberArray16 {
|
|
671
|
+
return this.frustum.projectionMatrix._m;
|
|
601
672
|
}
|
|
602
673
|
|
|
603
674
|
/**
|
|
@@ -605,41 +676,27 @@ class Camera {
|
|
|
605
676
|
* @public
|
|
606
677
|
* @return {Mat4} - Projection-view matrix.
|
|
607
678
|
*/
|
|
608
|
-
getProjectionViewMatrix() {
|
|
609
|
-
return this.frustum.
|
|
679
|
+
public getProjectionViewMatrix(): NumberArray16 {
|
|
680
|
+
return this.frustum.projectionViewMatrix._m;
|
|
610
681
|
}
|
|
611
682
|
|
|
612
683
|
/**
|
|
613
684
|
* Returns inverse projection and model matrix product.
|
|
614
685
|
* @public
|
|
615
|
-
* @returns {Mat4} -
|
|
686
|
+
* @returns {Mat4} - Inverse projection-view matrix.
|
|
616
687
|
*/
|
|
617
|
-
getInverseProjectionViewMatrix() {
|
|
618
|
-
return this.frustum.
|
|
688
|
+
public getInverseProjectionViewMatrix(): NumberArray16 {
|
|
689
|
+
return this.frustum.inverseProjectionViewMatrix._m;
|
|
619
690
|
}
|
|
620
691
|
|
|
621
692
|
/**
|
|
622
693
|
* Returns inverse projection matrix.
|
|
623
694
|
* @public
|
|
624
|
-
* @returns {Mat4} -
|
|
695
|
+
* @returns {Mat4} - Inverse projection-view matrix.
|
|
625
696
|
*/
|
|
626
|
-
getInverseProjectionMatrix() {
|
|
627
|
-
return this.frustum.
|
|
697
|
+
public getInverseProjectionMatrix(): NumberArray16 {
|
|
698
|
+
return this.frustum.inverseProjectionMatrix._m;
|
|
628
699
|
}
|
|
629
700
|
}
|
|
630
701
|
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* When camera has been updated.
|
|
634
|
-
* @event og.Camera#viewchange
|
|
635
|
-
*/
|
|
636
|
-
"viewchange",
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Camera is stopped.
|
|
640
|
-
* @event og.Camera#moveend
|
|
641
|
-
*/
|
|
642
|
-
"moveend"
|
|
643
|
-
];
|
|
644
|
-
|
|
645
|
-
export { Camera };
|
|
702
|
+
export {Camera};
|