@cesium/engine 22.2.0 → 23.0.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/Workers/{chunk-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
- package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
- 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 +22 -22
- 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 +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- 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 +20 -12
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/BoxGeometry.js +1 -1
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/CornerType.js +1 -1
- package/Source/Core/CorridorGeometry.js +1 -1
- package/Source/Core/FeatureDetection.js +1 -32
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/IntersectionTests.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/PinBuilder.js +1 -1
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometry.js +1 -1
- package/Source/Core/RectangleGeometry.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +4 -8
- package/Source/Core/TerrainMesh.js +11 -8
- package/Source/Core/TerrainPicker.js +24 -7
- package/Source/Core/VideoSynchronizer.js +1 -1
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Core/writeTextToCanvas.js +40 -86
- package/Source/DataSources/BillboardGraphics.js +1 -1
- package/Source/DataSources/BoxGraphics.js +1 -1
- package/Source/DataSources/CallbackPositionProperty.js +1 -1
- package/Source/DataSources/CorridorGraphics.js +1 -1
- package/Source/DataSources/CzmlDataSource.js +1 -1
- package/Source/DataSources/EllipseGraphics.js +1 -1
- package/Source/DataSources/EllipsoidGraphics.js +1 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/EntityCluster.js +2 -2
- package/Source/DataSources/GeoJsonDataSource.js +2 -2
- package/Source/DataSources/GpxDataSource.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -1
- package/Source/DataSources/KmlTour.js +1 -1
- package/Source/DataSources/LabelGraphics.js +1 -1
- package/Source/DataSources/ModelGraphics.js +1 -1
- package/Source/DataSources/PlaneGraphics.js +1 -1
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/DataSources/PolylineGraphics.js +1 -1
- package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
- package/Source/DataSources/RectangleGraphics.js +1 -1
- package/Source/DataSources/WallGraphics.js +1 -1
- package/Source/DataSources/exportKml.js +1 -1
- package/Source/Renderer/Context.js +11 -10
- package/Source/Renderer/ContextLimits.js +66 -33
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Renderer/ShaderSource.js +19 -18
- package/Source/Renderer/Texture.js +1 -1
- package/Source/Renderer/Texture3D.js +166 -7
- package/Source/Renderer/TextureAtlas.js +2 -2
- package/Source/Scene/Appearance.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +8 -5
- package/Source/Scene/BillboardCollection.js +65 -26
- package/Source/Scene/BillboardTexture.js +4 -1
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/Camera.js +13 -2
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/CloudCollection.js +2 -2
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/CumulusCloud.js +1 -1
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/Fog.js +1 -1
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +907 -168
- package/Source/Scene/Globe.js +3 -10
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +323 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/ImageBasedLighting.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/ImageryProvider.js +2 -2
- package/Source/Scene/Label.js +7 -5
- package/Source/Scene/LabelCollection.js +60 -2
- package/Source/Scene/Material.js +1 -1
- package/Source/Scene/MaterialAppearance.js +1 -1
- package/Source/Scene/Megatexture.js +174 -242
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/ModelComponents.js +10 -0
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/ParticleSystem.js +2 -2
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/Polyline.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -4
- package/Source/Scene/PolylineColorAppearance.js +1 -6
- package/Source/Scene/PolylineMaterialAppearance.js +1 -6
- package/Source/Scene/PostProcessStageCollection.js +1 -1
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/QuadtreePrimitive.js +6 -3
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/ShadowMap.js +1 -2
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
- package/Source/Scene/Vector3DTilePolylines.js +1 -5
- package/Source/Scene/VoxelPrimitive.js +16 -33
- package/Source/Scene/VoxelRenderResources.js +1 -8
- package/Source/Scene/VoxelTraversal.js +16 -61
- package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Scene/processVoxelProperties.js +1 -1
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +9 -1
- package/Source/Shaders/Model/ModelFS.js +9 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -2
- package/Source/Shaders/Model/ModelVS.js +4 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
- package/Source/Shaders/Voxels/Megatexture.js +15 -83
- package/Source/Shaders/Voxels/Octree.glsl +6 -9
- package/Source/Shaders/Voxels/Octree.js +6 -9
- package/Source/Widget/CesiumWidget.js +1 -1
- package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
- package/index.d.ts +582 -193
- package/index.js +91 -83
- package/package.json +2 -1
- package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
|
@@ -95,7 +95,11 @@ CustomShaderPipelineStage.process = function (
|
|
|
95
95
|
|
|
96
96
|
// Generate lines of code for the shader, but don't add them to the shader
|
|
97
97
|
// yet.
|
|
98
|
-
const generatedCode = generateShaderLines(
|
|
98
|
+
const generatedCode = generateShaderLines(
|
|
99
|
+
customShader,
|
|
100
|
+
primitive,
|
|
101
|
+
renderResources,
|
|
102
|
+
);
|
|
99
103
|
|
|
100
104
|
// In some corner cases, the primitive may not be compatible with the
|
|
101
105
|
// shader. In this case, skip the custom shader.
|
|
@@ -221,14 +225,26 @@ function inferAttributeDefaults(attributeName) {
|
|
|
221
225
|
* @private
|
|
222
226
|
* @param {CustomShader} customShader
|
|
223
227
|
* @param {Object<string, ModelComponents.Attribute>} attributesByName
|
|
228
|
+
* @param {Set<string>} primitivePropertyIds all property IDs referenced by the primitive being processed, across all its property textures, property attributes, and property tables.
|
|
224
229
|
* @returns {object}
|
|
225
230
|
*/
|
|
226
|
-
function generateVertexShaderLines(
|
|
231
|
+
function generateVertexShaderLines(
|
|
232
|
+
customShader,
|
|
233
|
+
attributesByName,
|
|
234
|
+
primitivePropertyIds,
|
|
235
|
+
) {
|
|
227
236
|
if (!defined(customShader.vertexShaderText)) {
|
|
228
237
|
return { enabled: false };
|
|
229
238
|
}
|
|
230
239
|
|
|
231
|
-
const
|
|
240
|
+
const usedVariables = customShader.usedVariablesVertex;
|
|
241
|
+
if (
|
|
242
|
+
!checkMetadataCompatibility(usedVariables.metadataSet, primitivePropertyIds)
|
|
243
|
+
) {
|
|
244
|
+
return { enabled: false };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const primitiveAttributes = usedVariables.attributeSet;
|
|
232
248
|
const addToShader = getPrimitiveAttributesUsedInShader(
|
|
233
249
|
attributesByName,
|
|
234
250
|
primitiveAttributes,
|
|
@@ -318,14 +334,28 @@ function generatePositionBuiltins(customShader) {
|
|
|
318
334
|
* @private
|
|
319
335
|
* @param {CustomShader} customShader
|
|
320
336
|
* @param {Object<string, ModelComponents.Attribute>} attributesByName
|
|
337
|
+
* @param {PrimitiveRenderResources} renderResources
|
|
338
|
+
* @param {ModelComponents.Primitive} primitive
|
|
339
|
+
* @param {Set<string>} primitivePropertyIds all property IDs referenced by the primitive being processed, across all its property textures, property attributes, and property tables.
|
|
321
340
|
* @returns {object}
|
|
322
341
|
*/
|
|
323
|
-
function generateFragmentShaderLines(
|
|
342
|
+
function generateFragmentShaderLines(
|
|
343
|
+
customShader,
|
|
344
|
+
attributesByName,
|
|
345
|
+
primitivePropertyIds,
|
|
346
|
+
) {
|
|
324
347
|
if (!defined(customShader.fragmentShaderText)) {
|
|
325
348
|
return { enabled: false };
|
|
326
349
|
}
|
|
327
350
|
|
|
328
|
-
const
|
|
351
|
+
const usedVariables = customShader.usedVariablesFragment;
|
|
352
|
+
if (
|
|
353
|
+
!checkMetadataCompatibility(usedVariables.metadataSet, primitivePropertyIds)
|
|
354
|
+
) {
|
|
355
|
+
return { enabled: false };
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const primitiveAttributes = usedVariables.attributeSet;
|
|
329
359
|
const addToShader = getPrimitiveAttributesUsedInShader(
|
|
330
360
|
attributesByName,
|
|
331
361
|
primitiveAttributes,
|
|
@@ -477,16 +507,26 @@ function getAttributesNeedingDefaults(
|
|
|
477
507
|
* @private
|
|
478
508
|
* @param {CustomShader} customShader
|
|
479
509
|
* @param {ModelComponents.Primitive} primitive
|
|
510
|
+
* @param {PrimitiveRenderResources} renderResources
|
|
480
511
|
* @returns {object}
|
|
481
512
|
*/
|
|
482
|
-
function generateShaderLines(customShader, primitive) {
|
|
513
|
+
function generateShaderLines(customShader, primitive, renderResources) {
|
|
483
514
|
// Attempt to generate vertex and fragment shader lines before adding any
|
|
484
515
|
// code to the shader.
|
|
485
516
|
const attributesByName = getAttributesByName(primitive.attributes);
|
|
486
|
-
const
|
|
517
|
+
const primitivePropertyIds = getAllPropertyIds(
|
|
518
|
+
primitive,
|
|
519
|
+
renderResources.model.structuralMetadata,
|
|
520
|
+
);
|
|
521
|
+
const vertexLines = generateVertexShaderLines(
|
|
522
|
+
customShader,
|
|
523
|
+
attributesByName,
|
|
524
|
+
primitivePropertyIds,
|
|
525
|
+
);
|
|
487
526
|
const fragmentLines = generateFragmentShaderLines(
|
|
488
527
|
customShader,
|
|
489
528
|
attributesByName,
|
|
529
|
+
primitivePropertyIds,
|
|
490
530
|
);
|
|
491
531
|
|
|
492
532
|
// positionWC must be computed in the vertex shader
|
|
@@ -664,4 +704,79 @@ function addLinesToShader(shaderBuilder, customShader, generatedCode) {
|
|
|
664
704
|
}
|
|
665
705
|
}
|
|
666
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Get all property IDs a given primitive references (whether or not used in the shader).
|
|
709
|
+
*
|
|
710
|
+
* @param {StructuralMetadata} structuralMetadata the structural metadata for the primitive being processed
|
|
711
|
+
* @param {ModelComponents.Primitive} primitive the primitive being processed by this stage
|
|
712
|
+
*
|
|
713
|
+
* @returns {Set<string>} a set of all property IDs the primitive references
|
|
714
|
+
*
|
|
715
|
+
* @private
|
|
716
|
+
*/
|
|
717
|
+
function getAllPropertyIds(primitive, structuralMetadata) {
|
|
718
|
+
if (!defined(structuralMetadata)) {
|
|
719
|
+
return new Set();
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
const usedPropertyTextures = primitive.propertyTextureIds;
|
|
723
|
+
const usedPropertyAttributes = primitive.propertyAttributeIds;
|
|
724
|
+
const usedPropertyTables = defined(primitive.featureIds)
|
|
725
|
+
? primitive.featureIds.map((featureId) => featureId.propertyTableId)
|
|
726
|
+
: [];
|
|
727
|
+
|
|
728
|
+
const primitivePropertyIds = new Set();
|
|
729
|
+
|
|
730
|
+
function addUsedPropertyIds(propertyContainerIds, propertyContainers) {
|
|
731
|
+
for (const id of propertyContainerIds) {
|
|
732
|
+
const propertyContainer = propertyContainers[id];
|
|
733
|
+
Object.keys(propertyContainer.properties).forEach((propertyId) =>
|
|
734
|
+
primitivePropertyIds.add(propertyId),
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
addUsedPropertyIds(usedPropertyTextures, structuralMetadata.propertyTextures);
|
|
740
|
+
addUsedPropertyIds(
|
|
741
|
+
usedPropertyAttributes,
|
|
742
|
+
structuralMetadata.propertyAttributes,
|
|
743
|
+
);
|
|
744
|
+
addUsedPropertyIds(usedPropertyTables, structuralMetadata.propertyTables);
|
|
745
|
+
|
|
746
|
+
return primitivePropertyIds;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Because all primitives in a tileset share the same shader, but not necessarily the same
|
|
751
|
+
* metadata schema, not all primitives will be compatible with the custom shader. This is expected-
|
|
752
|
+
* it should not cause a fatal error (compilation failure), but instead should disable the custom shader for this primitive.
|
|
753
|
+
*
|
|
754
|
+
* @param {Object<string, boolean>} metadataPropertiesUsedInShader the set of metadata properties used in the shader (see CustomShader.js)
|
|
755
|
+
* @param {Set<string>} primitivePropertyIds the set of all metadata property IDs used in the primitive being processed
|
|
756
|
+
*
|
|
757
|
+
* @returns {boolean} true if all metadata properties used in the shader exist on the primitive, false otherwise
|
|
758
|
+
*
|
|
759
|
+
* @private
|
|
760
|
+
*/
|
|
761
|
+
function checkMetadataCompatibility(
|
|
762
|
+
metadataPropertiesUsedInShader,
|
|
763
|
+
primitivePropertyIds,
|
|
764
|
+
) {
|
|
765
|
+
for (const propertyName in metadataPropertiesUsedInShader) {
|
|
766
|
+
if (!metadataPropertiesUsedInShader.hasOwnProperty(propertyName)) {
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (!primitivePropertyIds.has(propertyName)) {
|
|
771
|
+
CustomShaderPipelineStage._oneTimeWarning(
|
|
772
|
+
"CustomShaderPipelineStage.checkMetadataCompatibility",
|
|
773
|
+
`A custom shader uses metadata property "${propertyName}" which is not present for all primitives in the tileset. Disabling the custom shader for these primitives.`,
|
|
774
|
+
);
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
return true;
|
|
780
|
+
}
|
|
781
|
+
|
|
667
782
|
export default CustomShaderPipelineStage;
|
|
@@ -33,31 +33,26 @@ import addAllToArray from "../../Core/addAllToArray.js";
|
|
|
33
33
|
* Implements the {@link ResourceLoader} interface.
|
|
34
34
|
* </p>
|
|
35
35
|
*
|
|
36
|
-
* @alias GeoJsonLoader
|
|
37
|
-
* @constructor
|
|
38
|
-
* @augments ResourceLoader
|
|
39
36
|
* @private
|
|
40
|
-
*
|
|
41
|
-
* @param {object} options Object with the following properties:
|
|
42
|
-
* @param {object} options.geoJson The GeoJson object.
|
|
43
37
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
class GeoJsonLoader extends ResourceLoader {
|
|
39
|
+
/**
|
|
40
|
+
* @param {object} options Object with the following properties:
|
|
41
|
+
* @param {object} options.geoJson The GeoJson object.
|
|
42
|
+
*/
|
|
43
|
+
constructor(options) {
|
|
44
|
+
super();
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
Check.typeOf.object("options.geoJson", options.geoJson);
|
|
49
|
-
//>>includeEnd('debug');
|
|
46
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
//>>includeStart('debug', pragmas.debug);
|
|
49
|
+
Check.typeOf.object("options.geoJson", options.geoJson);
|
|
50
|
+
//>>includeEnd('debug');
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
52
|
+
this._geoJson = options.geoJson;
|
|
53
|
+
this._components = undefined;
|
|
54
|
+
}
|
|
59
55
|
|
|
60
|
-
Object.defineProperties(GeoJsonLoader.prototype, {
|
|
61
56
|
/**
|
|
62
57
|
* The cache key of the resource.
|
|
63
58
|
*
|
|
@@ -67,11 +62,10 @@ Object.defineProperties(GeoJsonLoader.prototype, {
|
|
|
67
62
|
* @readonly
|
|
68
63
|
* @private
|
|
69
64
|
*/
|
|
70
|
-
cacheKey
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
65
|
+
get cacheKey() {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
75
69
|
/**
|
|
76
70
|
* The loaded components.
|
|
77
71
|
*
|
|
@@ -81,41 +75,47 @@ Object.defineProperties(GeoJsonLoader.prototype, {
|
|
|
81
75
|
* @readonly
|
|
82
76
|
* @private
|
|
83
77
|
*/
|
|
84
|
-
components
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
});
|
|
78
|
+
get components() {
|
|
79
|
+
return this._components;
|
|
80
|
+
}
|
|
90
81
|
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
82
|
+
/**
|
|
83
|
+
* Loads the resource.
|
|
84
|
+
* @returns {Promise<GeoJsonLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
load() {
|
|
88
|
+
return Promise.resolve(this);
|
|
89
|
+
}
|
|
99
90
|
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Processes the resource until it becomes ready.
|
|
93
|
+
*
|
|
94
|
+
* @param {FrameState} frameState The frame state.
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
process(frameState) {
|
|
98
|
+
//>>includeStart('debug', pragmas.debug);
|
|
99
|
+
Check.typeOf.object("frameState", frameState);
|
|
100
|
+
//>>includeEnd('debug');
|
|
101
|
+
|
|
102
|
+
if (defined(this._components)) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
110
105
|
|
|
111
|
-
|
|
106
|
+
this._components = parse(this._geoJson, frameState);
|
|
107
|
+
this._geoJson = undefined;
|
|
112
108
|
return true;
|
|
113
109
|
}
|
|
114
110
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Unloads the resource.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
unload() {
|
|
116
|
+
this._components = undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
119
|
|
|
120
120
|
function ParsedFeature() {
|
|
121
121
|
this.lines = undefined;
|
|
@@ -686,12 +686,4 @@ function parse(geoJson, frameState) {
|
|
|
686
686
|
return components;
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
-
/**
|
|
690
|
-
* Unloads the resource.
|
|
691
|
-
* @private
|
|
692
|
-
*/
|
|
693
|
-
GeoJsonLoader.prototype.unload = function () {
|
|
694
|
-
this._components = undefined;
|
|
695
|
-
};
|
|
696
|
-
|
|
697
689
|
export default GeoJsonLoader;
|
|
@@ -174,6 +174,14 @@ GeometryPipelineStage.process = function (
|
|
|
174
174
|
index = renderResources.attributeIndex++;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
// Use flat interpolation for point primitive vertex attributes (only supported in WebGL 2)
|
|
178
|
+
const interpolationQualifier =
|
|
179
|
+
!isPositionAttribute &&
|
|
180
|
+
primitive.primitiveType === PrimitiveType.POINTS &&
|
|
181
|
+
frameState.context.webgl2
|
|
182
|
+
? "flat"
|
|
183
|
+
: undefined;
|
|
184
|
+
|
|
177
185
|
processAttribute(
|
|
178
186
|
renderResources,
|
|
179
187
|
attribute,
|
|
@@ -181,6 +189,7 @@ GeometryPipelineStage.process = function (
|
|
|
181
189
|
attributeLocationCount,
|
|
182
190
|
use2D,
|
|
183
191
|
instanced,
|
|
192
|
+
interpolationQualifier,
|
|
184
193
|
);
|
|
185
194
|
}
|
|
186
195
|
|
|
@@ -201,6 +210,7 @@ function processAttribute(
|
|
|
201
210
|
attributeLocationCount,
|
|
202
211
|
use2D,
|
|
203
212
|
instanced,
|
|
213
|
+
interpolationQualifier,
|
|
204
214
|
) {
|
|
205
215
|
const shaderBuilder = renderResources.shaderBuilder;
|
|
206
216
|
const attributeInfo = ModelUtility.getAttributeInfo(attribute);
|
|
@@ -227,7 +237,7 @@ function processAttribute(
|
|
|
227
237
|
}
|
|
228
238
|
|
|
229
239
|
addAttributeDeclaration(shaderBuilder, attributeInfo, modifyFor2D);
|
|
230
|
-
addVaryingDeclaration(shaderBuilder, attributeInfo);
|
|
240
|
+
addVaryingDeclaration(shaderBuilder, attributeInfo, interpolationQualifier);
|
|
231
241
|
|
|
232
242
|
// For common attributes like normals and tangents, the code is
|
|
233
243
|
// already in GeometryStageVS, we just need to enable it.
|
|
@@ -363,7 +373,11 @@ function addMatrixAttributeToRenderResources(
|
|
|
363
373
|
}
|
|
364
374
|
}
|
|
365
375
|
|
|
366
|
-
function addVaryingDeclaration(
|
|
376
|
+
function addVaryingDeclaration(
|
|
377
|
+
shaderBuilder,
|
|
378
|
+
attributeInfo,
|
|
379
|
+
interpolationQualifier,
|
|
380
|
+
) {
|
|
367
381
|
const variableName = attributeInfo.variableName;
|
|
368
382
|
let varyingName = `v_${variableName}`;
|
|
369
383
|
|
|
@@ -383,7 +397,7 @@ function addVaryingDeclaration(shaderBuilder, attributeInfo) {
|
|
|
383
397
|
glslType = attributeInfo.glslType;
|
|
384
398
|
}
|
|
385
399
|
|
|
386
|
-
shaderBuilder.addVarying(glslType, varyingName);
|
|
400
|
+
shaderBuilder.addVarying(glslType, varyingName, interpolationQualifier);
|
|
387
401
|
}
|
|
388
402
|
|
|
389
403
|
function addAttributeDeclaration(shaderBuilder, attributeInfo, modifyFor2D) {
|