@openglobus/og 0.11.4 → 0.11.8
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 +3 -2
- package/package.json +12 -14
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/Globe.js +8 -5
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +19 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +9 -5
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +0 -1
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/Lighting.js +74 -64
- package/src/og/control/MouseNavigation.js +21 -18
- package/src/og/control/MouseWheelZoomControl.js +257 -0
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +22 -12
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/control/index.js +2 -0
- package/src/og/control/visibleExtent/Segment.js +1862 -0
- package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
- package/src/og/control/visibleExtent/drawnode.js +751 -0
- package/src/og/ellipsoid/Ellipsoid.js +149 -57
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +72 -30
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +315 -62
- package/src/og/entity/Entity.js +39 -1
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +62 -30
- package/src/og/entity/LabelHandler.js +40 -242
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -17
- package/src/og/layer/GeoImage.js +8 -16
- package/src/og/layer/GeoTexture2d.js +2 -10
- package/src/og/layer/GeoVideo.js +2 -10
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +24 -32
- package/src/og/layer/Material.js +1 -1
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -18
- package/src/og/layer/XYZ.js +4 -5
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +60 -30
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +3 -3
- package/src/og/renderer/Renderer.js +106 -124
- package/src/og/renderer/RendererEvents.js +45 -23
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +51 -90
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/segment/Segment.js +60 -156
- package/src/og/segment/Slice.js +45 -0
- package/src/og/shaders/drawnode.js +245 -342
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shaders/toneMapping.js +1 -0
- package/src/og/shapes/BaseShape.js +108 -36
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/GeoImageCreator.js +5 -1
- package/src/og/utils/TextureAtlas.js +18 -20
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +2 -2
- package/src/og/webgl/Handler.js +215 -162
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Clock.d.ts +0 -94
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -77
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -82
- package/types/ImageCanvas.d.ts +0 -123
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -42
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/ajax.d.ts +0 -24
- package/types/arial.d.ts +0 -48
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -312
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -218
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -17
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -15
- package/types/control/EarthCoordinates.d.ts +0 -47
- package/types/control/EarthNavigation.d.ts +0 -42
- package/types/control/GeoImageDragControl.d.ts +0 -6
- package/types/control/KeyboardNavigation.d.ts +0 -21
- package/types/control/LayerSwitcher.d.ts +0 -21
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -47
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -25
- package/types/control/Sun.d.ts +0 -50
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -48
- package/types/control/ZoomControl.d.ts +0 -27
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -146
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -78
- package/types/entity/Entity.d.ts +0 -333
- package/types/entity/EntityCollection.d.ts +0 -311
- package/types/entity/Geometry.d.ts +0 -74
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -189
- package/types/entity/LabelHandler.d.ts +0 -29
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -306
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -124
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.core.d.ts +0 -65
- package/types/index.d.ts +0 -45
- package/types/index.webgl.d.ts +0 -7
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -34
- package/types/layer/BaseGeoImage.d.ts +0 -94
- package/types/layer/CanvasTiles.d.ts +0 -68
- package/types/layer/GeoImage.d.ts +0 -52
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -55
- package/types/layer/KML.d.ts +0 -63
- package/types/layer/Layer.d.ts +0 -325
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -208
- package/types/layer/WMS.d.ts +0 -63
- package/types/layer/XYZ.d.ts +0 -120
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -460
- package/types/math/Vec4.d.ts +0 -162
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -261
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EntityCollectionNode.d.ts +0 -34
- package/types/quadTree/Node.d.ts +0 -61
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -298
- package/types/renderer/RendererEvents.d.ts +0 -233
- package/types/res/images.d.ts +0 -3
- package/types/scene/Axes.d.ts +0 -11
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -577
- package/types/scene/RenderNode.d.ts +0 -142
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -279
- package/types/segment/SegmentLonLat.d.ts +0 -16
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -7
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/shape.d.ts +0 -4
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -7
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -116
- package/types/terrain/MapboxTerrain.d.ts +0 -7
- package/types/terrain/index.d.ts +0 -5
- package/types/utils/FontAtlas.d.ts +0 -14
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -25
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -10
- package/types/utils/TerrainWorker.d.ts +0 -9
- package/types/utils/TextureAtlas.d.ts +0 -111
- package/types/utils/VectorTileCreator.d.ts +0 -16
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/shared.d.ts +0 -231
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -388
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
package/src/og/scene/Planet.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
+
import * as utils from "../utils/shared.js";
|
|
7
8
|
import * as shaders from "../shaders/drawnode.js";
|
|
8
9
|
import * as math from "../math.js";
|
|
9
10
|
import * as mercator from "../mercator.js";
|
|
@@ -32,7 +33,7 @@ import { NIGHT, SPECULAR } from "../res/images.js";
|
|
|
32
33
|
import { Geoid } from "../terrain/Geoid.js";
|
|
33
34
|
import { isUndef } from "../utils/shared.js";
|
|
34
35
|
|
|
35
|
-
const MAX_LOD = 0
|
|
36
|
+
const MAX_LOD = 1.0;
|
|
36
37
|
const MIN_LOD = 0.75;
|
|
37
38
|
|
|
38
39
|
let _tempPickingPix_ = new Uint8Array(4),
|
|
@@ -93,7 +94,7 @@ const EVENT_NAMES = [
|
|
|
93
94
|
* @param {string} [options.name="Earth"] - Planet name(Earth by default)
|
|
94
95
|
* @param {Ellipsoid} [options.ellipsoid] - Planet ellipsoid(WGS84 by default)
|
|
95
96
|
* @param {Number} [options.maxGridSize=128] - Segment maximal grid size
|
|
96
|
-
* @param {Number} [options.maxEqualZoomAltitude=
|
|
97
|
+
* @param {Number} [options.maxEqualZoomAltitude=15000000.0] - Maximal altitude since segments on the screen bacame the same zoom level
|
|
97
98
|
* @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen bacame the same zoom level
|
|
98
99
|
* @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
|
|
99
100
|
* @fires og.scene.Planet#draw
|
|
@@ -180,7 +181,7 @@ export class Planet extends RenderNode {
|
|
|
180
181
|
this._minAltitude = options.minAltitude;
|
|
181
182
|
this._maxAltitude = options.maxAltitude;
|
|
182
183
|
|
|
183
|
-
this.maxEqualZoomAltitude = options.maxEqualZoomAltitude ||
|
|
184
|
+
this.maxEqualZoomAltitude = options.maxEqualZoomAltitude || 15000000.0;
|
|
184
185
|
this.minEqualZoomAltitude = options.minEqualZoomAltitude || 10000.0;
|
|
185
186
|
this.minEqualZoomCameraSlope = options.minEqualZoomCameraSlope || 0.8;
|
|
186
187
|
|
|
@@ -335,6 +336,16 @@ export class Planet extends RenderNode {
|
|
|
335
336
|
*/
|
|
336
337
|
this._specularTexture = null;
|
|
337
338
|
|
|
339
|
+
//TODO: replace to a function
|
|
340
|
+
let a = utils.createColorRGB(options.ambient, new Vec3(0.2, 0.2, 0.2));
|
|
341
|
+
let d = utils.createColorRGB(options.diffuse, new Vec3(0.8, 0.8, 0.8));
|
|
342
|
+
let s = utils.createColorRGB(options.specular, new Vec3(0.0003, 0.0003, 0.0003));
|
|
343
|
+
let shininess = options.shininess || 20.0;
|
|
344
|
+
|
|
345
|
+
this._ambient = new Float32Array([a.x, a.y, a.z]);
|
|
346
|
+
this._diffuse = new Float32Array([d.x, d.y, d.z]);
|
|
347
|
+
this._specular = new Float32Array([s.x, s.y, s.z, shininess]);
|
|
348
|
+
|
|
338
349
|
/**
|
|
339
350
|
* True for rendering night glowing texture.
|
|
340
351
|
* @protected
|
|
@@ -371,14 +382,7 @@ export class Planet extends RenderNode {
|
|
|
371
382
|
this._maxLodRatio = MAX_LOD;
|
|
372
383
|
this._minLodRatio = MIN_LOD;
|
|
373
384
|
|
|
374
|
-
this.
|
|
375
|
-
this._ambientMaterialArr = new Float32Array(this.SLICE_SIZE_3 + 3);
|
|
376
|
-
this._specularMaterialArr = new Float32Array(this.SLICE_SIZE_4 + 4);
|
|
377
|
-
|
|
378
|
-
this._tileOffsetArr = new Float32Array(this.SLICE_SIZE_4);
|
|
379
|
-
this._visibleExtentOffsetArr = new Float32Array(this.SLICE_SIZE_4);
|
|
380
|
-
this._transparentColorArr = new Float32Array(this.SLICE_SIZE_4);
|
|
381
|
-
this._pickingColorArr = new Float32Array(this.SLICE_SIZE_3);
|
|
385
|
+
this._pickingColorArr = new Float32Array(this.SLICE_SIZE_4);
|
|
382
386
|
this._samplerArr = new Int32Array(this.SLICE_SIZE);
|
|
383
387
|
this._pickingMaskArr = new Int32Array(this.SLICE_SIZE);
|
|
384
388
|
|
|
@@ -619,11 +623,8 @@ export class Planet extends RenderNode {
|
|
|
619
623
|
var h = this.renderer.handler;
|
|
620
624
|
|
|
621
625
|
h.addProgram(shaders.drawnode_screen_nl(), true);
|
|
622
|
-
|
|
623
626
|
//h.addProgram(shaders.drawnode_screen_wl(), true);
|
|
624
|
-
|
|
625
627
|
h.addProgram(shaders.drawnode_screen_wl_webgl2(), true);
|
|
626
|
-
|
|
627
628
|
h.addProgram(shaders.drawnode_colorPicking(), true);
|
|
628
629
|
h.addProgram(shaders.drawnode_depth(), true);
|
|
629
630
|
h.addProgram(shaders.drawnode_heightPicking(), true);
|
|
@@ -731,31 +732,13 @@ export class Planet extends RenderNode {
|
|
|
731
732
|
}
|
|
732
733
|
|
|
733
734
|
// Creating quad trees nodes
|
|
734
|
-
this._quadTree = new Node(
|
|
735
|
-
Segment,
|
|
736
|
-
this,
|
|
737
|
-
quadTree.NW,
|
|
738
|
-
null,
|
|
739
|
-
0,
|
|
740
|
-
0,
|
|
735
|
+
this._quadTree = new Node(Segment, this, quadTree.NW, null, 0, 0,
|
|
741
736
|
Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34])
|
|
742
737
|
);
|
|
743
|
-
this._quadTreeNorth = new Node(
|
|
744
|
-
SegmentLonLat,
|
|
745
|
-
this,
|
|
746
|
-
quadTree.NW,
|
|
747
|
-
null,
|
|
748
|
-
0,
|
|
749
|
-
0,
|
|
738
|
+
this._quadTreeNorth = new Node(SegmentLonLat, this, quadTree.NW, null, 0, 0,
|
|
750
739
|
Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90])
|
|
751
740
|
);
|
|
752
|
-
this._quadTreeSouth = new Node(
|
|
753
|
-
SegmentLonLat,
|
|
754
|
-
this,
|
|
755
|
-
quadTree.NW,
|
|
756
|
-
null,
|
|
757
|
-
0,
|
|
758
|
-
0,
|
|
741
|
+
this._quadTreeSouth = new Node(SegmentLonLat, this, quadTree.NW, null, 0, 0,
|
|
759
742
|
Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT])
|
|
760
743
|
);
|
|
761
744
|
|
|
@@ -771,7 +754,7 @@ export class Planet extends RenderNode {
|
|
|
771
754
|
// loading Earth night glowing texture
|
|
772
755
|
if (this._useNightTexture) {
|
|
773
756
|
createImageBitmap(NIGHT).then(
|
|
774
|
-
(e) => (this._nightTexture = this.renderer.handler.
|
|
757
|
+
(e) => (this._nightTexture = this.renderer.handler.createTextureDefault(e))
|
|
775
758
|
);
|
|
776
759
|
}
|
|
777
760
|
|
|
@@ -1093,7 +1076,9 @@ export class Planet extends RenderNode {
|
|
|
1093
1076
|
frame() {
|
|
1094
1077
|
this._renderScreenNodesPASS();
|
|
1095
1078
|
|
|
1096
|
-
this.
|
|
1079
|
+
if (this.renderer.isActiveBackbuffers) {
|
|
1080
|
+
this._renderHeightPickingFramebufferPASS();
|
|
1081
|
+
}
|
|
1097
1082
|
|
|
1098
1083
|
this.drawEntityCollections(this._frustumEntityCollections);
|
|
1099
1084
|
}
|
|
@@ -1124,7 +1109,7 @@ export class Planet extends RenderNode {
|
|
|
1124
1109
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1125
1110
|
|
|
1126
1111
|
if (frustumIndex === cam.FARTHEST_FRUSTUM_INDEX) {
|
|
1127
|
-
if (this._skipPreRender && (!this._renderCompletedActivated || cam.isMoved)) {
|
|
1112
|
+
if (this._skipPreRender/* && (!this._renderCompletedActivated || cam.isMoved)*/) {
|
|
1128
1113
|
this._collectRenderNodes();
|
|
1129
1114
|
}
|
|
1130
1115
|
this._skipPreRender = true;
|
|
@@ -1147,12 +1132,12 @@ export class Planet extends RenderNode {
|
|
|
1147
1132
|
this._vectorTileCreator.frame();
|
|
1148
1133
|
}
|
|
1149
1134
|
|
|
1150
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
1151
1135
|
|
|
1152
|
-
gl.
|
|
1136
|
+
gl.enable(gl.CULL_FACE);
|
|
1153
1137
|
|
|
1154
1138
|
gl.enable(gl.BLEND);
|
|
1155
|
-
gl.
|
|
1139
|
+
gl.blendEquation(gl.FUNC_ADD);
|
|
1140
|
+
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
|
1156
1141
|
|
|
1157
1142
|
if (this.lightEnabled) {
|
|
1158
1143
|
h.programs.drawnode_screen_wl.activate();
|
|
@@ -1165,13 +1150,17 @@ export class Planet extends RenderNode {
|
|
|
1165
1150
|
gl.uniformMatrix4fv(shu.viewMatrix, false, cam.getViewMatrix());
|
|
1166
1151
|
gl.uniformMatrix4fv(shu.projectionMatrix, false, cam.getProjectionMatrix());
|
|
1167
1152
|
|
|
1153
|
+
gl.uniform3fv(shu.diffuse, this._diffuse);
|
|
1154
|
+
gl.uniform3fv(shu.ambient, this._ambient);
|
|
1155
|
+
gl.uniform4fv(shu.specular, this._specular);
|
|
1156
|
+
|
|
1168
1157
|
// bind night glowing material
|
|
1169
1158
|
gl.activeTexture(gl.TEXTURE0 + this.SLICE_SIZE);
|
|
1170
1159
|
gl.bindTexture(
|
|
1171
1160
|
gl.TEXTURE_2D,
|
|
1172
1161
|
(this.camera._lonLat.height > 329958.0 &&
|
|
1173
1162
|
(this._nightTexture || this.transparentTexture)) ||
|
|
1174
|
-
|
|
1163
|
+
this.transparentTexture
|
|
1175
1164
|
);
|
|
1176
1165
|
gl.uniform1i(shu.nightTexture, this.SLICE_SIZE);
|
|
1177
1166
|
|
|
@@ -1180,34 +1169,6 @@ export class Planet extends RenderNode {
|
|
|
1180
1169
|
gl.bindTexture(gl.TEXTURE_2D, this._specularTexture || this.transparentTexture);
|
|
1181
1170
|
gl.uniform1i(shu.specularTexture, this.SLICE_SIZE + 1);
|
|
1182
1171
|
|
|
1183
|
-
var b = this.baseLayer;
|
|
1184
|
-
if (b) {
|
|
1185
|
-
this._diffuseMaterialArr[0] = b.diffuse.x;
|
|
1186
|
-
this._diffuseMaterialArr[1] = b.diffuse.y;
|
|
1187
|
-
this._diffuseMaterialArr[2] = b.diffuse.z;
|
|
1188
|
-
|
|
1189
|
-
this._ambientMaterialArr[0] = b.ambient.x;
|
|
1190
|
-
this._ambientMaterialArr[1] = b.ambient.y;
|
|
1191
|
-
this._ambientMaterialArr[2] = b.ambient.z;
|
|
1192
|
-
|
|
1193
|
-
this._specularMaterialArr[0] = b.specular.x;
|
|
1194
|
-
this._specularMaterialArr[1] = b.specular.y;
|
|
1195
|
-
this._specularMaterialArr[2] = b.specular.z;
|
|
1196
|
-
this._specularMaterialArr[3] = b.shininess;
|
|
1197
|
-
} else {
|
|
1198
|
-
this._diffuseMaterialArr[0] = 0.89;
|
|
1199
|
-
this._diffuseMaterialArr[1] = 0.9;
|
|
1200
|
-
this._diffuseMaterialArr[2] = 0.83;
|
|
1201
|
-
|
|
1202
|
-
this._ambientMaterialArr[0] = 0.0;
|
|
1203
|
-
this._ambientMaterialArr[1] = 0.0;
|
|
1204
|
-
this._ambientMaterialArr[2] = 0.0;
|
|
1205
|
-
|
|
1206
|
-
this._specularMaterialArr[0] = 0.0003;
|
|
1207
|
-
this._specularMaterialArr[1] = 0.00012;
|
|
1208
|
-
this._specularMaterialArr[2] = 0.00001;
|
|
1209
|
-
this._specularMaterialArr[3] = 20.0;
|
|
1210
|
-
}
|
|
1211
1172
|
} else {
|
|
1212
1173
|
h.programs.drawnode_screen_nl.activate();
|
|
1213
1174
|
sh = h.programs.drawnode_screen_nl._program;
|
|
@@ -1385,6 +1346,7 @@ export class Planet extends RenderNode {
|
|
|
1385
1346
|
let cam = renderer.activeCamera;
|
|
1386
1347
|
|
|
1387
1348
|
gl.disable(gl.BLEND);
|
|
1349
|
+
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1388
1350
|
|
|
1389
1351
|
gl.uniformMatrix4fv(shu.viewMatrix, false, cam.getViewMatrix());
|
|
1390
1352
|
gl.uniformMatrix4fv(shu.projectionMatrix, false, cam.getProjectionMatrix());
|
|
@@ -1403,7 +1365,6 @@ export class Planet extends RenderNode {
|
|
|
1403
1365
|
rn[i].segment.depthRendering(sh, sl[0], 0);
|
|
1404
1366
|
}
|
|
1405
1367
|
|
|
1406
|
-
gl.enable(gl.POLYGON_OFFSET_FILL);
|
|
1407
1368
|
for (let j = 1, len = sl.length; j < len; j++) {
|
|
1408
1369
|
i = rn.length;
|
|
1409
1370
|
gl.polygonOffset(0, -j);
|
|
@@ -1509,12 +1470,11 @@ export class Planet extends RenderNode {
|
|
|
1509
1470
|
* Returns 3d cartesian coordinates on the relief planet by mouse cursor
|
|
1510
1471
|
* position or null if mouse cursor is outside the planet.
|
|
1511
1472
|
* @public
|
|
1512
|
-
* @param {Boolean} [force=false] - Force framebuffer rendering.
|
|
1513
1473
|
* @returns {Vec3} -
|
|
1514
1474
|
*/
|
|
1515
|
-
getCartesianFromMouseTerrain(
|
|
1475
|
+
getCartesianFromMouseTerrain() {
|
|
1516
1476
|
var ms = this.renderer.events.mouseState;
|
|
1517
|
-
var distance = this.getDistanceFromPixel(ms
|
|
1477
|
+
var distance = this.getDistanceFromPixel(ms);
|
|
1518
1478
|
if (distance) {
|
|
1519
1479
|
return ms.direction.scaleTo(distance).addA(this.renderer.activeCamera.eye);
|
|
1520
1480
|
}
|
|
@@ -1529,8 +1489,8 @@ export class Planet extends RenderNode {
|
|
|
1529
1489
|
* @param {Boolean} [force=false] - Force framebuffer rendering.
|
|
1530
1490
|
* @returns {Vec3} -
|
|
1531
1491
|
*/
|
|
1532
|
-
getCartesianFromPixelTerrain(px
|
|
1533
|
-
var distance = this.getDistanceFromPixel(px
|
|
1492
|
+
getCartesianFromPixelTerrain(px) {
|
|
1493
|
+
var distance = this.getDistanceFromPixel(px);
|
|
1534
1494
|
if (distance) {
|
|
1535
1495
|
var direction = px.direction || this.renderer.activeCamera.unproject(px.x, px.y);
|
|
1536
1496
|
return direction.scaleTo(distance).addA(this.renderer.activeCamera.eye);
|
|
@@ -1609,7 +1569,9 @@ export class Planet extends RenderNode {
|
|
|
1609
1569
|
|
|
1610
1570
|
// HEIGHT
|
|
1611
1571
|
this._heightPickingFramebuffer.activate();
|
|
1612
|
-
this._heightPickingFramebuffer.
|
|
1572
|
+
if (this._heightPickingFramebuffer.isComplete()) {
|
|
1573
|
+
this._heightPickingFramebuffer.readPixels(_tempPickingPix_, spx, spy);
|
|
1574
|
+
}
|
|
1613
1575
|
this._heightPickingFramebuffer.deactivate();
|
|
1614
1576
|
|
|
1615
1577
|
let dist = decodeFloatFromRGBAArr(_tempPickingPix_);
|
|
@@ -1618,20 +1580,19 @@ export class Planet extends RenderNode {
|
|
|
1618
1580
|
dist = this.getDistanceFromPixelEllipsoid(px) || 0;
|
|
1619
1581
|
} else if (dist < DEPTH_DISTANCE) {
|
|
1620
1582
|
r.screenDepthFramebuffer.activate();
|
|
1621
|
-
r.screenDepthFramebuffer.
|
|
1583
|
+
if (r.screenDepthFramebuffer.isComplete()) {
|
|
1584
|
+
r.screenDepthFramebuffer.readPixels(_tempDepthColor_, spx, spy);
|
|
1585
|
+
let screenPos = new Vec4(
|
|
1586
|
+
spx * 2.0 - 1.0,
|
|
1587
|
+
spy * 2.0 - 1.0,
|
|
1588
|
+
(_tempDepthColor_[0] / 255.0) * 2.0 - 1.0,
|
|
1589
|
+
1.0 * 2.0 - 1.0
|
|
1590
|
+
);
|
|
1591
|
+
let viewPosition = this.camera.frustums[0]._inverseProjectionMatrix.mulVec4(screenPos);
|
|
1592
|
+
let dir = px.direction || this.renderer.activeCamera.unproject(px.x, px.y);
|
|
1593
|
+
dist = -(viewPosition.z / viewPosition.w) / dir.dot(this.renderer.activeCamera.getForward());
|
|
1594
|
+
}
|
|
1622
1595
|
r.screenDepthFramebuffer.deactivate();
|
|
1623
|
-
|
|
1624
|
-
let screenPos = new Vec4(
|
|
1625
|
-
spx * 2.0 - 1.0,
|
|
1626
|
-
spy * 2.0 - 1.0,
|
|
1627
|
-
(_tempDepthColor_[0] / 255.0) * 2.0 - 1.0,
|
|
1628
|
-
1.0 * 2.0 - 1.0
|
|
1629
|
-
);
|
|
1630
|
-
let viewPosition = this.camera.frustums[0]._inverseProjectionMatrix.mulVec4(screenPos);
|
|
1631
|
-
let dir = px.direction || this.renderer.activeCamera.unproject(px.x, px.y);
|
|
1632
|
-
dist =
|
|
1633
|
-
-(viewPosition.z / viewPosition.w) /
|
|
1634
|
-
dir.dot(this.renderer.activeCamera.getForward());
|
|
1635
1596
|
}
|
|
1636
1597
|
|
|
1637
1598
|
return dist;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { BaseNode } from
|
|
4
|
-
import { Events } from
|
|
3
|
+
import { BaseNode } from "./BaseNode.js";
|
|
4
|
+
import { Events } from "../Events.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Render node is a logical part of a render mechanism. Represents scene rendering.
|
|
@@ -98,8 +98,7 @@ class RenderNode extends BaseNode {
|
|
|
98
98
|
n = this.name;
|
|
99
99
|
|
|
100
100
|
if (r) {
|
|
101
|
-
if (r.renderNodes[n] &&
|
|
102
|
-
r.renderNodes[n].isEqual(this)) {
|
|
101
|
+
if (r.renderNodes[n] && r.renderNodes[n].isEqual(this)) {
|
|
103
102
|
r.renderNodes[n] = null;
|
|
104
103
|
delete r.renderNodes[n];
|
|
105
104
|
}
|
|
@@ -195,7 +194,10 @@ class RenderNode extends BaseNode {
|
|
|
195
194
|
|
|
196
195
|
if (this.renderer) {
|
|
197
196
|
if (this._isActive && this._pickingId === -1) {
|
|
198
|
-
this._pickingId = this.renderer.addPickingCallback(
|
|
197
|
+
this._pickingId = this.renderer.addPickingCallback(
|
|
198
|
+
this,
|
|
199
|
+
this._entityCollectionPickingCallback
|
|
200
|
+
);
|
|
199
201
|
} else if (!this._isActive && this._pickingId !== -1) {
|
|
200
202
|
this.renderer.removePickingCallback(this._pickingId);
|
|
201
203
|
this._pickingId = -1;
|
|
@@ -277,7 +279,6 @@ class RenderNode extends BaseNode {
|
|
|
277
279
|
*/
|
|
278
280
|
drawPickingEntityCollections(ec) {
|
|
279
281
|
if (ec.length) {
|
|
280
|
-
|
|
281
282
|
var gl = this.renderer.handler.gl;
|
|
282
283
|
|
|
283
284
|
gl.disable(gl.CULL_FACE);
|
|
@@ -292,6 +293,12 @@ class RenderNode extends BaseNode {
|
|
|
292
293
|
ec[i]._fadingOpacity && ec[i].billboardHandler.drawPicking();
|
|
293
294
|
}
|
|
294
295
|
|
|
296
|
+
// geoObject pass
|
|
297
|
+
i = ec.length;
|
|
298
|
+
while (i--) {
|
|
299
|
+
ec[i]._fadingOpacity && ec[i].geoObjectHandler.drawPicking();
|
|
300
|
+
}
|
|
301
|
+
|
|
295
302
|
// label pass
|
|
296
303
|
i = ec.length;
|
|
297
304
|
while (i--) {
|
|
@@ -344,4 +351,4 @@ class RenderNode extends BaseNode {
|
|
|
344
351
|
}
|
|
345
352
|
}
|
|
346
353
|
|
|
347
|
-
export { RenderNode };
|
|
354
|
+
export { RenderNode };
|