@openglobus/og 0.11.8 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/og.css +2 -0
- package/package.json +1 -1
- package/src/og/Globe.js +18 -6
- package/src/og/camera/Camera.js +70 -79
- package/src/og/camera/PlanetCamera.js +25 -30
- package/src/og/control/DebugInfo.js +2 -2
- package/src/og/control/EarthNavigation.js +26 -17
- package/src/og/control/MouseNavigation.js +11 -13
- package/src/og/control/MouseWheelZoomControl.js +5 -5
- package/src/og/control/Sun.js +3 -3
- package/src/og/entity/Entity.js +742 -742
- package/src/og/entity/GeoObjectHandler.js +102 -117
- package/src/og/entity/LabelHandler.js +2 -1
- package/src/og/layer/XYZ.js +20 -21
- package/src/og/math/Vec3.js +18 -2
- package/src/og/quadTree/Node.js +48 -93
- package/src/og/quadTree/quadTree.js +1 -1
- package/src/og/renderer/Renderer.js +3 -5
- package/src/og/scene/Planet.js +105 -118
- package/src/og/segment/Segment.js +57 -136
- package/src/og/shaders/drawnode.js +132 -221
- package/src/og/terrain/EmptyTerrain.js +3 -2
- package/src/og/terrain/GlobusTerrain.js +2 -0
- package/src/og/utils/Loader.js +1 -1
- package/src/og/utils/PlainSegmentWorker.js +0 -13
- package/src/og/webgl/Handler.js +13 -9
|
@@ -87,7 +87,7 @@ class GeoObjectHandler {
|
|
|
87
87
|
for (let i = 0, len = this._vertexArr.length; i < len; i++) {
|
|
88
88
|
this._vertexBuffer && h.gl.deleteBuffer(this._vertexBuffer[i]);
|
|
89
89
|
this._vertexArr[i] = makeArrayTyped(this._vertexArr[i]);
|
|
90
|
-
this._vertexBuffer[i] = h.createArrayBuffer(this._vertexArr[i], 3,
|
|
90
|
+
this._vertexBuffer[i] = h.createArrayBuffer(this._vertexArr[i], 3, this._vertexArr[i].length / 3);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -96,7 +96,7 @@ class GeoObjectHandler {
|
|
|
96
96
|
for (let i = 0, len = this._pitchRollArr.length; i < len; i++) {
|
|
97
97
|
this._pitchRollBuffer && h.gl.deleteBuffer(this._pitchRollBuffer[i]);
|
|
98
98
|
this._pitchRollArr[i] = makeArrayTyped(this._pitchRollArr[i]);
|
|
99
|
-
this._pitchRollBuffer[i] = h.createArrayBuffer(this._pitchRollArr[i], 2,
|
|
99
|
+
this._pitchRollBuffer[i] = h.createArrayBuffer(this._pitchRollArr[i], 2, this._pitchRollArr[i].length / 2);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -105,7 +105,7 @@ class GeoObjectHandler {
|
|
|
105
105
|
for (let i = 0, len = this._sizeArr.length; i < len; i++) {
|
|
106
106
|
this._sizeBuffer && h.gl.deleteBuffer(this._sizeBuffer[i]);
|
|
107
107
|
this._sizeArr[i] = makeArrayTyped(this._sizeArr[i]);
|
|
108
|
-
this._sizeBuffer[i] = h.createArrayBuffer(this._sizeArr[i], 1,
|
|
108
|
+
this._sizeBuffer[i] = h.createArrayBuffer(this._sizeArr[i], 1, this._sizeArr[i].length);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -114,14 +114,10 @@ class GeoObjectHandler {
|
|
|
114
114
|
for (let i = 0, len = this._positionHighArr.length; i < len; i++) {
|
|
115
115
|
this._positionHighBuffer && h.gl.deleteBuffer(this._positionHighBuffer[i]);
|
|
116
116
|
this._positionHighArr[i] = makeArrayTyped(this._positionHighArr[i]);
|
|
117
|
-
this._positionHighBuffer[i] = h.createArrayBuffer(this._positionHighArr[i], 3,
|
|
117
|
+
this._positionHighBuffer[i] = h.createArrayBuffer(this._positionHighArr[i], 3, this._positionHighArr[i].length / 3);
|
|
118
118
|
this._positionLowBuffer && h.gl.deleteBuffer(this._positionLowBuffer[i]);
|
|
119
119
|
this._positionLowArr[i] = makeArrayTyped(this._positionLowArr[i]);
|
|
120
|
-
this._positionLowBuffer[i] = h.createArrayBuffer(
|
|
121
|
-
this._positionLowArr[i],
|
|
122
|
-
3,
|
|
123
|
-
this._positionLowArr[i].length / 3
|
|
124
|
-
);
|
|
120
|
+
this._positionLowBuffer[i] = h.createArrayBuffer(this._positionLowArr[i], 3, this._positionLowArr[i].length / 3);
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
|
|
@@ -130,7 +126,7 @@ class GeoObjectHandler {
|
|
|
130
126
|
for (let i = 0, len = this._rgbaArr.length; i < len; i++) {
|
|
131
127
|
this._rgbaBuffer && h.gl.deleteBuffer(this._rgbaBuffer[i]);
|
|
132
128
|
this._rgbaArr[i] = makeArrayTyped(this._rgbaArr[i]);
|
|
133
|
-
this._rgbaBuffer[i] = h.createArrayBuffer(this._rgbaArr[i], 4,
|
|
129
|
+
this._rgbaBuffer[i] = h.createArrayBuffer(this._rgbaArr[i], 4, this._rgbaArr[i].length / 4);
|
|
134
130
|
}
|
|
135
131
|
}
|
|
136
132
|
|
|
@@ -139,7 +135,7 @@ class GeoObjectHandler {
|
|
|
139
135
|
for (let i = 0, len = this._directionArr.length; i < len; i++) {
|
|
140
136
|
this._directionBuffer && h.gl.deleteBuffer(this._directionBuffer[i]);
|
|
141
137
|
this._directionArr[i] = makeArrayTyped(this._directionArr[i]);
|
|
142
|
-
this._directionBuffer[i] = h.createArrayBuffer(this._directionArr[i], 3,
|
|
138
|
+
this._directionBuffer[i] = h.createArrayBuffer(this._directionArr[i], 3, this._directionArr[i].length / 3);
|
|
143
139
|
}
|
|
144
140
|
}
|
|
145
141
|
|
|
@@ -148,7 +144,7 @@ class GeoObjectHandler {
|
|
|
148
144
|
for (let i = 0, len = this._normalsArr.length; i < len; i++) {
|
|
149
145
|
this._normalsBuffer && h.gl.deleteBuffer(this._normalsBuffer[i]);
|
|
150
146
|
this._normalsArr[i] = makeArrayTyped(this._normalsArr[i]);
|
|
151
|
-
this._normalsBuffer[i] = h.createArrayBuffer(this._normalsArr[i], 3,
|
|
147
|
+
this._normalsBuffer[i] = h.createArrayBuffer(this._normalsArr[i], 3, this._normalsArr[i].length / 3);
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
150
|
|
|
@@ -157,11 +153,7 @@ class GeoObjectHandler {
|
|
|
157
153
|
for (let i = 0, len = this._indicesArr.length; i < len; i++) {
|
|
158
154
|
this._indicesBuffer && h.gl.deleteBuffer(this._indicesBuffer[i]);
|
|
159
155
|
this._indicesArr[i] = makeArrayTyped(this._indicesArr[i], Uint16Array);
|
|
160
|
-
this._indicesBuffer[i] = h.createElementArrayBuffer(
|
|
161
|
-
this._indicesArr[i],
|
|
162
|
-
1,
|
|
163
|
-
this._indicesArr[i].length
|
|
164
|
-
);
|
|
156
|
+
this._indicesBuffer[i] = h.createElementArrayBuffer(this._indicesArr[i], 1, this._indicesArr[i].length);
|
|
165
157
|
}
|
|
166
158
|
}
|
|
167
159
|
|
|
@@ -170,7 +162,7 @@ class GeoObjectHandler {
|
|
|
170
162
|
for (let i = 0, len = this._pickingColorArr.length; i < len; i++) {
|
|
171
163
|
this._pickingColorBuffer && h.gl.deleteBuffer(this._pickingColorBuffer[i]);
|
|
172
164
|
this._pickingColorArr[i] = makeArrayTyped(this._pickingColorArr[i]);
|
|
173
|
-
this._pickingColorBuffer[i] = h.createArrayBuffer(this._pickingColorArr[i], 3,
|
|
165
|
+
this._pickingColorBuffer[i] = h.createArrayBuffer(this._pickingColorArr[i], 3, this._pickingColorArr[i].length / 3);
|
|
174
166
|
}
|
|
175
167
|
}
|
|
176
168
|
|
|
@@ -215,14 +207,15 @@ class GeoObjectHandler {
|
|
|
215
207
|
if (!alreadyAdded) {
|
|
216
208
|
this._instancedTags.set(tag, {
|
|
217
209
|
iCounts: 1,
|
|
210
|
+
maxIndex: Math.max(...geoObject._indices),
|
|
218
211
|
index: this._instancedTags.size
|
|
219
212
|
});
|
|
220
213
|
} else {
|
|
221
214
|
const prevState = this._instancedTags.get(tag),
|
|
222
215
|
nextCount = prevState.iCounts + 1;
|
|
223
216
|
this._instancedTags.set(tag, {
|
|
224
|
-
|
|
225
|
-
|
|
217
|
+
...prevState,
|
|
218
|
+
iCounts: nextCount
|
|
226
219
|
});
|
|
227
220
|
}
|
|
228
221
|
const tagData = this._instancedTags.get(tag),
|
|
@@ -233,7 +226,8 @@ class GeoObjectHandler {
|
|
|
233
226
|
*/
|
|
234
227
|
geoObject._tagIndex = tagData.iCounts - 1;
|
|
235
228
|
if (geoObject._visibility) {
|
|
236
|
-
if (!
|
|
229
|
+
if (!this._vertexArr[ti] || this._vertexArr[ti].length !== geoObject._vertices.length) {
|
|
230
|
+
|
|
237
231
|
this._vertexArr[ti] = concatArrays(
|
|
238
232
|
this._vertexArr[ti],
|
|
239
233
|
setParametersToArray(
|
|
@@ -306,8 +300,6 @@ class GeoObjectHandler {
|
|
|
306
300
|
setParametersToArray([], 0, itemSize, itemSize, x, y, z, w)
|
|
307
301
|
);
|
|
308
302
|
|
|
309
|
-
this._indicesArr[ti] = concatArrays(this._indicesArr[ti], geoObject._indices);
|
|
310
|
-
|
|
311
303
|
x = geoObject._pitch;
|
|
312
304
|
y = geoObject._roll;
|
|
313
305
|
|
|
@@ -324,7 +316,7 @@ class GeoObjectHandler {
|
|
|
324
316
|
this._sizeArr[ti],
|
|
325
317
|
setParametersToArray([], 0, itemSize, itemSize, geoObject.scale)
|
|
326
318
|
);
|
|
327
|
-
this.
|
|
319
|
+
this._addIndices(geoObject);
|
|
328
320
|
}
|
|
329
321
|
|
|
330
322
|
_displayPASS() {
|
|
@@ -357,47 +349,19 @@ class GeoObjectHandler {
|
|
|
357
349
|
ti = tagData.index;
|
|
358
350
|
|
|
359
351
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._normalsBuffer[ti]);
|
|
360
|
-
gl.vertexAttribPointer(
|
|
361
|
-
a.aVertexNormal,
|
|
362
|
-
this._normalsBuffer[ti].itemSize,
|
|
363
|
-
gl.FLOAT,
|
|
364
|
-
false,
|
|
365
|
-
0,
|
|
366
|
-
0
|
|
367
|
-
);
|
|
352
|
+
gl.vertexAttribPointer(a.aVertexNormal, this._normalsBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
368
353
|
|
|
369
354
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer[ti]);
|
|
370
|
-
gl.vertexAttribPointer(
|
|
371
|
-
a.aVertexPosition,
|
|
372
|
-
this._vertexBuffer[ti].itemSize,
|
|
373
|
-
gl.FLOAT,
|
|
374
|
-
false,
|
|
375
|
-
0,
|
|
376
|
-
0
|
|
377
|
-
);
|
|
355
|
+
gl.vertexAttribPointer(a.aVertexPosition, this._vertexBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
378
356
|
|
|
379
357
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._directionBuffer[ti]);
|
|
380
|
-
gl.vertexAttribPointer(
|
|
381
|
-
a.aDirection,
|
|
382
|
-
this._directionBuffer[ti].itemSize,
|
|
383
|
-
gl.FLOAT,
|
|
384
|
-
false,
|
|
385
|
-
0,
|
|
386
|
-
0
|
|
387
|
-
);
|
|
358
|
+
gl.vertexAttribPointer(a.aDirection, this._directionBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
388
359
|
|
|
389
360
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._sizeBuffer[ti]);
|
|
390
361
|
gl.vertexAttribPointer(a.aScale, this._sizeBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
391
362
|
|
|
392
363
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._pitchRollBuffer[ti]);
|
|
393
|
-
gl.vertexAttribPointer(
|
|
394
|
-
a.aPitchRoll,
|
|
395
|
-
this._pitchRollBuffer[ti].itemSize,
|
|
396
|
-
gl.FLOAT,
|
|
397
|
-
false,
|
|
398
|
-
0,
|
|
399
|
-
0
|
|
400
|
-
);
|
|
364
|
+
gl.vertexAttribPointer(a.aPitchRoll, this._pitchRollBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
401
365
|
|
|
402
366
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._rgbaBuffer[ti]);
|
|
403
367
|
gl.vertexAttribPointer(a.aColor, this._rgbaBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
@@ -561,7 +525,7 @@ class GeoObjectHandler {
|
|
|
561
525
|
gl.disable(gl.CULL_FACE);
|
|
562
526
|
}
|
|
563
527
|
|
|
564
|
-
_recalculateIndices() {
|
|
528
|
+
_recalculateIndices(startIndex) {
|
|
565
529
|
const allIndices = this._indicesArr,
|
|
566
530
|
goArr = this._geoObjects,
|
|
567
531
|
maxIndicesByTags = new Array(this._instancedTags.size).fill(0);
|
|
@@ -590,10 +554,62 @@ class GeoObjectHandler {
|
|
|
590
554
|
}
|
|
591
555
|
}
|
|
592
556
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
557
|
+
_addIndices(g) {
|
|
558
|
+
let i = g._handlerIndex;
|
|
559
|
+
const allIndices = this._indicesArr,
|
|
560
|
+
gArr = this._geoObjects,
|
|
561
|
+
iLen = g._indices.length,
|
|
562
|
+
tagData = this._instancedTags.get(g.tag),
|
|
563
|
+
maxIndex = tagData.maxIndex,
|
|
564
|
+
ti = tagData.index;
|
|
565
|
+
|
|
566
|
+
allIndices[ti] = concatArrays(allIndices[ti], g._indices);
|
|
567
|
+
|
|
568
|
+
while (gArr[i]) {
|
|
569
|
+
const g = gArr[i];
|
|
570
|
+
|
|
571
|
+
if (g._tagIndex > 0) {
|
|
572
|
+
setParametersToArray(allIndices[ti], g._tagIndex, iLen, iLen, ...g._indices.reduce((acc, cur) => {
|
|
573
|
+
acc.push(cur + ((maxIndex + 1) * g._tagIndex));
|
|
574
|
+
return acc;
|
|
575
|
+
}, []));
|
|
576
|
+
}
|
|
577
|
+
i++;
|
|
578
|
+
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
_removeIndices(geoObject) {
|
|
584
|
+
const allIndices = this._indicesArr,
|
|
585
|
+
gArr = this._geoObjects,
|
|
586
|
+
iLen = geoObject._indices.length,
|
|
587
|
+
tagData = this._instancedTags.get(geoObject.tag),
|
|
588
|
+
maxIndex = tagData.maxIndex,
|
|
589
|
+
ti = tagData.index,
|
|
590
|
+
count = tagData.iCounts;
|
|
591
|
+
|
|
592
|
+
let i = geoObject._handlerIndex;
|
|
593
|
+
|
|
594
|
+
this._indicesArr[ti] = spliceArray(this._indicesArr[ti], geoObject._tagIndex * geoObject._indicesCount, geoObject._indicesCount);
|
|
595
|
+
|
|
596
|
+
while (gArr[i]) {
|
|
597
|
+
if (geoObject.tag === gArr[i].tag) {
|
|
598
|
+
if (count !== 0) {
|
|
599
|
+
const startI = (gArr[i]._tagIndex - 1) * iLen;
|
|
600
|
+
let stopI = startI + geoObject._indicesCount;
|
|
601
|
+
while (stopI > startI) {
|
|
602
|
+
this._indicesArr[ti][stopI - 1] = allIndices[ti][stopI - 1] - maxIndex - 1;
|
|
603
|
+
stopI--;
|
|
604
|
+
}
|
|
605
|
+
} else {
|
|
606
|
+
allIndices[ti] = geoObject._indices;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
i++;
|
|
610
|
+
|
|
611
|
+
}
|
|
612
|
+
|
|
597
613
|
}
|
|
598
614
|
|
|
599
615
|
setDirectionArr(index, direction) {
|
|
@@ -606,15 +622,7 @@ class GeoObjectHandler {
|
|
|
606
622
|
length = itemSize;
|
|
607
623
|
}
|
|
608
624
|
|
|
609
|
-
setParametersToArray(
|
|
610
|
-
this._directionArr[ti],
|
|
611
|
-
ob._tagIndex,
|
|
612
|
-
length,
|
|
613
|
-
itemSize,
|
|
614
|
-
direction.x,
|
|
615
|
-
direction.y,
|
|
616
|
-
direction.z
|
|
617
|
-
);
|
|
625
|
+
setParametersToArray(this._directionArr[ti], ob._tagIndex, length, itemSize, direction.x, direction.y, direction.z);
|
|
618
626
|
this._changedBuffers[DIRECTION_BUFFER] = true;
|
|
619
627
|
}
|
|
620
628
|
|
|
@@ -639,26 +647,10 @@ class GeoObjectHandler {
|
|
|
639
647
|
length = itemSize;
|
|
640
648
|
}
|
|
641
649
|
|
|
642
|
-
setParametersToArray(
|
|
643
|
-
this._positionHighArr[ti],
|
|
644
|
-
ob._tagIndex,
|
|
645
|
-
length,
|
|
646
|
-
itemSize,
|
|
647
|
-
positionHigh.x,
|
|
648
|
-
positionHigh.y,
|
|
649
|
-
positionHigh.z
|
|
650
|
-
);
|
|
650
|
+
setParametersToArray(this._positionHighArr[ti], ob._tagIndex, length, itemSize, positionHigh.x, positionHigh.y, positionHigh.z);
|
|
651
651
|
|
|
652
652
|
// Low
|
|
653
|
-
setParametersToArray(
|
|
654
|
-
this._positionLowArr[ti],
|
|
655
|
-
ob._tagIndex,
|
|
656
|
-
length,
|
|
657
|
-
itemSize,
|
|
658
|
-
positionLow.x,
|
|
659
|
-
positionLow.y,
|
|
660
|
-
positionLow.z
|
|
661
|
-
);
|
|
653
|
+
setParametersToArray(this._positionLowArr[ti], ob._tagIndex, length, itemSize, positionLow.x, positionLow.y, positionLow.z);
|
|
662
654
|
|
|
663
655
|
this._changedBuffers[POSITION_BUFFER] = true;
|
|
664
656
|
}
|
|
@@ -673,16 +665,7 @@ class GeoObjectHandler {
|
|
|
673
665
|
length = itemSize;
|
|
674
666
|
}
|
|
675
667
|
|
|
676
|
-
setParametersToArray(
|
|
677
|
-
this._rgbaArr[ti],
|
|
678
|
-
ob._tagIndex,
|
|
679
|
-
length,
|
|
680
|
-
itemSize,
|
|
681
|
-
rgba.x,
|
|
682
|
-
rgba.y,
|
|
683
|
-
rgba.z,
|
|
684
|
-
rgba.w
|
|
685
|
-
);
|
|
668
|
+
setParametersToArray(this._rgbaArr[ti], ob._tagIndex, length, itemSize, rgba.x, rgba.y, rgba.z, rgba.w);
|
|
686
669
|
|
|
687
670
|
this._changedBuffers[RGBA_BUFFER] = true;
|
|
688
671
|
}
|
|
@@ -771,16 +754,16 @@ class GeoObjectHandler {
|
|
|
771
754
|
this._indicesArr = null;
|
|
772
755
|
this._pickingColorArr = null;
|
|
773
756
|
|
|
774
|
-
this._pitchRollArr = new Float32Array();
|
|
775
|
-
this._sizeArr = new Float32Array();
|
|
776
|
-
this._vertexArr = new Float32Array();
|
|
777
|
-
this._positionHighArr = new Float32Array();
|
|
778
|
-
this._positionLowArr = new Float32Array();
|
|
779
|
-
this._rgbaArr = new Float32Array();
|
|
780
|
-
this._directionArr = new Float32Array();
|
|
781
|
-
this._normalsArr = new Float32Array();
|
|
782
|
-
this._indicesArr = new Uint16Array();
|
|
783
|
-
this._pickingColorArr = new Float32Array();
|
|
757
|
+
this._pitchRollArr = [new Float32Array()];
|
|
758
|
+
this._sizeArr = [new Float32Array()];
|
|
759
|
+
this._vertexArr = [new Float32Array()];
|
|
760
|
+
this._positionHighArr = [new Float32Array()];
|
|
761
|
+
this._positionLowArr = [new Float32Array()];
|
|
762
|
+
this._rgbaArr = [new Float32Array()];
|
|
763
|
+
this._directionArr = [new Float32Array()];
|
|
764
|
+
this._normalsArr = [new Float32Array()];
|
|
765
|
+
this._indicesArr = [new Uint16Array()];
|
|
766
|
+
this._pickingColorArr = [new Float32Array()];
|
|
784
767
|
|
|
785
768
|
this._removeGeoObjects();
|
|
786
769
|
this._deleteBuffers();
|
|
@@ -866,19 +849,20 @@ class GeoObjectHandler {
|
|
|
866
849
|
const gi = geoObject._handlerIndex,
|
|
867
850
|
tag = geoObject.tag,
|
|
868
851
|
ti = this.getTagIndexByObjectIndex(gi),
|
|
869
|
-
prevState = this._instancedTags.get(tag)
|
|
852
|
+
prevState = this._instancedTags.get(tag),
|
|
853
|
+
iCount = prevState.iCounts - 1;
|
|
870
854
|
|
|
871
855
|
this._instancedTags.set(tag, {
|
|
872
|
-
|
|
873
|
-
|
|
856
|
+
...prevState,
|
|
857
|
+
iCounts: iCount
|
|
874
858
|
});
|
|
875
859
|
|
|
876
860
|
this._geoObjects.splice(gi, 1);
|
|
877
861
|
|
|
878
|
-
let i =
|
|
862
|
+
let i = geoObject._tagIndex * 4;
|
|
879
863
|
this._rgbaArr[ti] = spliceArray(this._rgbaArr[ti], i, 4);
|
|
880
864
|
|
|
881
|
-
i =
|
|
865
|
+
i = geoObject._tagIndex * 3;
|
|
882
866
|
if (prevState.iCounts <= 1) {
|
|
883
867
|
this._vertexArr[ti] = spliceArray(this._vertexArr[ti], 0, geoObject._verticesCount * 3);
|
|
884
868
|
this._normalsArr[ti] = spliceArray(
|
|
@@ -892,14 +876,15 @@ class GeoObjectHandler {
|
|
|
892
876
|
this._directionArr[ti] = spliceArray(this._directionArr[ti], i, 3);
|
|
893
877
|
this._pickingColorArr[ti] = spliceArray(this._pickingColorArr[ti], i, 3);
|
|
894
878
|
|
|
895
|
-
i =
|
|
879
|
+
i = geoObject._tagIndex * 2;
|
|
896
880
|
this._pitchRollArr[ti] = spliceArray(this._pitchRollArr[ti], i, 2);
|
|
897
|
-
|
|
898
|
-
i = gi * 1;
|
|
881
|
+
i = geoObject._tagIndex;
|
|
899
882
|
this._sizeArr[ti] = spliceArray(this._sizeArr[ti], i, 1);
|
|
900
883
|
|
|
884
|
+
this._removeIndices(geoObject);
|
|
885
|
+
|
|
901
886
|
this._reindexGeoObjects(gi, tag);
|
|
902
|
-
|
|
887
|
+
|
|
903
888
|
this.refresh();
|
|
904
889
|
|
|
905
890
|
geoObject._handlerIndex = -1;
|
package/src/og/layer/XYZ.js
CHANGED
|
@@ -237,9 +237,6 @@ class XYZ extends Layer {
|
|
|
237
237
|
if (material.isReady) {
|
|
238
238
|
return material.texOffset;
|
|
239
239
|
} else {
|
|
240
|
-
// if (material.loadingAttempts > 20) {
|
|
241
|
-
// debugger;
|
|
242
|
-
// }
|
|
243
240
|
|
|
244
241
|
let segment = material.segment,
|
|
245
242
|
pn = segment.node,
|
|
@@ -257,25 +254,27 @@ class XYZ extends Layer {
|
|
|
257
254
|
}
|
|
258
255
|
|
|
259
256
|
let maxNativeZoom = material.layer.maxNativeZoom;
|
|
260
|
-
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
let pn = segment.node;
|
|
267
|
-
while (pn.segment.tileZoom > material.layer.maxNativeZoom) {
|
|
268
|
-
pn = pn.parentNode;
|
|
269
|
-
}
|
|
270
|
-
let pnm = pn.segment.materials[material.layer._id];
|
|
271
|
-
if (pnm) {
|
|
272
|
-
!pnm.isLoading && !pnm.isReady && this.loadMaterial(pnm, true);
|
|
257
|
+
|
|
258
|
+
if (segment.loadTile) {
|
|
259
|
+
if (pn.segment.tileZoom === maxNativeZoom) {
|
|
260
|
+
material.textureNotExists();
|
|
261
|
+
} else if (material.segment.tileZoom <= maxNativeZoom) {
|
|
262
|
+
!material.isLoading && !material.isReady && this.loadMaterial(material);
|
|
273
263
|
} else {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
264
|
+
let pn = segment.node;
|
|
265
|
+
while (pn.segment.tileZoom > material.layer.maxNativeZoom) {
|
|
266
|
+
pn = pn.parentNode;
|
|
267
|
+
}
|
|
268
|
+
let pnm = pn.segment.materials[material.layer._id];
|
|
269
|
+
if (pnm) {
|
|
270
|
+
!pnm.isLoading && !pnm.isReady && this.loadMaterial(pnm, true);
|
|
271
|
+
} else {
|
|
272
|
+
pnm = pn.segment.materials[material.layer._id] = material.layer.createMaterial(
|
|
273
|
+
pn.segment
|
|
274
|
+
);
|
|
275
|
+
this.loadMaterial(pnm, true);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
if (notEmpty) {
|
package/src/og/math/Vec3.js
CHANGED
|
@@ -699,8 +699,24 @@ export class Vec3 {
|
|
|
699
699
|
* @param {Vec3} point3 - Distant point.
|
|
700
700
|
* @returns {number} -
|
|
701
701
|
*/
|
|
702
|
-
distance(point3) {
|
|
703
|
-
|
|
702
|
+
distance(point3) {
|
|
703
|
+
let dx = this.x - point3.x,
|
|
704
|
+
dy = this.y - point3.y,
|
|
705
|
+
dz = this.z - point3.z;
|
|
706
|
+
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Gets square distance to point.
|
|
711
|
+
* @public
|
|
712
|
+
* @param {Vec3} point3 - Distant point.
|
|
713
|
+
* @returns {number} -
|
|
714
|
+
*/
|
|
715
|
+
distance2(point3) {
|
|
716
|
+
let dx = this.x - point3.x,
|
|
717
|
+
dy = this.y - point3.y,
|
|
718
|
+
dz = this.z - point3.z;
|
|
719
|
+
return dx * dx + dy * dy + dz * dz;
|
|
704
720
|
}
|
|
705
721
|
|
|
706
722
|
/**
|