@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
|
@@ -12,26 +12,13 @@ import { Box } from "../bv/Box.js";
|
|
|
12
12
|
import { Vec3 } from "../math/Vec3.js";
|
|
13
13
|
import * as segmentHelper from "../segment/segmentHelper.js";
|
|
14
14
|
import { getMatrixSubArray } from "../utils/shared.js";
|
|
15
|
+
import { Slice } from "./Slice.js";
|
|
15
16
|
|
|
16
17
|
export const MAX_NORMAL_ZOOM = 7;
|
|
17
18
|
|
|
18
19
|
var _tempHigh = new Vec3();
|
|
19
20
|
var _tempLow = new Vec3();
|
|
20
21
|
|
|
21
|
-
var _RenderingSlice = function (p) {
|
|
22
|
-
this.layers = [];
|
|
23
|
-
this.tileOffsetArr = new Float32Array(p.SLICE_SIZE_4);
|
|
24
|
-
this.visibleExtentOffsetArr = new Float32Array(p.SLICE_SIZE_4);
|
|
25
|
-
this.transparentColorArr = new Float32Array(p.SLICE_SIZE_4);
|
|
26
|
-
|
|
27
|
-
this.clear = function () {
|
|
28
|
-
this.layers = null;
|
|
29
|
-
this.tileOffsetArr = null;
|
|
30
|
-
this.visibleExtentOffsetArr = null;
|
|
31
|
-
this.transparentColorArr = null;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
|
|
35
22
|
let _v0 = new Vec3(),
|
|
36
23
|
_v1 = new Vec3(),
|
|
37
24
|
_v2 = new Vec3(),
|
|
@@ -241,7 +228,7 @@ class Segment {
|
|
|
241
228
|
this._inTheQueue = false;
|
|
242
229
|
this._appliedNeighborsZoom = [0, 0, 0, 0];
|
|
243
230
|
|
|
244
|
-
this.
|
|
231
|
+
this._slices = [];
|
|
245
232
|
|
|
246
233
|
this._indexBuffer = null;
|
|
247
234
|
|
|
@@ -946,12 +933,12 @@ class Segment {
|
|
|
946
933
|
|
|
947
934
|
this.clearSegment();
|
|
948
935
|
|
|
949
|
-
var i = this.
|
|
936
|
+
var i = this._slices.length;
|
|
950
937
|
while (i--) {
|
|
951
|
-
this.
|
|
938
|
+
this._slices[i].clear();
|
|
952
939
|
}
|
|
953
940
|
|
|
954
|
-
this.
|
|
941
|
+
this._slices = null;
|
|
955
942
|
|
|
956
943
|
this.node = null;
|
|
957
944
|
|
|
@@ -990,9 +977,6 @@ class Segment {
|
|
|
990
977
|
this.vertexPositionBufferLow = null;
|
|
991
978
|
this.vertexTextureCoordBuffer = null;
|
|
992
979
|
|
|
993
|
-
this._tileOffsetArr = null;
|
|
994
|
-
this._visibleExtentOffsetArr = null;
|
|
995
|
-
|
|
996
980
|
this._projection = null;
|
|
997
981
|
this._appliedNeighborsZoom = null;
|
|
998
982
|
|
|
@@ -1104,10 +1088,10 @@ class Segment {
|
|
|
1104
1088
|
v_rb = new Vec3(bigOne[9], bigOne[10], bigOne[11]);
|
|
1105
1089
|
|
|
1106
1090
|
let vn = new Vec3(
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1091
|
+
bigOne[3] - bigOne[0],
|
|
1092
|
+
bigOne[4] - bigOne[1],
|
|
1093
|
+
bigOne[5] - bigOne[2]
|
|
1094
|
+
),
|
|
1111
1095
|
vw = new Vec3(
|
|
1112
1096
|
bigOne[6] - bigOne[0],
|
|
1113
1097
|
bigOne[7] - bigOne[1],
|
|
@@ -1291,13 +1275,13 @@ class Segment {
|
|
|
1291
1275
|
n.sideSize[2] =
|
|
1292
1276
|
n.sideSize[3] =
|
|
1293
1277
|
this.gridSize =
|
|
1294
|
-
|
|
1278
|
+
p.terrain.gridSizeByZoom[this.tileZoom] || p.terrain.plainGridSize;
|
|
1295
1279
|
|
|
1296
1280
|
n.sideSizeLog2[0] =
|
|
1297
1281
|
n.sideSizeLog2[1] =
|
|
1298
1282
|
n.sideSizeLog2[2] =
|
|
1299
1283
|
n.sideSizeLog2[3] =
|
|
1300
|
-
|
|
1284
|
+
Math.log2(p.terrain.gridSizeByZoom[this.tileZoom] || p.terrain.plainGridSize);
|
|
1301
1285
|
|
|
1302
1286
|
if (this.tileZoom <= p.terrain.maxZoom) {
|
|
1303
1287
|
var nmc = this.planet._normalMapCreator;
|
|
@@ -1484,11 +1468,12 @@ class Segment {
|
|
|
1484
1468
|
|
|
1485
1469
|
var notEmpty = false;
|
|
1486
1470
|
|
|
1487
|
-
var slice = this.
|
|
1471
|
+
var slice = this._slices[sliceIndex];
|
|
1488
1472
|
|
|
1489
1473
|
if (!slice) {
|
|
1490
|
-
slice = this.
|
|
1474
|
+
slice = this._slices[sliceIndex] = new Slice(this);
|
|
1491
1475
|
} else {
|
|
1476
|
+
//TODO: optimization!!!
|
|
1492
1477
|
slice.layers = [];
|
|
1493
1478
|
}
|
|
1494
1479
|
|
|
@@ -1511,40 +1496,7 @@ class Segment {
|
|
|
1511
1496
|
this.planet._renderCompleted = false;
|
|
1512
1497
|
}
|
|
1513
1498
|
|
|
1514
|
-
slice.
|
|
1515
|
-
|
|
1516
|
-
var n4 = n * 4,
|
|
1517
|
-
n3 = n * 3;
|
|
1518
|
-
|
|
1519
|
-
var arr = li.applyMaterial(m);
|
|
1520
|
-
slice.tileOffsetArr[n4] = arr[0];
|
|
1521
|
-
slice.tileOffsetArr[n4 + 1] = arr[1];
|
|
1522
|
-
slice.tileOffsetArr[n4 + 2] = arr[2];
|
|
1523
|
-
slice.tileOffsetArr[n4 + 3] = arr[3];
|
|
1524
|
-
|
|
1525
|
-
arr = this._getLayerExtentOffset(li);
|
|
1526
|
-
slice.visibleExtentOffsetArr[n4] = arr[0];
|
|
1527
|
-
slice.visibleExtentOffsetArr[n4 + 1] = arr[1];
|
|
1528
|
-
slice.visibleExtentOffsetArr[n4 + 2] = arr[2];
|
|
1529
|
-
slice.visibleExtentOffsetArr[n4 + 3] = arr[3];
|
|
1530
|
-
|
|
1531
|
-
slice.transparentColorArr[n4] = li.transparentColor[0];
|
|
1532
|
-
slice.transparentColorArr[n4 + 1] = li.transparentColor[1];
|
|
1533
|
-
slice.transparentColorArr[n4 + 2] = li.transparentColor[2];
|
|
1534
|
-
slice.transparentColorArr[n4 + 3] = li.opacity;
|
|
1535
|
-
|
|
1536
|
-
p._diffuseMaterialArr[n3 + 3] = li.diffuse.x;
|
|
1537
|
-
p._diffuseMaterialArr[n3 + 1 + 3] = li.diffuse.y;
|
|
1538
|
-
p._diffuseMaterialArr[n3 + 2 + 3] = li.diffuse.z;
|
|
1539
|
-
|
|
1540
|
-
p._ambientMaterialArr[n3 + 3] = li.ambient.x;
|
|
1541
|
-
p._ambientMaterialArr[n3 + 1 + 3] = li.ambient.y;
|
|
1542
|
-
p._ambientMaterialArr[n3 + 2 + 3] = li.ambient.z;
|
|
1543
|
-
|
|
1544
|
-
p._specularMaterialArr[n4 + 4] = li.specular.x;
|
|
1545
|
-
p._specularMaterialArr[n4 + 1 + 4] = li.specular.y;
|
|
1546
|
-
p._specularMaterialArr[n4 + 2 + 4] = li.specular.z;
|
|
1547
|
-
p._specularMaterialArr[n4 + 3 + 4] = li.shininess;
|
|
1499
|
+
slice.append(li, m);
|
|
1548
1500
|
|
|
1549
1501
|
p._samplerArr[n] = n;
|
|
1550
1502
|
|
|
@@ -1561,9 +1513,12 @@ class Segment {
|
|
|
1561
1513
|
gl.uniform1i(shu.samplerCount, n);
|
|
1562
1514
|
gl.uniform1f(shu.height, currHeight);
|
|
1563
1515
|
gl.uniform1iv(shu.samplerArr, p._samplerArr);
|
|
1516
|
+
|
|
1517
|
+
//slice.uniform(gl, shu);
|
|
1518
|
+
|
|
1564
1519
|
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1565
|
-
gl.
|
|
1566
|
-
gl.uniform4fv(shu.
|
|
1520
|
+
gl.uniform1fv(shu.layerOpacityArr, slice.layerOpacityArr);
|
|
1521
|
+
//gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1567
1522
|
|
|
1568
1523
|
// bind normalmap texture
|
|
1569
1524
|
if (p.lightEnabled) {
|
|
@@ -1575,30 +1530,12 @@ class Segment {
|
|
|
1575
1530
|
|
|
1576
1531
|
// bind segment specular and night material texture coordinates
|
|
1577
1532
|
gl.uniform4fv(shu.uGlobalTextureCoord, this._globalTextureCoordinates);
|
|
1578
|
-
|
|
1579
|
-
gl.uniform3fv(shu.diffuseMaterial, p._diffuseMaterialArr);
|
|
1580
|
-
gl.uniform3fv(shu.ambientMaterial, p._ambientMaterialArr);
|
|
1581
|
-
gl.uniform4fv(shu.specularMaterial, p._specularMaterialArr);
|
|
1582
1533
|
}
|
|
1583
1534
|
|
|
1584
1535
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1585
|
-
gl.vertexAttribPointer(
|
|
1586
|
-
sha.aVertexPositionHigh,
|
|
1587
|
-
this.vertexPositionBufferHigh.itemSize,
|
|
1588
|
-
gl.FLOAT,
|
|
1589
|
-
false,
|
|
1590
|
-
0,
|
|
1591
|
-
0
|
|
1592
|
-
);
|
|
1536
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1593
1537
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1594
|
-
gl.vertexAttribPointer(
|
|
1595
|
-
sha.aVertexPositionLow,
|
|
1596
|
-
this.vertexPositionBufferLow.itemSize,
|
|
1597
|
-
gl.FLOAT,
|
|
1598
|
-
false,
|
|
1599
|
-
0,
|
|
1600
|
-
0
|
|
1601
|
-
);
|
|
1538
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1602
1539
|
|
|
1603
1540
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer);
|
|
1604
1541
|
gl.vertexAttribPointer(sha.aTextureCoord, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
@@ -1628,13 +1565,13 @@ class Segment {
|
|
|
1628
1565
|
currHeight = 0;
|
|
1629
1566
|
}
|
|
1630
1567
|
|
|
1631
|
-
var
|
|
1632
|
-
|
|
1633
|
-
var slice = this._renderingSlices[sliceIndex];
|
|
1568
|
+
var slice = this._slices[sliceIndex];
|
|
1634
1569
|
|
|
1635
1570
|
var notEmpty = false;
|
|
1636
1571
|
|
|
1637
|
-
|
|
1572
|
+
let len = slice.layers.length;
|
|
1573
|
+
|
|
1574
|
+
for (let n = 0; n < len; n++) {
|
|
1638
1575
|
notEmpty = true;
|
|
1639
1576
|
p._samplerArr[n] = n;
|
|
1640
1577
|
gl.activeTexture(gl.TEXTURE0 + n);
|
|
@@ -1642,32 +1579,21 @@ class Segment {
|
|
|
1642
1579
|
}
|
|
1643
1580
|
|
|
1644
1581
|
if (notEmpty || !isOverlay) {
|
|
1645
|
-
gl.uniform1i(shu.samplerCount,
|
|
1582
|
+
gl.uniform1i(shu.samplerCount, len);
|
|
1646
1583
|
gl.uniform1f(shu.height, currHeight);
|
|
1647
1584
|
gl.uniform1iv(shu.samplerArr, p._samplerArr);
|
|
1585
|
+
|
|
1586
|
+
//slice.uniform(gl, shu);
|
|
1587
|
+
|
|
1648
1588
|
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1649
|
-
gl.
|
|
1650
|
-
gl.uniform4fv(shu.
|
|
1589
|
+
gl.uniform1fv(shu.layerOpacityArr, slice.layerOpacityArr);
|
|
1590
|
+
//gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1651
1591
|
|
|
1652
1592
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1653
|
-
gl.vertexAttribPointer(
|
|
1654
|
-
sha.aVertexPositionHigh,
|
|
1655
|
-
this.vertexPositionBufferHigh.itemSize,
|
|
1656
|
-
gl.FLOAT,
|
|
1657
|
-
false,
|
|
1658
|
-
0,
|
|
1659
|
-
0
|
|
1660
|
-
);
|
|
1593
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1661
1594
|
|
|
1662
1595
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1663
|
-
gl.vertexAttribPointer(
|
|
1664
|
-
sha.aVertexPositionLow,
|
|
1665
|
-
this.vertexPositionBufferLow.itemSize,
|
|
1666
|
-
gl.FLOAT,
|
|
1667
|
-
false,
|
|
1668
|
-
0,
|
|
1669
|
-
0
|
|
1670
|
-
);
|
|
1596
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1671
1597
|
|
|
1672
1598
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer);
|
|
1673
1599
|
gl.vertexAttribPointer(sha.aTextureCoord, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
@@ -1694,9 +1620,11 @@ class Segment {
|
|
|
1694
1620
|
|
|
1695
1621
|
var notEmpty = false;
|
|
1696
1622
|
|
|
1697
|
-
var slice = this.
|
|
1623
|
+
var slice = this._slices[sliceIndex];
|
|
1624
|
+
|
|
1625
|
+
let len = slice.layers.length;
|
|
1698
1626
|
|
|
1699
|
-
for (
|
|
1627
|
+
for (let n = 0; n < len; n++) {
|
|
1700
1628
|
notEmpty = true;
|
|
1701
1629
|
|
|
1702
1630
|
var li = slice.layers[n];
|
|
@@ -1717,33 +1645,22 @@ class Segment {
|
|
|
1717
1645
|
}
|
|
1718
1646
|
|
|
1719
1647
|
if (notEmpty || !isOverlay) {
|
|
1720
|
-
gl.uniform1i(shu.samplerCount,
|
|
1648
|
+
gl.uniform1i(shu.samplerCount, len);
|
|
1721
1649
|
gl.uniform1f(shu.height, currHeight);
|
|
1722
1650
|
gl.uniform1iv(shu.samplerArr, p._samplerArr);
|
|
1723
1651
|
gl.uniform1iv(shu.pickingMaskArr, p._pickingMaskArr);
|
|
1724
|
-
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1725
|
-
gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1726
|
-
gl.uniform4fv(shu.transparentColorArr, slice.transparentColorArr);
|
|
1727
1652
|
gl.uniform4fv(shu.pickingColorArr, p._pickingColorArr);
|
|
1728
1653
|
|
|
1654
|
+
//slice.uniform(gl, shu);
|
|
1655
|
+
|
|
1656
|
+
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1657
|
+
gl.uniform1fv(shu.layerOpacityArr, slice.layerOpacityArr);
|
|
1658
|
+
//gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1659
|
+
|
|
1729
1660
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1730
|
-
gl.vertexAttribPointer(
|
|
1731
|
-
sha.aVertexPositionHigh,
|
|
1732
|
-
this.vertexPositionBufferHigh.itemSize,
|
|
1733
|
-
gl.FLOAT,
|
|
1734
|
-
false,
|
|
1735
|
-
0,
|
|
1736
|
-
0
|
|
1737
|
-
);
|
|
1661
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1738
1662
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1739
|
-
gl.vertexAttribPointer(
|
|
1740
|
-
sha.aVertexPositionLow,
|
|
1741
|
-
this.vertexPositionBufferLow.itemSize,
|
|
1742
|
-
gl.FLOAT,
|
|
1743
|
-
false,
|
|
1744
|
-
0,
|
|
1745
|
-
0
|
|
1746
|
-
);
|
|
1663
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1747
1664
|
|
|
1748
1665
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer);
|
|
1749
1666
|
gl.vertexAttribPointer(sha.aTextureCoord, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
@@ -1773,13 +1690,13 @@ class Segment {
|
|
|
1773
1690
|
currHeight = 0;
|
|
1774
1691
|
}
|
|
1775
1692
|
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1778
|
-
var slice = this._renderingSlices[sliceIndex];
|
|
1693
|
+
var slice = this._slices[sliceIndex];
|
|
1779
1694
|
|
|
1780
1695
|
var notEmpty = false;
|
|
1781
1696
|
|
|
1782
|
-
|
|
1697
|
+
let len = slice.layers.length;
|
|
1698
|
+
|
|
1699
|
+
for (let n = 0; n < len; n++) {
|
|
1783
1700
|
notEmpty = true;
|
|
1784
1701
|
p._samplerArr[n] = n;
|
|
1785
1702
|
gl.activeTexture(gl.TEXTURE0 + n);
|
|
@@ -1787,32 +1704,21 @@ class Segment {
|
|
|
1787
1704
|
}
|
|
1788
1705
|
|
|
1789
1706
|
if (notEmpty || !isOverlay) {
|
|
1790
|
-
gl.uniform1i(shu.samplerCount,
|
|
1707
|
+
gl.uniform1i(shu.samplerCount, len);
|
|
1791
1708
|
gl.uniform1f(shu.height, currHeight);
|
|
1792
1709
|
gl.uniform1iv(shu.samplerArr, p._samplerArr);
|
|
1710
|
+
|
|
1711
|
+
//slice.uniform(gl, shu);
|
|
1712
|
+
|
|
1793
1713
|
gl.uniform4fv(shu.tileOffsetArr, slice.tileOffsetArr);
|
|
1794
|
-
gl.
|
|
1795
|
-
gl.uniform4fv(shu.
|
|
1714
|
+
gl.uniform1fv(shu.layerOpacityArr, slice.layerOpacityArr);
|
|
1715
|
+
//gl.uniform4fv(shu.visibleExtentOffsetArr, slice.visibleExtentOffsetArr);
|
|
1796
1716
|
|
|
1797
1717
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferHigh);
|
|
1798
|
-
gl.vertexAttribPointer(
|
|
1799
|
-
sha.aVertexPositionHigh,
|
|
1800
|
-
this.vertexPositionBufferHigh.itemSize,
|
|
1801
|
-
gl.FLOAT,
|
|
1802
|
-
false,
|
|
1803
|
-
0,
|
|
1804
|
-
0
|
|
1805
|
-
);
|
|
1718
|
+
gl.vertexAttribPointer(sha.aVertexPositionHigh, this.vertexPositionBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
1806
1719
|
|
|
1807
1720
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBufferLow);
|
|
1808
|
-
gl.vertexAttribPointer(
|
|
1809
|
-
sha.aVertexPositionLow,
|
|
1810
|
-
this.vertexPositionBufferLow.itemSize,
|
|
1811
|
-
gl.FLOAT,
|
|
1812
|
-
false,
|
|
1813
|
-
0,
|
|
1814
|
-
0
|
|
1815
|
-
);
|
|
1721
|
+
gl.vertexAttribPointer(sha.aVertexPositionLow, this.vertexPositionBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
1816
1722
|
|
|
1817
1723
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexTextureCoordBuffer);
|
|
1818
1724
|
gl.vertexAttribPointer(sha.aTextureCoord, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
@@ -1826,9 +1732,7 @@ class Segment {
|
|
|
1826
1732
|
var s = this.node.sideSizeLog2;
|
|
1827
1733
|
var cache = this.planet._indexesCache[Math.log2(this.gridSize)][s[0]][s[1]][s[2]][s[3]];
|
|
1828
1734
|
if (!cache.buffer) {
|
|
1829
|
-
let indexes = segmentHelper
|
|
1830
|
-
.getInstance()
|
|
1831
|
-
.createSegmentIndexes(Math.log2(this.gridSize), [s[0], s[1], s[2], s[3]]);
|
|
1735
|
+
let indexes = segmentHelper.getInstance().createSegmentIndexes(Math.log2(this.gridSize), [s[0], s[1], s[2], s[3]]);
|
|
1832
1736
|
cache.buffer = this.planet.renderer.handler.createElementArrayBuffer(indexes, 1);
|
|
1833
1737
|
this.planet._indexesCacheToRemoveCounter++;
|
|
1834
1738
|
indexes = null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class Slice {
|
|
4
|
+
constructor(segment) {
|
|
5
|
+
this.segment = segment;
|
|
6
|
+
this.layers = [];
|
|
7
|
+
this.tileOffsetArr = new Float32Array(segment.planet.SLICE_SIZE_4);
|
|
8
|
+
this.layerOpacityArr = new Float32Array(segment.planet.SLICE_SIZE);
|
|
9
|
+
this.init();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
init() {}
|
|
13
|
+
|
|
14
|
+
clear() {
|
|
15
|
+
this.layers = null;
|
|
16
|
+
this.tileOffsetArr = null;
|
|
17
|
+
this.layerOpacityArr = null;
|
|
18
|
+
//this.visibleExtentOffsetArr = null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
append(layer, material) {
|
|
22
|
+
let n = this.layers.length;
|
|
23
|
+
|
|
24
|
+
this.layers.push(layer);
|
|
25
|
+
|
|
26
|
+
this.layerOpacityArr[n] = layer.opacity;
|
|
27
|
+
|
|
28
|
+
let n4 = n * 4;
|
|
29
|
+
|
|
30
|
+
let arr = layer.applyMaterial(material);
|
|
31
|
+
this.tileOffsetArr[n4] = arr[0];
|
|
32
|
+
this.tileOffsetArr[n4 + 1] = arr[1];
|
|
33
|
+
this.tileOffsetArr[n4 + 2] = arr[2];
|
|
34
|
+
this.tileOffsetArr[n4 + 3] = arr[3];
|
|
35
|
+
|
|
36
|
+
//arr = this.segment._getLayerExtentOffset(layer);
|
|
37
|
+
//slice.visibleExtentOffsetArr[n4] = arr[0];
|
|
38
|
+
//slice.visibleExtentOffsetArr[n4 + 1] = arr[1];
|
|
39
|
+
//slice.visibleExtentOffsetArr[n4 + 2] = arr[2];
|
|
40
|
+
//slice.visibleExtentOffsetArr[n4 + 3] = arr[3];
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Slice }
|