@cesium/engine 9.0.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/pako_deflate.min.js +108 -210
- package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
- package/Build/ThirdParty/Workers/z-worker-pako.js +56 -105
- package/Build/Workers/{chunk-VR5RBW52.js → chunk-26NE4LRW.js} +7 -7
- package/Build/Workers/{chunk-P2YAAMT2.js → chunk-26XJDV3D.js} +15 -15
- package/Build/Workers/{chunk-L4BW3RUA.js → chunk-2TRB253J.js} +7 -7
- package/Build/Workers/{chunk-NP2GYYE5.js → chunk-3PV5HQ2R.js} +6 -6
- package/Build/Workers/{chunk-BCU2LH5T.js → chunk-3VDHTBY5.js} +10 -10
- package/Build/Workers/{chunk-WHUSTDIB.js → chunk-4RG6WOXH.js} +10 -10
- package/Build/Workers/{chunk-P4XKB3QZ.js → chunk-5OK5JFDP.js} +5 -5
- package/Build/Workers/{chunk-2ZBL3MVO.js → chunk-7HLZRYGD.js} +10 -12
- package/Build/Workers/chunk-7PFZ4Z7C.js +961 -0
- package/Build/Workers/{chunk-24YTYWNB.js → chunk-A5CSB5ZE.js} +11 -13
- package/Build/Workers/{chunk-RMOEYCZW.js → chunk-AROLUUGS.js} +2 -2
- package/Build/Workers/{chunk-3NCVAGDA.js → chunk-BBBTT36L.js} +14 -14
- package/Build/Workers/{chunk-QKBGRKKG.js → chunk-BNT2SNWU.js} +4 -4
- package/Build/Workers/{chunk-LQJ5FFFR.js → chunk-CFBGPZU6.js} +11 -13
- package/Build/Workers/{chunk-C6OI26DR.js → chunk-CVCVMOQA.js} +1 -1
- package/Build/Workers/{chunk-SS4ESNE3.js → chunk-DIVFF6DK.js} +2 -2
- package/Build/Workers/{chunk-PXB7T27O.js → chunk-EJZVBTX4.js} +6 -6
- package/Build/Workers/{chunk-TZORKRNK.js → chunk-EODIOQ35.js} +1 -1
- package/Build/Workers/{chunk-QCQUZGXI.js → chunk-ETC45PHH.js} +5 -6
- package/Build/Workers/{chunk-E6WXPSJS.js → chunk-G7IAO7CW.js} +7 -7
- package/Build/Workers/{chunk-X2F6BEPY.js → chunk-GOQEANLM.js} +16 -16
- package/Build/Workers/{chunk-7COR472O.js → chunk-GUFV24F4.js} +7197 -5096
- package/Build/Workers/{chunk-5TIV3L26.js → chunk-GX2BWBN2.js} +13 -13
- package/Build/Workers/{chunk-ADOVHYWO.js → chunk-GX5LMUGZ.js} +469 -6
- package/Build/Workers/{chunk-2632RVPI.js → chunk-I6CW7ZE5.js} +7 -7
- package/Build/Workers/{chunk-YDVSBWEO.js → chunk-IF2OX6R4.js} +3 -5
- package/Build/Workers/{chunk-RSJXEO2A.js → chunk-IXYFH7DV.js} +95 -155
- package/Build/Workers/{chunk-ZNVSKMQ2.js → chunk-K5F23SZO.js} +6 -6
- package/Build/Workers/{chunk-MWV7IZK4.js → chunk-KTZK2UDR.js} +7 -7
- package/Build/Workers/{chunk-HBQPB6IH.js → chunk-LZFFO4KB.js} +12 -12
- package/Build/Workers/{chunk-GFA4SMXV.js → chunk-OYP23VAL.js} +11 -11
- package/Build/Workers/{chunk-ZYPTP7GS.js → chunk-PHT53MCH.js} +11 -11
- package/Build/Workers/{chunk-TJBU6GML.js → chunk-PUQR43HZ.js} +6 -6
- package/Build/Workers/{chunk-CO35JNNE.js → chunk-QZIWFSRM.js} +4 -4
- package/Build/Workers/{chunk-C3XBUYBO.js → chunk-RDR4KVPA.js} +17 -17
- package/Build/Workers/{chunk-YV4H2Y7M.js → chunk-RRUO4QEK.js} +4 -4
- package/Build/Workers/{chunk-LAQP3SCC.js → chunk-RTIT7UDN.js} +2 -2
- package/Build/Workers/{chunk-Z7FQLK6N.js → chunk-SC3TBKST.js} +4 -4
- package/Build/Workers/{chunk-GXUXEOE2.js → chunk-TDIGL45B.js} +1 -1
- package/Build/Workers/{chunk-EOXYZ34O.js → chunk-TP4FFUAH.js} +2 -2
- package/Build/Workers/{chunk-N4KXMWQU.js → chunk-U2LSTOMA.js} +2 -2
- package/Build/Workers/{chunk-6WF3KIF5.js → chunk-U6MTSO6A.js} +47 -84
- package/Build/Workers/{chunk-I37B3MZ2.js → chunk-UICVDDCQ.js} +1 -1
- package/Build/Workers/{chunk-DPUSFA7S.js → chunk-UKJCFXVV.js} +6 -6
- package/Build/Workers/{chunk-EPKE7GE3.js → chunk-UYKG3UFK.js} +5 -5
- package/Build/Workers/{chunk-RV7ZOSS6.js → chunk-W4OS542B.js} +13 -13
- package/Build/Workers/{chunk-DGDUKCJJ.js → chunk-WHDEZSAL.js} +6 -6
- package/Build/Workers/{chunk-NZWNZA6S.js → chunk-WOYQB5HM.js} +5 -5
- package/Build/Workers/{chunk-M2AYBTNH.js → chunk-WP3LCUOE.js} +13 -13
- package/Build/Workers/{chunk-73FKKY52.js → chunk-YGNQJ4YI.js} +5 -5
- package/Build/Workers/{chunk-SE4PXOEA.js → chunk-YGTWKLFY.js} +19 -19
- package/Build/Workers/{chunk-5R6VWLMH.js → chunk-ZHJDE6JN.js} +6 -6
- package/Build/Workers/combineGeometry.js +22 -24
- package/Build/Workers/createBoxGeometry.js +16 -18
- package/Build/Workers/createBoxOutlineGeometry.js +14 -16
- package/Build/Workers/createCircleGeometry.js +24 -26
- package/Build/Workers/createCircleOutlineGeometry.js +17 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
- package/Build/Workers/createCorridorGeometry.js +27 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
- package/Build/Workers/createCylinderGeometry.js +18 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
- package/Build/Workers/createEllipseGeometry.js +24 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
- package/Build/Workers/createEllipsoidGeometry.js +17 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
- package/Build/Workers/createFrustumGeometry.js +16 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
- package/Build/Workers/createGeometry.js +22 -24
- package/Build/Workers/createGroundPolylineGeometry.js +23 -25
- package/Build/Workers/createPlaneGeometry.js +14 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
- package/Build/Workers/createPolygonGeometry.js +32 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
- package/Build/Workers/createPolylineGeometry.js +23 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
- package/Build/Workers/createRectangleGeometry.js +27 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
- package/Build/Workers/createSimplePolylineGeometry.js +21 -23
- package/Build/Workers/createSphereGeometry.js +17 -19
- package/Build/Workers/createSphereOutlineGeometry.js +16 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
- package/Build/Workers/createVectorTileGeometries.js +22 -24
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -16
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
- package/Build/Workers/createVerticesFromHeightmap.js +23 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
- package/Build/Workers/createWallGeometry.js +22 -24
- package/Build/Workers/createWallOutlineGeometry.js +21 -23
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
- package/Build/Workers/decodeI3S.js +10 -11
- package/Build/Workers/transcodeKTX2.js +44 -80
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Math.js +0 -5
- package/Source/Core/PixelFormat.js +1 -0
- package/Source/Core/Rectangle.js +89 -0
- package/Source/Core/TaskProcessor.js +19 -3
- package/Source/Core/sampleTerrain.js +3 -3
- package/Source/DataSources/DataSourceDisplay.js +5 -0
- package/Source/Renderer/ShaderBuilder.js +6 -3
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -5
- package/Source/Scene/Cesium3DTile.js +65 -0
- package/Source/Scene/Cesium3DTileset.js +48 -1
- package/Source/Scene/ClippingPolygon.js +212 -0
- package/Source/Scene/ClippingPolygonCollection.js +968 -0
- package/Source/Scene/Globe.js +14 -0
- package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
- package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
- package/Source/Scene/GltfLoader.js +458 -435
- package/Source/Scene/GltfLoaderUtil.js +3 -12
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
- package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
- package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
- package/Source/Scene/Model/LightingPipelineStage.js +2 -4
- package/Source/Scene/Model/MaterialPipelineStage.js +346 -29
- package/Source/Scene/Model/Model.js +91 -3
- package/Source/Scene/Model/Model3DTileContent.js +21 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
- package/Source/Scene/Model/ModelSceneGraph.js +5 -0
- package/Source/Scene/Model/ModelUtility.js +3 -0
- package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
- package/Source/Scene/ModelComponents.js +169 -1
- package/Source/Scene/PickDepth.js +23 -15
- package/Source/Scene/ResourceCache.js +41 -50
- package/Source/Scene/ResourceCacheKey.js +41 -53
- package/Source/Scene/Terrain.js +2 -2
- package/Source/Shaders/Builtin/CzmBuiltins.js +6 -8
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +14 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.js +14 -0
- package/Source/Shaders/GlobeFS.glsl +13 -1
- package/Source/Shaders/GlobeFS.js +13 -1
- package/Source/Shaders/GlobeVS.glsl +32 -0
- package/Source/Shaders/GlobeVS.js +32 -0
- package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageVS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
- package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
- package/Source/Shaders/Model/LightingStageFS.js +113 -48
- package/Source/Shaders/Model/MaterialStageFS.glsl +399 -137
- package/Source/Shaders/Model/MaterialStageFS.js +399 -137
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
- package/Source/Shaders/Model/ModelFS.glsl +6 -0
- package/Source/Shaders/Model/ModelFS.js +7 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -0
- package/Source/Shaders/Model/ModelVS.js +4 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
- package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/index.d.ts +230 -4
- package/index.js +234 -229
- package/package.json +1 -1
- package/Build/Workers/chunk-2KACWKS4.js +0 -501
- package/Build/Workers/chunk-2XPLH3JY.js +0 -2977
- package/Build/Workers/chunk-X6XOMPWL.js +0 -73
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
- package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
- package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
package/Source/Scene/Globe.js
CHANGED
|
@@ -449,6 +449,20 @@ Object.defineProperties(Globe.prototype, {
|
|
|
449
449
|
this._surface.tileProvider.clippingPlanes = value;
|
|
450
450
|
},
|
|
451
451
|
},
|
|
452
|
+
/**
|
|
453
|
+
* A property specifying a {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
454
|
+
*
|
|
455
|
+
* @memberof Globe.prototype
|
|
456
|
+
* @type {ClippingPolygonCollection}
|
|
457
|
+
*/
|
|
458
|
+
clippingPolygons: {
|
|
459
|
+
get: function () {
|
|
460
|
+
return this._surface.tileProvider.clippingPolygons;
|
|
461
|
+
},
|
|
462
|
+
set: function (value) {
|
|
463
|
+
this._surface.tileProvider.clippingPolygons = value;
|
|
464
|
+
},
|
|
465
|
+
},
|
|
452
466
|
/**
|
|
453
467
|
* A property specifying a {@link Rectangle} used to limit globe rendering to a cartographic area.
|
|
454
468
|
* Defaults to the maximum extent of cartographic coordinates.
|
|
@@ -10,13 +10,15 @@ function GlobeSurfaceShader(
|
|
|
10
10
|
flags,
|
|
11
11
|
material,
|
|
12
12
|
shaderProgram,
|
|
13
|
-
clippingShaderState
|
|
13
|
+
clippingShaderState,
|
|
14
|
+
clippingPolygonShaderState
|
|
14
15
|
) {
|
|
15
16
|
this.numberOfDayTextures = numberOfDayTextures;
|
|
16
17
|
this.flags = flags;
|
|
17
18
|
this.material = material;
|
|
18
19
|
this.shaderProgram = shaderProgram;
|
|
19
20
|
this.clippingShaderState = clippingShaderState;
|
|
21
|
+
this.clippingPolygonShaderState = clippingPolygonShaderState;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -60,6 +62,31 @@ function getPositionMode(sceneMode) {
|
|
|
60
62
|
return positionMode;
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
function getPolygonClippingFunction(context) {
|
|
66
|
+
// return a noop for webgl1
|
|
67
|
+
if (!context.webgl2) {
|
|
68
|
+
return `void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
|
|
69
|
+
}`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return `void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
|
|
73
|
+
czm_clipPolygons(clippingDistance, regionsLength, clippingPosition, regionIndex);
|
|
74
|
+
}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function getUnpackClippingFunction(context) {
|
|
78
|
+
// return a noop for webgl1
|
|
79
|
+
if (!context.webgl2) {
|
|
80
|
+
return `vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
|
|
81
|
+
return vec4();
|
|
82
|
+
}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return `vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
|
|
86
|
+
return czm_unpackClippingExtents(extentsTexture, index);
|
|
87
|
+
}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
63
90
|
function get2DYPositionFraction(useWebMercatorProjection) {
|
|
64
91
|
const get2DYPositionFractionGeographicProjection =
|
|
65
92
|
"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }";
|
|
@@ -95,6 +122,8 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
95
122
|
const enableFog = options.enableFog;
|
|
96
123
|
const enableClippingPlanes = options.enableClippingPlanes;
|
|
97
124
|
const clippingPlanes = options.clippingPlanes;
|
|
125
|
+
const enableClippingPolygons = options.enableClippingPolygons;
|
|
126
|
+
const clippingPolygons = options.clippingPolygons;
|
|
98
127
|
const clippedByBoundaries = options.clippedByBoundaries;
|
|
99
128
|
const hasImageryLayerCutout = options.hasImageryLayerCutout;
|
|
100
129
|
const colorCorrect = options.colorCorrect;
|
|
@@ -152,16 +181,17 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
152
181
|
(quantization << 18) |
|
|
153
182
|
(applySplit << 19) |
|
|
154
183
|
(enableClippingPlanes << 20) |
|
|
155
|
-
(
|
|
156
|
-
(
|
|
157
|
-
(
|
|
158
|
-
(
|
|
159
|
-
(
|
|
160
|
-
(
|
|
161
|
-
(
|
|
162
|
-
(
|
|
163
|
-
(
|
|
164
|
-
(
|
|
184
|
+
(enableClippingPolygons << 21) |
|
|
185
|
+
(cartographicLimitRectangleFlag << 22) |
|
|
186
|
+
(imageryCutoutFlag << 23) |
|
|
187
|
+
(colorCorrect << 24) |
|
|
188
|
+
(highlightFillTile << 25) |
|
|
189
|
+
(colorToAlpha << 26) |
|
|
190
|
+
(hasGeodeticSurfaceNormals << 27) |
|
|
191
|
+
(hasExaggeration << 28) |
|
|
192
|
+
(showUndergroundColor << 29) |
|
|
193
|
+
(translucent << 30) |
|
|
194
|
+
(applyDayNightAlpha << 31);
|
|
165
195
|
|
|
166
196
|
let currentClippingShaderState = 0;
|
|
167
197
|
if (defined(clippingPlanes) && clippingPlanes.length > 0) {
|
|
@@ -169,13 +199,23 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
169
199
|
? clippingPlanes.clippingPlanesState
|
|
170
200
|
: 0;
|
|
171
201
|
}
|
|
202
|
+
|
|
203
|
+
let currentClippingPolygonsShaderState = 0;
|
|
204
|
+
if (defined(clippingPolygons) && clippingPolygons.length > 0) {
|
|
205
|
+
currentClippingPolygonsShaderState = enableClippingPolygons
|
|
206
|
+
? clippingPolygons.clippingPolygonsState
|
|
207
|
+
: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
172
210
|
let surfaceShader = surfaceTile.surfaceShader;
|
|
173
211
|
if (
|
|
174
212
|
defined(surfaceShader) &&
|
|
175
213
|
surfaceShader.numberOfDayTextures === numberOfDayTextures &&
|
|
176
214
|
surfaceShader.flags === flags &&
|
|
177
215
|
surfaceShader.material === this.material &&
|
|
178
|
-
surfaceShader.clippingShaderState === currentClippingShaderState
|
|
216
|
+
surfaceShader.clippingShaderState === currentClippingShaderState &&
|
|
217
|
+
surfaceShader.clippingPolygonShaderState ===
|
|
218
|
+
currentClippingPolygonsShaderState
|
|
179
219
|
) {
|
|
180
220
|
return surfaceShader.shaderProgram;
|
|
181
221
|
}
|
|
@@ -190,16 +230,25 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
190
230
|
if (
|
|
191
231
|
!defined(surfaceShader) ||
|
|
192
232
|
surfaceShader.material !== this.material ||
|
|
193
|
-
surfaceShader.clippingShaderState !== currentClippingShaderState
|
|
233
|
+
surfaceShader.clippingShaderState !== currentClippingShaderState ||
|
|
234
|
+
surfaceShader.clippingPolygonShaderState !==
|
|
235
|
+
currentClippingPolygonsShaderState
|
|
194
236
|
) {
|
|
195
237
|
// Cache miss - we've never seen this combination of numberOfDayTextures and flags before.
|
|
196
238
|
const vs = this.baseVertexShaderSource.clone();
|
|
197
239
|
const fs = this.baseFragmentShaderSource.clone();
|
|
198
240
|
|
|
241
|
+
// Need to go before GlobeFS
|
|
199
242
|
if (currentClippingShaderState !== 0) {
|
|
200
243
|
fs.sources.unshift(
|
|
201
244
|
getClippingFunction(clippingPlanes, frameState.context)
|
|
202
|
-
);
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Need to go before GlobeFS
|
|
249
|
+
if (currentClippingPolygonsShaderState !== 0) {
|
|
250
|
+
fs.sources.unshift(getPolygonClippingFunction(frameState.context));
|
|
251
|
+
vs.sources.unshift(getUnpackClippingFunction(frameState.context));
|
|
203
252
|
}
|
|
204
253
|
|
|
205
254
|
vs.defines.push(quantizationDefine);
|
|
@@ -292,6 +341,22 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
292
341
|
fs.defines.push("ENABLE_CLIPPING_PLANES");
|
|
293
342
|
}
|
|
294
343
|
|
|
344
|
+
if (enableClippingPolygons) {
|
|
345
|
+
fs.defines.push("ENABLE_CLIPPING_POLYGONS");
|
|
346
|
+
vs.defines.push("ENABLE_CLIPPING_POLYGONS");
|
|
347
|
+
|
|
348
|
+
if (clippingPolygons.inverse) {
|
|
349
|
+
fs.defines.push("CLIPPING_INVERSE");
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
fs.defines.push(
|
|
353
|
+
`CLIPPING_POLYGON_REGIONS_LENGTH ${clippingPolygons.extentsCount}`
|
|
354
|
+
);
|
|
355
|
+
vs.defines.push(
|
|
356
|
+
`CLIPPING_POLYGON_REGIONS_LENGTH ${clippingPolygons.extentsCount}`
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
295
360
|
if (colorCorrect) {
|
|
296
361
|
fs.defines.push("COLOR_CORRECT");
|
|
297
362
|
}
|
|
@@ -377,7 +442,8 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
377
442
|
flags,
|
|
378
443
|
this.material,
|
|
379
444
|
shader,
|
|
380
|
-
currentClippingShaderState
|
|
445
|
+
currentClippingShaderState,
|
|
446
|
+
currentClippingPolygonsShaderState
|
|
381
447
|
);
|
|
382
448
|
}
|
|
383
449
|
|
|
@@ -38,6 +38,7 @@ import RenderState from "../Renderer/RenderState.js";
|
|
|
38
38
|
import VertexArray from "../Renderer/VertexArray.js";
|
|
39
39
|
import BlendingState from "./BlendingState.js";
|
|
40
40
|
import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
|
|
41
|
+
import ClippingPolygonCollection from "./ClippingPolygonCollection.js";
|
|
41
42
|
import DepthFunction from "./DepthFunction.js";
|
|
42
43
|
import GlobeSurfaceTile from "./GlobeSurfaceTile.js";
|
|
43
44
|
import ImageryLayer from "./ImageryLayer.js";
|
|
@@ -170,6 +171,13 @@ function GlobeSurfaceTileProvider(options) {
|
|
|
170
171
|
*/
|
|
171
172
|
this._clippingPlanes = undefined;
|
|
172
173
|
|
|
174
|
+
/**
|
|
175
|
+
* A property specifying a {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
176
|
+
* @type {ClippingPolygonCollection}
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
this._clippingPolygons = undefined;
|
|
180
|
+
|
|
173
181
|
/**
|
|
174
182
|
* A property specifying a {@link Rectangle} used to selectively limit terrain and imagery rendering.
|
|
175
183
|
* @type {Rectangle}
|
|
@@ -290,7 +298,7 @@ Object.defineProperties(GlobeSurfaceTileProvider.prototype, {
|
|
|
290
298
|
},
|
|
291
299
|
},
|
|
292
300
|
/**
|
|
293
|
-
* The {@link ClippingPlaneCollection} used to selectively disable rendering
|
|
301
|
+
* The {@link ClippingPlaneCollection} used to selectively disable rendering.
|
|
294
302
|
*
|
|
295
303
|
* @type {ClippingPlaneCollection}
|
|
296
304
|
*
|
|
@@ -304,6 +312,22 @@ Object.defineProperties(GlobeSurfaceTileProvider.prototype, {
|
|
|
304
312
|
ClippingPlaneCollection.setOwner(value, this, "_clippingPlanes");
|
|
305
313
|
},
|
|
306
314
|
},
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* The {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
318
|
+
*
|
|
319
|
+
* @type {ClippingPolygonCollection}
|
|
320
|
+
*
|
|
321
|
+
* @private
|
|
322
|
+
*/
|
|
323
|
+
clippingPolygons: {
|
|
324
|
+
get: function () {
|
|
325
|
+
return this._clippingPolygons;
|
|
326
|
+
},
|
|
327
|
+
set: function (value) {
|
|
328
|
+
ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
|
|
329
|
+
},
|
|
330
|
+
},
|
|
307
331
|
});
|
|
308
332
|
|
|
309
333
|
function sortTileImageryByLayerIndex(a, b) {
|
|
@@ -391,6 +415,14 @@ GlobeSurfaceTileProvider.prototype.beginUpdate = function (frameState) {
|
|
|
391
415
|
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
392
416
|
clippingPlanes.update(frameState);
|
|
393
417
|
}
|
|
418
|
+
|
|
419
|
+
// update clipping polygons
|
|
420
|
+
const clippingPolygons = this._clippingPolygons;
|
|
421
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
422
|
+
clippingPolygons.update(frameState);
|
|
423
|
+
clippingPolygons.queueCommands(frameState);
|
|
424
|
+
}
|
|
425
|
+
|
|
394
426
|
this._usedDrawCommands = 0;
|
|
395
427
|
|
|
396
428
|
this._hasLoadedTilesThisFrame = false;
|
|
@@ -657,6 +689,11 @@ function isUndergroundVisible(tileProvider, frameState) {
|
|
|
657
689
|
return true;
|
|
658
690
|
}
|
|
659
691
|
|
|
692
|
+
const clippingPolygons = tileProvider._clippingPolygons;
|
|
693
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
|
|
660
697
|
if (
|
|
661
698
|
!Rectangle.equals(
|
|
662
699
|
tileProvider.cartographicLimitRectangle,
|
|
@@ -775,6 +812,16 @@ GlobeSurfaceTileProvider.prototype.computeTileVisibility = function (
|
|
|
775
812
|
}
|
|
776
813
|
}
|
|
777
814
|
|
|
815
|
+
const clippingPolygons = this._clippingPolygons;
|
|
816
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
817
|
+
const polygonIntersection = clippingPolygons.computeIntersectionWithBoundingVolume(
|
|
818
|
+
tileBoundingRegion
|
|
819
|
+
);
|
|
820
|
+
tile.isClipped = polygonIntersection !== Intersect.OUTSIDE;
|
|
821
|
+
// Polygon clipping intersections are determined by outer rectangles, therefore we cannot
|
|
822
|
+
// preemptively determine if a tile is completely clipped or not here.
|
|
823
|
+
}
|
|
824
|
+
|
|
778
825
|
let visibility;
|
|
779
826
|
const intersection = cullingVolume.computeVisibility(boundingVolume);
|
|
780
827
|
|
|
@@ -1364,6 +1411,8 @@ GlobeSurfaceTileProvider.prototype.isDestroyed = function () {
|
|
|
1364
1411
|
GlobeSurfaceTileProvider.prototype.destroy = function () {
|
|
1365
1412
|
this._tileProvider = this._tileProvider && this._tileProvider.destroy();
|
|
1366
1413
|
this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
|
|
1414
|
+
this._clippingPolygons =
|
|
1415
|
+
this._clippingPolygons && this._clippingPolygons.destroy();
|
|
1367
1416
|
this._removeLayerAddedListener =
|
|
1368
1417
|
this._removeLayerAddedListener && this._removeLayerAddedListener();
|
|
1369
1418
|
this._removeLayerRemovedListener =
|
|
@@ -1755,6 +1804,21 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1755
1804
|
style.alpha = this.properties.clippingPlanesEdgeWidth;
|
|
1756
1805
|
return style;
|
|
1757
1806
|
},
|
|
1807
|
+
u_clippingDistance: function () {
|
|
1808
|
+
const texture =
|
|
1809
|
+
globeSurfaceTileProvider._clippingPolygons.clippingTexture;
|
|
1810
|
+
if (defined(texture)) {
|
|
1811
|
+
return texture;
|
|
1812
|
+
}
|
|
1813
|
+
return frameState.context.defaultTexture;
|
|
1814
|
+
},
|
|
1815
|
+
u_clippingExtents: function () {
|
|
1816
|
+
const texture = globeSurfaceTileProvider._clippingPolygons.extentsTexture;
|
|
1817
|
+
if (defined(texture)) {
|
|
1818
|
+
return texture;
|
|
1819
|
+
}
|
|
1820
|
+
return frameState.context.defaultTexture;
|
|
1821
|
+
},
|
|
1758
1822
|
u_minimumBrightness: function () {
|
|
1759
1823
|
return frameState.fog.minimumBrightness;
|
|
1760
1824
|
},
|
|
@@ -2039,6 +2103,8 @@ const surfaceShaderSetOptionsScratch = {
|
|
|
2039
2103
|
enableFog: undefined,
|
|
2040
2104
|
enableClippingPlanes: undefined,
|
|
2041
2105
|
clippingPlanes: undefined,
|
|
2106
|
+
enableClippingPolygons: undefined,
|
|
2107
|
+
clippingPolygons: undefined,
|
|
2042
2108
|
clippedByBoundaries: undefined,
|
|
2043
2109
|
hasImageryLayerCutout: undefined,
|
|
2044
2110
|
colorCorrect: undefined,
|
|
@@ -2166,6 +2232,13 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2166
2232
|
) {
|
|
2167
2233
|
--maxTextures;
|
|
2168
2234
|
}
|
|
2235
|
+
if (
|
|
2236
|
+
defined(tileProvider.clippingPolygons) &&
|
|
2237
|
+
tileProvider.clippingPolygons.enabled
|
|
2238
|
+
) {
|
|
2239
|
+
--maxTextures;
|
|
2240
|
+
--maxTextures;
|
|
2241
|
+
}
|
|
2169
2242
|
|
|
2170
2243
|
maxTextures -= globeTranslucencyState.numberOfTextureUniforms;
|
|
2171
2244
|
|
|
@@ -2726,6 +2799,11 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2726
2799
|
uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
|
|
2727
2800
|
}
|
|
2728
2801
|
|
|
2802
|
+
// update clipping polygons
|
|
2803
|
+
const clippingPolygons = tileProvider._clippingPolygons;
|
|
2804
|
+
const clippingPolygonsEnabled =
|
|
2805
|
+
defined(clippingPolygons) && clippingPolygons.enabled && tile.isClipped;
|
|
2806
|
+
|
|
2729
2807
|
surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures;
|
|
2730
2808
|
surfaceShaderSetOptions.applyBrightness = applyBrightness;
|
|
2731
2809
|
surfaceShaderSetOptions.applyContrast = applyContrast;
|
|
@@ -2738,6 +2816,8 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2738
2816
|
surfaceShaderSetOptions.enableFog = applyFog;
|
|
2739
2817
|
surfaceShaderSetOptions.enableClippingPlanes = clippingPlanesEnabled;
|
|
2740
2818
|
surfaceShaderSetOptions.clippingPlanes = clippingPlanes;
|
|
2819
|
+
surfaceShaderSetOptions.enableClippingPolygons = clippingPolygonsEnabled;
|
|
2820
|
+
surfaceShaderSetOptions.clippingPolygons = clippingPolygons;
|
|
2741
2821
|
surfaceShaderSetOptions.hasImageryLayerCutout = applyCutout;
|
|
2742
2822
|
surfaceShaderSetOptions.colorCorrect = colorCorrect;
|
|
2743
2823
|
surfaceShaderSetOptions.highlightFillTile = highlightFillTile;
|