@cesium/engine 8.0.0 → 9.1.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/z-worker-pako.js +7 -10
- package/Build/Workers/{chunk-F4HFJMGM.js → chunk-2CSEEWHN.js} +6 -6
- package/Build/Workers/{chunk-7TC63SJW.js → chunk-34DGOKCO.js} +10 -12
- package/Build/Workers/{chunk-7ZFGPDJA.js → chunk-3RZK5NNV.js} +4 -4
- package/Build/Workers/{chunk-M7ERACJJ.js → chunk-3S2MFY4B.js} +13 -13
- package/Build/Workers/{chunk-BROJAZRZ.js → chunk-4AJGCQFX.js} +13 -13
- package/Build/Workers/{chunk-2FWRMUTY.js → chunk-4KIUON73.js} +4 -4
- package/Build/Workers/{chunk-5QULIR53.js → chunk-4PHPQRSH.js} +4 -4
- package/Build/Workers/{chunk-X4356LRH.js → chunk-66E3H2KU.js} +12 -12
- package/Build/Workers/{chunk-G43QFN4Q.js → chunk-6HCAQOVK.js} +6 -6
- package/Build/Workers/{chunk-23UFSGND.js → chunk-7LPEGKOF.js} +7 -7
- package/Build/Workers/{chunk-DDUQAJ4P.js → chunk-7VZNXIKG.js} +7 -7
- package/Build/Workers/{chunk-JURN7NPV.js → chunk-A6NCZSL3.js} +19 -19
- package/Build/Workers/{chunk-ZT7KWISZ.js → chunk-AOFMPKUB.js} +4 -4
- package/Build/Workers/{chunk-BIKA3NRA.js → chunk-AOIKO5Y7.js} +5 -5
- package/Build/Workers/{chunk-YWTJ2B4B.js → chunk-BDUJXBVF.js} +1 -1
- package/Build/Workers/{chunk-OGXZVPPM.js → chunk-C5CE4OG6.js} +469 -6
- package/Build/Workers/{chunk-FNIRWHJB.js → chunk-CE6GTZ4I.js} +11 -13
- package/Build/Workers/{chunk-SH5USDPI.js → chunk-CYAJYEKW.js} +6 -6
- package/Build/Workers/{chunk-Y5UQJLYE.js → chunk-FOZQIHZK.js} +6 -6
- package/Build/Workers/{chunk-2FRVPMCS.js → chunk-G7CJQKKD.js} +7 -7
- package/Build/Workers/{chunk-EERJKOAF.js → chunk-GIFJ77E4.js} +4 -4
- package/Build/Workers/{chunk-FJKNFAKQ.js → chunk-I5TDPPC4.js} +7197 -5096
- package/Build/Workers/{chunk-3VAZEH7M.js → chunk-IBXGK4WV.js} +2 -2
- package/Build/Workers/{chunk-VOXYEYJT.js → chunk-JI2445T5.js} +11 -11
- package/Build/Workers/{chunk-PGSJK77E.js → chunk-KPY4F4BW.js} +6 -6
- package/Build/Workers/{chunk-I46ZRR5W.js → chunk-LVJCR7DH.js} +17 -17
- package/Build/Workers/{chunk-T3XIFPYR.js → chunk-LW7WGHEU.js} +16 -16
- package/Build/Workers/{chunk-HU6N6EXB.js → chunk-MWYZ64MH.js} +12 -11
- package/Build/Workers/chunk-NI2R52QD.js +961 -0
- package/Build/Workers/{chunk-SOWMRMWA.js → chunk-PEABJLCK.js} +1 -1
- package/Build/Workers/{chunk-EG6PTBY2.js → chunk-PK7TEP3J.js} +15 -15
- package/Build/Workers/{chunk-GRC2ZTAF.js → chunk-POLFRINT.js} +14 -14
- package/Build/Workers/{chunk-Z3TIFFGF.js → chunk-PS6AEMBR.js} +7 -7
- package/Build/Workers/{chunk-Y2ME2IJV.js → chunk-PWF3YJJ5.js} +13 -13
- package/Build/Workers/{chunk-2A75IWRS.js → chunk-QKF7XXEQ.js} +7 -7
- package/Build/Workers/{chunk-4H7PY4U5.js → chunk-RL73GOEF.js} +2 -2
- package/Build/Workers/{chunk-MDWEGWPA.js → chunk-RR7EOKGZ.js} +10 -10
- package/Build/Workers/{chunk-F3YA3Y2Z.js → chunk-S4XDCPKD.js} +1 -1
- package/Build/Workers/{chunk-PPH7OFP3.js → chunk-TMMOULW3.js} +5 -5
- package/Build/Workers/{chunk-XGI5BXZY.js → chunk-U4IMCOF5.js} +2 -2
- package/Build/Workers/{chunk-4DO5W5XZ.js → chunk-UAJEGIWA.js} +6 -6
- package/Build/Workers/{chunk-BBWDMCVU.js → chunk-UCPPWV64.js} +1 -1
- package/Build/Workers/{chunk-FZRIVR7Y.js → chunk-V7JB576Q.js} +5 -5
- package/Build/Workers/{chunk-2UPKWTMJ.js → chunk-WEGCQ5DY.js} +6 -6
- package/Build/Workers/{chunk-STW2DGFI.js → chunk-WFICTTOE.js} +2 -2
- package/Build/Workers/{chunk-LPR3YNP2.js → chunk-WWP3I7R5.js} +5 -5
- package/Build/Workers/{chunk-A5DWLWCY.js → chunk-XHLDDE65.js} +10 -10
- package/Build/Workers/{chunk-UEXTBDBE.js → chunk-XWML5Y7N.js} +11 -13
- package/Build/Workers/{chunk-EHWHNOEX.js → chunk-YLZTCEBJ.js} +1 -1
- package/Build/Workers/{chunk-34FXV7D7.js → chunk-ZC4AGBZK.js} +2 -2
- package/Build/Workers/{chunk-GATZHF3K.js → chunk-ZDP32RQI.js} +2 -2
- package/Build/Workers/{chunk-KKCR2YOP.js → chunk-ZWPIM77Q.js} +11 -11
- 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 +23 -25
- 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 +33 -35
- 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 +5 -5
- package/Build/Workers/decodeI3S.js +10 -11
- package/Build/Workers/transcodeKTX2.js +8 -8
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
- package/Source/Core/Check.d.ts +127 -0
- package/Source/Core/Check.js +0 -1
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +1 -0
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/Rectangle.js +89 -0
- package/Source/Core/VerticalExaggeration.js +2 -1
- 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 +37 -3
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +4 -0
- package/Source/Scene/Cesium3DTile.js +65 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
- package/Source/Scene/Cesium3DTileset.js +52 -40
- package/Source/Scene/ClippingPolygon.js +212 -0
- package/Source/Scene/ClippingPolygonCollection.js +968 -0
- package/Source/Scene/Globe.js +14 -67
- package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
- package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
- package/Source/Scene/Label.js +33 -0
- package/Source/Scene/LabelCollection.js +2 -1
- package/Source/Scene/Model/Model.js +83 -0
- 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/Primitive.js +0 -3
- package/Source/Scene/SensorVolumePortionToDisplay.js +1 -1
- package/Source/Scene/Terrain.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +0 -15
- package/Source/Scene/VoxelCylinderShape.js +14 -131
- package/Source/Scene/VoxelEllipsoidShape.js +136 -227
- package/Source/Scene/VoxelPrimitive.js +106 -14
- package/Source/Scene/VoxelRenderResources.js +9 -3
- package/Source/Scene/VoxelShape.js +0 -10
- package/Source/Scene/processVoxelProperties.js +1 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
- package/Source/Shaders/GlobeFS.glsl +12 -0
- package/Source/Shaders/GlobeFS.js +12 -0
- 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/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/Shaders/Voxels/IntersectBox.glsl +21 -47
- package/Source/Shaders/Voxels/IntersectBox.js +21 -47
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +66 -96
- package/Source/Shaders/Voxels/IntersectCylinder.js +66 -96
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +226 -154
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +226 -154
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
- package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
- package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
- package/Source/Shaders/Voxels/Megatexture.js +1 -2
- package/Source/Shaders/Voxels/Octree.glsl +14 -9
- package/Source/Shaders/Voxels/Octree.js +14 -9
- package/Source/Shaders/Voxels/VoxelFS.glsl +93 -43
- package/Source/Shaders/Voxels/VoxelFS.js +93 -43
- package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
- package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
- package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +50 -8
- package/Source/Shaders/Voxels/convertUvToCylinder.js +50 -8
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +82 -53
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +82 -53
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/Workers/createGeometry.js +1 -1
- package/index.d.ts +478 -35
- package/index.js +61 -52
- package/package.json +2 -2
- package/Build/Workers/chunk-BG4UCVXN.js +0 -73
- package/Build/Workers/chunk-TTUZP4BO.js +0 -501
- package/Build/Workers/chunk-YJEBABKH.js +0 -2977
package/Source/Scene/Globe.js
CHANGED
|
@@ -28,7 +28,6 @@ import ImageryLayerCollection from "./ImageryLayerCollection.js";
|
|
|
28
28
|
import QuadtreePrimitive from "./QuadtreePrimitive.js";
|
|
29
29
|
import SceneMode from "./SceneMode.js";
|
|
30
30
|
import ShadowMode from "./ShadowMode.js";
|
|
31
|
-
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* The globe rendered in the scene, including its terrain ({@link Globe#terrainProvider})
|
|
@@ -341,10 +340,6 @@ function Globe(ellipsoid) {
|
|
|
341
340
|
*/
|
|
342
341
|
this.atmosphereBrightnessShift = 0.0;
|
|
343
342
|
|
|
344
|
-
this._terrainExaggerationChanged = false;
|
|
345
|
-
this._terrainExaggeration = 1.0;
|
|
346
|
-
this._terrainExaggerationRelativeHeight = 0.0;
|
|
347
|
-
|
|
348
343
|
/**
|
|
349
344
|
* Whether to show terrain skirts. Terrain skirts are geometry extending downwards from a tile's edges used to hide seams between neighboring tiles.
|
|
350
345
|
* Skirts are always hidden when the camera is underground or translucency is enabled.
|
|
@@ -454,6 +449,20 @@ Object.defineProperties(Globe.prototype, {
|
|
|
454
449
|
this._surface.tileProvider.clippingPlanes = value;
|
|
455
450
|
},
|
|
456
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
|
+
},
|
|
457
466
|
/**
|
|
458
467
|
* A property specifying a {@link Rectangle} used to limit globe rendering to a cartographic area.
|
|
459
468
|
* Defaults to the maximum extent of cartographic coordinates.
|
|
@@ -523,68 +532,6 @@ Object.defineProperties(Globe.prototype, {
|
|
|
523
532
|
return this._terrainProviderChanged;
|
|
524
533
|
},
|
|
525
534
|
},
|
|
526
|
-
/**
|
|
527
|
-
* A scalar used to exaggerate the terrain. Defaults to <code>1.0</code> (no exaggeration).
|
|
528
|
-
* A value of <code>2.0</code> scales the terrain by 2x.
|
|
529
|
-
* A value of <code>0.0</code> makes the terrain completely flat.
|
|
530
|
-
* Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
|
|
531
|
-
*
|
|
532
|
-
* @memberof Globe.prototype
|
|
533
|
-
* @type {number}
|
|
534
|
-
* @default 1.0
|
|
535
|
-
*
|
|
536
|
-
* @deprecated
|
|
537
|
-
*/
|
|
538
|
-
terrainExaggeration: {
|
|
539
|
-
get: function () {
|
|
540
|
-
deprecationWarning(
|
|
541
|
-
"Globe.terrainExaggeration",
|
|
542
|
-
"Globe.terrainExaggeration was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggeration instead."
|
|
543
|
-
);
|
|
544
|
-
return this._terrainExaggeration;
|
|
545
|
-
},
|
|
546
|
-
set: function (value) {
|
|
547
|
-
deprecationWarning(
|
|
548
|
-
"Globe.terrainExaggeration",
|
|
549
|
-
"Globe.terrainExaggeration was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggeration instead."
|
|
550
|
-
);
|
|
551
|
-
if (value !== this._terrainExaggeration) {
|
|
552
|
-
this._terrainExaggeration = value;
|
|
553
|
-
this._terrainExaggerationChanged = true;
|
|
554
|
-
}
|
|
555
|
-
},
|
|
556
|
-
},
|
|
557
|
-
/**
|
|
558
|
-
* The height from which terrain is exaggerated. Defaults to <code>0.0</code> (scaled relative to ellipsoid surface).
|
|
559
|
-
* Terrain that is above this height will scale upwards and terrain that is below this height will scale downwards.
|
|
560
|
-
* Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
|
|
561
|
-
* If {@link Globe#terrainExaggeration} is <code>1.0</code> this value will have no effect.
|
|
562
|
-
*
|
|
563
|
-
* @memberof Globe.prototype
|
|
564
|
-
* @type {number}
|
|
565
|
-
* @default 0.0
|
|
566
|
-
*
|
|
567
|
-
* @deprecated
|
|
568
|
-
*/
|
|
569
|
-
terrainExaggerationRelativeHeight: {
|
|
570
|
-
get: function () {
|
|
571
|
-
deprecationWarning(
|
|
572
|
-
"Globe.terrainExaggerationRelativeHeight",
|
|
573
|
-
"Globe.terrainExaggerationRelativeHeight was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggerationRelativeHeight instead."
|
|
574
|
-
);
|
|
575
|
-
return this._terrainExaggerationRelativeHeight;
|
|
576
|
-
},
|
|
577
|
-
set: function (value) {
|
|
578
|
-
deprecationWarning(
|
|
579
|
-
"Globe.terrainExaggerationRelativeHeight",
|
|
580
|
-
"Globe.terrainExaggerationRelativeHeight was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggerationRelativeHeight instead."
|
|
581
|
-
);
|
|
582
|
-
if (value !== this._terrainExaggerationRelativeHeight) {
|
|
583
|
-
this._terrainExaggerationRelativeHeight = value;
|
|
584
|
-
this._terrainExaggerationChanged = true;
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
},
|
|
588
535
|
/**
|
|
589
536
|
* Gets an event that's raised when the length of the tile load queue has changed since the last render frame. When the load queue is empty,
|
|
590
537
|
* all terrain and imagery for the current view have been loaded. The event passes the new length of the tile load queue.
|
|
@@ -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;
|
package/Source/Scene/Label.js
CHANGED
|
@@ -85,6 +85,36 @@ function parseFont(label) {
|
|
|
85
85
|
label._lineHeight = fontInfo.lineHeight;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @typedef {object} Label.ConstructorOptions
|
|
90
|
+
*
|
|
91
|
+
* Initialization options for the Label constructor
|
|
92
|
+
*
|
|
93
|
+
* @property {Cartesian3} position The cartesian position of the label.
|
|
94
|
+
* @property {string} [id] A user-defined object to return when the label is picked with {@link Scene#pick}.
|
|
95
|
+
* @property {boolean} [show=true] Determines if this label will be shown.
|
|
96
|
+
* @property {string} [text] A string specifying the text of the label.
|
|
97
|
+
* @property {string} [font='30px sans-serif'] A string specifying the font used to draw this label. Fonts are specified using the same syntax as the CSS 'font' property.
|
|
98
|
+
* @property {LabelStyle} [style=LabelStyle.FILL] A {@link LabelStyle} specifying the style of the label.
|
|
99
|
+
* @property {number} [scale=1.0] A number specifying the uniform scale that is multiplied with the label size.
|
|
100
|
+
* @property {boolean} [showBackground=false] Determines if a background behind this label will be shown.
|
|
101
|
+
* @property {Color} [backgroundColor=new Color(0.165, 0.165, 0.165, 0.8)] A {@link Color} specifying the background color of the label.
|
|
102
|
+
* @property {Cartesian2} [backgroundPadding=new Cartesian2(7, 5)] A {@link Cartesian2} Specifying the horizontal and vertical background padding in pixels.
|
|
103
|
+
* @property {Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} specifying the pixel offset in screen space from the origin of this label.
|
|
104
|
+
* @property {Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} specifying the 3D Cartesian offset applied to this label in eye coordinates.
|
|
105
|
+
* @property {HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.CENTER] A {@link HorizontalOrigin} specifying the horizontal origin of this label.
|
|
106
|
+
* @property {VerticalOrigin} [verticalOrigin=VerticalOrigin.CENTER] A {@link VerticalOrigin} specifying the vertical origin of this label.
|
|
107
|
+
* @property {HeightReference} [heightReference=HeightReference.NONE] A {@link HeightReference} specifying the height reference of this label.
|
|
108
|
+
* @property {Color} [fillColor=Color.WHITE] A {@link Color} specifying the fill color of the label.
|
|
109
|
+
* @property {Color} [outlineColor=Color.BLACK] A {@link Color} specifying the outline color of the label.
|
|
110
|
+
* @property {number} [outlineWidth=1.0] A number specifying the outline width of the label.
|
|
111
|
+
* @property {NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} specifying near and far translucency properties of the label based on the label's distance from the camera.
|
|
112
|
+
* @property {NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} specifying near and far pixel offset scaling properties of the label based on the label's distance from the camera.
|
|
113
|
+
* @property {NearFarScalar} [scaleByDistance] A {@link NearFarScalar} specifying near and far scaling properties of the label based on the label's distance from the camera.
|
|
114
|
+
* @property {DistanceDisplayCondition} [distanceDisplayCondition] A {@link DistanceDisplayCondition} specifying at what distance from the camera that this label will be displayed.
|
|
115
|
+
* @property {number} [disableDepthTestDistance] A number specifying the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain.
|
|
116
|
+
*/
|
|
117
|
+
|
|
88
118
|
/**
|
|
89
119
|
* <div class="notice">
|
|
90
120
|
* Create labels by calling {@link LabelCollection#add}. Do not call the constructor directly.
|
|
@@ -94,6 +124,9 @@ function parseFont(label) {
|
|
|
94
124
|
* @internalConstructor
|
|
95
125
|
* @class
|
|
96
126
|
*
|
|
127
|
+
* @param {Label.ConstructorOptions} options Object describing initialization options
|
|
128
|
+
* @param {LabelCollection} labelCollection Instance of LabelCollection
|
|
129
|
+
*
|
|
97
130
|
* @exception {DeveloperError} translucencyByDistance.far must be greater than translucencyByDistance.near
|
|
98
131
|
* @exception {DeveloperError} pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near
|
|
99
132
|
* @exception {DeveloperError} distanceDisplayCondition.far must be greater than distanceDisplayCondition.near
|
|
@@ -710,7 +710,7 @@ Object.defineProperties(LabelCollection.prototype, {
|
|
|
710
710
|
* Creates and adds a label with the specified initial properties to the collection.
|
|
711
711
|
* The added label is returned so it can be modified or removed from the collection later.
|
|
712
712
|
*
|
|
713
|
-
* @param {
|
|
713
|
+
* @param {Label.ConstructorOptions} [options] A template describing the label's properties as shown in Example 1.
|
|
714
714
|
* @returns {Label} The label that was added to the collection.
|
|
715
715
|
*
|
|
716
716
|
* @performance Calling <code>add</code> is expected constant time. However, the collection's vertex buffer
|
|
@@ -755,6 +755,7 @@ Object.defineProperties(LabelCollection.prototype, {
|
|
|
755
755
|
* font : '24px Helvetica',
|
|
756
756
|
* });
|
|
757
757
|
*
|
|
758
|
+
*
|
|
758
759
|
* @see LabelCollection#remove
|
|
759
760
|
* @see LabelCollection#removeAll
|
|
760
761
|
*/
|
|
@@ -17,6 +17,7 @@ import Resource from "../../Core/Resource.js";
|
|
|
17
17
|
import RuntimeError from "../../Core/RuntimeError.js";
|
|
18
18
|
import Pass from "../../Renderer/Pass.js";
|
|
19
19
|
import ClippingPlaneCollection from "../ClippingPlaneCollection.js";
|
|
20
|
+
import ClippingPolygonCollection from "../ClippingPolygonCollection.js";
|
|
20
21
|
import ColorBlendMode from "../ColorBlendMode.js";
|
|
21
22
|
import GltfLoader from "../GltfLoader.js";
|
|
22
23
|
import HeightReference, {
|
|
@@ -147,6 +148,7 @@ import pickModel from "./pickModel.js";
|
|
|
147
148
|
* @privateParam {boolean} [options.showOutline=true] Whether to display the outline for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. When true, outlines are displayed. When false, outlines are not displayed.
|
|
148
149
|
* @privateParam {Color} [options.outlineColor=Color.BLACK] The color to use when rendering outlines.
|
|
149
150
|
* @privateParam {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model.
|
|
151
|
+
* @privateParam {ClippingPolygonCollection} [options.clippingPolygons] The {@link ClippingPolygonCollection} used to selectively disable rendering the model.
|
|
150
152
|
* @privateParam {Cartesian3} [options.lightColor] The light color when shading the model. When <code>undefined</code> the scene's light color is used instead.
|
|
151
153
|
* @privateParam {ImageBasedLighting} [options.imageBasedLighting] The properties for managing image-based lighting on this model.
|
|
152
154
|
* @privateParam {boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent.
|
|
@@ -370,6 +372,20 @@ function Model(options) {
|
|
|
370
372
|
this._clippingPlanesState = 0; // If this value changes, the shaders need to be regenerated.
|
|
371
373
|
this._clippingPlanesMatrix = Matrix4.clone(Matrix4.IDENTITY); // Derived from reference matrix and the current view matrix
|
|
372
374
|
|
|
375
|
+
// If the given clipping polygons don't have an owner, make this model its owner.
|
|
376
|
+
// Otherwise, the clipping polygons are passed down from a tileset.
|
|
377
|
+
const clippingPolygons = options.clippingPolygons;
|
|
378
|
+
if (defined(clippingPolygons) && clippingPolygons.owner === undefined) {
|
|
379
|
+
ClippingPolygonCollection.setOwner(
|
|
380
|
+
clippingPolygons,
|
|
381
|
+
this,
|
|
382
|
+
"_clippingPolygons"
|
|
383
|
+
);
|
|
384
|
+
} else {
|
|
385
|
+
this._clippingPolygons = clippingPolygons;
|
|
386
|
+
}
|
|
387
|
+
this._clippingPolygonsState = 0; // If this value changes, the shaders need to be regenerated.
|
|
388
|
+
|
|
373
389
|
this._lightColor = Cartesian3.clone(options.lightColor);
|
|
374
390
|
|
|
375
391
|
this._imageBasedLighting = defined(options.imageBasedLighting)
|
|
@@ -1303,6 +1319,26 @@ Object.defineProperties(Model.prototype, {
|
|
|
1303
1319
|
},
|
|
1304
1320
|
},
|
|
1305
1321
|
|
|
1322
|
+
/**
|
|
1323
|
+
* The {@link ClippingPolygonCollection} used to selectively disable rendering the model.
|
|
1324
|
+
*
|
|
1325
|
+
* @memberof Model.prototype
|
|
1326
|
+
*
|
|
1327
|
+
* @type {ClippingPolygonCollection}
|
|
1328
|
+
*/
|
|
1329
|
+
clippingPolygons: {
|
|
1330
|
+
get: function () {
|
|
1331
|
+
return this._clippingPolygons;
|
|
1332
|
+
},
|
|
1333
|
+
set: function (value) {
|
|
1334
|
+
if (value !== this._clippingPolygons) {
|
|
1335
|
+
// Handle destroying old clipping polygons, new clipping polygons ownership
|
|
1336
|
+
ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
|
|
1337
|
+
this.resetDrawCommands();
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
},
|
|
1341
|
+
|
|
1306
1342
|
/**
|
|
1307
1343
|
* The light color when shading the model. When <code>undefined</code> the scene's light color is used instead.
|
|
1308
1344
|
* <p>
|
|
@@ -1801,6 +1837,7 @@ Model.prototype.update = function (frameState) {
|
|
|
1801
1837
|
updateSilhouette(this, frameState);
|
|
1802
1838
|
updateSkipLevelOfDetail(this, frameState);
|
|
1803
1839
|
updateClippingPlanes(this, frameState);
|
|
1840
|
+
updateClippingPolygons(this, frameState);
|
|
1804
1841
|
updateSceneMode(this, frameState);
|
|
1805
1842
|
updateFog(this, frameState);
|
|
1806
1843
|
updateVerticalExaggeration(this, frameState);
|
|
@@ -1987,6 +2024,24 @@ function updateClippingPlanes(model, frameState) {
|
|
|
1987
2024
|
}
|
|
1988
2025
|
}
|
|
1989
2026
|
|
|
2027
|
+
function updateClippingPolygons(model, frameState) {
|
|
2028
|
+
// Update the clipping polygon collection / state for this model to detect any changes.
|
|
2029
|
+
let currentClippingPolygonsState = 0;
|
|
2030
|
+
if (model.isClippingPolygonsEnabled()) {
|
|
2031
|
+
if (model._clippingPolygons.owner === model) {
|
|
2032
|
+
model._clippingPolygons.update(frameState);
|
|
2033
|
+
model._clippingPolygons.queueCommands(frameState);
|
|
2034
|
+
}
|
|
2035
|
+
currentClippingPolygonsState =
|
|
2036
|
+
model._clippingPolygons.clippingPolygonsState;
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
if (currentClippingPolygonsState !== model._clippingPolygonsState) {
|
|
2040
|
+
model.resetDrawCommands();
|
|
2041
|
+
model._clippingPolygonsState = currentClippingPolygonsState;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
|
|
1990
2045
|
function updateSceneMode(model, frameState) {
|
|
1991
2046
|
if (frameState.mode !== model._sceneMode) {
|
|
1992
2047
|
if (model._projectTo2D) {
|
|
@@ -2537,6 +2592,21 @@ Model.prototype.pick = function (
|
|
|
2537
2592
|
);
|
|
2538
2593
|
};
|
|
2539
2594
|
|
|
2595
|
+
/**
|
|
2596
|
+
* Gets whether or not clipping polygons are enabled for this model.
|
|
2597
|
+
*
|
|
2598
|
+
* @returns {boolean} <code>true</code> if clipping polygons are enabled for this model, <code>false</code>.
|
|
2599
|
+
* @private
|
|
2600
|
+
*/
|
|
2601
|
+
Model.prototype.isClippingPolygonsEnabled = function () {
|
|
2602
|
+
const clippingPolygons = this._clippingPolygons;
|
|
2603
|
+
return (
|
|
2604
|
+
defined(clippingPolygons) &&
|
|
2605
|
+
clippingPolygons.enabled &&
|
|
2606
|
+
clippingPolygons.length !== 0
|
|
2607
|
+
);
|
|
2608
|
+
};
|
|
2609
|
+
|
|
2540
2610
|
/**
|
|
2541
2611
|
* Returns true if this object was destroyed; otherwise, false.
|
|
2542
2612
|
* <br /><br />
|
|
@@ -2606,6 +2676,17 @@ Model.prototype.destroy = function () {
|
|
|
2606
2676
|
}
|
|
2607
2677
|
this._clippingPlanes = undefined;
|
|
2608
2678
|
|
|
2679
|
+
// Only destroy the ClippingPolygonCollection if this is the owner.
|
|
2680
|
+
const clippingPolygonCollection = this._clippingPolygons;
|
|
2681
|
+
if (
|
|
2682
|
+
defined(clippingPolygonCollection) &&
|
|
2683
|
+
!clippingPolygonCollection.isDestroyed() &&
|
|
2684
|
+
clippingPolygonCollection.owner === this
|
|
2685
|
+
) {
|
|
2686
|
+
clippingPolygonCollection.destroy();
|
|
2687
|
+
}
|
|
2688
|
+
this._clippingPolygons = undefined;
|
|
2689
|
+
|
|
2609
2690
|
// Only destroy the ImageBasedLighting if this is the owner.
|
|
2610
2691
|
if (
|
|
2611
2692
|
this._shouldDestroyImageBasedLighting &&
|
|
@@ -2689,6 +2770,7 @@ Model.prototype.destroyModelResources = function () {
|
|
|
2689
2770
|
* @param {boolean} [options.showOutline=true] Whether to display the outline for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. When true, outlines are displayed. When false, outlines are not displayed.
|
|
2690
2771
|
* @param {Color} [options.outlineColor=Color.BLACK] The color to use when rendering outlines.
|
|
2691
2772
|
* @param {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model.
|
|
2773
|
+
* @param {ClippingPolygonCollection} [options.clippingPolygons] The {@link ClippingPolygonCollection} used to selectively disable rendering the model.
|
|
2692
2774
|
* @param {Cartesian3} [options.lightColor] The light color when shading the model. When <code>undefined</code> the scene's light color is used instead.
|
|
2693
2775
|
* @param {ImageBasedLighting} [options.imageBasedLighting] The properties for managing image-based lighting on this model.
|
|
2694
2776
|
* @param {boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent.
|
|
@@ -3051,6 +3133,7 @@ function makeModelOptions(loader, modelType, options) {
|
|
|
3051
3133
|
showOutline: options.showOutline,
|
|
3052
3134
|
outlineColor: options.outlineColor,
|
|
3053
3135
|
clippingPlanes: options.clippingPlanes,
|
|
3136
|
+
clippingPolygons: options.clippingPolygons,
|
|
3054
3137
|
lightColor: options.lightColor,
|
|
3055
3138
|
imageBasedLighting: options.imageBasedLighting,
|
|
3056
3139
|
backFaceCulling: options.backFaceCulling,
|