@openglobus/og 0.11.8 → 0.12.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/css/og.css +2 -0
- package/dist/@openglobus/og.css +1 -0
- package/dist/@openglobus/og.esm.js +21 -0
- package/dist/@openglobus/og.esm.js.map +1 -0
- package/dist/@openglobus/og.umd.js +21 -0
- package/dist/@openglobus/og.umd.js.map +1 -0
- package/package.json +11 -11
- 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 +138 -134
- package/src/og/entity/LabelHandler.js +2 -1
- package/src/og/layer/CanvasTiles.js +8 -11
- package/src/og/layer/KML.js +19 -12
- package/src/og/layer/Layer.js +9 -2
- package/src/og/layer/XYZ.js +27 -28
- 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 +147 -127
- package/src/og/segment/Segment.js +63 -136
- package/src/og/shaders/drawnode.js +132 -221
- package/src/og/shaders/geoObject.js +15 -6
- 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
- package/types/Clock.d.ts +94 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +77 -0
- package/types/Extent.d.ts +166 -0
- package/types/Globe.d.ts +85 -0
- package/types/ImageCanvas.d.ts +123 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +42 -0
- package/types/QueueArray.d.ts +19 -0
- package/types/Rectangle.d.ts +80 -0
- package/types/Stack.d.ts +19 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +7 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +30 -0
- package/types/bv/Sphere.d.ts +38 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +312 -0
- package/types/camera/Frustum.d.ts +133 -0
- package/types/camera/PlanetCamera.d.ts +219 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +104 -0
- package/types/control/DebugInfo.d.ts +15 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/EarthNavigation.d.ts +43 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +21 -0
- package/types/control/LayerSwitcher.d.ts +21 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/MouseNavigation.d.ts +48 -0
- package/types/control/MouseWheelZoomControl.d.ts +45 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +11 -0
- package/types/control/SimpleNavigation.d.ts +25 -0
- package/types/control/Sun.d.ts +50 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +27 -0
- package/types/control/index.d.ts +18 -0
- package/types/ellipsoid/Ellipsoid.d.ts +146 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +6 -0
- package/types/entity/BaseBillboard.d.ts +215 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +79 -0
- package/types/entity/Entity.d.ts +348 -0
- package/types/entity/EntityCollection.d.ts +317 -0
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +81 -0
- package/types/entity/Geometry.d.ts +74 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +189 -0
- package/types/entity/LabelHandler.d.ts +31 -0
- package/types/entity/LabelWorker.d.ts +11 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +306 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +124 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +119 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +94 -0
- package/types/layer/CanvasTiles.d.ts +67 -0
- package/types/layer/GeoImage.d.ts +52 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +55 -0
- package/types/layer/KML.d.ts +68 -0
- package/types/layer/Layer.d.ts +311 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +61 -0
- package/types/layer/XYZ.d.ts +119 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +178 -0
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +65 -0
- package/types/math/Mat4.d.ts +176 -0
- package/types/math/Plane.d.ts +18 -0
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +309 -0
- package/types/math/Vec3.d.ts +467 -0
- package/types/math/Vec4.d.ts +162 -0
- package/types/math/coder.d.ts +43 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +6 -0
- package/types/proj/EPSG4326.d.ts +6 -0
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +60 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/Renderer.d.ts +290 -0
- package/types/renderer/RendererEvents.d.ts +237 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +576 -0
- package/types/scene/RenderNode.d.ts +142 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/Segment.d.ts +275 -0
- package/types/segment/SegmentLonLat.d.ts +17 -0
- package/types/segment/Slice.d.ts +10 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +250 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +7 -0
- package/types/terrain/EmptyTerrain.d.ts +73 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +116 -0
- package/types/terrain/MapboxTerrain.d.ts +7 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +15 -0
- package/types/utils/GeoImageCreator.d.ts +30 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +231 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +417 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +161 -0
- package/types/webgl/ProgramController.d.ts +89 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
package/src/og/layer/XYZ.js
CHANGED
|
@@ -151,8 +151,9 @@ class XYZ extends Layer {
|
|
|
151
151
|
} else {
|
|
152
152
|
material.texture = seg.planet.transparentTexture;
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
|
|
155
|
+
// Q: Maybe we should change "<2" to material.segment.tileZoom < (material.layer.minZoom + 1)
|
|
156
|
+
if (this._planet.layerLock.isFree() || material.segment.tileZoom < 2) {
|
|
156
157
|
material.isReady = false;
|
|
157
158
|
material.isLoading = true;
|
|
158
159
|
|
|
@@ -237,9 +238,6 @@ class XYZ extends Layer {
|
|
|
237
238
|
if (material.isReady) {
|
|
238
239
|
return material.texOffset;
|
|
239
240
|
} else {
|
|
240
|
-
// if (material.loadingAttempts > 20) {
|
|
241
|
-
// debugger;
|
|
242
|
-
// }
|
|
243
241
|
|
|
244
242
|
let segment = material.segment,
|
|
245
243
|
pn = segment.node,
|
|
@@ -248,34 +246,35 @@ class XYZ extends Layer {
|
|
|
248
246
|
let mId = this._id;
|
|
249
247
|
let psegm = material;
|
|
250
248
|
while (pn.parentNode) {
|
|
249
|
+
pn = pn.parentNode;
|
|
250
|
+
psegm = pn.segment.materials[mId];
|
|
251
251
|
if (psegm && psegm.textureExists) {
|
|
252
252
|
notEmpty = true;
|
|
253
253
|
break;
|
|
254
254
|
}
|
|
255
|
-
pn = pn.parentNode;
|
|
256
|
-
psegm = pn.segment.materials[mId];
|
|
257
255
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
} else {
|
|
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);
|
|
256
|
+
|
|
257
|
+
if (segment.passReady) {
|
|
258
|
+
let maxNativeZoom = material.layer.maxNativeZoom;
|
|
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) {
|
|
@@ -313,7 +312,7 @@ class XYZ extends Layer {
|
|
|
313
312
|
|
|
314
313
|
material.isReady = false;
|
|
315
314
|
material.textureExists = false;
|
|
316
|
-
material.isLoading = false;
|
|
315
|
+
material.isLoading = false;
|
|
317
316
|
}
|
|
318
317
|
|
|
319
318
|
/**
|
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
|
/**
|
package/src/og/quadTree/Node.js
CHANGED
|
@@ -7,7 +7,6 @@ import { Vec3 } from "../math/Vec3.js";
|
|
|
7
7
|
import { MAX_LAT } from "../mercator.js";
|
|
8
8
|
import { EPSG3857 } from "../proj/EPSG3857.js";
|
|
9
9
|
import { EPSG4326 } from "../proj/EPSG4326.js";
|
|
10
|
-
import { MAX_NORMAL_ZOOM } from "../segment/Segment.js";
|
|
11
10
|
import { getMatrixSubArray, getMatrixSubArrayBoundsExt } from "../utils/shared.js";
|
|
12
11
|
import {
|
|
13
12
|
COMSIDE,
|
|
@@ -30,8 +29,6 @@ import {
|
|
|
30
29
|
WALKTHROUGH
|
|
31
30
|
} from "./quadTree.js";
|
|
32
31
|
|
|
33
|
-
const VISIBLE_HEIGHT = 1400000.0;
|
|
34
|
-
|
|
35
32
|
let _tempHigh = new Vec3(),
|
|
36
33
|
_tempLow = new Vec3();
|
|
37
34
|
|
|
@@ -67,6 +64,7 @@ class Node {
|
|
|
67
64
|
|
|
68
65
|
constructor(SegmentPrototype, planet, partId, parent, id, tileZoom, extent) {
|
|
69
66
|
this.SegmentPrototype = SegmentPrototype;
|
|
67
|
+
planet._createdNodesCount++;
|
|
70
68
|
this.planet = planet;
|
|
71
69
|
this.parentNode = parent;
|
|
72
70
|
this.partId = partId;
|
|
@@ -84,7 +82,6 @@ class Node {
|
|
|
84
82
|
this._cameraInside = false;
|
|
85
83
|
this.inFrustum = 0;
|
|
86
84
|
this.createBounds();
|
|
87
|
-
this.planet._createdNodesCount++;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
createChildrenNodes() {
|
|
@@ -102,45 +99,10 @@ class Node {
|
|
|
102
99
|
var c = new LonLat(sw.lon + size_x, sw.lat + size_y);
|
|
103
100
|
var nd = this.nodes;
|
|
104
101
|
|
|
105
|
-
nd[NW] = new Node(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this,
|
|
110
|
-
id,
|
|
111
|
-
z,
|
|
112
|
-
new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat))
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
nd[NE] = new Node(
|
|
116
|
-
this.SegmentPrototype,
|
|
117
|
-
p,
|
|
118
|
-
NE,
|
|
119
|
-
this,
|
|
120
|
-
id,
|
|
121
|
-
z,
|
|
122
|
-
new Extent(c, new LonLat(ne.lon, ne.lat))
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
nd[SW] = new Node(
|
|
126
|
-
this.SegmentPrototype,
|
|
127
|
-
p,
|
|
128
|
-
SW,
|
|
129
|
-
this,
|
|
130
|
-
id,
|
|
131
|
-
z,
|
|
132
|
-
new Extent(new LonLat(sw.lon, sw.lat), c)
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
nd[SE] = new Node(
|
|
136
|
-
this.SegmentPrototype,
|
|
137
|
-
p,
|
|
138
|
-
SE,
|
|
139
|
-
this,
|
|
140
|
-
id,
|
|
141
|
-
z,
|
|
142
|
-
new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y))
|
|
143
|
-
);
|
|
102
|
+
nd[NW] = new Node(this.SegmentPrototype, p, NW, this, id, z, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)));
|
|
103
|
+
nd[NE] = new Node(this.SegmentPrototype, p, NE, this, id, z, new Extent(c, new LonLat(ne.lon, ne.lat)));
|
|
104
|
+
nd[SW] = new Node(this.SegmentPrototype, p, SW, this, id, z, new Extent(new LonLat(sw.lon, sw.lat), c));
|
|
105
|
+
nd[SE] = new Node(this.SegmentPrototype, p, SE, this, id, z, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)));
|
|
144
106
|
}
|
|
145
107
|
|
|
146
108
|
createBounds() {
|
|
@@ -153,6 +115,15 @@ class Node {
|
|
|
153
115
|
} else {
|
|
154
116
|
seg.createBoundsByParent();
|
|
155
117
|
}
|
|
118
|
+
|
|
119
|
+
let x = seg.bsphere.center.x,
|
|
120
|
+
y = seg.bsphere.center.y,
|
|
121
|
+
z = seg.bsphere.center.z;
|
|
122
|
+
|
|
123
|
+
let length = 1.0 / Math.sqrt(x * x + y * y + z * z);
|
|
124
|
+
seg.centerNormal.x = x * length;
|
|
125
|
+
seg.centerNormal.y = y * length;
|
|
126
|
+
seg.centerNormal.z = z * length;
|
|
156
127
|
}
|
|
157
128
|
|
|
158
129
|
getState() {
|
|
@@ -204,15 +175,10 @@ class Node {
|
|
|
204
175
|
}
|
|
205
176
|
|
|
206
177
|
renderTree(cam, maxZoom, terrainReadySegment, stopLoading) {
|
|
207
|
-
if (
|
|
208
|
-
this.planet._renderedNodes.length >= MAX_RENDERED_NODES ||
|
|
209
|
-
this.planet._nodeCounterError_ > 2000
|
|
210
|
-
) {
|
|
178
|
+
if (this.planet._renderedNodes.length >= MAX_RENDERED_NODES) {
|
|
211
179
|
return;
|
|
212
180
|
}
|
|
213
181
|
|
|
214
|
-
this.planet._nodeCounterError_++;
|
|
215
|
-
|
|
216
182
|
this.state = WALKTHROUGH;
|
|
217
183
|
|
|
218
184
|
this.neighbors[0] = null;
|
|
@@ -282,27 +248,49 @@ class Node {
|
|
|
282
248
|
if (this.inFrustum || this._cameraInside || seg.tileZoom < 3) {
|
|
283
249
|
let h = cam._lonLat.height;
|
|
284
250
|
|
|
285
|
-
let
|
|
286
|
-
|
|
287
|
-
|
|
251
|
+
let eye = cam.eye;
|
|
252
|
+
let horizonDist = eye.length2() - this.planet.ellipsoid._b2;
|
|
253
|
+
|
|
254
|
+
let altVis = seg.tileZoom > 19 ||
|
|
288
255
|
(seg.tileZoom < 4 && !seg.terrainReady) ||
|
|
289
256
|
seg.tileZoom < 2;
|
|
290
257
|
|
|
258
|
+
if (h > 21000) {
|
|
259
|
+
altVis = altVis || eye.distance2(seg._sw) < horizonDist
|
|
260
|
+
|| eye.distance2(seg._nw) < horizonDist
|
|
261
|
+
|| eye.distance2(seg._ne) < horizonDist
|
|
262
|
+
|| eye.distance2(seg._se) < horizonDist;
|
|
263
|
+
} else {
|
|
264
|
+
altVis = altVis || cam.eye.distance(seg.bsphere.center) - seg.bsphere.radius < VISIBLE_DISTANCE * Math.sqrt(h);
|
|
265
|
+
}
|
|
266
|
+
|
|
291
267
|
if ((this.inFrustum && (altVis || h > 10000.0)) || this._cameraInside) {
|
|
292
268
|
seg._collectVisibleNodes();
|
|
293
269
|
}
|
|
294
270
|
|
|
295
271
|
if (seg.tileZoom < 2 && seg.normalMapReady) {
|
|
296
272
|
this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
297
|
-
} else if (
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
273
|
+
} else if (seg.terrainReady && (
|
|
274
|
+
!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet._lodSize ||
|
|
275
|
+
maxZoom && ((seg.tileZoom === maxZoom) || !altVis))) {
|
|
276
|
+
|
|
277
|
+
if (altVis) {
|
|
278
|
+
seg.passReady = true;
|
|
279
|
+
this.renderNode(this.inFrustum, !this.inFrustum, terrainReadySegment, stopLoading);
|
|
280
|
+
} else {
|
|
281
|
+
this.state = NOTRENDERING;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
} else if (
|
|
285
|
+
seg.terrainReady &&
|
|
286
|
+
seg.tileZoom < planet.terrain._maxNodeZoom &&
|
|
287
|
+
(!maxZoom || maxZoom && cam.projectedSize(seg.bsphere.center, seg.bsphere.radius) > this.planet._maxLodSize)) {
|
|
303
288
|
this.traverseNodes(cam, maxZoom, seg, stopLoading);
|
|
289
|
+
} else if (altVis) {
|
|
290
|
+
seg.passReady = maxZoom ? seg.terrainReady : false;
|
|
291
|
+
this.renderNode(this.inFrustum, !this.inFrustum, terrainReadySegment, stopLoading);
|
|
304
292
|
} else {
|
|
305
|
-
this.
|
|
293
|
+
this.state = NOTRENDERING;
|
|
306
294
|
}
|
|
307
295
|
} else {
|
|
308
296
|
this.state = NOTRENDERING;
|
|
@@ -322,39 +310,6 @@ class Node {
|
|
|
322
310
|
n[3].renderTree(cam, maxZoom, terrainReadySegment, stopLoading);
|
|
323
311
|
}
|
|
324
312
|
|
|
325
|
-
prepareForRendering(
|
|
326
|
-
cam,
|
|
327
|
-
altVis,
|
|
328
|
-
inFrustum,
|
|
329
|
-
terrainReadySegment,
|
|
330
|
-
stopLoading
|
|
331
|
-
) {
|
|
332
|
-
let seg = this.segment;
|
|
333
|
-
|
|
334
|
-
if (cam._lonLat.height < VISIBLE_HEIGHT) {
|
|
335
|
-
if (altVis) {
|
|
336
|
-
this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
|
|
337
|
-
} else {
|
|
338
|
-
this.state = NOTRENDERING;
|
|
339
|
-
}
|
|
340
|
-
} else {
|
|
341
|
-
if (seg.tileZoom < 2) {
|
|
342
|
-
this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
|
|
343
|
-
} else if (seg.tileZoom > MAX_NORMAL_ZOOM) {
|
|
344
|
-
this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
|
|
345
|
-
} else if (
|
|
346
|
-
seg._swNorm.dot(cam._n) > 0.0 ||
|
|
347
|
-
seg._nwNorm.dot(cam._n) > 0.0 ||
|
|
348
|
-
seg._neNorm.dot(cam._n) > 0.0 ||
|
|
349
|
-
seg._seNorm.dot(cam._n) > 0.0
|
|
350
|
-
) {
|
|
351
|
-
this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
|
|
352
|
-
} else {
|
|
353
|
-
this.state = NOTRENDERING;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
313
|
renderNode(inFrustum, onlyTerrain, terrainReadySegment, stopLoading) {
|
|
359
314
|
var seg = this.segment;
|
|
360
315
|
|
|
@@ -376,7 +331,7 @@ class Node {
|
|
|
376
331
|
}
|
|
377
332
|
|
|
378
333
|
// Create normal map texture
|
|
379
|
-
if (seg.planet.lightEnabled && !seg.normalMapReady
|
|
334
|
+
if (seg.planet.lightEnabled && !seg.normalMapReady /*&& !seg.parentNormalMapReady*/) {
|
|
380
335
|
this.whileNormalMapCreating();
|
|
381
336
|
}
|
|
382
337
|
|
|
@@ -210,8 +210,6 @@ class Renderer {
|
|
|
210
210
|
|
|
211
211
|
this._currentOutput = "screen";
|
|
212
212
|
|
|
213
|
-
this.isActiveBackbuffers = true;
|
|
214
|
-
|
|
215
213
|
this.labelWorker = new LabelWorker();
|
|
216
214
|
}
|
|
217
215
|
|
|
@@ -481,8 +479,8 @@ class Renderer {
|
|
|
481
479
|
}
|
|
482
480
|
|
|
483
481
|
this.handler.onCanvasResize = () => {
|
|
482
|
+
this.resize();
|
|
484
483
|
this.events.dispatch(this.events.resize, this.handler.canvas);
|
|
485
|
-
this._resize();
|
|
486
484
|
};
|
|
487
485
|
|
|
488
486
|
this._screenFrameCornersBuffer = this.handler.createArrayBuffer(
|
|
@@ -509,7 +507,7 @@ class Renderer {
|
|
|
509
507
|
}
|
|
510
508
|
}
|
|
511
509
|
|
|
512
|
-
|
|
510
|
+
resize() {
|
|
513
511
|
let c = this.handler.canvas;
|
|
514
512
|
this.activeCamera.setAspectRatio(c.width / c.height);
|
|
515
513
|
this.sceneFramebuffer.setSize(c.width, c.height);
|
|
@@ -744,7 +742,7 @@ class Renderer {
|
|
|
744
742
|
|
|
745
743
|
let frustums = this.activeCamera.frustums;
|
|
746
744
|
|
|
747
|
-
let anyEvent = this.events.mouseState.anyEvent()
|
|
745
|
+
let anyEvent = this.events.mouseState.anyEvent();
|
|
748
746
|
|
|
749
747
|
// Rendering scene nodes and entityCollections
|
|
750
748
|
let rn = this._renderNodesArr;
|