@pirireis/webglobeplugins 0.15.17-alpha → 0.15.18-alpha
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/Math/methods.js +2 -2
- package/package.json +1 -1
- package/point-tracks/plugin.js +18 -13
- package/programs/line-on-globe/linestrip/linestrip.js +0 -1
- package/programs/totems/globe-changes.js +52 -0
- package/range-tools-on-terrain/bearing-line/adapters.js +8 -5
- package/range-tools-on-terrain/bearing-line/plugin.js +6 -4
- package/range-tools-on-terrain/circle-line-chain/adapters.js +2 -0
- package/range-tools-on-terrain/circle-line-chain/plugin.js +15 -4
- package/range-tools-on-terrain/range-ring/adapters.js +59 -7
- package/range-tools-on-terrain/range-ring/plugin.js +23 -3
- package/semiplugins/lightweight/line-plugin.js +8 -4
- package/semiplugins/lightweight/piece-of-pie-plugin.js +4 -2
- package/semiplugins/shape-on-terrain/arc-plugin.js +34 -10
- package/semiplugins/shape-on-terrain/circle-plugin.js +46 -21
- package/semiplugins/shape-on-terrain/padding-1-degree.js +357 -190
- package/util/account/single-attribute-buffer-management/buffer-manager.js +12 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator copy.js +161 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +91 -5
- package/util/account/single-attribute-buffer-management/chunked-buffer-manager.js +75 -0
- package/util/account/single-attribute-buffer-management/chunked-buffer-orchestrator.js +195 -0
- package/util/account/single-attribute-buffer-management/object-store.js +7 -0
- package/util/check/typecheck.js +12 -0
- package/util/geometry/index.js +2 -1
|
@@ -68,15 +68,16 @@ export class CircleOnTerrainPlugin {
|
|
|
68
68
|
_vao = null;
|
|
69
69
|
_dobuild = true; // This is used to trigger the build of circles when the camera position changes.
|
|
70
70
|
_staticDynamicStrategy = null;
|
|
71
|
-
|
|
71
|
+
_options = {
|
|
72
72
|
variativeColorsOn: false,
|
|
73
73
|
defaultColor: [0.1, 0.1, 0.1, 1], // Default color in RGBA format
|
|
74
|
-
defaultHeightFromGroundIn3D: 30.0
|
|
74
|
+
defaultHeightFromGroundIn3D: 30.0,
|
|
75
|
+
isMSL: false
|
|
75
76
|
};
|
|
76
77
|
constructor(id, styleOptions = null) {
|
|
77
78
|
this.id = id;
|
|
78
79
|
if (styleOptions) {
|
|
79
|
-
this.
|
|
80
|
+
this._options = { ...this._options, ...styleOptions };
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
init(globe, gl) {
|
|
@@ -92,8 +93,8 @@ export class CircleOnTerrainPlugin {
|
|
|
92
93
|
this.bufferManagerMap.set("position3d", {
|
|
93
94
|
bufferManager: new BufferManager(gl, (CIRCLE_POINTS_COUNT + 1) * 3, { initialCapacity }), // plus 1 is for butting linestrips
|
|
94
95
|
adaptor: (item) => {
|
|
95
|
-
const { longLatArr, height = this.
|
|
96
|
-
const result = globe3Dcoordinates(globe,
|
|
96
|
+
const { longLatArr, height = this._options.defaultHeightFromGroundIn3D, msl = this._options.isMSL } = item;
|
|
97
|
+
const result = globe3Dcoordinates(globe, longLatArr, height, msl, { paddingCount: 1, paddingValue: NaN });
|
|
97
98
|
return result;
|
|
98
99
|
}
|
|
99
100
|
});
|
|
@@ -105,7 +106,7 @@ export class CircleOnTerrainPlugin {
|
|
|
105
106
|
return result;
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
|
-
if (this.
|
|
109
|
+
if (this._options.variativeColorsOn) {
|
|
109
110
|
this.bufferManagerMap.set("color", {
|
|
110
111
|
bufferManager: new BufferManager(gl, (CIRCLE_POINTS_COUNT + 1) * 4, { initialCapacity }),
|
|
111
112
|
adaptor: (item) => {
|
|
@@ -116,17 +117,17 @@ export class CircleOnTerrainPlugin {
|
|
|
116
117
|
}
|
|
117
118
|
else {
|
|
118
119
|
for (let i = 0; i < CIRCLE_POINTS_COUNT; i++) {
|
|
119
|
-
_colorArray.set(this.
|
|
120
|
+
_colorArray.set(this._options.defaultColor, i * 4);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
return _colorArray;
|
|
123
124
|
}
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
|
-
this._vao = this.lineProgram.createVAO(createBufferAndReadInfo(this.bufferManagerMap.get("position3d")?.bufferManager.buffer), createBufferAndReadInfo(this.bufferManagerMap.get("position2d")?.bufferManager.buffer), this.
|
|
127
|
+
this._vao = this.lineProgram.createVAO(createBufferAndReadInfo(this.bufferManagerMap.get("position3d")?.bufferManager.buffer), createBufferAndReadInfo(this.bufferManagerMap.get("position2d")?.bufferManager.buffer), this._options.variativeColorsOn ?
|
|
127
128
|
createBufferAndReadInfo(this.bufferManagerMap.get("color")?.bufferManager.buffer) : null);
|
|
128
129
|
this._circleUBOHandler = this.lineProgram.createUBO();
|
|
129
|
-
this.setDefaultColor(this.
|
|
130
|
+
this.setDefaultColor(this._options.defaultColor);
|
|
130
131
|
this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
|
|
131
132
|
}
|
|
132
133
|
insertBulk(circles) {
|
|
@@ -175,22 +176,40 @@ export class CircleOnTerrainPlugin {
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
setPluginOpacity(opacity) {
|
|
179
|
+
setPluginOpacity(opacity, drawRender = false) {
|
|
179
180
|
if (!this.globe || !this.gl) {
|
|
180
181
|
console.warn("Globe or WebGL context is not initialized.");
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
184
|
opacityCheck(opacity);
|
|
184
185
|
this._opacity = opacity;
|
|
185
|
-
|
|
186
|
+
if (drawRender) {
|
|
187
|
+
this.globe.DrawRender();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
setElevationMode(mode) {
|
|
191
|
+
switch (mode) {
|
|
192
|
+
case "msl":
|
|
193
|
+
this._options.isMSL = true;
|
|
194
|
+
break;
|
|
195
|
+
case "agl":
|
|
196
|
+
this._options.isMSL = false;
|
|
197
|
+
break;
|
|
198
|
+
default:
|
|
199
|
+
throw new Error(`Unknown elevation mode: ${mode}`);
|
|
200
|
+
}
|
|
201
|
+
this._buildCircles();
|
|
202
|
+
this.globe?.DrawRender();
|
|
186
203
|
}
|
|
187
|
-
setDefaultColor(color) {
|
|
204
|
+
setDefaultColor(color, drawRender = false) {
|
|
188
205
|
if (!this.globe || !this.gl) {
|
|
189
206
|
console.warn("Globe or WebGL context is not initialized.");
|
|
190
207
|
return;
|
|
191
208
|
}
|
|
192
209
|
this._circleUBOHandler?.updateSingle("u_color", new Float32Array(color));
|
|
193
|
-
|
|
210
|
+
if (drawRender) {
|
|
211
|
+
this.globe.DrawRender();
|
|
212
|
+
}
|
|
194
213
|
}
|
|
195
214
|
// IMPLICIT METHODS
|
|
196
215
|
_buildCircles() {
|
|
@@ -215,7 +234,8 @@ export class CircleOnTerrainPlugin {
|
|
|
215
234
|
const data = [{
|
|
216
235
|
key: "",
|
|
217
236
|
longLatArr: [],
|
|
218
|
-
height: null
|
|
237
|
+
height: null,
|
|
238
|
+
msl: null
|
|
219
239
|
}];
|
|
220
240
|
const lookAtPosition = _cameraUniformBlock.getLookAtVector();
|
|
221
241
|
const cameraPosition = _cameraUniformBlock.getNormalizedCameraVector();
|
|
@@ -225,7 +245,7 @@ export class CircleOnTerrainPlugin {
|
|
|
225
245
|
const currentLOD = globe.api_GetCurrentLODWithDecimal();
|
|
226
246
|
const circlePointsLongLat = new Float64Array((CIRCLE_POINTS_COUNT) * 2);
|
|
227
247
|
for (const [key, circle] of this.circleMap.entries()) {
|
|
228
|
-
const [{ radius, center, height = null }, circleForAzimuthCalc] = circle;
|
|
248
|
+
const [{ radius, center, height = null, msl = null }, circleForAzimuthCalc] = circle;
|
|
229
249
|
const closestAzimuthAngle = CircleMethods.closestAzimuthAngle(circleForAzimuthCalc, cameraPosition);
|
|
230
250
|
const stregthLevel = defineStregthLevel(currentLOD, radius);
|
|
231
251
|
if (stregthLevel < 0) {
|
|
@@ -237,6 +257,7 @@ export class CircleOnTerrainPlugin {
|
|
|
237
257
|
data[0].key = key;
|
|
238
258
|
data[0].longLatArr = circlePointsLongLat;
|
|
239
259
|
data[0].height = height;
|
|
260
|
+
data[0].msl = msl;
|
|
240
261
|
// Add to buffer orchestrator
|
|
241
262
|
this.bufferOrchestrator.insertBulk(data, bufferManagerMap, ["position3d", "position2d"]);
|
|
242
263
|
}
|
|
@@ -252,7 +273,8 @@ export class CircleOnTerrainPlugin {
|
|
|
252
273
|
key: "",
|
|
253
274
|
longLatArr: [],
|
|
254
275
|
height: null,
|
|
255
|
-
color: [1, 1, 1, 1]
|
|
276
|
+
color: [1, 1, 1, 1],
|
|
277
|
+
msl: false
|
|
256
278
|
}];
|
|
257
279
|
// ensure buffer orchestrotrator have enough capacity
|
|
258
280
|
// all circles are build with even sampling, AttractionLevel = 0
|
|
@@ -262,12 +284,13 @@ export class CircleOnTerrainPlugin {
|
|
|
262
284
|
const circlePointsLongLat = new Float64Array((CIRCLE_POINTS_COUNT) * 2);
|
|
263
285
|
bufferOrchestrator.resetWithCapacity(bufferManagerMap, circleMap.size);
|
|
264
286
|
for (const [key, circle] of this.circleMap.entries()) {
|
|
265
|
-
const [{ radius, center, height = null, color = null }, _] = circle;
|
|
287
|
+
const [{ radius, center, height = null, color = null, msl = undefined }, _] = circle;
|
|
266
288
|
CircleCDF.globeFindPointByPolarHalfCircle(circlePointsLongLat, globe, center[0], center[1], radius, zeroRotation, templateAngles);
|
|
267
289
|
data[0].key = key;
|
|
268
290
|
data[0].longLatArr = circlePointsLongLat;
|
|
269
291
|
data[0].height = height;
|
|
270
|
-
data[0].color = color || this.
|
|
292
|
+
data[0].color = color || this._options.defaultColor;
|
|
293
|
+
data[0].msl = msl;
|
|
271
294
|
this.bufferOrchestrator.insertBulk(data, bufferManagerMap);
|
|
272
295
|
}
|
|
273
296
|
}
|
|
@@ -281,13 +304,14 @@ export class CircleOnTerrainPlugin {
|
|
|
281
304
|
console.warn(`CircleOnTerrainPlugin: Circle ${key} not found in circleMap.`);
|
|
282
305
|
continue;
|
|
283
306
|
}
|
|
284
|
-
const [{ radius, center, height = null, color = null }, _] = this.circleMap.get(key);
|
|
307
|
+
const [{ radius, center, height = null, color = null, msl = undefined }, _] = this.circleMap.get(key);
|
|
285
308
|
const circlePointsLongLat = new Float64Array((CIRCLE_POINTS_COUNT) * 2);
|
|
286
309
|
CircleCDF.globeFindPointByPolarHalfCircle(circlePointsLongLat, globe, center[0], center[1], radius, zeroRotation, templateAngles);
|
|
287
310
|
data[0].key = key;
|
|
288
311
|
data[0].longLatArr = circlePointsLongLat;
|
|
289
312
|
data[0].height = height;
|
|
290
|
-
data[0].color = color || this.
|
|
313
|
+
data[0].color = color || this._options.defaultColor;
|
|
314
|
+
data[0].msl = msl;
|
|
291
315
|
this.bufferOrchestrator.insertBulk(data, bufferManagerMap);
|
|
292
316
|
}
|
|
293
317
|
}
|
|
@@ -299,7 +323,8 @@ export class CircleOnTerrainPlugin {
|
|
|
299
323
|
!bufferManagerMap || !_vao || !_circleUBOHandler) {
|
|
300
324
|
return;
|
|
301
325
|
}
|
|
302
|
-
|
|
326
|
+
if (globe.api_IsScreenMoving())
|
|
327
|
+
this._buildCircles();
|
|
303
328
|
const drawOptions = {
|
|
304
329
|
drawRange: {
|
|
305
330
|
first: 0,
|