@openglobus/og 0.19.3 → 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/timeline/timelineUtils.js +32 -32
- 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/scene/Axes.js +4 -4
- package/lib/js/shaders/geoObject.js +6 -6
- 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);
|
|
@@ -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) {
|
|
@@ -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/scene/Axes.js
CHANGED
|
@@ -43,13 +43,13 @@ class Axes extends RenderNode {
|
|
|
43
43
|
}
|
|
44
44
|
createAxesBuffer(gridSize) {
|
|
45
45
|
const vertices = [
|
|
46
|
-
0.0, 0.0, 0.0, gridSize - 1, 0.0, 0.0,
|
|
47
|
-
0.0, 0.0, 0.0, 0.0, gridSize - 1, 0.0,
|
|
46
|
+
0.0, 0.0, 0.0, gridSize - 1, 0.0, 0.0, // x - R
|
|
47
|
+
0.0, 0.0, 0.0, 0.0, gridSize - 1, 0.0, // y - B
|
|
48
48
|
0.0, 0.0, 0.0, 0.0, 0.0, gridSize - 1 // z - G
|
|
49
49
|
];
|
|
50
50
|
const colors = [
|
|
51
|
-
1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0,
|
|
52
|
-
0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0,
|
|
51
|
+
1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, // x - R
|
|
52
|
+
0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, // y - B
|
|
53
53
|
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 // z - G
|
|
54
54
|
];
|
|
55
55
|
this.axesBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(vertices), 3, 6);
|
|
@@ -21,7 +21,7 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
21
21
|
aDirection: { type: "vec3", divisor: 1 },
|
|
22
22
|
aPitchRoll: { type: "vec2", divisor: 1 },
|
|
23
23
|
aColor: { type: "vec4", divisor: 1 },
|
|
24
|
-
aScale: { type: "
|
|
24
|
+
aScale: { type: "vec3", divisor: 1 },
|
|
25
25
|
aDispose: { type: "float", divisor: 1 }
|
|
26
26
|
},
|
|
27
27
|
vertexShader: `precision highp float;
|
|
@@ -33,7 +33,7 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
33
33
|
attribute vec3 aDirection;
|
|
34
34
|
attribute vec2 aPitchRoll;
|
|
35
35
|
attribute vec4 aColor;
|
|
36
|
-
attribute
|
|
36
|
+
attribute vec3 aScale;
|
|
37
37
|
attribute float aDispose;
|
|
38
38
|
attribute float aUseTexture;
|
|
39
39
|
attribute vec2 aTexCoord;
|
|
@@ -118,7 +118,7 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
118
118
|
// ... is the same math
|
|
119
119
|
float scd = uScaleByDistance[2] * clamp(lookLength, uScaleByDistance[0], uScaleByDistance[1]) / uScaleByDistance[0];
|
|
120
120
|
|
|
121
|
-
vec3 vert = modelMatrix * aVertexPosition * aScale * scd;
|
|
121
|
+
vec3 vert = modelMatrix * (aVertexPosition * aScale) * scd;
|
|
122
122
|
v_vertex = position + vert;
|
|
123
123
|
|
|
124
124
|
// @hack
|
|
@@ -183,7 +183,7 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
|
|
|
183
183
|
aDirection: { type: "vec3", divisor: 1 },
|
|
184
184
|
aPitchRoll: { type: "vec2", divisor: 1 },
|
|
185
185
|
aPickingColor: { type: "vec3", divisor: 1 },
|
|
186
|
-
aScale: { type: "
|
|
186
|
+
aScale: { type: "vec3", divisor: 1 },
|
|
187
187
|
aDispose: { type: "float", divisor: 1 }
|
|
188
188
|
},
|
|
189
189
|
vertexShader: `precision highp float;
|
|
@@ -194,7 +194,7 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
|
|
|
194
194
|
attribute vec3 aDirection;
|
|
195
195
|
attribute vec3 aPickingColor;
|
|
196
196
|
attribute vec2 aPitchRoll;
|
|
197
|
-
attribute
|
|
197
|
+
attribute vec3 aScale;
|
|
198
198
|
attribute float aDispose;
|
|
199
199
|
|
|
200
200
|
uniform vec3 eyePositionHigh;
|
|
@@ -262,7 +262,7 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
|
|
|
262
262
|
// tays in the vert above it affects on Mac Safari jitter
|
|
263
263
|
float scd = pickingScale * uScaleByDistance[2] * clamp(lookLength, uScaleByDistance[0], uScaleByDistance[1]) / uScaleByDistance[0];
|
|
264
264
|
|
|
265
|
-
vec3 vert = modelMatrix * aVertexPosition * aScale * scd;
|
|
265
|
+
vec3 vert = modelMatrix * (aVertexPosition * aScale) * scd;
|
|
266
266
|
|
|
267
267
|
vert += lowDiff;
|
|
268
268
|
|
|
@@ -13,6 +13,7 @@ declare class MapboxTerrain extends GlobusTerrain {
|
|
|
13
13
|
protected _ctx: CanvasRenderingContext2D;
|
|
14
14
|
protected _imageDataCache: Record<string, Uint8ClampedArray>;
|
|
15
15
|
constructor(name: string | null, options?: IMapboxTerrainParams);
|
|
16
|
+
static checkNoDataValue(noDataValues: number[] | TypedArray, value: number): boolean;
|
|
16
17
|
isBlur(segment: Segment): boolean;
|
|
17
18
|
protected _createTemporalCanvas(size: number): CanvasRenderingContext2D;
|
|
18
19
|
protected _createHeights(data: HTMLImageElement | ImageBitmap, tileIndex: string, tileX: number, tileY: number, tileZoom: number, extent: Extent, preventChildren: boolean): TypedArray | number[];
|
|
@@ -3,6 +3,7 @@ import { getTileExtent } from "../mercator";
|
|
|
3
3
|
import { GlobusTerrain } from "./GlobusTerrain";
|
|
4
4
|
import { isPowerOfTwo } from "../math";
|
|
5
5
|
import { Layer } from "../layer/Layer";
|
|
6
|
+
import { binarySearchFast } from "../utils/shared";
|
|
6
7
|
/**
|
|
7
8
|
* The key doesn't work; just an example!
|
|
8
9
|
*/
|
|
@@ -31,6 +32,12 @@ class MapboxTerrain extends GlobusTerrain {
|
|
|
31
32
|
this._ctx = this._createTemporalCanvas(this._imageSize);
|
|
32
33
|
this._imageDataCache = {};
|
|
33
34
|
}
|
|
35
|
+
static checkNoDataValue(noDataValues, value) {
|
|
36
|
+
if (value > 50000) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return binarySearchFast(noDataValues, value) !== -1;
|
|
40
|
+
}
|
|
34
41
|
isBlur(segment) {
|
|
35
42
|
return segment.tileZoom >= 16;
|
|
36
43
|
}
|
|
@@ -10,8 +10,8 @@ export function objParser(text) {
|
|
|
10
10
|
];
|
|
11
11
|
// same order as `f` indices
|
|
12
12
|
let vertexData = [
|
|
13
|
-
[],
|
|
14
|
-
[],
|
|
13
|
+
[], // positions
|
|
14
|
+
[], // texcoords
|
|
15
15
|
[], // normals
|
|
16
16
|
];
|
|
17
17
|
const materialLibs = [];
|
|
@@ -82,7 +82,7 @@ export function objParser(text) {
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
s: () => {
|
|
85
|
-
},
|
|
85
|
+
}, // smoothing group
|
|
86
86
|
mtllib(parts, unparsedArgs) {
|
|
87
87
|
// the spec says there can be multiple filenames here
|
|
88
88
|
// but many exist with spaces in a single filename
|
package/lib/js/utils/shared.d.ts
CHANGED
|
@@ -52,8 +52,9 @@ export declare function stringTemplate(template: string, params?: any): string;
|
|
|
52
52
|
export declare function getHTML(template: string, params?: any): string;
|
|
53
53
|
export declare function parseHTML(htmlStr: string): HTMLElement[];
|
|
54
54
|
export declare function print2d(id: string, text: string, x: number, y: number): void;
|
|
55
|
+
export declare function isNumber(value: any): boolean;
|
|
55
56
|
export declare function defaultString(str?: string, def?: string): string;
|
|
56
|
-
export declare function createVector3(v?: Vec3 | Vec2 | NumberArray3 | NumberArray2 | null, def?: Vec3): Vec3;
|
|
57
|
+
export declare function createVector3(v?: number | Vec3 | Vec2 | NumberArray3 | NumberArray2 | null, def?: Vec3): Vec3;
|
|
57
58
|
export declare function createVector4(v?: Vec4 | NumberArray4 | null, def?: Vec4): Vec4;
|
|
58
59
|
export declare function createColorRGBA(c?: string | NumberArray4 | Vec4 | null, def?: Vec4): Vec4;
|
|
59
60
|
export declare function createColorRGB(c?: string | NumberArray3 | Vec3 | null, def?: Vec3): Vec3;
|
package/lib/js/utils/shared.js
CHANGED
|
@@ -145,12 +145,18 @@ export function print2d(id, text, x, y) {
|
|
|
145
145
|
el.style.left = `${x}px`;
|
|
146
146
|
el.style.top = `${y}px`;
|
|
147
147
|
}
|
|
148
|
+
export function isNumber(value) {
|
|
149
|
+
return typeof value === 'number';
|
|
150
|
+
}
|
|
148
151
|
export function defaultString(str, def = "") {
|
|
149
152
|
return str ? str.trim() : def;
|
|
150
153
|
}
|
|
151
154
|
export function createVector3(v, def) {
|
|
152
155
|
if (v) {
|
|
153
|
-
if (v
|
|
156
|
+
if (isNumber(v)) {
|
|
157
|
+
return new Vec3(v, v, v);
|
|
158
|
+
}
|
|
159
|
+
else if (v instanceof Vec3) {
|
|
154
160
|
return v.clone();
|
|
155
161
|
}
|
|
156
162
|
else if (v instanceof Array) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.4",
|
|
4
4
|
"description": "[openglobus](https://www.openglobus.org/) is a javascript/typescript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers, and 3D objects. It uses the WebGL technology, open source, and completely free.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "./sandbox"
|
|
7
7
|
},
|
|
8
8
|
"main": "./lib/js/index.js",
|
|
9
|
+
"types": "./lib/js/index.d.ts",
|
|
9
10
|
"style": "./css/og.css",
|
|
10
11
|
"scripts": {
|
|
11
12
|
"docs": "jsdoc -r ./src/ -c ./jsdoc.conf.json -d ./docs",
|
|
@@ -32,28 +33,34 @@
|
|
|
32
33
|
},
|
|
33
34
|
"homepage": "https://www.openglobus.org",
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@babel/
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"
|
|
36
|
+
"@babel/cli": "^7.24.7",
|
|
37
|
+
"@babel/core": "^7.24.7",
|
|
38
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
39
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
40
|
+
"@babel/preset-env": "^7.24.7",
|
|
41
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
42
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
43
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
44
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
45
|
+
"@types/jest": "^29.5.12",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^7.10.0",
|
|
47
|
+
"@typescript-eslint/parser": "^7.10.0",
|
|
48
|
+
"clean-jsdoc-theme": "^4.3.0",
|
|
49
|
+
"eslint": "^8.57.0",
|
|
44
50
|
"jest": "^29.7.0",
|
|
45
51
|
"jest-canvas-mock": "^2.5.2",
|
|
46
52
|
"jest-environment-jsdom": "^29.7.0",
|
|
47
|
-
"jsdoc": "^4.0.
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
+
"jsdoc": "^4.0.3",
|
|
54
|
+
"jsdoc-babel": "^0.5.0",
|
|
55
|
+
"lint-staged": "^15.2.4",
|
|
56
|
+
"local-web-server": "^5.3.3",
|
|
57
|
+
"postcss": "^8.4.38",
|
|
58
|
+
"prettier": "^3.2.5",
|
|
59
|
+
"rollup": "^4.18.0",
|
|
53
60
|
"rollup-plugin-copy": "^3.5.0",
|
|
54
61
|
"rollup-plugin-postcss": "^4.0.2",
|
|
55
|
-
"ts-jest": "^29.1.
|
|
56
|
-
"typescript": "^5.
|
|
62
|
+
"ts-jest": "^29.1.3",
|
|
63
|
+
"typescript": "^5.4.5"
|
|
57
64
|
},
|
|
58
65
|
"lint-staged": {
|
|
59
66
|
"*.{js,ts}": [
|