@openglobus/og 1.0.0-rc1 → 1.0.0-rc11
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 +3 -1
- package/lib/Globe.d.ts +15 -6
- package/lib/Object3d.d.ts +1 -1
- package/lib/assets/LabelWorker.worker-C24YLEkW.js.map +1 -0
- package/lib/assets/PlainSegmentWorker.worker-DJHXd0bF.js.map +1 -0
- package/lib/assets/TerrainWorker.worker-B4Gp0jCy.js.map +1 -0
- package/lib/camera/Camera.d.ts +42 -8
- package/lib/camera/Frustum.d.ts +37 -1
- package/lib/camera/PlanetCamera.d.ts +22 -4
- package/lib/control/FramebufferPreview.d.ts +18 -2
- package/lib/control/Lighting.d.ts +3 -0
- package/lib/control/Navigation.d.ts +12 -1
- package/lib/control/Sun.d.ts +54 -0
- package/lib/control/depthCamera/DepthCamera.d.ts +118 -0
- package/lib/control/depthCamera/DepthCameraHandler.d.ts +25 -0
- package/lib/control/depthCamera/depth_camera.d.ts +2 -0
- package/lib/control/drawing/PolygonDrawingScene.d.ts +1 -1
- package/lib/control/elevationProfile/ElevationProfileScene.d.ts +1 -1
- package/lib/control/entityEditor/CameraEditorView.d.ts +62 -0
- package/lib/control/entityEditor/EntityEditor.d.ts +2 -1
- package/lib/control/entityEditor/EntityEditorDialog.d.ts +15 -47
- package/lib/control/entityEditor/EntityEditorScene.d.ts +17 -1
- package/lib/control/entityEditor/EntityEditorView.d.ts +68 -0
- package/lib/control/entityEditor/ProjectorEditorView.d.ts +31 -0
- package/lib/control/entityEditor/RotateEntity.d.ts +5 -1
- package/lib/control/heightRuler/HeightRulerScene.d.ts +2 -1
- package/lib/control/index.d.ts +2 -3
- package/lib/control/ruler/RulerScene.d.ts +1 -1
- package/lib/control/selection/SelectionScene.d.ts +1 -1
- package/lib/control/timeline/TimelineControl.d.ts +17 -0
- package/lib/entity/EntityCollection.d.ts +45 -2
- package/lib/entity/billboard/Billboard.d.ts +7 -3
- package/lib/entity/geoObject/GeoObjectHandler.d.ts +3 -0
- package/lib/entity/ray/Ray.d.ts +2 -0
- package/lib/index.d.ts +14 -2
- package/lib/layer/BaseTileMaterialLayer.d.ts +36 -0
- package/lib/layer/CanvasTiles.d.ts +8 -12
- package/lib/layer/Vector.d.ts +59 -7
- package/lib/layer/XYZ.d.ts +5 -21
- package/lib/math/Line2.d.ts +9 -0
- package/lib/og.css +2 -1
- package/lib/og.es.js +1 -1
- package/lib/og.es.js.map +1 -1
- package/lib/quadTree/EntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/quadTree/QuadTreeStrategy.d.ts +3 -1
- package/lib/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/renderer/PhongDeferredShading.d.ts +2 -0
- package/lib/renderer/Renderer.d.ts +30 -2
- package/lib/renderer/RendererEvents.d.ts +1 -0
- package/lib/renderer/cascadeShadows/CascadeShadowManager.d.ts +34 -0
- package/lib/renderer/cascadeShadows/CascadeShadowMap.d.ts +112 -0
- package/lib/renderer/cascadeShadows/cascade_shadow_depth.d.ts +2 -0
- package/lib/renderer/projectors/Projector.d.ts +66 -0
- package/lib/renderer/projectors/ProjectorManager.d.ts +85 -0
- package/lib/renderer/projectors/ProjectorsPass.d.ts +37 -0
- package/lib/renderer/shadows/ShadowManager.d.ts +40 -0
- package/lib/renderer/shadows/ShadowMap.d.ts +21 -0
- package/lib/renderer/textureUnits.d.ts +6 -0
- package/lib/res/fonts/Ephesis-Regular.json +1 -0
- package/lib/res/fonts/Ephesis-Regular.png +0 -0
- package/lib/res/fonts/Karla-Bold.json +1 -0
- package/lib/res/fonts/Karla-Bold.png +0 -0
- package/lib/res/fonts/Karla-Italic.json +1 -0
- package/lib/res/fonts/Karla-Italic.png +0 -0
- package/lib/res/fonts/Karla-Light.json +1 -0
- package/lib/res/fonts/Karla-Light.png +0 -0
- package/lib/res/fonts/Karla-Medium.json +1 -0
- package/lib/res/fonts/Karla-Medium.png +0 -0
- package/lib/res/fonts/Roboto-Regular.json +1 -37147
- package/lib/res/fonts/Roboto-Regular.png +0 -0
- package/lib/res/fonts/arial.json +1 -4321
- package/lib/res/fonts/arial.png +0 -0
- package/lib/scene/Axes.d.ts +1 -0
- package/lib/scene/Planet.d.ts +27 -6
- package/lib/scene/Scene.d.ts +2 -10
- package/lib/scene/SkyBox.d.ts +2 -1
- package/lib/segment/Segment.d.ts +10 -1
- package/lib/shaders/common/uniforms.d.ts +27 -0
- package/lib/shaders/geo_object/geo_object.d.ts +1 -0
- package/lib/shaders/projectorsPass/projectorsPass.d.ts +2 -0
- package/lib/shaders/tone_mapping/toneMapping.d.ts +1 -1
- package/lib/shaders/varianceBlur.d.ts +2 -0
- package/lib/terrain/EmptyTerrain.d.ts +1 -1
- package/lib/terrain/MapterhornTerrain.d.ts +10 -0
- package/lib/terrain/RgbTerrain.d.ts +11 -0
- package/lib/terrain/index.d.ts +6 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/ui/Color.d.ts +5 -2
- package/lib/ui/Input.d.ts +17 -1
- package/lib/ui/Slider.d.ts +2 -0
- package/lib/ui/TitleBarView.d.ts +21 -0
- package/lib/ui/index.d.ts +1 -0
- package/lib/utils/FontAtlas.d.ts +52 -8
- package/lib/utils/gltf/types.d.ts +5 -4
- package/lib/utils/shared.d.ts +1 -0
- package/lib/webgl/BaseFramebuffer.d.ts +28 -0
- package/lib/webgl/Framebuffer.d.ts +5 -7
- package/lib/webgl/Handler.d.ts +13 -0
- package/package.json +13 -11
- package/lib/assets/LabelWorker.worker-DYd7xn3M.js.map +0 -1
- package/lib/assets/PlainSegmentWorker.worker-JsKldq-e.js.map +0 -1
- package/lib/assets/TerrainWorker.worker-CqUJvMOv.js.map +0 -1
- package/lib/control/CameraFrameComposer.d.ts +0 -19
- package/lib/control/CameraFrameHandler.d.ts +0 -26
- package/lib/control/cameraDepthHandler/CameraDepthHandler.d.ts +0 -42
- package/lib/control/cameraDepthHandler/camera_depth.d.ts +0 -2
- package/lib/res/fonts/Roboto-Regular.ttf.cfg +0 -1340
- package/lib/res/fonts/Roboto-Regular.ttf.png +0 -0
- package/lib/res/fonts/arial.ttf.cfg +0 -1570
- package/lib/res/fonts/arial.ttf.png +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# OpenGlobus
|
|
5
5
|
|
|
6
|
-
[
|
|
6
|
+
[OpenGlobus](https://www.openglobus.org/) is a typescript/javascript library designed to display interactive 3D maps and other geospatial data at a
|
|
7
7
|
scale from planet to bee.
|
|
8
8
|
|
|
9
9
|
It supports various high-resolution terrain providers, imagery layers, renders thousands of 3D objects, provides
|
|
@@ -139,3 +139,5 @@ There are many ways to contribute back to the project:
|
|
|
139
139
|
## License
|
|
140
140
|
|
|
141
141
|
### Apache-2.0
|
|
142
|
+
---
|
|
143
|
+
OpenGlobus. Precision at all scales.
|
package/lib/Globe.d.ts
CHANGED
|
@@ -18,8 +18,9 @@ export interface IGlobeParams {
|
|
|
18
18
|
attributionContainer?: HTMLElement;
|
|
19
19
|
target?: string | HTMLElement;
|
|
20
20
|
skybox?: Scene;
|
|
21
|
-
|
|
21
|
+
pixelRatio?: number;
|
|
22
22
|
msaa?: number;
|
|
23
|
+
deferredDisabled?: boolean;
|
|
23
24
|
name?: string;
|
|
24
25
|
frustums?: NumberArray2[];
|
|
25
26
|
ellipsoid?: Ellipsoid;
|
|
@@ -41,10 +42,14 @@ export interface IGlobeParams {
|
|
|
41
42
|
sun?: {
|
|
42
43
|
active?: boolean;
|
|
43
44
|
stopped?: boolean;
|
|
45
|
+
localDateTime?: Date | null;
|
|
44
46
|
};
|
|
45
47
|
navigation?: {
|
|
46
48
|
active?: boolean;
|
|
47
49
|
inertia?: number;
|
|
50
|
+
minInertia?: number;
|
|
51
|
+
maxInertia?: number;
|
|
52
|
+
minInertiaAltitude?: number;
|
|
48
53
|
dragInertia?: number;
|
|
49
54
|
minSlope?: number;
|
|
50
55
|
mass?: number;
|
|
@@ -66,6 +71,7 @@ export interface IGlobeParams {
|
|
|
66
71
|
exposure?: number;
|
|
67
72
|
maxNodesCount?: number;
|
|
68
73
|
transparentBackground?: boolean;
|
|
74
|
+
frameOpacity?: number;
|
|
69
75
|
shadeMode?: ShadeModeInput;
|
|
70
76
|
reverseDepth?: boolean;
|
|
71
77
|
}
|
|
@@ -105,24 +111,27 @@ export interface IGlobeParams {
|
|
|
105
111
|
* @param {boolean} [options.autoActivate=true] - Globe rendering auto activation flag. True is default.
|
|
106
112
|
* @param {HTMLElement} [options.attributionContainer] - Container for attribution list.
|
|
107
113
|
* @param {number} [options.maxGridSize=128] = Maximal segment grid size. 128 is default
|
|
108
|
-
* @param {string} [options.fontsSrc] -
|
|
114
|
+
* @param {string} [options.fontsSrc] - Fonts collection url.
|
|
109
115
|
* @param {string} [options.resourcesSrc] - Resources root src.
|
|
110
|
-
* @param {string} [options.nightTextureSrc] - Night
|
|
116
|
+
* @param {string} [options.nightTextureSrc] - Night-glowing image sources
|
|
111
117
|
* @param {string} [options.specularTextureSrc] - Specular water mask image sourcr
|
|
112
|
-
* @param {number} [options.maxAltitude
|
|
118
|
+
* @param {number} [options.maxAltitude] - Maximal camera altitude above terrain
|
|
113
119
|
* @param {number} [options.minAltitude=1.0] - Minimal camera altitude above terrain
|
|
114
|
-
* @param {number} [options.maxEqualZoomAltitude
|
|
120
|
+
* @param {number} [options.maxEqualZoomAltitude] - Maximal altitude since segments on the screen became the same zoom level
|
|
115
121
|
* @param {number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen became the same zoom level
|
|
116
122
|
* @param {number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above the globe where segments on the screen became the same zoom level
|
|
117
123
|
* @param {number} [options.loadingBatchSize=12] -
|
|
118
124
|
* @param {number} [options.quadTreeStrategyPrototype] - Prototype of quadTree. QuadTreeStrategy for Earth is default.
|
|
119
125
|
* @param {number} [options.msaa=0] - MSAA antialiasing parameter: 2,4,8,16. Default is 0.
|
|
120
|
-
* @param {
|
|
126
|
+
* @param {boolean} [options.deferredDisabled=false] - Disables deferred and WOIT pipelines and renders objects with forward shaders.
|
|
127
|
+
* @param {number} [options.pixelRatio] - Device pixel ratio. Default is current screen DPI.
|
|
121
128
|
* @param {boolean} [options.atmosphereEnabled] - Enables atmosphere effect.
|
|
122
129
|
* @param {boolean} [options.transtitionOpacityEnabled] - Enables terrain smooth opacity transition effect.
|
|
123
130
|
* @param {IAtmosphereParams} [options.atmosphereParameters] - Atmosphere model parameters.
|
|
124
131
|
* @param {number} [options.gamma] - Gamma
|
|
125
132
|
* @param {number} [options.exposure] - Exposure
|
|
133
|
+
* @param {boolean} [options.transparentBackground=false] - Enables a transparent WebGL canvas background so HTML behind the globe container remains visible.
|
|
134
|
+
* @param {number} [options.frameOpacity=1.0] - Frame opacity applied by renderer transparency flags.
|
|
126
135
|
* @param {boolean} [options.reverseDepth=true] - Enables reverse-Z depth for the planet camera perspective mode.
|
|
127
136
|
*/
|
|
128
137
|
declare class Globe {
|
package/lib/Object3d.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ declare class Object3d {
|
|
|
71
71
|
static scale(vertices: number[], s: Vec3): void;
|
|
72
72
|
static centroid(vertices: number[]): number[];
|
|
73
73
|
static translate(vertices: number[], v: NumberArray3): void;
|
|
74
|
-
static getNormals(vertices: number[]): number[];
|
|
74
|
+
static getNormals(vertices: number[], indices?: number[]): number[];
|
|
75
75
|
static createSphere(lonBands?: number, latBands?: number, radius?: number, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
|
|
76
76
|
static createDisc(radius?: number, height?: number, radialSegments?: number, isTop?: boolean, startIndex?: number, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
|
|
77
77
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelWorker.worker-C24YLEkW.js","names":[],"sources":["../../src/entity/label/LabelWorker.worker.js"],"sourcesContent":["\"use strict\";\n\nfunction concatTypedArrays(dest, index, source) {\n let len = source.length,\n offset = index * len;\n for (let i = 0; i < len; i++) {\n dest[offset + i] = source[i];\n }\n}\n\nfunction srgbToLinear(v) {\n return Math.pow(v, 2.2);\n}\n\nself.onmessage = function (e) {\n var labelData = e.data.labelData,\n id = labelData[0],\n maxLetters = labelData[1],\n isVisible = labelData[2],\n /*3, 4, 5*/ _positionHigh_x = labelData[3],\n _positionHigh_y = labelData[4],\n _positionHigh_z = labelData[5],\n /*6, 7, 8*/ _positionLow_x = labelData[6],\n _positionLow_y = labelData[7],\n _positionLow_z = labelData[8],\n /*9*/ _size = labelData[9],\n /*10, 11*/ _offset_x = labelData[10],\n _offset_y = labelData[11],\n /*12, 13, 14, 15*/ _color_x = labelData[12],\n _color_y = labelData[13],\n _color_z = labelData[14],\n _color_w = labelData[15],\n /*16*/ _rotation = labelData[16],\n /*17, 18, 19*/ _alignedAxis_x = labelData[17],\n _alignedAxis_y = labelData[18],\n _alignedAxis_z = labelData[19],\n /*20*/ _fontIndex = labelData[20],\n /*21*/ _outline = labelData[21],\n /*22, 23, 24, 25*/ _outlineColor_x = labelData[22],\n _outlineColor_y = labelData[23],\n _outlineColor_z = labelData[24],\n _outlineColor_w = labelData[25],\n /*26, 27, 28*/ _pickingColor_x = labelData[26],\n _pickingColor_y = labelData[27],\n _pickingColor_z = labelData[28];\n\n let _vertexArr = new Float32Array(maxLetters * 12),\n _texCoordArr = new Float32Array(maxLetters * 24),\n _gliphParamArr = new Float32Array(maxLetters * 24),\n _positionHighArr = new Float32Array(maxLetters * 18),\n _positionLowArr = new Float32Array(maxLetters * 18),\n _sizeArr = new Float32Array(maxLetters * 6),\n _offsetArr = new Float32Array(maxLetters * 12),\n _rgbaArr = new Float32Array(maxLetters * 24),\n _rotationArr = new Float32Array(maxLetters * 6),\n _alignedAxisArr = new Float32Array(maxLetters * 18),\n _fontIndexArr = new Float32Array(maxLetters * 6),\n _outlineArr = new Float32Array(maxLetters * 6),\n _outlineColorArr = new Float32Array(maxLetters * 24),\n _pickingColorArr = new Float32Array(maxLetters * 18);\n\n for (let i = 0; i < maxLetters; i++) {\n if (isVisible !== 0) {\n concatTypedArrays(_vertexArr, i, [0, 0, 0, -1, 1, -1, 1, -1, 1, 0, 0, 0]);\n } else {\n concatTypedArrays(_vertexArr, i, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n }\n\n concatTypedArrays(\n _texCoordArr,\n i,\n [0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0]\n );\n concatTypedArrays(_gliphParamArr, i, [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]);\n\n var x = _positionHigh_x,\n y = _positionHigh_y,\n z = _positionHigh_z,\n w;\n concatTypedArrays(_positionHighArr, i, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);\n\n x = _positionLow_x;\n y = _positionLow_y;\n z = _positionLow_z;\n concatTypedArrays(_positionLowArr, i, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);\n\n x = _size;\n concatTypedArrays(_sizeArr, i, [x, x, x, x, x, x]);\n\n x = _offset_x;\n y = _offset_y;\n concatTypedArrays(_offsetArr, i, [x, y, x, y, x, y, x, y, x, y, x, y]);\n\n x = srgbToLinear(_color_x);\n y = srgbToLinear(_color_y);\n z = srgbToLinear(_color_z);\n w = _color_w;\n concatTypedArrays(_rgbaArr, i, [x, y, z, w, x, y, z, w, x, y, z, w, x, y, z, w, x, y, z, w, x, y, z, w]);\n\n x = _rotation;\n concatTypedArrays(_rotationArr, i, [x, x, x, x, x, x]);\n\n x = _alignedAxis_x;\n y = _alignedAxis_y;\n z = _alignedAxis_z;\n concatTypedArrays(_alignedAxisArr, i, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);\n\n x = _fontIndex;\n concatTypedArrays(_fontIndexArr, i, [x, x, x, x, x, x]);\n\n x = _outline;\n concatTypedArrays(_outlineArr, i, [x, x, x, x, x, x]);\n\n x = srgbToLinear(_outlineColor_x);\n y = srgbToLinear(_outlineColor_y);\n z = srgbToLinear(_outlineColor_z);\n w = _outlineColor_w;\n concatTypedArrays(_outlineColorArr, i, [\n x,\n y,\n z,\n w,\n x,\n y,\n z,\n w,\n x,\n y,\n z,\n w,\n x,\n y,\n z,\n w,\n x,\n y,\n z,\n w,\n x,\n y,\n z,\n w\n ]);\n\n x = _pickingColor_x / 255;\n y = _pickingColor_y / 255;\n z = _pickingColor_z / 255;\n concatTypedArrays(_pickingColorArr, i, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);\n }\n\n self.postMessage(\n {\n id: id,\n vertexArr: _vertexArr,\n texCoordArr: _texCoordArr,\n gliphParamArr: _gliphParamArr,\n positionHighArr: _positionHighArr,\n positionLowArr: _positionLowArr,\n sizeArr: _sizeArr,\n offsetArr: _offsetArr,\n rgbaArr: _rgbaArr,\n rotationArr: _rotationArr,\n alignedAxisArr: _alignedAxisArr,\n fontIndexArr: _fontIndexArr,\n outlineArr: _outlineArr,\n outlineColorArr: _outlineColorArr,\n pickingColorArr: _pickingColorArr\n },\n [\n _vertexArr.buffer,\n _texCoordArr.buffer,\n _gliphParamArr.buffer,\n _positionHighArr.buffer,\n _positionLowArr.buffer,\n _sizeArr.buffer,\n _offsetArr.buffer,\n _rgbaArr.buffer,\n _rotationArr.buffer,\n _alignedAxisArr.buffer,\n _fontIndexArr.buffer,\n _outlineArr.buffer,\n _outlineColorArr.buffer,\n _pickingColorArr.buffer\n ]\n );\n};\n"],"mappings":"yBAEA,SAAS,EAAkB,EAAM,EAAO,EAAA,CACpC,IAAI,EAAM,EAAO,OACb,EAAS,EAAQ,EACrB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,IACrB,EAAK,EAAS,GAAK,EAAO,EAElC,CAEA,SAAS,EA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,EAAiB,OACjB,EAAgB,OAChB,EAAS,OACT,EAAW,OACX,EAAS,OACT,EAAa,OACb,EAAgB,OAChB,EAAc,OACd,EAAY,OACZ,EAAiB,OACjB,EAAiB,MAAA,CAAA,CAG7B,CAAA,EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlainSegmentWorker.worker-DJHXd0bF.js","names":[],"sources":["../../src/utils/PlainSegmentWorker.worker.js"],"sourcesContent":["\"use strict\";\n\nlet model = null;\n\nlet cached_ix = null;\nlet cached_iy = null;\nlet v00 = null;\nlet v01 = null;\nlet v10 = null;\nlet v11 = null;\n//let t = null;\n\nfunction rawval(ix, iy) {\n if (iy < 0) {\n iy = -iy;\n ix += model.width / 2;\n } else if (iy >= model.height) {\n iy = 2 * (model.height - 1) - iy;\n ix += model.width / 2;\n }\n\n if (ix < 0) {\n ix += model.width;\n } else if (ix >= model.width) {\n ix -= model.width;\n }\n\n var k = (iy * model.width + ix) * 2 + model.i;\n\n return (model.rawfile[k] << 8) | model.rawfile[k + 1];\n}\n\nfunction getHeightMSL(lon, lat) {\n if (!model) return 0;\n\n if (lon < 0) lon += 360.0;\n\n var fy = (90 - lat) * model.rlatres;\n var fx = lon * model.rlonres;\n var iy = Math.floor(fy);\n var ix = Math.floor(fx);\n\n fx -= ix;\n fy -= iy;\n\n if (iy === model.height - 1) {\n iy--;\n }\n\n if (cached_ix !== ix || cached_iy !== iy) {\n cached_ix = ix;\n cached_iy = iy;\n\n v00 = rawval(ix, iy);\n v01 = rawval(ix + 1, iy);\n v10 = rawval(ix, iy + 1);\n v11 = rawval(ix + 1, iy + 1);\n }\n\n let h = null;\n\n var a = (1 - fx) * v00 + fx * v01;\n var b = (1 - fx) * v10 + fx * v11;\n\n h = (1 - fy) * a + fy * b;\n\n return model.offset + model.scale * h;\n}\n\nconst HALF_PI = Math.PI * 0.5;\nconst POLE = 20037508.34;\nconst PI_BY_POLE = Math.PI / POLE;\nconst INV_POLE_BY_180 = 180.0 / POLE;\nconst INV_PI_BY_180 = 180.0 / Math.PI;\nconst INV_PI_BY_180_HALF_PI = INV_PI_BY_180 * HALF_PI;\nconst RADIANS = Math.PI / 180.0;\nconst INV_PI_BY_360 = INV_PI_BY_180 * 2.0;\n\nlet E2 = 0.0,\n A = 0.0;\n\nlet _projFunc = null;\n\nconst Vec3 = function (x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n};\n\nvar geodeticToCartesian = function (lon, lat, heightFactor, res) {\n let h = getHeightMSL(lon, lat) * heightFactor;\n\n let latrad = RADIANS * lat,\n lonrad = RADIANS * lon;\n\n let slt = Math.sin(latrad);\n\n let N = A / Math.sqrt(1.0 - E2 * slt * slt);\n let nc = (N + h) * Math.cos(latrad);\n\n res.x = nc * Math.cos(lonrad);\n res.y = nc * Math.sin(lonrad);\n res.z = (N * (1 - E2) + h) * slt;\n};\n\nvar geodeticToCartesianInverse = function (lon, lat, heightFactor, res) {\n geodeticToCartesian(\n lon * INV_POLE_BY_180,\n INV_PI_BY_360 * Math.atan(Math.exp(lat * PI_BY_POLE)) - INV_PI_BY_180_HALF_PI,\n heightFactor,\n res\n );\n};\n\nvar worldPos = new Vec3(0.0, 0.0, 0.0);\nvar rtcPos = new Vec3(0.0, 0.0, 0.0);\nvar _tempHigh = new Vec3(0.0, 0.0, 0.0);\nvar _tempLow = new Vec3(0.0, 0.0, 0.0);\n\nvar doubleToTwoFloats = function (v, high, low) {\n let x = v.x,\n y = v.y,\n z = v.z;\n\n var doubleHigh;\n\n if (x >= 0.0) {\n doubleHigh = Math.floor(x / 65536.0) * 65536.0;\n high.x = Math.fround(doubleHigh);\n low.x = Math.fround(x - doubleHigh);\n } else {\n doubleHigh = Math.floor(-x / 65536.0) * 65536.0;\n high.x = Math.fround(-doubleHigh);\n low.x = Math.fround(x + doubleHigh);\n }\n\n if (y >= 0.0) {\n doubleHigh = Math.floor(y / 65536.0) * 65536.0;\n high.y = Math.fround(doubleHigh);\n low.y = Math.fround(y - doubleHigh);\n } else {\n doubleHigh = Math.floor(-y / 65536.0) * 65536.0;\n high.y = Math.fround(-doubleHigh);\n low.y = Math.fround(y + doubleHigh);\n }\n\n if (z >= 0.0) {\n doubleHigh = Math.floor(z / 65536.0) * 65536.0;\n high.z = Math.fround(doubleHigh);\n low.z = Math.fround(z - doubleHigh);\n } else {\n doubleHigh = Math.floor(-z / 65536.0) * 65536.0;\n high.z = Math.fround(-doubleHigh);\n low.z = Math.fround(z + doubleHigh);\n }\n};\n\nself.onmessage = function (msg) {\n if (msg.data.model) {\n model = msg.data.model;\n model.rawfile = msg.data.rawfile;\n } else if (msg.data.params) {\n let rtc_x = msg.data.params[14];\n let rtc_y = msg.data.params[15];\n let rtc_z = msg.data.params[16];\n\n let xmin = 549755748352.0,\n xmax = -549755748352.0,\n ymin = 549755748352.0,\n ymax = -549755748352.0,\n zmin = 549755748352.0,\n zmax = -549755748352.0;\n\n E2 = msg.data.params[8];\n A = msg.data.params[9];\n\n let gridSize = msg.data.params[2],\n fgs = msg.data.params[3],\n r2_x = msg.data.params[10],\n r2_y = msg.data.params[11],\n r2_z = msg.data.params[12];\n\n let heightFactor = msg.data.params[13];\n\n if (msg.data.params[1] === 0.0) {\n _projFunc = geodeticToCartesianInverse;\n } else {\n _projFunc = geodeticToCartesian;\n }\n\n let maxFgs = Math.max(fgs, gridSize);\n let llStep = (msg.data.params[6] - msg.data.params[4]) / maxFgs;\n let ltStep = (msg.data.params[7] - msg.data.params[5]) / maxFgs;\n\n let esw_lon = msg.data.params[4],\n ene_lat = msg.data.params[7];\n\n let dg = Math.max(fgs / gridSize, 1.0),\n gs = maxFgs + 1;\n\n const gsgs = gs * gs;\n\n const gridSize3 = (gridSize + 1) * (gridSize + 1) * 3;\n\n let plainNormals = new Float32Array(gridSize3);\n\n let plainVertices = new Float64Array(gridSize3);\n let plainVerticesHigh = new Float32Array(gridSize3);\n let plainVerticesLow = new Float32Array(gridSize3);\n let normalMapNormals = new Float32Array(gsgs * 3);\n let normalMapVertices = new Float64Array(gsgs * 3);\n\n let ind = 0,\n nmInd = 0;\n\n for (let k = 0; k < gsgs; k++) {\n let j = k % gs,\n i = ~~(k / gs);\n\n _projFunc(esw_lon + j * llStep, ene_lat - i * ltStep, heightFactor, worldPos);\n\n let nx = worldPos.x * r2_x,\n ny = worldPos.y * r2_y,\n nz = worldPos.z * r2_z;\n let l = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);\n let nxl = nx * l,\n nyl = ny * l,\n nzl = nz * l;\n\n rtcPos.x = worldPos.x - rtc_x;\n rtcPos.y = worldPos.y - rtc_y;\n rtcPos.z = worldPos.z - rtc_z;\n\n normalMapVertices[nmInd] = rtcPos.x;\n normalMapNormals[nmInd++] = nxl;\n\n normalMapVertices[nmInd] = rtcPos.y;\n normalMapNormals[nmInd++] = nyl;\n\n normalMapVertices[nmInd] = rtcPos.z;\n normalMapNormals[nmInd++] = nzl;\n\n if (i % dg === 0 && j % dg === 0) {\n doubleToTwoFloats(rtcPos, _tempHigh, _tempLow);\n\n plainVertices[ind] = rtcPos.x;\n plainVerticesHigh[ind] = _tempHigh.x;\n plainVerticesLow[ind] = _tempLow.x;\n plainNormals[ind++] = nxl;\n\n plainVertices[ind] = rtcPos.y;\n plainVerticesHigh[ind] = _tempHigh.y;\n plainVerticesLow[ind] = _tempLow.y;\n plainNormals[ind++] = nyl;\n\n plainVertices[ind] = rtcPos.z;\n plainVerticesHigh[ind] = _tempHigh.z;\n plainVerticesLow[ind] = _tempLow.z;\n plainNormals[ind++] = nzl;\n\n if (worldPos.x < xmin) xmin = worldPos.x;\n if (worldPos.x > xmax) xmax = worldPos.x;\n if (worldPos.y < ymin) ymin = worldPos.y;\n if (worldPos.y > ymax) ymax = worldPos.y;\n if (worldPos.z < zmin) zmin = worldPos.z;\n if (worldPos.z > zmax) zmax = worldPos.z;\n }\n }\n\n let x = (xmax - xmin) * 0.5,\n y = (ymax - ymin) * 0.5,\n z = (zmax - zmin) * 0.5;\n\n let plainRadius = Math.sqrt(x * x + y * y + z * z);\n\n self.postMessage(\n {\n id: msg.data.params[0],\n plainVertices: plainVertices,\n plainVerticesHigh: plainVerticesHigh,\n plainVerticesLow: plainVerticesLow,\n plainNormals: plainNormals,\n normalMapNormals: normalMapNormals,\n normalMapVertices: normalMapVertices,\n plainRadius: plainRadius,\n relativeCenter: [rtc_x, rtc_y, rtc_z]\n },\n [\n plainVertices.buffer,\n plainVerticesHigh.buffer,\n plainVerticesLow.buffer,\n plainNormals.buffer,\n normalMapNormals.buffer,\n normalMapVertices.buffer\n ]\n );\n }\n};\n"],"mappings":"yBAEA,IAAI,EAAQ,KAER,EAAY,KACZ,EAAY,KACZ,EAAM,KACN,EAAM,KACN,EAAM,KACN,EAAM,KAGV,SAAS,EAAO,EAAI,EAAA,CACZ,EAAK,GACL,EAAA,CAAM,EACN,GAAM,EAAM,MAAQ,GACb,GAAM,EAAM,SACnB,EAAK,GAAK,EAAM,OAAS,GAAK,EAC9B,GAAM,EAAM,MAAQ,GAGpB,EAAK,EACL,GAAM,EAAM,MACL,GAAM,EAAM,QACnB,GAAM,EAAM,OAGhB,IAAI,EAA8B,GAAzB,EAAK,EAAM,MAAQ,GAAU,EAAM,EAE5C,OAAQ,EAAM,QAAQ,IAAM,EAAK,EAAM,QAAQ,EAAI,EACvD,CAuCA,IAAM,EAAoB,GAAV,KAAK,GAEf,EAAa,KAAK,GAAK,YAEvB,EAAgB,IAAQ,KAAK,GAC7B,EAAwB,EAAgB,EACxC,EAAU,KAAK,GAAK,IACpB,EAAgC,EAAhB,EAElB,EAAK,EACL,EAAI,EAEJ,EAAY,KAEV,EAAO,SAAU,EAAG,EAAG,EAAA,CACzB,KAAK,EAAI,EACT,KAAK,EAAI,EACT,KAAK,EAAI,CACb,EAEA,IAAI,EAAsB,SAAU,EAAK,EAAK,EAAc,EAAA,CACxD,IAAI,EA1DR,SAAsB,EAAK,EAAA,CACvB,GAAA,CAAK,EAAO,MAAO,GAEf,EAAM,IAAG,GAAO,KAEp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worker-B4Gp0jCy.js","names":[],"sources":["../../src/utils/TerrainWorker.worker.js"],"sourcesContent":["\"use strict\";\n//\n//Terrain worker\n//\n\nfunction binarySearchFast(arr, x) {\n let start = 0,\n end = arr.length - 1;\n while (start <= end) {\n let k = Math.floor((start + end) * 0.5);\n if (Math.abs(arr[k] - x) < 1e-3) return k;\n else if (arr[k] < x) start = k + 1;\n else end = k - 1;\n }\n return -1;\n}\n\nfunction checkNoDataValue(noDataValues, value) {\n return binarySearchFast(noDataValues, value) !== -1;\n}\n\nvar Vec3 = function (x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n};\n\nvar doubleToTwoFloats = function (v, high, low) {\n let x = v.x,\n y = v.y,\n z = v.z;\n\n var doubleHigh;\n\n if (x >= 0.0) {\n doubleHigh = Math.floor(x / 65536.0) * 65536.0;\n high.x = Math.fround(doubleHigh);\n low.x = Math.fround(x - doubleHigh);\n } else {\n doubleHigh = Math.floor(-x / 65536.0) * 65536.0;\n high.x = Math.fround(-doubleHigh);\n low.x = Math.fround(x + doubleHigh);\n }\n\n if (y >= 0.0) {\n doubleHigh = Math.floor(y / 65536.0) * 65536.0;\n high.y = Math.fround(doubleHigh);\n low.y = Math.fround(y - doubleHigh);\n } else {\n doubleHigh = Math.floor(-y / 65536.0) * 65536.0;\n high.y = Math.fround(-doubleHigh);\n low.y = Math.fround(y + doubleHigh);\n }\n\n if (z >= 0.0) {\n doubleHigh = Math.floor(z / 65536.0) * 65536.0;\n high.z = Math.fround(doubleHigh);\n low.z = Math.fround(z - doubleHigh);\n } else {\n doubleHigh = Math.floor(-z / 65536.0) * 65536.0;\n high.z = Math.fround(-doubleHigh);\n low.z = Math.fround(z + doubleHigh);\n }\n};\n\nVec3.prototype.sub = function (v) {\n return new Vec3(this.x - v.x, this.y - v.y, this.z - v.z);\n};\n\nVec3.prototype.add = function (v) {\n return new Vec3(this.x + v.x, this.y + v.y, this.z + v.z);\n};\n\nVec3.prototype.cross = function (v) {\n return new Vec3(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x);\n};\n\nVec3.prototype.normalize = function () {\n var x = this.x,\n y = this.y,\n z = this.z;\n var length = 1.0 / Math.sqrt(x * x + y * y + z * z);\n this.x = x * length;\n this.y = y * length;\n this.z = z * length;\n return this;\n};\n\nVec3.prototype.distance = function (v) {\n return this.sub(v).length();\n};\n\nVec3.prototype.length = function () {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n};\n\nvar blerp = function (x, y, fQ11, fQ21, fQ12, fQ22) {\n return fQ11 * (1.0 - x) * (1.0 - y) + fQ21 * x * (1.0 - y) + fQ12 * (1.0 - x) * y + fQ22 * x * y;\n};\n\nvar _tempVec = new Vec3(0.0, 0.0, 0.0);\nvar _rtcTempVec = new Vec3(0.0, 0.0, 0.0);\n\nvar _tempHigh = new Vec3(0.0, 0.0, 0.0),\n _tempLow = new Vec3(0.0, 0.0, 0.0);\n\nself.onmessage = function (e) {\n var elevations = e.data.elevations,\n this_plainVertices = e.data.this_plainVertices,\n this_plainNormals = e.data.this_plainNormals,\n this_normalMapVertices = e.data.this_normalMapVertices,\n this_normalMapNormals = e.data.this_normalMapNormals,\n heightFactor = e.data.heightFactor,\n gridSize = e.data.gridSize,\n noDataValues = e.data.noDataValues,\n id = e.data.id;\n\n let rtc_x = e.data.relativeCenter[0],\n rtc_y = e.data.relativeCenter[1],\n rtc_z = e.data.relativeCenter[2];\n\n var xmin = 549755748352.0,\n xmax = -549755748352.0,\n ymin = 549755748352.0,\n ymax = -549755748352.0,\n zmin = 549755748352.0,\n zmax = -549755748352.0;\n\n const fileGridSize = Math.sqrt(elevations.length) - 1;\n\n const fileGridSize_one = fileGridSize + 1;\n const fileGridSize_one_x2 = fileGridSize_one * fileGridSize_one;\n const tgs = gridSize;\n const dg = fileGridSize / tgs;\n const gs = tgs + 1;\n const hf = heightFactor;\n\n var vInd = 0,\n noDataInd = 0;\n\n var gsgs3 = gs * gs * 3;\n\n var terrainVertices = new Float64Array(gsgs3),\n terrainVerticesHigh = new Float32Array(gsgs3),\n terrainVerticesLow = new Float32Array(gsgs3),\n noDataVertices = new Uint8Array(gs * gs);\n\n var normalMapNormals, normalMapVertices;\n\n var nv = this_normalMapVertices,\n nn = this_normalMapNormals;\n\n if (fileGridSize >= tgs) {\n normalMapNormals = new Float32Array(fileGridSize_one_x2 * 3);\n normalMapVertices = new Float64Array(fileGridSize_one_x2 * 3);\n\n for (let k = 0; k < fileGridSize_one_x2; k++) {\n var j = k % fileGridSize_one,\n i = ~~(k / fileGridSize_one);\n\n //\n // V0\n //\n var hInd0 = k;\n var vInd0 = hInd0 * 3;\n var currElv = elevations[hInd0];\n if (checkNoDataValue(noDataValues, currElv)) {\n currElv = 0.0;\n }\n var h0 = hf * currElv;\n var v0 = new Vec3(\n rtc_x + nv[vInd0] + h0 * nn[vInd0],\n rtc_y + nv[vInd0 + 1] + h0 * nn[vInd0 + 1],\n rtc_z + nv[vInd0 + 2] + h0 * nn[vInd0 + 2]\n );\n\n normalMapVertices[vInd0] = v0.x - rtc_x;\n normalMapVertices[vInd0 + 1] = v0.y - rtc_y;\n normalMapVertices[vInd0 + 2] = v0.z - rtc_z;\n\n //\n // The vertex goes into screen buffer\n if (i % dg === 0 && j % dg === 0) {\n let currVert = new Vec3(rtc_x + nv[vInd0], rtc_y + nv[vInd0 + 1], rtc_z + nv[vInd0 + 2]);\n let nextVert = new Vec3(rtc_x + nv[vInd0 + 3], rtc_y + nv[vInd0 + 4], rtc_z + nv[vInd0 + 5]);\n\n let nextElv = elevations[hInd0 + 1];\n if (checkNoDataValue(noDataValues, nextElv)) {\n nextElv = 0.0;\n }\n\n let eps = false;\n if (noDataValues.length === 0) {\n let step = currVert.distance(nextVert);\n let deltaElv = Math.abs(currElv - nextElv);\n eps = deltaElv / step > 10.0 || currElv < -5000;\n }\n\n if (eps) {\n noDataVertices[noDataInd] = 1;\n } else {\n noDataVertices[noDataInd] = 0;\n if (v0.x < xmin) xmin = v0.x;\n if (v0.x > xmax) xmax = v0.x;\n if (v0.y < ymin) ymin = v0.y;\n if (v0.y > ymax) ymax = v0.y;\n if (v0.z < zmin) zmin = v0.z;\n if (v0.z > zmax) zmax = v0.z;\n }\n\n let rtc_v0 = new Vec3(v0.x - rtc_x, v0.y - rtc_y, v0.z - rtc_z);\n doubleToTwoFloats(rtc_v0, _tempHigh, _tempLow);\n\n terrainVerticesHigh[vInd] = _tempHigh.x;\n terrainVerticesLow[vInd] = _tempLow.x;\n terrainVertices[vInd++] = rtc_v0.x;\n\n terrainVerticesHigh[vInd] = _tempHigh.y;\n terrainVerticesLow[vInd] = _tempLow.y;\n terrainVertices[vInd++] = rtc_v0.y;\n\n terrainVerticesHigh[vInd] = _tempHigh.z;\n terrainVerticesLow[vInd] = _tempLow.z;\n terrainVertices[vInd++] = rtc_v0.z;\n\n noDataInd++;\n }\n\n if (i !== fileGridSize && j !== fileGridSize) {\n //\n // V1\n //\n var hInd1 = k + 1;\n var vInd1 = hInd1 * 3;\n var elv = elevations[hInd1];\n if (checkNoDataValue(noDataValues, elv)) {\n elv = 0.0;\n }\n var h1 = hf * elv;\n var v1 = new Vec3(\n rtc_x + nv[vInd1] + h1 * nn[vInd1],\n rtc_y + nv[vInd1 + 1] + h1 * nn[vInd1 + 1],\n rtc_z + nv[vInd1 + 2] + h1 * nn[vInd1 + 2]\n );\n\n normalMapVertices[vInd1] = v1.x - rtc_x;\n normalMapVertices[vInd1 + 1] = v1.y - rtc_y;\n normalMapVertices[vInd1 + 2] = v1.z - rtc_z;\n\n //\n // V2\n //\n var hInd2 = k + fileGridSize_one;\n var vInd2 = hInd2 * 3;\n elv = elevations[hInd2];\n if (checkNoDataValue(noDataValues, elv)) {\n elv = 0.0;\n }\n var h2 = hf * elv;\n var v2 = new Vec3(\n rtc_x + nv[vInd2] + h2 * nn[vInd2],\n rtc_y + nv[vInd2 + 1] + h2 * nn[vInd2 + 1],\n rtc_z + nv[vInd2 + 2] + h2 * nn[vInd2 + 2]\n );\n\n normalMapVertices[vInd2] = v2.x - rtc_x;\n normalMapVertices[vInd2 + 1] = v2.y - rtc_y;\n normalMapVertices[vInd2 + 2] = v2.z - rtc_z;\n\n //\n // V3\n //\n var hInd3 = k + fileGridSize_one + 1;\n var vInd3 = hInd3 * 3;\n elv = elevations[hInd3];\n if (checkNoDataValue(noDataValues, elv)) {\n elv = 0.0;\n }\n var h3 = hf * elv;\n var v3 = new Vec3(\n rtc_x + nv[vInd3] + h3 * nn[vInd3],\n rtc_y + nv[vInd3 + 1] + h3 * nn[vInd3 + 1],\n rtc_z + nv[vInd3 + 2] + h3 * nn[vInd3 + 2]\n );\n\n normalMapVertices[vInd3] = v3.x - rtc_x;\n normalMapVertices[vInd3 + 1] = v3.y - rtc_y;\n normalMapVertices[vInd3 + 2] = v3.z - rtc_z;\n\n //\n // Normal\n //\n var e10 = v1.sub(v0),\n e20 = v2.sub(v0),\n e30 = v3.sub(v0);\n\n var sw = e20.cross(e30).normalize();\n var ne = e30.cross(e10).normalize();\n var n0 = ne.add(sw).normalize();\n\n normalMapNormals[vInd0] += n0.x;\n normalMapNormals[vInd0 + 1] += n0.y;\n normalMapNormals[vInd0 + 2] += n0.z;\n\n normalMapNormals[vInd1] += ne.x;\n normalMapNormals[vInd1 + 1] += ne.y;\n normalMapNormals[vInd1 + 2] += ne.z;\n\n normalMapNormals[vInd2] += sw.x;\n normalMapNormals[vInd2 + 1] += sw.y;\n normalMapNormals[vInd2 + 2] += sw.z;\n\n normalMapNormals[vInd3] += n0.x;\n normalMapNormals[vInd3 + 1] += n0.y;\n normalMapNormals[vInd3 + 2] += n0.z;\n }\n }\n } else {\n normalMapNormals = new Float32Array(gsgs3);\n normalMapVertices = new Float64Array(gsgs3);\n\n var oneSize = tgs / fileGridSize;\n var gsgs = gsgs3 / 3;\n var fgsOne = fileGridSize + 1;\n\n for (let i = 0; i < gsgs; i++) {\n let ii = Math.floor(i / gs),\n ij = i % gs;\n\n let qii = ii % oneSize,\n qij = ij % oneSize;\n\n let hlt_ind = Math.floor(ii / oneSize) * fgsOne + Math.floor(ij / oneSize);\n\n if (ij === tgs) {\n hlt_ind -= 1;\n qij = oneSize;\n }\n\n if (ii === tgs) {\n hlt_ind -= fgsOne;\n qii = oneSize;\n }\n\n let hrt_ind = hlt_ind + 1,\n hlb_ind = hlt_ind + fgsOne,\n hrb_ind = hlb_ind + 1;\n\n let h_lt = elevations[hlt_ind],\n h_rt = elevations[hrt_ind],\n h_lb = elevations[hlb_ind],\n h_rb = elevations[hrb_ind];\n\n if (checkNoDataValue(noDataValues, h_lt)) {\n h_lt = 0.0;\n }\n\n if (checkNoDataValue(noDataValues, h_rt)) {\n h_rt = 0.0;\n }\n\n if (checkNoDataValue(noDataValues, h_lb)) {\n h_lb = 0.0;\n }\n\n if (checkNoDataValue(noDataValues, h_rb)) {\n h_rb = 0.0;\n }\n\n let hi = blerp(qij / oneSize, qii / oneSize, h_lt, h_rt, h_lb, h_rb);\n\n let i3 = i * 3;\n\n _rtcTempVec.x = this_plainVertices[i3] + hi * this_plainNormals[i3];\n _rtcTempVec.y = this_plainVertices[i3 + 1] + hi * this_plainNormals[i3 + 1];\n _rtcTempVec.z = this_plainVertices[i3 + 2] + hi * this_plainNormals[i3 + 2];\n\n doubleToTwoFloats(_rtcTempVec, _tempHigh, _tempLow);\n\n terrainVertices[i3] = _rtcTempVec.x;\n terrainVertices[i3 + 1] = _rtcTempVec.y;\n terrainVertices[i3 + 2] = _rtcTempVec.z;\n\n terrainVerticesHigh[i3] = _tempHigh.x;\n terrainVerticesHigh[i3 + 1] = _tempHigh.y;\n terrainVerticesHigh[i3 + 2] = _tempHigh.z;\n\n terrainVerticesLow[i3] = _tempLow.x;\n terrainVerticesLow[i3 + 1] = _tempLow.y;\n terrainVerticesLow[i3 + 2] = _tempLow.z;\n\n _tempVec.x = _rtcTempVec.x + rtc_x;\n _tempVec.y = _rtcTempVec.y + rtc_y;\n _tempVec.z = _rtcTempVec.z + rtc_z;\n\n if (_tempVec.x < xmin) xmin = _tempVec.x;\n if (_tempVec.x > xmax) xmax = _tempVec.x;\n if (_tempVec.y < ymin) ymin = _tempVec.y;\n if (_tempVec.y > ymax) ymax = _tempVec.y;\n if (_tempVec.z < zmin) zmin = _tempVec.z;\n if (_tempVec.z > zmax) zmax = _tempVec.z;\n }\n\n normalMapVertices.set(terrainVertices);\n\n for (let k = 0; k < gsgs; k++) {\n let j = k % gs,\n i = ~~(k / gs);\n\n if (i !== tgs && j !== tgs) {\n let v0ind = k * 3,\n v1ind = v0ind + 3,\n v2ind = v0ind + gs * 3,\n v3ind = v2ind + 3;\n\n let v0 = new Vec3(\n terrainVertices[v0ind] + rtc_x,\n terrainVertices[v0ind + 1] + rtc_y,\n terrainVertices[v0ind + 2] + rtc_z\n ),\n v1 = new Vec3(\n terrainVertices[v1ind] + rtc_x,\n terrainVertices[v1ind + 1] + rtc_y,\n terrainVertices[v1ind + 2] + rtc_z\n ),\n v2 = new Vec3(\n terrainVertices[v2ind] + rtc_x,\n terrainVertices[v2ind + 1] + rtc_y,\n terrainVertices[v2ind + 2] + rtc_z\n ),\n v3 = new Vec3(\n terrainVertices[v3ind] + rtc_x,\n terrainVertices[v3ind + 1] + rtc_y,\n terrainVertices[v3ind + 2] + rtc_z\n );\n\n let e10 = v1.sub(v0).normalize(),\n e20 = v2.sub(v0).normalize(),\n e30 = v3.sub(v0).normalize();\n\n let sw = e20.cross(e30).normalize();\n let ne = e30.cross(e10).normalize();\n let n0 = ne.add(sw).normalize();\n\n normalMapNormals[v0ind] += n0.x;\n normalMapNormals[v0ind + 1] += n0.y;\n normalMapNormals[v0ind + 2] += n0.z;\n\n normalMapNormals[v1ind] += ne.x;\n normalMapNormals[v1ind + 1] += ne.y;\n normalMapNormals[v1ind + 2] += ne.z;\n\n normalMapNormals[v2ind] += sw.x;\n normalMapNormals[v2ind + 1] += sw.y;\n normalMapNormals[v2ind + 2] += sw.z;\n\n normalMapNormals[v3ind] += n0.x;\n normalMapNormals[v3ind + 1] += n0.y;\n normalMapNormals[v3ind + 2] += n0.z;\n }\n }\n }\n\n self.postMessage(\n {\n id: id,\n normalMapNormals: normalMapNormals,\n normalMapVertices: normalMapVertices,\n terrainVertices: terrainVertices,\n terrainVerticesHigh: terrainVerticesHigh,\n terrainVerticesLow: terrainVerticesLow,\n noDataVertices: noDataVertices,\n bounds: [xmin, ymin, zmin, xmax, ymax, zmax],\n relativeCenter: e.data.relativeCenter\n },\n [\n normalMapNormals.buffer,\n normalMapVertices.buffer,\n terrainVertices.buffer,\n terrainVerticesHigh.buffer,\n terrainVerticesLow.buffer,\n noDataVertices.buffer\n ]\n );\n};\n"],"mappings":"yBAiBA,SAAS,EAAiB,EAAc,EAAA,CACpC,OAbJ,SAA0B,EAAK,EAAA,CAC3B,IAAI,EAAQ,EACR,EAAM,EAAI,OAAS,EACvB,KAAO,GAAS,GAAK,CACjB,IAAI,EAAI,KAAK,MAAsB,IAAf,EAAQ,EAAA,EAC5B,GAAI,KAAK,IAAI,EAAI,GAAK,CAAA,EAAK,KAAM,OAAO,EAC/B,EAAI,GAAK,EAAG,EAAQ,EAAI,EAC5B,EAAM,EAAI,CACnB,CACA,MAAA,EACJ,EAG4B,EAAc,CAAA,IAAtC,EACJ,CAEA,IAAI,EAAO,SAAU,EAAG,EAAG,EAAA,CACvB,KAAK,EAAI,EACT,KAAK,EAAI,EACT,KAAK,EAAI,CACb,EAEI,EAAoB,SAAU,EAAG,EAAM,EAAA,CACvC,IAAI,EAAI,EAAE,EACN,EAAI,EAAE,EACN,EAAI,EAAE,EAEV,IAAI,EAEA,GAAK,GACL,EAAuC,MAA1B,KAAK,MAAM,EAAI,KAAA,EAC5B,EAAK,EAAI,KAAK,OAAO,CAAA,EACrB,EAAI,EAAI,KAAK,OAAO,EAAI,CAAA,IAExB,EAAwC,MAA3B,KAAK,MAAA,CAAO,EAAI,KAAA,EAC7B,EAAK,EAAI,KAAK,OAAA,CAAQ,CAAA,EACtB,EAAI,EAAI,KAAK,OAAO,EAAI,C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AK,UAAA,EACpB,EAAK,EAAG,IAAI,CAAA,CAAA,CAAI,UAAA,EAEpB,EAAiB,IAAU,EAAG,EAC9B,EAAiB,EAAQ,IAAM,EAAG,EAClC,EAAiB,EAAQ,IAAM,EAAG,EAElC,EAAiB,IAAU,EAAG,EAC9B,EAAiB,EAAQ,IAAM,EAAG,EAClC,EAAiB,EAAQ,IAAM,EAAG,EAElC,EAAiB,IAAU,EAAG,EAC9B,EAAiB,EAAQ,IAAM,EAAG,EAClC,EAAiB,EAAQ,IAAM,EAAG,EAElC,EAAiB,IAAU,EAAG,EAC9B,EAAiB,EAAQ,IAAM,EAAG,EAClC,EAAiB,EAAQ,IAAM,EAAG,CACtC,CAER,CAEA,KAAK,YACD,CACQ,GAAA,GACc,iBAAA,EACC,kBAAA,EACF,gBAAA,EACI,oBAAA,EACD,mBAAA,EACJ,eAAA,EAChB,OAAQ,CAAC,EAAM,EAAM,EAAM,EAAM,EAAM,CAAA,EACvC,eAAgB,EAAE,KAAK,cAAA,EAE3B,CACI,EAAiB,OACjB,EAAkB,OAClB,EAAgB,OAChB,EAAoB,OACpB,EAAmB,OACnB,EAAe,MAAA,CAAA,CAG3B,CAAA,EAAA,CAAA"}
|
package/lib/camera/Camera.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface IFlyBaseParams {
|
|
|
37
37
|
startCallback?: Function;
|
|
38
38
|
frameCallback?: Function;
|
|
39
39
|
}
|
|
40
|
-
export declare const DEFAULT_FLIGHT_DURATION =
|
|
40
|
+
export declare const DEFAULT_FLIGHT_DURATION = 1000;
|
|
41
41
|
export declare const DEFAULT_EASING: EasingFunction;
|
|
42
42
|
type CameraFrame = {
|
|
43
43
|
eye: Vec3;
|
|
@@ -76,7 +76,6 @@ declare class Camera {
|
|
|
76
76
|
*/
|
|
77
77
|
events: EventsHandler<CameraEvents>;
|
|
78
78
|
protected _isOrthographic: boolean;
|
|
79
|
-
protected _focusDistance: number;
|
|
80
79
|
/**
|
|
81
80
|
* Camera position.
|
|
82
81
|
* @public
|
|
@@ -144,6 +143,12 @@ declare class Camera {
|
|
|
144
143
|
protected _pb: Vec3;
|
|
145
144
|
protected _peye: Vec3;
|
|
146
145
|
isMoving: boolean;
|
|
146
|
+
protected _pViewAngle: number;
|
|
147
|
+
protected _pAspect: number;
|
|
148
|
+
protected _pWidth: number;
|
|
149
|
+
protected _pHeight: number;
|
|
150
|
+
protected _pIsOrthographic: boolean;
|
|
151
|
+
protected _pFocusDistance: number;
|
|
147
152
|
protected _tanViewAngle_hrad: number;
|
|
148
153
|
_tanViewAngle_hradOneByHeight: number;
|
|
149
154
|
protected _projSizeConst: number;
|
|
@@ -244,11 +249,22 @@ declare class Camera {
|
|
|
244
249
|
* @returns {boolean}
|
|
245
250
|
*/
|
|
246
251
|
isFlying(): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Checks camera movement and projection changes.
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
checkViewChanges(): void;
|
|
247
257
|
/**
|
|
248
258
|
* Checks whether the camera stopped moving and dispatches `moveend`.
|
|
249
259
|
* @public
|
|
260
|
+
* @returns {boolean} `true` when the camera is moving after the check.
|
|
261
|
+
*/
|
|
262
|
+
checkMoveEnd(): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Checks whether the camera view or projection changed and dispatches `viewchange`.
|
|
265
|
+
* @protected
|
|
250
266
|
*/
|
|
251
|
-
|
|
267
|
+
protected _checkViewChange(): void;
|
|
252
268
|
/**
|
|
253
269
|
* Binds picking colors for all frustums.
|
|
254
270
|
* @public
|
|
@@ -303,6 +319,11 @@ declare class Camera {
|
|
|
303
319
|
* @returns {Vec3} Backward direction.
|
|
304
320
|
*/
|
|
305
321
|
getBackward(): Vec3;
|
|
322
|
+
/**
|
|
323
|
+
* Updates camera slope against the horizontal XZ plane.
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
updateCameraSlope(): void;
|
|
306
327
|
/**
|
|
307
328
|
* Updates camera view space
|
|
308
329
|
* @public
|
|
@@ -359,7 +380,7 @@ declare class Camera {
|
|
|
359
380
|
* @public
|
|
360
381
|
* @param {Array.<NumberArray2>} frustums - Array of `[near, far]` ranges.
|
|
361
382
|
*/
|
|
362
|
-
setFrustums(frustums: [number, number][]): void;
|
|
383
|
+
setFrustums(frustums: [number, number][], focusDistance?: number): void;
|
|
363
384
|
protected _updateViewportParameters(): void;
|
|
364
385
|
/**
|
|
365
386
|
* Sets camera view angle in degrees
|
|
@@ -367,6 +388,12 @@ declare class Camera {
|
|
|
367
388
|
* @param {number} angle - View angle
|
|
368
389
|
*/
|
|
369
390
|
setViewAngle(angle: number): void;
|
|
391
|
+
/**
|
|
392
|
+
* Sets camera horizontal view angle in degrees.
|
|
393
|
+
* @public
|
|
394
|
+
* @param {number} angle - Horizontal view angle.
|
|
395
|
+
*/
|
|
396
|
+
setHorizontalViewAngle(angle: number): void;
|
|
370
397
|
/**
|
|
371
398
|
* Returns camera vertical view angle in degrees.
|
|
372
399
|
* @public
|
|
@@ -562,7 +589,7 @@ declare class Camera {
|
|
|
562
589
|
*/
|
|
563
590
|
rotateAround(angle: number, isArc?: boolean, center?: Vec3, up?: Vec3): void;
|
|
564
591
|
/**
|
|
565
|
-
* Rotates camera around center point by horizontal.
|
|
592
|
+
* Rotates camera around the center point by horizontal.
|
|
566
593
|
* @public
|
|
567
594
|
* @param {number} angle - Rotation angle in radians.
|
|
568
595
|
* @param {boolean} [isArc] - If true camera up vector gets from current up vector every frame,
|
|
@@ -572,14 +599,14 @@ declare class Camera {
|
|
|
572
599
|
*/
|
|
573
600
|
rotateHorizontal(angle: number, isArc?: boolean, center?: Vec3, up?: Vec3): void;
|
|
574
601
|
/**
|
|
575
|
-
* Rotates camera around center point by vertical.
|
|
602
|
+
* Rotates camera around the center point by vertical.
|
|
576
603
|
* @param {number} angle - Rotation angle in radians.
|
|
577
604
|
* @param {Vec3} [center] - Point that the camera rotates around.
|
|
578
605
|
*/
|
|
579
606
|
rotateVertical(angle: number, center?: Vec3): void;
|
|
580
607
|
/**
|
|
581
608
|
* Gets 3d size factor. Uses in LOD distance calculation.
|
|
582
|
-
* It is very important function used in Node.ts
|
|
609
|
+
* It is a very important function used in Node.ts
|
|
583
610
|
* @public
|
|
584
611
|
* @param {Vec3} p - Point in 3d.
|
|
585
612
|
* @param {Vec3} r - size.
|
|
@@ -611,12 +638,19 @@ declare class Camera {
|
|
|
611
638
|
*/
|
|
612
639
|
getCurrentFrustum(): number;
|
|
613
640
|
/**
|
|
614
|
-
* Checks whether sphere intersects any camera frustum.
|
|
641
|
+
* Checks whether the sphere intersects any camera frustum.
|
|
615
642
|
* @public
|
|
616
643
|
* @param {Sphere} sphere - Bounding sphere.
|
|
617
644
|
* @returns {boolean} `true` when visible in at least one frustum.
|
|
618
645
|
*/
|
|
619
646
|
containsSphere(sphere: Sphere): boolean;
|
|
647
|
+
/**
|
|
648
|
+
* Checks whether a point is inside any camera frustum.
|
|
649
|
+
* @public
|
|
650
|
+
* @param {Vec3} point - Cartesian point.
|
|
651
|
+
* @returns {boolean} `true` when visible in at least one frustum.
|
|
652
|
+
*/
|
|
653
|
+
containsPoint(point: Vec3): boolean;
|
|
620
654
|
/**
|
|
621
655
|
* Returns current active frustum.
|
|
622
656
|
* @public
|
package/lib/camera/Frustum.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ interface IFrustumParams {
|
|
|
9
9
|
aspect?: number;
|
|
10
10
|
near?: number;
|
|
11
11
|
far?: number;
|
|
12
|
+
isOrthographic?: boolean;
|
|
13
|
+
focusDistance?: number;
|
|
12
14
|
reverseDepth?: boolean;
|
|
13
15
|
depthZeroToOne?: boolean;
|
|
14
16
|
}
|
|
@@ -24,6 +26,12 @@ declare class Frustum {
|
|
|
24
26
|
protected _tanViewAngle_hrad: number;
|
|
25
27
|
protected _reverseDepth: boolean;
|
|
26
28
|
protected _depthZeroToOne: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Reference distance used to compute orthographic frustum size.
|
|
31
|
+
* For orthographic frustums this value is synchronized with vertical bounds.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
focusDistance: number;
|
|
27
35
|
/**
|
|
28
36
|
* Camera projection matrix.
|
|
29
37
|
* @protected
|
|
@@ -156,11 +164,39 @@ declare class Frustum {
|
|
|
156
164
|
* @param {number} near - Near clipping plane distance.
|
|
157
165
|
* @param {number} far - Far clipping plane distance.
|
|
158
166
|
* @param {boolean} [isOrthographic=false] - Enables orthographic projection mode.
|
|
159
|
-
* @param {number} [focusDistance=
|
|
167
|
+
* @param {number} [focusDistance=this.focusDistance] - Reference distance used to compute orthographic frustum size.
|
|
160
168
|
* @param {boolean} [reverseDepth=false] - Enables reverse-Z infinite perspective projection.
|
|
161
169
|
* @param {boolean} [depthZeroToOne=false] - Uses `[0, 1]` NDC depth range for reverse-Z projection.
|
|
162
170
|
*/
|
|
163
171
|
setProjectionMatrix(viewAngle: number, aspect: number, near: number, far: number, isOrthographic?: boolean, focusDistance?: number, reverseDepth?: boolean, depthZeroToOne?: boolean): void;
|
|
172
|
+
/**
|
|
173
|
+
* Sets reference distance used to compute orthographic bounds and rebuilds projection matrices.
|
|
174
|
+
* Keeps current near and far clipping planes unchanged.
|
|
175
|
+
* @public
|
|
176
|
+
* @param {number} focusDistance - Reference distance.
|
|
177
|
+
*/
|
|
178
|
+
setFocusDistance(focusDistance: number): void;
|
|
179
|
+
/**
|
|
180
|
+
* Updates orthographic projection bounds and rebuilds projection matrices.
|
|
181
|
+
* Keeps the current near and far clipping planes unchanged.
|
|
182
|
+
* @public
|
|
183
|
+
* @param {number} left - Left orthographic bound.
|
|
184
|
+
* @param {number} right - Right orthographic bound.
|
|
185
|
+
* @param {number} bottom - Bottom orthographic bound.
|
|
186
|
+
* @param {number} top - Top orthographic bound.
|
|
187
|
+
*/
|
|
188
|
+
setOrthoBounds(left: number, right: number, bottom: number, top: number): void;
|
|
189
|
+
/**
|
|
190
|
+
* Updates orthographic projection bounds and clipping planes in one projection rebuild.
|
|
191
|
+
* @public
|
|
192
|
+
* @param {number} left - Left orthographic bound.
|
|
193
|
+
* @param {number} right - Right orthographic bound.
|
|
194
|
+
* @param {number} bottom - Bottom orthographic bound.
|
|
195
|
+
* @param {number} top - Top orthographic bound.
|
|
196
|
+
* @param {number} near - Near clipping plane distance.
|
|
197
|
+
* @param {number} far - Far clipping plane distance.
|
|
198
|
+
*/
|
|
199
|
+
setOrthoProjection(left: number, right: number, bottom: number, top: number, near: number, far: number): void;
|
|
164
200
|
/**
|
|
165
201
|
* Updates near and far clipping planes.
|
|
166
202
|
* @public
|
|
@@ -14,9 +14,6 @@ export interface IPlanetFlyCartesianParams extends IFlyCartesianParams {
|
|
|
14
14
|
preventLock?: boolean;
|
|
15
15
|
linearPath?: boolean;
|
|
16
16
|
}
|
|
17
|
-
export interface IPlanetFlyDistanceParams extends IPlanetFlyCartesianParams {
|
|
18
|
-
distance?: number;
|
|
19
|
-
}
|
|
20
17
|
/**
|
|
21
18
|
* Planet camera.
|
|
22
19
|
* @class
|
|
@@ -91,6 +88,7 @@ declare class PlanetCamera extends Camera {
|
|
|
91
88
|
protected _keyLock: Key;
|
|
92
89
|
protected _checkTerrainCollision: boolean;
|
|
93
90
|
eyeNorm: Vec3;
|
|
91
|
+
protected _extentFitRequestId: number;
|
|
94
92
|
constructor(planet: Planet, options?: IPlanetCameraParams);
|
|
95
93
|
/**
|
|
96
94
|
* Enables or disables terrain collision checks.
|
|
@@ -104,6 +102,11 @@ declare class PlanetCamera extends Camera {
|
|
|
104
102
|
* @virtual
|
|
105
103
|
*/
|
|
106
104
|
update(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Updates camera slope against the planet surface normal.
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
updateCameraSlope(): void;
|
|
107
110
|
/**
|
|
108
111
|
* Updates camera geographic coordinates from current cartesian position.
|
|
109
112
|
* @public
|
|
@@ -125,7 +128,7 @@ declare class PlanetCamera extends Camera {
|
|
|
125
128
|
* @public
|
|
126
129
|
* @param {LonLat} lonlat - New camera and camera view position.
|
|
127
130
|
* @param {LonLat} [lookLonLat] - Look up coordinates.
|
|
128
|
-
* @param {Vec3} [up] - Camera UP vector.
|
|
131
|
+
* @param {Vec3} [up] - Camera UP vector. Defaults to the local surface normal for an explicit look point.
|
|
129
132
|
*/
|
|
130
133
|
setLonLat(lonlat: LonLat, lookLonLat?: LonLat, up?: Vec3): void;
|
|
131
134
|
/**
|
|
@@ -148,6 +151,11 @@ declare class PlanetCamera extends Camera {
|
|
|
148
151
|
* @returns {Vec3}
|
|
149
152
|
*/
|
|
150
153
|
getExtentPosition(extent: Extent, height?: number | null): Vec3;
|
|
154
|
+
protected _getExtentCenterHeightInfo(extent: Extent): {
|
|
155
|
+
height: number;
|
|
156
|
+
segmentZoom: number;
|
|
157
|
+
};
|
|
158
|
+
protected _isSegmentHeightAccurate(extentHeight: number, segmentZoom: number): boolean;
|
|
151
159
|
/**
|
|
152
160
|
* View current extent.
|
|
153
161
|
* @public
|
|
@@ -227,6 +235,7 @@ declare class PlanetCamera extends Camera {
|
|
|
227
235
|
* @returns {Vec3 | undefined} Terrain point under camera when available.
|
|
228
236
|
*/
|
|
229
237
|
checkTerrainCollision(): Vec3 | undefined;
|
|
238
|
+
protected _getInsideCollisionSegment(): Segment | null;
|
|
230
239
|
/**
|
|
231
240
|
* Returns visible surface arc distance from current altitude.
|
|
232
241
|
* @public
|
|
@@ -234,6 +243,15 @@ declare class PlanetCamera extends Camera {
|
|
|
234
243
|
* @returns {number} Visible surface distance.
|
|
235
244
|
*/
|
|
236
245
|
getSurfaceVisibleDistance(d: number): number;
|
|
246
|
+
/**
|
|
247
|
+
* Returns the ellipsoid intersection point for a screen-space ray.
|
|
248
|
+
* If the ray doesn't hit ellipsoid, it returns 'undefined'.
|
|
249
|
+
* @public
|
|
250
|
+
* @param {number} x - Screen X coordinate in pixels.
|
|
251
|
+
* @param {number} y - Screen Y coordinate in pixels.
|
|
252
|
+
* @returns {Vec3 | undefined} Cartesian intersection point.
|
|
253
|
+
*/
|
|
254
|
+
getRayIntersectionEllipsoid(x: number, y: number): Vec3 | undefined;
|
|
237
255
|
/**
|
|
238
256
|
* Returns heading angle in degrees.
|
|
239
257
|
* Should match `getYaw()` in most cases.
|
|
@@ -4,6 +4,12 @@ import { Control, IControlParams } from "./Control";
|
|
|
4
4
|
import { ShaderProgram } from "../webgl/ShaderProgram";
|
|
5
5
|
export interface IFramebufferDialogParams extends IControlParams {
|
|
6
6
|
framebuffer?: Framebuffer;
|
|
7
|
+
arrayTexture?: WebGLTexture;
|
|
8
|
+
arrayLayer?: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
left?: number;
|
|
12
|
+
top?: number;
|
|
7
13
|
title?: string;
|
|
8
14
|
common?: string;
|
|
9
15
|
image?: string;
|
|
@@ -11,15 +17,25 @@ export interface IFramebufferDialogParams extends IControlParams {
|
|
|
11
17
|
}
|
|
12
18
|
export declare class FramebufferPreview extends Control {
|
|
13
19
|
protected _dialog: Dialog<null>;
|
|
14
|
-
$canvas: HTMLCanvasElement;
|
|
15
20
|
protected _framebuffer: Framebuffer | null;
|
|
21
|
+
protected _arrayTexture: WebGLTexture | null;
|
|
22
|
+
protected _arrayLayer: number;
|
|
23
|
+
protected _width: number;
|
|
24
|
+
protected _height: number;
|
|
25
|
+
protected _isArrayMode: boolean;
|
|
16
26
|
protected _screenFramebuffer: Framebuffer | null;
|
|
17
|
-
framebufferCurrentTexture: number;
|
|
18
27
|
protected _program: ShaderProgram;
|
|
28
|
+
$canvas: HTMLCanvasElement;
|
|
29
|
+
framebufferCurrentTexture: number;
|
|
19
30
|
constructor(params: IFramebufferDialogParams);
|
|
20
31
|
bindFramebuffer(framebuffer: Framebuffer): void;
|
|
32
|
+
bindArrayTexture(texture: WebGLTexture, layer: number): void;
|
|
21
33
|
oninit(): void;
|
|
22
34
|
activate(): void;
|
|
23
35
|
deactivate(): void;
|
|
36
|
+
protected _isDrawSubscribed: boolean;
|
|
37
|
+
protected _subscribeDraw(): void;
|
|
38
|
+
protected _unsubscribeDraw(): void;
|
|
39
|
+
protected _onDialogVisibilityChange: (isVisible: boolean) => void;
|
|
24
40
|
protected _onDraw: () => void;
|
|
25
41
|
}
|
|
@@ -18,10 +18,12 @@ export declare class Lighting extends Control {
|
|
|
18
18
|
protected _panel: View<null>;
|
|
19
19
|
protected _atmosphereMaxOpacity: Slider;
|
|
20
20
|
protected _atmosphereMinOpacity: Slider;
|
|
21
|
+
protected _atmosphereOpacityCurveShift: Slider;
|
|
21
22
|
protected _simpleSkyBackgroundColorOne: Color;
|
|
22
23
|
protected _simpleSkyBackgroundColorTwo: Color;
|
|
23
24
|
protected _gamma: Slider;
|
|
24
25
|
protected _exposure: Slider;
|
|
26
|
+
protected _whitepoint: Slider;
|
|
25
27
|
protected _night: Slider;
|
|
26
28
|
protected _opacity: Slider;
|
|
27
29
|
protected _diffuse_r: Slider;
|
|
@@ -36,6 +38,7 @@ export declare class Lighting extends Control {
|
|
|
36
38
|
protected _shininess: Slider;
|
|
37
39
|
$gamma: HTMLElement | null;
|
|
38
40
|
$exposure: HTMLElement | null;
|
|
41
|
+
$whitepoint: HTMLElement | null;
|
|
39
42
|
$night: HTMLElement | null;
|
|
40
43
|
$opacity: HTMLElement | null;
|
|
41
44
|
$diffuse: HTMLElement | null;
|
|
@@ -9,6 +9,9 @@ import { type EventsHandler } from "../Events";
|
|
|
9
9
|
export type NavigationMode = "north" | "adaptive" | "free";
|
|
10
10
|
export interface INavigationParams extends IControlParams {
|
|
11
11
|
inertia?: number;
|
|
12
|
+
minInertia?: number;
|
|
13
|
+
maxInertia?: number;
|
|
14
|
+
minInertiaAltitude?: number;
|
|
12
15
|
velInertia?: number;
|
|
13
16
|
dragInertia?: number;
|
|
14
17
|
minSlope?: number;
|
|
@@ -27,6 +30,9 @@ export type NavigationEventsList = ["drag", "zoom", "rotate"];
|
|
|
27
30
|
* @param {INavigationParams} [options] - Navigation options:
|
|
28
31
|
* @param {NavigationMode} [options.mode] - Navigation mode: "north" (keeps north fixed), "adaptive" (default, auto-detects arc mode), "free" (arc rotation mode)
|
|
29
32
|
* @param {number} [options.inertia] - inertia factor
|
|
33
|
+
* @param {number} [options.minInertia] - inertia factor at minInertiaAltitude. Default is 1
|
|
34
|
+
* @param {number} [options.maxInertia] - inertia factor at maximal camera altitude. Default is 1.1
|
|
35
|
+
* @param {number} [options.minInertiaAltitude] - minimal altitude where inertia interpolation starts. Default is 3000000
|
|
30
36
|
* @param {number} [options.velInertia] - base velocity inertia factor. Default is 0.89
|
|
31
37
|
* @param {number} [options.dragInertia] - drag inertia
|
|
32
38
|
* @param {number} [options.mass] - camera mass, affects velocity. Default is 1
|
|
@@ -48,6 +54,9 @@ export declare class Navigation extends Control {
|
|
|
48
54
|
mass: number;
|
|
49
55
|
minSlope: number;
|
|
50
56
|
inertia: number;
|
|
57
|
+
minInertia: number;
|
|
58
|
+
maxInertia: number;
|
|
59
|
+
minInertiaAltitude: number;
|
|
51
60
|
dragInertia: number;
|
|
52
61
|
zoomSpeed: number;
|
|
53
62
|
poleThreshold: number;
|
|
@@ -67,6 +76,7 @@ export declare class Navigation extends Control {
|
|
|
67
76
|
protected _grabbedSphere: Sphere;
|
|
68
77
|
protected _wheelDirection: number;
|
|
69
78
|
protected _currScreenPos: Vec2;
|
|
79
|
+
protected _grabbedScreenPoint: Vec2;
|
|
70
80
|
protected _tUp: Vec3;
|
|
71
81
|
protected _tRad: number;
|
|
72
82
|
protected _shiftBusy: boolean;
|
|
@@ -89,7 +99,7 @@ export declare class Navigation extends Control {
|
|
|
89
99
|
onremove(): void;
|
|
90
100
|
onactivate(): void;
|
|
91
101
|
ondeactivate(): void;
|
|
92
|
-
protected
|
|
102
|
+
protected onPreDraw(): void;
|
|
93
103
|
_onShiftFree: () => void;
|
|
94
104
|
private _onCameraFly;
|
|
95
105
|
protected _onMouseMove: (e: IMouseState) => void;
|
|
@@ -120,5 +130,6 @@ export declare class Navigation extends Control {
|
|
|
120
130
|
protected _updateVel_roll(): void;
|
|
121
131
|
protected get dt(): number;
|
|
122
132
|
protected get velocityInertia(): number;
|
|
133
|
+
protected _calcInertia(): number;
|
|
123
134
|
stop(): void;
|
|
124
135
|
}
|