@openglobus/og 0.19.2 → 0.19.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/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/js/Object3d.d.ts +9 -1
- package/lib/js/Object3d.js +56 -1
- package/lib/js/astro/jd.js +26 -26
- package/lib/js/control/KeyboardNavigation.js +10 -10
- package/lib/js/control/MouseNavigation.js +4 -8
- package/lib/js/control/timeline/timelineUtils.js +32 -32
- package/lib/js/ellipsoid/Ellipsoid.d.ts +7 -1
- package/lib/js/ellipsoid/Ellipsoid.js +7 -1
- package/lib/js/entity/GeoObject.d.ts +8 -3
- package/lib/js/entity/GeoObject.js +10 -2
- package/lib/js/entity/GeoObjectHandler.d.ts +1 -1
- package/lib/js/entity/GeoObjectHandler.js +11 -6
- package/lib/js/quadTree/Node.js +14 -65
- package/lib/js/renderer/Renderer.js +6 -5
- package/lib/js/scene/Axes.js +4 -4
- package/lib/js/segment/Segment.d.ts +1 -0
- package/lib/js/segment/Segment.js +8 -3
- package/lib/js/shaders/drawnode.js +18 -14
- package/lib/js/shaders/geoObject.js +14 -14
- package/lib/js/terrain/MapboxTerrain.d.ts +1 -0
- package/lib/js/terrain/MapboxTerrain.js +7 -0
- package/lib/js/utils/objParser.js +3 -3
- package/lib/js/utils/shared.d.ts +2 -1
- package/lib/js/utils/shared.js +7 -1
- package/package.json +25 -18
package/lib/js/Object3d.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedArray } from './utils/shared';
|
|
2
|
-
import { NumberArray3 } from './math/Vec3';
|
|
2
|
+
import { NumberArray3, Vec3 } from './math/Vec3';
|
|
3
3
|
interface IObject3dParams {
|
|
4
4
|
name?: string;
|
|
5
5
|
vertices?: number[];
|
|
@@ -41,6 +41,14 @@ declare class Object3d {
|
|
|
41
41
|
static getNormals(vertices: number[]): number[];
|
|
42
42
|
static createSphere(lonBands?: number, latBands?: number, radius?: number, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
|
|
43
43
|
static createDisc(radius?: number, height?: number, radialSegments?: number, isTop?: boolean, startIndex?: number, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
|
|
44
|
+
/**
|
|
45
|
+
* Returns scale parameters for a frustum geoObject created with only Object3d.createFrustum();
|
|
46
|
+
* @param length
|
|
47
|
+
* @param horizontalAngle
|
|
48
|
+
* @param verticalAngle
|
|
49
|
+
*/
|
|
50
|
+
static getFrustumScaleByCameraParams(length: number, horizontalAngle: number, verticalAngle: number): Vec3;
|
|
51
|
+
static createFrustum(length?: number, width?: number, height?: number, xOffset?: number, yOffset?: number, zOffset?: number): Object3d;
|
|
44
52
|
static createCylinder(radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, isTop?: boolean, isBottom?: boolean, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
|
|
45
53
|
static createCube(length?: number, height?: number, depth?: number, xOffset?: number, yOffset?: number, zOffset?: number): Object3d;
|
|
46
54
|
static createArrow(back?: number, height?: number, front?: number): Object3d;
|
package/lib/js/Object3d.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { htmlColorToFloat32Array } from './utils/shared';
|
|
2
2
|
import { Vec3 } from './math/Vec3';
|
|
3
|
-
import { MAX, MIN } from './math';
|
|
3
|
+
import { MAX, MIN, RADIANS_HALF } from './math';
|
|
4
4
|
import { transformLeftToRightCoordinateSystem, objParser } from "./utils/objParser";
|
|
5
5
|
function getColor(color) {
|
|
6
6
|
if (color instanceof Array) {
|
|
@@ -219,6 +219,61 @@ class Object3d {
|
|
|
219
219
|
'vertices': vertices, 'normals': normals, 'indices': indices
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns scale parameters for a frustum geoObject created with only Object3d.createFrustum();
|
|
224
|
+
* @param length
|
|
225
|
+
* @param horizontalAngle
|
|
226
|
+
* @param verticalAngle
|
|
227
|
+
*/
|
|
228
|
+
static getFrustumScaleByCameraParams(length, horizontalAngle, verticalAngle) {
|
|
229
|
+
return new Vec3(2.0 * length * Math.tan(RADIANS_HALF * horizontalAngle), 2.0 * length * Math.tan(RADIANS_HALF * verticalAngle), length);
|
|
230
|
+
}
|
|
231
|
+
static createFrustum(length = 1, width = 1, height = 1, xOffset = 0, yOffset = 0, zOffset = 0) {
|
|
232
|
+
width *= 0.5;
|
|
233
|
+
height *= 0.5;
|
|
234
|
+
return new Object3d({
|
|
235
|
+
vertices: [
|
|
236
|
+
//
|
|
237
|
+
//inside
|
|
238
|
+
//
|
|
239
|
+
//top
|
|
240
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
241
|
+
-1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
242
|
+
1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
243
|
+
//bottop
|
|
244
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
245
|
+
1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
246
|
+
-1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
247
|
+
//right
|
|
248
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
249
|
+
1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
250
|
+
1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
251
|
+
//left
|
|
252
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
253
|
+
-1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
254
|
+
-1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
255
|
+
//
|
|
256
|
+
// outside
|
|
257
|
+
//
|
|
258
|
+
//top
|
|
259
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
260
|
+
1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
261
|
+
-1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
262
|
+
//bottop
|
|
263
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
264
|
+
-1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
265
|
+
1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
266
|
+
//right
|
|
267
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
268
|
+
1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset,
|
|
269
|
+
1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
270
|
+
//left
|
|
271
|
+
0 + xOffset, 0 + yOffset, 0 + zOffset,
|
|
272
|
+
-1 * width + xOffset, 1 * height + yOffset, -1 * length + zOffset,
|
|
273
|
+
-1 * width + xOffset, -1 * height + yOffset, -1 * length + zOffset
|
|
274
|
+
]
|
|
275
|
+
});
|
|
276
|
+
}
|
|
222
277
|
static createCylinder(radiusTop = 1.0, radiusBottom = 1.0, height = 1.0, radialSegments = 32, heightSegments = 1.0, isTop = true, isBottom = true, offsetX = 0, offsetY = 0, offsetZ = 0) {
|
|
223
278
|
let vertices = [], indices = [], normals = [];
|
|
224
279
|
let thetaStart = 0.0, thetaLength = Math.PI * 2;
|
package/lib/js/astro/jd.js
CHANGED
|
@@ -385,32 +385,32 @@ function __ls(jd, leapSeconds) {
|
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
387
|
const leapSecondsTable = [
|
|
388
|
-
__ls(2441317.5, 10.0),
|
|
389
|
-
__ls(2441499.5, 11.0),
|
|
390
|
-
__ls(2441683.5, 12.0),
|
|
391
|
-
__ls(2442048.5, 13.0),
|
|
392
|
-
__ls(2442413.5, 14.0),
|
|
393
|
-
__ls(2442778.5, 15.0),
|
|
394
|
-
__ls(2443144.5, 16.0),
|
|
395
|
-
__ls(2443509.5, 17.0),
|
|
396
|
-
__ls(2443874.5, 18.0),
|
|
397
|
-
__ls(2444239.5, 19.0),
|
|
398
|
-
__ls(2444786.5, 20.0),
|
|
399
|
-
__ls(2445151.5, 21.0),
|
|
400
|
-
__ls(2445516.5, 22.0),
|
|
401
|
-
__ls(2446247.5, 23.0),
|
|
402
|
-
__ls(2447161.5, 24.0),
|
|
403
|
-
__ls(2447892.5, 25.0),
|
|
404
|
-
__ls(2448257.5, 26.0),
|
|
405
|
-
__ls(2448804.5, 27.0),
|
|
406
|
-
__ls(2449169.5, 28.0),
|
|
407
|
-
__ls(2449534.5, 29.0),
|
|
408
|
-
__ls(2450083.5, 30.0),
|
|
409
|
-
__ls(2450630.5, 31.0),
|
|
410
|
-
__ls(2451179.5, 32.0),
|
|
411
|
-
__ls(2453736.5, 33.0),
|
|
412
|
-
__ls(2454832.5, 34.0),
|
|
413
|
-
__ls(2456109.5, 35.0),
|
|
388
|
+
__ls(2441317.5, 10.0), // 1972-01-01T00:00:00.000Z
|
|
389
|
+
__ls(2441499.5, 11.0), // 1972-07-01T00:00:00.000Z
|
|
390
|
+
__ls(2441683.5, 12.0), // 1973-01-01T00:00:00.000Z
|
|
391
|
+
__ls(2442048.5, 13.0), // 1974-01-01T00:00:00.000Z
|
|
392
|
+
__ls(2442413.5, 14.0), // 1975-01-01T00:00:00.000Z
|
|
393
|
+
__ls(2442778.5, 15.0), // 1976-01-01T00:00:00.000Z
|
|
394
|
+
__ls(2443144.5, 16.0), // 1977-01-01T00:00:00.000Z
|
|
395
|
+
__ls(2443509.5, 17.0), // 1978-01-01T00:00:00.000Z
|
|
396
|
+
__ls(2443874.5, 18.0), // 1979-01-01T00:00:00.000Z
|
|
397
|
+
__ls(2444239.5, 19.0), // 1980-01-01T00:00:00.000Z
|
|
398
|
+
__ls(2444786.5, 20.0), // 1981-07-01T00:00:00.000Z
|
|
399
|
+
__ls(2445151.5, 21.0), // 1982-07-01T00:00:00.000Z
|
|
400
|
+
__ls(2445516.5, 22.0), // 1983-01-01T00:00:00.000Z
|
|
401
|
+
__ls(2446247.5, 23.0), // 1985-07-01T00:00:00.000Z
|
|
402
|
+
__ls(2447161.5, 24.0), // 1988-01-01T00:00:00.000Z
|
|
403
|
+
__ls(2447892.5, 25.0), // 1990-01-01T00:00:00.000Z
|
|
404
|
+
__ls(2448257.5, 26.0), // 1991-01-01T00:00:00.000Z
|
|
405
|
+
__ls(2448804.5, 27.0), // 1992-07-01T00:00:00.000Z
|
|
406
|
+
__ls(2449169.5, 28.0), // 1993-07-01T00:00:00.000Z
|
|
407
|
+
__ls(2449534.5, 29.0), // 1994-07-01T00:00:00.000Z
|
|
408
|
+
__ls(2450083.5, 30.0), // 1996-01-01T00:00:00.000Z
|
|
409
|
+
__ls(2450630.5, 31.0), // 1997-07-01T00:00:00.000Z
|
|
410
|
+
__ls(2451179.5, 32.0), // 1999-01-01T00:00:00.000Z
|
|
411
|
+
__ls(2453736.5, 33.0), // 2006-01-01T00:00:00.000Z
|
|
412
|
+
__ls(2454832.5, 34.0), // 2009-01-01T00:00:00.000Z
|
|
413
|
+
__ls(2456109.5, 35.0), // 2012-07-01T00:00:00.000Z
|
|
414
414
|
__ls(2457204.5, 36.0) // 2015-07-01T00:00:00.000Z
|
|
415
415
|
];
|
|
416
416
|
export const J2000TAI = UTCtoTAI(J2000);
|
|
@@ -54,19 +54,19 @@ export class KeyboardNavigation extends Control {
|
|
|
54
54
|
}
|
|
55
55
|
onCameraMoveForward() {
|
|
56
56
|
let cam = this.planet.camera;
|
|
57
|
-
cam.slide(0, 0, -cam.
|
|
57
|
+
cam.slide(0, 0, -cam.getAltitude() / this.step);
|
|
58
58
|
}
|
|
59
59
|
onCameraMoveBackward() {
|
|
60
60
|
let cam = this.planet.camera;
|
|
61
|
-
cam.slide(0, 0, cam.
|
|
61
|
+
cam.slide(0, 0, cam.getAltitude() / this.step);
|
|
62
62
|
}
|
|
63
63
|
onCameraStrifeLeft() {
|
|
64
64
|
let cam = this.planet.camera;
|
|
65
|
-
cam.slide(-cam.
|
|
65
|
+
cam.slide(-cam.getAltitude() / this.step, 0, 0);
|
|
66
66
|
}
|
|
67
67
|
onCameraStrifeRight() {
|
|
68
68
|
let cam = this.planet.camera;
|
|
69
|
-
cam.slide(cam.
|
|
69
|
+
cam.slide(cam.getAltitude() / this.step, 0, 0);
|
|
70
70
|
}
|
|
71
71
|
onCameraLookUp() {
|
|
72
72
|
let cam = this.planet.camera;
|
|
@@ -74,7 +74,7 @@ export class KeyboardNavigation extends Control {
|
|
|
74
74
|
cam.pitch(15 / this.renderer.handler.deltaTime);
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
cam.rotateVertical((cam.
|
|
77
|
+
cam.rotateVertical((cam.getAltitude() / 3000000) * math.RADIANS, Vec3.ZERO);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
onCameraLookDown() {
|
|
@@ -83,7 +83,7 @@ export class KeyboardNavigation extends Control {
|
|
|
83
83
|
cam.pitch(-15 / this.renderer.handler.deltaTime);
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
cam.rotateVertical((-cam.
|
|
86
|
+
cam.rotateVertical((-cam.getAltitude() / 3000000) * math.RADIANS, Vec3.ZERO);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
onCameraLookLeft() {
|
|
@@ -92,7 +92,7 @@ export class KeyboardNavigation extends Control {
|
|
|
92
92
|
cam.roll(15 / this.renderer.handler.deltaTime);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
cam.rotateHorizontal((cam.
|
|
95
|
+
cam.rotateHorizontal((cam.getAltitude() / 3000000) * math.RADIANS);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
onCameraLookRight() {
|
|
@@ -101,7 +101,7 @@ export class KeyboardNavigation extends Control {
|
|
|
101
101
|
cam.roll(-15 / this.renderer.handler.deltaTime);
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
cam.rotateHorizontal((-cam.
|
|
104
|
+
cam.rotateHorizontal((-cam.getAltitude() / 3000000) * math.RADIANS);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
onCameraTurnLeft() {
|
|
@@ -110,7 +110,7 @@ export class KeyboardNavigation extends Control {
|
|
|
110
110
|
cam.yaw(15 / this.renderer.handler.deltaTime);
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
|
-
cam.rotateHorizontal((cam.
|
|
113
|
+
cam.rotateHorizontal((cam.getAltitude() / 3000000) * math.RADIANS);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
onCameraTurnRight() {
|
|
@@ -119,7 +119,7 @@ export class KeyboardNavigation extends Control {
|
|
|
119
119
|
cam.yaw(-15 / this.renderer.handler.deltaTime);
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
-
cam.rotateHorizontal((-cam.
|
|
122
|
+
cam.rotateHorizontal((-cam.getAltitude() / 3000000) * math.RADIANS, false, Vec3.ZERO);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
// from CompassButton._onClick()
|
|
@@ -275,10 +275,13 @@ export class MouseNavigation extends Control {
|
|
|
275
275
|
const cam = this.planet.camera;
|
|
276
276
|
if (this.pointOnEarth && e.moving) {
|
|
277
277
|
this.renderer.controlsBag.scaleRot = 1.0;
|
|
278
|
-
let l = (0.5 / cam.eye.distance(this.pointOnEarth)) *
|
|
278
|
+
let l = (0.5 / cam.eye.distance(this.pointOnEarth)) * cam._lonLat.height * math.RADIANS;
|
|
279
279
|
if (l > 0.007) {
|
|
280
280
|
l = 0.007;
|
|
281
281
|
}
|
|
282
|
+
else if (l < 0.003) {
|
|
283
|
+
l = 0.003;
|
|
284
|
+
}
|
|
282
285
|
cam.rotateHorizontal(l * (e.x - e.prev_x), false, this.pointOnEarth, this.earthUp);
|
|
283
286
|
cam.rotateVertical(l * (e.y - e.prev_y), this.pointOnEarth, this.minSlope);
|
|
284
287
|
}
|
|
@@ -303,13 +306,6 @@ export class MouseNavigation extends Control {
|
|
|
303
306
|
if (this.stepIndex) {
|
|
304
307
|
r.controlsBag.scaleRot = 1.0;
|
|
305
308
|
const sf = this.stepsForward[this.stepsCount - this.stepIndex--];
|
|
306
|
-
let maxAlt = cam.maxAltitude + this.planet.ellipsoid.polarSize;
|
|
307
|
-
let minAlt = cam.minAltitude + this.planet.ellipsoid.polarSize;
|
|
308
|
-
const camAlt = sf.eye.length();
|
|
309
|
-
if (camAlt > maxAlt || camAlt < minAlt && this._wheelDirection > 0) {
|
|
310
|
-
this._wheelDirection = +1;
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
309
|
cam.eye = sf.eye;
|
|
314
310
|
cam._u = sf.v;
|
|
315
311
|
cam._r = sf.u;
|
|
@@ -55,38 +55,38 @@ export const SCALES = [
|
|
|
55
55
|
[10.0, 10],
|
|
56
56
|
[15.0, 15],
|
|
57
57
|
[30.0, 6],
|
|
58
|
-
[60.0, 12],
|
|
59
|
-
[120.0, 12],
|
|
60
|
-
[300.0, 5],
|
|
61
|
-
[600.0, 10],
|
|
62
|
-
[900.0, 15],
|
|
63
|
-
[1800.0, 6],
|
|
64
|
-
[3600.0, 12],
|
|
65
|
-
[7200.0, 10],
|
|
66
|
-
[14400.0, 4],
|
|
67
|
-
[21600.0, 6],
|
|
68
|
-
[43200.0, 12],
|
|
69
|
-
[86400.0, 24],
|
|
70
|
-
[172800.0, 2],
|
|
71
|
-
[345600.0, 4],
|
|
72
|
-
[604800.0, 7],
|
|
73
|
-
[1296000.0, 15],
|
|
74
|
-
[2592000.0, 5],
|
|
75
|
-
[5184000.0, 6],
|
|
76
|
-
[7776000.0, 9],
|
|
77
|
-
[15552000.0, 18],
|
|
78
|
-
[31536000.0, 12],
|
|
79
|
-
[63072000.0, 2],
|
|
80
|
-
[126144000.0, 4],
|
|
81
|
-
[157680000.0, 5],
|
|
82
|
-
[315360000.0, 10],
|
|
83
|
-
[630720000.0, 2],
|
|
84
|
-
[1261440000.0, 4],
|
|
85
|
-
[1576800000.0, 5],
|
|
86
|
-
[3153600000.0, 10],
|
|
87
|
-
[6307200000.0, 2],
|
|
88
|
-
[12614400000.0, 4],
|
|
89
|
-
[15768000000.0, 5],
|
|
58
|
+
[60.0, 12], // 1min
|
|
59
|
+
[120.0, 12], // 2min
|
|
60
|
+
[300.0, 5], // 5min
|
|
61
|
+
[600.0, 10], // 10min
|
|
62
|
+
[900.0, 15], // 15min
|
|
63
|
+
[1800.0, 6], // 30min
|
|
64
|
+
[3600.0, 12], // 1hr
|
|
65
|
+
[7200.0, 10], // 2hr
|
|
66
|
+
[14400.0, 4], // 4hr
|
|
67
|
+
[21600.0, 6], // 6hr
|
|
68
|
+
[43200.0, 12], // 12hr
|
|
69
|
+
[86400.0, 24], // 24hr
|
|
70
|
+
[172800.0, 2], // 2days
|
|
71
|
+
[345600.0, 4], // 4days
|
|
72
|
+
[604800.0, 7], // 7days
|
|
73
|
+
[1296000.0, 15], // 15days
|
|
74
|
+
[2592000.0, 5], // 30days
|
|
75
|
+
[5184000.0, 6], // 60days
|
|
76
|
+
[7776000.0, 9], // 90days
|
|
77
|
+
[15552000.0, 18], // 180days
|
|
78
|
+
[31536000.0, 12], // 365days
|
|
79
|
+
[63072000.0, 2], // 2years
|
|
80
|
+
[126144000.0, 4], // 4years
|
|
81
|
+
[157680000.0, 5], // 5years
|
|
82
|
+
[315360000.0, 10], // 10years
|
|
83
|
+
[630720000.0, 2], // 20years
|
|
84
|
+
[1261440000.0, 4], // 40years
|
|
85
|
+
[1576800000.0, 5], // 50years
|
|
86
|
+
[3153600000.0, 10], // 100years
|
|
87
|
+
[6307200000.0, 2], // 200years
|
|
88
|
+
[12614400000.0, 4], // 400years
|
|
89
|
+
[15768000000.0, 5], // 500years
|
|
90
90
|
[31536000000.0, 10], // 1000years
|
|
91
91
|
];
|
|
92
92
|
export function getScale(seconds) {
|
|
@@ -145,6 +145,12 @@ declare class Ellipsoid {
|
|
|
145
145
|
* @returns {LonLat} - Destination point coordinates
|
|
146
146
|
*/
|
|
147
147
|
getGreatCircleDestination(lonLat: LonLat, azimuth: number, dist: number): LonLat;
|
|
148
|
+
/**
|
|
149
|
+
* Returns inverse Geodesic solution for two points
|
|
150
|
+
* @param {LonLat} lonLat1 - start coordinates point
|
|
151
|
+
* @param {LonLat} lonLat2 - end coordinates point
|
|
152
|
+
* @returns {IInverseResult} - Contains distance, initialAzimuth, and finalAzimuth values
|
|
153
|
+
*/
|
|
148
154
|
inverse(lonLat1: LonLat, lonLat2: LonLat): IInverseResult;
|
|
149
155
|
/**
|
|
150
156
|
* Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m).
|
|
@@ -153,7 +159,7 @@ declare class Ellipsoid {
|
|
|
153
159
|
* @param {LonLat} lonLat - Origin coordinates
|
|
154
160
|
* @param {number} azimuth - View azimuth in degrees
|
|
155
161
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
156
|
-
* @returns {LonLat} - Destination point coordinates
|
|
162
|
+
* @returns {{ destination: LonLat; finalAzimuth: number }} - Destination point coordinates
|
|
157
163
|
*/
|
|
158
164
|
direct(lonLat: LonLat, azimuth: number, dist: number): IDirectResult;
|
|
159
165
|
/**
|
|
@@ -229,6 +229,12 @@ class Ellipsoid {
|
|
|
229
229
|
getGreatCircleDestination(lonLat, azimuth, dist) {
|
|
230
230
|
return this.direct(lonLat, azimuth, dist).destination;
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Returns inverse Geodesic solution for two points
|
|
234
|
+
* @param {LonLat} lonLat1 - start coordinates point
|
|
235
|
+
* @param {LonLat} lonLat2 - end coordinates point
|
|
236
|
+
* @returns {IInverseResult} - Contains distance, initialAzimuth, and finalAzimuth values
|
|
237
|
+
*/
|
|
232
238
|
inverse(lonLat1, lonLat2) {
|
|
233
239
|
let a = this._a, b = this._b, f = this._flattening;
|
|
234
240
|
const fi1 = lonLat1.lat * RADIANS, lambda1 = lonLat1.lon * RADIANS;
|
|
@@ -282,7 +288,7 @@ class Ellipsoid {
|
|
|
282
288
|
* @param {LonLat} lonLat - Origin coordinates
|
|
283
289
|
* @param {number} azimuth - View azimuth in degrees
|
|
284
290
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
285
|
-
* @returns {LonLat} - Destination point coordinates
|
|
291
|
+
* @returns {{ destination: LonLat; finalAzimuth: number }} - Destination point coordinates
|
|
286
292
|
*/
|
|
287
293
|
direct(lonLat, azimuth, dist) {
|
|
288
294
|
let lon1 = lonLat.lon, lat1 = lonLat.lat;
|
|
@@ -12,7 +12,7 @@ export interface IGeoObjectParams {
|
|
|
12
12
|
pitch?: number;
|
|
13
13
|
yaw?: number;
|
|
14
14
|
roll?: number;
|
|
15
|
-
scale?: number;
|
|
15
|
+
scale?: number | Vec3;
|
|
16
16
|
color?: Vec4 | NumberArray4 | string;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -43,7 +43,7 @@ declare class GeoObject {
|
|
|
43
43
|
protected _pitch: number;
|
|
44
44
|
protected _yaw: number;
|
|
45
45
|
protected _roll: number;
|
|
46
|
-
protected _scale:
|
|
46
|
+
protected _scale: Vec3;
|
|
47
47
|
/**
|
|
48
48
|
* RGBA color.
|
|
49
49
|
* @public
|
|
@@ -118,10 +118,15 @@ declare class GeoObject {
|
|
|
118
118
|
*/
|
|
119
119
|
setPosition3v(position: Vec3): void;
|
|
120
120
|
setYaw(yaw: number): void;
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @param {number} pitch - Pitch in radians
|
|
124
|
+
*/
|
|
121
125
|
setPitch(pitch: number): void;
|
|
122
126
|
setRoll(roll: number): void;
|
|
123
127
|
setScale(scale: number): void;
|
|
124
|
-
|
|
128
|
+
setScale3v(scale: Vec3): void;
|
|
129
|
+
getScale(): Vec3;
|
|
125
130
|
/**
|
|
126
131
|
* Removes geo object from handler.
|
|
127
132
|
* @public
|
|
@@ -21,7 +21,7 @@ class GeoObject {
|
|
|
21
21
|
this._pitch = options.pitch || 0.0;
|
|
22
22
|
this._yaw = options.yaw || 0.0;
|
|
23
23
|
this._roll = options.roll || 0.0;
|
|
24
|
-
this._scale = options.scale
|
|
24
|
+
this._scale = utils.createVector3(options.scale, new Vec3(1, 1, 1));
|
|
25
25
|
this._color = utils.createColorRGBA(options.color);
|
|
26
26
|
this._direction = new Vec3(0, 1, 0);
|
|
27
27
|
this._handler = null;
|
|
@@ -151,6 +151,10 @@ class GeoObject {
|
|
|
151
151
|
this._yaw = yaw;
|
|
152
152
|
this.updateDirection();
|
|
153
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
*
|
|
156
|
+
* @param {number} pitch - Pitch in radians
|
|
157
|
+
*/
|
|
154
158
|
setPitch(pitch) {
|
|
155
159
|
this._pitch = pitch;
|
|
156
160
|
this._handler && this._handler.setPitchRollArr(this._tagData, this._tagDataIndex, pitch, this._roll);
|
|
@@ -160,7 +164,11 @@ class GeoObject {
|
|
|
160
164
|
this._handler && this._handler.setPitchRollArr(this._tagData, this._tagDataIndex, this._pitch, roll);
|
|
161
165
|
}
|
|
162
166
|
setScale(scale) {
|
|
163
|
-
this._scale = scale;
|
|
167
|
+
this._scale.x = this._scale.y = this._scale.z = scale;
|
|
168
|
+
this._handler && this._handler.setScaleArr(this._tagData, this._tagDataIndex, this._scale);
|
|
169
|
+
}
|
|
170
|
+
setScale3v(scale) {
|
|
171
|
+
this._scale.copy(scale);
|
|
164
172
|
this._handler && this._handler.setScaleArr(this._tagData, this._tagDataIndex, scale);
|
|
165
173
|
}
|
|
166
174
|
getScale() {
|
|
@@ -85,7 +85,7 @@ declare class GeoObjectHandler {
|
|
|
85
85
|
setRgbaArr(tagData: InstanceData, tagDataIndex: number, rgba: Vec4): void;
|
|
86
86
|
setPickingColorArr(tagData: InstanceData, tagDataIndex: number, color: Vec3): void;
|
|
87
87
|
setPitchRollArr(tagData: InstanceData, tagDataIndex: number, pitch: number, roll: number): void;
|
|
88
|
-
setScaleArr(tagData: InstanceData, tagDataIndex: number, scale:
|
|
88
|
+
setScaleArr(tagData: InstanceData, tagDataIndex: number, scale: Vec3): void;
|
|
89
89
|
protected _updateTag(dataTag: InstanceData): void;
|
|
90
90
|
update(): void;
|
|
91
91
|
_removeAll(): void;
|
|
@@ -151,10 +151,10 @@ class InstanceData {
|
|
|
151
151
|
h.setStreamArrayBuffer(this._visibleBuffer, this._visibleArr);
|
|
152
152
|
}
|
|
153
153
|
createSizeBuffer() {
|
|
154
|
-
let h = this._geoObjectHandler._planet.renderer.handler, numItems = this._sizeArr.length;
|
|
154
|
+
let h = this._geoObjectHandler._planet.renderer.handler, numItems = this._sizeArr.length / 3;
|
|
155
155
|
if (!this._sizeBuffer || this._sizeBuffer.numItems !== numItems) {
|
|
156
156
|
h.gl.deleteBuffer(this._sizeBuffer);
|
|
157
|
-
this._sizeBuffer = h.createStreamArrayBuffer(
|
|
157
|
+
this._sizeBuffer = h.createStreamArrayBuffer(3, numItems);
|
|
158
158
|
}
|
|
159
159
|
this._sizeArr = makeArrayTyped(this._sizeArr);
|
|
160
160
|
h.setStreamArrayBuffer(this._sizeBuffer, this._sizeArr);
|
|
@@ -312,12 +312,17 @@ class GeoObjectHandler {
|
|
|
312
312
|
x = geoObject.getPitch();
|
|
313
313
|
y = geoObject.getRoll();
|
|
314
314
|
tagData._pitchRollArr = concatArrays(tagData._pitchRollArr, setParametersToArray([], 0, itemSize, itemSize, x, y));
|
|
315
|
-
itemSize =
|
|
316
|
-
|
|
315
|
+
itemSize = 3;
|
|
316
|
+
let scale = geoObject.getScale();
|
|
317
|
+
x = scale.x;
|
|
318
|
+
y = scale.y;
|
|
319
|
+
z = scale.z;
|
|
320
|
+
tagData._sizeArr = concatArrays(tagData._sizeArr, setParametersToArray([], 0, itemSize, itemSize, x, y, z));
|
|
317
321
|
}
|
|
318
322
|
_displayPASS() {
|
|
319
323
|
let r = this._planet.renderer, sh = r.handler.programs.geo_object, p = sh._program, u = p.uniforms, a = p.attributes, gl = r.handler.gl, ec = this._entityCollection;
|
|
320
324
|
sh.activate();
|
|
325
|
+
//gl.disable(gl.CULL_FACE);
|
|
321
326
|
//
|
|
322
327
|
// Could be in VAO
|
|
323
328
|
//
|
|
@@ -451,7 +456,7 @@ class GeoObjectHandler {
|
|
|
451
456
|
this._updateTag(tagData);
|
|
452
457
|
}
|
|
453
458
|
setScaleArr(tagData, tagDataIndex, scale) {
|
|
454
|
-
setParametersToArray(tagData._sizeArr, tagDataIndex,
|
|
459
|
+
setParametersToArray(tagData._sizeArr, tagDataIndex, 3, 3, scale.x, scale.y, scale.z);
|
|
455
460
|
tagData._changedBuffers[SIZE_BUFFER] = true;
|
|
456
461
|
this._updateTag(tagData);
|
|
457
462
|
}
|
|
@@ -541,8 +546,8 @@ class GeoObjectHandler {
|
|
|
541
546
|
tagData._positionLowArr = spliceArray(tagData._positionLowArr, tdi * 3, 3);
|
|
542
547
|
tagData._directionArr = spliceArray(tagData._directionArr, tdi * 3, 3);
|
|
543
548
|
tagData._pickingColorArr = spliceArray(tagData._pickingColorArr, tdi * 3, 3);
|
|
549
|
+
tagData._sizeArr = spliceArray(tagData._sizeArr, tdi * 3, 3);
|
|
544
550
|
tagData._pitchRollArr = spliceArray(tagData._pitchRollArr, tdi * 2, 2);
|
|
545
|
-
tagData._sizeArr = spliceArray(tagData._sizeArr, tdi, 1);
|
|
546
551
|
tagData._visibleArr = spliceArray(tagData._visibleArr, tdi, 1);
|
|
547
552
|
geoObject._handlerIndex = -1;
|
|
548
553
|
geoObject._handler = null;
|
package/lib/js/quadTree/Node.js
CHANGED
|
@@ -7,7 +7,7 @@ import { MAX, MIN } from "../math";
|
|
|
7
7
|
import { MAX_LAT } from "../mercator";
|
|
8
8
|
import { Vec2 } from "../math/Vec2";
|
|
9
9
|
import { Vec3 } from "../math/Vec3";
|
|
10
|
-
import { E, MAX_RENDERED_NODES, N, NE, NEIGHBOUR, NOTRENDERING, NW, OPPART, OPSIDE, PARTOFFSET, RENDERING, S, SE, SW,
|
|
10
|
+
import { E, MAX_RENDERED_NODES, N, NE, NEIGHBOUR, NOTRENDERING, NW, OPPART, OPSIDE, PARTOFFSET, RENDERING, S, SE, SW, W, WALKTHROUGH } from "./quadTree";
|
|
11
11
|
import { TILEGROUP_COMMON, TILEGROUP_NORTH, TILEGROUP_SOUTH } from "../segment/Segment";
|
|
12
12
|
let _tempHigh = new Vec3(), _tempLow = new Vec3();
|
|
13
13
|
const _vertOrder = [
|
|
@@ -202,15 +202,17 @@ class Node {
|
|
|
202
202
|
}
|
|
203
203
|
if (this.inFrustum || this._cameraInside || seg.tileZoom < 3) {
|
|
204
204
|
let h = Math.abs(cam._lonLat.height);
|
|
205
|
-
let
|
|
206
|
-
|
|
207
|
-
let altVis = seg.tileZoom
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
205
|
+
let horizonDist = cam.eye.length2() - this.planet.ellipsoid.polarSizeSqr;
|
|
206
|
+
horizonDist = horizonDist < 106876472875.63281 * planet._heightFactor ? 106876472875.63281 * planet._heightFactor : horizonDist;
|
|
207
|
+
let altVis = seg.tileZoom < 2 || seg.tileZoom > 19 ||
|
|
208
|
+
/* Could be replaced with camera frustum always looking down check,
|
|
209
|
+
and not to go througn nodes from the oppositeside of the globe*/
|
|
210
|
+
(seg.tileZoom < 5 && !seg.terrainReady);
|
|
211
|
+
altVis = altVis ||
|
|
212
|
+
cam.eye.distance2(seg._sw) < horizonDist ||
|
|
213
|
+
cam.eye.distance2(seg._nw) < horizonDist ||
|
|
214
|
+
cam.eye.distance2(seg._ne) < horizonDist ||
|
|
215
|
+
cam.eye.distance2(seg._se) < horizonDist;
|
|
214
216
|
if ((this.inFrustum && (altVis || h > 10000.0)) || this._cameraInside) {
|
|
215
217
|
//@todo: replace to the strategy
|
|
216
218
|
seg._collectVisibleNodes();
|
|
@@ -218,7 +220,8 @@ class Node {
|
|
|
218
220
|
if (seg.tileZoom < 2) {
|
|
219
221
|
this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
220
222
|
}
|
|
221
|
-
else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize
|
|
223
|
+
else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize
|
|
224
|
+
|| maxZoom && ((seg.tileZoom === maxZoom) || !altVis))) {
|
|
222
225
|
if (altVis) {
|
|
223
226
|
seg.passReady = true;
|
|
224
227
|
this.renderNode(this.inFrustum, !this.inFrustum, terrainReadySegment, stopLoading);
|
|
@@ -476,60 +479,6 @@ class Node {
|
|
|
476
479
|
}
|
|
477
480
|
return -1;
|
|
478
481
|
}
|
|
479
|
-
// // TODO: test test test
|
|
480
|
-
// public ___getCommonSide___(b: Node) {
|
|
481
|
-
// let a = this, as = a.segment, bs = b.segment;
|
|
482
|
-
//
|
|
483
|
-
// if (as.tileZoom === bs.tileZoom) {
|
|
484
|
-
// return as.getNeighborSide(bs);
|
|
485
|
-
// } else if (as.tileZoom > bs.tileZoom) {
|
|
486
|
-
// let dz = as.tileZoom - bs.tileZoom, i = dz, p: Node = this;
|
|
487
|
-
//
|
|
488
|
-
// while (i--) {
|
|
489
|
-
// p = p.parentNode!;
|
|
490
|
-
// }
|
|
491
|
-
//
|
|
492
|
-
// let side = p.segment.getNeighborSide(bs);
|
|
493
|
-
//
|
|
494
|
-
// if (side !== -1) {
|
|
495
|
-
// i = dz;
|
|
496
|
-
// p = this;
|
|
497
|
-
// let _n = true;
|
|
498
|
-
//
|
|
499
|
-
// while (i--) {
|
|
500
|
-
// _n = _n && COMSIDE[p.partId][side];
|
|
501
|
-
// }
|
|
502
|
-
//
|
|
503
|
-
// if (_n) {
|
|
504
|
-
// return side;
|
|
505
|
-
// }
|
|
506
|
-
// }
|
|
507
|
-
// } else {
|
|
508
|
-
// let dz = bs.tileZoom - as.tileZoom, i = dz, p = b;
|
|
509
|
-
//
|
|
510
|
-
// while (i--) {
|
|
511
|
-
// p = p.parentNode!;
|
|
512
|
-
// }
|
|
513
|
-
//
|
|
514
|
-
// let side = p.segment.getNeighborSide(as);
|
|
515
|
-
//
|
|
516
|
-
// if (side !== -1) {
|
|
517
|
-
// i = dz;
|
|
518
|
-
// p = b;
|
|
519
|
-
// let _n = true;
|
|
520
|
-
//
|
|
521
|
-
// while (i--) {
|
|
522
|
-
// _n = _n && COMSIDE[p.partId][side];
|
|
523
|
-
// }
|
|
524
|
-
//
|
|
525
|
-
// if (_n) {
|
|
526
|
-
// return OPSIDE[side];
|
|
527
|
-
// }
|
|
528
|
-
// }
|
|
529
|
-
// }
|
|
530
|
-
//
|
|
531
|
-
// return -1;
|
|
532
|
-
// }
|
|
533
482
|
whileNormalMapCreating() {
|
|
534
483
|
const seg = this.segment;
|
|
535
484
|
if (!seg.terrainIsLoading && seg.terrainExists && !seg._inTheQueue) {
|
|
@@ -720,7 +720,8 @@ class Renderer {
|
|
|
720
720
|
this.enableBlendDefault();
|
|
721
721
|
e.dispatch(e.draw, this);
|
|
722
722
|
let frustums = this.activeCamera.frustums;
|
|
723
|
-
let pointerEvent =
|
|
723
|
+
let pointerEvent = e.pointerEvent();
|
|
724
|
+
let mouseHold = e.mouseState.leftButtonDown || e.mouseState.rightButtonDown;
|
|
724
725
|
// Rendering scene nodes and entityCollections
|
|
725
726
|
let rn = this._renderNodesArr;
|
|
726
727
|
let k = frustums.length;
|
|
@@ -740,21 +741,21 @@ class Renderer {
|
|
|
740
741
|
this._drawTransparentEntityCollections();
|
|
741
742
|
this._clearEntityCollectionQueue();
|
|
742
743
|
e.dispatch(e.drawtransparent, this);
|
|
743
|
-
if (pointerEvent) {
|
|
744
|
+
if (pointerEvent && !mouseHold) {
|
|
744
745
|
this._drawPickingBuffer();
|
|
745
|
-
this.__useDistanceFramebuffer__ && this._drawDistanceBuffer();
|
|
746
746
|
}
|
|
747
|
+
this.__useDistanceFramebuffer__ && this._drawDistanceBuffer();
|
|
747
748
|
}
|
|
748
749
|
sceneFramebuffer.deactivate();
|
|
749
750
|
this.blitFramebuffer && sceneFramebuffer.blitTo(this.blitFramebuffer, 0);
|
|
750
751
|
if (pointerEvent) {
|
|
751
|
-
// It works ONLY for 0 (closest) frustum
|
|
752
752
|
if (h.isWebGl2()) {
|
|
753
|
+
// It works ONLY for 0 (closest) frustum
|
|
753
754
|
this._drawDepthBuffer();
|
|
754
755
|
}
|
|
755
756
|
this._readPickingBuffer();
|
|
756
|
-
this.__useDistanceFramebuffer__ && this._readDistanceBuffer();
|
|
757
757
|
}
|
|
758
|
+
this.__useDistanceFramebuffer__ && this._readDistanceBuffer();
|
|
758
759
|
// Tone mapping followed by rendering on the screen
|
|
759
760
|
this._fnScreenFrame();
|
|
760
761
|
e.dispatch(e.postdraw, this);
|