@openglobus/og 0.16.2 → 0.17.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/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 +0 -4
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +92 -55
- package/src/og/ImageCanvas.js +12 -5
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +0 -4
- package/src/og/Object3d.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/PlanetCamera.js +8 -15
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +0 -4
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- 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 +11 -15
- package/src/og/control/MouseNavigation.js +0 -4
- 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 +5 -5
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +205 -275
- 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 +0 -4
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +7 -11
- package/src/og/entity/GeoObject.js +0 -4
- package/src/og/entity/GeoObjectHandler.js +0 -4
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +3 -4
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +0 -4
- package/src/og/entity/PointCloud.js +0 -4
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +4 -6
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/Strip.js +1 -1
- 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 +5 -8
- package/src/og/layer/CanvasTiles.js +0 -4
- 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 +2 -3
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +23 -20
- 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 +0 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +39 -7
- 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/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +109 -22
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +0 -4
- package/src/og/scene/Planet.js +114 -112
- package/src/og/scene/RenderNode.js +11 -3
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +8 -4
- package/src/og/segment/SegmentLonLat.js +2 -6
- package/src/og/segment/segmentHelper.js +229 -225
- 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 +1 -2
- package/src/og/utils/NormalMapCreator.js +8 -9
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/shared.js +20 -1
- package/src/og/webgl/Framebuffer.js +0 -4
- package/src/og/webgl/Handler.js +45 -19
- package/src/og/webgl/Multisample.js +0 -4
- package/src/og/webgl/Program.js +0 -4
- 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 +50 -63
- package/types/entity/Entity.d.ts +3 -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.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 +26 -24
- 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(0, 0, 28000000),
|
|
210
|
+
look: new Vec3(0, 0, 0),
|
|
211
|
+
up: new Vec3(0, 1, 0),
|
|
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
|
|
|
@@ -759,6 +770,7 @@ export class Planet extends RenderNode {
|
|
|
759
770
|
// Initialization indexes table
|
|
760
771
|
segmentHelper.getInstance().setMaxGridSize(this._maxGridSize);
|
|
761
772
|
const TABLESIZE = this._maxGridSize;
|
|
773
|
+
|
|
762
774
|
let kk = 0;
|
|
763
775
|
// Initialization indexes buffers cache. It takes about 120mb RAM!
|
|
764
776
|
for (var i = 0; i <= TABLESIZE; i++) {
|
|
@@ -816,17 +828,6 @@ export class Planet extends RenderNode {
|
|
|
816
828
|
|
|
817
829
|
this.transparentTexture = this.renderer.handler.transparentTexture;
|
|
818
830
|
|
|
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
831
|
this._renderedNodesInFrustum = new Array(this.camera.frustums.length);
|
|
831
832
|
for (let i = 0, len = this._renderedNodesInFrustum.length; i < len; i++) {
|
|
832
833
|
this._renderedNodesInFrustum[i] = [];
|
|
@@ -856,26 +857,44 @@ export class Planet extends RenderNode {
|
|
|
856
857
|
createImageBitmap(SPECULAR).then((e) => (this._specularTexture = this.renderer.handler.createTexture_l(e)));
|
|
857
858
|
}
|
|
858
859
|
|
|
859
|
-
this._geoImageCreator
|
|
860
|
+
this._geoImageCreator.init();
|
|
860
861
|
|
|
861
|
-
this._vectorTileCreator
|
|
862
|
+
this._vectorTileCreator.init();
|
|
862
863
|
|
|
863
|
-
this._normalMapCreator
|
|
864
|
-
minTableSize: 1,
|
|
865
|
-
maxTableSize: TABLESIZE,
|
|
866
|
-
blur: this.terrain && (this.terrain.blur != undefined ? this.terrain.blur : true)
|
|
867
|
-
});
|
|
864
|
+
this._normalMapCreator.init();
|
|
868
865
|
|
|
869
866
|
this.renderer.events.on("draw", this._globalPreDraw, this, -100);
|
|
870
867
|
|
|
871
868
|
// Loading first nodes for better viewing if you have started on a lower altitude.
|
|
872
869
|
this._preRender();
|
|
873
870
|
|
|
874
|
-
this._initialized = true;
|
|
875
|
-
|
|
876
871
|
this.renderer.events.on("postdraw", () => {
|
|
877
872
|
this._checkRendercompleted();
|
|
878
873
|
});
|
|
874
|
+
|
|
875
|
+
this.initLayers();
|
|
876
|
+
|
|
877
|
+
this._initialized = true;
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
//
|
|
881
|
+
// after init
|
|
882
|
+
//
|
|
883
|
+
if (this._initialViewExtent) {
|
|
884
|
+
this.viewExtent(this._initialViewExtent);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
this.renderer.activeCamera = this.camera;
|
|
888
|
+
this.camera.bindRenderer(this.renderer);
|
|
889
|
+
this.camera.update();
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
initLayers() {
|
|
893
|
+
let temp = [...this._layers];
|
|
894
|
+
for (let i = 0; i < temp.length; i++) {
|
|
895
|
+
this.removeLayer(temp[i]);
|
|
896
|
+
this.addLayer(temp[i]);
|
|
897
|
+
}
|
|
879
898
|
}
|
|
880
899
|
|
|
881
900
|
clearIndexesCache() {
|
|
@@ -1143,13 +1162,32 @@ export class Planet extends RenderNode {
|
|
|
1143
1162
|
|
|
1144
1163
|
if (this.camera.isFirstPass) {
|
|
1145
1164
|
this.camera.update();
|
|
1146
|
-
|
|
1165
|
+
|
|
1166
|
+
if (this._skipPreRender && this._collectRenderNodesIsActive) {
|
|
1167
|
+
this._collectRenderNodes();
|
|
1168
|
+
}
|
|
1169
|
+
this._skipPreRender = true;
|
|
1170
|
+
|
|
1171
|
+
this.transformLights();
|
|
1172
|
+
|
|
1173
|
+
// creates terrain normal maps
|
|
1174
|
+
this._normalMapCreator.frame();
|
|
1175
|
+
|
|
1176
|
+
// Creating geoImages textures.
|
|
1177
|
+
this._geoImageCreator.frame();
|
|
1178
|
+
|
|
1179
|
+
// Vector tiles rasteriazation
|
|
1180
|
+
this._vectorTileCreator.frame();
|
|
1181
|
+
|
|
1147
1182
|
this.camera.checkTerrainCollision();
|
|
1148
1183
|
this.camera.update();
|
|
1149
1184
|
|
|
1150
1185
|
// Here is the planet node dispatches a draw event before
|
|
1151
1186
|
// rendering begins and we have got render nodes.
|
|
1152
1187
|
this.events.dispatch(this.events.draw, this);
|
|
1188
|
+
|
|
1189
|
+
// Collect entity collections from vector layers
|
|
1190
|
+
this._collectVectorLayerCollections();
|
|
1153
1191
|
}
|
|
1154
1192
|
|
|
1155
1193
|
this.drawEntityCollections(this._frustumEntityCollections);
|
|
@@ -1196,27 +1234,6 @@ export class Planet extends RenderNode {
|
|
|
1196
1234
|
this.camera.setTerrainCollisionActivity(true);
|
|
1197
1235
|
}
|
|
1198
1236
|
|
|
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
1237
|
_renderScreenNodesPASSNoAtmos() {
|
|
1221
1238
|
|
|
1222
1239
|
let sh, shu;
|
|
@@ -1229,9 +1246,7 @@ export class Planet extends RenderNode {
|
|
|
1229
1246
|
|
|
1230
1247
|
gl.enable(gl.CULL_FACE);
|
|
1231
1248
|
|
|
1232
|
-
|
|
1233
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
1234
|
-
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1249
|
+
renderer.enableBlendOneSrcAlpha();
|
|
1235
1250
|
|
|
1236
1251
|
if (this.lightEnabled) {
|
|
1237
1252
|
h.programs.drawnode_screen_wl.activate();
|
|
@@ -1339,9 +1354,7 @@ export class Planet extends RenderNode {
|
|
|
1339
1354
|
|
|
1340
1355
|
gl.enable(gl.CULL_FACE);
|
|
1341
1356
|
|
|
1342
|
-
|
|
1343
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
1344
|
-
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1357
|
+
renderer.enableBlendOneSrcAlpha();
|
|
1345
1358
|
|
|
1346
1359
|
if (this.lightEnabled) {
|
|
1347
1360
|
h.programs.drawnode_screen_wl.activate();
|
|
@@ -1492,9 +1505,10 @@ export class Planet extends RenderNode {
|
|
|
1492
1505
|
let shu = sh.uniforms;
|
|
1493
1506
|
let cam = renderer.activeCamera;
|
|
1494
1507
|
|
|
1495
|
-
|
|
1496
|
-
gl.
|
|
1497
|
-
gl.
|
|
1508
|
+
// Special blend
|
|
1509
|
+
// gl.enable(gl.BLEND);
|
|
1510
|
+
// gl.blendEquation(gl.FUNC_ADD);
|
|
1511
|
+
// gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1498
1512
|
|
|
1499
1513
|
gl.enable(gl.CULL_FACE);
|
|
1500
1514
|
|
|
@@ -1686,8 +1700,8 @@ export class Planet extends RenderNode {
|
|
|
1686
1700
|
* @param {Boolean} [force=false] - Force framebuffer rendering.
|
|
1687
1701
|
* @returns {LonLat} -
|
|
1688
1702
|
*/
|
|
1689
|
-
getLonLatFromPixelTerrain(px
|
|
1690
|
-
var coords = this.getCartesianFromPixelTerrain(px
|
|
1703
|
+
getLonLatFromPixelTerrain(px) {
|
|
1704
|
+
var coords = this.getCartesianFromPixelTerrain(px);
|
|
1691
1705
|
if (coords) {
|
|
1692
1706
|
return this.ellipsoid.cartesianToLonLat(coords);
|
|
1693
1707
|
}
|
|
@@ -1695,7 +1709,7 @@ export class Planet extends RenderNode {
|
|
|
1695
1709
|
}
|
|
1696
1710
|
|
|
1697
1711
|
/**
|
|
1698
|
-
* Returns projected 2d screen coordinates by 3d cartesian
|
|
1712
|
+
* Returns projected 2d screen coordinates by 3d cartesian coordinates.
|
|
1699
1713
|
* @public
|
|
1700
1714
|
* @param {Vec3} coords - Cartesian coordinates.
|
|
1701
1715
|
* @returns {Vec2} -
|
|
@@ -1720,7 +1734,7 @@ export class Planet extends RenderNode {
|
|
|
1720
1734
|
|
|
1721
1735
|
/**
|
|
1722
1736
|
* Returns distance from active camera to the the planet ellipsoid
|
|
1723
|
-
*
|
|
1737
|
+
* coordinates unprojected by 2d screen coordinates, or null if screen coordinates outside the planet.
|
|
1724
1738
|
* @public
|
|
1725
1739
|
* @param {Vec2} px - Screen coordinates.
|
|
1726
1740
|
* @returns {number} -
|
|
@@ -1731,8 +1745,8 @@ export class Planet extends RenderNode {
|
|
|
1731
1745
|
}
|
|
1732
1746
|
|
|
1733
1747
|
/**
|
|
1734
|
-
* Returns distance from active camera to the the relief planet
|
|
1735
|
-
* by 2d screen
|
|
1748
|
+
* Returns distance from active camera to the the relief planet coordinates unprojected
|
|
1749
|
+
* by 2d screen coordinates, or null if screen coordinates outside the planet.
|
|
1736
1750
|
* If screen coordinates inside the planet but relief is not exists in the
|
|
1737
1751
|
* point than function returns distance to the planet ellipsoid.
|
|
1738
1752
|
* @public
|
|
@@ -1784,7 +1798,11 @@ export class Planet extends RenderNode {
|
|
|
1784
1798
|
* @param {Extent} extent - Geographical extent.
|
|
1785
1799
|
*/
|
|
1786
1800
|
viewExtent(extent) {
|
|
1787
|
-
this.
|
|
1801
|
+
if (this.camera) {
|
|
1802
|
+
this.camera.viewExtent(extent);
|
|
1803
|
+
} else {
|
|
1804
|
+
this._initialViewExtent = extent;
|
|
1805
|
+
}
|
|
1788
1806
|
}
|
|
1789
1807
|
|
|
1790
1808
|
/**
|
|
@@ -1794,7 +1812,7 @@ export class Planet extends RenderNode {
|
|
|
1794
1812
|
* where index 0 - southwest longitude, 1 - latitude southwest, 2 - longitude northeast, 3 - latitude northeast.
|
|
1795
1813
|
*/
|
|
1796
1814
|
viewExtentArr(extentArr) {
|
|
1797
|
-
this.
|
|
1815
|
+
this.viewExtent(new Extent(new LonLat(extentArr[0], extentArr[1]), new LonLat(extentArr[2], extentArr[3])));
|
|
1798
1816
|
}
|
|
1799
1817
|
|
|
1800
1818
|
/**
|
|
@@ -1804,28 +1822,6 @@ export class Planet extends RenderNode {
|
|
|
1804
1822
|
*/
|
|
1805
1823
|
getViewExtent() {
|
|
1806
1824
|
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
1825
|
}
|
|
1830
1826
|
|
|
1831
1827
|
/**
|
|
@@ -1849,13 +1845,13 @@ export class Planet extends RenderNode {
|
|
|
1849
1845
|
* @param {cameraCallback} [completeCallback] - Callback that calls befor the flying begins.
|
|
1850
1846
|
*/
|
|
1851
1847
|
flyExtent(extent, height, up, ampl, completeCallback, startCallback) {
|
|
1852
|
-
this.
|
|
1848
|
+
this.camera.flyExtent(extent, height, up, ampl, completeCallback, startCallback);
|
|
1853
1849
|
}
|
|
1854
1850
|
|
|
1855
1851
|
/**
|
|
1856
1852
|
* Fly camera to the new point.
|
|
1857
1853
|
* @public
|
|
1858
|
-
* @param {Vec3} cartesian - Fly
|
|
1854
|
+
* @param {Vec3} cartesian - Fly coordinates.
|
|
1859
1855
|
* @param {Vec3} [look] - Camera "look at" point.
|
|
1860
1856
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1861
1857
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
@@ -1864,13 +1860,13 @@ export class Planet extends RenderNode {
|
|
|
1864
1860
|
* @param [frameCallback]
|
|
1865
1861
|
*/
|
|
1866
1862
|
flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback) {
|
|
1867
|
-
this.
|
|
1863
|
+
this.camera.flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback);
|
|
1868
1864
|
}
|
|
1869
1865
|
|
|
1870
1866
|
/**
|
|
1871
1867
|
* Fly camera to the new geographical position.
|
|
1872
1868
|
* @public
|
|
1873
|
-
* @param {LonLat} lonlat - Fly geographical
|
|
1869
|
+
* @param {LonLat} lonlat - Fly geographical coordinates.
|
|
1874
1870
|
* @param {Vec3} [look] - Camera "look at" point on the end of a flying.
|
|
1875
1871
|
* @param {Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1876
1872
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
@@ -1879,7 +1875,7 @@ export class Planet extends RenderNode {
|
|
|
1879
1875
|
* @param [frameCallback]
|
|
1880
1876
|
*/
|
|
1881
1877
|
flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback) {
|
|
1882
|
-
this.
|
|
1878
|
+
this.camera.flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback);
|
|
1883
1879
|
}
|
|
1884
1880
|
|
|
1885
1881
|
/**
|
|
@@ -1887,7 +1883,7 @@ export class Planet extends RenderNode {
|
|
|
1887
1883
|
* @public
|
|
1888
1884
|
*/
|
|
1889
1885
|
stopFlying() {
|
|
1890
|
-
this.
|
|
1886
|
+
this.camera.stopFlying();
|
|
1891
1887
|
}
|
|
1892
1888
|
|
|
1893
1889
|
updateBillboardsTexCoords() {
|
|
@@ -1933,4 +1929,10 @@ export class Planet extends RenderNode {
|
|
|
1933
1929
|
});
|
|
1934
1930
|
});
|
|
1935
1931
|
}
|
|
1932
|
+
|
|
1933
|
+
onremove() {
|
|
1934
|
+
this.memClear();
|
|
1935
|
+
this.quadTreeStrategy.destroyBranches();
|
|
1936
|
+
this._renderedNodes = [];
|
|
1937
|
+
}
|
|
1936
1938
|
}
|
|
@@ -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() {
|