@openglobus/og 0.18.5 → 0.19.1
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 +17 -69
- package/css/og.css +59 -44
- package/lib/@openglobus/og.css +1 -1
- 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/Globe.d.ts +2 -0
- package/lib/js/Globe.js +3 -1
- package/lib/js/control/DebugInfo.js +5 -0
- package/lib/js/control/LayerSwitcher.d.ts +18 -3
- package/lib/js/control/LayerSwitcher.js +111 -11
- package/lib/js/control/MouseNavigation.d.ts +2 -0
- package/lib/js/control/MouseNavigation.js +15 -15
- package/lib/js/control/elevationProfile/ElevationProfile.js +3 -1
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +7 -7
- package/lib/js/control/heightRuler/HeightRulerScene.js +1 -1
- package/lib/js/control/ruler/RulerScene.js +3 -3
- package/lib/js/control/selection/SelectionScene.js +2 -2
- package/lib/js/entity/Entity.js +5 -1
- package/lib/js/layer/Layer.d.ts +18 -4
- package/lib/js/layer/Layer.js +25 -4
- package/lib/js/layer/XYZ.d.ts +0 -1
- package/lib/js/quadTree/Node.d.ts +21 -3
- package/lib/js/quadTree/Node.js +161 -62
- package/lib/js/renderer/Renderer.js +19 -16
- package/lib/js/renderer/RendererEvents.d.ts +1 -0
- package/lib/js/renderer/RendererEvents.js +5 -0
- package/lib/js/scene/Planet.d.ts +29 -4
- package/lib/js/scene/Planet.js +207 -85
- package/lib/js/segment/Segment.d.ts +7 -1
- package/lib/js/segment/Segment.js +57 -12
- package/lib/js/shaders/drawnode.js +21 -2
- package/lib/js/shaders/geoObject.js +30 -24
- package/lib/js/terrain/GlobusTerrain.js +1 -1
- package/lib/js/utils/shared.d.ts +1 -0
- package/lib/js/utils/shared.js +1 -0
- package/package.json +2 -2
package/lib/js/quadTree/Node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Extent } from "../Extent";
|
|
2
2
|
import { EPSG3857 } from "../proj/EPSG3857";
|
|
3
3
|
import { EPSG4326 } from "../proj/EPSG4326";
|
|
4
|
-
import { getMatrixSubArray32, getMatrixSubArray64, getMatrixSubArrayBoundsExt } from "../utils/shared";
|
|
4
|
+
import { binaryInsert, getMatrixSubArray32, getMatrixSubArray64, getMatrixSubArrayBoundsExt } from "../utils/shared";
|
|
5
5
|
import { LonLat } from "../LonLat";
|
|
6
6
|
import { MAX, MIN } from "../math";
|
|
7
7
|
import { MAX_LAT } from "../mercator";
|
|
@@ -39,15 +39,18 @@ class Node {
|
|
|
39
39
|
this.partId = partId;
|
|
40
40
|
this.nodeId = partId + id;
|
|
41
41
|
this.state = null;
|
|
42
|
+
this.prevState = null;
|
|
42
43
|
this.appliedTerrainNodeId = -1;
|
|
43
44
|
this.sideSizeLog2 = [0, 0, 0, 0];
|
|
44
45
|
this.ready = false;
|
|
45
46
|
this.neighbors = [[], [], [], []];
|
|
46
47
|
this.equalizedSideWithNodeId = [this.nodeId, this.nodeId, this.nodeId, this.nodeId];
|
|
48
|
+
// @todo: this.nodes = null;
|
|
47
49
|
this.nodes = [];
|
|
48
50
|
this.segment = new SegmentPrototype(this, planet, tileZoom, extent);
|
|
49
51
|
this._cameraInside = false;
|
|
50
52
|
this.inFrustum = 0;
|
|
53
|
+
this._fadingNodes = [];
|
|
51
54
|
this.createBounds();
|
|
52
55
|
}
|
|
53
56
|
createChildrenNodes() {
|
|
@@ -133,23 +136,28 @@ class Node {
|
|
|
133
136
|
// public isBrother(node: Node): boolean {
|
|
134
137
|
// return !(this.parentNode || node.parentNode) || (this.parentNode!.nodeId === node.parentNode!.nodeId);
|
|
135
138
|
// }
|
|
136
|
-
|
|
139
|
+
traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode) {
|
|
140
|
+
if (!this.ready) {
|
|
141
|
+
this.createChildrenNodes();
|
|
142
|
+
}
|
|
143
|
+
let n = this.nodes;
|
|
144
|
+
n[0].renderTree(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
145
|
+
n[1].renderTree(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
146
|
+
n[2].renderTree(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
147
|
+
n[3].renderTree(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
148
|
+
}
|
|
149
|
+
renderTree(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode) {
|
|
137
150
|
if (this.planet._renderedNodes.length >= MAX_RENDERED_NODES) {
|
|
138
151
|
return;
|
|
139
152
|
}
|
|
153
|
+
if (!maxZoom || zoomPassNode && this.segment.tileZoom > zoomPassNode.segment.tileZoom) {
|
|
154
|
+
this.prevState = this.state;
|
|
155
|
+
}
|
|
140
156
|
this.state = WALKTHROUGH;
|
|
141
|
-
|
|
142
|
-
this.
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
// @ts-ignore
|
|
146
|
-
this.neighbors[2] = null;
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
this.neighbors[3] = null;
|
|
149
|
-
this.neighbors[0] = [];
|
|
150
|
-
this.neighbors[1] = [];
|
|
151
|
-
this.neighbors[2] = [];
|
|
152
|
-
this.neighbors[3] = [];
|
|
157
|
+
this.clearNeighbors();
|
|
158
|
+
// for (let i = 0; i < this._fadingNodes.length; i++) {
|
|
159
|
+
// this._fadingNodes[i].neighbors && this._fadingNodes[i].clearNeighbors();
|
|
160
|
+
// }
|
|
153
161
|
let seg = this.segment, planet = this.planet;
|
|
154
162
|
this._cameraInside = false;
|
|
155
163
|
// Search a node which the camera is flying over.
|
|
@@ -208,7 +216,7 @@ class Node {
|
|
|
208
216
|
seg._collectVisibleNodes();
|
|
209
217
|
}
|
|
210
218
|
if (seg.tileZoom < 2) {
|
|
211
|
-
this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
219
|
+
this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
212
220
|
}
|
|
213
221
|
else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize || maxZoom && ((seg.tileZoom === maxZoom) || !altVis))) {
|
|
214
222
|
if (altVis) {
|
|
@@ -220,7 +228,7 @@ class Node {
|
|
|
220
228
|
}
|
|
221
229
|
}
|
|
222
230
|
else if (seg.terrainReady && seg.checkZoom() && (!maxZoom || cam.projectedSize(seg.bsphere.center, seg.bsphere.radius) > this.planet._maxLodSize)) {
|
|
223
|
-
this.traverseNodes(cam, maxZoom, seg, stopLoading);
|
|
231
|
+
this.traverseNodes(cam, maxZoom, seg, stopLoading, zoomPassNode);
|
|
224
232
|
}
|
|
225
233
|
else if (altVis) {
|
|
226
234
|
seg.passReady = maxZoom ? seg.terrainReady : false;
|
|
@@ -234,16 +242,6 @@ class Node {
|
|
|
234
242
|
this.state = NOTRENDERING;
|
|
235
243
|
}
|
|
236
244
|
}
|
|
237
|
-
traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading) {
|
|
238
|
-
if (!this.ready) {
|
|
239
|
-
this.createChildrenNodes();
|
|
240
|
-
}
|
|
241
|
-
let n = this.nodes;
|
|
242
|
-
n[0].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
243
|
-
n[1].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
244
|
-
n[2].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
245
|
-
n[3].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
246
|
-
}
|
|
247
245
|
renderNode(inFrustum, onlyTerrain, terrainReadySegment, stopLoading) {
|
|
248
246
|
let seg = this.segment;
|
|
249
247
|
// Create and load terrain data
|
|
@@ -278,39 +276,107 @@ class Node {
|
|
|
278
276
|
// Finally this node proceeds to rendering.
|
|
279
277
|
this.addToRender(inFrustum);
|
|
280
278
|
}
|
|
279
|
+
childrenPrevStateEquals(state) {
|
|
280
|
+
let n = this.nodes;
|
|
281
|
+
return n.length === 4 && n[0].prevState === state && n[1].prevState === state && n[2].prevState === state && n[3].prevState === state;
|
|
282
|
+
}
|
|
283
|
+
isFading() {
|
|
284
|
+
let n = this.nodes;
|
|
285
|
+
return this.state === WALKTHROUGH && this.segment._transitionOpacity > 0.0 && n.length === 4 && (n[0].state === RENDERING && n[1].state === RENDERING && n[2].state === RENDERING && n[3].state === RENDERING);
|
|
286
|
+
}
|
|
287
|
+
_collectFadingNodes() {
|
|
288
|
+
if (this.segment.tileZoom < 3) {
|
|
289
|
+
this.segment._transitionOpacity = 1.0;
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
// Light up the node
|
|
293
|
+
if (this.prevState !== RENDERING) {
|
|
294
|
+
// means that the node is lighting up
|
|
295
|
+
this.segment._transitionOpacity = 0.0;
|
|
296
|
+
// store fading nodes, could be a parent or children nodes
|
|
297
|
+
this._fadingNodes = [];
|
|
298
|
+
let timestamp = window.performance.now();
|
|
299
|
+
this.segment._transitionTimestamp = timestamp;
|
|
300
|
+
if (this.parentNode) {
|
|
301
|
+
// Parent was visible the last frame, make the parent fading
|
|
302
|
+
if (this.parentNode.prevState === RENDERING) {
|
|
303
|
+
let pn = this.parentNode.parentNode;
|
|
304
|
+
while (pn) {
|
|
305
|
+
if (pn.isFading()) {
|
|
306
|
+
for (let i = 0; i < pn.nodes.length; i++) {
|
|
307
|
+
pn.nodes[i].segment._transitionOpacity = 1.0;
|
|
308
|
+
pn.nodes[i]._fadingNodes = [];
|
|
309
|
+
}
|
|
310
|
+
pn.segment._transitionOpacity = 0.0;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
pn = pn.parentNode;
|
|
314
|
+
}
|
|
315
|
+
// not sure it's necessary here
|
|
316
|
+
//this.parentNode.whileTerrainLoading();
|
|
317
|
+
this._fadingNodes.push(this.parentNode);
|
|
318
|
+
this.parentNode.segment._transitionOpacity = 2.0;
|
|
319
|
+
this.parentNode.segment._transitionTimestamp = timestamp;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
// Check if the children were visible last frame, and make them fading
|
|
323
|
+
if (this.segment.childrenInitialized() && this.childrenPrevStateEquals(RENDERING)) {
|
|
324
|
+
for (let i = 0; i < this.nodes.length; i++) {
|
|
325
|
+
let ni = this.nodes[i];
|
|
326
|
+
// not sure it's necessary here
|
|
327
|
+
//ni.whileTerrainLoading();
|
|
328
|
+
this._fadingNodes.push(ni);
|
|
329
|
+
ni.segment._transitionOpacity = 2.0;
|
|
330
|
+
ni.segment._transitionTimestamp = timestamp;
|
|
331
|
+
ni.prevState = ni.state;
|
|
332
|
+
ni.state = NOTRENDERING;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
clearNeighbors() {
|
|
340
|
+
//this.sideSizeLog2[0] = this.sideSizeLog2[1] = this.sideSizeLog2[2] = this.sideSizeLog2[3] = Math.log2(this.segment.gridSize);
|
|
341
|
+
// @ts-ignore
|
|
342
|
+
this.neighbors[0] = this.neighbors[1] = this.neighbors[2] = this.neighbors[3] = null;
|
|
343
|
+
this.neighbors[0] = [];
|
|
344
|
+
this.neighbors[1] = [];
|
|
345
|
+
this.neighbors[2] = [];
|
|
346
|
+
this.neighbors[3] = [];
|
|
347
|
+
}
|
|
348
|
+
_refreshTransitionOpacity() {
|
|
349
|
+
if (this._fadingNodes.length === 0) {
|
|
350
|
+
this.segment._transitionOpacity = 1.0;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
if (this._fadingNodes.length === 4 && !this.childrenPrevStateEquals(RENDERING)) {
|
|
354
|
+
this.segment._transitionOpacity = 1.0;
|
|
355
|
+
this._fadingNodes = [];
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
this.segment.increaseTransitionOpacity();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
281
362
|
/**
|
|
282
|
-
*
|
|
363
|
+
* Picking up current node to render processing.
|
|
283
364
|
* @public
|
|
284
365
|
*/
|
|
285
366
|
addToRender(inFrustum) {
|
|
286
367
|
this.state = RENDERING;
|
|
287
368
|
let nodes = this.planet._renderedNodes;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if (ld > 1) {
|
|
299
|
-
cs_size = Math.ceil(ap.gridSize / ld);
|
|
300
|
-
opcs_size = bp.gridSize;
|
|
301
|
-
}
|
|
302
|
-
else if (ld < 1) {
|
|
303
|
-
cs_size = ap.gridSize;
|
|
304
|
-
opcs_size = Math.ceil(bp.gridSize * ld);
|
|
305
|
-
}
|
|
306
|
-
this.sideSizeLog2[cs] = Math.log2(cs_size);
|
|
307
|
-
ni.sideSizeLog2[opcs] = Math.log2(opcs_size);
|
|
308
|
-
}
|
|
309
|
-
this.neighbors[cs].push(ni);
|
|
310
|
-
ni.neighbors[opcs].push(this);
|
|
311
|
-
}
|
|
369
|
+
//@ts-ignore
|
|
370
|
+
if (!this.planet._transitionOpacityEnabled) {
|
|
371
|
+
this.getRenderedNodesNeighbors(nodes);
|
|
372
|
+
nodes.push(this);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
//@todo: check if it's possible to get rid of the sorting when using breadth traverse tree
|
|
376
|
+
binaryInsert(nodes, this, (a, b) => {
|
|
377
|
+
return a.segment.tileZoom - b.segment.tileZoom;
|
|
378
|
+
});
|
|
312
379
|
}
|
|
313
|
-
nodes.push(this);
|
|
314
380
|
if (!this.segment.terrainReady) {
|
|
315
381
|
this.planet._renderCompleted = false;
|
|
316
382
|
this.planet._terrainCompleted = false;
|
|
@@ -324,6 +390,46 @@ class Node {
|
|
|
324
390
|
inFrustum >>= 1;
|
|
325
391
|
}
|
|
326
392
|
}
|
|
393
|
+
applyNeighbor(node, side) {
|
|
394
|
+
const opcs = OPSIDE[side];
|
|
395
|
+
if (this.neighbors[side].length === 0 || node.neighbors[opcs].length === 0) {
|
|
396
|
+
const ap = this.segment;
|
|
397
|
+
const bp = node.segment;
|
|
398
|
+
const ld = ap.gridSize / (bp.gridSize * Math.pow(2, bp.tileZoom - ap.tileZoom));
|
|
399
|
+
let cs_size = ap.gridSize, opcs_size = bp.gridSize;
|
|
400
|
+
if (ld > 1) {
|
|
401
|
+
cs_size = Math.ceil(ap.gridSize / ld);
|
|
402
|
+
opcs_size = bp.gridSize;
|
|
403
|
+
}
|
|
404
|
+
else if (ld < 1) {
|
|
405
|
+
cs_size = ap.gridSize;
|
|
406
|
+
opcs_size = Math.ceil(bp.gridSize * ld);
|
|
407
|
+
}
|
|
408
|
+
this.sideSizeLog2[side] = Math.log2(cs_size);
|
|
409
|
+
node.sideSizeLog2[opcs] = Math.log2(opcs_size);
|
|
410
|
+
}
|
|
411
|
+
//@todo: fix dupe neighbors
|
|
412
|
+
this.neighbors[side].push(node);
|
|
413
|
+
node.neighbors[opcs].push(this);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Searching current node for its neighbours.
|
|
417
|
+
* @public
|
|
418
|
+
*/
|
|
419
|
+
getRenderedNodesNeighbors(nodes) {
|
|
420
|
+
for (let i = nodes.length - 1; i >= 0; --i) {
|
|
421
|
+
let ni = nodes[i];
|
|
422
|
+
let cs = this.getCommonSide(ni);
|
|
423
|
+
if (cs !== -1) {
|
|
424
|
+
this.applyNeighbor(ni, cs);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Checking if current node has a common side with input node and return side index N, E, S or W. Otherwise returns -1.
|
|
430
|
+
* @param {Node} node - Input node
|
|
431
|
+
* @returns {number} - Node side index
|
|
432
|
+
*/
|
|
327
433
|
getCommonSide(node) {
|
|
328
434
|
const as = this.segment;
|
|
329
435
|
const bs = node.segment;
|
|
@@ -574,23 +680,16 @@ class Node {
|
|
|
574
680
|
}
|
|
575
681
|
}
|
|
576
682
|
destroy() {
|
|
577
|
-
this.state = NOTRENDERING;
|
|
683
|
+
this.prevState = this.state = NOTRENDERING;
|
|
578
684
|
this.segment.destroySegment();
|
|
579
685
|
let n = this.neighbors;
|
|
580
|
-
for (let i = 0
|
|
686
|
+
for (let i = 0, len = n.length; i < len; i++) {
|
|
581
687
|
let ni = n[i];
|
|
582
688
|
if (ni) {
|
|
583
689
|
for (let j = 0; j < ni.length; j++) {
|
|
584
690
|
let nij = ni[j];
|
|
585
691
|
if (nij && nij.neighbors) {
|
|
586
|
-
|
|
587
|
-
nij.neighbors[N] = null;
|
|
588
|
-
// @ts-ignore
|
|
589
|
-
nij.neighbors[E] = null;
|
|
590
|
-
// @ts-ignore
|
|
591
|
-
nij.neighbors[S] = null;
|
|
592
|
-
// @ts-ignore
|
|
593
|
-
nij.neighbors[W] = null;
|
|
692
|
+
nij.clearNeighbors();
|
|
594
693
|
}
|
|
595
694
|
}
|
|
596
695
|
}
|
|
@@ -640,17 +640,8 @@ class Renderer {
|
|
|
640
640
|
let ec = this._entityCollections;
|
|
641
641
|
if (ec.length) {
|
|
642
642
|
this.enableBlendDefault();
|
|
643
|
-
//geoObject
|
|
644
|
-
let i = ec.length;
|
|
645
|
-
while (i--) {
|
|
646
|
-
let eci = ec[i];
|
|
647
|
-
if (ec[i]._fadingOpacity) {
|
|
648
|
-
eci.events.dispatch(eci.events.draw, eci);
|
|
649
|
-
ec[i].geoObjectHandler.draw();
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
643
|
// pointClouds pass
|
|
653
|
-
i = ec.length;
|
|
644
|
+
let i = ec.length;
|
|
654
645
|
while (i--) {
|
|
655
646
|
ec[i]._fadingOpacity && ec[i].pointCloudHandler.draw();
|
|
656
647
|
}
|
|
@@ -665,10 +656,19 @@ class Renderer {
|
|
|
665
656
|
if (ec.length) {
|
|
666
657
|
let gl = this.handler.gl;
|
|
667
658
|
this.enableBlendDefault();
|
|
659
|
+
// GeoObjects
|
|
660
|
+
let i = ec.length;
|
|
661
|
+
while (i--) {
|
|
662
|
+
let eci = ec[i];
|
|
663
|
+
if (ec[i]._fadingOpacity) {
|
|
664
|
+
eci.events.dispatch(eci.events.draw, eci);
|
|
665
|
+
ec[i].geoObjectHandler.draw();
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
668
|
// billboards pass
|
|
669
669
|
gl.activeTexture(gl.TEXTURE0);
|
|
670
670
|
gl.bindTexture(gl.TEXTURE_2D, this.billboardsTextureAtlas.texture);
|
|
671
|
-
|
|
671
|
+
i = ec.length;
|
|
672
672
|
while (i--) {
|
|
673
673
|
let eci = ec[i];
|
|
674
674
|
eci._fadingOpacity && eci.billboardHandler.draw();
|
|
@@ -717,6 +717,7 @@ class Renderer {
|
|
|
717
717
|
let h = this.handler, gl = h.gl;
|
|
718
718
|
gl.clearColor(0.0, 0.0, 0.0, 1.0);
|
|
719
719
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
720
|
+
this.enableBlendDefault();
|
|
720
721
|
e.dispatch(e.draw, this);
|
|
721
722
|
let frustums = this.activeCamera.frustums;
|
|
722
723
|
let pointerEvent = e.pointerEvent() || this.activeCamera.isMoving;
|
|
@@ -738,6 +739,7 @@ class Renderer {
|
|
|
738
739
|
}
|
|
739
740
|
this._drawTransparentEntityCollections();
|
|
740
741
|
this._clearEntityCollectionQueue();
|
|
742
|
+
e.dispatch(e.drawtransparent, this);
|
|
741
743
|
if (pointerEvent) {
|
|
742
744
|
this._drawPickingBuffer();
|
|
743
745
|
this.__useDistanceFramebuffer__ && this._drawDistanceBuffer();
|
|
@@ -816,18 +818,19 @@ class Renderer {
|
|
|
816
818
|
else {
|
|
817
819
|
gl.clear(gl.DEPTH_BUFFER_BIT);
|
|
818
820
|
}
|
|
819
|
-
//
|
|
820
|
-
// draw picking scenes
|
|
821
|
-
//
|
|
822
|
-
gl.disable(gl.BLEND);
|
|
823
821
|
let dp = this._pickingCallbacks;
|
|
824
822
|
for (let i = 0, len = dp.length; i < len; i++) {
|
|
823
|
+
//
|
|
824
|
+
// draw picking scenes, usually we don't need blending,
|
|
825
|
+
// but sometimes set it manually in the callbacks
|
|
826
|
+
//
|
|
827
|
+
gl.disable(gl.BLEND);
|
|
825
828
|
/**
|
|
826
829
|
* This callback renders picking frame.
|
|
827
830
|
*/
|
|
828
831
|
dp[i].callback.call(dp[i].sender);
|
|
832
|
+
gl.enable(gl.BLEND);
|
|
829
833
|
}
|
|
830
|
-
gl.enable(gl.BLEND);
|
|
831
834
|
this.pickingFramebuffer.deactivate();
|
|
832
835
|
}
|
|
833
836
|
/**
|
|
@@ -9,6 +9,7 @@ export type RendererEventsHandler = RendererEvents & EventsHandler<RendererEvent
|
|
|
9
9
|
export declare function createRendererEvents(renderer: Renderer): RendererEvents;
|
|
10
10
|
export type RendererEventsType = [
|
|
11
11
|
"draw",
|
|
12
|
+
"drawtransparent",
|
|
12
13
|
"postdraw",
|
|
13
14
|
"resize",
|
|
14
15
|
"resizeend",
|
|
@@ -710,6 +710,11 @@ const RENDERER_EVENTS = [
|
|
|
710
710
|
* @event og.RendererEvents#draw
|
|
711
711
|
*/
|
|
712
712
|
"draw",
|
|
713
|
+
/**
|
|
714
|
+
* Triggered after all transparent object are drawn
|
|
715
|
+
* @event og.RendererEvents#drawtransparent
|
|
716
|
+
*/
|
|
717
|
+
"drawtransparent",
|
|
713
718
|
/**
|
|
714
719
|
* Triggered after scene frame is rendered(after render nodes).
|
|
715
720
|
* @event og.RendererEvents#postdraw
|
package/lib/js/scene/Planet.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { TerrainWorker } from "../utils/TerrainWorker";
|
|
|
23
23
|
import { Vec2, Vec3, NumberArray2, NumberArray3, NumberArray4 } from "../math/index";
|
|
24
24
|
import { VectorTileCreator } from "../utils/VectorTileCreator";
|
|
25
25
|
import { WebGLBufferExt, WebGLTextureExt, IDefaultTextureParams } from "../webgl/Handler";
|
|
26
|
+
import { Program } from "../webgl/Program";
|
|
27
|
+
import { Segment } from "../segment/Segment";
|
|
26
28
|
export interface IPlanetParams {
|
|
27
29
|
name?: string;
|
|
28
30
|
ellipsoid?: Ellipsoid;
|
|
@@ -42,6 +44,7 @@ export interface IPlanetParams {
|
|
|
42
44
|
maxGridSize?: number;
|
|
43
45
|
maxLoadingRequests?: number;
|
|
44
46
|
atmosphereEnabled?: boolean;
|
|
47
|
+
transitionOpacityEnabled?: boolean;
|
|
45
48
|
}
|
|
46
49
|
export type PlanetEventsList = [
|
|
47
50
|
"draw",
|
|
@@ -176,6 +179,8 @@ export declare class Planet extends RenderNode {
|
|
|
176
179
|
*/
|
|
177
180
|
_renderedNodes: Node[];
|
|
178
181
|
_renderedNodesInFrustum: Node[][];
|
|
182
|
+
_fadingNodes: Map<number, Node>;
|
|
183
|
+
_fadingNodesInFrustum: Node[][];
|
|
179
184
|
/**
|
|
180
185
|
* Current visible mercator segments tree nodes array.
|
|
181
186
|
* @public
|
|
@@ -306,7 +311,8 @@ export declare class Planet extends RenderNode {
|
|
|
306
311
|
* @type {number}
|
|
307
312
|
*/
|
|
308
313
|
nightTextureCoefficient: number;
|
|
309
|
-
protected _renderScreenNodesPASS:
|
|
314
|
+
protected _renderScreenNodesPASS: () => void;
|
|
315
|
+
protected _renderScreenNodesWithHeightPASS: () => void;
|
|
310
316
|
protected _atmosphereEnabled: boolean;
|
|
311
317
|
protected _atmosphereMaxMinOpacity: Float32Array;
|
|
312
318
|
solidTextureOne: WebGLTextureExt | null;
|
|
@@ -314,6 +320,10 @@ export declare class Planet extends RenderNode {
|
|
|
314
320
|
protected _skipPreRender: boolean;
|
|
315
321
|
protected _nightTextureSrc: string | null;
|
|
316
322
|
protected _specularTextureSrc: string | null;
|
|
323
|
+
transitionTime: number;
|
|
324
|
+
_prevNodes: Map<number, Node>;
|
|
325
|
+
_currNodes: Map<number, Node>;
|
|
326
|
+
protected _transitionOpacityEnabled: boolean;
|
|
317
327
|
constructor(options?: IPlanetParams);
|
|
318
328
|
/**
|
|
319
329
|
* Returns true if current terrain data set is loaded
|
|
@@ -447,11 +457,18 @@ export declare class Planet extends RenderNode {
|
|
|
447
457
|
protected _sortLayers(): void;
|
|
448
458
|
protected _clearRenderedNodeList(): void;
|
|
449
459
|
protected _clearRenderNodesInFrustum(): void;
|
|
460
|
+
protected _collectRenderedNodesMaxZoom(cam: PlanetCamera): void;
|
|
461
|
+
set transitionOpacityEnabled(isEnabled: boolean);
|
|
462
|
+
get transitionOpacityEnabled(): boolean;
|
|
450
463
|
/**
|
|
451
464
|
* Collects visible quad nodes.
|
|
452
465
|
* @protected
|
|
453
466
|
*/
|
|
454
|
-
protected _collectRenderNodes(): void;
|
|
467
|
+
protected _collectRenderNodes(cam: PlanetCamera): void;
|
|
468
|
+
protected _renderScreenNodesPASSNoAtmos(): void;
|
|
469
|
+
protected _renderScreenNodesPASSAtmos(): void;
|
|
470
|
+
protected _renderScreenNodesWithHeightPASSNoAtmos(): void;
|
|
471
|
+
protected _renderScreenNodesWithHeightPASSAtmos(): void;
|
|
455
472
|
protected _globalPreDraw(): void;
|
|
456
473
|
/**
|
|
457
474
|
* Render node callback.
|
|
@@ -460,6 +477,7 @@ export declare class Planet extends RenderNode {
|
|
|
460
477
|
preFrame(): void;
|
|
461
478
|
/**
|
|
462
479
|
* Render node callback.
|
|
480
|
+
* Frame function is called for each renderer activrCamera frustum.
|
|
463
481
|
* @public
|
|
464
482
|
* @override
|
|
465
483
|
*/
|
|
@@ -467,8 +485,15 @@ export declare class Planet extends RenderNode {
|
|
|
467
485
|
protected _checkRendercompleted(): void;
|
|
468
486
|
lockQuadTree(): void;
|
|
469
487
|
unlockQuadTree(): void;
|
|
470
|
-
protected
|
|
471
|
-
protected
|
|
488
|
+
protected _setUniformsNoAtmos(cam: PlanetCamera): Program;
|
|
489
|
+
protected _setUniformsAtmos(cam: PlanetCamera): Program;
|
|
490
|
+
protected _renderingFadingNodes: (nodes: Map<number, boolean>, sh: Program, currentNode: Node, sl: Layer[], sliceIndex: number, outTransparentSegments?: Segment[]) => void;
|
|
491
|
+
protected _renderingFadingNodesNoDepth: (nodes: Map<number, boolean>, sh: Program, currentNode: Node, sl: Layer[], sliceIndex: number) => void;
|
|
492
|
+
/**
|
|
493
|
+
* Drawing nodes
|
|
494
|
+
*/
|
|
495
|
+
protected _renderingScreenNodes(sh: Program, cam: PlanetCamera, renderedNodes: Node[]): void;
|
|
496
|
+
protected _renderingScreenNodesWithHeight(sh: Program, cam: PlanetCamera, renderedNodes: Node[]): void;
|
|
472
497
|
protected _renderDistanceFramebufferPASS(): void;
|
|
473
498
|
protected _renderColorPickingFramebufferPASS(): void;
|
|
474
499
|
protected _renderDepthFramebufferPASS(): void;
|