@openglobus/og 0.11.8 → 0.12.4
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/css/og.css +2 -0
- package/dist/@openglobus/og.css +1 -0
- package/dist/@openglobus/og.esm.js +21 -0
- package/dist/@openglobus/og.esm.js.map +1 -0
- package/dist/@openglobus/og.umd.js +21 -0
- package/dist/@openglobus/og.umd.js.map +1 -0
- package/package.json +11 -11
- package/src/og/Globe.js +18 -6
- package/src/og/camera/Camera.js +70 -79
- package/src/og/camera/PlanetCamera.js +25 -30
- package/src/og/control/DebugInfo.js +2 -2
- package/src/og/control/EarthNavigation.js +26 -17
- package/src/og/control/MouseNavigation.js +11 -13
- package/src/og/control/MouseWheelZoomControl.js +5 -5
- package/src/og/control/Sun.js +3 -3
- package/src/og/entity/Entity.js +742 -742
- package/src/og/entity/GeoObjectHandler.js +138 -134
- package/src/og/entity/LabelHandler.js +2 -1
- package/src/og/layer/CanvasTiles.js +8 -11
- package/src/og/layer/KML.js +19 -12
- package/src/og/layer/Layer.js +9 -2
- package/src/og/layer/XYZ.js +27 -28
- package/src/og/math/Vec3.js +18 -2
- package/src/og/quadTree/Node.js +48 -93
- package/src/og/quadTree/quadTree.js +1 -1
- package/src/og/renderer/Renderer.js +3 -5
- package/src/og/scene/Planet.js +147 -127
- package/src/og/segment/Segment.js +63 -136
- package/src/og/shaders/drawnode.js +132 -221
- package/src/og/shaders/geoObject.js +15 -6
- package/src/og/terrain/EmptyTerrain.js +3 -2
- package/src/og/terrain/GlobusTerrain.js +2 -0
- package/src/og/utils/Loader.js +1 -1
- package/src/og/utils/PlainSegmentWorker.js +0 -13
- package/src/og/webgl/Handler.js +13 -9
- package/types/Clock.d.ts +94 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +77 -0
- package/types/Extent.d.ts +166 -0
- package/types/Globe.d.ts +85 -0
- package/types/ImageCanvas.d.ts +123 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +42 -0
- package/types/QueueArray.d.ts +19 -0
- package/types/Rectangle.d.ts +80 -0
- package/types/Stack.d.ts +19 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +7 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +30 -0
- package/types/bv/Sphere.d.ts +38 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +312 -0
- package/types/camera/Frustum.d.ts +133 -0
- package/types/camera/PlanetCamera.d.ts +219 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +104 -0
- package/types/control/DebugInfo.d.ts +15 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/EarthNavigation.d.ts +43 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +21 -0
- package/types/control/LayerSwitcher.d.ts +21 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/MouseNavigation.d.ts +48 -0
- package/types/control/MouseWheelZoomControl.d.ts +45 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +11 -0
- package/types/control/SimpleNavigation.d.ts +25 -0
- package/types/control/Sun.d.ts +50 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +27 -0
- package/types/control/index.d.ts +18 -0
- package/types/ellipsoid/Ellipsoid.d.ts +146 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +6 -0
- package/types/entity/BaseBillboard.d.ts +215 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +79 -0
- package/types/entity/Entity.d.ts +348 -0
- package/types/entity/EntityCollection.d.ts +317 -0
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +81 -0
- package/types/entity/Geometry.d.ts +74 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +189 -0
- package/types/entity/LabelHandler.d.ts +31 -0
- package/types/entity/LabelWorker.d.ts +11 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +306 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +124 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +119 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +94 -0
- package/types/layer/CanvasTiles.d.ts +67 -0
- package/types/layer/GeoImage.d.ts +52 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +55 -0
- package/types/layer/KML.d.ts +68 -0
- package/types/layer/Layer.d.ts +311 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +61 -0
- package/types/layer/XYZ.d.ts +119 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +178 -0
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +65 -0
- package/types/math/Mat4.d.ts +176 -0
- package/types/math/Plane.d.ts +18 -0
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +309 -0
- package/types/math/Vec3.d.ts +467 -0
- package/types/math/Vec4.d.ts +162 -0
- package/types/math/coder.d.ts +43 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +6 -0
- package/types/proj/EPSG4326.d.ts +6 -0
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +60 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/Renderer.d.ts +290 -0
- package/types/renderer/RendererEvents.d.ts +237 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +576 -0
- package/types/scene/RenderNode.d.ts +142 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/Segment.d.ts +275 -0
- package/types/segment/SegmentLonLat.d.ts +17 -0
- package/types/segment/Slice.d.ts +10 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +250 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +7 -0
- package/types/terrain/EmptyTerrain.d.ts +73 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +116 -0
- package/types/terrain/MapboxTerrain.d.ts +7 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +15 -0
- package/types/utils/GeoImageCreator.d.ts +30 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +231 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +417 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +161 -0
- package/types/webgl/ProgramController.d.ts +89 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounding sphere class.
|
|
3
|
+
* @class
|
|
4
|
+
* @param {Number} [radius] - Bounding sphere radius.
|
|
5
|
+
* @param {Vec3} [center] - Bounding sphere coordiantes.
|
|
6
|
+
*/
|
|
7
|
+
export class Sphere {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {number} radius
|
|
11
|
+
* @param {Vec3} center
|
|
12
|
+
*/
|
|
13
|
+
constructor(radius: number, center: Vec3);
|
|
14
|
+
/**
|
|
15
|
+
* Sphere radius.
|
|
16
|
+
* @public
|
|
17
|
+
* @type {Number}
|
|
18
|
+
*/
|
|
19
|
+
public radius: number;
|
|
20
|
+
/**
|
|
21
|
+
* Sphere coordiantes.
|
|
22
|
+
* @public
|
|
23
|
+
* @type {Vec3}
|
|
24
|
+
*/
|
|
25
|
+
public center: Vec3;
|
|
26
|
+
/**
|
|
27
|
+
* Sets bounding sphere coordinates by the bounds array.
|
|
28
|
+
* @param {Array.<number>} bounds - Bounds is an array where [minX, minY, minZ, maxX, maxY, maxZ]
|
|
29
|
+
*/
|
|
30
|
+
setFromBounds(bounds: Array<number>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Sets bounding sphere coordiantes by ellipsoid geodetic extend.
|
|
33
|
+
* @param {Ellipsoid} ellipsoid - Ellipsoid.
|
|
34
|
+
* @param {Extent} extent - Geodetic extent.
|
|
35
|
+
*/
|
|
36
|
+
setFromExtent(ellipsoid: Ellipsoid, extent: Extent): void;
|
|
37
|
+
}
|
|
38
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camera class.
|
|
3
|
+
* @class
|
|
4
|
+
* @param {Renderer} [renderer] - Renderer uses the camera instance.
|
|
5
|
+
* @param {Object} [options] - Camera options:
|
|
6
|
+
* @param {Object} [options.name] - Camera name.
|
|
7
|
+
* @param {number} [options.viewAngle=38] - Camera angle of view. Default is 30.0
|
|
8
|
+
* @param {number} [options.near=1] - Camera near plane distance. Default is 1.0
|
|
9
|
+
* @param {number} [options.far=og.math.MAX] - Camera far plane distance. Deafult is og.math.MAX
|
|
10
|
+
* @param {Vec3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
|
|
11
|
+
* @param {Vec3} [options.look=[0,0,0]] - Camera look position. Default (0,0,0)
|
|
12
|
+
* @param {Vec3} [options.up=[0,1,0]] - Camera eye position. Default (0,1,0)
|
|
13
|
+
*
|
|
14
|
+
* @fires og.Camera#viewchange
|
|
15
|
+
*/
|
|
16
|
+
export class Camera {
|
|
17
|
+
/**
|
|
18
|
+
* @param {Renderer} [renderer] - Renderer uses the camera instance.
|
|
19
|
+
* @param {Object} [options] - Camera options:
|
|
20
|
+
*/
|
|
21
|
+
constructor(renderer?: Renderer, options?: any);
|
|
22
|
+
/**
|
|
23
|
+
* Assigned renderer
|
|
24
|
+
* @public
|
|
25
|
+
* @type {Renderer}
|
|
26
|
+
*/
|
|
27
|
+
public renderer: Renderer;
|
|
28
|
+
/**
|
|
29
|
+
* Camera events handler
|
|
30
|
+
* @public
|
|
31
|
+
* @type {Events}
|
|
32
|
+
*/
|
|
33
|
+
public events: Events;
|
|
34
|
+
/**
|
|
35
|
+
* Camera position.
|
|
36
|
+
* @public
|
|
37
|
+
* @type {Vec3}
|
|
38
|
+
*/
|
|
39
|
+
public eye: Vec3;
|
|
40
|
+
/**
|
|
41
|
+
* Camera RTE high position
|
|
42
|
+
* @public
|
|
43
|
+
* @type {Vec3}
|
|
44
|
+
*/
|
|
45
|
+
public eyeHigh: Vec3;
|
|
46
|
+
/**
|
|
47
|
+
* Camera RTE low position
|
|
48
|
+
* @public
|
|
49
|
+
* @type {Vec3}
|
|
50
|
+
*/
|
|
51
|
+
public eyeLow: Vec3;
|
|
52
|
+
/**
|
|
53
|
+
* Aspect ratio.
|
|
54
|
+
* @protected
|
|
55
|
+
* @type {Number}
|
|
56
|
+
*/
|
|
57
|
+
protected _aspect: number;
|
|
58
|
+
/**
|
|
59
|
+
* Camera view angle in degrees
|
|
60
|
+
* @protected
|
|
61
|
+
* @type {Number}
|
|
62
|
+
*/
|
|
63
|
+
protected _viewAngle: number;
|
|
64
|
+
/**
|
|
65
|
+
* Camera normal matrix.
|
|
66
|
+
* @protected
|
|
67
|
+
* @type {Mat3}
|
|
68
|
+
*/
|
|
69
|
+
protected _normalMatrix: Mat3;
|
|
70
|
+
/**
|
|
71
|
+
* Camera view matrix.
|
|
72
|
+
* @protected
|
|
73
|
+
* @type {Mat4}
|
|
74
|
+
*/
|
|
75
|
+
protected _viewMatrix: Mat4;
|
|
76
|
+
/**
|
|
77
|
+
* Camera right vector.
|
|
78
|
+
* @protected
|
|
79
|
+
* @type {Vec3}
|
|
80
|
+
*/
|
|
81
|
+
protected _r: Vec3;
|
|
82
|
+
/**
|
|
83
|
+
* Camera up vector.
|
|
84
|
+
* @protected
|
|
85
|
+
* @type {Vec3}
|
|
86
|
+
*/
|
|
87
|
+
protected _u: Vec3;
|
|
88
|
+
/**
|
|
89
|
+
* Camera forward vector.
|
|
90
|
+
* @protected
|
|
91
|
+
* @type {Vec3}
|
|
92
|
+
*/
|
|
93
|
+
protected _b: Vec3;
|
|
94
|
+
_pu: Vec3;
|
|
95
|
+
_pv: Vec3;
|
|
96
|
+
_pn: Vec3;
|
|
97
|
+
_peye: Vec3;
|
|
98
|
+
isMoved: boolean;
|
|
99
|
+
_tanViewAngle_hrad: number;
|
|
100
|
+
_tanViewAngle_hradOneByHeight: number;
|
|
101
|
+
frustums: Frustum[];
|
|
102
|
+
nearFarArr: any[];
|
|
103
|
+
frustumColors: any[];
|
|
104
|
+
FARTHEST_FRUSTUM_INDEX: number;
|
|
105
|
+
_currentFrustum: number;
|
|
106
|
+
checkMoveEnd(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Camera initialization.
|
|
109
|
+
* @public
|
|
110
|
+
* @param {Renderer} renderer - OpenGlobus renderer object.
|
|
111
|
+
* @param {Object} [options] - Camera options:
|
|
112
|
+
* @param {number} [options.viewAngle] - Camera angle of view. Default is 30.0
|
|
113
|
+
* @param {number} [options.near] - Camera near plane distance. Default is 1.0
|
|
114
|
+
* @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
|
|
115
|
+
* @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
|
|
116
|
+
* @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
|
|
117
|
+
* @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
|
|
118
|
+
*/
|
|
119
|
+
public _init(options?: {
|
|
120
|
+
viewAngle?: number;
|
|
121
|
+
near?: number;
|
|
122
|
+
far?: number;
|
|
123
|
+
eye?: Vec3;
|
|
124
|
+
look?: Vec3;
|
|
125
|
+
up?: Vec3;
|
|
126
|
+
}): void;
|
|
127
|
+
getUp(): Vec3;
|
|
128
|
+
getDown(): Vec3;
|
|
129
|
+
getRight(): Vec3;
|
|
130
|
+
getLeft(): Vec3;
|
|
131
|
+
getForward(): Vec3;
|
|
132
|
+
getBackward(): Vec3;
|
|
133
|
+
/**
|
|
134
|
+
* Updates camera view space
|
|
135
|
+
* @public
|
|
136
|
+
* @virtual
|
|
137
|
+
*/
|
|
138
|
+
public update(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Refresh camera matrices
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
public refresh(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Sets aspect ratio
|
|
146
|
+
* @public
|
|
147
|
+
* @param {Number} aspect - Camera aspect ratio
|
|
148
|
+
*/
|
|
149
|
+
public setAspectRatio(aspect: number): void;
|
|
150
|
+
/**
|
|
151
|
+
* Returns aspect ratio
|
|
152
|
+
* @public
|
|
153
|
+
* @returns {number} - Aspect ratio
|
|
154
|
+
*/
|
|
155
|
+
public getAspectRatio(): number;
|
|
156
|
+
/**
|
|
157
|
+
* Sets up camera projection
|
|
158
|
+
* @public
|
|
159
|
+
* @param {nnumber} angle - Camera's view angle
|
|
160
|
+
* @param {number} aspect - Screen aspect ration
|
|
161
|
+
*/
|
|
162
|
+
public _setProj(angle: nnumber, aspect: number): void;
|
|
163
|
+
_projSizeConst: number;
|
|
164
|
+
/**
|
|
165
|
+
* Sets camera view angle in degrees
|
|
166
|
+
* @public
|
|
167
|
+
* @param {number} angle - View angle
|
|
168
|
+
*/
|
|
169
|
+
public setViewAngle(angle: number): void;
|
|
170
|
+
/**
|
|
171
|
+
* Gets camera view angle in degrees
|
|
172
|
+
* @public
|
|
173
|
+
* @returns {number} angle -
|
|
174
|
+
*/
|
|
175
|
+
public getViewAngle(): number;
|
|
176
|
+
/**
|
|
177
|
+
* Sets camera to eye position
|
|
178
|
+
* @public
|
|
179
|
+
* @param {Vec3} eye - Camera position
|
|
180
|
+
* @param {Vec3} look - Look point
|
|
181
|
+
* @param {Vec3} up - Camera up vector
|
|
182
|
+
* @returns {Camera} - This camera
|
|
183
|
+
*/
|
|
184
|
+
public set(eye: Vec3, look: Vec3, up: Vec3): Camera;
|
|
185
|
+
/**
|
|
186
|
+
* Sets camera look point
|
|
187
|
+
* @public
|
|
188
|
+
* @param {Vec3} look - Look point
|
|
189
|
+
* @param {Vec3} [up] - Camera up vector otherwise camera current up vector(this._u)
|
|
190
|
+
*/
|
|
191
|
+
public look(look: Vec3, up?: Vec3): void;
|
|
192
|
+
/**
|
|
193
|
+
* Slides camera to vector d - (du, dv, dn)
|
|
194
|
+
* @public
|
|
195
|
+
* @param {number} du - delta X
|
|
196
|
+
* @param {number} dv - delta Y
|
|
197
|
+
* @param {number} dn - delta Z
|
|
198
|
+
*/
|
|
199
|
+
public slide(du: number, dv: number, dn: number): void;
|
|
200
|
+
/**
|
|
201
|
+
* Roll the camera to the angle in degrees
|
|
202
|
+
* @public
|
|
203
|
+
* @param {number} angle - Delta roll angle in degrees
|
|
204
|
+
*/
|
|
205
|
+
public roll(angle: number): void;
|
|
206
|
+
/**
|
|
207
|
+
* Pitch the camera to the angle in degrees
|
|
208
|
+
* @public
|
|
209
|
+
* @param {number} angle - Delta pitch angle in degrees
|
|
210
|
+
*/
|
|
211
|
+
public pitch(angle: number): void;
|
|
212
|
+
/**
|
|
213
|
+
* Yaw the camera to the angle in degrees
|
|
214
|
+
* @public
|
|
215
|
+
* @param {number} angle - Delta yaw angle in degrees
|
|
216
|
+
*/
|
|
217
|
+
public yaw(angle: number): void;
|
|
218
|
+
/**
|
|
219
|
+
* Returns normal vector direction to to the unprojected screen point from camera eye
|
|
220
|
+
* @public
|
|
221
|
+
* @param {number} x - Scren X coordinate
|
|
222
|
+
* @param {number} y - Scren Y coordinate
|
|
223
|
+
* @returns {Vec3} - Direction vector
|
|
224
|
+
*/
|
|
225
|
+
public unproject(x: number, y: number): Vec3;
|
|
226
|
+
/**
|
|
227
|
+
* Gets projected 3d point to the 2d screen coordiantes
|
|
228
|
+
* @public
|
|
229
|
+
* @param {Vec3} v - Cartesian 3d coordiantes
|
|
230
|
+
* @returns {Vec2} - Screen point coordinates
|
|
231
|
+
*/
|
|
232
|
+
public project(v: Vec3): Vec2;
|
|
233
|
+
/**
|
|
234
|
+
* Rotates camera around center point
|
|
235
|
+
* @public
|
|
236
|
+
* @param {number} angle - Rotation angle in radians
|
|
237
|
+
* @param {boolean} isArc - If true camera up vector gets from current up vector every frame,
|
|
238
|
+
* otherwise up is always input parameter.
|
|
239
|
+
* @param {Vec3} center - Point that the camera rotates around
|
|
240
|
+
* @param {Vecto3} [up] - Camera up vector
|
|
241
|
+
*/
|
|
242
|
+
public rotateAround(angle: number, isArc: boolean, center: Vec3, up?: Vecto3): void;
|
|
243
|
+
/**
|
|
244
|
+
* Rotates camera around center point by horizontal.
|
|
245
|
+
* @public
|
|
246
|
+
* @param {number} angle - Rotation angle in radians.
|
|
247
|
+
* @param {boolaen} isArc - If true camera up vector gets from current up vector every frame,
|
|
248
|
+
* otherwise up is always input parameter.
|
|
249
|
+
* @param {Vec3} center - Point that the camera rotates around.
|
|
250
|
+
* @param {Vec3} [up] - Camera up vector.
|
|
251
|
+
*/
|
|
252
|
+
public rotateHorizontal(angle: number, isArc: boolaen, center: Vec3, up?: Vec3): void;
|
|
253
|
+
/**
|
|
254
|
+
* Rotates camera around center point by vecrtical.
|
|
255
|
+
* @param {number} angle - Rotation angle in radians.
|
|
256
|
+
* @param {Vec3} center - Point that the camera rotates around.
|
|
257
|
+
*/
|
|
258
|
+
rotateVertical(angle: number, center: Vec3): void;
|
|
259
|
+
/**
|
|
260
|
+
* Gets 3d size factor. Uses in LOD distance calculation.
|
|
261
|
+
* @public
|
|
262
|
+
* @param {Vec3} p - Far point.
|
|
263
|
+
* @param {Vec3} r - Far point.
|
|
264
|
+
* @returns {number} - Size factor.
|
|
265
|
+
*/
|
|
266
|
+
public projectedSize(p: Vec3, r: Vec3): number;
|
|
267
|
+
/**
|
|
268
|
+
* Returns normal matrix.
|
|
269
|
+
* @public
|
|
270
|
+
* @returns {Mat3} - Normal matrix.
|
|
271
|
+
*/
|
|
272
|
+
public getNormalMatrix(): Mat3;
|
|
273
|
+
/**
|
|
274
|
+
* Returns model matrix.
|
|
275
|
+
* @public
|
|
276
|
+
* @returns {Mat4} - View matrix.
|
|
277
|
+
*/
|
|
278
|
+
public getViewMatrix(): Mat4;
|
|
279
|
+
setCurrentFrustum(k: any): void;
|
|
280
|
+
getCurrentFrustum(): number;
|
|
281
|
+
get frustum(): Frustum;
|
|
282
|
+
/**
|
|
283
|
+
* Returns projection matrix.
|
|
284
|
+
* @public
|
|
285
|
+
* @returns {Mat4} - Projection matrix.
|
|
286
|
+
*/
|
|
287
|
+
public getProjectionMatrix(): Mat4;
|
|
288
|
+
/**
|
|
289
|
+
* Returns projection and model matrix product.
|
|
290
|
+
* @public
|
|
291
|
+
* @return {Mat4} - Projection-view matrix.
|
|
292
|
+
*/
|
|
293
|
+
public getProjectionViewMatrix(): Mat4;
|
|
294
|
+
/**
|
|
295
|
+
* Returns inverse projection and model matrix product.
|
|
296
|
+
* @public
|
|
297
|
+
* @returns {Mat4} - Inversed projection-view matrix.
|
|
298
|
+
*/
|
|
299
|
+
public getInverseProjectionViewMatrix(): Mat4;
|
|
300
|
+
/**
|
|
301
|
+
* Returns inverse projection matrix.
|
|
302
|
+
* @public
|
|
303
|
+
* @returns {Mat4} - Inversed projection-view matrix.
|
|
304
|
+
*/
|
|
305
|
+
public getInverseProjectionMatrix(): Mat4;
|
|
306
|
+
}
|
|
307
|
+
import { Events } from "../Events.js";
|
|
308
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
309
|
+
import { Mat3 } from "../math/Mat3.js";
|
|
310
|
+
import { Mat4 } from "../math/Mat4.js";
|
|
311
|
+
import { Frustum } from "./Frustum.js";
|
|
312
|
+
import { Vec2 } from "../math/Vec2.js";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frustum object, part of the camera object.
|
|
3
|
+
* @class
|
|
4
|
+
*/
|
|
5
|
+
export class Frustum {
|
|
6
|
+
/**
|
|
7
|
+
* @param {*} options
|
|
8
|
+
*/
|
|
9
|
+
constructor(options?: any);
|
|
10
|
+
/**
|
|
11
|
+
* Frustum planes.
|
|
12
|
+
* @private
|
|
13
|
+
* @type {Array.<Array.<number>>}
|
|
14
|
+
*/
|
|
15
|
+
private _f;
|
|
16
|
+
/**
|
|
17
|
+
* Camera projection matrix.
|
|
18
|
+
* @protected
|
|
19
|
+
* @type {Mat4}
|
|
20
|
+
*/
|
|
21
|
+
protected _projectionMatrix: Mat4;
|
|
22
|
+
/**
|
|
23
|
+
* Camera inverse projection matrix.
|
|
24
|
+
* @protected
|
|
25
|
+
* @type {Mat4}
|
|
26
|
+
*/
|
|
27
|
+
protected _inverseProjectionMatrix: Mat4;
|
|
28
|
+
/**
|
|
29
|
+
* Product of projection and view matrices.
|
|
30
|
+
* @protected
|
|
31
|
+
* @type {Mat4}
|
|
32
|
+
*/
|
|
33
|
+
protected _projectionViewMatrix: Mat4;
|
|
34
|
+
/**
|
|
35
|
+
* Inverse projectionView Matrix.
|
|
36
|
+
* @protected
|
|
37
|
+
* @type {Mat4}
|
|
38
|
+
*/
|
|
39
|
+
protected _inverseProjectionViewMatrix: Mat4;
|
|
40
|
+
/**
|
|
41
|
+
* Projection frustum left value.
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
public left: number;
|
|
45
|
+
/**
|
|
46
|
+
* Projection frustum right value.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
public right: number;
|
|
50
|
+
/**
|
|
51
|
+
* Projection frustum bottom value.
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
public bottom: number;
|
|
55
|
+
/**
|
|
56
|
+
* Projection frustum top value.
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
public top: number;
|
|
60
|
+
/**
|
|
61
|
+
* Projection frustum near value.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
public near: number;
|
|
65
|
+
/**
|
|
66
|
+
* Projection frustum far value.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
public far: number;
|
|
70
|
+
_cameraFrustumIndex: any;
|
|
71
|
+
getRightPlane(): number[];
|
|
72
|
+
getLeftPlane(): number[];
|
|
73
|
+
getBottomPlane(): number[];
|
|
74
|
+
getTopPlane(): number[];
|
|
75
|
+
getBackwardPlane(): number[];
|
|
76
|
+
getForwardPlane(): number[];
|
|
77
|
+
getProjectionViewMatrix(): number[];
|
|
78
|
+
getProjectionMatrix(): number[];
|
|
79
|
+
getInverseProjectionMatrix(): number[];
|
|
80
|
+
/**
|
|
81
|
+
* Sets up camera projection matrix.
|
|
82
|
+
* @public
|
|
83
|
+
* @param {nnumber} angle - Camera's view angle.
|
|
84
|
+
* @param {number} aspect - Screen aspect ration.
|
|
85
|
+
* @param {number} near - Near camera distance.
|
|
86
|
+
* @param {number} far - Far camera distance.
|
|
87
|
+
*/
|
|
88
|
+
public setProjectionMatrix(angle: nnumber, aspect: number, near: number, far: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Camera's projection matrix values.
|
|
91
|
+
* @public
|
|
92
|
+
* @param {Mat4} projectionView - projectionView matrix.
|
|
93
|
+
*/
|
|
94
|
+
public setViewMatrix(viewMatrix: any): void;
|
|
95
|
+
/**
|
|
96
|
+
* Returns true if a point in the frustum.
|
|
97
|
+
* @public
|
|
98
|
+
* @param {Vec3} point - Cartesian point.
|
|
99
|
+
* @returns {boolean} -
|
|
100
|
+
*/
|
|
101
|
+
public containsPoint(point: Vec3): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Returns true if the frustum contains a bonding sphere, but bottom plane exclude.
|
|
104
|
+
* @public
|
|
105
|
+
* @param {Sphere} sphere - Bounding sphere.
|
|
106
|
+
* @returns {boolean} -
|
|
107
|
+
*/
|
|
108
|
+
public containsSphereBottomExc(sphere: Sphere): boolean;
|
|
109
|
+
containsSphereButtom(sphere: any): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Returns true if the frustum contains a bonding sphere.
|
|
112
|
+
* @public
|
|
113
|
+
* @param {Sphere} sphere - Bounding sphere.
|
|
114
|
+
* @returns {boolean} -
|
|
115
|
+
*/
|
|
116
|
+
public containsSphere(sphere: Sphere): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Returns true if the frustum contains a bonding sphere.
|
|
119
|
+
* @public
|
|
120
|
+
* @param {Vec3} center - Sphere center.
|
|
121
|
+
* @param {number} radius - Sphere radius.
|
|
122
|
+
* @returns {boolean} -
|
|
123
|
+
*/
|
|
124
|
+
public containsSphere2(center: Vec3, radius: number): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Returns true if the frustum contains a bounding box.
|
|
127
|
+
* @public
|
|
128
|
+
* @param {Box} box - Bounding box.
|
|
129
|
+
* @returns {boolean} -
|
|
130
|
+
*/
|
|
131
|
+
public containsBox(box: Box): boolean;
|
|
132
|
+
}
|
|
133
|
+
import { Mat4 } from "../math/Mat4.js";
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planet camera.
|
|
3
|
+
* @class
|
|
4
|
+
* @extends {Camera}
|
|
5
|
+
* @param {RenderNode} planet - Planet render node.
|
|
6
|
+
* @param {Object} [options] - Planet camera options:
|
|
7
|
+
* @param {Object} [options.name] - Camera name.
|
|
8
|
+
* @param {number} [options.viewAngle=37] - Camera angle of view. Default is 35.0
|
|
9
|
+
* @param {number} [options.near] - Camera near plane distance. Default is 1.0
|
|
10
|
+
* @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
|
|
11
|
+
* @param {number} [options.minAltitude] - Minimal altitude for the camera. Deafult is 1
|
|
12
|
+
* @param {number} [options.maxAltitude] - Maximal altitude for the camera. Deafult is 20000000
|
|
13
|
+
* @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
|
|
14
|
+
* @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
|
|
15
|
+
* @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
|
|
16
|
+
*/
|
|
17
|
+
export class PlanetCamera extends Camera {
|
|
18
|
+
/**
|
|
19
|
+
* @param {RenderNode} planet - Planet render node.
|
|
20
|
+
* @param {Object} [options] - Planet camera options:
|
|
21
|
+
*/
|
|
22
|
+
constructor(planet: RenderNode, options?: any);
|
|
23
|
+
/**
|
|
24
|
+
* Assigned camera's planet.
|
|
25
|
+
* @public
|
|
26
|
+
* @type {Planet}
|
|
27
|
+
*/
|
|
28
|
+
public planet: Planet;
|
|
29
|
+
/**
|
|
30
|
+
* Minimal alltitude that camera can reach over the terrain.
|
|
31
|
+
* @public
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
public minAltitude: number;
|
|
35
|
+
/**
|
|
36
|
+
* Maximal alltitude that camera can reach over the globe.
|
|
37
|
+
* @public
|
|
38
|
+
* @type {number}
|
|
39
|
+
*/
|
|
40
|
+
public maxAltitude: number;
|
|
41
|
+
/**
|
|
42
|
+
* Current geographical degree position.
|
|
43
|
+
* @protected
|
|
44
|
+
* @type {LonLat}
|
|
45
|
+
*/
|
|
46
|
+
protected _lonLat: LonLat;
|
|
47
|
+
/**
|
|
48
|
+
* Current geographical mercator position.
|
|
49
|
+
* @protected
|
|
50
|
+
* @type {LonLat}
|
|
51
|
+
*/
|
|
52
|
+
protected _lonLatMerc: LonLat;
|
|
53
|
+
/**
|
|
54
|
+
* Current altitude.
|
|
55
|
+
* @protected
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
protected _terrainAltitude: number;
|
|
59
|
+
/**
|
|
60
|
+
* Cartesian coordinates on the terrain.
|
|
61
|
+
* @protected
|
|
62
|
+
* @type {Vec3}
|
|
63
|
+
*/
|
|
64
|
+
protected _terrainPoint: Vec3;
|
|
65
|
+
/**
|
|
66
|
+
* Quad node that camera flies over.
|
|
67
|
+
* @protected
|
|
68
|
+
* @type {quadTree.Node}
|
|
69
|
+
*/
|
|
70
|
+
protected _insideSegment: quadTree.Node;
|
|
71
|
+
/**
|
|
72
|
+
* Coordinates that depends on what segment class we are fling over.
|
|
73
|
+
* It can be WGS84 or Mercator coordinates. Gets in og.quadTree.Node
|
|
74
|
+
* @protected
|
|
75
|
+
* @type {LonLat}
|
|
76
|
+
*/
|
|
77
|
+
protected _insideSegmentPosition: LonLat;
|
|
78
|
+
slope: number;
|
|
79
|
+
_keyLock: Key;
|
|
80
|
+
_framesArr: any[];
|
|
81
|
+
_framesCounter: number;
|
|
82
|
+
_numFrames: number;
|
|
83
|
+
_completeCallback: any;
|
|
84
|
+
_flying: boolean;
|
|
85
|
+
eyeNorm: Vec3;
|
|
86
|
+
updateGeodeticPosition(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Sets altitude over the terrain.
|
|
89
|
+
* @public
|
|
90
|
+
* @param {number} alt - Altitude over the terrain.
|
|
91
|
+
*/
|
|
92
|
+
public setAltitude(alt: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Gets altitude over the terrain.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
public getAltitude(): number;
|
|
98
|
+
/**
|
|
99
|
+
* Places camera to view to the geographical point.
|
|
100
|
+
* @public
|
|
101
|
+
* @param {LonLat} lonlat - New camera and camera view position.
|
|
102
|
+
* @param {LonLat} [lookLonLat] - Look up coordinates.
|
|
103
|
+
* @param {Vec3} [up] - Camera UP vector. Default (0,1,0)
|
|
104
|
+
*/
|
|
105
|
+
public setLonLat(lonlat: LonLat, lookLonLat?: LonLat, up?: Vec3): void;
|
|
106
|
+
/**
|
|
107
|
+
* Returns camera geographical position.
|
|
108
|
+
* @public
|
|
109
|
+
* @returns {LonLat}
|
|
110
|
+
*/
|
|
111
|
+
public getLonLat(): LonLat;
|
|
112
|
+
/**
|
|
113
|
+
* Returns camera height.
|
|
114
|
+
* @public
|
|
115
|
+
* @returns {number}
|
|
116
|
+
*/
|
|
117
|
+
public getHeight(): number;
|
|
118
|
+
/**
|
|
119
|
+
* Gets position by viewable extent.
|
|
120
|
+
* @public
|
|
121
|
+
* @param {Extent} extent - Viewable extent.
|
|
122
|
+
* @param {Number} height - Camera height
|
|
123
|
+
* @returns {Vec3}
|
|
124
|
+
*/
|
|
125
|
+
public getExtentPosition(extent: Extent, height: number): Vec3;
|
|
126
|
+
/**
|
|
127
|
+
* View current extent.
|
|
128
|
+
* @public
|
|
129
|
+
* @param {Extent} extent - Current extent.
|
|
130
|
+
*/
|
|
131
|
+
public viewExtent(extent: Extent, height: any): void;
|
|
132
|
+
/**
|
|
133
|
+
* Flies to the current extent.
|
|
134
|
+
* @public
|
|
135
|
+
* @param {Extent} extent - Current extent.
|
|
136
|
+
* @param {Vec3} [up] - Camera UP in the end of flying. Default - (0,1,0)
|
|
137
|
+
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
138
|
+
* @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
|
|
139
|
+
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
|
|
140
|
+
* @param [frameCallback]
|
|
141
|
+
*/
|
|
142
|
+
public flyExtent(extent: Extent, height: any, up?: Vec3, ampl?: number, completeCallback?: cameraCallback, startCallback?: cameraCallback, frameCallback?: any): void;
|
|
143
|
+
viewDistance(cartesian: any, distance?: number): void;
|
|
144
|
+
flyDistance(cartesian: any, distance: number, ampl: number, completeCallback: any, startCallback: any, frameCallback: any): void;
|
|
145
|
+
/**
|
|
146
|
+
* Flies to the cartesian coordinates.
|
|
147
|
+
* @public
|
|
148
|
+
* @param {Vec3} cartesian - Finish cartesian coordinates.
|
|
149
|
+
* @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
|
|
150
|
+
* @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
|
|
151
|
+
* @param {Number} [ampl=1.0] - Altitude amplitude factor.
|
|
152
|
+
* @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
|
|
153
|
+
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
|
|
154
|
+
* @param [frameCallback]
|
|
155
|
+
*/
|
|
156
|
+
public flyCartesian(cartesian: Vec3, look?: Vec3, up?: Vec3, ampl?: number, completeCallback?: cameraCallback, startCallback?: cameraCallback, frameCallback?: any): void;
|
|
157
|
+
_frameCallback: any;
|
|
158
|
+
/**
|
|
159
|
+
* Flies to the geo coordiantes.
|
|
160
|
+
* @public
|
|
161
|
+
* @param {LonLat} lonlat - Finish coordinates.
|
|
162
|
+
* @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
|
|
163
|
+
* @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
|
|
164
|
+
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
165
|
+
* @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
|
|
166
|
+
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
|
|
167
|
+
*/
|
|
168
|
+
public flyLonLat(lonlat: LonLat, look?: Vec3, up?: Vec3, ampl?: number, completeCallback?: cameraCallback, startCallback?: cameraCallback): void;
|
|
169
|
+
/**
|
|
170
|
+
* Breaks the flight.
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
public stopFlying(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Returns camera is flying.
|
|
176
|
+
* @public
|
|
177
|
+
* @returns {boolean}
|
|
178
|
+
*/
|
|
179
|
+
public isFlying(): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Rotates around planet to the left.
|
|
182
|
+
* @public
|
|
183
|
+
* @param {number} angle - Rotation angle.
|
|
184
|
+
* @param {boolean} [spin] - If its true rotates around globe spin.
|
|
185
|
+
*/
|
|
186
|
+
public rotateLeft(angle: number, spin?: boolean): void;
|
|
187
|
+
/**
|
|
188
|
+
* Rotates around planet to the right.
|
|
189
|
+
* @public
|
|
190
|
+
* @param {number} angle - Rotation angle.
|
|
191
|
+
* @param {boolean} [spin] - If its true rotates around globe spin.
|
|
192
|
+
*/
|
|
193
|
+
public rotateRight(angle: number, spin?: boolean): void;
|
|
194
|
+
/**
|
|
195
|
+
* Rotates around planet to the north pole.
|
|
196
|
+
* @public
|
|
197
|
+
* @param {number} angle - Rotation angle.
|
|
198
|
+
*/
|
|
199
|
+
public rotateUp(angle: number): void;
|
|
200
|
+
/**
|
|
201
|
+
* Rotates around planet to the south pole.
|
|
202
|
+
* @public
|
|
203
|
+
* @param {number} angle - Rotation angle.
|
|
204
|
+
*/
|
|
205
|
+
public rotateDown(angle: number): void;
|
|
206
|
+
/**
|
|
207
|
+
* Prepare camera to the frame. Used in render node frame function.
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
public checkFly(): void;
|
|
211
|
+
checkTerrainCollision(): void;
|
|
212
|
+
getSurfaceVisibleDistance(d: any): number;
|
|
213
|
+
getHeading(): number;
|
|
214
|
+
isVisible(poi: any): boolean;
|
|
215
|
+
}
|
|
216
|
+
import { Camera } from "./Camera.js";
|
|
217
|
+
import { LonLat } from "../LonLat.js";
|
|
218
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
219
|
+
import { Key } from "../Lock.js";
|