diff --git a/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js b/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js index f3897e2ff0c..1469d31fe1a 100644 --- a/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js +++ b/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js @@ -33,7 +33,7 @@ import ConvolveSpecularMapVS from "../Shaders/ConvolveSpecularMapVS.js"; * @typedef {object} DynamicEnvironmentMapManager.ConstructorOptions * Options for the DynamicEnvironmentMapManager constructor * @property {boolean} [enabled=true] If true, the environment map and related properties will continue to update. - * @property {number} [mipmapLevels=10] The number of mipmap levels to generate for specular maps. More mipmap levels will produce a higher resolution specular reflection. + * @property {number} [mipmapLevels=7] The number of mipmap levels to generate for specular maps. More mipmap levels will produce a higher resolution specular reflection. * @property {number} [maximumSecondsDifference=3600] The maximum amount of elapsed seconds before a new environment map is created. * @property {number} [maximumPositionEpsilon=1000] The maximum difference in position before a new environment map is created, in meters. Small differences in position will not visibly affect results. * @property {number} [atmosphereScatteringIntensity=2.0] The intensity of the scattered light emitted from the atmosphere. This should be adjusted relative to the value of {@link Scene.light} intensity. @@ -77,11 +77,12 @@ function DynamicEnvironmentMapManager(options) { this._sphericalHarmonicCoefficientsDirty = false; this._shouldRegenerateShaders = false; + this._shouldReset = false; options = defaultValue(options, defaultValue.EMPTY_OBJECT); const mipmapLevels = Math.min( - defaultValue(options.mipmapLevels, 10), + defaultValue(options.mipmapLevels, 7), Math.log2(ContextLimits.maximumCubeMapSize), ); @@ -251,7 +252,7 @@ Object.defineProperties(DynamicEnvironmentMapManager.prototype, { } this._position = Cartesian3.clone(value, this._position); - this.reset(); + this._shouldReset = true; }, }, @@ -345,7 +346,7 @@ DynamicEnvironmentMapManager._updateCommandQueue = (frameState) => { DynamicEnvironmentMapManager._activeComputeCommandCount < DynamicEnvironmentMapManager._maximumComputeCommandCount ) { - if (command.canceled) { + if (command.owner.isDestroyed() || command.canceled) { command = DynamicEnvironmentMapManager._nextFrameCommandQueue.shift(); continue; } @@ -354,6 +355,10 @@ DynamicEnvironmentMapManager._updateCommandQueue = (frameState) => { DynamicEnvironmentMapManager._activeComputeCommandCount++; command = DynamicEnvironmentMapManager._nextFrameCommandQueue.shift(); } + + if (defined(command)) { + DynamicEnvironmentMapManager._nextFrameCommandQueue.push(command); + } } }; @@ -398,7 +403,6 @@ DynamicEnvironmentMapManager.prototype.reset = function () { for (let i = 0; i < length; ++i) { if (defined(this._radianceMapComputeCommands[i])) { this._radianceMapComputeCommands[i].canceled = true; - DynamicEnvironmentMapManager._activeComputeCommandCount--; } this._radianceMapComputeCommands[i] = undefined; } @@ -407,19 +411,19 @@ DynamicEnvironmentMapManager.prototype.reset = function () { for (let i = 0; i < length; ++i) { if (defined(this._convolutionComputeCommands[i])) { this._convolutionComputeCommands[i].canceled = true; - DynamicEnvironmentMapManager._activeComputeCommandCount--; } this._convolutionComputeCommands[i] = undefined; } if (defined(this._irradianceComputeCommand)) { this._irradianceComputeCommand.canceled = true; - DynamicEnvironmentMapManager._activeComputeCommandCount--; this._irradianceComputeCommand = undefined; } this._radianceMapDirty = true; this._radianceCommandsDirty = true; + this._convolutionsCommandsDirty = false; + this._irradianceCommandDirty = false; }; const scratchPackedAtmosphere = new Cartesian3(); @@ -539,7 +543,8 @@ function updateRadianceMap(manager, frameState) { let i = 0; for (const face of CubeMap.faceNames()) { let texture = manager._radianceMapTextures[i]; - if (defined(texture)) { + // Destroy any existing textures that have no yet been cleaned up + if (defined(texture) && !texture.isDestroyed()) { texture.destroy(); } @@ -570,36 +575,35 @@ function updateRadianceMap(manager, frameState) { ); }, }, - persists: true, owner: manager, - postExecute: () => { - const commands = manager._radianceMapComputeCommands; - if (!defined(commands[index])) { - // This command was cancelled - return; - } - commands[index] = undefined; - - const framebuffer = new Framebuffer({ - context: context, - colorTextures: [manager._radianceMapTextures[index]], - destroyAttachments: false, - }); - - // Copy the output texture into the corresponding cubemap face - framebuffer._bind(); - manager._radianceCubeMap[face].copyFromFramebuffer(); - framebuffer._unBind(); - framebuffer.destroy(); - + }); + command.postExecute = () => { + if (manager.isDestroyed() || command.canceled) { DynamicEnvironmentMapManager._activeComputeCommandCount--; + return; + } - if (!commands.some(defined)) { - manager._convolutionsCommandsDirty = true; - manager._shouldRegenerateShaders = true; - } - }, - }); + const commands = manager._radianceMapComputeCommands; + commands[index] = undefined; + + const framebuffer = new Framebuffer({ + context: context, + colorTextures: [manager._radianceMapTextures[index]], + }); + + // Copy the output texture into the corresponding cubemap face + framebuffer._bind(); + manager._radianceCubeMap[face].copyFromFramebuffer(); + framebuffer._unBind(); + framebuffer.destroy(); + + DynamicEnvironmentMapManager._activeComputeCommandCount--; + + if (!commands.some(defined)) { + manager._convolutionsCommandsDirty = true; + manager._shouldRegenerateShaders = true; + } + }; manager._radianceMapComputeCommands[i] = command; DynamicEnvironmentMapManager._queueCommand(command, frameState); @@ -626,32 +630,48 @@ function updateSpecularMaps(manager, frameState) { const context = frameState.context; let facesCopied = 0; - const getPostExecute = (index, texture, face, level) => () => { - // Copy output texture to corresponding face and mipmap level - const commands = manager._convolutionComputeCommands; - if (!defined(commands[index]) || commands[index].canceled) { - // This command was cancelled + const getPostExecute = (command, index, texture, face, level) => () => { + if (manager.isDestroyed() || command.canceled) { + DynamicEnvironmentMapManager._activeComputeCommandCount--; return; } + + // Copy output texture to corresponding face and mipmap level + const commands = manager._convolutionComputeCommands; commands[index] = undefined; radianceCubeMap.copyFace(frameState, texture, face, level); facesCopied++; DynamicEnvironmentMapManager._activeComputeCommandCount--; - // All faces and levels have been copied - if (facesCopied === manager._specularMapTextures.length) { + texture.destroy(); + manager._specularMapTextures[index] = undefined; + + // All faces for each mipmap level have been copied + const length = manager._specularMapTextures.length; + if (facesCopied >= length) { manager._irradianceCommandDirty = true; radianceCubeMap.sampler = new Sampler({ minificationFilter: TextureMinificationFilter.LINEAR_MIPMAP_LINEAR, }); + manager._shouldRegenerateShaders = true; + + // Cleanup shared resources + manager._va.destroy(); + manager._va = undefined; + manager._convolveSP.destroy(); + manager._convolveSP = undefined; } }; let index = 0; for (let level = 1; level < mipmapLevels; ++level) { for (const face of CubeMap.faceNames()) { + if (defined(manager._specularMapTextures[index])) { + manager._specularMapTextures[index].destroy(); + } + const texture = (manager._specularMapTextures[index] = new Texture({ context: context, width: width, @@ -683,6 +703,8 @@ function updateSpecularMaps(manager, frameState) { shaderProgram: shaderProgram, vertexArray: vertexArray, outputTexture: texture, + // Persist so we can use a shared shader progam and vertex array across all commands + // Shared resources are instead destroyed in postExecute persists: true, owner: manager, uniformMap: { @@ -692,8 +714,14 @@ function updateSpecularMaps(manager, frameState) { return CubeMap.getDirection(face, scratchCartesian); }, }, - postExecute: getPostExecute(index, texture, face, level), }); + command.postExecute = getPostExecute( + command, + index, + texture, + face, + level, + ); manager._convolutionComputeCommands[index] = command; DynamicEnvironmentMapManager._queueCommand(command, frameState); ++index; @@ -717,17 +745,19 @@ function updateIrradianceResources(manager, frameState) { const dimensions = irradianceTextureDimensions; let texture = manager._irradianceMapTexture; - if (!defined(texture)) { - texture = new Texture({ - context: context, - width: dimensions.x, - height: dimensions.y, - pixelDatatype: PixelDatatype.FLOAT, - pixelFormat: PixelFormat.RGBA, - }); - manager._irradianceMapTexture = texture; + if (defined(texture) && !texture.isDestroyed()) { + texture.destroy(); } + texture = new Texture({ + context: context, + width: dimensions.x, + height: dimensions.y, + pixelDatatype: PixelDatatype.FLOAT, + pixelFormat: PixelFormat.RGBA, + }); + manager._irradianceMapTexture = texture; + let fs = manager._irradianceMapFS; if (!defined(fs)) { fs = new ShaderSource({ @@ -739,21 +769,25 @@ function updateIrradianceResources(manager, frameState) { const command = new ComputeCommand({ fragmentShaderSource: fs, outputTexture: texture, + owner: manager, uniformMap: { u_radianceMap: () => manager._radianceCubeMap ?? context.defaultTexture, }, - postExecute: () => { - if (!defined(manager._irradianceComputeCommand)) { - // This command was cancelled - return; - } - manager._irradianceTextureDirty = false; - manager._irradianceComputeCommand = undefined; - manager._sphericalHarmonicCoefficientsDirty = true; + }); + command.postExecute = () => { + if (manager.isDestroyed() || command.canceled) { DynamicEnvironmentMapManager._activeComputeCommandCount--; - }, - }); + return; + } + manager._irradianceTextureDirty = false; + manager._irradianceComputeCommand = undefined; + manager._sphericalHarmonicCoefficientsDirty = true; + manager._irradianceMapFS = undefined; + + DynamicEnvironmentMapManager._activeComputeCommandCount--; + }; + manager._irradianceComputeCommand = command; DynamicEnvironmentMapManager._queueCommand(command, frameState); manager._irradianceTextureDirty = true; @@ -768,6 +802,11 @@ function updateIrradianceResources(manager, frameState) { function updateSphericalHarmonicCoefficients(manager, frameState) { const context = frameState.context; + if (!defined(manager._irradianceMapTexture)) { + // Operation was canceled + return; + } + const framebuffer = new Framebuffer({ context: context, colorTextures: [manager._irradianceMapTexture], @@ -793,6 +832,8 @@ function updateSphericalHarmonicCoefficients(manager, frameState) { } framebuffer.destroy(); + manager._irradianceMapTexture.destroy(); + manager._irradianceMapTexture = undefined; manager._shouldRegenerateShaders = true; } @@ -834,9 +875,11 @@ DynamicEnvironmentMapManager.prototype.update = function (frameState) { this.maximumSecondsDifference, )); - if (regenerateEnvironmentMap) { + if (this._shouldReset || regenerateEnvironmentMap) { this.reset(); + this._shouldReset = false; this._lastTime = JulianDate.clone(frameState.time, this._lastTime); + return; } if (this._radianceMapDirty) { @@ -910,19 +953,33 @@ DynamicEnvironmentMapManager.prototype.destroy = function () { length = this._radianceMapTextures.length; for (let i = 0; i < length; ++i) { this._radianceMapTextures[i] = - this._radianceMapTextures[i] && this._radianceMapTextures[i].destroy(); + this._radianceMapTextures[i] && + !this._radianceMapTextures[i].isDestroyed() && + this._radianceMapTextures[i].destroy(); } length = this._specularMapTextures.length; for (let i = 0; i < length; ++i) { this._specularMapTextures[i] = - this._specularMapTextures[i] && this._specularMapTextures[i].destroy(); + this._specularMapTextures[i] && + !this._specularMapTextures[i].isDestroyed() && + this._specularMapTextures[i].destroy(); } this._radianceCubeMap = this._radianceCubeMap && this._radianceCubeMap.destroy(); this._irradianceMapTexture = - this._irradianceMapTexture && this._irradianceMapTexture.destroy(); + this._irradianceMapTexture && + !this._irradianceMapTexture.isDestroyed() && + this._irradianceMapTexture.destroy(); + + if (defined(this._va)) { + this._va.destroy(); + } + + if (defined(this._convolveSP)) { + this._convolveSP.destroy(); + } return destroyObject(this); }; diff --git a/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js b/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js index a05b1be4dc2..2ba0406a0db 100644 --- a/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js +++ b/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js @@ -487,6 +487,8 @@ describe( }), ); expect(root.contentFailed).toBeTrue(); + + await Cesium3DTilesTester.waitForTilesLoaded(scene, tileset); }); it("handles failed tile requests", async function () { diff --git a/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js b/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js index 0783774b748..f00e7b67d02 100644 --- a/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js +++ b/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js @@ -202,7 +202,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.13869766891002655, 0.17165547609329224, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -210,7 +210,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.11016352474689484, 0.15077166259288788, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -218,7 +218,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0013909616973251104, -0.00141593546140939, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -226,7 +226,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00016706169117242098, 0.00006681153899990022, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -288,7 +288,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.03880387544631958, 0.050429586321115494, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -296,7 +296,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.00047372994595207274, 0.011921915225684643, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -304,7 +304,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0005534383235499263, -0.001172146643511951, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -312,22 +312,22 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00010014028521254659, -0.0005452318582683802, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].y).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].z).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].x).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].y).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].z).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].x).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].y).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].z).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].x).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].y).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].z).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[7].x).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[7].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[7].y).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[7].z).toBeGreaterThan(0.0); @@ -374,7 +374,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.3365404009819031, 0.3376566469669342, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -382,7 +382,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.25208908319473267, 0.25084879994392395, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -390,7 +390,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0009837104007601738, 0.0008832928724586964, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( @@ -399,7 +399,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0015308377332985401, -0.0012394117657095194, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeGreaterThan(0.0); @@ -460,7 +460,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.04265068098902702, 0.04163559526205063, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -468,7 +468,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.023243442177772522, 0.025639381259679794, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -476,7 +476,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0033528741914778948, -0.0031588575802743435, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -484,7 +484,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.007121194154024124, 0.005899451207369566, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeGreaterThan(0.0); @@ -545,7 +545,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0054358793422579765, 0.0027179396711289883, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -553,7 +553,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0037772462237626314, 0.0018886231118813157, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -561,7 +561,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000007333524990826845, -0.0000036667624954134226, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -569,7 +569,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.000008501945558236912, 0.000004250972779118456, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -633,7 +633,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.04545757919549942, 0.02313476987183094, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -641,7 +641,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.004114487674087286, -0.0017214358085766435, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -649,7 +649,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0008244783966802061, -0.00026270488160662353, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -657,16 +657,16 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000012375472579151392, 0.0005265426589176059, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].y).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].z).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].x).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].y).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].z).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].x).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].y).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].z).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].x).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].y).toBeGreaterThan(0.0); @@ -715,7 +715,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.039464931935071945, 0.047749463468790054, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -723,7 +723,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.031872138381004333, 0.04223670810461044, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -731,7 +731,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0008044499554671347, -0.0008345510577782989, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -739,7 +739,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000017321406630799174, -0.000006108442903496325, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -798,7 +798,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.21367456018924713, 0.23666927218437195, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -806,7 +806,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.15787045657634735, 0.19085952639579773, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -814,7 +814,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0010327763156965375, -0.001100384397432208, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -822,7 +822,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00028964842204004526, 0.00021805899450555444, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -881,7 +881,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.07419705390930176, 0.09077795594930649, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -889,7 +889,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.06336799263954163, 0.08409948647022247, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -897,7 +897,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0006284310948103666, -0.000669674074742943, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -905,7 +905,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.000024254957679659128, 0.00004792874096892774, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -964,7 +964,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.13499368727207184, 0.13499368727207184, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -972,7 +972,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.1081928238272667, 0.1081928238272667, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -980,7 +980,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0013909616973251104, -0.00141593546140939, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -988,7 +988,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00016706169117242098, 0.00006681153899990022, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -1047,7 +1047,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.11958353966474533, 0.15991388261318207, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -1055,7 +1055,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.11915278434753418, 0.15629366040229797, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -1063,7 +1063,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0016134318429976702, -0.0015525781782343984, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -1071,16 +1071,16 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.000019326049368828535, -0.000023931264877319336, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[4].y).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[4].y).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].z).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[5].x).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].y).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].z).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].y).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].z).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].y).toBeLessThan(0.0); @@ -1130,7 +1130,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.1812949925661087, 0.19759616255760193, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -1138,7 +1138,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.09013032913208008, 0.13857196271419525, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -1146,7 +1146,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000895244418643415, -0.0011140345595777035, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -1154,7 +1154,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0004962628008797765, 0.0002673182752914727, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0);