50260bb9452ec1a9cef29f506eb070ed2f26e7aa6c9b95319eaf17ac551751eb.json 49 KB

1
  1. {"ast":null,"code":"import { Observable } from \"../Misc/observable.js\";\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { BaseTexture } from \"../Materials/Textures/baseTexture.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { MirrorTexture } from \"../Materials/Textures/mirrorTexture.js\";\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture.js\";\nimport { BackgroundMaterial } from \"../Materials/Background/backgroundMaterial.js\";\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder.js\";\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder.js\";\nimport { Plane } from \"../Maths/math.plane.js\";\n/**\n * The EnvironmentHelper class can be used to add a fully featured non-expensive background to your scene.\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\n * It also helps with the default setup of your ImageProcessingConfiguration.\n */\nexport class EnvironmentHelper {\n /**\n * Creates the default options for the helper.\n * @param scene The scene the environment helper belongs to.\n * @returns default options for the helper.\n */\n static _GetDefaultOptions(scene) {\n return {\n createGround: true,\n groundSize: 15,\n groundTexture: this._GroundTextureCDNUrl,\n groundColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\n groundOpacity: 0.9,\n enableGroundShadow: true,\n groundShadowLevel: 0.5,\n enableGroundMirror: false,\n groundMirrorSizeRatio: 0.3,\n groundMirrorBlurKernel: 64,\n groundMirrorAmount: 1,\n groundMirrorFresnelWeight: 1,\n groundMirrorFallOffDistance: 0,\n groundMirrorTextureType: 0,\n groundYBias: 0.00001,\n createSkybox: true,\n skyboxSize: 20,\n skyboxTexture: this._SkyboxTextureCDNUrl,\n skyboxColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\n backgroundYRotation: 0,\n sizeAuto: true,\n rootPosition: Vector3.Zero(),\n setupImageProcessing: true,\n environmentTexture: this._EnvironmentTextureCDNUrl,\n cameraExposure: 0.8,\n cameraContrast: 1.2,\n toneMappingEnabled: true\n };\n }\n /**\n * Gets the root mesh created by the helper.\n */\n get rootMesh() {\n return this._rootMesh;\n }\n /**\n * Gets the skybox created by the helper.\n */\n get skybox() {\n return this._skybox;\n }\n /**\n * Gets the skybox texture created by the helper.\n */\n get skyboxTexture() {\n return this._skyboxTexture;\n }\n /**\n * Gets the skybox material created by the helper.\n */\n get skyboxMaterial() {\n return this._skyboxMaterial;\n }\n /**\n * Gets the ground mesh created by the helper.\n */\n get ground() {\n return this._ground;\n }\n /**\n * Gets the ground texture created by the helper.\n */\n get groundTexture() {\n return this._groundTexture;\n }\n /**\n * Gets the ground mirror created by the helper.\n */\n get groundMirror() {\n return this._groundMirror;\n }\n /**\n * Gets the ground mirror render list to helps pushing the meshes\n * you wish in the ground reflection.\n */\n get groundMirrorRenderList() {\n if (this._groundMirror) {\n return this._groundMirror.renderList;\n }\n return null;\n }\n /**\n * Gets the ground material created by the helper.\n */\n get groundMaterial() {\n return this._groundMaterial;\n }\n /**\n * constructor\n * @param options Defines the options we want to customize the helper\n * @param scene The scene to add the material to\n */\n constructor(options, scene) {\n this._errorHandler = (message, exception) => {\n this.onErrorObservable.notifyObservers({\n message: message,\n exception: exception\n });\n };\n this._options = {\n ...EnvironmentHelper._GetDefaultOptions(scene),\n ...options\n };\n this._scene = scene;\n this.onErrorObservable = new Observable();\n this._setupBackground();\n this._setupImageProcessing();\n }\n /**\n * Updates the environment according to the new options\n * @param options options to configure the helper (IEnvironmentHelperOptions)\n */\n updateOptions(options) {\n const newOptions = {\n ...this._options,\n ...options\n };\n if (this._ground && !newOptions.createGround) {\n this._ground.dispose();\n this._ground = null;\n }\n if (this._groundMaterial && !newOptions.createGround) {\n this._groundMaterial.dispose();\n this._groundMaterial = null;\n }\n if (this._groundTexture) {\n if (this._options.groundTexture != newOptions.groundTexture) {\n this._groundTexture.dispose();\n this._groundTexture = null;\n }\n }\n if (this._skybox && !newOptions.createSkybox) {\n this._skybox.dispose();\n this._skybox = null;\n }\n if (this._skyboxMaterial && !newOptions.createSkybox) {\n this._skyboxMaterial.dispose();\n this._skyboxMaterial = null;\n }\n if (this._skyboxTexture) {\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\n this._skyboxTexture.dispose();\n this._skyboxTexture = null;\n }\n }\n if (this._groundMirror && !newOptions.enableGroundMirror) {\n this._groundMirror.dispose();\n this._groundMirror = null;\n }\n if (this._scene.environmentTexture) {\n if (this._options.environmentTexture != newOptions.environmentTexture) {\n this._scene.environmentTexture.dispose();\n }\n }\n this._options = newOptions;\n this._setupBackground();\n this._setupImageProcessing();\n }\n /**\n * Sets the primary color of all the available elements.\n * @param color the main color to affect to the ground and the background\n */\n setMainColor(color) {\n if (this.groundMaterial) {\n this.groundMaterial.primaryColor = color;\n }\n if (this.skyboxMaterial) {\n this.skyboxMaterial.primaryColor = color;\n }\n if (this.groundMirror) {\n this.groundMirror.clearColor = new Color4(color.r, color.g, color.b, 1.0);\n }\n }\n /**\n * Setup the image processing according to the specified options.\n */\n _setupImageProcessing() {\n if (this._options.setupImageProcessing) {\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\n this._setupEnvironmentTexture();\n }\n }\n /**\n * Setup the environment texture according to the specified options.\n */\n _setupEnvironmentTexture() {\n if (this._scene.environmentTexture) {\n return;\n }\n if (this._options.environmentTexture instanceof BaseTexture) {\n this._scene.environmentTexture = this._options.environmentTexture;\n return;\n }\n const environmentTexture = CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\n this._scene.environmentTexture = environmentTexture;\n }\n /**\n * Setup the background according to the specified options.\n */\n _setupBackground() {\n if (!this._rootMesh) {\n this._rootMesh = new Mesh(\"BackgroundHelper\", this._scene);\n }\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\n const sceneSize = this._getSceneSize();\n if (this._options.createGround) {\n this._setupGround(sceneSize);\n this._setupGroundMaterial();\n this._setupGroundDiffuseTexture();\n if (this._options.enableGroundMirror) {\n this._setupGroundMirrorTexture(sceneSize);\n }\n this._setupMirrorInGroundMaterial();\n }\n if (this._options.createSkybox) {\n this._setupSkybox(sceneSize);\n this._setupSkyboxMaterial();\n this._setupSkyboxReflectionTexture();\n }\n this._rootMesh.position.x = sceneSize.rootPosition.x;\n this._rootMesh.position.z = sceneSize.rootPosition.z;\n this._rootMesh.position.y = sceneSize.rootPosition.y;\n }\n /**\n * Get the scene sizes according to the setup.\n * @returns the different ground and skybox sizes.\n */\n _getSceneSize() {\n let groundSize = this._options.groundSize;\n let skyboxSize = this._options.skyboxSize;\n let rootPosition = this._options.rootPosition;\n if (!this._scene.meshes || this._scene.meshes.length === 1) {\n // 1 only means the root of the helper.\n return {\n groundSize,\n skyboxSize,\n rootPosition\n };\n }\n const sceneExtends = this._scene.getWorldExtends(mesh => {\n return mesh !== this._ground && mesh !== this._rootMesh && mesh !== this._skybox;\n });\n const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\n if (this._options.sizeAuto) {\n if (this._scene.activeCamera instanceof ArcRotateCamera && this._scene.activeCamera.upperRadiusLimit) {\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\n skyboxSize = groundSize;\n }\n const sceneDiagonalLenght = sceneDiagonal.length();\n if (sceneDiagonalLenght > groundSize) {\n groundSize = sceneDiagonalLenght * 2;\n skyboxSize = groundSize;\n }\n // 10 % bigger.\n groundSize *= 1.1;\n skyboxSize *= 1.5;\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\n }\n return {\n groundSize,\n skyboxSize,\n rootPosition\n };\n }\n /**\n * Setup the ground according to the specified options.\n * @param sceneSize\n */\n _setupGround(sceneSize) {\n if (!this._ground || this._ground.isDisposed()) {\n this._ground = CreatePlane(\"BackgroundPlane\", {\n size: sceneSize.groundSize\n }, this._scene);\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\n this._ground.isPickable = false;\n this._ground.parent = this._rootMesh;\n this._ground.onDisposeObservable.add(() => {\n this._ground = null;\n });\n }\n this._ground.receiveShadows = this._options.enableGroundShadow;\n }\n /**\n * Setup the ground material according to the specified options.\n */\n _setupGroundMaterial() {\n if (!this._groundMaterial) {\n this._groundMaterial = new BackgroundMaterial(\"BackgroundPlaneMaterial\", this._scene);\n }\n this._groundMaterial.alpha = this._options.groundOpacity;\n this._groundMaterial.alphaMode = 8;\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\n this._groundMaterial.primaryColor = this._options.groundColor;\n this._groundMaterial.useRGBColor = false;\n this._groundMaterial.enableNoise = true;\n if (this._ground) {\n this._ground.material = this._groundMaterial;\n }\n }\n /**\n * Setup the ground diffuse texture according to the specified options.\n */\n _setupGroundDiffuseTexture() {\n if (!this._groundMaterial) {\n return;\n }\n if (this._groundTexture) {\n return;\n }\n if (this._options.groundTexture instanceof BaseTexture) {\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\n return;\n }\n this._groundTexture = new Texture(this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\n this._groundTexture.gammaSpace = false;\n this._groundTexture.hasAlpha = true;\n this._groundMaterial.diffuseTexture = this._groundTexture;\n }\n /**\n * Setup the ground mirror texture according to the specified options.\n * @param sceneSize\n */\n _setupGroundMirrorTexture(sceneSize) {\n const wrapping = Texture.CLAMP_ADDRESSMODE;\n if (!this._groundMirror) {\n this._groundMirror = new MirrorTexture(\"BackgroundPlaneMirrorTexture\", {\n ratio: this._options.groundMirrorSizeRatio\n }, this._scene, false, this._options.groundMirrorTextureType, Texture.BILINEAR_SAMPLINGMODE, true);\n this._groundMirror.mirrorPlane = new Plane(0, -1, 0, sceneSize.rootPosition.y);\n this._groundMirror.anisotropicFilteringLevel = 1;\n this._groundMirror.wrapU = wrapping;\n this._groundMirror.wrapV = wrapping;\n if (this._groundMirror.renderList) {\n for (let i = 0; i < this._scene.meshes.length; i++) {\n const mesh = this._scene.meshes[i];\n if (mesh !== this._ground && mesh !== this._skybox && mesh !== this._rootMesh) {\n this._groundMirror.renderList.push(mesh);\n }\n }\n }\n }\n const gammaGround = this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions);\n this._groundMirror.clearColor = new Color4(gammaGround.r, gammaGround.g, gammaGround.b, 1);\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\n }\n /**\n * Setup the ground to receive the mirror texture.\n */\n _setupMirrorInGroundMaterial() {\n if (this._groundMaterial) {\n this._groundMaterial.reflectionTexture = this._groundMirror;\n this._groundMaterial.reflectionFresnel = true;\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\n }\n }\n /**\n * Setup the skybox according to the specified options.\n * @param sceneSize\n */\n _setupSkybox(sceneSize) {\n if (!this._skybox || this._skybox.isDisposed()) {\n this._skybox = CreateBox(\"BackgroundSkybox\", {\n size: sceneSize.skyboxSize,\n sideOrientation: Mesh.BACKSIDE\n }, this._scene);\n this._skybox.isPickable = false;\n this._skybox.onDisposeObservable.add(() => {\n this._skybox = null;\n });\n }\n this._skybox.parent = this._rootMesh;\n }\n /**\n * Setup the skybox material according to the specified options.\n */\n _setupSkyboxMaterial() {\n if (!this._skybox) {\n return;\n }\n if (!this._skyboxMaterial) {\n this._skyboxMaterial = new BackgroundMaterial(\"BackgroundSkyboxMaterial\", this._scene);\n }\n this._skyboxMaterial.useRGBColor = false;\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\n this._skyboxMaterial.enableNoise = true;\n this._skybox.material = this._skyboxMaterial;\n }\n /**\n * Setup the skybox reflection texture according to the specified options.\n */\n _setupSkyboxReflectionTexture() {\n if (!this._skyboxMaterial) {\n return;\n }\n if (this._skyboxTexture) {\n return;\n }\n if (this._options.skyboxTexture instanceof BaseTexture) {\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\n return;\n }\n this._skyboxTexture = new CubeTexture(this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\n this._skyboxTexture.coordinatesMode = Texture.SKYBOX_MODE;\n this._skyboxTexture.gammaSpace = false;\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\n }\n /**\n * Dispose all the elements created by the Helper.\n */\n dispose() {\n if (this._groundMaterial) {\n this._groundMaterial.dispose(true, true);\n }\n if (this._skyboxMaterial) {\n this._skyboxMaterial.dispose(true, true);\n }\n this._rootMesh.dispose(false);\n }\n}\n/**\n * Default ground texture URL.\n */\nEnvironmentHelper._GroundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\n/**\n * Default skybox texture URL.\n */\nEnvironmentHelper._SkyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\n/**\n * Default environment texture URL.\n */\nEnvironmentHelper._EnvironmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";","map":{"version":3,"names":["Observable","ArcRotateCamera","Vector3","Color3","Color4","Mesh","BaseTexture","Texture","MirrorTexture","CubeTexture","BackgroundMaterial","CreatePlane","CreateBox","Plane","EnvironmentHelper","_GetDefaultOptions","scene","createGround","groundSize","groundTexture","_GroundTextureCDNUrl","groundColor","toLinearSpace","getEngine","useExactSrgbConversions","scale","groundOpacity","enableGroundShadow","groundShadowLevel","enableGroundMirror","groundMirrorSizeRatio","groundMirrorBlurKernel","groundMirrorAmount","groundMirrorFresnelWeight","groundMirrorFallOffDistance","groundMirrorTextureType","groundYBias","createSkybox","skyboxSize","skyboxTexture","_SkyboxTextureCDNUrl","skyboxColor","backgroundYRotation","sizeAuto","rootPosition","Zero","setupImageProcessing","environmentTexture","_EnvironmentTextureCDNUrl","cameraExposure","cameraContrast","toneMappingEnabled","rootMesh","_rootMesh","skybox","_skybox","_skyboxTexture","skyboxMaterial","_skyboxMaterial","ground","_ground","_groundTexture","groundMirror","_groundMirror","groundMirrorRenderList","renderList","groundMaterial","_groundMaterial","constructor","options","_errorHandler","message","exception","onErrorObservable","notifyObservers","_options","_scene","_setupBackground","_setupImageProcessing","updateOptions","newOptions","dispose","setMainColor","color","primaryColor","clearColor","r","g","b","imageProcessingConfiguration","contrast","exposure","_setupEnvironmentTexture","CreateFromPrefilteredData","rotation","y","sceneSize","_getSceneSize","_setupGround","_setupGroundMaterial","_setupGroundDiffuseTexture","_setupGroundMirrorTexture","_setupMirrorInGroundMaterial","_setupSkybox","_setupSkyboxMaterial","_setupSkyboxReflectionTexture","position","x","z","meshes","length","sceneExtends","getWorldExtends","mesh","sceneDiagonal","max","subtract","min","activeCamera","upperRadiusLimit","sceneDiagonalLenght","add","isDisposed","size","Math","PI","isPickable","parent","onDisposeObservable","receiveShadows","alpha","alphaMode","shadowLevel","useRGBColor","enableNoise","material","diffuseTexture","undefined","gammaSpace","hasAlpha","wrapping","CLAMP_ADDRESSMODE","ratio","BILINEAR_SAMPLINGMODE","mirrorPlane","anisotropicFilteringLevel","wrapU","wrapV","i","push","gammaGround","toGammaSpace","adaptiveBlurKernel","reflectionTexture","reflectionFresnel","reflectionAmount","reflectionStandardFresnelWeight","reflectionFalloffDistance","sideOrientation","BACKSIDE","coordinatesMode","SKYBOX_MODE"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Helpers/environmentHelper.js"],"sourcesContent":["import { Observable } from \"../Misc/observable.js\";\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { BaseTexture } from \"../Materials/Textures/baseTexture.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { MirrorTexture } from \"../Materials/Textures/mirrorTexture.js\";\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture.js\";\nimport { BackgroundMaterial } from \"../Materials/Background/backgroundMaterial.js\";\n\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder.js\";\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder.js\";\nimport { Plane } from \"../Maths/math.plane.js\";\n/**\n * The EnvironmentHelper class can be used to add a fully featured non-expensive background to your scene.\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\n * It also helps with the default setup of your ImageProcessingConfiguration.\n */\nexport class EnvironmentHelper {\n /**\n * Creates the default options for the helper.\n * @param scene The scene the environment helper belongs to.\n * @returns default options for the helper.\n */\n static _GetDefaultOptions(scene) {\n return {\n createGround: true,\n groundSize: 15,\n groundTexture: this._GroundTextureCDNUrl,\n groundColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\n groundOpacity: 0.9,\n enableGroundShadow: true,\n groundShadowLevel: 0.5,\n enableGroundMirror: false,\n groundMirrorSizeRatio: 0.3,\n groundMirrorBlurKernel: 64,\n groundMirrorAmount: 1,\n groundMirrorFresnelWeight: 1,\n groundMirrorFallOffDistance: 0,\n groundMirrorTextureType: 0,\n groundYBias: 0.00001,\n createSkybox: true,\n skyboxSize: 20,\n skyboxTexture: this._SkyboxTextureCDNUrl,\n skyboxColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\n backgroundYRotation: 0,\n sizeAuto: true,\n rootPosition: Vector3.Zero(),\n setupImageProcessing: true,\n environmentTexture: this._EnvironmentTextureCDNUrl,\n cameraExposure: 0.8,\n cameraContrast: 1.2,\n toneMappingEnabled: true,\n };\n }\n /**\n * Gets the root mesh created by the helper.\n */\n get rootMesh() {\n return this._rootMesh;\n }\n /**\n * Gets the skybox created by the helper.\n */\n get skybox() {\n return this._skybox;\n }\n /**\n * Gets the skybox texture created by the helper.\n */\n get skyboxTexture() {\n return this._skyboxTexture;\n }\n /**\n * Gets the skybox material created by the helper.\n */\n get skyboxMaterial() {\n return this._skyboxMaterial;\n }\n /**\n * Gets the ground mesh created by the helper.\n */\n get ground() {\n return this._ground;\n }\n /**\n * Gets the ground texture created by the helper.\n */\n get groundTexture() {\n return this._groundTexture;\n }\n /**\n * Gets the ground mirror created by the helper.\n */\n get groundMirror() {\n return this._groundMirror;\n }\n /**\n * Gets the ground mirror render list to helps pushing the meshes\n * you wish in the ground reflection.\n */\n get groundMirrorRenderList() {\n if (this._groundMirror) {\n return this._groundMirror.renderList;\n }\n return null;\n }\n /**\n * Gets the ground material created by the helper.\n */\n get groundMaterial() {\n return this._groundMaterial;\n }\n /**\n * constructor\n * @param options Defines the options we want to customize the helper\n * @param scene The scene to add the material to\n */\n constructor(options, scene) {\n this._errorHandler = (message, exception) => {\n this.onErrorObservable.notifyObservers({ message: message, exception: exception });\n };\n this._options = {\n ...EnvironmentHelper._GetDefaultOptions(scene),\n ...options,\n };\n this._scene = scene;\n this.onErrorObservable = new Observable();\n this._setupBackground();\n this._setupImageProcessing();\n }\n /**\n * Updates the environment according to the new options\n * @param options options to configure the helper (IEnvironmentHelperOptions)\n */\n updateOptions(options) {\n const newOptions = {\n ...this._options,\n ...options,\n };\n if (this._ground && !newOptions.createGround) {\n this._ground.dispose();\n this._ground = null;\n }\n if (this._groundMaterial && !newOptions.createGround) {\n this._groundMaterial.dispose();\n this._groundMaterial = null;\n }\n if (this._groundTexture) {\n if (this._options.groundTexture != newOptions.groundTexture) {\n this._groundTexture.dispose();\n this._groundTexture = null;\n }\n }\n if (this._skybox && !newOptions.createSkybox) {\n this._skybox.dispose();\n this._skybox = null;\n }\n if (this._skyboxMaterial && !newOptions.createSkybox) {\n this._skyboxMaterial.dispose();\n this._skyboxMaterial = null;\n }\n if (this._skyboxTexture) {\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\n this._skyboxTexture.dispose();\n this._skyboxTexture = null;\n }\n }\n if (this._groundMirror && !newOptions.enableGroundMirror) {\n this._groundMirror.dispose();\n this._groundMirror = null;\n }\n if (this._scene.environmentTexture) {\n if (this._options.environmentTexture != newOptions.environmentTexture) {\n this._scene.environmentTexture.dispose();\n }\n }\n this._options = newOptions;\n this._setupBackground();\n this._setupImageProcessing();\n }\n /**\n * Sets the primary color of all the available elements.\n * @param color the main color to affect to the ground and the background\n */\n setMainColor(color) {\n if (this.groundMaterial) {\n this.groundMaterial.primaryColor = color;\n }\n if (this.skyboxMaterial) {\n this.skyboxMaterial.primaryColor = color;\n }\n if (this.groundMirror) {\n this.groundMirror.clearColor = new Color4(color.r, color.g, color.b, 1.0);\n }\n }\n /**\n * Setup the image processing according to the specified options.\n */\n _setupImageProcessing() {\n if (this._options.setupImageProcessing) {\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\n this._setupEnvironmentTexture();\n }\n }\n /**\n * Setup the environment texture according to the specified options.\n */\n _setupEnvironmentTexture() {\n if (this._scene.environmentTexture) {\n return;\n }\n if (this._options.environmentTexture instanceof BaseTexture) {\n this._scene.environmentTexture = this._options.environmentTexture;\n return;\n }\n const environmentTexture = CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\n this._scene.environmentTexture = environmentTexture;\n }\n /**\n * Setup the background according to the specified options.\n */\n _setupBackground() {\n if (!this._rootMesh) {\n this._rootMesh = new Mesh(\"BackgroundHelper\", this._scene);\n }\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\n const sceneSize = this._getSceneSize();\n if (this._options.createGround) {\n this._setupGround(sceneSize);\n this._setupGroundMaterial();\n this._setupGroundDiffuseTexture();\n if (this._options.enableGroundMirror) {\n this._setupGroundMirrorTexture(sceneSize);\n }\n this._setupMirrorInGroundMaterial();\n }\n if (this._options.createSkybox) {\n this._setupSkybox(sceneSize);\n this._setupSkyboxMaterial();\n this._setupSkyboxReflectionTexture();\n }\n this._rootMesh.position.x = sceneSize.rootPosition.x;\n this._rootMesh.position.z = sceneSize.rootPosition.z;\n this._rootMesh.position.y = sceneSize.rootPosition.y;\n }\n /**\n * Get the scene sizes according to the setup.\n * @returns the different ground and skybox sizes.\n */\n _getSceneSize() {\n let groundSize = this._options.groundSize;\n let skyboxSize = this._options.skyboxSize;\n let rootPosition = this._options.rootPosition;\n if (!this._scene.meshes || this._scene.meshes.length === 1) {\n // 1 only means the root of the helper.\n return { groundSize, skyboxSize, rootPosition };\n }\n const sceneExtends = this._scene.getWorldExtends((mesh) => {\n return mesh !== this._ground && mesh !== this._rootMesh && mesh !== this._skybox;\n });\n const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\n if (this._options.sizeAuto) {\n if (this._scene.activeCamera instanceof ArcRotateCamera && this._scene.activeCamera.upperRadiusLimit) {\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\n skyboxSize = groundSize;\n }\n const sceneDiagonalLenght = sceneDiagonal.length();\n if (sceneDiagonalLenght > groundSize) {\n groundSize = sceneDiagonalLenght * 2;\n skyboxSize = groundSize;\n }\n // 10 % bigger.\n groundSize *= 1.1;\n skyboxSize *= 1.5;\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\n }\n return { groundSize, skyboxSize, rootPosition };\n }\n /**\n * Setup the ground according to the specified options.\n * @param sceneSize\n */\n _setupGround(sceneSize) {\n if (!this._ground || this._ground.isDisposed()) {\n this._ground = CreatePlane(\"BackgroundPlane\", { size: sceneSize.groundSize }, this._scene);\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\n this._ground.isPickable = false;\n this._ground.parent = this._rootMesh;\n this._ground.onDisposeObservable.add(() => {\n this._ground = null;\n });\n }\n this._ground.receiveShadows = this._options.enableGroundShadow;\n }\n /**\n * Setup the ground material according to the specified options.\n */\n _setupGroundMaterial() {\n if (!this._groundMaterial) {\n this._groundMaterial = new BackgroundMaterial(\"BackgroundPlaneMaterial\", this._scene);\n }\n this._groundMaterial.alpha = this._options.groundOpacity;\n this._groundMaterial.alphaMode = 8;\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\n this._groundMaterial.primaryColor = this._options.groundColor;\n this._groundMaterial.useRGBColor = false;\n this._groundMaterial.enableNoise = true;\n if (this._ground) {\n this._ground.material = this._groundMaterial;\n }\n }\n /**\n * Setup the ground diffuse texture according to the specified options.\n */\n _setupGroundDiffuseTexture() {\n if (!this._groundMaterial) {\n return;\n }\n if (this._groundTexture) {\n return;\n }\n if (this._options.groundTexture instanceof BaseTexture) {\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\n return;\n }\n this._groundTexture = new Texture(this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\n this._groundTexture.gammaSpace = false;\n this._groundTexture.hasAlpha = true;\n this._groundMaterial.diffuseTexture = this._groundTexture;\n }\n /**\n * Setup the ground mirror texture according to the specified options.\n * @param sceneSize\n */\n _setupGroundMirrorTexture(sceneSize) {\n const wrapping = Texture.CLAMP_ADDRESSMODE;\n if (!this._groundMirror) {\n this._groundMirror = new MirrorTexture(\"BackgroundPlaneMirrorTexture\", { ratio: this._options.groundMirrorSizeRatio }, this._scene, false, this._options.groundMirrorTextureType, Texture.BILINEAR_SAMPLINGMODE, true);\n this._groundMirror.mirrorPlane = new Plane(0, -1, 0, sceneSize.rootPosition.y);\n this._groundMirror.anisotropicFilteringLevel = 1;\n this._groundMirror.wrapU = wrapping;\n this._groundMirror.wrapV = wrapping;\n if (this._groundMirror.renderList) {\n for (let i = 0; i < this._scene.meshes.length; i++) {\n const mesh = this._scene.meshes[i];\n if (mesh !== this._ground && mesh !== this._skybox && mesh !== this._rootMesh) {\n this._groundMirror.renderList.push(mesh);\n }\n }\n }\n }\n const gammaGround = this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions);\n this._groundMirror.clearColor = new Color4(gammaGround.r, gammaGround.g, gammaGround.b, 1);\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\n }\n /**\n * Setup the ground to receive the mirror texture.\n */\n _setupMirrorInGroundMaterial() {\n if (this._groundMaterial) {\n this._groundMaterial.reflectionTexture = this._groundMirror;\n this._groundMaterial.reflectionFresnel = true;\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\n }\n }\n /**\n * Setup the skybox according to the specified options.\n * @param sceneSize\n */\n _setupSkybox(sceneSize) {\n if (!this._skybox || this._skybox.isDisposed()) {\n this._skybox = CreateBox(\"BackgroundSkybox\", { size: sceneSize.skyboxSize, sideOrientation: Mesh.BACKSIDE }, this._scene);\n this._skybox.isPickable = false;\n this._skybox.onDisposeObservable.add(() => {\n this._skybox = null;\n });\n }\n this._skybox.parent = this._rootMesh;\n }\n /**\n * Setup the skybox material according to the specified options.\n */\n _setupSkyboxMaterial() {\n if (!this._skybox) {\n return;\n }\n if (!this._skyboxMaterial) {\n this._skyboxMaterial = new BackgroundMaterial(\"BackgroundSkyboxMaterial\", this._scene);\n }\n this._skyboxMaterial.useRGBColor = false;\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\n this._skyboxMaterial.enableNoise = true;\n this._skybox.material = this._skyboxMaterial;\n }\n /**\n * Setup the skybox reflection texture according to the specified options.\n */\n _setupSkyboxReflectionTexture() {\n if (!this._skyboxMaterial) {\n return;\n }\n if (this._skyboxTexture) {\n return;\n }\n if (this._options.skyboxTexture instanceof BaseTexture) {\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\n return;\n }\n this._skyboxTexture = new CubeTexture(this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\n this._skyboxTexture.coordinatesMode = Texture.SKYBOX_MODE;\n this._skyboxTexture.gammaSpace = false;\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\n }\n /**\n * Dispose all the elements created by the Helper.\n */\n dispose() {\n if (this._groundMaterial) {\n this._groundMaterial.dispose(true, true);\n }\n if (this._skyboxMaterial) {\n this._skyboxMaterial.dispose(true, true);\n }\n this._rootMesh.dispose(false);\n }\n}\n/**\n * Default ground texture URL.\n */\nEnvironmentHelper._GroundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\n/**\n * Default skybox texture URL.\n */\nEnvironmentHelper._SkyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\n/**\n * Default environment texture URL.\n */\nEnvironmentHelper._EnvironmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,MAAM,EAAEC,MAAM,QAAQ,wBAAwB;AACvD,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,WAAW,QAAQ,sCAAsC;AAClE,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,aAAa,QAAQ,wCAAwC;AACtE,SAASC,WAAW,QAAQ,sCAAsC;AAClE,SAASC,kBAAkB,QAAQ,+CAA+C;AAElF,SAASC,WAAW,QAAQ,oCAAoC;AAChE,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,KAAK,QAAQ,wBAAwB;AAC9C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,CAAC;EAC3B;AACJ;AACA;AACA;AACA;EACI,OAAOC,kBAAkBA,CAACC,KAAK,EAAE;IAC7B,OAAO;MACHC,YAAY,EAAE,IAAI;MAClBC,UAAU,EAAE,EAAE;MACdC,aAAa,EAAE,IAAI,CAACC,oBAAo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