@cesium/engine 10.0.0 → 11.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-AA4GZKOT.js → chunk-2EDC3QGH.js} +1 -1
- package/Build/Workers/{chunk-DKVHRNFY.js → chunk-2MKRG7L7.js} +5 -5
- package/Build/Workers/{chunk-X23FRWHJ.js → chunk-2RZYNSMR.js} +6 -6
- package/Build/Workers/{chunk-TO2PVHKI.js → chunk-4NBRIKB3.js} +2 -2
- package/Build/Workers/{chunk-GRAT5GE7.js → chunk-4TK5YR6Q.js} +5 -5
- package/Build/Workers/{chunk-XD445VDH.js → chunk-54VC7SCM.js} +7 -7
- package/Build/Workers/{chunk-G3YR53LY.js → chunk-5IY5BXCT.js} +13 -13
- package/Build/Workers/{chunk-O3JCMSS3.js → chunk-6FFGOENI.js} +54 -7
- package/Build/Workers/{chunk-7XGC6YB2.js → chunk-6PJIHPQB.js} +13 -13
- package/Build/Workers/{chunk-GR3CDLCP.js → chunk-6ZREIBKS.js} +7 -7
- package/Build/Workers/{chunk-4MSUJ4I7.js → chunk-AI3O7UN2.js} +6 -6
- package/Build/Workers/{chunk-COYFZ5VA.js → chunk-AS7P4BHI.js} +6 -6
- package/Build/Workers/{chunk-JYAHOGGL.js → chunk-AUM45VEG.js} +16 -15
- package/Build/Workers/{chunk-BDFNKFOE.js → chunk-BBO6BGLC.js} +13 -13
- package/Build/Workers/{chunk-AVI4IUWC.js → chunk-BH5ZEN4I.js} +10 -10
- package/Build/Workers/{chunk-4BAE4PWO.js → chunk-BJ3WF5RW.js} +6 -6
- package/Build/Workers/{chunk-Q55ECN3Y.js → chunk-BUOFSNFW.js} +1 -1
- package/Build/Workers/{chunk-QX5XS4LC.js → chunk-BZXF3GNX.js} +2 -2
- package/Build/Workers/{chunk-PYHLO636.js → chunk-DJXXI7UF.js} +5 -5
- package/Build/Workers/{chunk-LCLJJ2MZ.js → chunk-DVAIU7A4.js} +17 -17
- package/Build/Workers/{chunk-SYCPRK3D.js → chunk-FJT3ERV7.js} +9 -9
- package/Build/Workers/{chunk-L6RTJ3RE.js → chunk-GOHDOWU5.js} +14 -14
- package/Build/Workers/{chunk-MSKXMXJI.js → chunk-HA6TZ3XT.js} +4 -4
- package/Build/Workers/{chunk-PCP4YQST.js → chunk-HBZSCVZC.js} +11 -11
- package/Build/Workers/{chunk-5S7OLEPK.js → chunk-HC7RYWPZ.js} +12 -12
- package/Build/Workers/{chunk-VE7BFUIX.js → chunk-HFMJM3SX.js} +1 -1
- package/Build/Workers/{chunk-OOK53QUQ.js → chunk-HFPMX5L2.js} +1 -1
- package/Build/Workers/{chunk-VFBNELXB.js → chunk-HO2NTC7I.js} +6 -6
- package/Build/Workers/{chunk-DOXCPOG4.js → chunk-HZPMWR4H.js} +7 -7
- package/Build/Workers/{chunk-I2RC4XVN.js → chunk-IBG5FVXC.js} +4 -4
- package/Build/Workers/{chunk-LEABCTLP.js → chunk-IXLNNST6.js} +4 -4
- package/Build/Workers/{chunk-4YSNMHZ4.js → chunk-JYUCC5NV.js} +6 -6
- package/Build/Workers/{chunk-BCL4PHHT.js → chunk-KFW4UNQH.js} +10 -10
- package/Build/Workers/{chunk-R6B7UCQB.js → chunk-KKAEXHDY.js} +2 -2
- package/Build/Workers/{chunk-BJF5LOWE.js → chunk-L6FARMF6.js} +7 -7
- package/Build/Workers/{chunk-C2CGMAIU.js → chunk-N3BIL6WA.js} +13 -13
- package/Build/Workers/{chunk-STBBMQGG.js → chunk-O5SSW3B3.js} +6 -6
- package/Build/Workers/{chunk-S3PI2KFM.js → chunk-OC4MYPVW.js} +2 -2
- package/Build/Workers/{chunk-MDHQR3ZS.js → chunk-OOA6GXKD.js} +7 -7
- package/Build/Workers/{chunk-AD5HBJ2F.js → chunk-OSCHEWSG.js} +7 -7
- package/Build/Workers/{chunk-NTXTUNEF.js → chunk-QGT2GMOK.js} +4 -4
- package/Build/Workers/{chunk-VO3ACQB2.js → chunk-RFQYEYAL.js} +17 -17
- package/Build/Workers/{chunk-KUN2ZA5X.js → chunk-RJF5ZP76.js} +4 -4
- package/Build/Workers/{chunk-QD4KM3GO.js → chunk-SIZXFNJY.js} +6 -5
- package/Build/Workers/{chunk-FXIHSF7O.js → chunk-SRZJCF7G.js} +9 -9
- package/Build/Workers/{chunk-T77JILCU.js → chunk-T4MB73MC.js} +2 -2
- package/Build/Workers/{chunk-3WUV74WM.js → chunk-TTI2SUWJ.js} +2 -2
- package/Build/Workers/{chunk-QMLTCCYG.js → chunk-VHJ5ESXF.js} +1 -1
- package/Build/Workers/{chunk-2J3JKXCP.js → chunk-VSFFJGTA.js} +9 -5
- package/Build/Workers/{chunk-DGS5QNIO.js → chunk-WQRXRDCZ.js} +11 -11
- package/Build/Workers/{chunk-OORVMGDU.js → chunk-WXDGOYTT.js} +12 -7
- package/Build/Workers/{chunk-RJYML24O.js → chunk-XLCZE6DD.js} +423 -448
- 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 +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- 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 +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- 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 +24 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +28 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +20 -22
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/CompressedTextureBuffer.js +11 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/KTX2Transcoder.js +9 -16
- package/Source/Core/PixelFormat.js +1 -15
- package/Source/Core/Simon1994PlanetaryPositions.js +2 -1
- package/Source/Core/Transforms.js +137 -2
- package/Source/DataSources/BillboardGraphics.js +16 -0
- package/Source/DataSources/BillboardVisualizer.js +7 -0
- package/Source/DataSources/CallbackProperty.js +8 -2
- package/Source/DataSources/CheckerboardMaterialProperty.js +7 -1
- package/Source/DataSources/ColorMaterialProperty.js +7 -1
- package/Source/DataSources/CompositeMaterialProperty.js +5 -4
- package/Source/DataSources/CompositePositionProperty.js +7 -1
- package/Source/DataSources/CompositeProperty.js +5 -5
- package/Source/DataSources/ConstantPositionProperty.js +7 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/GridMaterialProperty.js +7 -1
- package/Source/DataSources/ImageMaterialProperty.js +8 -1
- package/Source/DataSources/MaterialProperty.js +7 -1
- package/Source/DataSources/NodeTransformationProperty.js +7 -1
- package/Source/DataSources/PathVisualizer.js +4 -4
- package/Source/DataSources/PointGraphics.js +17 -0
- package/Source/DataSources/PointVisualizer.js +12 -0
- package/Source/DataSources/PolylineArrowMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineDashMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineGlowMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineOutlineMaterialProperty.js +7 -1
- package/Source/DataSources/PositionProperty.js +5 -8
- package/Source/DataSources/PositionPropertyArray.js +7 -1
- package/Source/DataSources/Property.js +1 -1
- package/Source/DataSources/PropertyArray.js +5 -5
- package/Source/DataSources/PropertyBag.js +5 -4
- package/Source/DataSources/ReferenceProperty.js +7 -1
- package/Source/DataSources/SampledPositionProperty.js +7 -1
- package/Source/DataSources/SampledProperty.js +6 -4
- package/Source/DataSources/ScaledPositionProperty.js +6 -0
- package/Source/DataSources/StripeMaterialProperty.js +7 -1
- package/Source/DataSources/TerrainOffsetProperty.js +9 -0
- package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +7 -1
- package/Source/DataSources/TimeIntervalCollectionProperty.js +5 -5
- package/Source/DataSources/VelocityOrientationProperty.js +6 -1
- package/Source/DataSources/VelocityVectorProperty.js +3 -5
- package/Source/Renderer/AutomaticUniforms.js +3 -18
- package/Source/Renderer/Context.js +15 -0
- package/Source/Renderer/CubeMap.js +326 -348
- package/Source/Renderer/CubeMapFace.js +26 -48
- package/Source/Renderer/PixelDatatype.js +23 -0
- package/Source/Renderer/Sampler.js +7 -13
- package/Source/Renderer/ShaderProgram.js +7 -0
- package/Source/Renderer/Texture.js +396 -332
- package/Source/Renderer/UniformState.js +8 -33
- package/Source/Renderer/demodernizeShader.js +2 -0
- package/Source/Renderer/loadCubeMap.js +3 -8
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +29 -2
- package/Source/Scene/BillboardCollection.js +49 -0
- package/Source/Scene/BingMapsImageryProvider.js +10 -1
- package/Source/Scene/CameraEventAggregator.js +49 -5
- package/Source/Scene/Globe.js +1 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +29 -24
- package/Source/Scene/GlobeSurfaceTileProvider.js +5 -3
- package/Source/Scene/ImageBasedLighting.js +36 -36
- package/Source/Scene/Label.js +2 -2
- package/Source/Scene/Material.js +24 -2
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -15
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/PointPrimitive.js +28 -2
- package/Source/Scene/PointPrimitiveCollection.js +22 -9
- package/Source/Scene/PostProcessStageCollection.js +45 -15
- package/Source/Scene/PostProcessStageLibrary.js +26 -0
- package/Source/Scene/Scene.js +20 -22
- package/Source/Scene/SceneTransforms.js +0 -62
- package/Source/Scene/ScreenSpaceCameraController.js +11 -4
- package/Source/Scene/SkyBox.js +13 -19
- package/Source/Scene/SpecularEnvironmentCubeMap.js +240 -0
- package/Source/Scene/Tonemapper.js +35 -23
- package/Source/Scene/VoxelPrimitive.js +0 -29
- package/Source/Scene/VoxelRenderResources.js +0 -3
- package/Source/Shaders/BillboardCollectionFS.glsl +4 -0
- package/Source/Shaders/BillboardCollectionFS.js +4 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +3 -1
- package/Source/Shaders/BillboardCollectionVS.js +3 -1
- package/Source/Shaders/BrdfLutGeneratorFS.glsl +30 -13
- package/Source/Shaders/BrdfLutGeneratorFS.js +30 -13
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -2
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +42 -41
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +42 -41
- package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.glsl +23 -0
- package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.js +25 -0
- package/Source/Shaders/Builtin/Functions/textureCube.glsl +21 -2
- package/Source/Shaders/Builtin/Functions/textureCube.js +21 -2
- package/Source/Shaders/Builtin/Structs/materialInput.glsl +2 -0
- package/Source/Shaders/Builtin/Structs/materialInput.js +2 -0
- package/Source/Shaders/GlobeFS.glsl +10 -4
- package/Source/Shaders/GlobeFS.js +10 -4
- package/Source/Shaders/Materials/WaterMaskMaterial.glsl +15 -0
- package/Source/Shaders/Materials/WaterMaskMaterial.js +17 -0
- package/Source/Shaders/Model/AtmosphereStageFS.glsl +1 -1
- package/Source/Shaders/Model/AtmosphereStageFS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +57 -46
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +57 -46
- package/Source/Shaders/Model/LightingStageFS.glsl +8 -7
- package/Source/Shaders/Model/LightingStageFS.js +8 -7
- package/Source/Shaders/Model/MaterialStageFS.glsl +10 -14
- package/Source/Shaders/Model/MaterialStageFS.js +10 -14
- package/Source/Shaders/PointPrimitiveCollectionFS.glsl +4 -0
- package/Source/Shaders/PointPrimitiveCollectionFS.js +4 -0
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +9 -7
- package/Source/Shaders/PointPrimitiveCollectionVS.js +9 -7
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +4 -0
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +4 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +4 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +4 -0
- package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.glsl +25 -0
- package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.js +27 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +4 -0
- package/Source/Shaders/SkyAtmosphereFS.glsl +1 -1
- package/Source/Shaders/SkyAtmosphereFS.js +1 -1
- package/Source/Widget/CesiumWidget.js +1 -1
- package/index.d.ts +191 -106
- package/index.js +133 -134
- package/package.json +4 -4
- package/Source/Scene/OctahedralProjectedCubeMap.js +0 -445
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +0 -78
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +0 -80
- package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +0 -89
- package/Source/Shaders/OctahedralProjectionAtlasFS.js +0 -91
- package/Source/Shaders/OctahedralProjectionFS.glsl +0 -14
- package/Source/Shaders/OctahedralProjectionFS.js +0 -16
- package/Source/Shaders/OctahedralProjectionVS.glsl +0 -10
- package/Source/Shaders/OctahedralProjectionVS.js +0 -12
|
@@ -4,7 +4,7 @@ import defined from "../Core/defined.js";
|
|
|
4
4
|
import defaultValue from "../Core/defaultValue.js";
|
|
5
5
|
import destroyObject from "../Core/destroyObject.js";
|
|
6
6
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
7
|
-
import
|
|
7
|
+
import SpecularEnvironmentCubeMap from "./SpecularEnvironmentCubeMap.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Properties for managing image-based lighting on tilesets and models.
|
|
@@ -84,8 +84,8 @@ function ImageBasedLighting(options) {
|
|
|
84
84
|
|
|
85
85
|
// The specular environment map texture is created in update();
|
|
86
86
|
this._specularEnvironmentMaps = options.specularEnvironmentMaps;
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
87
|
+
this._specularEnvironmentCubeMap = undefined;
|
|
88
|
+
this._specularEnvironmentCubeMapDirty = true;
|
|
89
89
|
this._specularEnvironmentMapLoaded = false;
|
|
90
90
|
this._previousSpecularEnvironmentMapLoaded = false;
|
|
91
91
|
|
|
@@ -186,8 +186,8 @@ Object.defineProperties(ImageBasedLighting.prototype, {
|
|
|
186
186
|
* </p>
|
|
187
187
|
*
|
|
188
188
|
* These values can be obtained by preprocessing the environment map using the <code>cmgen</code> tool of
|
|
189
|
-
* {@link https://github.com/google/filament/releases|Google's Filament project}.
|
|
190
|
-
*
|
|
189
|
+
* {@link https://github.com/google/filament/releases|Google's Filament project}.
|
|
190
|
+
* Be sure to use the <code>--no-mirror</code> option in <code>cmgen</code>.
|
|
191
191
|
*
|
|
192
192
|
* @memberof ImageBasedLighting.prototype
|
|
193
193
|
*
|
|
@@ -226,8 +226,8 @@ Object.defineProperties(ImageBasedLighting.prototype, {
|
|
|
226
226
|
},
|
|
227
227
|
set: function (value) {
|
|
228
228
|
if (value !== this._specularEnvironmentMaps) {
|
|
229
|
-
this.
|
|
230
|
-
this.
|
|
229
|
+
this._specularEnvironmentCubeMapDirty =
|
|
230
|
+
this._specularEnvironmentCubeMapDirty ||
|
|
231
231
|
value !== this._specularEnvironmentMaps;
|
|
232
232
|
this._specularEnvironmentMapLoaded = false;
|
|
233
233
|
}
|
|
@@ -299,16 +299,16 @@ Object.defineProperties(ImageBasedLighting.prototype, {
|
|
|
299
299
|
},
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
|
-
* The
|
|
302
|
+
* The cube map for the specular environment maps.
|
|
303
303
|
*
|
|
304
304
|
* @memberof ImageBasedLighting.prototype
|
|
305
|
-
* @type {
|
|
305
|
+
* @type {SpecularEnvironmentCubeMap}
|
|
306
306
|
*
|
|
307
307
|
* @private
|
|
308
308
|
*/
|
|
309
|
-
|
|
309
|
+
specularEnvironmentCubeMap: {
|
|
310
310
|
get: function () {
|
|
311
|
-
return this.
|
|
311
|
+
return this._specularEnvironmentCubeMap;
|
|
312
312
|
},
|
|
313
313
|
},
|
|
314
314
|
|
|
@@ -337,30 +337,30 @@ Object.defineProperties(ImageBasedLighting.prototype, {
|
|
|
337
337
|
useSpecularEnvironmentMaps: {
|
|
338
338
|
get: function () {
|
|
339
339
|
return (
|
|
340
|
-
(defined(this.
|
|
341
|
-
this.
|
|
340
|
+
(defined(this._specularEnvironmentCubeMap) &&
|
|
341
|
+
this._specularEnvironmentCubeMap.ready) ||
|
|
342
342
|
this._useDefaultSpecularMaps
|
|
343
343
|
);
|
|
344
344
|
},
|
|
345
345
|
},
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
function
|
|
349
|
-
if (!
|
|
348
|
+
function createSpecularEnvironmentCubeMap(imageBasedLighting, context) {
|
|
349
|
+
if (!SpecularEnvironmentCubeMap.isSupported(context)) {
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
imageBasedLighting.
|
|
354
|
-
imageBasedLighting.
|
|
355
|
-
imageBasedLighting.
|
|
353
|
+
imageBasedLighting._specularEnvironmentCubeMap =
|
|
354
|
+
imageBasedLighting._specularEnvironmentCubeMap &&
|
|
355
|
+
imageBasedLighting._specularEnvironmentCubeMap.destroy();
|
|
356
356
|
|
|
357
357
|
if (defined(imageBasedLighting._specularEnvironmentMaps)) {
|
|
358
|
-
const
|
|
358
|
+
const cubeMap = new SpecularEnvironmentCubeMap(
|
|
359
359
|
imageBasedLighting._specularEnvironmentMaps
|
|
360
360
|
);
|
|
361
|
-
imageBasedLighting.
|
|
361
|
+
imageBasedLighting._specularEnvironmentCubeMap = cubeMap;
|
|
362
362
|
|
|
363
|
-
imageBasedLighting._removeErrorListener =
|
|
363
|
+
imageBasedLighting._removeErrorListener = cubeMap.errorEvent.addEventListener(
|
|
364
364
|
(error) => {
|
|
365
365
|
console.error(`Error loading specularEnvironmentMaps: ${error}`);
|
|
366
366
|
}
|
|
@@ -428,23 +428,23 @@ ImageBasedLighting.prototype.update = function (frameState) {
|
|
|
428
428
|
|
|
429
429
|
this._previousSpecularEnvironmentMapLoaded = this._specularEnvironmentMapLoaded;
|
|
430
430
|
|
|
431
|
-
if (this.
|
|
432
|
-
|
|
433
|
-
this.
|
|
431
|
+
if (this._specularEnvironmentCubeMapDirty) {
|
|
432
|
+
createSpecularEnvironmentCubeMap(this, context);
|
|
433
|
+
this._specularEnvironmentCubeMapDirty = false;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
if (defined(this.
|
|
437
|
-
this.
|
|
438
|
-
if (this.
|
|
436
|
+
if (defined(this._specularEnvironmentCubeMap)) {
|
|
437
|
+
this._specularEnvironmentCubeMap.update(frameState);
|
|
438
|
+
if (this._specularEnvironmentCubeMap.ready) {
|
|
439
439
|
this._specularEnvironmentMapLoaded = true;
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
const
|
|
444
|
-
!defined(this.
|
|
443
|
+
const recompileWithDefaultCubeMap =
|
|
444
|
+
!defined(this._specularEnvironmentCubeMap) &&
|
|
445
445
|
defined(frameState.specularEnvironmentMaps) &&
|
|
446
446
|
!this._useDefaultSpecularMaps;
|
|
447
|
-
const
|
|
447
|
+
const recompileWithoutDefaultCubeMap =
|
|
448
448
|
!defined(frameState.specularEnvironmentMaps) &&
|
|
449
449
|
this._useDefaultSpecularMaps;
|
|
450
450
|
|
|
@@ -458,13 +458,13 @@ ImageBasedLighting.prototype.update = function (frameState) {
|
|
|
458
458
|
|
|
459
459
|
this._shouldRegenerateShaders =
|
|
460
460
|
this._shouldRegenerateShaders ||
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
recompileWithDefaultCubeMap ||
|
|
462
|
+
recompileWithoutDefaultCubeMap ||
|
|
463
463
|
recompileWithDefaultSHCoeffs ||
|
|
464
464
|
recompileWithoutDefaultSHCoeffs;
|
|
465
465
|
|
|
466
466
|
this._useDefaultSpecularMaps =
|
|
467
|
-
!defined(this.
|
|
467
|
+
!defined(this._specularEnvironmentCubeMap) &&
|
|
468
468
|
defined(frameState.specularEnvironmentMaps);
|
|
469
469
|
this._useDefaultSphericalHarmonics =
|
|
470
470
|
!defined(this._sphericalHarmonicCoefficients) &&
|
|
@@ -503,9 +503,9 @@ ImageBasedLighting.prototype.isDestroyed = function () {
|
|
|
503
503
|
* @private
|
|
504
504
|
*/
|
|
505
505
|
ImageBasedLighting.prototype.destroy = function () {
|
|
506
|
-
this.
|
|
507
|
-
this.
|
|
508
|
-
this.
|
|
506
|
+
this._specularEnvironmentCubeMap =
|
|
507
|
+
this._specularEnvironmentCubeMap &&
|
|
508
|
+
this._specularEnvironmentCubeMap.destroy();
|
|
509
509
|
this._removeErrorListener =
|
|
510
510
|
this._removeErrorListener && this._removeErrorListener();
|
|
511
511
|
return destroyObject(this);
|
package/Source/Scene/Label.js
CHANGED
|
@@ -102,8 +102,8 @@ function parseFont(label) {
|
|
|
102
102
|
* @property {Cartesian2} [backgroundPadding=new Cartesian2(7, 5)] A {@link Cartesian2} Specifying the horizontal and vertical background padding in pixels.
|
|
103
103
|
* @property {Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} specifying the pixel offset in screen space from the origin of this label.
|
|
104
104
|
* @property {Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} specifying the 3D Cartesian offset applied to this label in eye coordinates.
|
|
105
|
-
* @property {HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.
|
|
106
|
-
* @property {VerticalOrigin} [verticalOrigin=VerticalOrigin.
|
|
105
|
+
* @property {HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.LEFT] A {@link HorizontalOrigin} specifying the horizontal origin of this label.
|
|
106
|
+
* @property {VerticalOrigin} [verticalOrigin=VerticalOrigin.BASELINE] A {@link VerticalOrigin} specifying the vertical origin of this label.
|
|
107
107
|
* @property {HeightReference} [heightReference=HeightReference.NONE] A {@link HeightReference} specifying the height reference of this label.
|
|
108
108
|
* @property {Color} [fillColor=Color.WHITE] A {@link Color} specifying the fill color of the label.
|
|
109
109
|
* @property {Color} [outlineColor=Color.BLACK] A {@link Color} specifying the outline color of the label.
|
package/Source/Scene/Material.js
CHANGED
|
@@ -34,6 +34,7 @@ import SlopeRampMaterial from "../Shaders/Materials/SlopeRampMaterial.js";
|
|
|
34
34
|
import StripeMaterial from "../Shaders/Materials/StripeMaterial.js";
|
|
35
35
|
import TextureMagnificationFilter from "../Renderer/TextureMagnificationFilter.js";
|
|
36
36
|
import TextureMinificationFilter from "../Renderer/TextureMinificationFilter.js";
|
|
37
|
+
import WaterMaskMaterial from "../Shaders/Materials/WaterMaskMaterial.js";
|
|
37
38
|
import WaterMaterial from "../Shaders/Materials/Water.js";
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -219,6 +220,11 @@ import WaterMaterial from "../Shaders/Materials/Water.js";
|
|
|
219
220
|
* <li><code>heights</code>: image of heights sorted from lowest to highest.</li>
|
|
220
221
|
* <li><code>colors</code>: image of colors at the corresponding heights.</li>
|
|
221
222
|
* </ul>
|
|
223
|
+
* <li>WaterMask</li>
|
|
224
|
+
* <ul>
|
|
225
|
+
* <li><code>waterColor</code>: diffuse color and alpha for the areas covered by water.</li>
|
|
226
|
+
* <li><code>landColor</code>: diffuse color and alpha for the areas covered by land.</li>
|
|
227
|
+
* </ul>
|
|
222
228
|
* </ul>
|
|
223
229
|
* </ul>
|
|
224
230
|
* </div>
|
|
@@ -233,7 +239,6 @@ import WaterMaterial from "../Shaders/Materials/Water.js";
|
|
|
233
239
|
* @param {TextureMinificationFilter} [options.minificationFilter=TextureMinificationFilter.LINEAR] The {@link TextureMinificationFilter} to apply to this material's textures.
|
|
234
240
|
* @param {TextureMagnificationFilter} [options.magnificationFilter=TextureMagnificationFilter.LINEAR] The {@link TextureMagnificationFilter} to apply to this material's textures.
|
|
235
241
|
* @param {object} options.fabric The fabric JSON used to generate the material.
|
|
236
|
-
*ructor
|
|
237
242
|
*
|
|
238
243
|
* @exception {DeveloperError} fabric: uniform has invalid type.
|
|
239
244
|
* @exception {DeveloperError} fabric: uniforms and materials cannot share the same property.
|
|
@@ -245,7 +250,6 @@ import WaterMaterial from "../Shaders/Materials/Water.js";
|
|
|
245
250
|
* @exception {DeveloperError} strict: shader source does not use material.
|
|
246
251
|
*
|
|
247
252
|
* @see {@link https://github.com/CesiumGS/cesium/wiki/Fabric|Fabric wiki page} for a more detailed options of Fabric.
|
|
248
|
-
*
|
|
249
253
|
* @demo {@link https://sandcastle.cesium.com/index.html?src=Materials.html|Cesium Sandcastle Materials Demo}
|
|
250
254
|
*
|
|
251
255
|
* @example
|
|
@@ -1739,4 +1743,22 @@ Material._materialCache.addMaterial(Material.ElevationBandType, {
|
|
|
1739
1743
|
translucent: true,
|
|
1740
1744
|
});
|
|
1741
1745
|
|
|
1746
|
+
/**
|
|
1747
|
+
* Gets the name of the water mask material.
|
|
1748
|
+
* @type {string}
|
|
1749
|
+
* @readonly
|
|
1750
|
+
*/
|
|
1751
|
+
Material.WaterMaskType = "WaterMask";
|
|
1752
|
+
Material._materialCache.addMaterial(Material.WaterMaskType, {
|
|
1753
|
+
fabric: {
|
|
1754
|
+
type: Material.WaterMaskType,
|
|
1755
|
+
source: WaterMaskMaterial,
|
|
1756
|
+
uniforms: {
|
|
1757
|
+
waterColor: new Color(1.0, 1.0, 1.0, 1.0),
|
|
1758
|
+
landColor: new Color(0.0, 0.0, 0.0, 0.0),
|
|
1759
|
+
},
|
|
1760
|
+
},
|
|
1761
|
+
translucent: false,
|
|
1762
|
+
});
|
|
1763
|
+
|
|
1742
1764
|
export default Material;
|
|
@@ -2,7 +2,7 @@ import combine from "../../Core/combine.js";
|
|
|
2
2
|
import defined from "../../Core/defined.js";
|
|
3
3
|
import ImageBasedLightingStageFS from "../../Shaders/Model/ImageBasedLightingStageFS.js";
|
|
4
4
|
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
5
|
-
import
|
|
5
|
+
import SpecularEnvironmentCubeMap from "../SpecularEnvironmentCubeMap.js";
|
|
6
6
|
|
|
7
7
|
const ImageBasedLightingPipelineStage = {
|
|
8
8
|
name: "ImageBasedLightingPipelineStage", // Helps with debugging
|
|
@@ -34,7 +34,7 @@ ImageBasedLightingPipelineStage.process = function (
|
|
|
34
34
|
ShaderDestination.FRAGMENT
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
if (
|
|
37
|
+
if (SpecularEnvironmentCubeMap.isSupported(frameState.context)) {
|
|
38
38
|
const addMatrix =
|
|
39
39
|
imageBasedLighting.useSphericalHarmonics ||
|
|
40
40
|
imageBasedLighting.useSpecularEnvironmentMaps ||
|
|
@@ -72,8 +72,8 @@ ImageBasedLightingPipelineStage.process = function (
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (
|
|
75
|
-
defined(imageBasedLighting.
|
|
76
|
-
imageBasedLighting.
|
|
75
|
+
defined(imageBasedLighting.specularEnvironmentCubeMap) &&
|
|
76
|
+
imageBasedLighting.specularEnvironmentCubeMap.ready
|
|
77
77
|
) {
|
|
78
78
|
shaderBuilder.addDefine(
|
|
79
79
|
"SPECULAR_IBL",
|
|
@@ -86,15 +86,10 @@ ImageBasedLightingPipelineStage.process = function (
|
|
|
86
86
|
ShaderDestination.FRAGMENT
|
|
87
87
|
);
|
|
88
88
|
shaderBuilder.addUniform(
|
|
89
|
-
"
|
|
89
|
+
"samplerCube",
|
|
90
90
|
"model_specularEnvironmentMaps",
|
|
91
91
|
ShaderDestination.FRAGMENT
|
|
92
92
|
);
|
|
93
|
-
shaderBuilder.addUniform(
|
|
94
|
-
"vec2",
|
|
95
|
-
"model_specularEnvironmentMapsSize",
|
|
96
|
-
ShaderDestination.FRAGMENT
|
|
97
|
-
);
|
|
98
93
|
shaderBuilder.addUniform(
|
|
99
94
|
"float",
|
|
100
95
|
"model_specularEnvironmentMapsMaximumLOD",
|
|
@@ -138,13 +133,10 @@ ImageBasedLightingPipelineStage.process = function (
|
|
|
138
133
|
return imageBasedLighting.sphericalHarmonicCoefficients;
|
|
139
134
|
},
|
|
140
135
|
model_specularEnvironmentMaps: function () {
|
|
141
|
-
return imageBasedLighting.
|
|
142
|
-
},
|
|
143
|
-
model_specularEnvironmentMapsSize: function () {
|
|
144
|
-
return imageBasedLighting.specularEnvironmentMapAtlas.texture.dimensions;
|
|
136
|
+
return imageBasedLighting.specularEnvironmentCubeMap.texture;
|
|
145
137
|
},
|
|
146
138
|
model_specularEnvironmentMapsMaximumLOD: function () {
|
|
147
|
-
return imageBasedLighting.
|
|
139
|
+
return imageBasedLighting.specularEnvironmentCubeMap.maximumMipmapLevel;
|
|
148
140
|
},
|
|
149
141
|
};
|
|
150
142
|
|
|
@@ -2251,7 +2251,7 @@ function updatePickIds(model) {
|
|
|
2251
2251
|
|
|
2252
2252
|
// Matrix3 is a row-major constructor.
|
|
2253
2253
|
// The same constructor in GLSL will produce the transpose of this.
|
|
2254
|
-
const yUpToZUp = new Matrix3(
|
|
2254
|
+
const yUpToZUp = new Matrix3(1, 0, 0, 0, 0, 1, 0, -1, 0);
|
|
2255
2255
|
|
|
2256
2256
|
function updateReferenceMatrices(model, frameState) {
|
|
2257
2257
|
const modelMatrix = defined(model._clampedModelMatrix)
|
|
@@ -11,6 +11,7 @@ import Matrix4 from "../Core/Matrix4.js";
|
|
|
11
11
|
import NearFarScalar from "../Core/NearFarScalar.js";
|
|
12
12
|
import SceneMode from "./SceneMode.js";
|
|
13
13
|
import SceneTransforms from "./SceneTransforms.js";
|
|
14
|
+
import SplitDirection from "./SplitDirection.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* <div class="notice">
|
|
@@ -117,6 +118,11 @@ function PointPrimitive(options, pointPrimitiveCollection) {
|
|
|
117
118
|
this._pointPrimitiveCollection = pointPrimitiveCollection;
|
|
118
119
|
this._dirty = false;
|
|
119
120
|
this._index = -1; //Used only by PointPrimitiveCollection
|
|
121
|
+
|
|
122
|
+
this._splitDirection = defaultValue(
|
|
123
|
+
options.splitDirection,
|
|
124
|
+
SplitDirection.NONE
|
|
125
|
+
);
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
const SHOW_INDEX = (PointPrimitive.SHOW_INDEX = 0);
|
|
@@ -129,7 +135,8 @@ const SCALE_BY_DISTANCE_INDEX = (PointPrimitive.SCALE_BY_DISTANCE_INDEX = 6);
|
|
|
129
135
|
const TRANSLUCENCY_BY_DISTANCE_INDEX = (PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX = 7);
|
|
130
136
|
const DISTANCE_DISPLAY_CONDITION_INDEX = (PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX = 8);
|
|
131
137
|
const DISABLE_DEPTH_DISTANCE_INDEX = (PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX = 9);
|
|
132
|
-
PointPrimitive.
|
|
138
|
+
const SPLIT_DIRECTION_INDEX = (PointPrimitive.SPLIT_DIRECTION_INDEX = 10);
|
|
139
|
+
PointPrimitive.NUMBER_OF_PROPERTIES = 11;
|
|
133
140
|
|
|
134
141
|
function makeDirty(pointPrimitive, propertyChanged) {
|
|
135
142
|
const pointPrimitiveCollection = pointPrimitive._pointPrimitiveCollection;
|
|
@@ -486,6 +493,24 @@ Object.defineProperties(PointPrimitive.prototype, {
|
|
|
486
493
|
}
|
|
487
494
|
},
|
|
488
495
|
},
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* The {@link SplitDirection} to apply to this point.
|
|
499
|
+
* @memberof PointPrimitive.prototype
|
|
500
|
+
* @type {SplitDirection}
|
|
501
|
+
* @default {@link SplitDirection.NONE}
|
|
502
|
+
*/
|
|
503
|
+
splitDirection: {
|
|
504
|
+
get: function () {
|
|
505
|
+
return this._splitDirection;
|
|
506
|
+
},
|
|
507
|
+
set: function (value) {
|
|
508
|
+
if (this._splitDirection !== value) {
|
|
509
|
+
this._splitDirection = value;
|
|
510
|
+
makeDirty(this, SPLIT_DIRECTION_INDEX);
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
},
|
|
489
514
|
});
|
|
490
515
|
|
|
491
516
|
PointPrimitive.prototype.getPickId = function (context) {
|
|
@@ -660,7 +685,8 @@ PointPrimitive.prototype.equals = function (other) {
|
|
|
660
685
|
this._distanceDisplayCondition,
|
|
661
686
|
other._distanceDisplayCondition
|
|
662
687
|
) &&
|
|
663
|
-
this._disableDepthTestDistance === other._disableDepthTestDistance
|
|
688
|
+
this._disableDepthTestDistance === other._disableDepthTestDistance &&
|
|
689
|
+
this._splitDirection === other._splitDirection)
|
|
664
690
|
);
|
|
665
691
|
};
|
|
666
692
|
|
|
@@ -38,6 +38,7 @@ const DISTANCE_DISPLAY_CONDITION_INDEX =
|
|
|
38
38
|
PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX;
|
|
39
39
|
const DISABLE_DEPTH_DISTANCE_INDEX =
|
|
40
40
|
PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX;
|
|
41
|
+
const SPLIT_DIRECTION_INDEX = PointPrimitive.SPLIT_DIRECTION_INDEX;
|
|
41
42
|
const NUMBER_OF_PROPERTIES = PointPrimitive.NUMBER_OF_PROPERTIES;
|
|
42
43
|
|
|
43
44
|
const attributeLocations = {
|
|
@@ -46,7 +47,7 @@ const attributeLocations = {
|
|
|
46
47
|
compressedAttribute0: 2, // color, outlineColor, pick color
|
|
47
48
|
compressedAttribute1: 3, // show, translucency by distance, some free space
|
|
48
49
|
scaleByDistance: 4,
|
|
49
|
-
|
|
50
|
+
distanceDisplayConditionAndDisableDepthAndSplitDirection: 5,
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
/**
|
|
@@ -492,8 +493,9 @@ function createVAF(context, numberOfPointPrimitives, buffersUsage) {
|
|
|
492
493
|
usage: buffersUsage[SCALE_BY_DISTANCE_INDEX],
|
|
493
494
|
},
|
|
494
495
|
{
|
|
495
|
-
index:
|
|
496
|
-
|
|
496
|
+
index:
|
|
497
|
+
attributeLocations.distanceDisplayConditionAndDisableDepthAndSplitDirection,
|
|
498
|
+
componentsPerAttribute: 4,
|
|
497
499
|
componentDatatype: ComponentDatatype.FLOAT,
|
|
498
500
|
usage: buffersUsage[DISTANCE_DISPLAY_CONDITION_INDEX],
|
|
499
501
|
},
|
|
@@ -665,7 +667,7 @@ function writeScaleByDistance(
|
|
|
665
667
|
writer(i, near, nearValue, far, farValue);
|
|
666
668
|
}
|
|
667
669
|
|
|
668
|
-
function
|
|
670
|
+
function writeDistanceDisplayConditionAndDepthDisableAndSplitDirection(
|
|
669
671
|
pointPrimitiveCollection,
|
|
670
672
|
context,
|
|
671
673
|
vafWriters,
|
|
@@ -673,7 +675,10 @@ function writeDistanceDisplayConditionAndDepthDisable(
|
|
|
673
675
|
) {
|
|
674
676
|
const i = pointPrimitive._index;
|
|
675
677
|
const writer =
|
|
676
|
-
vafWriters[
|
|
678
|
+
vafWriters[
|
|
679
|
+
attributeLocations
|
|
680
|
+
.distanceDisplayConditionAndDisableDepthAndSplitDirection
|
|
681
|
+
];
|
|
677
682
|
let near = 0.0;
|
|
678
683
|
let far = Number.MAX_VALUE;
|
|
679
684
|
|
|
@@ -697,7 +702,12 @@ function writeDistanceDisplayConditionAndDepthDisable(
|
|
|
697
702
|
}
|
|
698
703
|
}
|
|
699
704
|
|
|
700
|
-
|
|
705
|
+
let direction = 0.0;
|
|
706
|
+
const split = pointPrimitive.splitDirection;
|
|
707
|
+
if (defined(split)) {
|
|
708
|
+
direction = split;
|
|
709
|
+
}
|
|
710
|
+
writer(i, near, far, disableDepthTestDistance, direction);
|
|
701
711
|
}
|
|
702
712
|
|
|
703
713
|
function writePointPrimitive(
|
|
@@ -730,7 +740,7 @@ function writePointPrimitive(
|
|
|
730
740
|
vafWriters,
|
|
731
741
|
pointPrimitive
|
|
732
742
|
);
|
|
733
|
-
|
|
743
|
+
writeDistanceDisplayConditionAndDepthDisableAndSplitDirection(
|
|
734
744
|
pointPrimitiveCollection,
|
|
735
745
|
context,
|
|
736
746
|
vafWriters,
|
|
@@ -925,9 +935,12 @@ PointPrimitiveCollection.prototype.update = function (frameState) {
|
|
|
925
935
|
|
|
926
936
|
if (
|
|
927
937
|
properties[DISTANCE_DISPLAY_CONDITION_INDEX] ||
|
|
928
|
-
properties[DISABLE_DEPTH_DISTANCE_INDEX]
|
|
938
|
+
properties[DISABLE_DEPTH_DISTANCE_INDEX] ||
|
|
939
|
+
properties[SPLIT_DIRECTION_INDEX]
|
|
929
940
|
) {
|
|
930
|
-
writers.push(
|
|
941
|
+
writers.push(
|
|
942
|
+
writeDistanceDisplayConditionAndDepthDisableAndSplitDirection
|
|
943
|
+
);
|
|
931
944
|
}
|
|
932
945
|
|
|
933
946
|
const numWriters = writers.length;
|
|
@@ -12,7 +12,7 @@ import TextureWrap from "../Renderer/TextureWrap.js";
|
|
|
12
12
|
import PassThrough from "../Shaders/PostProcessStages/PassThrough.js";
|
|
13
13
|
import PostProcessStageLibrary from "./PostProcessStageLibrary.js";
|
|
14
14
|
import PostProcessStageTextureCache from "./PostProcessStageTextureCache.js";
|
|
15
|
-
import Tonemapper from "./Tonemapper.js";
|
|
15
|
+
import Tonemapper, { validateTonemapper } from "./Tonemapper.js";
|
|
16
16
|
|
|
17
17
|
const stackScratch = [];
|
|
18
18
|
|
|
@@ -41,11 +41,12 @@ function PostProcessStageCollection() {
|
|
|
41
41
|
// Some shaders, such as the atmosphere and ground atmosphere, output values slightly over 1.0.
|
|
42
42
|
this._autoExposureEnabled = false;
|
|
43
43
|
this._autoExposure = PostProcessStageLibrary.createAutoExposureStage();
|
|
44
|
+
this._exposure = 1.0;
|
|
44
45
|
this._tonemapping = undefined;
|
|
45
46
|
this._tonemapper = undefined;
|
|
46
47
|
|
|
47
|
-
// set tonemapper and tonemapping
|
|
48
|
-
this.tonemapper = Tonemapper.
|
|
48
|
+
// set tonemapper and tonemapping using the setter
|
|
49
|
+
this.tonemapper = Tonemapper.PBR_NEUTRAL;
|
|
49
50
|
|
|
50
51
|
const tonemapping = this._tonemapping;
|
|
51
52
|
|
|
@@ -313,11 +314,14 @@ Object.defineProperties(PostProcessStageCollection.prototype, {
|
|
|
313
314
|
},
|
|
314
315
|
|
|
315
316
|
/**
|
|
316
|
-
*
|
|
317
|
+
* Specifies the tonemapping algorithm used when rendering with high dynamic range.
|
|
318
|
+
* {@link https://sandcastle.cesium.com/?src=High%20Dynamic%20Range.html|Sandcastle Demo}
|
|
317
319
|
*
|
|
320
|
+
* @example viewer.scene.postProcessStages.tonemapper = Cesium.Tonemapper.ACES;
|
|
321
|
+
*
|
|
322
|
+
* @default Tonemapper.PBR_NEUTRAL
|
|
318
323
|
* @memberof PostProcessStageCollection.prototype
|
|
319
324
|
* @type {Tonemapper}
|
|
320
|
-
* @private
|
|
321
325
|
*/
|
|
322
326
|
tonemapper: {
|
|
323
327
|
get: function () {
|
|
@@ -328,7 +332,7 @@ Object.defineProperties(PostProcessStageCollection.prototype, {
|
|
|
328
332
|
return;
|
|
329
333
|
}
|
|
330
334
|
//>>includeStart('debug', pragmas.debug);
|
|
331
|
-
if (!
|
|
335
|
+
if (!validateTonemapper(value)) {
|
|
332
336
|
throw new DeveloperError("tonemapper was set to an invalid value.");
|
|
333
337
|
}
|
|
334
338
|
//>>includeEnd('debug');
|
|
@@ -339,26 +343,31 @@ Object.defineProperties(PostProcessStageCollection.prototype, {
|
|
|
339
343
|
}
|
|
340
344
|
|
|
341
345
|
const useAutoExposure = this._autoExposureEnabled;
|
|
342
|
-
let
|
|
346
|
+
let tonemapping;
|
|
343
347
|
|
|
344
348
|
switch (value) {
|
|
345
349
|
case Tonemapper.REINHARD:
|
|
346
|
-
|
|
350
|
+
tonemapping = PostProcessStageLibrary.createReinhardTonemappingStage(
|
|
347
351
|
useAutoExposure
|
|
348
352
|
);
|
|
349
353
|
break;
|
|
350
354
|
case Tonemapper.MODIFIED_REINHARD:
|
|
351
|
-
|
|
355
|
+
tonemapping = PostProcessStageLibrary.createModifiedReinhardTonemappingStage(
|
|
352
356
|
useAutoExposure
|
|
353
357
|
);
|
|
354
358
|
break;
|
|
355
359
|
case Tonemapper.FILMIC:
|
|
356
|
-
|
|
360
|
+
tonemapping = PostProcessStageLibrary.createFilmicTonemappingStage(
|
|
361
|
+
useAutoExposure
|
|
362
|
+
);
|
|
363
|
+
break;
|
|
364
|
+
case Tonemapper.PBR_NEUTRAL:
|
|
365
|
+
tonemapping = PostProcessStageLibrary.createPbrNeutralTonemappingStage(
|
|
357
366
|
useAutoExposure
|
|
358
367
|
);
|
|
359
368
|
break;
|
|
360
369
|
default:
|
|
361
|
-
|
|
370
|
+
tonemapping = PostProcessStageLibrary.createAcesTonemappingStage(
|
|
362
371
|
useAutoExposure
|
|
363
372
|
);
|
|
364
373
|
break;
|
|
@@ -366,22 +375,43 @@ Object.defineProperties(PostProcessStageCollection.prototype, {
|
|
|
366
375
|
|
|
367
376
|
if (useAutoExposure) {
|
|
368
377
|
const autoexposure = this._autoExposure;
|
|
369
|
-
|
|
378
|
+
tonemapping.uniforms.autoExposure = function () {
|
|
370
379
|
return autoexposure.outputTexture;
|
|
371
380
|
};
|
|
381
|
+
} else {
|
|
382
|
+
tonemapping.uniforms.exposure = this._exposure;
|
|
372
383
|
}
|
|
373
384
|
|
|
374
385
|
this._tonemapper = value;
|
|
375
|
-
this._tonemapping =
|
|
386
|
+
this._tonemapping = tonemapping;
|
|
376
387
|
|
|
377
388
|
if (defined(this._stageNames)) {
|
|
378
|
-
this._stageNames[
|
|
379
|
-
|
|
389
|
+
this._stageNames[tonemapping.name] = tonemapping;
|
|
390
|
+
tonemapping._textureCache = this._textureCache;
|
|
380
391
|
}
|
|
381
392
|
|
|
382
393
|
this._textureCacheDirty = true;
|
|
383
394
|
},
|
|
384
395
|
},
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Control the exposure when HDR is on. Less than 1.0 makes the tonemapping darker while greater than 1.0 makes it brighter.
|
|
399
|
+
*
|
|
400
|
+
* @example viewer.scene.postProcessStages.exposure = 1.0;
|
|
401
|
+
*
|
|
402
|
+
* @default 1.0
|
|
403
|
+
* @memberof PostProcessStageCollection.prototype
|
|
404
|
+
* @type {number}
|
|
405
|
+
*/
|
|
406
|
+
exposure: {
|
|
407
|
+
get: function () {
|
|
408
|
+
return this._exposure;
|
|
409
|
+
},
|
|
410
|
+
set: function (value) {
|
|
411
|
+
this._tonemapping.uniforms.exposure = value;
|
|
412
|
+
this._exposure = value;
|
|
413
|
+
},
|
|
414
|
+
},
|
|
385
415
|
});
|
|
386
416
|
|
|
387
417
|
function removeStages(collection) {
|
|
@@ -14,6 +14,7 @@ import DepthOfField from "../Shaders/PostProcessStages/DepthOfField.js";
|
|
|
14
14
|
import DepthView from "../Shaders/PostProcessStages/DepthView.js";
|
|
15
15
|
import EdgeDetection from "../Shaders/PostProcessStages/EdgeDetection.js";
|
|
16
16
|
import FilmicTonemapping from "../Shaders/PostProcessStages/FilmicTonemapping.js";
|
|
17
|
+
import PbrNeutralTonemapping from "../Shaders/PostProcessStages/PbrNeutralTonemapping.js";
|
|
17
18
|
import FXAA from "../Shaders/PostProcessStages/FXAA.js";
|
|
18
19
|
import GaussianBlur1D from "../Shaders/PostProcessStages/GaussianBlur1D.js";
|
|
19
20
|
import LensFlare from "../Shaders/PostProcessStages/LensFlare.js";
|
|
@@ -669,6 +670,7 @@ PostProcessStageLibrary.createAcesTonemappingStage = function (
|
|
|
669
670
|
fragmentShader: fs,
|
|
670
671
|
uniforms: {
|
|
671
672
|
autoExposure: undefined,
|
|
673
|
+
exposure: 1.0,
|
|
672
674
|
},
|
|
673
675
|
});
|
|
674
676
|
};
|
|
@@ -689,6 +691,28 @@ PostProcessStageLibrary.createFilmicTonemappingStage = function (
|
|
|
689
691
|
fragmentShader: fs,
|
|
690
692
|
uniforms: {
|
|
691
693
|
autoExposure: undefined,
|
|
694
|
+
exposure: 1.0,
|
|
695
|
+
},
|
|
696
|
+
});
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Creates a post-process stage that applies filmic tonemapping operator.
|
|
701
|
+
* @param {boolean} useAutoExposure Whether or not to use auto-exposure.
|
|
702
|
+
* @return {PostProcessStage} A post-process stage that applies filmic tonemapping operator.
|
|
703
|
+
* @private
|
|
704
|
+
*/
|
|
705
|
+
PostProcessStageLibrary.createPbrNeutralTonemappingStage = function (
|
|
706
|
+
useAutoExposure
|
|
707
|
+
) {
|
|
708
|
+
let fs = useAutoExposure ? "#define AUTO_EXPOSURE\n" : "";
|
|
709
|
+
fs += PbrNeutralTonemapping;
|
|
710
|
+
return new PostProcessStage({
|
|
711
|
+
name: "czm_pbr_neutral",
|
|
712
|
+
fragmentShader: fs,
|
|
713
|
+
uniforms: {
|
|
714
|
+
autoExposure: undefined,
|
|
715
|
+
exposure: 1.0,
|
|
692
716
|
},
|
|
693
717
|
});
|
|
694
718
|
};
|
|
@@ -709,6 +733,7 @@ PostProcessStageLibrary.createReinhardTonemappingStage = function (
|
|
|
709
733
|
fragmentShader: fs,
|
|
710
734
|
uniforms: {
|
|
711
735
|
autoExposure: undefined,
|
|
736
|
+
exposure: 1.0,
|
|
712
737
|
},
|
|
713
738
|
});
|
|
714
739
|
};
|
|
@@ -730,6 +755,7 @@ PostProcessStageLibrary.createModifiedReinhardTonemappingStage = function (
|
|
|
730
755
|
uniforms: {
|
|
731
756
|
white: Color.WHITE,
|
|
732
757
|
autoExposure: undefined,
|
|
758
|
+
exposure: 1.0,
|
|
733
759
|
},
|
|
734
760
|
});
|
|
735
761
|
};
|