@cesium/engine 1.1.0 → 2.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/{AxisAlignedBoundingBox-a4321399.js → AxisAlignedBoundingBox-47525601.js} +1 -1
- package/Build/Workers/{BoundingRectangle-80d8801f.js → BoundingRectangle-93b263ac.js} +1 -1
- package/Build/Workers/{BoxGeometry-33c10a4f.js → BoxGeometry-8c4b4125.js} +1 -1
- package/Build/Workers/{Color-1bf9a6e0.js → Color-52c60ed7.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-5c5b981b.js → CoplanarPolygonGeometryLibrary-33c4c1f8.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-7cbae7a0.js → CorridorGeometryLibrary-5039cd8e.js} +1 -1
- package/Build/Workers/{CylinderGeometry-42740df0.js → CylinderGeometry-3ac44974.js} +1 -1
- package/Build/Workers/{EllipseGeometry-49a3ac21.js → EllipseGeometry-a9c9b3be.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-b891b2f8.js → EllipseGeometryLibrary-855d4681.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-fbd72e07.js → EllipseOutlineGeometry-017a5929.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-a351dba8.js → EllipsoidGeometry-826e7bce.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-3e8779bf.js → EllipsoidOutlineGeometry-784dcdb5.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-cfb50678.js → EllipsoidTangentPlane-ed9443a1.js} +1 -1
- package/Build/Workers/{FrustumGeometry-c5754412.js → FrustumGeometry-9f1ee4d8.js} +1 -1
- package/Build/Workers/{GeometryAttribute-0bfd05e8.js → GeometryAttribute-334718f8.js} +1 -1
- package/Build/Workers/{GeometryPipeline-0166905d.js → GeometryPipeline-8fb0db69.js} +1 -1
- package/Build/Workers/{IntersectionTests-a93d3de9.js → IntersectionTests-27d49265.js} +1 -1
- package/Build/Workers/{OrientedBoundingBox-b450cb61.js → OrientedBoundingBox-79ee7cbb.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-f918ac26.js → PolygonGeometryLibrary-6b5a29e9.js} +1 -1
- package/Build/Workers/{PolygonPipeline-f59a8f0a.js → PolygonPipeline-21668b3f.js} +1 -1
- package/Build/Workers/{PolylinePipeline-d8e6bd9b.js → PolylinePipeline-5e2e1b21.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-125d2edf.js → PolylineVolumeGeometryLibrary-97f0b94e.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-0d7b5ed4.js → PrimitivePipeline-5640850a.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-0768db63.js → RectangleGeometryLibrary-d5457f7b.js} +1 -1
- package/Build/Workers/{TerrainEncoding-06470d7f.js → TerrainEncoding-bfdf2021.js} +1 -1
- package/Build/Workers/{Transforms-26539bce.js → Transforms-a05e5e6e.js} +17 -0
- package/Build/Workers/{WallGeometryLibrary-6167b0fc.js → WallGeometryLibrary-6db0ebb6.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +68 -2
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +1 -1
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeDraco.js +9 -1
- package/Build/Workers/package.js +1 -1
- package/Build/Workers/transcodeKTX2.js +22 -2
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/README.md +14 -16
- package/Source/Core/FeatureDetection.js +18 -0
- package/Source/Core/Ion.js +1 -2
- package/Source/Core/PixelFormat.js +22 -2
- package/Source/Core/sampleTerrain.js +5 -0
- package/Source/Renderer/AutomaticUniforms.js +3 -3
- package/Source/Renderer/Context.js +4 -14
- package/Source/Renderer/ShaderBuilder.js +13 -12
- package/Source/Renderer/ShaderSource.js +31 -26
- package/Source/Renderer/demodernizeShader.js +76 -0
- package/Source/Scene/AutoExposure.js +5 -5
- package/Source/Scene/BatchTable.js +5 -5
- package/Source/Scene/BillboardCollection.js +2 -2
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/Cesium3DTile.js +8 -2
- package/Source/Scene/Cesium3DTileBatchTable.js +28 -28
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +12 -0
- package/Source/Scene/Cesium3DTileset.js +6 -1
- package/Source/Scene/ClassificationPrimitive.js +3 -8
- package/Source/Scene/DebugAppearance.js +7 -9
- package/Source/Scene/DebugInspector.js +5 -5
- package/Source/Scene/DepthPlane.js +0 -6
- package/Source/Scene/DerivedCommand.js +8 -22
- package/Source/Scene/EllipsoidPrimitive.js +0 -7
- package/Source/Scene/GlobeTranslucencyState.js +6 -6
- package/Source/Scene/GroundPolylinePrimitive.js +2 -4
- package/Source/Scene/InvertClassification.js +9 -10
- package/Source/Scene/Material.js +6 -6
- package/Source/Scene/Megatexture.js +2 -2
- package/Source/Scene/MetadataSemantic.js +8 -0
- package/Source/Scene/Model/CustomShader.js +1 -1
- package/Source/Scene/Model/FeatureIdPipelineStage.js +4 -4
- package/Source/Scene/Model/LightingModel.js +1 -1
- package/Source/Scene/Model/MetadataPipelineStage.js +1 -1
- package/Source/Scene/Model/PickingPipelineStage.js +1 -1
- package/Source/Scene/OIT.js +211 -119
- package/Source/Scene/PickDepth.js +2 -2
- package/Source/Scene/PointCloud.js +11 -11
- package/Source/Scene/PointCloudEyeDomeLighting.js +9 -4
- package/Source/Scene/PolylineCollection.js +2 -7
- package/Source/Scene/PolylineMaterialAppearance.js +2 -3
- package/Source/Scene/PostProcessStage.js +13 -13
- package/Source/Scene/PostProcessStageLibrary.js +3 -3
- package/Source/Scene/Primitive.js +22 -31
- package/Source/Scene/ShadowMap.js +7 -7
- package/Source/Scene/ShadowMapShader.js +9 -9
- package/Source/Scene/ShadowVolumeAppearance.js +1 -1
- package/Source/Scene/TextureAtlas.js +5 -3
- package/Source/Scene/Vector3DTilePolylines.js +1 -1
- package/Source/Scene/Vector3DTilePrimitive.js +2 -2
- package/Source/Scene/VoxelEllipsoidShape.js +15 -7
- package/Source/Scene/VoxelPrimitive.js +4 -4
- package/Source/Scene/computeFlyToLocationForRectangle.js +10 -1
- package/Source/Scene/createElevationBandMaterial.js +10 -15
- package/Source/Scene/getClipAndStyleCode.js +1 -1
- package/Source/Scene/getClippingFunction.js +3 -3
- package/Source/Scene/processVoxelProperties.js +1 -1
- package/Source/Shaders/AdjustTranslucentFS.glsl +9 -6
- package/Source/Shaders/AdjustTranslucentFS.js +9 -6
- package/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl +7 -7
- package/Source/Shaders/Appearances/AllMaterialAppearanceFS.js +7 -7
- package/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +12 -12
- package/Source/Shaders/Appearances/AllMaterialAppearanceVS.js +12 -12
- package/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl +4 -4
- package/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js +4 -4
- package/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl +6 -6
- package/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js +6 -6
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl +5 -5
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js +5 -5
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl +7 -7
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js +7 -7
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +4 -4
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js +4 -4
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +8 -8
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js +8 -8
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +2 -2
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js +2 -2
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +5 -5
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js +5 -5
- package/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +10 -10
- package/Source/Shaders/Appearances/PolylineColorAppearanceVS.js +10 -10
- package/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +12 -12
- package/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js +12 -12
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +5 -5
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js +5 -5
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl +8 -8
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js +8 -8
- package/Source/Shaders/BillboardCollectionFS.glsl +15 -15
- package/Source/Shaders/BillboardCollectionFS.js +15 -15
- package/Source/Shaders/BillboardCollectionVS.glsl +23 -23
- package/Source/Shaders/BillboardCollectionVS.js +23 -23
- package/Source/Shaders/BrdfLutGeneratorFS.glsl +2 -2
- package/Source/Shaders/BrdfLutGeneratorFS.js +2 -2
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/Builtin/Functions/depthClamp.glsl +3 -3
- package/Source/Shaders/Builtin/Functions/depthClamp.js +3 -3
- package/Source/Shaders/Builtin/Functions/getWaterNoise.glsl +4 -4
- package/Source/Shaders/Builtin/Functions/getWaterNoise.js +4 -4
- package/Source/Shaders/Builtin/Functions/phong.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/phong.js +1 -1
- package/Source/Shaders/Builtin/Functions/readDepth.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/readDepth.js +1 -1
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +5 -5
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +5 -5
- package/Source/Shaders/Builtin/Functions/shadowDepthCompare.glsl +3 -3
- package/Source/Shaders/Builtin/Functions/shadowDepthCompare.js +3 -3
- package/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js +1 -1
- package/Source/Shaders/Builtin/Functions/textureCube.glsl +17 -0
- package/Source/Shaders/Builtin/Functions/textureCube.js +18 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +2 -2
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +2 -2
- package/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl +2 -2
- package/Source/Shaders/Builtin/Functions/vertexLogDepth.js +2 -2
- package/Source/Shaders/Builtin/Functions/writeDepthClamp.glsl +5 -8
- package/Source/Shaders/Builtin/Functions/writeDepthClamp.js +5 -8
- package/Source/Shaders/Builtin/Functions/writeLogDepth.glsl +6 -6
- package/Source/Shaders/Builtin/Functions/writeLogDepth.js +6 -6
- package/Source/Shaders/CloudCollectionFS.glsl +18 -18
- package/Source/Shaders/CloudCollectionFS.js +18 -18
- package/Source/Shaders/CloudCollectionVS.glsl +11 -11
- package/Source/Shaders/CloudCollectionVS.js +11 -11
- package/Source/Shaders/CloudNoiseFS.glsl +5 -5
- package/Source/Shaders/CloudNoiseFS.js +5 -5
- package/Source/Shaders/CloudNoiseVS.glsl +2 -2
- package/Source/Shaders/CloudNoiseVS.js +2 -2
- package/Source/Shaders/CompareAndPackTranslucentDepth.glsl +4 -4
- package/Source/Shaders/CompareAndPackTranslucentDepth.js +4 -4
- package/Source/Shaders/CompositeOITFS.glsl +6 -6
- package/Source/Shaders/CompositeOITFS.js +6 -6
- package/Source/Shaders/DepthPlaneFS.glsl +2 -2
- package/Source/Shaders/DepthPlaneFS.js +2 -2
- package/Source/Shaders/DepthPlaneVS.glsl +2 -2
- package/Source/Shaders/DepthPlaneVS.js +2 -2
- package/Source/Shaders/EllipsoidFS.glsl +5 -13
- package/Source/Shaders/EllipsoidFS.js +6 -14
- package/Source/Shaders/EllipsoidVS.glsl +2 -2
- package/Source/Shaders/EllipsoidVS.js +2 -2
- package/Source/Shaders/FXAA3_11.glsl +4 -4
- package/Source/Shaders/FXAA3_11.js +4 -4
- package/Source/Shaders/GlobeFS.glsl +15 -15
- package/Source/Shaders/GlobeFS.js +15 -15
- package/Source/Shaders/GlobeVS.glsl +17 -17
- package/Source/Shaders/GlobeVS.js +17 -17
- package/Source/Shaders/Materials/AspectRampMaterial.glsl +1 -1
- package/Source/Shaders/Materials/AspectRampMaterial.js +1 -1
- package/Source/Shaders/Materials/BumpMapMaterial.glsl +3 -3
- package/Source/Shaders/Materials/BumpMapMaterial.js +3 -3
- package/Source/Shaders/Materials/ElevationBandMaterial.glsl +3 -3
- package/Source/Shaders/Materials/ElevationBandMaterial.js +3 -3
- package/Source/Shaders/Materials/ElevationContourMaterial.glsl +2 -1
- package/Source/Shaders/Materials/ElevationContourMaterial.js +2 -1
- package/Source/Shaders/Materials/ElevationRampMaterial.glsl +1 -1
- package/Source/Shaders/Materials/ElevationRampMaterial.js +1 -1
- package/Source/Shaders/Materials/GridMaterial.glsl +3 -2
- package/Source/Shaders/Materials/GridMaterial.js +3 -2
- package/Source/Shaders/Materials/NormalMapMaterial.glsl +1 -1
- package/Source/Shaders/Materials/NormalMapMaterial.js +1 -1
- package/Source/Shaders/Materials/PolylineArrowMaterial.glsl +3 -2
- package/Source/Shaders/Materials/PolylineArrowMaterial.js +3 -2
- package/Source/Shaders/Materials/PolylineDashMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineDashMaterial.js +1 -1
- package/Source/Shaders/Materials/PolylineOutlineMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineOutlineMaterial.js +1 -1
- package/Source/Shaders/Materials/SlopeRampMaterial.glsl +1 -1
- package/Source/Shaders/Materials/SlopeRampMaterial.js +1 -1
- package/Source/Shaders/Materials/Water.glsl +1 -1
- package/Source/Shaders/Materials/Water.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +3 -3
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +3 -3
- package/Source/Shaders/Model/MaterialStageFS.glsl +10 -10
- package/Source/Shaders/Model/MaterialStageFS.js +10 -10
- package/Source/Shaders/Model/ModelClippingPlanesStageFS.glsl +3 -3
- package/Source/Shaders/Model/ModelClippingPlanesStageFS.js +3 -3
- package/Source/Shaders/Model/ModelFS.glsl +1 -1
- package/Source/Shaders/Model/ModelFS.js +1 -1
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +3 -3
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +3 -3
- package/Source/Shaders/Model/SelectedFeatureIdStageCommon.glsl +1 -1
- package/Source/Shaders/Model/SelectedFeatureIdStageCommon.js +1 -1
- package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +8 -8
- package/Source/Shaders/OctahedralProjectionAtlasFS.js +8 -8
- package/Source/Shaders/OctahedralProjectionFS.glsl +4 -4
- package/Source/Shaders/OctahedralProjectionFS.js +4 -4
- package/Source/Shaders/OctahedralProjectionVS.glsl +3 -3
- package/Source/Shaders/OctahedralProjectionVS.js +3 -3
- package/Source/Shaders/PointPrimitiveCollectionFS.glsl +6 -6
- package/Source/Shaders/PointPrimitiveCollectionFS.js +6 -6
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +12 -12
- package/Source/Shaders/PointPrimitiveCollectionVS.js +12 -12
- package/Source/Shaders/PolylineFS.glsl +3 -3
- package/Source/Shaders/PolylineFS.js +3 -3
- package/Source/Shaders/PolylineShadowVolumeFS.glsl +12 -16
- package/Source/Shaders/PolylineShadowVolumeFS.js +12 -16
- package/Source/Shaders/PolylineShadowVolumeMorphFS.glsl +8 -8
- package/Source/Shaders/PolylineShadowVolumeMorphFS.js +8 -8
- package/Source/Shaders/PolylineShadowVolumeMorphVS.glsl +20 -20
- package/Source/Shaders/PolylineShadowVolumeMorphVS.js +20 -20
- package/Source/Shaders/PolylineShadowVolumeVS.glsl +20 -20
- package/Source/Shaders/PolylineShadowVolumeVS.js +20 -20
- package/Source/Shaders/PolylineVS.glsl +17 -17
- package/Source/Shaders/PolylineVS.js +17 -17
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +4 -4
- package/Source/Shaders/PostProcessStages/AdditiveBlend.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AdditiveBlend.js +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +4 -4
- package/Source/Shaders/PostProcessStages/BlackAndWhite.glsl +4 -4
- package/Source/Shaders/PostProcessStages/BlackAndWhite.js +4 -4
- package/Source/Shaders/PostProcessStages/BloomComposite.glsl +5 -5
- package/Source/Shaders/PostProcessStages/BloomComposite.js +5 -5
- package/Source/Shaders/PostProcessStages/BrightPass.glsl +3 -3
- package/Source/Shaders/PostProcessStages/BrightPass.js +3 -3
- package/Source/Shaders/PostProcessStages/Brightness.glsl +3 -3
- package/Source/Shaders/PostProcessStages/Brightness.js +3 -3
- package/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.glsl +5 -5
- package/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.js +5 -5
- package/Source/Shaders/PostProcessStages/ContrastBias.glsl +3 -3
- package/Source/Shaders/PostProcessStages/ContrastBias.js +3 -3
- package/Source/Shaders/PostProcessStages/DepthOfField.glsl +2 -2
- package/Source/Shaders/PostProcessStages/DepthOfField.js +2 -2
- package/Source/Shaders/PostProcessStages/DepthView.glsl +2 -2
- package/Source/Shaders/PostProcessStages/DepthView.js +2 -2
- package/Source/Shaders/PostProcessStages/DepthViewPacked.glsl +3 -3
- package/Source/Shaders/PostProcessStages/DepthViewPacked.js +3 -3
- package/Source/Shaders/PostProcessStages/EdgeDetection.glsl +7 -7
- package/Source/Shaders/PostProcessStages/EdgeDetection.js +7 -7
- package/Source/Shaders/PostProcessStages/FXAA.glsl +3 -3
- package/Source/Shaders/PostProcessStages/FXAA.js +3 -3
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +4 -4
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +4 -4
- package/Source/Shaders/PostProcessStages/GaussianBlur1D.glsl +5 -5
- package/Source/Shaders/PostProcessStages/GaussianBlur1D.js +5 -5
- package/Source/Shaders/PostProcessStages/LensFlare.glsl +13 -13
- package/Source/Shaders/PostProcessStages/LensFlare.js +13 -13
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +4 -4
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +4 -4
- package/Source/Shaders/PostProcessStages/NightVision.glsl +3 -3
- package/Source/Shaders/PostProcessStages/NightVision.js +3 -3
- package/Source/Shaders/PostProcessStages/PassThrough.glsl +2 -2
- package/Source/Shaders/PostProcessStages/PassThrough.js +2 -2
- package/Source/Shaders/PostProcessStages/PassThroughDepth.glsl +2 -2
- package/Source/Shaders/PostProcessStages/PassThroughDepth.js +2 -2
- package/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.glsl +7 -9
- package/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.js +8 -10
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +4 -4
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +4 -4
- package/Source/Shaders/PostProcessStages/Silhouette.glsl +4 -4
- package/Source/Shaders/PostProcessStages/Silhouette.js +4 -4
- package/Source/Shaders/ReprojectWebMercatorFS.glsl +2 -2
- package/Source/Shaders/ReprojectWebMercatorFS.js +2 -2
- package/Source/Shaders/ReprojectWebMercatorVS.glsl +3 -3
- package/Source/Shaders/ReprojectWebMercatorVS.js +3 -3
- package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +19 -23
- package/Source/Shaders/ShadowVolumeAppearanceFS.js +20 -24
- package/Source/Shaders/ShadowVolumeAppearanceVS.glsl +12 -12
- package/Source/Shaders/ShadowVolumeAppearanceVS.js +12 -12
- package/Source/Shaders/ShadowVolumeFS.glsl +2 -6
- package/Source/Shaders/ShadowVolumeFS.js +3 -7
- package/Source/Shaders/SkyAtmosphereFS.glsl +6 -6
- package/Source/Shaders/SkyAtmosphereFS.js +6 -6
- package/Source/Shaders/SkyAtmosphereVS.glsl +6 -6
- package/Source/Shaders/SkyAtmosphereVS.js +6 -6
- package/Source/Shaders/SkyBoxFS.glsl +3 -3
- package/Source/Shaders/SkyBoxFS.js +3 -3
- package/Source/Shaders/SkyBoxVS.glsl +2 -2
- package/Source/Shaders/SkyBoxVS.js +2 -2
- package/Source/Shaders/SunFS.glsl +3 -3
- package/Source/Shaders/SunFS.js +3 -3
- package/Source/Shaders/SunTextureFS.glsl +2 -2
- package/Source/Shaders/SunTextureFS.js +2 -2
- package/Source/Shaders/SunVS.glsl +2 -2
- package/Source/Shaders/SunVS.js +2 -2
- package/Source/Shaders/Vector3DTileClampedPolylinesFS.glsl +9 -13
- package/Source/Shaders/Vector3DTileClampedPolylinesFS.js +9 -13
- package/Source/Shaders/Vector3DTileClampedPolylinesVS.glsl +12 -12
- package/Source/Shaders/Vector3DTileClampedPolylinesVS.js +12 -12
- package/Source/Shaders/Vector3DTilePolylinesVS.glsl +5 -5
- package/Source/Shaders/Vector3DTilePolylinesVS.js +5 -5
- package/Source/Shaders/VectorTileVS.glsl +2 -2
- package/Source/Shaders/VectorTileVS.js +2 -2
- package/Source/Shaders/ViewportQuadFS.glsl +2 -2
- package/Source/Shaders/ViewportQuadFS.js +2 -2
- package/Source/Shaders/ViewportQuadVS.glsl +3 -3
- package/Source/Shaders/ViewportQuadVS.js +3 -3
- package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectDepth.js +1 -1
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -2
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -2
- package/Source/Shaders/Voxels/Megatexture.glsl +1 -1
- package/Source/Shaders/Voxels/Megatexture.js +1 -1
- package/Source/Shaders/Voxels/Octree.glsl +4 -4
- package/Source/Shaders/Voxels/Octree.js +4 -4
- package/Source/Shaders/Voxels/VoxelFS.glsl +2 -2
- package/Source/Shaders/Voxels/VoxelFS.js +2 -2
- package/Source/Shaders/Voxels/VoxelVS.glsl +1 -1
- package/Source/Shaders/Voxels/VoxelVS.js +1 -1
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +5 -9
- package/Source/Shaders/Voxels/convertUvToCylinder.js +5 -9
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +3 -6
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +3 -6
- package/Source/WorkersES6/decodeDraco.js +9 -1
- package/index.d.ts +26 -12
- package/index.js +53 -52
- package/package.json +1 -1
- package/Source/Renderer/modernizeShader.js +0 -242
|
@@ -43,18 +43,9 @@ function Context(canvas, options) {
|
|
|
43
43
|
Check.defined("canvas", canvas);
|
|
44
44
|
//>>includeEnd('debug');
|
|
45
45
|
|
|
46
|
-
let requestWebgl2 = false;
|
|
47
|
-
if (defined(options) && defined(options.requestWebgl2)) {
|
|
48
|
-
requestWebgl2 = options.requestWebgl2;
|
|
49
|
-
Context._deprecationWarning(
|
|
50
|
-
"ContextOptions.requestWebgl2",
|
|
51
|
-
"Cesium.requestWebgl2 was deprecated in CesiumJS 1.101 and will be removed in 1.102. Use Cesium.requestWebgl1 to request a WebGL1 or WebGL2 context."
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
46
|
const {
|
|
56
47
|
getWebGLStub,
|
|
57
|
-
requestWebgl1
|
|
48
|
+
requestWebgl1,
|
|
58
49
|
webgl: webglOptions = {},
|
|
59
50
|
allowTextureFilterAnisotropic = true,
|
|
60
51
|
} = defaultValue(options, {});
|
|
@@ -72,9 +63,8 @@ function Context(canvas, options) {
|
|
|
72
63
|
: getWebGLContext(canvas, webglOptions, requestWebgl1);
|
|
73
64
|
|
|
74
65
|
// Get context type. instanceof will throw if WebGL2 is not supported
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
glContext instanceof WebGL2RenderingContext;
|
|
66
|
+
const webgl2Supported = typeof WebGL2RenderingContext !== "undefined";
|
|
67
|
+
const webgl2 = webgl2Supported && glContext instanceof WebGL2RenderingContext;
|
|
78
68
|
|
|
79
69
|
this._canvas = canvas;
|
|
80
70
|
this._originalGLContext = glContext;
|
|
@@ -407,7 +397,7 @@ function Context(canvas, options) {
|
|
|
407
397
|
* especially for horizon views.
|
|
408
398
|
* </p>
|
|
409
399
|
*
|
|
410
|
-
* @property {Boolean} [
|
|
400
|
+
* @property {Boolean} [requestWebGl1=false] If true and the browser supports it, use a WebGL 1 rendering context
|
|
411
401
|
* @property {Boolean} [allowTextureFilterAnisotropic=true] If true, use anisotropic filtering during texture sampling
|
|
412
402
|
* @property {WebGLOptions} [webgl] WebGL options to be passed on to canvas.getContext
|
|
413
403
|
* @property {Function} [getWebGLStub] A function to create a WebGL stub for testing
|
|
@@ -43,9 +43,9 @@ import ShaderFunction from "./ShaderFunction.js";
|
|
|
43
43
|
* "void main()",
|
|
44
44
|
* "{",
|
|
45
45
|
* " #ifdef SOLID_COLOR",
|
|
46
|
-
* "
|
|
46
|
+
* " out_FragColor = vec4(u_color, 1.0);",
|
|
47
47
|
* " #else",
|
|
48
|
-
* "
|
|
48
|
+
* " out_FragColor = vec4(v_color, 1.0);",
|
|
49
49
|
* " #endif",
|
|
50
50
|
* "}"
|
|
51
51
|
* ]);
|
|
@@ -307,7 +307,7 @@ ShaderBuilder.prototype.addUniform = function (type, identifier, destination) {
|
|
|
307
307
|
* @return {Number} The integer location of the attribute. This location can be used when creating attributes for a {@link VertexArray}. This will always be 0.
|
|
308
308
|
*
|
|
309
309
|
* @example
|
|
310
|
-
* // creates the line "
|
|
310
|
+
* // creates the line "in vec3 a_position;"
|
|
311
311
|
* shaderBuilder.setPositionAttribute("vec3", "a_position");
|
|
312
312
|
*/
|
|
313
313
|
ShaderBuilder.prototype.setPositionAttribute = function (type, identifier) {
|
|
@@ -322,7 +322,7 @@ ShaderBuilder.prototype.setPositionAttribute = function (type, identifier) {
|
|
|
322
322
|
}
|
|
323
323
|
//>>includeEnd('debug');
|
|
324
324
|
|
|
325
|
-
this._positionAttributeLine = `
|
|
325
|
+
this._positionAttributeLine = `in ${type} ${identifier};`;
|
|
326
326
|
|
|
327
327
|
// Some WebGL implementations require attribute 0 to always be active, so
|
|
328
328
|
// this builder assumes the position will always go in location 0
|
|
@@ -343,7 +343,7 @@ ShaderBuilder.prototype.setPositionAttribute = function (type, identifier) {
|
|
|
343
343
|
* @return {Number} The integer location of the attribute. This location can be used when creating attributes for a {@link VertexArray}
|
|
344
344
|
*
|
|
345
345
|
* @example
|
|
346
|
-
* // creates the line "
|
|
346
|
+
* // creates the line "in vec2 a_texCoord0;" in the vertex shader
|
|
347
347
|
* shaderBuilder.addAttribute("vec2", "a_texCoord0");
|
|
348
348
|
*/
|
|
349
349
|
ShaderBuilder.prototype.addAttribute = function (type, identifier) {
|
|
@@ -352,7 +352,7 @@ ShaderBuilder.prototype.addAttribute = function (type, identifier) {
|
|
|
352
352
|
Check.typeOf.string("identifier", identifier);
|
|
353
353
|
//>>includeEnd('debug');
|
|
354
354
|
|
|
355
|
-
const line = `
|
|
355
|
+
const line = `in ${type} ${identifier};`;
|
|
356
356
|
this._attributeLines.push(line);
|
|
357
357
|
|
|
358
358
|
const location = this._nextAttributeLocation;
|
|
@@ -371,7 +371,8 @@ ShaderBuilder.prototype.addAttribute = function (type, identifier) {
|
|
|
371
371
|
* @param {String} identifier An identifier for the varying. Identifiers must begin with <code>v_</code> to be consistent with Cesium's style guide.
|
|
372
372
|
*
|
|
373
373
|
* @example
|
|
374
|
-
* // creates the line "
|
|
374
|
+
* // creates the line "in vec3 v_color;" in the vertex shader
|
|
375
|
+
* // creates the line "out vec3 v_color;" in the fragment shader
|
|
375
376
|
* shaderBuilder.addVarying("vec3", "v_color");
|
|
376
377
|
*/
|
|
377
378
|
ShaderBuilder.prototype.addVarying = function (type, identifier) {
|
|
@@ -380,9 +381,9 @@ ShaderBuilder.prototype.addVarying = function (type, identifier) {
|
|
|
380
381
|
Check.typeOf.string("identifier", identifier);
|
|
381
382
|
//>>includeEnd('debug');
|
|
382
383
|
|
|
383
|
-
const line =
|
|
384
|
-
this._vertexShaderParts.varyingLines.push(line);
|
|
385
|
-
this._fragmentShaderParts.varyingLines.push(line);
|
|
384
|
+
const line = `${type} ${identifier};`;
|
|
385
|
+
this._vertexShaderParts.varyingLines.push(`out ${line}`);
|
|
386
|
+
this._fragmentShaderParts.varyingLines.push(`in ${line}`);
|
|
386
387
|
};
|
|
387
388
|
|
|
388
389
|
/**
|
|
@@ -427,9 +428,9 @@ ShaderBuilder.prototype.addVertexLines = function (lines) {
|
|
|
427
428
|
* "void main()",
|
|
428
429
|
* "{",
|
|
429
430
|
* " #ifdef SOLID_COLOR",
|
|
430
|
-
* "
|
|
431
|
+
* " out_FragColor = vec4(u_color, 1.0);",
|
|
431
432
|
* " #else",
|
|
432
|
-
* "
|
|
433
|
+
* " out_FragColor = vec4(v_color, 1.0);",
|
|
433
434
|
* " #endif",
|
|
434
435
|
* "}"
|
|
435
436
|
* ]);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import defaultValue from "../Core/defaultValue.js";
|
|
2
2
|
import defined from "../Core/defined.js";
|
|
3
3
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
4
|
-
import modernizeShader from "../Renderer/modernizeShader.js";
|
|
5
4
|
import CzmBuiltins from "../Shaders/Builtin/CzmBuiltins.js";
|
|
6
5
|
import AutomaticUniforms from "./AutomaticUniforms.js";
|
|
6
|
+
import demodernizeShader from "./demodernizeShader.js";
|
|
7
7
|
|
|
8
8
|
function removeComments(source) {
|
|
9
9
|
// remove inline comments
|
|
@@ -223,12 +223,6 @@ function combineShader(shaderSource, isFragmentShader, context) {
|
|
|
223
223
|
// combine into single string
|
|
224
224
|
let result = "";
|
|
225
225
|
|
|
226
|
-
// #version must be first
|
|
227
|
-
// defaults to #version 100 if not specified
|
|
228
|
-
if (defined(version)) {
|
|
229
|
-
result = `#version ${version}\n`;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
226
|
const extensionsLength = extensions.length;
|
|
233
227
|
for (i = 0; i < extensionsLength; i++) {
|
|
234
228
|
result += extensions[i];
|
|
@@ -261,12 +255,6 @@ function combineShader(shaderSource, isFragmentShader, context) {
|
|
|
261
255
|
}
|
|
262
256
|
}
|
|
263
257
|
|
|
264
|
-
// GLSLModernizer inserts its own layout qualifiers
|
|
265
|
-
// at this position in the source
|
|
266
|
-
if (context.webgl2) {
|
|
267
|
-
result += "#define OUTPUT_DECLARATION\n\n";
|
|
268
|
-
}
|
|
269
|
-
|
|
270
258
|
// Define a constant for the OES_texture_float_linear extension since WebGL does not.
|
|
271
259
|
if (context.textureFloatLinear) {
|
|
272
260
|
result += "#define OES_texture_float_linear\n\n";
|
|
@@ -278,19 +266,36 @@ function combineShader(shaderSource, isFragmentShader, context) {
|
|
|
278
266
|
}
|
|
279
267
|
|
|
280
268
|
// append built-ins
|
|
269
|
+
let builtinSources = "";
|
|
281
270
|
if (shaderSource.includeBuiltIns) {
|
|
282
|
-
|
|
271
|
+
builtinSources = getBuiltinsAndAutomaticUniforms(combinedSources);
|
|
283
272
|
}
|
|
284
273
|
|
|
285
274
|
// reset line number
|
|
286
275
|
result += "\n#line 0\n";
|
|
287
276
|
|
|
288
277
|
// append actual source
|
|
278
|
+
const combinedShader = builtinSources + combinedSources;
|
|
279
|
+
if (
|
|
280
|
+
context.webgl2 &&
|
|
281
|
+
isFragmentShader &&
|
|
282
|
+
!/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g.test(
|
|
283
|
+
combinedShader
|
|
284
|
+
) &&
|
|
285
|
+
!/czm_out_FragColor/g.test(combinedShader) &&
|
|
286
|
+
/out_FragColor/g.test(combinedShader)
|
|
287
|
+
) {
|
|
288
|
+
result += "layout(location = 0) out vec4 out_FragColor;\n\n";
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
result += builtinSources;
|
|
289
292
|
result += combinedSources;
|
|
290
293
|
|
|
291
294
|
// modernize the source
|
|
292
|
-
if (context.webgl2) {
|
|
293
|
-
result =
|
|
295
|
+
if (!context.webgl2) {
|
|
296
|
+
result = demodernizeShader(result, isFragmentShader);
|
|
297
|
+
} else {
|
|
298
|
+
result = `#version 300 es\n${result}`;
|
|
294
299
|
}
|
|
295
300
|
|
|
296
301
|
return result;
|
|
@@ -302,21 +307,21 @@ function combineShader(shaderSource, isFragmentShader, context) {
|
|
|
302
307
|
* @param {Object} [options] Object with the following properties:
|
|
303
308
|
* @param {String[]} [options.sources] An array of strings to combine containing GLSL code for the shader.
|
|
304
309
|
* @param {String[]} [options.defines] An array of strings containing GLSL identifiers to <code>#define</code>.
|
|
305
|
-
* @param {String} [options.pickColorQualifier] The GLSL qualifier, <code>uniform</code> or <code>
|
|
310
|
+
* @param {String} [options.pickColorQualifier] The GLSL qualifier, <code>uniform</code> or <code>in</code>, for the input <code>czm_pickColor</code>. When defined, a pick fragment shader is generated.
|
|
306
311
|
* @param {Boolean} [options.includeBuiltIns=true] If true, referenced built-in functions will be included with the combined shader. Set to false if this shader will become a source in another shader, to avoid duplicating functions.
|
|
307
312
|
*
|
|
308
|
-
* @exception {DeveloperError} options.pickColorQualifier must be 'uniform' or '
|
|
313
|
+
* @exception {DeveloperError} options.pickColorQualifier must be 'uniform' or 'in'.
|
|
309
314
|
*
|
|
310
315
|
* @example
|
|
311
316
|
* // 1. Prepend #defines to a shader
|
|
312
317
|
* const source = new Cesium.ShaderSource({
|
|
313
318
|
* defines : ['WHITE'],
|
|
314
|
-
* sources : ['void main() { \n#ifdef WHITE\n
|
|
319
|
+
* sources : ['void main() { \n#ifdef WHITE\n out_FragColor = vec4(1.0); \n#else\n out_FragColor = vec4(0.0); \n#endif\n }']
|
|
315
320
|
* });
|
|
316
321
|
*
|
|
317
322
|
* // 2. Modify a fragment shader for picking
|
|
318
323
|
* const source2 = new Cesium.ShaderSource({
|
|
319
|
-
* sources : ['void main() {
|
|
324
|
+
* sources : ['void main() { out_FragColor = vec4(1.0); }'],
|
|
320
325
|
* pickColorQualifier : 'uniform'
|
|
321
326
|
* });
|
|
322
327
|
*
|
|
@@ -330,10 +335,10 @@ function ShaderSource(options) {
|
|
|
330
335
|
if (
|
|
331
336
|
defined(pickColorQualifier) &&
|
|
332
337
|
pickColorQualifier !== "uniform" &&
|
|
333
|
-
pickColorQualifier !== "
|
|
338
|
+
pickColorQualifier !== "in"
|
|
334
339
|
) {
|
|
335
340
|
throw new DeveloperError(
|
|
336
|
-
"options.pickColorQualifier must be 'uniform' or '
|
|
341
|
+
"options.pickColorQualifier must be 'uniform' or 'in'."
|
|
337
342
|
);
|
|
338
343
|
}
|
|
339
344
|
//>>includeEnd('debug');
|
|
@@ -430,8 +435,8 @@ ShaderSource.createPickVertexShaderSource = function (vertexShaderSource) {
|
|
|
430
435
|
"czm_old_main"
|
|
431
436
|
);
|
|
432
437
|
const pickMain =
|
|
433
|
-
"
|
|
434
|
-
"
|
|
438
|
+
"in vec4 pickColor; \n" +
|
|
439
|
+
"out vec4 czm_pickColor; \n" +
|
|
435
440
|
"void main() \n" +
|
|
436
441
|
"{ \n" +
|
|
437
442
|
" czm_old_main(); \n" +
|
|
@@ -454,10 +459,10 @@ ShaderSource.createPickFragmentShaderSource = function (
|
|
|
454
459
|
`void main() \n` +
|
|
455
460
|
`{ \n` +
|
|
456
461
|
` czm_old_main(); \n` +
|
|
457
|
-
` if (
|
|
462
|
+
` if (out_FragColor.a == 0.0) { \n` +
|
|
458
463
|
` discard; \n` +
|
|
459
464
|
` } \n` +
|
|
460
|
-
`
|
|
465
|
+
` out_FragColor = czm_pickColor; \n` +
|
|
461
466
|
`}`;
|
|
462
467
|
|
|
463
468
|
return `${renamedFS}\n${pickMain}`;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transpiles a [GLSL 3.00]{@link https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf}
|
|
3
|
+
* shader to a [GLSL 1.00]{@link https://registry.khronos.org/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf} shader.
|
|
4
|
+
*
|
|
5
|
+
* This function does not aim to provide a comprehensive transpilation from GLSL 3.00 to GLSL 1.00; only the functionality
|
|
6
|
+
* used within the CesiumJS shaders is supported.
|
|
7
|
+
*
|
|
8
|
+
* @private
|
|
9
|
+
*
|
|
10
|
+
* @param {string} input The GLSL 3.00 shader.
|
|
11
|
+
* @param {boolean} isFragmentShader True if the shader is a fragment shader.
|
|
12
|
+
*
|
|
13
|
+
* @return {string}
|
|
14
|
+
*/
|
|
15
|
+
function demodernizeShader(input, isFragmentShader) {
|
|
16
|
+
let output = input;
|
|
17
|
+
|
|
18
|
+
// Remove version string got GLSL 3.00.
|
|
19
|
+
output = output.replaceAll(`version 300 es`, ``);
|
|
20
|
+
|
|
21
|
+
// Replace all texture calls with texture2D
|
|
22
|
+
output = output.replaceAll(
|
|
23
|
+
/(texture\()/g,
|
|
24
|
+
`texture2D(` // Trailing ')' is included in the match group.
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (isFragmentShader) {
|
|
28
|
+
// Replace the in with varying.
|
|
29
|
+
output = output.replaceAll(/(in)\s+(vec\d|mat\d|float)/g, `varying $2`);
|
|
30
|
+
|
|
31
|
+
if (/out_FragData_(\d+)/.test(output)) {
|
|
32
|
+
output = `#extension GL_EXT_draw_buffers : enable\n${output}`;
|
|
33
|
+
|
|
34
|
+
// Remove all layout declarations for out_FragData.
|
|
35
|
+
output = output.replaceAll(
|
|
36
|
+
/layout\s+\(location\s*=\s*\d+\)\s*out\s+vec4\s+out_FragData_\d+;/g,
|
|
37
|
+
``
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Replace out_FragData with gl_FragData.
|
|
41
|
+
output = output.replaceAll(/out_FragData_(\d+)/g, `gl_FragData[$1]`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Replace out_FragColor with gl_FragColor.
|
|
45
|
+
output = output.replaceAll(/out_FragColor/g, `gl_FragColor`);
|
|
46
|
+
output = output.replaceAll(/out_FragColor\[(\d+)\]/g, `gl_FragColor[$1]`);
|
|
47
|
+
|
|
48
|
+
// Remove all layout declarations for out_FragColor.
|
|
49
|
+
output = output.replaceAll(
|
|
50
|
+
/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor/g,
|
|
51
|
+
``
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (/gl_FragDepth/.test(output)) {
|
|
55
|
+
output = `#extension GL_EXT_frag_depth : enable\n${output}`;
|
|
56
|
+
// Replace gl_FragDepth with gl_FragDepthEXT.
|
|
57
|
+
output = output.replaceAll(/gl_FragDepth/g, `gl_FragDepthEXT`);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
// Replace the in with attribute.
|
|
61
|
+
output = output.replaceAll(/(in)\s+(vec\d|mat\d|float)/g, `attribute $2`);
|
|
62
|
+
|
|
63
|
+
// Replace the out with varying.
|
|
64
|
+
output = output.replaceAll(
|
|
65
|
+
/(out)\s+(vec\d|mat\d|float)\s+([\w]+);/g,
|
|
66
|
+
`varying $2 $3;`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Add version string for GLSL 1.00.
|
|
71
|
+
output = `#version 100\n${output}`;
|
|
72
|
+
|
|
73
|
+
return output;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default demodernizeShader;
|
|
@@ -203,16 +203,16 @@ function createUniformMap(autoexposure, index) {
|
|
|
203
203
|
function getShaderSource(index, length) {
|
|
204
204
|
let source =
|
|
205
205
|
"uniform sampler2D colorTexture; \n" +
|
|
206
|
-
"
|
|
206
|
+
"in vec2 v_textureCoordinates; \n" +
|
|
207
207
|
"float sampleTexture(vec2 offset) { \n";
|
|
208
208
|
|
|
209
209
|
if (index === 0) {
|
|
210
210
|
source +=
|
|
211
|
-
" vec4 color =
|
|
211
|
+
" vec4 color = texture(colorTexture, v_textureCoordinates + offset); \n" +
|
|
212
212
|
" return czm_luminance(color.rgb); \n";
|
|
213
213
|
} else {
|
|
214
214
|
source +=
|
|
215
|
-
" return
|
|
215
|
+
" return texture(colorTexture, v_textureCoordinates + offset).r; \n";
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
source += "}\n\n";
|
|
@@ -244,13 +244,13 @@ function getShaderSource(index, length) {
|
|
|
244
244
|
|
|
245
245
|
if (index === length - 1) {
|
|
246
246
|
source +=
|
|
247
|
-
" float previous =
|
|
247
|
+
" float previous = texture(previousLuminance, vec2(0.5)).r; \n" +
|
|
248
248
|
" color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n" +
|
|
249
249
|
" color = previous + (color - previous) / (60.0 * 1.5); \n" +
|
|
250
250
|
" color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n";
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
source += "
|
|
253
|
+
source += " out_FragColor = vec4(color); \n" + "} \n";
|
|
254
254
|
return source;
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -530,12 +530,12 @@ function getGlslAttributeFunction(batchTable, attributeIndex) {
|
|
|
530
530
|
) {
|
|
531
531
|
glslFunction +=
|
|
532
532
|
"vec4 textureValue; \n" +
|
|
533
|
-
"textureValue.x = czm_unpackFloat(
|
|
534
|
-
"textureValue.y = czm_unpackFloat(
|
|
535
|
-
"textureValue.z = czm_unpackFloat(
|
|
536
|
-
"textureValue.w = czm_unpackFloat(
|
|
533
|
+
"textureValue.x = czm_unpackFloat(texture(batchTexture, st)); \n" +
|
|
534
|
+
"textureValue.y = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \n" +
|
|
535
|
+
"textureValue.z = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \n" +
|
|
536
|
+
"textureValue.w = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n";
|
|
537
537
|
} else {
|
|
538
|
-
glslFunction += " vec4 textureValue =
|
|
538
|
+
glslFunction += " vec4 textureValue = texture(batchTexture, st); \n";
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
glslFunction += ` ${functionReturnType} value = textureValue${functionReturnValue}; \n`;
|
|
@@ -1789,10 +1789,10 @@ function updateBoundingVolume(collection, frameState, boundingVolume) {
|
|
|
1789
1789
|
function createDebugCommand(billboardCollection, context) {
|
|
1790
1790
|
const fs =
|
|
1791
1791
|
"uniform sampler2D billboard_texture; \n" +
|
|
1792
|
-
"
|
|
1792
|
+
"in vec2 v_textureCoordinates; \n" +
|
|
1793
1793
|
"void main() \n" +
|
|
1794
1794
|
"{ \n" +
|
|
1795
|
-
"
|
|
1795
|
+
" out_FragColor = texture(billboard_texture, v_textureCoordinates); \n" +
|
|
1796
1796
|
"} \n";
|
|
1797
1797
|
|
|
1798
1798
|
const drawCommand = context.createViewportQuadCommand(fs, {
|
|
@@ -177,7 +177,7 @@ function BingMapsImageryProvider(options) {
|
|
|
177
177
|
|
|
178
178
|
this._proxy = options.proxy;
|
|
179
179
|
this._credit = new Credit(
|
|
180
|
-
`<a href="
|
|
180
|
+
`<a href="https://www.microsoft.com/en-us/maps/product/enduserterms"><img src="${BingMapsImageryProvider.logoUrl}" title="Bing Imagery"/></a>`
|
|
181
181
|
);
|
|
182
182
|
|
|
183
183
|
this._tilingScheme = new WebMercatorTilingScheme({
|
|
@@ -146,7 +146,7 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
|
|
|
146
146
|
|
|
147
147
|
if (!defined(this._geometricError)) {
|
|
148
148
|
this._geometricError = defined(parent)
|
|
149
|
-
? parent.
|
|
149
|
+
? parent._geometricError
|
|
150
150
|
: tileset._geometricError;
|
|
151
151
|
Cesium3DTile._deprecationWarning(
|
|
152
152
|
"geometricErrorUndefined",
|
|
@@ -874,7 +874,7 @@ Cesium3DTile.prototype.getScreenSpaceError = function (
|
|
|
874
874
|
const heightFraction = defaultValue(progressiveResolutionHeightFraction, 1.0);
|
|
875
875
|
const parentGeometricError = defined(this.parent)
|
|
876
876
|
? this.parent.geometricError
|
|
877
|
-
: tileset.
|
|
877
|
+
: tileset._scaledGeometricError;
|
|
878
878
|
const geometricError = useParentGeometricError
|
|
879
879
|
? parentGeometricError
|
|
880
880
|
: this.geometricError;
|
|
@@ -1791,6 +1791,12 @@ Cesium3DTile.prototype.updateGeometricErrorScale = function () {
|
|
|
1791
1791
|
const scale = Matrix4.getScale(this.computedTransform, scratchScale);
|
|
1792
1792
|
const uniformScale = Cartesian3.maximumComponent(scale);
|
|
1793
1793
|
this.geometricError = this._geometricError * uniformScale;
|
|
1794
|
+
|
|
1795
|
+
if (!defined(this.parent)) {
|
|
1796
|
+
// Update the tileset's geometric error
|
|
1797
|
+
const tileset = this._tileset;
|
|
1798
|
+
tileset._scaledGeometricError = tileset._geometricError * uniformScale;
|
|
1799
|
+
}
|
|
1794
1800
|
};
|
|
1795
1801
|
|
|
1796
1802
|
function applyDebugSettings(tile, tileset, frameState, passOptions) {
|
|
@@ -517,13 +517,13 @@ Cesium3DTileBatchTable.prototype.getVertexShaderCallback = function (
|
|
|
517
517
|
newMain +=
|
|
518
518
|
`${
|
|
519
519
|
"uniform sampler2D tile_batchTexture; \n" +
|
|
520
|
-
"
|
|
521
|
-
"
|
|
520
|
+
"out vec4 tile_featureColor; \n" +
|
|
521
|
+
"out vec2 tile_featureSt; \n" +
|
|
522
522
|
"void main() \n" +
|
|
523
523
|
"{ \n" +
|
|
524
524
|
" vec2 st = computeSt("
|
|
525
525
|
}${batchIdAttributeName}); \n` +
|
|
526
|
-
` vec4 featureProperties =
|
|
526
|
+
` vec4 featureProperties = texture(tile_batchTexture, st); \n` +
|
|
527
527
|
` tile_color(featureProperties); \n` +
|
|
528
528
|
` float show = ceil(featureProperties.a); \n` + // 0 - false, non-zero - true
|
|
529
529
|
` gl_Position *= show; \n`; // Per-feature show/hide
|
|
@@ -553,7 +553,7 @@ Cesium3DTileBatchTable.prototype.getVertexShaderCallback = function (
|
|
|
553
553
|
// When VTF is not supported, color blend mode MIX will look incorrect due to the feature's color not being available in the vertex shader
|
|
554
554
|
newMain =
|
|
555
555
|
`${
|
|
556
|
-
"
|
|
556
|
+
"out vec2 tile_featureSt; \n" +
|
|
557
557
|
"void main() \n" +
|
|
558
558
|
"{ \n" +
|
|
559
559
|
" tile_color(vec4(1.0)); \n" +
|
|
@@ -578,22 +578,22 @@ function getDefaultShader(source, applyHighlight) {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
// The color blend mode is intended for the RGB channels so alpha is always just multiplied.
|
|
581
|
-
//
|
|
581
|
+
// out_FragColor is multiplied by the tile color only when tile_colorBlend is 0.0 (highlight)
|
|
582
582
|
return (
|
|
583
583
|
`${source}uniform float tile_colorBlend; \n` +
|
|
584
584
|
`void tile_color(vec4 tile_featureColor) \n` +
|
|
585
585
|
`{ \n` +
|
|
586
586
|
` tile_main(); \n` +
|
|
587
587
|
` tile_featureColor = czm_gammaCorrect(tile_featureColor); \n` +
|
|
588
|
-
`
|
|
588
|
+
` out_FragColor.a *= tile_featureColor.a; \n` +
|
|
589
589
|
` float highlight = ceil(tile_colorBlend); \n` +
|
|
590
|
-
`
|
|
590
|
+
` out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n` +
|
|
591
591
|
`} \n`
|
|
592
592
|
);
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
function replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName) {
|
|
596
|
-
const functionCall = `
|
|
596
|
+
const functionCall = `texture(${diffuseAttributeOrUniformName}`;
|
|
597
597
|
|
|
598
598
|
let fromIndex = 0;
|
|
599
599
|
let startIndex = source.indexOf(functionCall, fromIndex);
|
|
@@ -668,12 +668,12 @@ function modifyDiffuse(source, diffuseAttributeOrUniformName, applyHighlight) {
|
|
|
668
668
|
"} \n";
|
|
669
669
|
|
|
670
670
|
// The color blend mode is intended for the RGB channels so alpha is always just multiplied.
|
|
671
|
-
//
|
|
671
|
+
// out_FragColor is multiplied by the tile color only when tile_colorBlend is 0.0 (highlight)
|
|
672
672
|
const highlight =
|
|
673
673
|
" tile_featureColor = czm_gammaCorrect(tile_featureColor); \n" +
|
|
674
|
-
"
|
|
674
|
+
" out_FragColor.a *= tile_featureColor.a; \n" +
|
|
675
675
|
" float highlight = ceil(tile_colorBlend); \n" +
|
|
676
|
-
"
|
|
676
|
+
" out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n";
|
|
677
677
|
|
|
678
678
|
let setColor;
|
|
679
679
|
if (type === "vec3" || type === "vec4") {
|
|
@@ -691,8 +691,8 @@ function modifyDiffuse(source, diffuseAttributeOrUniformName, applyHighlight) {
|
|
|
691
691
|
` tile_main(); \n`;
|
|
692
692
|
} else if (type === "sampler2D") {
|
|
693
693
|
// Handles any number of nested parentheses
|
|
694
|
-
// E.g.
|
|
695
|
-
// E.g.
|
|
694
|
+
// E.g. texture(u_diffuse, uv)
|
|
695
|
+
// E.g. texture(u_diffuse, computeUV(index))
|
|
696
696
|
source = replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName);
|
|
697
697
|
setColor =
|
|
698
698
|
" tile_diffuse = tile_featureColor; \n" + " tile_main(); \n";
|
|
@@ -727,14 +727,14 @@ Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function (
|
|
|
727
727
|
// When VTF is supported, per-feature show/hide already happened in the fragment shader
|
|
728
728
|
source +=
|
|
729
729
|
"uniform sampler2D tile_pickTexture; \n" +
|
|
730
|
-
"
|
|
731
|
-
"
|
|
730
|
+
"in vec2 tile_featureSt; \n" +
|
|
731
|
+
"in vec4 tile_featureColor; \n" +
|
|
732
732
|
"void main() \n" +
|
|
733
733
|
"{ \n" +
|
|
734
734
|
" tile_color(tile_featureColor); \n";
|
|
735
735
|
|
|
736
736
|
if (hasPremultipliedAlpha) {
|
|
737
|
-
source += "
|
|
737
|
+
source += " out_FragColor.rgb *= out_FragColor.a; \n";
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
source += "}";
|
|
@@ -745,10 +745,10 @@ Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function (
|
|
|
745
745
|
source +=
|
|
746
746
|
"uniform sampler2D tile_pickTexture; \n" +
|
|
747
747
|
"uniform sampler2D tile_batchTexture; \n" +
|
|
748
|
-
"
|
|
748
|
+
"in vec2 tile_featureSt; \n" +
|
|
749
749
|
"void main() \n" +
|
|
750
750
|
"{ \n" +
|
|
751
|
-
" vec4 featureProperties =
|
|
751
|
+
" vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); \n" +
|
|
752
752
|
" if (featureProperties.a == 0.0) { \n" + // show: alpha == 0 - false, non-zeo - true
|
|
753
753
|
" discard; \n" +
|
|
754
754
|
" } \n";
|
|
@@ -775,7 +775,7 @@ Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function (
|
|
|
775
775
|
source += " tile_color(featureProperties); \n";
|
|
776
776
|
|
|
777
777
|
if (hasPremultipliedAlpha) {
|
|
778
|
-
source += "
|
|
778
|
+
source += " out_FragColor.rgb *= out_FragColor.a; \n";
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
source += "} \n";
|
|
@@ -794,28 +794,28 @@ Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback = funct
|
|
|
794
794
|
// When VTF is supported, per-feature show/hide already happened in the fragment shader
|
|
795
795
|
source +=
|
|
796
796
|
"uniform sampler2D tile_pickTexture;\n" +
|
|
797
|
-
"
|
|
798
|
-
"
|
|
797
|
+
"in vec2 tile_featureSt; \n" +
|
|
798
|
+
"in vec4 tile_featureColor; \n" +
|
|
799
799
|
"void main() \n" +
|
|
800
800
|
"{ \n" +
|
|
801
801
|
" tile_main(); \n" +
|
|
802
|
-
"
|
|
803
|
-
"
|
|
802
|
+
" out_FragColor = tile_featureColor; \n" +
|
|
803
|
+
" out_FragColor.rgb *= out_FragColor.a; \n" +
|
|
804
804
|
"}";
|
|
805
805
|
} else {
|
|
806
806
|
source +=
|
|
807
807
|
"uniform sampler2D tile_batchTexture; \n" +
|
|
808
808
|
"uniform sampler2D tile_pickTexture;\n" +
|
|
809
|
-
"
|
|
809
|
+
"in vec2 tile_featureSt; \n" +
|
|
810
810
|
"void main() \n" +
|
|
811
811
|
"{ \n" +
|
|
812
812
|
" tile_main(); \n" +
|
|
813
|
-
" vec4 featureProperties =
|
|
813
|
+
" vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); \n" +
|
|
814
814
|
" if (featureProperties.a == 0.0) { \n" + // show: alpha == 0 - false, non-zero - true
|
|
815
815
|
" discard; \n" +
|
|
816
816
|
" } \n" +
|
|
817
|
-
"
|
|
818
|
-
"
|
|
817
|
+
" out_FragColor = featureProperties; \n" +
|
|
818
|
+
" out_FragColor.rgb *= out_FragColor.a; \n" +
|
|
819
819
|
"} \n";
|
|
820
820
|
}
|
|
821
821
|
return source;
|
|
@@ -875,7 +875,7 @@ Cesium3DTileBatchTable.prototype.getUniformMapCallback = function () {
|
|
|
875
875
|
};
|
|
876
876
|
|
|
877
877
|
Cesium3DTileBatchTable.prototype.getPickId = function () {
|
|
878
|
-
return "
|
|
878
|
+
return "texture(tile_pickTexture, tile_featureSt)";
|
|
879
879
|
};
|
|
880
880
|
|
|
881
881
|
///////////////////////////////////////////////////////////////////////////
|
|
@@ -14,6 +14,7 @@ import ImplicitSubtree from "./ImplicitSubtree.js";
|
|
|
14
14
|
import ImplicitSubtreeCache from "./ImplicitSubtreeCache.js";
|
|
15
15
|
import ImplicitTileCoordinates from "./ImplicitTileCoordinates.js";
|
|
16
16
|
import ImplicitTileset from "./ImplicitTileset.js";
|
|
17
|
+
import MetadataSemantic from "./MetadataSemantic.js";
|
|
17
18
|
import MetadataType from "./MetadataType.js";
|
|
18
19
|
import preprocess3DTileContent from "./preprocess3DTileContent.js";
|
|
19
20
|
import ResourceCache from "./ResourceCache.js";
|
|
@@ -144,6 +145,7 @@ function Cesium3DTilesVoxelProvider(options) {
|
|
|
144
145
|
that.dimensions = Cartesian3.unpack(voxel.dimensions);
|
|
145
146
|
that.shapeTransform = shapeTransform;
|
|
146
147
|
that.globalTransform = globalTransform;
|
|
148
|
+
that.maximumTileCount = getTileCount(metadata);
|
|
147
149
|
|
|
148
150
|
let paddingBefore;
|
|
149
151
|
let paddingAfter;
|
|
@@ -175,6 +177,16 @@ Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
|
175
177
|
},
|
|
176
178
|
});
|
|
177
179
|
|
|
180
|
+
function getTileCount(metadata) {
|
|
181
|
+
if (!defined(metadata.tileset)) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return metadata.tileset.getPropertyBySemantic(
|
|
186
|
+
MetadataSemantic.TILESET_TILE_COUNT
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
178
190
|
function validate(tileset) {
|
|
179
191
|
const root = tileset.root;
|
|
180
192
|
|