@openglobus/og 0.16.3 → 0.17.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 +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +2 -6
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +93 -56
- package/src/og/ImageCanvas.js +13 -6
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +1 -5
- package/src/og/Object3d.js +2 -2
- package/src/og/QueueArray.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/Frustum.js +4 -4
- package/src/og/camera/PlanetCamera.js +15 -22
- package/src/og/cons.js +1 -1
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +3 -7
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/EarthNavigation.js +6 -13
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +12 -16
- package/src/og/control/MouseNavigation.js +1 -5
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +7 -7
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +236 -325
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +3 -7
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +14 -18
- package/src/og/entity/GeoObject.js +6 -8
- package/src/og/entity/GeoObjectHandler.js +30 -24
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +18 -19
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +10 -14
- package/src/og/entity/LabelWorker.js +1 -1
- package/src/og/entity/PointCloud.js +2 -6
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +15 -17
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/RayHandler.js +2 -2
- package/src/og/entity/Strip.js +1 -1
- package/src/og/entity/StripHandler.js +2 -2
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +6 -9
- package/src/og/layer/CanvasTiles.js +1 -5
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +1 -0
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +25 -22
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +5 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +42 -10
- package/src/og/mercator.js +1 -1
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Node.js +15 -14
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +114 -27
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +1 -5
- package/src/og/scene/Planet.js +127 -130
- package/src/og/scene/RenderNode.js +20 -12
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +10 -6
- package/src/og/segment/SegmentLonLat.js +3 -7
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/atmos.js +1 -1
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +2 -3
- package/src/og/utils/NormalMapCreator.js +11 -12
- package/src/og/utils/PlainSegmentWorker.js +9 -9
- package/src/og/utils/TerrainWorker.js +2 -2
- package/src/og/utils/TextureAtlas.js +1 -1
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/earcut.js +8 -8
- package/src/og/utils/shared.js +30 -11
- package/src/og/webgl/Framebuffer.js +2 -6
- package/src/og/webgl/Handler.js +46 -20
- package/src/og/webgl/Multisample.js +2 -6
- package/src/og/webgl/Program.js +4 -8
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +53 -64
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/GeoObject.d.ts +1 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math/Vec3.d.ts +2 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +27 -26
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
package/src/og/scene/Planet.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/scene/Planet
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
"use strict";
|
|
6
2
|
|
|
7
3
|
import { PlanetCamera } from "../camera/PlanetCamera.js";
|
|
@@ -50,10 +46,11 @@ const MAX_NODES = 200;
|
|
|
50
46
|
|
|
51
47
|
const HORIZON_TANGENT = 0.81;
|
|
52
48
|
|
|
53
|
-
const EVENT_NAMES = [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const EVENT_NAMES = [
|
|
50
|
+
/**
|
|
51
|
+
* Triggered before globe frame begins to render.
|
|
52
|
+
* @event og.scene.Planet#draw
|
|
53
|
+
*/
|
|
57
54
|
"draw",
|
|
58
55
|
|
|
59
56
|
/**
|
|
@@ -96,7 +93,8 @@ const EVENT_NAMES = [/**
|
|
|
96
93
|
* Triggered when layer data is laded
|
|
97
94
|
* @event og.scene.Planet#terraincompleted
|
|
98
95
|
*/
|
|
99
|
-
"layerloadend"
|
|
96
|
+
"layerloadend"
|
|
97
|
+
];
|
|
100
98
|
|
|
101
99
|
/**
|
|
102
100
|
* Main class for rendering planet
|
|
@@ -119,7 +117,7 @@ export class Planet extends RenderNode {
|
|
|
119
117
|
constructor(options = {}) {
|
|
120
118
|
super(options.name);
|
|
121
119
|
|
|
122
|
-
this._cameraFrustums = options.frustums || [[1, 100
|
|
120
|
+
this._cameraFrustums = options.frustums || [[1, 100], [100, 1000 + 7.0], [1000 - 7.0, 1e6 + 17], [1e6 - 17, 1e9]];
|
|
123
121
|
|
|
124
122
|
/**
|
|
125
123
|
* @public
|
|
@@ -198,15 +196,22 @@ export class Planet extends RenderNode {
|
|
|
198
196
|
*/
|
|
199
197
|
this._terrainPool = null;
|
|
200
198
|
|
|
199
|
+
this._minAltitude = options.minAltitude;
|
|
200
|
+
this._maxAltitude = options.maxAltitude;
|
|
201
|
+
|
|
201
202
|
/**
|
|
202
203
|
* Camera is this.renderer.activeCamera pointer.
|
|
203
204
|
* @public
|
|
204
205
|
* @type {PlanetCamera}
|
|
205
206
|
*/
|
|
206
|
-
this.camera =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
this.camera = new PlanetCamera(this, {
|
|
208
|
+
frustums: this._cameraFrustums,
|
|
209
|
+
eye: new Vec3(25000000, 0, 0),
|
|
210
|
+
look: Vec3.ZERO,
|
|
211
|
+
up: Vec3.NORTH,
|
|
212
|
+
minAltitude: this._minAltitude,
|
|
213
|
+
maxAltitude: this._maxAltitude
|
|
214
|
+
});
|
|
210
215
|
|
|
211
216
|
this.maxEqualZoomAltitude = options.maxEqualZoomAltitude || 15000000.0;
|
|
212
217
|
this.minEqualZoomAltitude = options.minEqualZoomAltitude || 10000.0;
|
|
@@ -239,6 +244,8 @@ export class Planet extends RenderNode {
|
|
|
239
244
|
|
|
240
245
|
this._viewExtent = new Extent(new LonLat(180, 180), new LonLat(-180, -180));
|
|
241
246
|
|
|
247
|
+
this._initialViewExtent = null;
|
|
248
|
+
|
|
242
249
|
/**
|
|
243
250
|
* @protected
|
|
244
251
|
*/
|
|
@@ -287,12 +294,6 @@ export class Planet extends RenderNode {
|
|
|
287
294
|
*/
|
|
288
295
|
this.terrainLock = new Lock();
|
|
289
296
|
|
|
290
|
-
/**
|
|
291
|
-
* Layer's transparent colors.
|
|
292
|
-
* @protected
|
|
293
|
-
*/
|
|
294
|
-
this._tcolorArr = [];
|
|
295
|
-
|
|
296
297
|
/**
|
|
297
298
|
* Height scale factor. 1 - is normal elevation scale.
|
|
298
299
|
* @protected
|
|
@@ -354,7 +355,7 @@ export class Planet extends RenderNode {
|
|
|
354
355
|
*/
|
|
355
356
|
this._useSpecularTexture = isUndef(options.useSpecularTexture) ? true : options.useSpecularTexture;
|
|
356
357
|
|
|
357
|
-
this._maxGridSize = Math.log2(options.maxGridSize ||
|
|
358
|
+
this._maxGridSize = Math.log2(options.maxGridSize || 128);
|
|
358
359
|
|
|
359
360
|
/**
|
|
360
361
|
* Segment multiple textures size.(4 - convinient value for the most devices)
|
|
@@ -382,13 +383,23 @@ export class Planet extends RenderNode {
|
|
|
382
383
|
/**
|
|
383
384
|
* GeoImage creator.
|
|
384
385
|
* @protected
|
|
385
|
-
* @type{
|
|
386
|
+
* @type{GeoImageCreator}
|
|
386
387
|
*/
|
|
387
|
-
this._geoImageCreator =
|
|
388
|
+
this._geoImageCreator = new GeoImageCreator(this);
|
|
388
389
|
|
|
389
|
-
|
|
390
|
+
/**
|
|
391
|
+
* VectorTileCreator creator.
|
|
392
|
+
* @protected
|
|
393
|
+
* @type{VectorTileCreator}
|
|
394
|
+
*/
|
|
395
|
+
this._vectorTileCreator = new VectorTileCreator(this);
|
|
390
396
|
|
|
391
|
-
|
|
397
|
+
/**
|
|
398
|
+
* NormalMapCreator creator.
|
|
399
|
+
* @protected
|
|
400
|
+
* @type{NormalMapCreator}
|
|
401
|
+
*/
|
|
402
|
+
this._normalMapCreator = new NormalMapCreator(this);
|
|
392
403
|
|
|
393
404
|
this._terrainWorker = new TerrainWorker(3);
|
|
394
405
|
|
|
@@ -427,13 +438,8 @@ export class Planet extends RenderNode {
|
|
|
427
438
|
this._atmosphereMaxMinOpacity = new Float32Array([1.0, 0.41]);
|
|
428
439
|
}
|
|
429
440
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
// TODO: fix normal for ellipsoid
|
|
433
|
-
//
|
|
434
|
-
let n = cartesian.normal();
|
|
435
|
-
let t = Vec3.proj_b_to_plane(Vec3.UNIT_Y, n);
|
|
436
|
-
return Quat.getLookRotation(t, n);
|
|
441
|
+
getNorthFrameRotation(cartesian) {
|
|
442
|
+
return this.ellipsoid.getNorthFrameRotation(cartesian);
|
|
437
443
|
}
|
|
438
444
|
|
|
439
445
|
set atmosphereMaxOpacity(opacity) {
|
|
@@ -521,7 +527,7 @@ export class Planet extends RenderNode {
|
|
|
521
527
|
* @param {Array.<control.Control>} cArr - Control array.
|
|
522
528
|
*/
|
|
523
529
|
addControls(cArr) {
|
|
524
|
-
for (
|
|
530
|
+
for (let i = 0; i < cArr.length; i++) {
|
|
525
531
|
this.addControl(cArr[i]);
|
|
526
532
|
}
|
|
527
533
|
}
|
|
@@ -759,17 +765,18 @@ export class Planet extends RenderNode {
|
|
|
759
765
|
// Initialization indexes table
|
|
760
766
|
segmentHelper.getInstance().setMaxGridSize(this._maxGridSize);
|
|
761
767
|
const TABLESIZE = this._maxGridSize;
|
|
768
|
+
|
|
762
769
|
let kk = 0;
|
|
763
770
|
// Initialization indexes buffers cache. It takes about 120mb RAM!
|
|
764
|
-
for (
|
|
771
|
+
for (let i = 0; i <= TABLESIZE; i++) {
|
|
765
772
|
!this._indexesCache[i] && (this._indexesCache[i] = new Array(TABLESIZE));
|
|
766
|
-
for (
|
|
773
|
+
for (let j = 0; j <= TABLESIZE; j++) {
|
|
767
774
|
!this._indexesCache[i][j] && (this._indexesCache[i][j] = new Array(TABLESIZE));
|
|
768
|
-
for (
|
|
775
|
+
for (let k = 0; k <= TABLESIZE; k++) {
|
|
769
776
|
!this._indexesCache[i][j][k] && (this._indexesCache[i][j][k] = new Array(TABLESIZE));
|
|
770
|
-
for (
|
|
777
|
+
for (let m = 0; m <= TABLESIZE; m++) {
|
|
771
778
|
!this._indexesCache[i][j][k][m] && (this._indexesCache[i][j][k][m] = new Array(TABLESIZE));
|
|
772
|
-
for (
|
|
779
|
+
for (let q = 0; q <= TABLESIZE; q++) {
|
|
773
780
|
let ptr = {
|
|
774
781
|
buffer: null
|
|
775
782
|
};
|
|
@@ -816,17 +823,6 @@ export class Planet extends RenderNode {
|
|
|
816
823
|
|
|
817
824
|
this.transparentTexture = this.renderer.handler.transparentTexture;
|
|
818
825
|
|
|
819
|
-
this.camera = this.renderer.activeCamera = new PlanetCamera(this, {
|
|
820
|
-
frustums: this._cameraFrustums,
|
|
821
|
-
eye: new Vec3(0, 0, 28000000),
|
|
822
|
-
look: new Vec3(0, 0, 0),
|
|
823
|
-
up: new Vec3(0, 1, 0),
|
|
824
|
-
minAltitude: this._minAltitude,
|
|
825
|
-
maxAltitude: this._maxAltitude
|
|
826
|
-
});
|
|
827
|
-
|
|
828
|
-
this.camera.update();
|
|
829
|
-
|
|
830
826
|
this._renderedNodesInFrustum = new Array(this.camera.frustums.length);
|
|
831
827
|
for (let i = 0, len = this._renderedNodesInFrustum.length; i < len; i++) {
|
|
832
828
|
this._renderedNodesInFrustum[i] = [];
|
|
@@ -856,26 +852,44 @@ export class Planet extends RenderNode {
|
|
|
856
852
|
createImageBitmap(SPECULAR).then((e) => (this._specularTexture = this.renderer.handler.createTexture_l(e)));
|
|
857
853
|
}
|
|
858
854
|
|
|
859
|
-
this._geoImageCreator
|
|
855
|
+
this._geoImageCreator.init();
|
|
860
856
|
|
|
861
|
-
this._vectorTileCreator
|
|
857
|
+
this._vectorTileCreator.init();
|
|
862
858
|
|
|
863
|
-
this._normalMapCreator
|
|
864
|
-
minTableSize: 1,
|
|
865
|
-
maxTableSize: TABLESIZE,
|
|
866
|
-
blur: this.terrain && (this.terrain.blur != undefined ? this.terrain.blur : true)
|
|
867
|
-
});
|
|
859
|
+
this._normalMapCreator.init();
|
|
868
860
|
|
|
869
861
|
this.renderer.events.on("draw", this._globalPreDraw, this, -100);
|
|
870
862
|
|
|
871
863
|
// Loading first nodes for better viewing if you have started on a lower altitude.
|
|
872
864
|
this._preRender();
|
|
873
865
|
|
|
874
|
-
this._initialized = true;
|
|
875
|
-
|
|
876
866
|
this.renderer.events.on("postdraw", () => {
|
|
877
867
|
this._checkRendercompleted();
|
|
878
868
|
});
|
|
869
|
+
|
|
870
|
+
this.initLayers();
|
|
871
|
+
|
|
872
|
+
this._initialized = true;
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
//
|
|
876
|
+
// after init
|
|
877
|
+
//
|
|
878
|
+
if (this._initialViewExtent) {
|
|
879
|
+
this.viewExtent(this._initialViewExtent);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
this.renderer.activeCamera = this.camera;
|
|
883
|
+
this.camera.bindRenderer(this.renderer);
|
|
884
|
+
this.camera.update();
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
initLayers() {
|
|
888
|
+
let temp = [...this._layers];
|
|
889
|
+
for (let i = 0; i < temp.length; i++) {
|
|
890
|
+
this.removeLayer(temp[i]);
|
|
891
|
+
this.addLayer(temp[i]);
|
|
892
|
+
}
|
|
879
893
|
}
|
|
880
894
|
|
|
881
895
|
clearIndexesCache() {
|
|
@@ -1084,7 +1098,7 @@ export class Planet extends RenderNode {
|
|
|
1084
1098
|
this._clearRenderNodesInFrustum();
|
|
1085
1099
|
this._renderedNodes = [];
|
|
1086
1100
|
|
|
1087
|
-
for (
|
|
1101
|
+
for (let i = 0, len = temp.length; i < len; i++) {
|
|
1088
1102
|
var ri = temp[i];
|
|
1089
1103
|
let ht = ri.segment.centerNormal.dot(cam._b);
|
|
1090
1104
|
if (ri.segment.tileZoom === this.maxCurrZoom || ht < HORIZON_TANGENT) {
|
|
@@ -1143,13 +1157,32 @@ export class Planet extends RenderNode {
|
|
|
1143
1157
|
|
|
1144
1158
|
if (this.camera.isFirstPass) {
|
|
1145
1159
|
this.camera.update();
|
|
1146
|
-
|
|
1160
|
+
|
|
1161
|
+
if (this._skipPreRender && this._collectRenderNodesIsActive) {
|
|
1162
|
+
this._collectRenderNodes();
|
|
1163
|
+
}
|
|
1164
|
+
this._skipPreRender = true;
|
|
1165
|
+
|
|
1166
|
+
this.transformLights();
|
|
1167
|
+
|
|
1168
|
+
// creates terrain normal maps
|
|
1169
|
+
this._normalMapCreator.frame();
|
|
1170
|
+
|
|
1171
|
+
// Creating geoImages textures.
|
|
1172
|
+
this._geoImageCreator.frame();
|
|
1173
|
+
|
|
1174
|
+
// Vector tiles rasteriazation
|
|
1175
|
+
this._vectorTileCreator.frame();
|
|
1176
|
+
|
|
1147
1177
|
this.camera.checkTerrainCollision();
|
|
1148
1178
|
this.camera.update();
|
|
1149
1179
|
|
|
1150
1180
|
// Here is the planet node dispatches a draw event before
|
|
1151
1181
|
// rendering begins and we have got render nodes.
|
|
1152
1182
|
this.events.dispatch(this.events.draw, this);
|
|
1183
|
+
|
|
1184
|
+
// Collect entity collections from vector layers
|
|
1185
|
+
this._collectVectorLayerCollections();
|
|
1153
1186
|
}
|
|
1154
1187
|
|
|
1155
1188
|
this.drawEntityCollections(this._frustumEntityCollections);
|
|
@@ -1196,27 +1229,6 @@ export class Planet extends RenderNode {
|
|
|
1196
1229
|
this.camera.setTerrainCollisionActivity(true);
|
|
1197
1230
|
}
|
|
1198
1231
|
|
|
1199
|
-
_firstPASS() {
|
|
1200
|
-
|
|
1201
|
-
if (this._skipPreRender && this._collectRenderNodesIsActive) {
|
|
1202
|
-
this._collectRenderNodes();
|
|
1203
|
-
}
|
|
1204
|
-
this._skipPreRender = true;
|
|
1205
|
-
|
|
1206
|
-
this.transformLights();
|
|
1207
|
-
|
|
1208
|
-
this._normalMapCreator.frame();
|
|
1209
|
-
|
|
1210
|
-
// Creating geoImages textures.
|
|
1211
|
-
this._geoImageCreator.frame();
|
|
1212
|
-
|
|
1213
|
-
// Collect entity collections from vector layers
|
|
1214
|
-
this._collectVectorLayerCollections();
|
|
1215
|
-
|
|
1216
|
-
// Vector tiles rasteriazation
|
|
1217
|
-
this._vectorTileCreator.frame();
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
1232
|
_renderScreenNodesPASSNoAtmos() {
|
|
1221
1233
|
|
|
1222
1234
|
let sh, shu;
|
|
@@ -1229,9 +1241,7 @@ export class Planet extends RenderNode {
|
|
|
1229
1241
|
|
|
1230
1242
|
gl.enable(gl.CULL_FACE);
|
|
1231
1243
|
|
|
1232
|
-
|
|
1233
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
1234
|
-
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1244
|
+
renderer.enableBlendOneSrcAlpha();
|
|
1235
1245
|
|
|
1236
1246
|
if (this.lightEnabled) {
|
|
1237
1247
|
h.programs.drawnode_screen_wl.activate();
|
|
@@ -1286,7 +1296,7 @@ export class Planet extends RenderNode {
|
|
|
1286
1296
|
|
|
1287
1297
|
if (sl.length) {
|
|
1288
1298
|
let sli = sl[0];
|
|
1289
|
-
for (
|
|
1299
|
+
for (let i = sli.length - 1; i >= 0; --i) {
|
|
1290
1300
|
let li = sli[i];
|
|
1291
1301
|
if (li._fading && firstPass && li._refreshFadingOpacity()) {
|
|
1292
1302
|
sli.splice(i, 1);
|
|
@@ -1295,7 +1305,7 @@ export class Planet extends RenderNode {
|
|
|
1295
1305
|
}
|
|
1296
1306
|
|
|
1297
1307
|
let isEq = this.terrain.equalizeVertices;
|
|
1298
|
-
i = rn.length;
|
|
1308
|
+
var i = rn.length;
|
|
1299
1309
|
while (i--) {
|
|
1300
1310
|
let s = rn[i].segment;
|
|
1301
1311
|
isEq && s.equalize();
|
|
@@ -1339,9 +1349,7 @@ export class Planet extends RenderNode {
|
|
|
1339
1349
|
|
|
1340
1350
|
gl.enable(gl.CULL_FACE);
|
|
1341
1351
|
|
|
1342
|
-
|
|
1343
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
1344
|
-
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1352
|
+
renderer.enableBlendOneSrcAlpha();
|
|
1345
1353
|
|
|
1346
1354
|
if (this.lightEnabled) {
|
|
1347
1355
|
h.programs.drawnode_screen_wl.activate();
|
|
@@ -1410,7 +1418,7 @@ export class Planet extends RenderNode {
|
|
|
1410
1418
|
|
|
1411
1419
|
if (sl.length) {
|
|
1412
1420
|
let sli = sl[0];
|
|
1413
|
-
for (
|
|
1421
|
+
for (let i = sli.length - 1; i >= 0; --i) {
|
|
1414
1422
|
let li = sli[i];
|
|
1415
1423
|
if (li._fading && firstPass && li._refreshFadingOpacity()) {
|
|
1416
1424
|
sli.splice(i, 1);
|
|
@@ -1419,7 +1427,7 @@ export class Planet extends RenderNode {
|
|
|
1419
1427
|
}
|
|
1420
1428
|
|
|
1421
1429
|
let isEq = this.terrain.equalizeVertices;
|
|
1422
|
-
i = rn.length;
|
|
1430
|
+
var i = rn.length;
|
|
1423
1431
|
while (i--) {
|
|
1424
1432
|
let s = rn[i].segment;
|
|
1425
1433
|
isEq && s.equalize();
|
|
@@ -1492,9 +1500,10 @@ export class Planet extends RenderNode {
|
|
|
1492
1500
|
let shu = sh.uniforms;
|
|
1493
1501
|
let cam = renderer.activeCamera;
|
|
1494
1502
|
|
|
1495
|
-
|
|
1496
|
-
gl.
|
|
1497
|
-
gl.
|
|
1503
|
+
// Special blend
|
|
1504
|
+
// gl.enable(gl.BLEND);
|
|
1505
|
+
// gl.blendEquation(gl.FUNC_ADD);
|
|
1506
|
+
// gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1498
1507
|
|
|
1499
1508
|
gl.enable(gl.CULL_FACE);
|
|
1500
1509
|
|
|
@@ -1686,8 +1695,8 @@ export class Planet extends RenderNode {
|
|
|
1686
1695
|
* @param {Boolean} [force=false] - Force framebuffer rendering.
|
|
1687
1696
|
* @returns {LonLat} -
|
|
1688
1697
|
*/
|
|
1689
|
-
getLonLatFromPixelTerrain(px
|
|
1690
|
-
var coords = this.getCartesianFromPixelTerrain(px
|
|
1698
|
+
getLonLatFromPixelTerrain(px) {
|
|
1699
|
+
var coords = this.getCartesianFromPixelTerrain(px);
|
|
1691
1700
|
if (coords) {
|
|
1692
1701
|
return this.ellipsoid.cartesianToLonLat(coords);
|
|
1693
1702
|
}
|
|
@@ -1695,7 +1704,7 @@ export class Planet extends RenderNode {
|
|
|
1695
1704
|
}
|
|
1696
1705
|
|
|
1697
1706
|
/**
|
|
1698
|
-
* Returns projected 2d screen coordinates by 3d cartesian
|
|
1707
|
+
* Returns projected 2d screen coordinates by 3d cartesian coordinates.
|
|
1699
1708
|
* @public
|
|
1700
1709
|
* @param {Vec3} coords - Cartesian coordinates.
|
|
1701
1710
|
* @returns {Vec2} -
|
|
@@ -1720,7 +1729,7 @@ export class Planet extends RenderNode {
|
|
|
1720
1729
|
|
|
1721
1730
|
/**
|
|
1722
1731
|
* Returns distance from active camera to the the planet ellipsoid
|
|
1723
|
-
*
|
|
1732
|
+
* coordinates unprojected by 2d screen coordinates, or null if screen coordinates outside the planet.
|
|
1724
1733
|
* @public
|
|
1725
1734
|
* @param {Vec2} px - Screen coordinates.
|
|
1726
1735
|
* @returns {number} -
|
|
@@ -1731,8 +1740,8 @@ export class Planet extends RenderNode {
|
|
|
1731
1740
|
}
|
|
1732
1741
|
|
|
1733
1742
|
/**
|
|
1734
|
-
* Returns distance from active camera to the the relief planet
|
|
1735
|
-
* by 2d screen
|
|
1743
|
+
* Returns distance from active camera to the the relief planet coordinates unprojected
|
|
1744
|
+
* by 2d screen coordinates, or null if screen coordinates outside the planet.
|
|
1736
1745
|
* If screen coordinates inside the planet but relief is not exists in the
|
|
1737
1746
|
* point than function returns distance to the planet ellipsoid.
|
|
1738
1747
|
* @public
|
|
@@ -1784,7 +1793,11 @@ export class Planet extends RenderNode {
|
|
|
1784
1793
|
* @param {Extent} extent - Geographical extent.
|
|
1785
1794
|
*/
|
|
1786
1795
|
viewExtent(extent) {
|
|
1787
|
-
this.
|
|
1796
|
+
if (this.camera) {
|
|
1797
|
+
this.camera.viewExtent(extent);
|
|
1798
|
+
} else {
|
|
1799
|
+
this._initialViewExtent = extent;
|
|
1800
|
+
}
|
|
1788
1801
|
}
|
|
1789
1802
|
|
|
1790
1803
|
/**
|
|
@@ -1794,7 +1807,7 @@ export class Planet extends RenderNode {
|
|
|
1794
1807
|
* where index 0 - southwest longitude, 1 - latitude southwest, 2 - longitude northeast, 3 - latitude northeast.
|
|
1795
1808
|
*/
|
|
1796
1809
|
viewExtentArr(extentArr) {
|
|
1797
|
-
this.
|
|
1810
|
+
this.viewExtent(new Extent(new LonLat(extentArr[0], extentArr[1]), new LonLat(extentArr[2], extentArr[3])));
|
|
1798
1811
|
}
|
|
1799
1812
|
|
|
1800
1813
|
/**
|
|
@@ -1804,28 +1817,6 @@ export class Planet extends RenderNode {
|
|
|
1804
1817
|
*/
|
|
1805
1818
|
getViewExtent() {
|
|
1806
1819
|
return this._viewExtent;
|
|
1807
|
-
// if (this._viewExtentMerc) {
|
|
1808
|
-
// var ne = this._viewExtentMerc.northEast.inverseMercator(),
|
|
1809
|
-
// sw = this._viewExtentMerc.southWest.inverseMercator();
|
|
1810
|
-
// if (this._viewExtentWGS84) {
|
|
1811
|
-
// var e = this._viewExtentWGS84;
|
|
1812
|
-
// if (e.northEast.lon > ne.lon) {
|
|
1813
|
-
// ne.lon = e.northEast.lon;
|
|
1814
|
-
// }
|
|
1815
|
-
// if (e.northEast.lat > ne.lat) {
|
|
1816
|
-
// ne.lat = e.northEast.lat;
|
|
1817
|
-
// }
|
|
1818
|
-
// if (e.southWest.lon < sw.lon) {
|
|
1819
|
-
// sw.lon = e.southWest.lon;
|
|
1820
|
-
// }
|
|
1821
|
-
// if (e.southWest.lat < sw.lat) {
|
|
1822
|
-
// sw.lat = e.southWest.lat;
|
|
1823
|
-
// }
|
|
1824
|
-
// }
|
|
1825
|
-
// return new Extent(sw, ne);
|
|
1826
|
-
// } else if (this._viewExtentWGS84) {
|
|
1827
|
-
// return this._viewExtentWGS84;
|
|
1828
|
-
// }
|
|
1829
1820
|
}
|
|
1830
1821
|
|
|
1831
1822
|
/**
|
|
@@ -1849,13 +1840,13 @@ export class Planet extends RenderNode {
|
|
|
1849
1840
|
* @param {cameraCallback} [completeCallback] - Callback that calls befor the flying begins.
|
|
1850
1841
|
*/
|
|
1851
1842
|
flyExtent(extent, height, up, ampl, completeCallback, startCallback) {
|
|
1852
|
-
this.
|
|
1843
|
+
this.camera.flyExtent(extent, height, up, ampl, completeCallback, startCallback);
|
|
1853
1844
|
}
|
|
1854
1845
|
|
|
1855
1846
|
/**
|
|
1856
1847
|
* Fly camera to the new point.
|
|
1857
1848
|
* @public
|
|
1858
|
-
* @param {Vec3} cartesian - Fly
|
|
1849
|
+
* @param {Vec3} cartesian - Fly coordinates.
|
|
1859
1850
|
* @param {Vec3} [look] - Camera "look at" point.
|
|
1860
1851
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1861
1852
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
@@ -1864,13 +1855,13 @@ export class Planet extends RenderNode {
|
|
|
1864
1855
|
* @param [frameCallback]
|
|
1865
1856
|
*/
|
|
1866
1857
|
flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback) {
|
|
1867
|
-
this.
|
|
1858
|
+
this.camera.flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback);
|
|
1868
1859
|
}
|
|
1869
1860
|
|
|
1870
1861
|
/**
|
|
1871
1862
|
* Fly camera to the new geographical position.
|
|
1872
1863
|
* @public
|
|
1873
|
-
* @param {LonLat} lonlat - Fly geographical
|
|
1864
|
+
* @param {LonLat} lonlat - Fly geographical coordinates.
|
|
1874
1865
|
* @param {Vec3} [look] - Camera "look at" point on the end of a flying.
|
|
1875
1866
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1876
1867
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
@@ -1879,7 +1870,7 @@ export class Planet extends RenderNode {
|
|
|
1879
1870
|
* @param [frameCallback]
|
|
1880
1871
|
*/
|
|
1881
1872
|
flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback) {
|
|
1882
|
-
this.
|
|
1873
|
+
this.camera.flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback);
|
|
1883
1874
|
}
|
|
1884
1875
|
|
|
1885
1876
|
/**
|
|
@@ -1887,7 +1878,7 @@ export class Planet extends RenderNode {
|
|
|
1887
1878
|
* @public
|
|
1888
1879
|
*/
|
|
1889
1880
|
stopFlying() {
|
|
1890
|
-
this.
|
|
1881
|
+
this.camera.stopFlying();
|
|
1891
1882
|
}
|
|
1892
1883
|
|
|
1893
1884
|
updateBillboardsTexCoords() {
|
|
@@ -1933,4 +1924,10 @@ export class Planet extends RenderNode {
|
|
|
1933
1924
|
});
|
|
1934
1925
|
});
|
|
1935
1926
|
}
|
|
1927
|
+
|
|
1928
|
+
onremove() {
|
|
1929
|
+
this.memClear();
|
|
1930
|
+
this.quadTreeStrategy.destroyBranches();
|
|
1931
|
+
this._renderedNodes = [];
|
|
1932
|
+
}
|
|
1936
1933
|
}
|
|
@@ -82,12 +82,20 @@ class RenderNode extends BaseNode {
|
|
|
82
82
|
assign(renderer) {
|
|
83
83
|
this.renderer = renderer;
|
|
84
84
|
this._pickingId = renderer.addPickingCallback(this, this._entityCollectionPickingCallback);
|
|
85
|
+
this.initialize();
|
|
86
|
+
}
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
initialize() {
|
|
89
|
+
if (this.renderer.isInitialized()) {
|
|
90
|
+
for (let i = 0; i < this.entityCollections.length; i++) {
|
|
91
|
+
this.entityCollections[i].bindRenderNode(this);
|
|
92
|
+
}
|
|
93
|
+
this.init();
|
|
88
94
|
}
|
|
95
|
+
}
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
init() {
|
|
98
|
+
//virtual
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
onremove() {
|
|
@@ -104,7 +112,7 @@ class RenderNode extends BaseNode {
|
|
|
104
112
|
delete r.renderNodes[n];
|
|
105
113
|
}
|
|
106
114
|
|
|
107
|
-
for (
|
|
115
|
+
for (let i = 0; i < r._renderNodesArr.length; i++) {
|
|
108
116
|
if (r._renderNodesArr[i].isEqual(this)) {
|
|
109
117
|
r._renderNodesArr.splice(i, 1);
|
|
110
118
|
break;
|
|
@@ -216,7 +224,7 @@ class RenderNode extends BaseNode {
|
|
|
216
224
|
}
|
|
217
225
|
}
|
|
218
226
|
|
|
219
|
-
for (
|
|
227
|
+
for (let i = 0; i < this.childNodes.length; i++) {
|
|
220
228
|
this.childNodes[i].setActive(isActive);
|
|
221
229
|
}
|
|
222
230
|
}
|
|
@@ -228,7 +236,7 @@ class RenderNode extends BaseNode {
|
|
|
228
236
|
*/
|
|
229
237
|
setDrawMode(mode) {
|
|
230
238
|
this.drawMode = mode;
|
|
231
|
-
for (
|
|
239
|
+
for (let i = 0; i < this.childNodes.length; i++) {
|
|
232
240
|
this.childNodes[i].setDrawMode(mode);
|
|
233
241
|
}
|
|
234
242
|
}
|
|
@@ -239,7 +247,7 @@ class RenderNode extends BaseNode {
|
|
|
239
247
|
*/
|
|
240
248
|
transformLights() {
|
|
241
249
|
var r = this.renderer;
|
|
242
|
-
for (
|
|
250
|
+
for (let i = 0; i < this._lights.length; i++) {
|
|
243
251
|
var ii = i * 3;
|
|
244
252
|
var tp;
|
|
245
253
|
tp = this._lights[i]._position;
|
|
@@ -248,7 +256,7 @@ class RenderNode extends BaseNode {
|
|
|
248
256
|
this._lightsPositions[ii + 2] = tp.z;
|
|
249
257
|
}
|
|
250
258
|
|
|
251
|
-
// for (
|
|
259
|
+
// for (let i = 0; i < this._lights.length; i++) {
|
|
252
260
|
// var ii = i * 4;
|
|
253
261
|
// var tp;
|
|
254
262
|
// if (this._lights[i].directional) {
|
|
@@ -265,13 +273,13 @@ class RenderNode extends BaseNode {
|
|
|
265
273
|
}
|
|
266
274
|
|
|
267
275
|
updateBillboardsTexCoords() {
|
|
268
|
-
for (
|
|
276
|
+
for (let i = 0; i < this.entityCollections.length; i++) {
|
|
269
277
|
this.entityCollections[i].billboardHandler.refreshTexCoordsArr();
|
|
270
278
|
}
|
|
271
279
|
}
|
|
272
280
|
|
|
273
281
|
updateGeoObjectsTexCoords() {
|
|
274
|
-
for (
|
|
282
|
+
for (let i = 0; i < this.entityCollections.length; i++) {
|
|
275
283
|
this.entityCollections[i].geoObjectHandler.refreshTexCoordsArr();
|
|
276
284
|
}
|
|
277
285
|
}
|
|
@@ -288,7 +296,7 @@ class RenderNode extends BaseNode {
|
|
|
288
296
|
* @private
|
|
289
297
|
*/
|
|
290
298
|
_preDrawNodes() {
|
|
291
|
-
for (
|
|
299
|
+
for (let i = 0; i < this.childNodes.length; i++) {
|
|
292
300
|
if (this.childNodes[i]._isActive) {
|
|
293
301
|
this.childNodes[i]._preDrawNodes();
|
|
294
302
|
}
|
|
@@ -305,7 +313,7 @@ class RenderNode extends BaseNode {
|
|
|
305
313
|
* @private
|
|
306
314
|
*/
|
|
307
315
|
_drawNodes() {
|
|
308
|
-
for (
|
|
316
|
+
for (let i = 0; i < this.childNodes.length; i++) {
|
|
309
317
|
if (this.childNodes[i]._isActive) {
|
|
310
318
|
this.childNodes[i]._drawNodes();
|
|
311
319
|
}
|