@hztxi/cesium-engine 25.0.6 → 25.0.7
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/Build/Workers/chunk-2GJAWJJT.js +1344 -0
- package/Build/Workers/chunk-2J2VS5RI.js +288 -0
- package/Build/Workers/chunk-375SHKGW.js +44 -0
- package/Build/Workers/chunk-5FYUSABU.js +945 -0
- package/Build/Workers/chunk-5WU37CUJ.js +630 -0
- package/Build/Workers/chunk-6EBDN5WS.js +97 -0
- package/Build/Workers/chunk-75HIWCEV.js +301 -0
- package/Build/Workers/chunk-7AMVPXZY.js +1992 -0
- package/Build/Workers/chunk-7BMDD6SM.js +124 -0
- package/Build/Workers/chunk-7OME2OKM.js +171 -0
- package/Build/Workers/chunk-A2BROW3D.js +352 -0
- package/Build/Workers/chunk-B4XOVZGA.js +476 -0
- package/Build/Workers/chunk-CDLPLYLV.js +1287 -0
- package/Build/Workers/chunk-CEKCKPFN.js +368 -0
- package/Build/Workers/chunk-CHMDKP5L.js +2342 -0
- package/Build/Workers/chunk-CWGB3D4Z.js +257 -0
- package/Build/Workers/chunk-DQEUGBGA.js +2719 -0
- package/Build/Workers/chunk-DUBE5G2H.js +497 -0
- package/Build/Workers/chunk-E4PBNWWK.js +58 -0
- package/Build/Workers/chunk-E5MWOMVC.js +57 -0
- package/Build/Workers/chunk-EE3XBOQI.js +1483 -0
- package/Build/Workers/chunk-EHA2ZDPZ.js +415 -0
- package/Build/Workers/chunk-EKEKPAJF.js +454 -0
- package/Build/Workers/chunk-EOHKUXPX.js +198 -0
- package/Build/Workers/chunk-ERENMHG2.js +754 -0
- package/Build/Workers/chunk-ESQGFRLZ.js +163 -0
- package/Build/Workers/chunk-FV4OWDV4.js +9230 -0
- package/Build/Workers/chunk-FYRNNQSL.js +280 -0
- package/Build/Workers/chunk-JMF4ATAS.js +3794 -0
- package/Build/Workers/chunk-KEJKMITY.js +82 -0
- package/Build/Workers/chunk-KW2QZDUS.js +147 -0
- package/Build/Workers/chunk-L6B5XPBL.js +73 -0
- package/Build/Workers/chunk-LGJXN2VP.js +352 -0
- package/Build/Workers/chunk-LY2UG3HV.js +38 -0
- package/Build/Workers/chunk-NCPJBP24.js +140 -0
- package/Build/Workers/chunk-NFY5V6MR.js +102 -0
- package/Build/Workers/chunk-OYPSUED3.js +1067 -0
- package/Build/Workers/chunk-QIOOTLWN.js +56 -0
- package/Build/Workers/chunk-QUPRALOD.js +101 -0
- package/Build/Workers/chunk-RBEVHHXK.js +3201 -0
- package/Build/Workers/chunk-RHO5HV52.js +305 -0
- package/Build/Workers/chunk-SVCZUP5R.js +837 -0
- package/Build/Workers/chunk-TBHW5UME.js +973 -0
- package/Build/Workers/chunk-TPOX6IOR.js +1054 -0
- package/Build/Workers/chunk-ULNBTI6R.js +138 -0
- package/Build/Workers/chunk-UMUS2AQQ.js +398 -0
- package/Build/Workers/chunk-UZ7GTP2L.js +162 -0
- package/Build/Workers/chunk-W3C7OHXF.js +387 -0
- package/Build/Workers/chunk-WB5GWYDP.js +455 -0
- package/Build/Workers/chunk-WN6MAL25.js +682 -0
- package/Build/Workers/chunk-WTR7KMQA.js +693 -0
- package/Build/Workers/chunk-WTTFMU3P.js +241 -0
- package/Build/Workers/chunk-WULONJZC.js +1800 -0
- package/Build/Workers/chunk-WZPMAVTV.js +511 -0
- package/Build/Workers/chunk-Y7KVUJEB.js +219 -0
- package/Build/Workers/chunk-Z6JV4DZG.js +1046 -0
- package/Build/Workers/chunk-ZTK5EBUI.js +76 -0
- package/Build/Workers/chunk-ZZPDORJK.js +56 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +95 -31
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +23 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/Core/GroundPolylineGeometry.js +99 -4
- package/Source/Core/PolylinePipeline.js +9 -2
- package/Source/DataSources/PolylineGeometryUpdater.js +125 -7
- package/Source/Scene/Camera.js +56 -3
- package/Source/Scene/CameraFlightPath.js +14 -0
- package/Source/Scene/ColumbusWorlds.js +190 -0
- package/Source/Scene/FrameState.js +10 -0
- package/Source/Scene/Globe.js +89 -22
- package/Source/Scene/GlobeDepth.js +216 -5
- package/Source/Scene/GlobeSurfaceTileProvider.js +897 -678
- package/Source/Scene/GroundPolylinePrimitive.js +2 -1
- package/Source/Scene/Polyline.js +32 -5
- package/Source/Scene/PolylineCollection.js +37 -0
- package/Source/Scene/Primitive.js +12 -13
- package/Source/Scene/PrimitivePipeline.js +158 -28
- package/Source/Scene/Scene.js +428 -5
- package/Source/Scene/SceneTransforms.js +17 -0
- package/Source/Scene/ScreenSpaceCameraController.js +12 -3
- package/Source/Shaders/PolylineShadowVolumeFS.glsl +14 -0
- package/Source/Shaders/PolylineShadowVolumeFS.js +14 -0
- package/Source/Shaders/RestoreDepth.glsl +8 -0
- package/Source/Shaders/RestoreDepth.js +10 -0
- package/index.d.ts +535 -1393
- package/index.js +138 -136
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ import VertexArray from "../Renderer/VertexArray.js";
|
|
|
38
38
|
import BlendingState from "./BlendingState.js";
|
|
39
39
|
import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
|
|
40
40
|
import ClippingPolygonCollection from "./ClippingPolygonCollection.js";
|
|
41
|
+
import ColumbusWorlds from "./ColumbusWorlds.js";
|
|
41
42
|
import DepthFunction from "./DepthFunction.js";
|
|
42
43
|
import GlobeSurfaceTile from "./GlobeSurfaceTile.js";
|
|
43
44
|
import ImageryLayer from "./ImageryLayer.js";
|
|
@@ -742,10 +743,32 @@ GlobeSurfaceTileProvider.prototype.computeTileVisibility = function (
|
|
|
742
743
|
const distance = this.computeDistanceToTile(tile, frameState);
|
|
743
744
|
tile._distance = distance;
|
|
744
745
|
|
|
746
|
+
// When Columbus repeat worlds are enabled, translated copies of this tile
|
|
747
|
+
// may be visible even when the tile's primary position is not (and vice
|
|
748
|
+
// versa). Resolve the visible copies up front so the fog test below and the
|
|
749
|
+
// frustum test further down account for them, and refine the LOD distance
|
|
750
|
+
// to the nearest visible copy rather than the primary sphere, which may be
|
|
751
|
+
// a full world away from the camera.
|
|
752
|
+
let columbusOffsets;
|
|
753
|
+
if (isColumbusRepeatActive(frameState)) {
|
|
754
|
+
columbusOffsets = computeColumbusTileWorldOffsets(this, tile, frameState);
|
|
755
|
+
if (defined(columbusOffsets)) {
|
|
756
|
+
if (columbusOffsets.length === 0) {
|
|
757
|
+
// Neither the tile nor any of its world copies is visible.
|
|
758
|
+
return Visibility.NONE;
|
|
759
|
+
}
|
|
760
|
+
tile._distance = nearestColumbusSphereDistance(
|
|
761
|
+
frameState.camera.positionWC,
|
|
762
|
+
columbusTileSphereScratch,
|
|
763
|
+
columbusOffsets,
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
745
768
|
const undergroundVisible = isUndergroundVisible(this, frameState);
|
|
746
769
|
|
|
747
770
|
if (frameState.fog.enabled && !undergroundVisible) {
|
|
748
|
-
if (CesiumMath.fog(
|
|
771
|
+
if (CesiumMath.fog(tile._distance, frameState.fog.density) >= 1.0) {
|
|
749
772
|
// Tile is completely in fog so return that it is not visible.
|
|
750
773
|
return Visibility.NONE;
|
|
751
774
|
}
|
|
@@ -848,6 +871,16 @@ GlobeSurfaceTileProvider.prototype.computeTileVisibility = function (
|
|
|
848
871
|
visibility = Visibility.FULL;
|
|
849
872
|
}
|
|
850
873
|
|
|
874
|
+
if (
|
|
875
|
+
visibility === Visibility.NONE &&
|
|
876
|
+
defined(columbusOffsets) &&
|
|
877
|
+
columbusOffsets.length > 0
|
|
878
|
+
) {
|
|
879
|
+
// The tile's primary position is outside the frustum, but one of its
|
|
880
|
+
// translated Columbus world copies is visible.
|
|
881
|
+
visibility = Visibility.PARTIAL;
|
|
882
|
+
}
|
|
883
|
+
|
|
851
884
|
if (visibility === Visibility.NONE) {
|
|
852
885
|
return visibility;
|
|
853
886
|
}
|
|
@@ -1078,6 +1111,142 @@ const centerEyeScratch = new Cartesian3();
|
|
|
1078
1111
|
const southwestScratch = new Cartesian3();
|
|
1079
1112
|
const northeastScratch = new Cartesian3();
|
|
1080
1113
|
|
|
1114
|
+
// How many world copies to test and render on either side of the camera's
|
|
1115
|
+
// own world when Columbus repeat worlds are enabled. Five visible worlds is
|
|
1116
|
+
// far beyond any practical viewport while bounding worst-case command count.
|
|
1117
|
+
const COLUMBUS_MAX_EXTRA_WORLDS = 2;
|
|
1118
|
+
|
|
1119
|
+
const columbusRepeatSphereScratch = new BoundingSphere();
|
|
1120
|
+
const columbusNearestCenterScratch = new Cartesian3();
|
|
1121
|
+
|
|
1122
|
+
const DEFAULT_COLUMBUS_WORLD_OFFSETS = [0.0];
|
|
1123
|
+
const COLUMBUS_VISIBILITY_WORLD_OFFSETS = [];
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Whether Columbus repeat worlds are enabled for this frame. Only meaningful
|
|
1127
|
+
* in {@link SceneMode.COLUMBUS_VIEW}; other modes never repeat.
|
|
1128
|
+
*
|
|
1129
|
+
* @private
|
|
1130
|
+
*/
|
|
1131
|
+
function isColumbusRepeatActive(frameState) {
|
|
1132
|
+
return (
|
|
1133
|
+
frameState.columbusRepeatWorlds === true &&
|
|
1134
|
+
frameState.mode === SceneMode.COLUMBUS_VIEW
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* The projected width, in meters, of one full world (360° of longitude) under
|
|
1140
|
+
* the scene's map projection. Cached per projection instance.
|
|
1141
|
+
*
|
|
1142
|
+
* @private
|
|
1143
|
+
*/
|
|
1144
|
+
function getColumbusWorldWidth(tileProvider, frameState) {
|
|
1145
|
+
return ColumbusWorlds.getWorldWidth(frameState.mapProjection);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Computes the world offsets, in projected meters, at which translated copies
|
|
1150
|
+
* of the given Columbus-view bounding sphere are visible. Offset 0 (the tile
|
|
1151
|
+
* itself) is only included when the sphere is visible. The result is a shared
|
|
1152
|
+
* scratch array; consume it before this is called again.
|
|
1153
|
+
*
|
|
1154
|
+
* @private
|
|
1155
|
+
*/
|
|
1156
|
+
function computeColumbusWorldOffsets(
|
|
1157
|
+
sphere,
|
|
1158
|
+
cullingVolume,
|
|
1159
|
+
cameraY,
|
|
1160
|
+
worldWidth,
|
|
1161
|
+
result,
|
|
1162
|
+
) {
|
|
1163
|
+
result.length = 0;
|
|
1164
|
+
const cameraWorld = Math.round(cameraY / worldWidth);
|
|
1165
|
+
const testSphere = columbusRepeatSphereScratch;
|
|
1166
|
+
for (
|
|
1167
|
+
let w = cameraWorld - COLUMBUS_MAX_EXTRA_WORLDS;
|
|
1168
|
+
w <= cameraWorld + COLUMBUS_MAX_EXTRA_WORLDS;
|
|
1169
|
+
++w
|
|
1170
|
+
) {
|
|
1171
|
+
const offset = w * worldWidth;
|
|
1172
|
+
Cartesian3.clone(sphere.center, testSphere.center);
|
|
1173
|
+
testSphere.center.y += offset;
|
|
1174
|
+
testSphere.radius = sphere.radius;
|
|
1175
|
+
if (cullingVolume.computeVisibility(testSphere) !== Intersect.OUTSIDE) {
|
|
1176
|
+
result.push(offset);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return result;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Distance from the camera to the nearest visible copy of the given sphere,
|
|
1184
|
+
* used for LOD (SSE) and fog so a copy rendered under the camera is treated
|
|
1185
|
+
* as near even though the tile's primary position is a world away.
|
|
1186
|
+
*
|
|
1187
|
+
* @private
|
|
1188
|
+
*/
|
|
1189
|
+
function nearestColumbusSphereDistance(cameraPosition, sphere, offsets) {
|
|
1190
|
+
let nearest = Number.POSITIVE_INFINITY;
|
|
1191
|
+
const center = columbusNearestCenterScratch;
|
|
1192
|
+
for (let i = 0; i < offsets.length; ++i) {
|
|
1193
|
+
Cartesian3.clone(sphere.center, center);
|
|
1194
|
+
center.y += offsets[i];
|
|
1195
|
+
nearest = Math.min(
|
|
1196
|
+
nearest,
|
|
1197
|
+
Math.max(
|
|
1198
|
+
0.0,
|
|
1199
|
+
Cartesian3.distance(cameraPosition, center) - sphere.radius,
|
|
1200
|
+
),
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1203
|
+
return nearest;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
const columbusTileSphereScratch = new BoundingSphere();
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Builds the Columbus-view (height, u, v) bounding sphere for a tile and
|
|
1210
|
+
* computes which world copies of it are visible. Returns undefined when the
|
|
1211
|
+
* tile's min/max heights are not known yet; returns an empty array when
|
|
1212
|
+
* neither the tile nor any copy is visible. The sphere is left in
|
|
1213
|
+
* columbusTileSphereScratch for immediate distance computations.
|
|
1214
|
+
*
|
|
1215
|
+
* @private
|
|
1216
|
+
*/
|
|
1217
|
+
function computeColumbusTileWorldOffsets(tileProvider, tile, frameState) {
|
|
1218
|
+
const surfaceTile = tile.data;
|
|
1219
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
1220
|
+
if (
|
|
1221
|
+
surfaceTile.boundingVolumeSourceTile === undefined ||
|
|
1222
|
+
!defined(tileBoundingRegion)
|
|
1223
|
+
) {
|
|
1224
|
+
return undefined;
|
|
1225
|
+
}
|
|
1226
|
+
const sphere = BoundingSphere.fromRectangleWithHeights2D(
|
|
1227
|
+
tile.rectangle,
|
|
1228
|
+
frameState.mapProjection,
|
|
1229
|
+
tileBoundingRegion.minimumHeight,
|
|
1230
|
+
tileBoundingRegion.maximumHeight,
|
|
1231
|
+
columbusTileSphereScratch,
|
|
1232
|
+
);
|
|
1233
|
+
// fromRectangleWithHeights2D returns the sphere in projected
|
|
1234
|
+
// (u, v, height) order; shuffle to the Columbus world axes (height, u, v).
|
|
1235
|
+
Cartesian3.fromElements(
|
|
1236
|
+
sphere.center.z,
|
|
1237
|
+
sphere.center.x,
|
|
1238
|
+
sphere.center.y,
|
|
1239
|
+
sphere.center,
|
|
1240
|
+
);
|
|
1241
|
+
return computeColumbusWorldOffsets(
|
|
1242
|
+
sphere,
|
|
1243
|
+
frameState.cullingVolume,
|
|
1244
|
+
frameState.camera.positionWC.y,
|
|
1245
|
+
getColumbusWorldWidth(tileProvider, frameState),
|
|
1246
|
+
COLUMBUS_VISIBILITY_WORLD_OFFSETS,
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1081
1250
|
/**
|
|
1082
1251
|
* Shows a specified tile in this frame. The provider can cause the tile to be shown by adding
|
|
1083
1252
|
* render commands to the commandList, or use any other method as appropriate. The tile is not
|
|
@@ -2507,7 +2676,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2507
2676
|
surfaceShaderSetOptions.hasExaggeration = hasExaggeration;
|
|
2508
2677
|
|
|
2509
2678
|
const tileImageryCollection = surfaceTile.imagery;
|
|
2510
|
-
let imageryIndex
|
|
2679
|
+
let imageryIndex;
|
|
2511
2680
|
const imageryLen = tileImageryCollection.length;
|
|
2512
2681
|
|
|
2513
2682
|
const showSkirts =
|
|
@@ -2543,744 +2712,794 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2543
2712
|
}
|
|
2544
2713
|
}
|
|
2545
2714
|
|
|
2546
|
-
|
|
2547
|
-
|
|
2715
|
+
// Columbus repeat worlds: render a translated copy of this tile for every
|
|
2716
|
+
// visible world offset. Copy w is placed at u + w*worldWidth by shifting
|
|
2717
|
+
// the RTC center along the map-u axis; the projected tile rectangle is
|
|
2718
|
+
// RTC-relative, so it must NOT be shifted again (shifting both would move
|
|
2719
|
+
// the copy by 2*w*worldWidth). The vertex array and imagery textures are
|
|
2720
|
+
// shared with the primary tile, so copies cost no extra tile loads or
|
|
2721
|
+
// texture memory.
|
|
2722
|
+
let worldOffsets = DEFAULT_COLUMBUS_WORLD_OFFSETS;
|
|
2723
|
+
let baseRtcY = 0.0;
|
|
2724
|
+
if (isColumbusRepeatActive(frameState)) {
|
|
2725
|
+
const copyOffsets = computeColumbusTileWorldOffsets(
|
|
2726
|
+
tileProvider,
|
|
2727
|
+
tile,
|
|
2728
|
+
frameState,
|
|
2729
|
+
);
|
|
2730
|
+
if (defined(copyOffsets) && copyOffsets.length > 0) {
|
|
2731
|
+
worldOffsets = copyOffsets;
|
|
2732
|
+
baseRtcY = rtc.y;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2548
2735
|
|
|
2549
|
-
|
|
2550
|
-
|
|
2736
|
+
for (let worldIndex = 0; worldIndex < worldOffsets.length; ++worldIndex) {
|
|
2737
|
+
const worldOffset = worldOffsets[worldIndex];
|
|
2738
|
+
if (worldOffsets !== DEFAULT_COLUMBUS_WORLD_OFFSETS) {
|
|
2739
|
+
// rtc is the rtcScratch center in Columbus view; shift it along the
|
|
2740
|
+
// map-u axis so per-vertex RTC math stays numerically identical.
|
|
2741
|
+
rtc.y = baseRtcY + worldOffset;
|
|
2742
|
+
}
|
|
2743
|
+
imageryIndex = 0;
|
|
2551
2744
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
command.owner = tile;
|
|
2555
|
-
command.cull = false;
|
|
2556
|
-
command.boundingVolume = new BoundingSphere();
|
|
2557
|
-
command.orientedBoundingBox = undefined;
|
|
2745
|
+
do {
|
|
2746
|
+
let numberOfDayTextures = 0;
|
|
2558
2747
|
|
|
2559
|
-
|
|
2748
|
+
let command;
|
|
2749
|
+
let uniformMap;
|
|
2560
2750
|
|
|
2561
|
-
tileProvider._drawCommands.
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2751
|
+
if (tileProvider._drawCommands.length <= tileProvider._usedDrawCommands) {
|
|
2752
|
+
command = new DrawCommand();
|
|
2753
|
+
command.owner = tile;
|
|
2754
|
+
command.cull = false;
|
|
2755
|
+
command.boundingVolume = new BoundingSphere();
|
|
2756
|
+
command.orientedBoundingBox = undefined;
|
|
2567
2757
|
|
|
2568
|
-
|
|
2758
|
+
uniformMap = createTileUniformMap(frameState, tileProvider);
|
|
2569
2759
|
|
|
2570
|
-
|
|
2760
|
+
tileProvider._drawCommands.push(command);
|
|
2761
|
+
tileProvider._uniformMaps.push(uniformMap);
|
|
2762
|
+
} else {
|
|
2763
|
+
command = tileProvider._drawCommands[tileProvider._usedDrawCommands];
|
|
2764
|
+
uniformMap = tileProvider._uniformMaps[tileProvider._usedDrawCommands];
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
command.owner = tile;
|
|
2571
2768
|
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2769
|
+
++tileProvider._usedDrawCommands;
|
|
2770
|
+
|
|
2771
|
+
if (tile === tileProvider._debug.boundingSphereTile) {
|
|
2772
|
+
const obb = tileBoundingRegion.boundingVolume;
|
|
2773
|
+
const boundingSphere = tileBoundingRegion.boundingSphere;
|
|
2774
|
+
// If a debug primitive already exists for this tile, it will not be
|
|
2775
|
+
// re-created, to avoid allocation every frame. If it were possible
|
|
2776
|
+
// to have more than one selected tile, this would have to change.
|
|
2777
|
+
if (defined(obb)) {
|
|
2778
|
+
getDebugOrientedBoundingBox(obb, Color.RED).update(frameState);
|
|
2779
|
+
} else if (defined(boundingSphere)) {
|
|
2780
|
+
getDebugBoundingSphere(boundingSphere, Color.RED).update(frameState);
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
const uniformMapProperties = uniformMap.properties;
|
|
2785
|
+
Cartesian4.clone(initialColor, uniformMapProperties.initialColor);
|
|
2786
|
+
uniformMapProperties.oceanNormalMap = oceanNormalMap;
|
|
2787
|
+
uniformMapProperties.lightingFadeDistance.x =
|
|
2788
|
+
tileProvider.lightingFadeOutDistance;
|
|
2789
|
+
uniformMapProperties.lightingFadeDistance.y =
|
|
2790
|
+
tileProvider.lightingFadeInDistance;
|
|
2791
|
+
uniformMapProperties.nightFadeDistance.x =
|
|
2792
|
+
tileProvider.nightFadeOutDistance;
|
|
2793
|
+
uniformMapProperties.nightFadeDistance.y =
|
|
2794
|
+
tileProvider.nightFadeInDistance;
|
|
2795
|
+
uniformMapProperties.atmosphereLightIntensity =
|
|
2796
|
+
tileProvider.atmosphereLightIntensity;
|
|
2797
|
+
uniformMapProperties.atmosphereRayleighCoefficient =
|
|
2798
|
+
tileProvider.atmosphereRayleighCoefficient;
|
|
2799
|
+
uniformMapProperties.atmosphereMieCoefficient =
|
|
2800
|
+
tileProvider.atmosphereMieCoefficient;
|
|
2801
|
+
uniformMapProperties.atmosphereRayleighScaleHeight =
|
|
2802
|
+
tileProvider.atmosphereRayleighScaleHeight;
|
|
2803
|
+
uniformMapProperties.atmosphereMieScaleHeight =
|
|
2804
|
+
tileProvider.atmosphereMieScaleHeight;
|
|
2805
|
+
uniformMapProperties.atmosphereMieAnisotropy =
|
|
2806
|
+
tileProvider.atmosphereMieAnisotropy;
|
|
2807
|
+
uniformMapProperties.zoomedOutOceanSpecularIntensity =
|
|
2808
|
+
tileProvider.zoomedOutOceanSpecularIntensity;
|
|
2809
|
+
|
|
2810
|
+
const frontFaceAlphaByDistanceFinal = cameraUnderground
|
|
2811
|
+
? backFaceAlphaByDistance
|
|
2812
|
+
: frontFaceAlphaByDistance;
|
|
2813
|
+
const backFaceAlphaByDistanceFinal = cameraUnderground
|
|
2814
|
+
? frontFaceAlphaByDistance
|
|
2815
|
+
: backFaceAlphaByDistance;
|
|
2816
|
+
|
|
2817
|
+
if (defined(frontFaceAlphaByDistanceFinal)) {
|
|
2818
|
+
Cartesian4.fromElements(
|
|
2819
|
+
frontFaceAlphaByDistanceFinal.near,
|
|
2820
|
+
frontFaceAlphaByDistanceFinal.nearValue,
|
|
2821
|
+
frontFaceAlphaByDistanceFinal.far,
|
|
2822
|
+
frontFaceAlphaByDistanceFinal.farValue,
|
|
2823
|
+
uniformMapProperties.frontFaceAlphaByDistance,
|
|
2824
|
+
);
|
|
2825
|
+
Cartesian4.fromElements(
|
|
2826
|
+
backFaceAlphaByDistanceFinal.near,
|
|
2827
|
+
backFaceAlphaByDistanceFinal.nearValue,
|
|
2828
|
+
backFaceAlphaByDistanceFinal.far,
|
|
2829
|
+
backFaceAlphaByDistanceFinal.farValue,
|
|
2830
|
+
uniformMapProperties.backFaceAlphaByDistance,
|
|
2831
|
+
);
|
|
2582
2832
|
}
|
|
2583
|
-
}
|
|
2584
2833
|
|
|
2585
|
-
const uniformMapProperties = uniformMap.properties;
|
|
2586
|
-
Cartesian4.clone(initialColor, uniformMapProperties.initialColor);
|
|
2587
|
-
uniformMapProperties.oceanNormalMap = oceanNormalMap;
|
|
2588
|
-
uniformMapProperties.lightingFadeDistance.x =
|
|
2589
|
-
tileProvider.lightingFadeOutDistance;
|
|
2590
|
-
uniformMapProperties.lightingFadeDistance.y =
|
|
2591
|
-
tileProvider.lightingFadeInDistance;
|
|
2592
|
-
uniformMapProperties.nightFadeDistance.x =
|
|
2593
|
-
tileProvider.nightFadeOutDistance;
|
|
2594
|
-
uniformMapProperties.nightFadeDistance.y = tileProvider.nightFadeInDistance;
|
|
2595
|
-
uniformMapProperties.atmosphereLightIntensity =
|
|
2596
|
-
tileProvider.atmosphereLightIntensity;
|
|
2597
|
-
uniformMapProperties.atmosphereRayleighCoefficient =
|
|
2598
|
-
tileProvider.atmosphereRayleighCoefficient;
|
|
2599
|
-
uniformMapProperties.atmosphereMieCoefficient =
|
|
2600
|
-
tileProvider.atmosphereMieCoefficient;
|
|
2601
|
-
uniformMapProperties.atmosphereRayleighScaleHeight =
|
|
2602
|
-
tileProvider.atmosphereRayleighScaleHeight;
|
|
2603
|
-
uniformMapProperties.atmosphereMieScaleHeight =
|
|
2604
|
-
tileProvider.atmosphereMieScaleHeight;
|
|
2605
|
-
uniformMapProperties.atmosphereMieAnisotropy =
|
|
2606
|
-
tileProvider.atmosphereMieAnisotropy;
|
|
2607
|
-
uniformMapProperties.zoomedOutOceanSpecularIntensity =
|
|
2608
|
-
tileProvider.zoomedOutOceanSpecularIntensity;
|
|
2609
|
-
|
|
2610
|
-
const frontFaceAlphaByDistanceFinal = cameraUnderground
|
|
2611
|
-
? backFaceAlphaByDistance
|
|
2612
|
-
: frontFaceAlphaByDistance;
|
|
2613
|
-
const backFaceAlphaByDistanceFinal = cameraUnderground
|
|
2614
|
-
? frontFaceAlphaByDistance
|
|
2615
|
-
: backFaceAlphaByDistance;
|
|
2616
|
-
|
|
2617
|
-
if (defined(frontFaceAlphaByDistanceFinal)) {
|
|
2618
|
-
Cartesian4.fromElements(
|
|
2619
|
-
frontFaceAlphaByDistanceFinal.near,
|
|
2620
|
-
frontFaceAlphaByDistanceFinal.nearValue,
|
|
2621
|
-
frontFaceAlphaByDistanceFinal.far,
|
|
2622
|
-
frontFaceAlphaByDistanceFinal.farValue,
|
|
2623
|
-
uniformMapProperties.frontFaceAlphaByDistance,
|
|
2624
|
-
);
|
|
2625
2834
|
Cartesian4.fromElements(
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
uniformMapProperties.
|
|
2835
|
+
undergroundColorAlphaByDistance.near,
|
|
2836
|
+
undergroundColorAlphaByDistance.nearValue,
|
|
2837
|
+
undergroundColorAlphaByDistance.far,
|
|
2838
|
+
undergroundColorAlphaByDistance.farValue,
|
|
2839
|
+
uniformMapProperties.undergroundColorAlphaByDistance,
|
|
2631
2840
|
);
|
|
2632
|
-
|
|
2841
|
+
Color.clone(undergroundColor, uniformMapProperties.undergroundColor);
|
|
2842
|
+
|
|
2843
|
+
uniformMapProperties.lambertDiffuseMultiplier = lambertDiffuseMultiplier;
|
|
2844
|
+
uniformMapProperties.vertexShadowDarkness = vertexShadowDarkness;
|
|
2845
|
+
|
|
2846
|
+
const highlightFillTile =
|
|
2847
|
+
!defined(surfaceTile.vertexArray) &&
|
|
2848
|
+
defined(tileProvider.fillHighlightColor) &&
|
|
2849
|
+
tileProvider.fillHighlightColor.alpha > 0.0;
|
|
2850
|
+
if (highlightFillTile) {
|
|
2851
|
+
Color.clone(
|
|
2852
|
+
tileProvider.fillHighlightColor,
|
|
2853
|
+
uniformMapProperties.fillHighlightColor,
|
|
2854
|
+
);
|
|
2855
|
+
}
|
|
2633
2856
|
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
uniformMapProperties.
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2857
|
+
uniformMapProperties.verticalExaggerationAndRelativeHeight.x =
|
|
2858
|
+
exaggeration;
|
|
2859
|
+
uniformMapProperties.verticalExaggerationAndRelativeHeight.y =
|
|
2860
|
+
exaggerationRelativeHeight;
|
|
2861
|
+
|
|
2862
|
+
uniformMapProperties.center3D = mesh.center;
|
|
2863
|
+
Cartesian3.clone(rtc, uniformMapProperties.rtc);
|
|
2864
|
+
|
|
2865
|
+
Cartesian4.clone(tileRectangle, uniformMapProperties.tileRectangle);
|
|
2866
|
+
uniformMapProperties.southAndNorthLatitude.x = southLatitude;
|
|
2867
|
+
uniformMapProperties.southAndNorthLatitude.y = northLatitude;
|
|
2868
|
+
uniformMapProperties.southMercatorYAndOneOverHeight.x = southMercatorY;
|
|
2869
|
+
uniformMapProperties.southMercatorYAndOneOverHeight.y =
|
|
2870
|
+
oneOverMercatorHeight;
|
|
2871
|
+
|
|
2872
|
+
// Convert tile limiter rectangle from cartographic to texture space using the tileRectangle.
|
|
2873
|
+
const localizedCartographicLimitRectangle =
|
|
2874
|
+
localizedCartographicLimitRectangleScratch;
|
|
2875
|
+
const cartographicLimitRectangle = clipRectangleAntimeridian(
|
|
2876
|
+
tile.rectangle,
|
|
2877
|
+
tileProvider.cartographicLimitRectangle,
|
|
2654
2878
|
);
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
uniformMapProperties.verticalExaggerationAndRelativeHeight.x = exaggeration;
|
|
2658
|
-
uniformMapProperties.verticalExaggerationAndRelativeHeight.y =
|
|
2659
|
-
exaggerationRelativeHeight;
|
|
2660
2879
|
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
uniformMapProperties.southMercatorYAndOneOverHeight.x = southMercatorY;
|
|
2668
|
-
uniformMapProperties.southMercatorYAndOneOverHeight.y =
|
|
2669
|
-
oneOverMercatorHeight;
|
|
2670
|
-
|
|
2671
|
-
// Convert tile limiter rectangle from cartographic to texture space using the tileRectangle.
|
|
2672
|
-
const localizedCartographicLimitRectangle =
|
|
2673
|
-
localizedCartographicLimitRectangleScratch;
|
|
2674
|
-
const cartographicLimitRectangle = clipRectangleAntimeridian(
|
|
2675
|
-
tile.rectangle,
|
|
2676
|
-
tileProvider.cartographicLimitRectangle,
|
|
2677
|
-
);
|
|
2678
|
-
|
|
2679
|
-
const localizedTranslucencyRectangle =
|
|
2680
|
-
localizedTranslucencyRectangleScratch;
|
|
2681
|
-
const clippedTranslucencyRectangle = clipRectangleAntimeridian(
|
|
2682
|
-
tile.rectangle,
|
|
2683
|
-
translucencyRectangle,
|
|
2684
|
-
);
|
|
2685
|
-
|
|
2686
|
-
Cartesian3.fromElements(
|
|
2687
|
-
hueShift,
|
|
2688
|
-
saturationShift,
|
|
2689
|
-
brightnessShift,
|
|
2690
|
-
uniformMapProperties.hsbShift,
|
|
2691
|
-
);
|
|
2880
|
+
const localizedTranslucencyRectangle =
|
|
2881
|
+
localizedTranslucencyRectangleScratch;
|
|
2882
|
+
const clippedTranslucencyRectangle = clipRectangleAntimeridian(
|
|
2883
|
+
tile.rectangle,
|
|
2884
|
+
translucencyRectangle,
|
|
2885
|
+
);
|
|
2692
2886
|
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
localizedCartographicLimitRectangle.y =
|
|
2700
|
-
(cartographicLimitRectangle.south - cartographicTileRectangle.south) *
|
|
2701
|
-
inverseTileHeight;
|
|
2702
|
-
localizedCartographicLimitRectangle.z =
|
|
2703
|
-
(cartographicLimitRectangle.east - cartographicTileRectangle.west) *
|
|
2704
|
-
inverseTileWidth;
|
|
2705
|
-
localizedCartographicLimitRectangle.w =
|
|
2706
|
-
(cartographicLimitRectangle.north - cartographicTileRectangle.south) *
|
|
2707
|
-
inverseTileHeight;
|
|
2708
|
-
|
|
2709
|
-
Cartesian4.clone(
|
|
2710
|
-
localizedCartographicLimitRectangle,
|
|
2711
|
-
uniformMapProperties.localizedCartographicLimitRectangle,
|
|
2712
|
-
);
|
|
2887
|
+
Cartesian3.fromElements(
|
|
2888
|
+
hueShift,
|
|
2889
|
+
saturationShift,
|
|
2890
|
+
brightnessShift,
|
|
2891
|
+
uniformMapProperties.hsbShift,
|
|
2892
|
+
);
|
|
2713
2893
|
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2894
|
+
const cartographicTileRectangle = tile.rectangle;
|
|
2895
|
+
const inverseTileWidth = 1.0 / cartographicTileRectangle.width;
|
|
2896
|
+
const inverseTileHeight = 1.0 / cartographicTileRectangle.height;
|
|
2897
|
+
localizedCartographicLimitRectangle.x =
|
|
2898
|
+
(cartographicLimitRectangle.west - cartographicTileRectangle.west) *
|
|
2899
|
+
inverseTileWidth;
|
|
2900
|
+
localizedCartographicLimitRectangle.y =
|
|
2901
|
+
(cartographicLimitRectangle.south - cartographicTileRectangle.south) *
|
|
2902
|
+
inverseTileHeight;
|
|
2903
|
+
localizedCartographicLimitRectangle.z =
|
|
2904
|
+
(cartographicLimitRectangle.east - cartographicTileRectangle.west) *
|
|
2905
|
+
inverseTileWidth;
|
|
2906
|
+
localizedCartographicLimitRectangle.w =
|
|
2907
|
+
(cartographicLimitRectangle.north - cartographicTileRectangle.south) *
|
|
2908
|
+
inverseTileHeight;
|
|
2909
|
+
|
|
2910
|
+
Cartesian4.clone(
|
|
2911
|
+
localizedCartographicLimitRectangle,
|
|
2912
|
+
uniformMapProperties.localizedCartographicLimitRectangle,
|
|
2913
|
+
);
|
|
2731
2914
|
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
let applyToneMatchEdge = false;
|
|
2750
|
-
let applyToneMatchCross = false;
|
|
2751
|
-
let crossUnits = 0;
|
|
2752
|
-
let applySplit = false;
|
|
2753
|
-
let applyCutout = false;
|
|
2754
|
-
let applyColorToAlpha = false;
|
|
2755
|
-
|
|
2756
|
-
while (numberOfDayTextures < maxTextures && imageryIndex < imageryLen) {
|
|
2757
|
-
const tileImagery = tileImageryCollection[imageryIndex];
|
|
2758
|
-
const imagery = tileImagery.readyImagery;
|
|
2759
|
-
++imageryIndex;
|
|
2760
|
-
|
|
2761
|
-
if (!defined(imagery) || imagery.imageryLayer.alpha === 0.0) {
|
|
2762
|
-
continue;
|
|
2763
|
-
}
|
|
2915
|
+
localizedTranslucencyRectangle.x =
|
|
2916
|
+
(clippedTranslucencyRectangle.west - cartographicTileRectangle.west) *
|
|
2917
|
+
inverseTileWidth;
|
|
2918
|
+
localizedTranslucencyRectangle.y =
|
|
2919
|
+
(clippedTranslucencyRectangle.south - cartographicTileRectangle.south) *
|
|
2920
|
+
inverseTileHeight;
|
|
2921
|
+
localizedTranslucencyRectangle.z =
|
|
2922
|
+
(clippedTranslucencyRectangle.east - cartographicTileRectangle.west) *
|
|
2923
|
+
inverseTileWidth;
|
|
2924
|
+
localizedTranslucencyRectangle.w =
|
|
2925
|
+
(clippedTranslucencyRectangle.north - cartographicTileRectangle.south) *
|
|
2926
|
+
inverseTileHeight;
|
|
2927
|
+
|
|
2928
|
+
Cartesian4.clone(
|
|
2929
|
+
localizedTranslucencyRectangle,
|
|
2930
|
+
uniformMapProperties.localizedTranslucencyRectangle,
|
|
2931
|
+
);
|
|
2764
2932
|
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2933
|
+
// For performance, render fog only when fog is enabled and the effect of
|
|
2934
|
+
// fog would be non-negligible. This prevents the shader from running when
|
|
2935
|
+
// the camera is in space, for example.
|
|
2936
|
+
const applyFog =
|
|
2937
|
+
enableFog &&
|
|
2938
|
+
CesiumMath.fog(tile._distance, frameState.fog.density) >
|
|
2939
|
+
CesiumMath.EPSILON3;
|
|
2940
|
+
colorCorrect = colorCorrect && (applyFog || showGroundAtmosphere);
|
|
2941
|
+
|
|
2942
|
+
let applyBrightness = false;
|
|
2943
|
+
let applyContrast = false;
|
|
2944
|
+
let applyHue = false;
|
|
2945
|
+
let applySaturation = false;
|
|
2946
|
+
let applyGamma = false;
|
|
2947
|
+
let applyAlpha = false;
|
|
2948
|
+
let applyDayNightAlpha = false;
|
|
2949
|
+
let applyToneMatch = false;
|
|
2950
|
+
let applyToneMatchEdge = false;
|
|
2951
|
+
let applyToneMatchCross = false;
|
|
2952
|
+
let crossUnits = 0;
|
|
2953
|
+
let applySplit = false;
|
|
2954
|
+
let applyCutout = false;
|
|
2955
|
+
let applyColorToAlpha = false;
|
|
2956
|
+
|
|
2957
|
+
while (numberOfDayTextures < maxTextures && imageryIndex < imageryLen) {
|
|
2958
|
+
const tileImagery = tileImageryCollection[imageryIndex];
|
|
2959
|
+
const imagery = tileImagery.readyImagery;
|
|
2960
|
+
++imageryIndex;
|
|
2961
|
+
|
|
2962
|
+
if (!defined(imagery) || imagery.imageryLayer.alpha === 0.0) {
|
|
2963
|
+
continue;
|
|
2964
|
+
}
|
|
2768
2965
|
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2966
|
+
const texture = tileImagery.useWebMercatorT
|
|
2967
|
+
? imagery.textureWebMercator
|
|
2968
|
+
: imagery.texture;
|
|
2969
|
+
|
|
2970
|
+
//>>includeStart('debug', pragmas.debug);
|
|
2971
|
+
if (!defined(texture)) {
|
|
2972
|
+
// Our "ready" texture isn't actually ready. This should never happen.
|
|
2973
|
+
//
|
|
2974
|
+
// Side note: It IS possible for it to not be in the READY ImageryState, though.
|
|
2975
|
+
// This can happen when a single imagery tile is shared by two terrain tiles (common)
|
|
2976
|
+
// and one of them (A) needs a geographic version of the tile because it is near the poles,
|
|
2977
|
+
// and the other (B) does not. B can and will transition the imagery tile to the READY state
|
|
2978
|
+
// without reprojecting to geographic. Then, later, A will deem that same tile not-ready-yet
|
|
2979
|
+
// because it only has the Web Mercator texture, and flip it back to the TRANSITIONING state.
|
|
2980
|
+
// The imagery tile won't be in the READY state anymore, but it's still READY enough for B's
|
|
2981
|
+
// purposes.
|
|
2982
|
+
throw new DeveloperError("readyImagery is not actually ready!");
|
|
2983
|
+
}
|
|
2984
|
+
//>>includeEnd('debug');
|
|
2784
2985
|
|
|
2785
|
-
|
|
2986
|
+
const imageryLayer = imagery.imageryLayer;
|
|
2786
2987
|
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2988
|
+
if (!defined(tileImagery.textureTranslationAndScale)) {
|
|
2989
|
+
tileImagery.textureTranslationAndScale =
|
|
2990
|
+
imageryLayer._calculateTextureTranslationAndScale(
|
|
2991
|
+
tile,
|
|
2992
|
+
tileImagery,
|
|
2993
|
+
);
|
|
2994
|
+
}
|
|
2791
2995
|
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
applyAlpha
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
applyDayNightAlpha
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2996
|
+
uniformMapProperties.dayTextures[numberOfDayTextures] = texture;
|
|
2997
|
+
uniformMapProperties.dayTextureTranslationAndScale[
|
|
2998
|
+
numberOfDayTextures
|
|
2999
|
+
] = tileImagery.textureTranslationAndScale;
|
|
3000
|
+
uniformMapProperties.dayTextureTexCoordsRectangle[numberOfDayTextures] =
|
|
3001
|
+
tileImagery.textureCoordinateRectangle;
|
|
3002
|
+
uniformMapProperties.dayTextureUseWebMercatorT[numberOfDayTextures] =
|
|
3003
|
+
tileImagery.useWebMercatorT;
|
|
3004
|
+
|
|
3005
|
+
uniformMapProperties.dayTextureAlpha[numberOfDayTextures] =
|
|
3006
|
+
imageryLayer.alpha;
|
|
3007
|
+
applyAlpha =
|
|
3008
|
+
applyAlpha ||
|
|
3009
|
+
uniformMapProperties.dayTextureAlpha[numberOfDayTextures] !== 1.0;
|
|
3010
|
+
|
|
3011
|
+
uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] =
|
|
3012
|
+
imageryLayer.nightAlpha;
|
|
3013
|
+
applyDayNightAlpha =
|
|
3014
|
+
applyDayNightAlpha ||
|
|
3015
|
+
uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] !==
|
|
3016
|
+
1.0;
|
|
3017
|
+
|
|
3018
|
+
uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] =
|
|
3019
|
+
imageryLayer.dayAlpha;
|
|
3020
|
+
applyDayNightAlpha =
|
|
3021
|
+
applyDayNightAlpha ||
|
|
3022
|
+
uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] !== 1.0;
|
|
3023
|
+
|
|
3024
|
+
uniformMapProperties.dayTextureBrightness[numberOfDayTextures] =
|
|
3025
|
+
imageryLayer.brightness;
|
|
3026
|
+
applyBrightness =
|
|
3027
|
+
applyBrightness ||
|
|
3028
|
+
uniformMapProperties.dayTextureBrightness[numberOfDayTextures] !==
|
|
3029
|
+
ImageryLayer.DEFAULT_BRIGHTNESS;
|
|
3030
|
+
|
|
3031
|
+
uniformMapProperties.dayTextureContrast[numberOfDayTextures] =
|
|
3032
|
+
imageryLayer.contrast;
|
|
3033
|
+
applyContrast =
|
|
3034
|
+
applyContrast ||
|
|
3035
|
+
uniformMapProperties.dayTextureContrast[numberOfDayTextures] !==
|
|
3036
|
+
ImageryLayer.DEFAULT_CONTRAST;
|
|
3037
|
+
|
|
3038
|
+
uniformMapProperties.dayTextureHue[numberOfDayTextures] =
|
|
3039
|
+
imageryLayer.hue;
|
|
3040
|
+
applyHue =
|
|
3041
|
+
applyHue ||
|
|
3042
|
+
uniformMapProperties.dayTextureHue[numberOfDayTextures] !==
|
|
3043
|
+
ImageryLayer.DEFAULT_HUE;
|
|
3044
|
+
|
|
3045
|
+
uniformMapProperties.dayTextureSaturation[numberOfDayTextures] =
|
|
3046
|
+
imageryLayer.saturation;
|
|
3047
|
+
applySaturation =
|
|
3048
|
+
applySaturation ||
|
|
3049
|
+
uniformMapProperties.dayTextureSaturation[numberOfDayTextures] !==
|
|
3050
|
+
ImageryLayer.DEFAULT_SATURATION;
|
|
3051
|
+
|
|
3052
|
+
uniformMapProperties.dayTextureOneOverGamma[numberOfDayTextures] =
|
|
3053
|
+
1.0 / imageryLayer.gamma;
|
|
3054
|
+
applyGamma =
|
|
3055
|
+
applyGamma ||
|
|
3056
|
+
uniformMapProperties.dayTextureOneOverGamma[numberOfDayTextures] !==
|
|
3057
|
+
1.0 / ImageryLayer.DEFAULT_GAMMA;
|
|
3058
|
+
|
|
3059
|
+
const levelCorrection = imageryLayer._getLevelColorCorrection(
|
|
3060
|
+
imagery.level,
|
|
3061
|
+
);
|
|
3062
|
+
applyToneMatch = applyToneMatch || defined(levelCorrection);
|
|
3063
|
+
|
|
3064
|
+
let toneGain =
|
|
3065
|
+
uniformMapProperties.dayTextureToneGain[numberOfDayTextures];
|
|
3066
|
+
if (!defined(toneGain)) {
|
|
3067
|
+
toneGain = new Cartesian3(1.0, 1.0, 1.0);
|
|
3068
|
+
uniformMapProperties.dayTextureToneGain[numberOfDayTextures] =
|
|
3069
|
+
toneGain;
|
|
3070
|
+
}
|
|
3071
|
+
if (defined(levelCorrection)) {
|
|
3072
|
+
Cartesian3.clone(levelCorrection.gain, toneGain);
|
|
3073
|
+
} else {
|
|
3074
|
+
toneGain.x = 1.0;
|
|
3075
|
+
toneGain.y = 1.0;
|
|
3076
|
+
toneGain.z = 1.0;
|
|
3077
|
+
}
|
|
2857
3078
|
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
3079
|
+
let toneBias =
|
|
3080
|
+
uniformMapProperties.dayTextureToneBias[numberOfDayTextures];
|
|
3081
|
+
if (!defined(toneBias)) {
|
|
3082
|
+
toneBias = new Cartesian3(0.0, 0.0, 0.0);
|
|
3083
|
+
uniformMapProperties.dayTextureToneBias[numberOfDayTextures] =
|
|
3084
|
+
toneBias;
|
|
3085
|
+
}
|
|
3086
|
+
if (defined(levelCorrection)) {
|
|
3087
|
+
Cartesian3.clone(levelCorrection.bias, toneBias);
|
|
3088
|
+
} else {
|
|
3089
|
+
toneBias.x = 0.0;
|
|
3090
|
+
toneBias.y = 0.0;
|
|
3091
|
+
toneBias.z = 0.0;
|
|
3092
|
+
}
|
|
2871
3093
|
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
3094
|
+
// Edge-band fade of this texture's correction toward the adjacent
|
|
3095
|
+
// coarser tile's correction. Only the finer side of a LOD boundary
|
|
3096
|
+
// fades; same-level and finer neighbors leave the edge at this
|
|
3097
|
+
// texture's own correction, so the fade is a no-op there.
|
|
3098
|
+
const levelEdgeBlend = imageryLayer.levelColorEdgeBlend;
|
|
3099
|
+
if (defined(levelCorrection) && levelEdgeBlend > 0.0) {
|
|
3100
|
+
applyToneMatchEdge = true;
|
|
3101
|
+
}
|
|
3102
|
+
const edgeBaseIndex = numberOfDayTextures * 4;
|
|
3103
|
+
// Cross-fade bookkeeping: imagery level of each edge's neighbor, plus
|
|
3104
|
+
// the dominant (longest shared edge) coarser neighbor whose ancestor
|
|
3105
|
+
// texture will be bound for content cross-fading below.
|
|
3106
|
+
let dominantCrossLevel;
|
|
3107
|
+
let dominantCrossOverlap = 0.0;
|
|
3108
|
+
for (let edgeIndex = 0; edgeIndex < 4; ++edgeIndex) {
|
|
3109
|
+
let edgeGain =
|
|
3110
|
+
uniformMapProperties.dayTextureToneEdgeGain[
|
|
3111
|
+
edgeBaseIndex + edgeIndex
|
|
3112
|
+
];
|
|
3113
|
+
if (!defined(edgeGain)) {
|
|
3114
|
+
edgeGain = new Cartesian3();
|
|
3115
|
+
uniformMapProperties.dayTextureToneEdgeGain[
|
|
3116
|
+
edgeBaseIndex + edgeIndex
|
|
3117
|
+
] = edgeGain;
|
|
3118
|
+
}
|
|
3119
|
+
let edgeBias =
|
|
3120
|
+
uniformMapProperties.dayTextureToneEdgeBias[
|
|
3121
|
+
edgeBaseIndex + edgeIndex
|
|
3122
|
+
];
|
|
3123
|
+
if (!defined(edgeBias)) {
|
|
3124
|
+
edgeBias = new Cartesian3();
|
|
3125
|
+
uniformMapProperties.dayTextureToneEdgeBias[
|
|
3126
|
+
edgeBaseIndex + edgeIndex
|
|
3127
|
+
] = edgeBias;
|
|
3128
|
+
}
|
|
2885
3129
|
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
// fades; same-level and finer neighbors leave the edge at this
|
|
2889
|
-
// texture's own correction, so the fade is a no-op there.
|
|
2890
|
-
const levelEdgeBlend = imageryLayer.levelColorEdgeBlend;
|
|
2891
|
-
if (defined(levelCorrection) && levelEdgeBlend > 0.0) {
|
|
2892
|
-
applyToneMatchEdge = true;
|
|
2893
|
-
}
|
|
2894
|
-
const edgeBaseIndex = numberOfDayTextures * 4;
|
|
2895
|
-
// Cross-fade bookkeeping: imagery level of each edge's neighbor, plus
|
|
2896
|
-
// the dominant (longest shared edge) coarser neighbor whose ancestor
|
|
2897
|
-
// texture will be bound for content cross-fading below.
|
|
2898
|
-
let dominantCrossLevel;
|
|
2899
|
-
let dominantCrossOverlap = 0.0;
|
|
2900
|
-
for (let edgeIndex = 0; edgeIndex < 4; ++edgeIndex) {
|
|
2901
|
-
let edgeGain =
|
|
2902
|
-
uniformMapProperties.dayTextureToneEdgeGain[
|
|
3130
|
+
edgeNeighborLevelsScratch[edgeIndex] = undefined;
|
|
3131
|
+
uniformMapProperties.dayTextureToneEdgeBlend[
|
|
2903
3132
|
edgeBaseIndex + edgeIndex
|
|
2904
|
-
];
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3133
|
+
] = 0.0;
|
|
3134
|
+
if (defined(levelCorrection) && levelEdgeBlend > 0.0) {
|
|
3135
|
+
const neighbor = findAdjacentRenderedTile(
|
|
3136
|
+
getRenderedTilesFlat(tileProvider, frameState.frameNumber),
|
|
3137
|
+
tile.rectangle,
|
|
3138
|
+
edgeIndex,
|
|
3139
|
+
);
|
|
3140
|
+
const neighborLevel = defined(neighbor.tile)
|
|
3141
|
+
? getNeighborImageryLevel(neighbor.tile, imageryLayer)
|
|
3142
|
+
: undefined;
|
|
3143
|
+
edgeNeighborLevelsScratch[edgeIndex] = neighborLevel;
|
|
3144
|
+
if (defined(neighborLevel) && neighborLevel < imagery.level) {
|
|
3145
|
+
if (neighbor.overlap > dominantCrossOverlap) {
|
|
3146
|
+
dominantCrossOverlap = neighbor.overlap;
|
|
3147
|
+
dominantCrossLevel = neighborLevel;
|
|
3148
|
+
}
|
|
3149
|
+
const neighborCorrection =
|
|
3150
|
+
imageryLayer._getLevelColorCorrection(neighborLevel);
|
|
3151
|
+
if (defined(neighborCorrection)) {
|
|
3152
|
+
Cartesian3.clone(neighborCorrection.gain, edgeGain);
|
|
3153
|
+
Cartesian3.clone(neighborCorrection.bias, edgeBias);
|
|
3154
|
+
uniformMapProperties.dayTextureToneEdgeBlend[
|
|
3155
|
+
edgeBaseIndex + edgeIndex
|
|
3156
|
+
] = levelEdgeBlend;
|
|
3157
|
+
continue;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
Cartesian3.clone(toneGain, edgeGain);
|
|
3162
|
+
Cartesian3.clone(toneBias, edgeBias);
|
|
2910
3163
|
}
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
3164
|
+
|
|
3165
|
+
// Content cross-fade: bind the ancestor imagery at the dominant coarser
|
|
3166
|
+
// neighbor's level (the very source texture the coarser side renders).
|
|
3167
|
+
// Near edges facing that neighbor, the shader blends the tile's full
|
|
3168
|
+
// rendered result with the ancestor's rendering, making both sides of
|
|
3169
|
+
// the boundary pixel-identical at the shared edge regardless of whether
|
|
3170
|
+
// the residual step came from correction limits or content differences.
|
|
3171
|
+
// Falls back to the correction fade above when the ancestor texture is
|
|
3172
|
+
// not resident, the level gap is too large (the ancestor would be
|
|
3173
|
+
// minified beyond recognition), the sampler budget is exhausted, or the
|
|
3174
|
+
// layer opts out. Edges whose coarser neighbor is at a different level
|
|
3175
|
+
// keep the correction fade (single bound ancestor per texture).
|
|
3176
|
+
// Every unit gets valid values (identity when unbound): a command's
|
|
3177
|
+
// shader is the CROSS variant if ANY unit bound, and the pooled uniform
|
|
3178
|
+
// arrays must not contain holes or stale entries for the others.
|
|
3179
|
+
let crossGain =
|
|
3180
|
+
uniformMapProperties.dayTextureCrossGain[numberOfDayTextures];
|
|
3181
|
+
if (!defined(crossGain)) {
|
|
3182
|
+
crossGain = new Cartesian3(1.0, 1.0, 1.0);
|
|
3183
|
+
uniformMapProperties.dayTextureCrossGain[numberOfDayTextures] =
|
|
3184
|
+
crossGain;
|
|
3185
|
+
}
|
|
3186
|
+
let crossBias =
|
|
3187
|
+
uniformMapProperties.dayTextureCrossBias[numberOfDayTextures];
|
|
3188
|
+
if (!defined(crossBias)) {
|
|
3189
|
+
crossBias = new Cartesian3(0.0, 0.0, 0.0);
|
|
3190
|
+
uniformMapProperties.dayTextureCrossBias[numberOfDayTextures] =
|
|
3191
|
+
crossBias;
|
|
3192
|
+
}
|
|
3193
|
+
let crossTranslationAndScale =
|
|
3194
|
+
uniformMapProperties.dayTextureCrossTranslationAndScale[
|
|
3195
|
+
numberOfDayTextures
|
|
2914
3196
|
];
|
|
2915
|
-
if (!defined(
|
|
2916
|
-
|
|
2917
|
-
uniformMapProperties.
|
|
2918
|
-
|
|
2919
|
-
] =
|
|
3197
|
+
if (!defined(crossTranslationAndScale)) {
|
|
3198
|
+
crossTranslationAndScale = new Cartesian4(0.0, 0.0, 1.0, 1.0);
|
|
3199
|
+
uniformMapProperties.dayTextureCrossTranslationAndScale[
|
|
3200
|
+
numberOfDayTextures
|
|
3201
|
+
] = crossTranslationAndScale;
|
|
2920
3202
|
}
|
|
2921
3203
|
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
3204
|
+
let crossTexture = texture;
|
|
3205
|
+
if (
|
|
3206
|
+
defined(levelCorrection) &&
|
|
3207
|
+
levelEdgeBlend > 0.0 &&
|
|
3208
|
+
imageryLayer.levelColorEdgeCrossFade &&
|
|
3209
|
+
defined(dominantCrossLevel) &&
|
|
3210
|
+
imagery.level - dominantCrossLevel <= 4 &&
|
|
3211
|
+
numberOfDayTextures + crossUnits + 1 <= maxTextures
|
|
3212
|
+
) {
|
|
3213
|
+
let ancestor = imagery.parent;
|
|
3214
|
+
while (defined(ancestor) && ancestor.level > dominantCrossLevel) {
|
|
3215
|
+
ancestor = ancestor.parent;
|
|
3216
|
+
}
|
|
3217
|
+
const ancestorTexture =
|
|
3218
|
+
defined(ancestor) &&
|
|
3219
|
+
ancestor.level === dominantCrossLevel &&
|
|
3220
|
+
ancestor.state === ImageryState.READY
|
|
3221
|
+
? tileImagery.useWebMercatorT
|
|
3222
|
+
? ancestor.textureWebMercator
|
|
3223
|
+
: ancestor.texture
|
|
3224
|
+
: undefined;
|
|
3225
|
+
if (defined(ancestorTexture)) {
|
|
3226
|
+
crossTexture = ancestorTexture;
|
|
3227
|
+
++crossUnits;
|
|
3228
|
+
applyToneMatchCross = true;
|
|
3229
|
+
|
|
3230
|
+
const crossCorrection =
|
|
3231
|
+
imageryLayer._getLevelColorCorrection(dominantCrossLevel);
|
|
3232
|
+
if (defined(crossCorrection)) {
|
|
3233
|
+
Cartesian3.clone(crossCorrection.gain, crossGain);
|
|
3234
|
+
Cartesian3.clone(crossCorrection.bias, crossBias);
|
|
2940
3235
|
}
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3236
|
+
imageryLayer._calculateImageryTranslationAndScale(
|
|
3237
|
+
tile,
|
|
3238
|
+
ancestor,
|
|
3239
|
+
tileImagery.useWebMercatorT,
|
|
3240
|
+
crossTranslationAndScale,
|
|
3241
|
+
);
|
|
3242
|
+
|
|
3243
|
+
for (let edgeIndex = 0; edgeIndex < 4; ++edgeIndex) {
|
|
3244
|
+
uniformMapProperties.dayTextureCrossBlend[
|
|
2947
3245
|
edgeBaseIndex + edgeIndex
|
|
2948
|
-
] =
|
|
2949
|
-
|
|
3246
|
+
] =
|
|
3247
|
+
edgeNeighborLevelsScratch[edgeIndex] === dominantCrossLevel
|
|
3248
|
+
? levelEdgeBlend
|
|
3249
|
+
: 0.0;
|
|
2950
3250
|
}
|
|
2951
3251
|
}
|
|
2952
3252
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
// not resident, the level gap is too large (the ancestor would be
|
|
2965
|
-
// minified beyond recognition), the sampler budget is exhausted, or the
|
|
2966
|
-
// layer opts out. Edges whose coarser neighbor is at a different level
|
|
2967
|
-
// keep the correction fade (single bound ancestor per texture).
|
|
2968
|
-
// Every unit gets valid values (identity when unbound): a command's
|
|
2969
|
-
// shader is the CROSS variant if ANY unit bound, and the pooled uniform
|
|
2970
|
-
// arrays must not contain holes or stale entries for the others.
|
|
2971
|
-
let crossGain =
|
|
2972
|
-
uniformMapProperties.dayTextureCrossGain[numberOfDayTextures];
|
|
2973
|
-
if (!defined(crossGain)) {
|
|
2974
|
-
crossGain = new Cartesian3(1.0, 1.0, 1.0);
|
|
2975
|
-
uniformMapProperties.dayTextureCrossGain[numberOfDayTextures] =
|
|
2976
|
-
crossGain;
|
|
2977
|
-
}
|
|
2978
|
-
let crossBias =
|
|
2979
|
-
uniformMapProperties.dayTextureCrossBias[numberOfDayTextures];
|
|
2980
|
-
if (!defined(crossBias)) {
|
|
2981
|
-
crossBias = new Cartesian3(0.0, 0.0, 0.0);
|
|
2982
|
-
uniformMapProperties.dayTextureCrossBias[numberOfDayTextures] =
|
|
2983
|
-
crossBias;
|
|
2984
|
-
}
|
|
2985
|
-
let crossTranslationAndScale =
|
|
2986
|
-
uniformMapProperties.dayTextureCrossTranslationAndScale[
|
|
2987
|
-
numberOfDayTextures
|
|
2988
|
-
];
|
|
2989
|
-
if (!defined(crossTranslationAndScale)) {
|
|
2990
|
-
crossTranslationAndScale = new Cartesian4(0.0, 0.0, 1.0, 1.0);
|
|
2991
|
-
uniformMapProperties.dayTextureCrossTranslationAndScale[
|
|
2992
|
-
numberOfDayTextures
|
|
2993
|
-
] = crossTranslationAndScale;
|
|
2994
|
-
}
|
|
2995
|
-
|
|
2996
|
-
let crossTexture = texture;
|
|
2997
|
-
if (
|
|
2998
|
-
defined(levelCorrection) &&
|
|
2999
|
-
levelEdgeBlend > 0.0 &&
|
|
3000
|
-
imageryLayer.levelColorEdgeCrossFade &&
|
|
3001
|
-
defined(dominantCrossLevel) &&
|
|
3002
|
-
imagery.level - dominantCrossLevel <= 4 &&
|
|
3003
|
-
numberOfDayTextures + crossUnits + 1 <= maxTextures
|
|
3004
|
-
) {
|
|
3005
|
-
let ancestor = imagery.parent;
|
|
3006
|
-
while (defined(ancestor) && ancestor.level > dominantCrossLevel) {
|
|
3007
|
-
ancestor = ancestor.parent;
|
|
3008
|
-
}
|
|
3009
|
-
const ancestorTexture =
|
|
3010
|
-
defined(ancestor) &&
|
|
3011
|
-
ancestor.level === dominantCrossLevel &&
|
|
3012
|
-
ancestor.state === ImageryState.READY
|
|
3013
|
-
? tileImagery.useWebMercatorT
|
|
3014
|
-
? ancestor.textureWebMercator
|
|
3015
|
-
: ancestor.texture
|
|
3016
|
-
: undefined;
|
|
3017
|
-
if (defined(ancestorTexture)) {
|
|
3018
|
-
crossTexture = ancestorTexture;
|
|
3019
|
-
++crossUnits;
|
|
3020
|
-
applyToneMatchCross = true;
|
|
3021
|
-
|
|
3022
|
-
const crossCorrection =
|
|
3023
|
-
imageryLayer._getLevelColorCorrection(dominantCrossLevel);
|
|
3024
|
-
if (defined(crossCorrection)) {
|
|
3025
|
-
Cartesian3.clone(crossCorrection.gain, crossGain);
|
|
3026
|
-
Cartesian3.clone(crossCorrection.bias, crossBias);
|
|
3027
|
-
}
|
|
3028
|
-
imageryLayer._calculateImageryTranslationAndScale(
|
|
3029
|
-
tile,
|
|
3030
|
-
ancestor,
|
|
3031
|
-
tileImagery.useWebMercatorT,
|
|
3032
|
-
crossTranslationAndScale,
|
|
3033
|
-
);
|
|
3034
|
-
|
|
3253
|
+
if (crossTexture === texture) {
|
|
3254
|
+
crossGain.x = 1.0;
|
|
3255
|
+
crossGain.y = 1.0;
|
|
3256
|
+
crossGain.z = 1.0;
|
|
3257
|
+
crossBias.x = 0.0;
|
|
3258
|
+
crossBias.y = 0.0;
|
|
3259
|
+
crossBias.z = 0.0;
|
|
3260
|
+
crossTranslationAndScale.x = 0.0;
|
|
3261
|
+
crossTranslationAndScale.y = 0.0;
|
|
3262
|
+
crossTranslationAndScale.z = 1.0;
|
|
3263
|
+
crossTranslationAndScale.w = 1.0;
|
|
3035
3264
|
for (let edgeIndex = 0; edgeIndex < 4; ++edgeIndex) {
|
|
3036
3265
|
uniformMapProperties.dayTextureCrossBlend[
|
|
3037
3266
|
edgeBaseIndex + edgeIndex
|
|
3038
|
-
] =
|
|
3039
|
-
edgeNeighborLevelsScratch[edgeIndex] === dominantCrossLevel
|
|
3040
|
-
? levelEdgeBlend
|
|
3041
|
-
: 0.0;
|
|
3267
|
+
] = 0.0;
|
|
3042
3268
|
}
|
|
3043
3269
|
}
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3270
|
+
uniformMapProperties.dayTextureCrossTexture[numberOfDayTextures] =
|
|
3271
|
+
crossTexture;
|
|
3272
|
+
|
|
3273
|
+
uniformMapProperties.dayTextureSplit[numberOfDayTextures] =
|
|
3274
|
+
imageryLayer.splitDirection;
|
|
3275
|
+
applySplit =
|
|
3276
|
+
applySplit ||
|
|
3277
|
+
uniformMapProperties.dayTextureSplit[numberOfDayTextures] !== 0.0;
|
|
3278
|
+
|
|
3279
|
+
// Update cutout rectangle
|
|
3280
|
+
let dayTextureCutoutRectangle =
|
|
3281
|
+
uniformMapProperties.dayTextureCutoutRectangles[numberOfDayTextures];
|
|
3282
|
+
if (!defined(dayTextureCutoutRectangle)) {
|
|
3283
|
+
dayTextureCutoutRectangle =
|
|
3284
|
+
uniformMapProperties.dayTextureCutoutRectangles[
|
|
3285
|
+
numberOfDayTextures
|
|
3286
|
+
] = new Cartesian4();
|
|
3059
3287
|
}
|
|
3060
|
-
}
|
|
3061
|
-
uniformMapProperties.dayTextureCrossTexture[numberOfDayTextures] =
|
|
3062
|
-
crossTexture;
|
|
3063
|
-
|
|
3064
|
-
uniformMapProperties.dayTextureSplit[numberOfDayTextures] =
|
|
3065
|
-
imageryLayer.splitDirection;
|
|
3066
|
-
applySplit =
|
|
3067
|
-
applySplit ||
|
|
3068
|
-
uniformMapProperties.dayTextureSplit[numberOfDayTextures] !== 0.0;
|
|
3069
|
-
|
|
3070
|
-
// Update cutout rectangle
|
|
3071
|
-
let dayTextureCutoutRectangle =
|
|
3072
|
-
uniformMapProperties.dayTextureCutoutRectangles[numberOfDayTextures];
|
|
3073
|
-
if (!defined(dayTextureCutoutRectangle)) {
|
|
3074
|
-
dayTextureCutoutRectangle =
|
|
3075
|
-
uniformMapProperties.dayTextureCutoutRectangles[numberOfDayTextures] =
|
|
3076
|
-
new Cartesian4();
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
Cartesian4.clone(Cartesian4.ZERO, dayTextureCutoutRectangle);
|
|
3080
|
-
if (defined(imageryLayer.cutoutRectangle)) {
|
|
3081
|
-
const cutoutRectangle = clipRectangleAntimeridian(
|
|
3082
|
-
cartographicTileRectangle,
|
|
3083
|
-
imageryLayer.cutoutRectangle,
|
|
3084
|
-
);
|
|
3085
|
-
const intersection = Rectangle.simpleIntersection(
|
|
3086
|
-
cutoutRectangle,
|
|
3087
|
-
cartographicTileRectangle,
|
|
3088
|
-
rectangleIntersectionScratch,
|
|
3089
|
-
);
|
|
3090
|
-
applyCutout = defined(intersection) || applyCutout;
|
|
3091
|
-
|
|
3092
|
-
dayTextureCutoutRectangle.x =
|
|
3093
|
-
(cutoutRectangle.west - cartographicTileRectangle.west) *
|
|
3094
|
-
inverseTileWidth;
|
|
3095
|
-
dayTextureCutoutRectangle.y =
|
|
3096
|
-
(cutoutRectangle.south - cartographicTileRectangle.south) *
|
|
3097
|
-
inverseTileHeight;
|
|
3098
|
-
dayTextureCutoutRectangle.z =
|
|
3099
|
-
(cutoutRectangle.east - cartographicTileRectangle.west) *
|
|
3100
|
-
inverseTileWidth;
|
|
3101
|
-
dayTextureCutoutRectangle.w =
|
|
3102
|
-
(cutoutRectangle.north - cartographicTileRectangle.south) *
|
|
3103
|
-
inverseTileHeight;
|
|
3104
|
-
}
|
|
3105
3288
|
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3289
|
+
Cartesian4.clone(Cartesian4.ZERO, dayTextureCutoutRectangle);
|
|
3290
|
+
if (defined(imageryLayer.cutoutRectangle)) {
|
|
3291
|
+
const cutoutRectangle = clipRectangleAntimeridian(
|
|
3292
|
+
cartographicTileRectangle,
|
|
3293
|
+
imageryLayer.cutoutRectangle,
|
|
3294
|
+
);
|
|
3295
|
+
const intersection = Rectangle.simpleIntersection(
|
|
3296
|
+
cutoutRectangle,
|
|
3297
|
+
cartographicTileRectangle,
|
|
3298
|
+
rectangleIntersectionScratch,
|
|
3299
|
+
);
|
|
3300
|
+
applyCutout = defined(intersection) || applyCutout;
|
|
3301
|
+
|
|
3302
|
+
dayTextureCutoutRectangle.x =
|
|
3303
|
+
(cutoutRectangle.west - cartographicTileRectangle.west) *
|
|
3304
|
+
inverseTileWidth;
|
|
3305
|
+
dayTextureCutoutRectangle.y =
|
|
3306
|
+
(cutoutRectangle.south - cartographicTileRectangle.south) *
|
|
3307
|
+
inverseTileHeight;
|
|
3308
|
+
dayTextureCutoutRectangle.z =
|
|
3309
|
+
(cutoutRectangle.east - cartographicTileRectangle.west) *
|
|
3310
|
+
inverseTileWidth;
|
|
3311
|
+
dayTextureCutoutRectangle.w =
|
|
3312
|
+
(cutoutRectangle.north - cartographicTileRectangle.south) *
|
|
3313
|
+
inverseTileHeight;
|
|
3314
|
+
}
|
|
3113
3315
|
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
colorToAlpha.y = color.green;
|
|
3123
|
-
colorToAlpha.z = color.blue;
|
|
3124
|
-
colorToAlpha.w = imageryLayer.colorToAlphaThreshold;
|
|
3125
|
-
} else {
|
|
3126
|
-
colorToAlpha.w = -1.0;
|
|
3127
|
-
}
|
|
3316
|
+
// Update color to alpha
|
|
3317
|
+
let colorToAlpha =
|
|
3318
|
+
uniformMapProperties.colorsToAlpha[numberOfDayTextures];
|
|
3319
|
+
if (!defined(colorToAlpha)) {
|
|
3320
|
+
colorToAlpha = uniformMapProperties.colorsToAlpha[
|
|
3321
|
+
numberOfDayTextures
|
|
3322
|
+
] = new Cartesian4();
|
|
3323
|
+
}
|
|
3128
3324
|
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3325
|
+
const hasColorToAlpha =
|
|
3326
|
+
defined(imageryLayer.colorToAlpha) &&
|
|
3327
|
+
imageryLayer.colorToAlphaThreshold > 0.0;
|
|
3328
|
+
applyColorToAlpha = applyColorToAlpha || hasColorToAlpha;
|
|
3329
|
+
|
|
3330
|
+
if (hasColorToAlpha) {
|
|
3331
|
+
const color = imageryLayer.colorToAlpha;
|
|
3332
|
+
colorToAlpha.x = color.red;
|
|
3333
|
+
colorToAlpha.y = color.green;
|
|
3334
|
+
colorToAlpha.z = color.blue;
|
|
3335
|
+
colorToAlpha.w = imageryLayer.colorToAlphaThreshold;
|
|
3336
|
+
} else {
|
|
3337
|
+
colorToAlpha.w = -1.0;
|
|
3137
3338
|
}
|
|
3138
|
-
}
|
|
3139
3339
|
|
|
3140
|
-
|
|
3141
|
-
|
|
3340
|
+
if (defined(imagery.credits)) {
|
|
3341
|
+
const credits = imagery.credits;
|
|
3342
|
+
for (
|
|
3343
|
+
let creditIndex = 0, creditLength = credits.length;
|
|
3344
|
+
creditIndex < creditLength;
|
|
3345
|
+
++creditIndex
|
|
3346
|
+
) {
|
|
3347
|
+
creditDisplay.addCreditToNextFrame(credits[creditIndex]);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3142
3350
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
uniformMapProperties.dayTextures.length = numberOfDayTextures;
|
|
3146
|
-
uniformMapProperties.dayTextureToneEdgeGain.length =
|
|
3147
|
-
numberOfDayTextures * 4;
|
|
3148
|
-
uniformMapProperties.dayTextureToneEdgeBias.length =
|
|
3149
|
-
numberOfDayTextures * 4;
|
|
3150
|
-
uniformMapProperties.dayTextureToneEdgeBlend.length =
|
|
3151
|
-
numberOfDayTextures * 4;
|
|
3152
|
-
uniformMapProperties.dayTextureCrossTexture.length = numberOfDayTextures;
|
|
3153
|
-
uniformMapProperties.dayTextureCrossTranslationAndScale.length =
|
|
3154
|
-
numberOfDayTextures;
|
|
3155
|
-
uniformMapProperties.dayTextureCrossGain.length = numberOfDayTextures;
|
|
3156
|
-
uniformMapProperties.dayTextureCrossBias.length = numberOfDayTextures;
|
|
3157
|
-
uniformMapProperties.dayTextureCrossBlend.length = numberOfDayTextures * 4;
|
|
3158
|
-
uniformMapProperties.waterMask = waterMaskTexture;
|
|
3159
|
-
Cartesian4.clone(
|
|
3160
|
-
waterMaskTranslationAndScale,
|
|
3161
|
-
uniformMapProperties.waterMaskTranslationAndScale,
|
|
3162
|
-
);
|
|
3351
|
+
++numberOfDayTextures;
|
|
3352
|
+
}
|
|
3163
3353
|
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
uniformMapProperties.
|
|
3174
|
-
|
|
3175
|
-
|
|
3354
|
+
// trim texture array to the used length so we don't end up using old textures
|
|
3355
|
+
// which might get destroyed eventually
|
|
3356
|
+
uniformMapProperties.dayTextures.length = numberOfDayTextures;
|
|
3357
|
+
uniformMapProperties.dayTextureToneEdgeGain.length =
|
|
3358
|
+
numberOfDayTextures * 4;
|
|
3359
|
+
uniformMapProperties.dayTextureToneEdgeBias.length =
|
|
3360
|
+
numberOfDayTextures * 4;
|
|
3361
|
+
uniformMapProperties.dayTextureToneEdgeBlend.length =
|
|
3362
|
+
numberOfDayTextures * 4;
|
|
3363
|
+
uniformMapProperties.dayTextureCrossTexture.length = numberOfDayTextures;
|
|
3364
|
+
uniformMapProperties.dayTextureCrossTranslationAndScale.length =
|
|
3365
|
+
numberOfDayTextures;
|
|
3366
|
+
uniformMapProperties.dayTextureCrossGain.length = numberOfDayTextures;
|
|
3367
|
+
uniformMapProperties.dayTextureCrossBias.length = numberOfDayTextures;
|
|
3368
|
+
uniformMapProperties.dayTextureCrossBlend.length =
|
|
3369
|
+
numberOfDayTextures * 4;
|
|
3370
|
+
uniformMapProperties.waterMask = waterMaskTexture;
|
|
3371
|
+
Cartesian4.clone(
|
|
3372
|
+
waterMaskTranslationAndScale,
|
|
3373
|
+
uniformMapProperties.waterMaskTranslationAndScale,
|
|
3176
3374
|
);
|
|
3177
|
-
uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
|
|
3178
|
-
}
|
|
3179
|
-
|
|
3180
|
-
// update clipping polygons
|
|
3181
|
-
const clippingPolygons = tileProvider._clippingPolygons;
|
|
3182
|
-
const clippingPolygonsEnabled =
|
|
3183
|
-
defined(clippingPolygons) && clippingPolygons.enabled && tile.isClipped;
|
|
3184
|
-
|
|
3185
|
-
surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures;
|
|
3186
|
-
surfaceShaderSetOptions.applyBrightness = applyBrightness;
|
|
3187
|
-
surfaceShaderSetOptions.applyContrast = applyContrast;
|
|
3188
|
-
surfaceShaderSetOptions.applyHue = applyHue;
|
|
3189
|
-
surfaceShaderSetOptions.applySaturation = applySaturation;
|
|
3190
|
-
surfaceShaderSetOptions.applyGamma = applyGamma;
|
|
3191
|
-
surfaceShaderSetOptions.applyToneMatch = applyToneMatch;
|
|
3192
|
-
surfaceShaderSetOptions.applyToneMatchEdge = applyToneMatchEdge;
|
|
3193
|
-
surfaceShaderSetOptions.applyToneMatchCross = applyToneMatchCross;
|
|
3194
|
-
surfaceShaderSetOptions.applyAlpha = applyAlpha;
|
|
3195
|
-
surfaceShaderSetOptions.applyDayNightAlpha = applyDayNightAlpha;
|
|
3196
|
-
surfaceShaderSetOptions.applySplit = applySplit;
|
|
3197
|
-
surfaceShaderSetOptions.enableFog = applyFog;
|
|
3198
|
-
surfaceShaderSetOptions.enableClippingPlanes = clippingPlanesEnabled;
|
|
3199
|
-
surfaceShaderSetOptions.clippingPlanes = clippingPlanes;
|
|
3200
|
-
surfaceShaderSetOptions.enableClippingPolygons = clippingPolygonsEnabled;
|
|
3201
|
-
surfaceShaderSetOptions.clippingPolygons = clippingPolygons;
|
|
3202
|
-
surfaceShaderSetOptions.hasImageryLayerCutout = applyCutout;
|
|
3203
|
-
surfaceShaderSetOptions.colorCorrect = colorCorrect;
|
|
3204
|
-
surfaceShaderSetOptions.highlightFillTile = highlightFillTile;
|
|
3205
|
-
surfaceShaderSetOptions.colorToAlpha = applyColorToAlpha;
|
|
3206
|
-
surfaceShaderSetOptions.showUndergroundColor = showUndergroundColor;
|
|
3207
|
-
surfaceShaderSetOptions.translucent = translucent;
|
|
3208
|
-
|
|
3209
|
-
let count = surfaceTile.renderedMesh.indices.length;
|
|
3210
|
-
if (!showSkirts) {
|
|
3211
|
-
count = surfaceTile.renderedMesh.indexCountWithoutSkirts;
|
|
3212
|
-
}
|
|
3213
3375
|
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
createWireframeVertexArrayIfNecessary(context, tileProvider, tile);
|
|
3229
|
-
if (defined(surfaceTile.wireframeVertexArray)) {
|
|
3230
|
-
command.vertexArray = surfaceTile.wireframeVertexArray;
|
|
3231
|
-
command.primitiveType = PrimitiveType.LINES;
|
|
3232
|
-
command.count = count * 2;
|
|
3376
|
+
uniformMapProperties.minMaxHeight.x = encoding.minimumHeight;
|
|
3377
|
+
uniformMapProperties.minMaxHeight.y = encoding.maximumHeight;
|
|
3378
|
+
Matrix4.clone(encoding.matrix, uniformMapProperties.scaleAndBias);
|
|
3379
|
+
|
|
3380
|
+
// update clipping planes
|
|
3381
|
+
const clippingPlanes = tileProvider._clippingPlanes;
|
|
3382
|
+
const clippingPlanesEnabled =
|
|
3383
|
+
defined(clippingPlanes) && clippingPlanes.enabled && tile.isClipped;
|
|
3384
|
+
if (clippingPlanesEnabled) {
|
|
3385
|
+
uniformMapProperties.clippingPlanesEdgeColor = Color.clone(
|
|
3386
|
+
clippingPlanes.edgeColor,
|
|
3387
|
+
uniformMapProperties.clippingPlanesEdgeColor,
|
|
3388
|
+
);
|
|
3389
|
+
uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
|
|
3233
3390
|
}
|
|
3234
|
-
}
|
|
3235
3391
|
|
|
3236
|
-
|
|
3237
|
-
|
|
3392
|
+
// update clipping polygons
|
|
3393
|
+
const clippingPolygons = tileProvider._clippingPolygons;
|
|
3394
|
+
const clippingPolygonsEnabled =
|
|
3395
|
+
defined(clippingPolygons) && clippingPolygons.enabled && tile.isClipped;
|
|
3396
|
+
|
|
3397
|
+
surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures;
|
|
3398
|
+
surfaceShaderSetOptions.applyBrightness = applyBrightness;
|
|
3399
|
+
surfaceShaderSetOptions.applyContrast = applyContrast;
|
|
3400
|
+
surfaceShaderSetOptions.applyHue = applyHue;
|
|
3401
|
+
surfaceShaderSetOptions.applySaturation = applySaturation;
|
|
3402
|
+
surfaceShaderSetOptions.applyGamma = applyGamma;
|
|
3403
|
+
surfaceShaderSetOptions.applyToneMatch = applyToneMatch;
|
|
3404
|
+
surfaceShaderSetOptions.applyToneMatchEdge = applyToneMatchEdge;
|
|
3405
|
+
surfaceShaderSetOptions.applyToneMatchCross = applyToneMatchCross;
|
|
3406
|
+
surfaceShaderSetOptions.applyAlpha = applyAlpha;
|
|
3407
|
+
surfaceShaderSetOptions.applyDayNightAlpha = applyDayNightAlpha;
|
|
3408
|
+
surfaceShaderSetOptions.applySplit = applySplit;
|
|
3409
|
+
surfaceShaderSetOptions.enableFog = applyFog;
|
|
3410
|
+
surfaceShaderSetOptions.enableClippingPlanes = clippingPlanesEnabled;
|
|
3411
|
+
surfaceShaderSetOptions.clippingPlanes = clippingPlanes;
|
|
3412
|
+
surfaceShaderSetOptions.enableClippingPolygons = clippingPolygonsEnabled;
|
|
3413
|
+
surfaceShaderSetOptions.clippingPolygons = clippingPolygons;
|
|
3414
|
+
surfaceShaderSetOptions.hasImageryLayerCutout = applyCutout;
|
|
3415
|
+
surfaceShaderSetOptions.colorCorrect = colorCorrect;
|
|
3416
|
+
surfaceShaderSetOptions.highlightFillTile = highlightFillTile;
|
|
3417
|
+
surfaceShaderSetOptions.colorToAlpha = applyColorToAlpha;
|
|
3418
|
+
surfaceShaderSetOptions.showUndergroundColor = showUndergroundColor;
|
|
3419
|
+
surfaceShaderSetOptions.translucent = translucent;
|
|
3420
|
+
|
|
3421
|
+
let count = surfaceTile.renderedMesh.indices.length;
|
|
3422
|
+
if (!showSkirts) {
|
|
3423
|
+
count = surfaceTile.renderedMesh.indexCountWithoutSkirts;
|
|
3424
|
+
}
|
|
3238
3425
|
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
tile.rectangle,
|
|
3242
|
-
frameState.mapProjection,
|
|
3243
|
-
tileBoundingRegion.minimumHeight,
|
|
3244
|
-
tileBoundingRegion.maximumHeight,
|
|
3245
|
-
boundingVolume,
|
|
3246
|
-
);
|
|
3247
|
-
Cartesian3.fromElements(
|
|
3248
|
-
boundingVolume.center.z,
|
|
3249
|
-
boundingVolume.center.x,
|
|
3250
|
-
boundingVolume.center.y,
|
|
3251
|
-
boundingVolume.center,
|
|
3426
|
+
command.shaderProgram = tileProvider._surfaceShaderSet.getShaderProgram(
|
|
3427
|
+
surfaceShaderSetOptions,
|
|
3252
3428
|
);
|
|
3429
|
+
command.castShadows = castShadows;
|
|
3430
|
+
command.receiveShadows = receiveShadows;
|
|
3431
|
+
command.renderState = renderState;
|
|
3432
|
+
command.primitiveType = PrimitiveType.TRIANGLES;
|
|
3433
|
+
command.vertexArray =
|
|
3434
|
+
surfaceTile.vertexArray || surfaceTile.fill.vertexArray;
|
|
3435
|
+
command.count = count;
|
|
3436
|
+
command.uniformMap = uniformMap;
|
|
3437
|
+
command.pass = Pass.GLOBE;
|
|
3438
|
+
|
|
3439
|
+
if (tileProvider._debug.wireframe) {
|
|
3440
|
+
createWireframeVertexArrayIfNecessary(context, tileProvider, tile);
|
|
3441
|
+
if (defined(surfaceTile.wireframeVertexArray)) {
|
|
3442
|
+
command.vertexArray = surfaceTile.wireframeVertexArray;
|
|
3443
|
+
command.primitiveType = PrimitiveType.LINES;
|
|
3444
|
+
command.count = count * 2;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3253
3447
|
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3448
|
+
const boundingVolume = command.boundingVolume;
|
|
3449
|
+
const orientedBoundingBox = command.orientedBoundingBox;
|
|
3450
|
+
|
|
3451
|
+
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
3452
|
+
BoundingSphere.fromRectangleWithHeights2D(
|
|
3453
|
+
tile.rectangle,
|
|
3454
|
+
frameState.mapProjection,
|
|
3455
|
+
tileBoundingRegion.minimumHeight,
|
|
3456
|
+
tileBoundingRegion.maximumHeight,
|
|
3259
3457
|
boundingVolume,
|
|
3458
|
+
);
|
|
3459
|
+
Cartesian3.fromElements(
|
|
3460
|
+
boundingVolume.center.z,
|
|
3461
|
+
boundingVolume.center.x,
|
|
3462
|
+
boundingVolume.center.y,
|
|
3463
|
+
boundingVolume.center,
|
|
3464
|
+
);
|
|
3465
|
+
|
|
3466
|
+
if (worldOffset !== 0.0) {
|
|
3467
|
+
// Shift this copy along the map-u world axis for frustum culling,
|
|
3468
|
+
// shadows, and depth-based picking.
|
|
3469
|
+
boundingVolume.center.y += worldOffset;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
if (frameState.mode === SceneMode.MORPHING) {
|
|
3473
|
+
// The result is written into boundingVolume in place (the same object
|
|
3474
|
+
// referenced by command.boundingVolume), so the return value is unused.
|
|
3475
|
+
BoundingSphere.union(
|
|
3476
|
+
tileBoundingRegion.boundingSphere,
|
|
3477
|
+
boundingVolume,
|
|
3478
|
+
boundingVolume,
|
|
3479
|
+
);
|
|
3480
|
+
}
|
|
3481
|
+
} else {
|
|
3482
|
+
command.boundingVolume = BoundingSphere.clone(
|
|
3483
|
+
tileBoundingRegion.boundingSphere,
|
|
3260
3484
|
boundingVolume,
|
|
3261
3485
|
);
|
|
3486
|
+
command.orientedBoundingBox = OrientedBoundingBox.clone(
|
|
3487
|
+
tileBoundingRegion.boundingVolume,
|
|
3488
|
+
orientedBoundingBox,
|
|
3489
|
+
);
|
|
3262
3490
|
}
|
|
3263
|
-
} else {
|
|
3264
|
-
command.boundingVolume = BoundingSphere.clone(
|
|
3265
|
-
tileBoundingRegion.boundingSphere,
|
|
3266
|
-
boundingVolume,
|
|
3267
|
-
);
|
|
3268
|
-
command.orientedBoundingBox = OrientedBoundingBox.clone(
|
|
3269
|
-
tileBoundingRegion.boundingVolume,
|
|
3270
|
-
orientedBoundingBox,
|
|
3271
|
-
);
|
|
3272
|
-
}
|
|
3273
3491
|
|
|
3274
|
-
|
|
3492
|
+
command.dirty = true;
|
|
3275
3493
|
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3494
|
+
if (translucent) {
|
|
3495
|
+
globeTranslucencyState.updateDerivedCommands(command, frameState);
|
|
3496
|
+
}
|
|
3279
3497
|
|
|
3280
|
-
|
|
3498
|
+
pushCommand(command, frameState);
|
|
3281
3499
|
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3500
|
+
renderState = otherPassesRenderState;
|
|
3501
|
+
initialColor = otherPassesInitialColor;
|
|
3502
|
+
} while (imageryIndex < imageryLen);
|
|
3503
|
+
} // for worldIndex (Columbus repeat-world copies)
|
|
3285
3504
|
}
|
|
3286
3505
|
export default GlobeSurfaceTileProvider;
|