@cesium/engine 9.1.0 → 10.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/ThirdParty/Workers/pako_deflate.min.js +108 -210
- package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
- package/Build/ThirdParty/Workers/z-worker-pako.js +54 -104
- package/Build/Workers/{chunk-TMMOULW3.js → chunk-2J3JKXCP.js} +5 -5
- package/Build/Workers/{chunk-ZDP32RQI.js → chunk-3WUV74WM.js} +95 -155
- package/Build/Workers/{chunk-FOZQIHZK.js → chunk-4BAE4PWO.js} +6 -6
- package/Build/Workers/{chunk-CYAJYEKW.js → chunk-4MSUJ4I7.js} +8 -8
- package/Build/Workers/{chunk-KPY4F4BW.js → chunk-4YSNMHZ4.js} +6 -6
- package/Build/Workers/{chunk-66E3H2KU.js → chunk-5S7OLEPK.js} +12 -12
- package/Build/Workers/{chunk-4AJGCQFX.js → chunk-7XGC6YB2.js} +14 -14
- package/Build/Workers/{chunk-BDUJXBVF.js → chunk-AA4GZKOT.js} +3 -5
- package/Build/Workers/{chunk-7LPEGKOF.js → chunk-AD5HBJ2F.js} +11 -8
- package/Build/Workers/{chunk-XHLDDE65.js → chunk-AVI4IUWC.js} +11 -11
- package/Build/Workers/{chunk-MWYZ64MH.js → chunk-BCL4PHHT.js} +10 -10
- package/Build/Workers/{chunk-PWF3YJJ5.js → chunk-BDFNKFOE.js} +13 -13
- package/Build/Workers/{chunk-7VZNXIKG.js → chunk-BJF5LOWE.js} +7 -7
- package/Build/Workers/{chunk-3S2MFY4B.js → chunk-C2CGMAIU.js} +13 -13
- package/Build/Workers/{chunk-UAJEGIWA.js → chunk-COYFZ5VA.js} +6 -6
- package/Build/Workers/{chunk-ZWPIM77Q.js → chunk-DGS5QNIO.js} +13 -13
- package/Build/Workers/{chunk-V7JB576Q.js → chunk-DKVHRNFY.js} +5 -5
- package/Build/Workers/{chunk-NI2R52QD.js → chunk-DOXCPOG4.js} +11 -9
- package/Build/Workers/{chunk-XWML5Y7N.js → chunk-FXIHSF7O.js} +9 -9
- package/Build/Workers/{chunk-LW7WGHEU.js → chunk-G3YR53LY.js} +13 -13
- package/Build/Workers/{chunk-34DGOKCO.js → chunk-GR3CDLCP.js} +7 -7
- package/Build/Workers/{chunk-AOIKO5Y7.js → chunk-GRAT5GE7.js} +5 -5
- package/Build/Workers/{chunk-AOFMPKUB.js → chunk-I2RC4XVN.js} +4 -4
- package/Build/Workers/{chunk-PK7TEP3J.js → chunk-JYAHOGGL.js} +15 -15
- package/Build/Workers/{chunk-4KIUON73.js → chunk-KUN2ZA5X.js} +4 -4
- package/Build/Workers/{chunk-POLFRINT.js → chunk-L6RTJ3RE.js} +14 -14
- package/Build/Workers/{chunk-LVJCR7DH.js → chunk-LCLJJ2MZ.js} +18 -18
- package/Build/Workers/{chunk-3RZK5NNV.js → chunk-LEABCTLP.js} +4 -4
- package/Build/Workers/{chunk-QKF7XXEQ.js → chunk-MDHQR3ZS.js} +10 -8
- package/Build/Workers/{chunk-4PHPQRSH.js → chunk-MSKXMXJI.js} +5 -6
- package/Build/Workers/{chunk-GIFJ77E4.js → chunk-NTXTUNEF.js} +4 -4
- package/Build/Workers/{chunk-I5TDPPC4.js → chunk-O3JCMSS3.js} +17 -17
- package/Build/Workers/{chunk-PEABJLCK.js → chunk-OOK53QUQ.js} +1 -1
- package/Build/Workers/{chunk-PS6AEMBR.js → chunk-OORVMGDU.js} +7 -7
- package/Build/Workers/{chunk-JI2445T5.js → chunk-PCP4YQST.js} +11 -11
- package/Build/Workers/{chunk-C5CE4OG6.js → chunk-PYHLO636.js} +42 -13
- package/Build/Workers/{chunk-S4XDCPKD.js → chunk-Q55ECN3Y.js} +1 -1
- package/Build/Workers/{chunk-WWP3I7R5.js → chunk-QD4KM3GO.js} +5 -5
- package/Build/Workers/{chunk-YLZTCEBJ.js → chunk-QMLTCCYG.js} +1 -1
- package/Build/Workers/{chunk-IBXGK4WV.js → chunk-QX5XS4LC.js} +2 -2
- package/Build/Workers/{chunk-RL73GOEF.js → chunk-R6B7UCQB.js} +2 -2
- package/Build/Workers/{chunk-RR7EOKGZ.js → chunk-RJYML24O.js} +48 -85
- package/Build/Workers/{chunk-U4IMCOF5.js → chunk-S3PI2KFM.js} +2 -2
- package/Build/Workers/{chunk-6HCAQOVK.js → chunk-STBBMQGG.js} +6 -6
- package/Build/Workers/{chunk-CE6GTZ4I.js → chunk-SYCPRK3D.js} +10 -10
- package/Build/Workers/{chunk-WFICTTOE.js → chunk-T77JILCU.js} +2 -2
- package/Build/Workers/{chunk-ZC4AGBZK.js → chunk-TO2PVHKI.js} +2 -2
- package/Build/Workers/{chunk-UCPPWV64.js → chunk-VE7BFUIX.js} +1 -1
- package/Build/Workers/{chunk-2CSEEWHN.js → chunk-VFBNELXB.js} +7 -7
- package/Build/Workers/{chunk-A6NCZSL3.js → chunk-VO3ACQB2.js} +19 -19
- package/Build/Workers/{chunk-WEGCQ5DY.js → chunk-X23FRWHJ.js} +6 -6
- package/Build/Workers/{chunk-G7CJQKKD.js → chunk-XD445VDH.js} +7 -7
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +29 -25
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +27 -27
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +24 -24
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createPolylineGeometry.js +24 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +30 -30
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +26 -26
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
- package/Build/Workers/createSimplePolylineGeometry.js +22 -22
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +21 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +23 -23
- package/Build/Workers/createWallOutlineGeometry.js +22 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +43 -79
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/ApproximateTerrainHeights.js +4 -4
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +12 -8
- package/Source/Core/BoundingRectangle.js +2 -0
- package/Source/Core/BoundingSphere.js +4 -2
- package/Source/Core/Cartesian3.js +13 -10
- package/Source/Core/Cartographic.js +11 -8
- package/Source/Core/CesiumTerrainProvider.js +3 -2
- package/Source/Core/CircleGeometry.js +6 -2
- package/Source/Core/CircleOutlineGeometry.js +1 -1
- package/Source/Core/CoplanarPolygonGeometry.js +3 -3
- package/Source/Core/CorridorGeometry.js +4 -4
- package/Source/Core/CorridorOutlineGeometry.js +2 -2
- package/Source/Core/Credit.js +3 -2
- package/Source/Core/CustomHeightmapTerrainProvider.js +17 -3
- package/Source/Core/EllipseGeometry.js +4 -4
- package/Source/Core/EllipseOutlineGeometry.js +2 -2
- package/Source/Core/Ellipsoid.js +34 -0
- package/Source/Core/EllipsoidGeodesic.js +2 -2
- package/Source/Core/EllipsoidRhumbLine.js +4 -4
- package/Source/Core/EllipsoidTangentPlane.js +3 -3
- package/Source/Core/EllipsoidTerrainProvider.js +3 -3
- package/Source/Core/GeographicProjection.js +4 -3
- package/Source/Core/GeographicTilingScheme.js +3 -3
- package/Source/Core/GeometryPipeline.js +2 -2
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
- package/Source/Core/GoogleMaps.js +1 -1
- package/Source/Core/GroundPolylineGeometry.js +1 -1
- package/Source/Core/HeightmapTessellator.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Math.js +0 -5
- package/Source/Core/Occluder.js +3 -3
- package/Source/Core/OrientedBoundingBox.js +2 -2
- package/Source/Core/PolygonGeometry.js +4 -4
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +3 -3
- package/Source/Core/PolygonPipeline.js +2 -2
- package/Source/Core/PolylineGeometry.js +2 -2
- package/Source/Core/PolylinePipeline.js +6 -6
- package/Source/Core/PolylineVolumeGeometry.js +2 -2
- package/Source/Core/PolylineVolumeOutlineGeometry.js +2 -2
- package/Source/Core/Rectangle.js +6 -6
- package/Source/Core/RectangleGeometry.js +6 -6
- package/Source/Core/RectangleGeometryLibrary.js +3 -0
- package/Source/Core/RectangleOutlineGeometry.js +2 -2
- package/Source/Core/Simon1994PlanetaryPositions.js +3 -2
- package/Source/Core/SimplePolylineGeometry.js +2 -2
- package/Source/Core/Stereographic.js +2 -2
- package/Source/Core/TaskProcessor.js +19 -3
- package/Source/Core/Transforms.js +17 -17
- package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
- package/Source/Core/WallGeometry.js +3 -3
- package/Source/Core/WallOutlineGeometry.js +3 -3
- package/Source/Core/WebMercatorTilingScheme.js +3 -3
- package/Source/Core/createWorldTerrainAsync.js +2 -0
- package/Source/Core/sampleTerrain.js +3 -3
- package/Source/DataSources/BoxGeometryUpdater.js +2 -2
- package/Source/DataSources/CylinderGeometryUpdater.js +2 -2
- package/Source/DataSources/CzmlDataSource.js +8 -8
- package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -3
- package/Source/DataSources/EntityCluster.js +1 -1
- package/Source/DataSources/EntityView.js +2 -2
- package/Source/DataSources/KmlDataSource.js +4 -4
- package/Source/DataSources/ModelVisualizer.js +1 -2
- package/Source/DataSources/PolygonGeometryUpdater.js +1 -1
- package/Source/DataSources/PolylineGeometryUpdater.js +3 -2
- package/Source/DataSources/RectangleGeometryUpdater.js +1 -1
- package/Source/DataSources/ScaledPositionProperty.js +2 -2
- package/Source/DataSources/TerrainOffsetProperty.js +3 -7
- package/Source/DataSources/VelocityOrientationProperty.js +2 -2
- package/Source/DataSources/exportKml.js +2 -2
- package/Source/Renderer/UniformState.js +1 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +2 -2
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +8 -6
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/Camera.js +16 -10
- package/Source/Scene/Cesium3DTileset.js +1 -1
- package/Source/Scene/ClippingPolygon.js +2 -2
- package/Source/Scene/ClippingPolygonCollection.js +1 -1
- package/Source/Scene/CreditDisplay.js +94 -104
- package/Source/Scene/Globe.js +16 -13
- package/Source/Scene/GltfLoader.js +458 -435
- package/Source/Scene/GltfLoaderUtil.js +5 -16
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
- package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
- package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +1 -1
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
- package/Source/Scene/GridImageryProvider.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/MapboxImageryProvider.js +1 -1
- package/Source/Scene/MapboxStyleImageryProvider.js +1 -1
- package/Source/Scene/MetadataSemantic.js +4 -4
- package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
- package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
- package/Source/Scene/Model/InstancingPipelineStage.js +3 -3
- package/Source/Scene/Model/LightingPipelineStage.js +2 -4
- package/Source/Scene/Model/MaterialPipelineStage.js +395 -29
- package/Source/Scene/Model/Model.js +15 -7
- package/Source/Scene/Model/ModelSceneGraph.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +3 -0
- package/Source/Scene/Model/SceneMode2DPipelineStage.js +3 -3
- package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
- package/Source/Scene/Model/pickModel.js +2 -2
- package/Source/Scene/ModelComponents.js +178 -1
- package/Source/Scene/PickDepth.js +23 -15
- package/Source/Scene/Picking.js +4 -13
- package/Source/Scene/PointPrimitive.js +5 -2
- package/Source/Scene/ResourceCache.js +41 -50
- package/Source/Scene/ResourceCacheKey.js +41 -53
- package/Source/Scene/Scene.js +39 -31
- package/Source/Scene/SceneTransforms.js +78 -20
- package/Source/Scene/SceneTransitioner.js +2 -2
- package/Source/Scene/ScreenSpaceCameraController.js +29 -19
- package/Source/Scene/SkyBox.js +26 -0
- package/Source/Scene/Sun.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -10
- package/Source/Shaders/Builtin/Functions/ellipsoidTextureCoordinates.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/{ellipsoidWgs84TextureCoordinates.js → ellipsoidTextureCoordinates.js} +3 -3
- package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
- package/Source/Shaders/Builtin/Structs/materialInput.glsl +1 -1
- package/Source/Shaders/Builtin/Structs/materialInput.js +1 -1
- package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +16 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.js +16 -0
- package/Source/Shaders/EllipsoidFS.glsl +1 -1
- package/Source/Shaders/EllipsoidFS.js +1 -1
- package/Source/Shaders/GlobeFS.glsl +3 -3
- package/Source/Shaders/GlobeFS.js +3 -3
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
- package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
- package/Source/Shaders/Model/LightingStageFS.js +113 -48
- package/Source/Shaders/Model/MaterialStageFS.glsl +407 -136
- package/Source/Shaders/Model/MaterialStageFS.js +407 -136
- package/Source/Widget/CesiumWidget.css +0 -5
- package/Source/Widget/CesiumWidget.js +29 -28
- package/index.d.ts +184 -116
- package/index.js +92 -95
- package/package.json +2 -2
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
- package/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.glsl +0 -10
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
- package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
- package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
|
@@ -1,73 +1,138 @@
|
|
|
1
1
|
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
-
export default "#ifdef
|
|
3
|
-
vec3
|
|
2
|
+
export default "#ifdef USE_IBL_LIGHTING\n\
|
|
3
|
+
vec3 computeIBL(vec3 position, vec3 normal, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)\n\
|
|
4
4
|
{\n\
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
\n\
|
|
10
|
-
#ifdef USE_CUSTOM_LIGHT_COLOR\n\
|
|
11
|
-
vec3 lightColorHdr = model_lightColorHdr;\n\
|
|
5
|
+
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\n\
|
|
6
|
+
// Environment maps were provided, use them for IBL\n\
|
|
7
|
+
vec3 viewDirection = -normalize(position);\n\
|
|
8
|
+
vec3 iblColor = textureIBL(viewDirection, normal, lightDirection, material);\n\
|
|
12
9
|
#else\n\
|
|
13
|
-
|
|
10
|
+
// Use procedural IBL if there are no environment maps\n\
|
|
11
|
+
vec3 imageBasedLighting = proceduralIBL(position, normal, lightDirection, material);\n\
|
|
12
|
+
float maximumComponent = czm_maximumComponent(lightColorHdr);\n\
|
|
13
|
+
vec3 clampedLightColor = lightColorHdr / max(maximumComponent, 1.0);\n\
|
|
14
|
+
vec3 iblColor = clampedLightColor * imageBasedLighting;\n\
|
|
14
15
|
#endif\n\
|
|
16
|
+
return iblColor * material.occlusion;\n\
|
|
17
|
+
}\n\
|
|
18
|
+
#endif\n\
|
|
19
|
+
\n\
|
|
20
|
+
#ifdef USE_CLEARCOAT\n\
|
|
21
|
+
vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)\n\
|
|
22
|
+
{\n\
|
|
23
|
+
vec3 viewDirection = -normalize(position);\n\
|
|
24
|
+
vec3 halfwayDirection = normalize(viewDirection + lightDirection);\n\
|
|
25
|
+
vec3 normal = material.clearcoatNormal;\n\
|
|
26
|
+
float NdotL = clamp(dot(normal, lightDirection), 0.001, 1.0);\n\
|
|
27
|
+
\n\
|
|
28
|
+
// clearcoatF0 = vec3(pow((ior - 1.0) / (ior + 1.0), 2.0)), but without KHR_materials_ior, ior is a constant 1.5.\n\
|
|
29
|
+
vec3 f0 = vec3(0.04);\n\
|
|
30
|
+
vec3 f90 = vec3(1.0);\n\
|
|
31
|
+
// Note: clearcoat Fresnel computed with dot(n, v) instead of dot(v, h).\n\
|
|
32
|
+
// This is to make it energy conserving with a simple layering function.\n\
|
|
33
|
+
float NdotV = clamp(dot(normal, viewDirection), 0.0, 1.0);\n\
|
|
34
|
+
vec3 F = fresnelSchlick2(f0, f90, NdotV);\n\
|
|
15
35
|
\n\
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);\n\
|
|
36
|
+
// compute specular reflection from direct lighting\n\
|
|
37
|
+
float roughness = material.clearcoatRoughness;\n\
|
|
38
|
+
float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, roughness);\n\
|
|
39
|
+
vec3 directReflection = F * directStrength * NdotL;\n\
|
|
40
|
+
vec3 color = lightColorHdr * directReflection;\n\
|
|
41
|
+
\n\
|
|
42
|
+
#ifdef SPECULAR_IBL\n\
|
|
43
|
+
// Find the direction in which to sample the environment map\n\
|
|
44
|
+
vec3 cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirection, normal)));\n\
|
|
45
|
+
vec3 iblColor = computeSpecularIBL(cubeDir, NdotV, NdotV, f0, roughness);\n\
|
|
46
|
+
color += iblColor * material.occlusion;\n\
|
|
47
|
+
#elif defined(USE_IBL_LIGHTING)\n\
|
|
48
|
+
vec3 positionWC = vec3(czm_inverseView * vec4(position, 1.0));\n\
|
|
49
|
+
vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirection, normal)));\n\
|
|
50
|
+
vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);\n\
|
|
51
|
+
\n\
|
|
52
|
+
vec3 specularIrradiance = getProceduralSpecularIrradiance(reflectionWC, skyMetrics, roughness);\n\
|
|
53
|
+
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;\n\
|
|
54
|
+
vec3 specularColor = czm_srgbToLinear(f0 * brdfLut.x + brdfLut.y);\n\
|
|
55
|
+
vec3 iblColor = specularIrradiance * specularColor * model_iblFactor.y;\n\
|
|
56
|
+
#ifdef USE_SUN_LUMINANCE\n\
|
|
57
|
+
iblColor *= getSunLuminance(positionWC, normal, lightDirection);\n\
|
|
34
58
|
#endif\n\
|
|
59
|
+
float maximumComponent = czm_maximumComponent(lightColorHdr);\n\
|
|
60
|
+
vec3 clampedLightColor = lightColorHdr / max(maximumComponent, 1.0);\n\
|
|
61
|
+
color += clampedLightColor* iblColor * material.occlusion;\n\
|
|
62
|
+
#endif\n\
|
|
63
|
+
\n\
|
|
64
|
+
float clearcoatFactor = material.clearcoatFactor;\n\
|
|
65
|
+
vec3 clearcoatColor = color * clearcoatFactor;\n\
|
|
66
|
+
\n\
|
|
67
|
+
// Dim base layer based on transmission loss through clearcoat\n\
|
|
68
|
+
return baseLayerColor * (1.0 - clearcoatFactor * F) + clearcoatColor;\n\
|
|
69
|
+
}\n\
|
|
70
|
+
#endif\n\
|
|
71
|
+
\n\
|
|
72
|
+
#if defined(LIGHTING_PBR) && defined(HAS_NORMALS)\n\
|
|
73
|
+
vec3 computePbrLighting(in czm_modelMaterial material, in vec3 position)\n\
|
|
74
|
+
{\n\
|
|
75
|
+
#ifdef USE_CUSTOM_LIGHT_COLOR\n\
|
|
76
|
+
vec3 lightColorHdr = model_lightColorHdr;\n\
|
|
77
|
+
#else\n\
|
|
78
|
+
vec3 lightColorHdr = czm_lightColorHdr;\n\
|
|
35
79
|
#endif\n\
|
|
36
80
|
\n\
|
|
37
|
-
|
|
38
|
-
|
|
81
|
+
vec3 viewDirection = -normalize(position);\n\
|
|
82
|
+
vec3 normal = material.normalEC;\n\
|
|
83
|
+
vec3 lightDirection = normalize(czm_lightDirectionEC);\n\
|
|
84
|
+
\n\
|
|
85
|
+
vec3 directLighting = czm_pbrLighting(viewDirection, normal, lightDirection, material);\n\
|
|
86
|
+
vec3 directColor = lightColorHdr * directLighting;\n\
|
|
39
87
|
\n\
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
#
|
|
45
|
-
|
|
46
|
-
#
|
|
88
|
+
// Accumulate colors from base layer\n\
|
|
89
|
+
vec3 color = directColor + material.emissive;\n\
|
|
90
|
+
#ifdef USE_IBL_LIGHTING\n\
|
|
91
|
+
color += computeIBL(position, normal, lightDirection, lightColorHdr, material);\n\
|
|
92
|
+
#endif\n\
|
|
93
|
+
\n\
|
|
94
|
+
#ifdef USE_CLEARCOAT\n\
|
|
95
|
+
color = addClearcoatReflection(color, position, lightDirection, lightColorHdr, material);\n\
|
|
96
|
+
#endif\n\
|
|
47
97
|
\n\
|
|
48
98
|
return color;\n\
|
|
49
99
|
}\n\
|
|
50
100
|
#endif\n\
|
|
51
101
|
\n\
|
|
102
|
+
/**\n\
|
|
103
|
+
* Compute the material color under the current lighting conditions.\n\
|
|
104
|
+
* All other material properties are passed through so further stages\n\
|
|
105
|
+
* have access to them.\n\
|
|
106
|
+
*\n\
|
|
107
|
+
* @param {czm_modelMaterial} material The material properties from {@MaterialStageFS}\n\
|
|
108
|
+
* @param {ProcessedAttributes} attributes\n\
|
|
109
|
+
*/\n\
|
|
52
110
|
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)\n\
|
|
53
111
|
{\n\
|
|
54
|
-
// Even though the lighting will only set the diffuse color,\n\
|
|
55
|
-
// pass all other properties so further stages have access to them.\n\
|
|
56
|
-
vec3 color = vec3(0.0);\n\
|
|
57
|
-
\n\
|
|
58
112
|
#ifdef LIGHTING_PBR\n\
|
|
59
|
-
|
|
113
|
+
#ifdef HAS_NORMALS\n\
|
|
114
|
+
vec3 color = computePbrLighting(material, attributes.positionEC);\n\
|
|
115
|
+
#else\n\
|
|
116
|
+
vec3 color = material.diffuse * material.occlusion + material.emissive;\n\
|
|
117
|
+
#endif\n\
|
|
118
|
+
// In HDR mode, the frame buffer is in linear color space. The\n\
|
|
119
|
+
// post-processing stages (see PostProcessStageCollection) will handle\n\
|
|
120
|
+
// tonemapping. However, if HDR is not enabled, we must tonemap else large\n\
|
|
121
|
+
// values may be clamped to 1.0\n\
|
|
122
|
+
#ifndef HDR\n\
|
|
123
|
+
color = czm_acesTonemapping(color);\n\
|
|
124
|
+
#endif\n\
|
|
60
125
|
#else // unlit\n\
|
|
61
|
-
|
|
126
|
+
vec3 color = material.diffuse;\n\
|
|
62
127
|
#endif\n\
|
|
63
128
|
\n\
|
|
64
129
|
#ifdef HAS_POINT_CLOUD_COLOR_STYLE\n\
|
|
65
|
-
|
|
66
|
-
|
|
130
|
+
// The colors resulting from point cloud styles are adjusted differently.\n\
|
|
131
|
+
color = czm_gammaCorrect(color);\n\
|
|
67
132
|
#elif !defined(HDR)\n\
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
133
|
+
// If HDR is not enabled, the frame buffer stores sRGB colors rather than\n\
|
|
134
|
+
// linear colors so the linear value must be converted.\n\
|
|
135
|
+
color = czm_linearToSrgb(color);\n\
|
|
71
136
|
#endif\n\
|
|
72
137
|
\n\
|
|
73
138
|
material.diffuse = color;\n\
|