@openglobus/og 0.10.5 → 0.10.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"description": "[OpenGlobus](http://www.openglobus.org/) is a javascript 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"
|
|
@@ -551,9 +551,9 @@ class PlanetCamera extends Camera {
|
|
|
551
551
|
let slope = n.dot(eyeNorm);
|
|
552
552
|
|
|
553
553
|
if (minSlope) {
|
|
554
|
-
let dSlope = slope - this.slope;
|
|
554
|
+
//let dSlope = slope - this.slope;
|
|
555
555
|
|
|
556
|
-
if (slope < minSlope && dSlope < 0) return;
|
|
556
|
+
//if (slope < minSlope && dSlope < 0) return;
|
|
557
557
|
|
|
558
558
|
if (
|
|
559
559
|
(slope > 0.1 && v.dot(eyeNorm) > 0) ||
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @module og/layer/CanvasTiles
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as quadTree from
|
|
8
|
-
import { Layer } from
|
|
7
|
+
import * as quadTree from "../quadTree/quadTree.js";
|
|
8
|
+
import { Layer } from "./Layer.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Maximum tiles per frame.
|
|
@@ -92,7 +92,7 @@ class CanvasTiles extends Layer {
|
|
|
92
92
|
}
|
|
93
93
|
this._pendingsQueue = [];
|
|
94
94
|
// this._pendingsQueue.clear();
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Sets layer visibility.
|
|
@@ -119,11 +119,12 @@ class CanvasTiles extends Layer {
|
|
|
119
119
|
* @param {og.planetSegment.Material} material -
|
|
120
120
|
*/
|
|
121
121
|
loadMaterial(material) {
|
|
122
|
-
|
|
123
122
|
var seg = material.segment;
|
|
124
123
|
|
|
125
124
|
if (this._isBaseLayer) {
|
|
126
|
-
material.texture = seg._isNorth
|
|
125
|
+
material.texture = seg._isNorth
|
|
126
|
+
? seg.planet.solidTextureOne
|
|
127
|
+
: seg.planet.solidTextureTwo;
|
|
127
128
|
} else {
|
|
128
129
|
material.texture = seg.planet.transparentTexture;
|
|
129
130
|
}
|
|
@@ -149,33 +150,32 @@ class CanvasTiles extends Layer {
|
|
|
149
150
|
this._counter++;
|
|
150
151
|
var that = this;
|
|
151
152
|
if (this.drawTile) {
|
|
152
|
-
|
|
153
153
|
/**
|
|
154
154
|
* Tile custom draw function.
|
|
155
155
|
* @callback og.layer.CanvasTiles~drawTileCallback
|
|
156
156
|
* @param {og.planetSegment.Material} material
|
|
157
157
|
* @param {applyCanvasCallback} applyCanvasCallback
|
|
158
158
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
var e = that.events.load;
|
|
160
|
+
if (e.handlers.length) {
|
|
161
|
+
that.events.dispatch(e, material);
|
|
162
|
+
}
|
|
163
|
+
that.drawTile(
|
|
164
|
+
material,
|
|
165
|
+
/**
|
|
166
|
+
* Apply canvas.
|
|
167
|
+
* @callback applyCanvasCallback
|
|
168
|
+
* @param {Object} canvas -
|
|
169
|
+
*/
|
|
170
|
+
function (canvas) {
|
|
171
|
+
that._counter--;
|
|
172
|
+
CanvasTiles.__requestsCounter--;
|
|
173
|
+
if (material.isLoading) {
|
|
174
|
+
material.applyImage(canvas);
|
|
175
|
+
}
|
|
176
|
+
that._dequeueRequest();
|
|
163
177
|
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Apply canvas.
|
|
167
|
-
* @callback applyCanvasCallback
|
|
168
|
-
* @param {Object} canvas -
|
|
169
|
-
*/
|
|
170
|
-
function (canvas) {
|
|
171
|
-
that._counter--;
|
|
172
|
-
CanvasTiles.__requestsCounter--;
|
|
173
|
-
if (material.isLoading) {
|
|
174
|
-
material.applyImage(canvas);
|
|
175
|
-
}
|
|
176
|
-
that._dequeueRequest();
|
|
177
|
-
});
|
|
178
|
-
}, 50);
|
|
178
|
+
);
|
|
179
179
|
} else {
|
|
180
180
|
material.textureNotExists();
|
|
181
181
|
}
|
|
@@ -214,7 +214,10 @@ class CanvasTiles extends Layer {
|
|
|
214
214
|
while (this._pendingsQueue.length) {
|
|
215
215
|
var pmat = this._pendingsQueue.pop();
|
|
216
216
|
if (pmat.segment.node) {
|
|
217
|
-
if (
|
|
217
|
+
if (
|
|
218
|
+
pmat.segment.initialized &&
|
|
219
|
+
pmat.segment.node.getState() === quadTree.RENDERING
|
|
220
|
+
) {
|
|
218
221
|
return pmat;
|
|
219
222
|
}
|
|
220
223
|
pmat.isLoading = false;
|
|
@@ -227,7 +230,6 @@ class CanvasTiles extends Layer {
|
|
|
227
230
|
if (material.isReady) {
|
|
228
231
|
return [0, 0, 1, 1];
|
|
229
232
|
} else {
|
|
230
|
-
|
|
231
233
|
!material.isLoading && this.loadMaterial(material);
|
|
232
234
|
|
|
233
235
|
var segment = material.segment;
|
|
@@ -278,10 +280,10 @@ class CanvasTiles extends Layer {
|
|
|
278
280
|
material.textureExists = false;
|
|
279
281
|
|
|
280
282
|
if (material.image) {
|
|
281
|
-
material.image.src =
|
|
283
|
+
material.image.src = "";
|
|
282
284
|
material.image = null;
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
|
-
}
|
|
287
|
+
}
|
|
286
288
|
|
|
287
289
|
export { CanvasTiles };
|
package/src/og/quadTree/Node.js
CHANGED
|
@@ -477,26 +477,80 @@ Node.prototype.getCommonSide = function (node) {
|
|
|
477
477
|
b_sw_lon = b_sw.lon,
|
|
478
478
|
b_sw_lat = b_sw.lat;
|
|
479
479
|
|
|
480
|
+
if (as._tileGroup === bs._tileGroup) {
|
|
481
|
+
if (
|
|
482
|
+
a_ne_lon === b_sw_lon &&
|
|
483
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
484
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
485
|
+
) {
|
|
486
|
+
return E;
|
|
487
|
+
} else if (
|
|
488
|
+
a_sw_lon === b_ne_lon &&
|
|
489
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
490
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
491
|
+
) {
|
|
492
|
+
return W;
|
|
493
|
+
} else if (
|
|
494
|
+
a_ne_lat === b_sw_lat &&
|
|
495
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
496
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
497
|
+
) {
|
|
498
|
+
return N;
|
|
499
|
+
} else if (
|
|
500
|
+
a_sw_lat === b_ne_lat &&
|
|
501
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
502
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
503
|
+
) {
|
|
504
|
+
return S;
|
|
505
|
+
} else if (
|
|
506
|
+
bs.tileX === 0 &&
|
|
507
|
+
as.tileX === Math.pow(2, as.tileZoom) - 1 &&
|
|
508
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
509
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
510
|
+
) {
|
|
511
|
+
return E;
|
|
512
|
+
} else if (
|
|
513
|
+
as.tileX === 0 &&
|
|
514
|
+
bs.tileX === Math.pow(2, bs.tileZoom) - 1 &&
|
|
515
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
516
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
517
|
+
) {
|
|
518
|
+
return W;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
480
522
|
if (
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
523
|
+
as._tileGroup === 0 &&
|
|
524
|
+
bs._tileGroup === 1 &&
|
|
525
|
+
as.tileY === 0 &&
|
|
526
|
+
bs.tileY === Math.pow(2, bs.tileZoom) - 1 &&
|
|
527
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
528
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
484
529
|
) {
|
|
485
|
-
return
|
|
530
|
+
return N;
|
|
486
531
|
} else if (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
532
|
+
as._tileGroup === 2 &&
|
|
533
|
+
bs._tileGroup === 0 &&
|
|
534
|
+
as.tileY === 0 &&
|
|
535
|
+
bs.tileY === Math.pow(2, bs.tileZoom) - 1 &&
|
|
536
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
537
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
490
538
|
) {
|
|
491
|
-
return
|
|
539
|
+
return N;
|
|
492
540
|
} else if (
|
|
493
|
-
|
|
541
|
+
bs._tileGroup === 1 &&
|
|
542
|
+
as._tileGroup === 0 &&
|
|
543
|
+
as.tileY === Math.pow(2, as.tileZoom) - 1 &&
|
|
544
|
+
bs.tileY === 0 &&
|
|
494
545
|
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
495
546
|
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
496
547
|
) {
|
|
497
|
-
return
|
|
548
|
+
return S;
|
|
498
549
|
} else if (
|
|
499
|
-
|
|
550
|
+
as._tileGroup === 1 &&
|
|
551
|
+
bs._tileGroup === 0 &&
|
|
552
|
+
as.tileY === Math.pow(2, as.tileZoom) - 1 &&
|
|
553
|
+
bs.tileY === 0 &&
|
|
500
554
|
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
501
555
|
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
502
556
|
) {
|
package/src/og/scene/Planet.js
CHANGED
|
@@ -805,11 +805,11 @@ class Planet extends RenderNode {
|
|
|
805
805
|
this._quadTree.renderNode();
|
|
806
806
|
this._normalMapCreator.drawSingle(this._quadTree.segment);
|
|
807
807
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
808
|
+
for (var i = 0; i < this._quadTree.nodes.length; i++) {
|
|
809
|
+
this._quadTree.nodes[i].segment.createPlainSegment();
|
|
810
|
+
this._quadTree.nodes[i].renderNode(true);
|
|
811
|
+
this._normalMapCreator.drawSingle(this._quadTree.nodes[i].segment);
|
|
812
|
+
}
|
|
813
813
|
|
|
814
814
|
this._quadTreeNorth.createChildrenNodes();
|
|
815
815
|
this._quadTreeNorth.segment.createPlainSegment();
|