@babylonjs/core 7.9.0 → 7.10.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.
Files changed (98) hide show
  1. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  2. package/Behaviors/Cameras/framingBehavior.js +1 -1
  3. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  4. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +5 -5
  5. package/Behaviors/Meshes/baseSixDofDragBehavior.js +4 -4
  6. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  7. package/Collisions/gpuPicker.d.ts +38 -0
  8. package/Collisions/gpuPicker.js +256 -0
  9. package/Collisions/gpuPicker.js.map +1 -0
  10. package/Collisions/index.d.ts +1 -0
  11. package/Collisions/index.js +1 -0
  12. package/Collisions/index.js.map +1 -1
  13. package/Debug/physicsViewer.d.ts +4 -2
  14. package/Debug/physicsViewer.js +16 -4
  15. package/Debug/physicsViewer.js.map +1 -1
  16. package/Engines/Extensions/engine.views.d.ts +1 -0
  17. package/Engines/Extensions/engine.views.js +3 -0
  18. package/Engines/Extensions/engine.views.js.map +1 -0
  19. package/Engines/abstractEngine.js +2 -2
  20. package/Engines/abstractEngine.js.map +1 -1
  21. package/Engines/thinEngine.js +8 -7
  22. package/Engines/thinEngine.js.map +1 -1
  23. package/Gizmos/boundingBoxGizmo.d.ts +6 -5
  24. package/Gizmos/boundingBoxGizmo.js +5 -5
  25. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  26. package/Gizmos/lightGizmo.js +1 -2
  27. package/Gizmos/lightGizmo.js.map +1 -1
  28. package/Helpers/environmentHelper.js +2 -0
  29. package/Helpers/environmentHelper.js.map +1 -1
  30. package/Materials/Node/nodeMaterial.d.ts +2 -2
  31. package/Materials/Node/nodeMaterial.js +4 -4
  32. package/Materials/Node/nodeMaterial.js.map +1 -1
  33. package/Materials/material.d.ts +1 -1
  34. package/Materials/material.js.map +1 -1
  35. package/Materials/pushMaterial.d.ts +1 -1
  36. package/Materials/pushMaterial.js.map +1 -1
  37. package/Materials/shaderMaterial.d.ts +6 -1
  38. package/Materials/shaderMaterial.js +8 -1
  39. package/Materials/shaderMaterial.js.map +1 -1
  40. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +0 -2
  41. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  42. package/Meshes/Node/Blocks/mergeGeometryBlock.js +15 -11
  43. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  44. package/Meshes/abstractMesh.d.ts +6 -16
  45. package/Meshes/abstractMesh.js +5 -21
  46. package/Meshes/abstractMesh.js.map +1 -1
  47. package/Meshes/mesh.vertexData.js +19 -1
  48. package/Meshes/mesh.vertexData.js.map +1 -1
  49. package/Meshes/transformNode.d.ts +14 -0
  50. package/Meshes/transformNode.js +20 -0
  51. package/Meshes/transformNode.js.map +1 -1
  52. package/Particles/EmitterTypes/coneParticleEmitter.d.ts +60 -0
  53. package/Particles/EmitterTypes/coneParticleEmitter.js +88 -0
  54. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  55. package/Particles/IParticleSystem.d.ts +2 -1
  56. package/Particles/IParticleSystem.js.map +1 -1
  57. package/Particles/baseParticleSystem.d.ts +2 -1
  58. package/Particles/baseParticleSystem.js +3 -0
  59. package/Particles/baseParticleSystem.js.map +1 -1
  60. package/Particles/gpuParticleSystem.d.ts +2 -1
  61. package/Particles/gpuParticleSystem.js +6 -1
  62. package/Particles/gpuParticleSystem.js.map +1 -1
  63. package/Particles/particleSystem.d.ts +2 -1
  64. package/Particles/particleSystem.functions.d.ts +2 -1
  65. package/Particles/particleSystem.functions.js +4 -1
  66. package/Particles/particleSystem.functions.js.map +1 -1
  67. package/Particles/particleSystem.js +10 -2
  68. package/Particles/particleSystem.js.map +1 -1
  69. package/Physics/v2/IPhysicsEnginePlugin.d.ts +3 -0
  70. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  71. package/Physics/v2/Plugins/havokPlugin.d.ts +14 -0
  72. package/Physics/v2/Plugins/havokPlugin.js +42 -18
  73. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  74. package/Physics/v2/physicsEngine.d.ts +14 -0
  75. package/Physics/v2/physicsEngine.js +20 -0
  76. package/Physics/v2/physicsEngine.js.map +1 -1
  77. package/Rendering/edgesRenderer.js +2 -1
  78. package/Rendering/edgesRenderer.js.map +1 -1
  79. package/Shaders/ShadersInclude/lineUboDeclaration.d.ts +7 -0
  80. package/Shaders/ShadersInclude/lineUboDeclaration.js +14 -0
  81. package/Shaders/ShadersInclude/lineUboDeclaration.js.map +1 -0
  82. package/Shaders/ShadersInclude/lineVertexDeclaration.d.ts +5 -0
  83. package/Shaders/ShadersInclude/lineVertexDeclaration.js +11 -0
  84. package/Shaders/ShadersInclude/lineVertexDeclaration.js.map +1 -0
  85. package/Shaders/gpuUpdateParticles.vertex.js +12 -2
  86. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  87. package/Shaders/line.vertex.d.ts +2 -0
  88. package/Shaders/line.vertex.js +5 -2
  89. package/Shaders/line.vertex.js.map +1 -1
  90. package/ShadersWGSL/gpuUpdateParticles.compute.js +11 -1
  91. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  92. package/XR/features/WebXRControllerMovement.d.ts +14 -1
  93. package/XR/features/WebXRControllerMovement.js +21 -3
  94. package/XR/features/WebXRControllerMovement.js.map +1 -1
  95. package/XR/webXRInputSource.d.ts +1 -1
  96. package/XR/webXRInputSource.js +3 -3
  97. package/XR/webXRInputSource.js.map +1 -1
  98. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"lightGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/lightGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,q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AAC,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;KAC3F;IAED,IAAI,MAAM,GAAG,CAAC,EAAE;QACZ,OAAO,IAAI,CAAC;KACf;IACD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC,AAlE+B,CAkE9B","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector3, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport type { Node } from \"../node\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { Light } from \"../Lights/light\";\r\nimport type { Scene } from \"../scene\";\r\nimport { HemisphericLight } from \"../Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"../Lights/directionalLight\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateHemisphere } from \"../Meshes/Builders/hemisphereBuilder\";\r\nimport { SpotLight } from \"../Lights/spotLight\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Interface for light gizmo\r\n */\r\nexport interface ILightGizmo extends IGizmo {\r\n /** Event that fires each time the gizmo is clicked */\r\n onClickedObservable: Observable<Light>;\r\n /** The light that the gizmo is attached to */\r\n light: Nullable<Light>;\r\n /** The material used to render the light gizmo */\r\n readonly material: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Gizmo that enables viewing a light\r\n */\r\nexport class LightGizmo extends Gizmo implements ILightGizmo {\r\n protected _lightMesh: Mesh;\r\n protected _material: StandardMaterial;\r\n protected _cachedPosition = new Vector3();\r\n protected _cachedForward = new Vector3(0, 0, 1);\r\n protected _attachedMeshParent: TransformNode;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n\r\n /**\r\n * Event that fires each time the gizmo is clicked\r\n */\r\n public onClickedObservable = new Observable<Light>();\r\n\r\n /**\r\n * Creates a LightGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer) {\r\n super(gizmoLayer);\r\n this.attachedMesh = new AbstractMesh(\"\", this.gizmoLayer.utilityLayerScene);\r\n this._attachedMeshParent = new TransformNode(\"parent\", this.gizmoLayer.utilityLayerScene);\r\n\r\n this.attachedMesh.parent = this._attachedMeshParent;\r\n this._material = new StandardMaterial(\"light\", this.gizmoLayer.utilityLayerScene);\r\n this._material.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n this._material.specularColor = new Color3(0.1, 0.1, 0.1);\r\n\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (!this._light) {\r\n return;\r\n }\r\n\r\n this._isHovered = !!(pointerInfo.pickInfo && this._rootMesh.getChildMeshes().indexOf(<Mesh>pointerInfo.pickInfo.pickedMesh) != -1);\r\n if (this._isHovered && pointerInfo.event.button === 0) {\r\n this.onClickedObservable.notifyObservers(this._light);\r\n }\r\n }, PointerEventTypes.POINTERDOWN);\r\n }\r\n protected _light: Nullable<Light> = null;\r\n\r\n /**\r\n * Override attachedNode because lightgizmo only support attached mesh\r\n * It will return the attached mesh (if any) and setting an attached node will log\r\n * a warning\r\n */\r\n public override get attachedNode() {\r\n return this.attachedMesh;\r\n }\r\n public override set attachedNode(value: Nullable<Node>) {\r\n Logger.Warn(\"Nodes cannot be attached to LightGizmo. Attach to a mesh instead.\");\r\n }\r\n\r\n /**\r\n * The light that the gizmo is attached to\r\n */\r\n public set light(light: Nullable<Light>) {\r\n this._light = light;\r\n if (light) {\r\n // Create the mesh for the given light type\r\n if (this._lightMesh) {\r\n this._lightMesh.dispose();\r\n }\r\n\r\n if (light instanceof HemisphericLight) {\r\n this._lightMesh = LightGizmo._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene);\r\n } else if (light instanceof DirectionalLight) {\r\n this._lightMesh = LightGizmo._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene);\r\n } else if (light instanceof SpotLight) {\r\n this._lightMesh = LightGizmo._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene);\r\n } else {\r\n this._lightMesh = LightGizmo._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n this._lightMesh.getChildMeshes(false).forEach((m) => {\r\n m.material = this._material;\r\n });\r\n this._lightMesh.parent = this._rootMesh;\r\n\r\n // Add lighting to the light gizmo\r\n const gizmoLight = this.gizmoLayer._getSharedGizmoLight();\r\n gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(false));\r\n\r\n this._lightMesh.rotationQuaternion = new Quaternion();\r\n\r\n if (!this.attachedMesh!.reservedDataStore) {\r\n this.attachedMesh!.reservedDataStore = {};\r\n }\r\n this.attachedMesh!.reservedDataStore.lightGizmo = this;\r\n\r\n if (light.parent) {\r\n this._attachedMeshParent.freezeWorldMatrix(light.parent.getWorldMatrix());\r\n }\r\n\r\n // Get update position and direction if the light has it\r\n if ((light as any).position) {\r\n this.attachedMesh!.position.copyFrom((light as any).position);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n this._cachedPosition.copyFrom(this.attachedMesh!.position);\r\n }\r\n if ((light as any).direction) {\r\n this.attachedMesh!.setDirection((light as any).direction);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n const forward = this._getMeshForward();\r\n this._cachedForward.copyFrom(forward);\r\n }\r\n\r\n this._update();\r\n }\r\n }\r\n public get light() {\r\n return this._light;\r\n }\r\n\r\n /**\r\n * Gets the material used to render the light gizmo\r\n */\r\n public get material() {\r\n return this._material;\r\n }\r\n\r\n /**\r\n * @internal\r\n * returns mesh forward\r\n */\r\n protected _getMeshForward(): Vector3 {\r\n let forward = this.attachedMesh!.forward;\r\n if (this.attachedMesh!.getScene().useRightHandedSystem) {\r\n forward.negateToRef(TmpVectors.Vector3[0]);\r\n forward = TmpVectors.Vector3[0];\r\n }\r\n return forward;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n protected override _update() {\r\n super._update();\r\n if (!this._light) {\r\n return;\r\n }\r\n\r\n if (this._light.parent) {\r\n this._attachedMeshParent.freezeWorldMatrix(this._light.parent.getWorldMatrix());\r\n }\r\n\r\n // For light position and direction, a dirty flag is set to true in the setter\r\n // It means setting values individually or copying values will not call setter and\r\n // dirty flag will not be set to true. Hence creating a new Vector3.\r\n if ((this._light as any).position) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n if (!this.attachedMesh!.position.equals(this._cachedPosition)) {\r\n // update light to match gizmo\r\n const position = this.attachedMesh!.position;\r\n (this._light as any).position = new Vector3(position.x, position.y, position.z);\r\n this._cachedPosition.copyFrom(this.attachedMesh!.position);\r\n } else {\r\n // update gizmo to match light\r\n this.attachedMesh!.position.copyFrom((this._light as any).position);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n this._cachedPosition.copyFrom(this.attachedMesh!.position);\r\n }\r\n }\r\n if ((this._light as any).direction) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n const forward = this._getMeshForward();\r\n if (Vector3.DistanceSquared(forward, this._cachedForward) > 0.0001) {\r\n // update light to match gizmo\r\n const direction = forward;\r\n (this._light as any).direction = new Vector3(direction.x, direction.y, direction.z);\r\n this._cachedForward.copyFrom(forward);\r\n } else if (Vector3.DistanceSquared(forward, (this._light as any).direction) > 0.0001) {\r\n // update gizmo to match light\r\n this.attachedMesh!.setDirection((this._light as any).direction);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n this._cachedForward.copyFrom(forward);\r\n }\r\n }\r\n }\r\n\r\n // Static helper methods\r\n private static _Scale = 0.007;\r\n\r\n /**\r\n * Creates the lines for a light mesh\r\n * @param levels\r\n * @param scene\r\n * @returns the light lines mesh\r\n */\r\n private static _CreateLightLines = (levels: number, scene: Scene) => {\r\n const distFromSphere = 1.2;\r\n\r\n const root = new Mesh(\"root\", scene);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n // Create the top line, this will be cloned for all other lines\r\n const linePivot = new Mesh(\"linePivot\", scene);\r\n linePivot.parent = root;\r\n const line = CreateCylinder(\r\n \"line\",\r\n {\r\n updatable: false,\r\n height: 2,\r\n diameterTop: 0.2,\r\n diameterBottom: 0.3,\r\n tessellation: 6,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n line.position.y = line.scaling.y / 2 + distFromSphere;\r\n line.parent = linePivot;\r\n\r\n if (levels < 2) {\r\n return linePivot;\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n const l = linePivot.clone(\"lineParentClone\")!;\r\n l.rotation.z = Math.PI / 4;\r\n l.rotation.y = Math.PI / 2 + (Math.PI / 2) * i;\r\n\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n\r\n if (levels < 3) {\r\n return root;\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n const l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI / 2;\r\n l.rotation.y = (Math.PI / 2) * i;\r\n }\r\n\r\n if (levels < 4) {\r\n return root;\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n const l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI + Math.PI / 4;\r\n l.rotation.y = Math.PI / 2 + (Math.PI / 2) * i;\r\n\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n\r\n if (levels < 5) {\r\n return root;\r\n }\r\n const l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI;\r\n\r\n return root;\r\n };\r\n\r\n /**\r\n * Disposes of the light gizmo\r\n */\r\n public override dispose() {\r\n this.onClickedObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this._material.dispose();\r\n super.dispose();\r\n this._attachedMeshParent.dispose();\r\n }\r\n\r\n private static _CreateHemisphericLightMesh(scene: Scene) {\r\n const root = new Mesh(\"hemisphereLight\", scene);\r\n const hemisphere = CreateHemisphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n hemisphere.position.z = -0.15;\r\n hemisphere.rotation.x = Math.PI / 2;\r\n hemisphere.parent = root;\r\n\r\n const lines = this._CreateLightLines(3, scene);\r\n lines.parent = root;\r\n\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n return root;\r\n }\r\n\r\n private static _CreatePointLightMesh(scene: Scene) {\r\n const root = new Mesh(\"pointLight\", scene);\r\n const sphere = CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.rotation.x = Math.PI / 2;\r\n sphere.parent = root;\r\n\r\n const lines = this._CreateLightLines(5, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n return root;\r\n }\r\n\r\n private static _CreateSpotLightMesh(scene: Scene) {\r\n const root = new Mesh(\"spotLight\", scene);\r\n const sphere = CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.parent = root;\r\n\r\n const hemisphere = CreateHemisphere(root.name, { segments: 10, diameter: 2 }, scene);\r\n hemisphere.parent = root;\r\n hemisphere.rotation.x = -Math.PI / 2;\r\n\r\n const lines = this._CreateLightLines(2, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n return root;\r\n }\r\n\r\n private static _CreateDirectionalLightMesh(scene: Scene) {\r\n const root = new Mesh(\"directionalLight\", scene);\r\n\r\n const mesh = new Mesh(root.name, scene);\r\n mesh.parent = root;\r\n const sphere = CreateSphere(root.name, { diameter: 1.2, segments: 10 }, scene);\r\n sphere.parent = mesh;\r\n\r\n const line = CreateCylinder(\r\n root.name,\r\n {\r\n updatable: false,\r\n height: 6,\r\n diameterTop: 0.3,\r\n diameterBottom: 0.3,\r\n tessellation: 6,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n line.parent = mesh;\r\n\r\n let left = line.clone(root.name)!;\r\n left.scaling.y = 0.5;\r\n left.position.x += 1.25;\r\n\r\n let right = line.clone(root.name)!;\r\n right.scaling.y = 0.5;\r\n right.position.x += -1.25;\r\n\r\n const arrowHead = CreateCylinder(\r\n root.name,\r\n {\r\n updatable: false,\r\n height: 1,\r\n diameterTop: 0,\r\n diameterBottom: 0.6,\r\n tessellation: 6,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n arrowHead.position.y += 3;\r\n arrowHead.parent = mesh;\r\n\r\n left = arrowHead.clone(root.name);\r\n left.position.y = 1.5;\r\n left.position.x += 1.25;\r\n\r\n right = arrowHead.clone(root.name);\r\n right.position.y = 1.5;\r\n right.position.x += -1.25;\r\n\r\n mesh.scaling.scaleInPlace(LightGizmo._Scale);\r\n mesh.rotation.z = Math.PI / 2;\r\n mesh.rotation.y = Math.PI / 2;\r\n return root;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"lightGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/lightGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAc1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAajC;;;OAGG;IACH,YAAY,aAAmC,oBAAoB,CAAC,mBAAmB;QACnF,KAAK,CAAC,UAAU,CAAC,CAAC;QAfZ,oBAAe,GAAG,IAAI,OAAO,EAAE,CA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,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC;QACtC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC;QACxE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;KAC3F;IAED,IAAI,MAAM,GAAG,CAAC,EAAE;QACZ,OAAO,IAAI,CAAC;KACf;IACD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC,AAlE+B,CAkE9B","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector3, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport type { Node } from \"../node\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { Light } from \"../Lights/light\";\r\nimport type { Scene } from \"../scene\";\r\nimport { HemisphericLight } from \"../Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"../Lights/directionalLight\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateHemisphere } from \"../Meshes/Builders/hemisphereBuilder\";\r\nimport { SpotLight } from \"../Lights/spotLight\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Interface for light gizmo\r\n */\r\nexport interface ILightGizmo extends IGizmo {\r\n /** Event that fires each time the gizmo is clicked */\r\n onClickedObservable: Observable<Light>;\r\n /** The light that the gizmo is attached to */\r\n light: Nullable<Light>;\r\n /** The material used to render the light gizmo */\r\n readonly material: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Gizmo that enables viewing a light\r\n */\r\nexport class LightGizmo extends Gizmo implements ILightGizmo {\r\n protected _lightMesh: Mesh;\r\n protected _material: StandardMaterial;\r\n protected _cachedPosition = new Vector3();\r\n protected _cachedForward = new Vector3(0, 0, 1);\r\n protected _attachedMeshParent: TransformNode;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n\r\n /**\r\n * Event that fires each time the gizmo is clicked\r\n */\r\n public onClickedObservable = new Observable<Light>();\r\n\r\n /**\r\n * Creates a LightGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer) {\r\n super(gizmoLayer);\r\n this.attachedMesh = new Mesh(\"\", this.gizmoLayer.utilityLayerScene);\r\n this._attachedMeshParent = new TransformNode(\"parent\", this.gizmoLayer.utilityLayerScene);\r\n\r\n this.attachedMesh.parent = this._attachedMeshParent;\r\n this._material = new StandardMaterial(\"light\", this.gizmoLayer.utilityLayerScene);\r\n this._material.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n this._material.specularColor = new Color3(0.1, 0.1, 0.1);\r\n\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (!this._light) {\r\n return;\r\n }\r\n\r\n this._isHovered = !!(pointerInfo.pickInfo && this._rootMesh.getChildMeshes().indexOf(<Mesh>pointerInfo.pickInfo.pickedMesh) != -1);\r\n if (this._isHovered && pointerInfo.event.button === 0) {\r\n this.onClickedObservable.notifyObservers(this._light);\r\n }\r\n }, PointerEventTypes.POINTERDOWN);\r\n }\r\n protected _light: Nullable<Light> = null;\r\n\r\n /**\r\n * Override attachedNode because lightgizmo only support attached mesh\r\n * It will return the attached mesh (if any) and setting an attached node will log\r\n * a warning\r\n */\r\n public override get attachedNode() {\r\n return this.attachedMesh;\r\n }\r\n public override set attachedNode(value: Nullable<Node>) {\r\n Logger.Warn(\"Nodes cannot be attached to LightGizmo. Attach to a mesh instead.\");\r\n }\r\n\r\n /**\r\n * The light that the gizmo is attached to\r\n */\r\n public set light(light: Nullable<Light>) {\r\n this._light = light;\r\n if (light) {\r\n // Create the mesh for the given light type\r\n if (this._lightMesh) {\r\n this._lightMesh.dispose();\r\n }\r\n\r\n if (light instanceof HemisphericLight) {\r\n this._lightMesh = LightGizmo._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene);\r\n } else if (light instanceof DirectionalLight) {\r\n this._lightMesh = LightGizmo._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene);\r\n } else if (light instanceof SpotLight) {\r\n this._lightMesh = LightGizmo._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene);\r\n } else {\r\n this._lightMesh = LightGizmo._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n this._lightMesh.getChildMeshes(false).forEach((m) => {\r\n m.material = this._material;\r\n });\r\n this._lightMesh.parent = this._rootMesh;\r\n\r\n // Add lighting to the light gizmo\r\n const gizmoLight = this.gizmoLayer._getSharedGizmoLight();\r\n gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(false));\r\n\r\n this._lightMesh.rotationQuaternion = new Quaternion();\r\n\r\n if (!this.attachedMesh!.reservedDataStore) {\r\n this.attachedMesh!.reservedDataStore = {};\r\n }\r\n this.attachedMesh!.reservedDataStore.lightGizmo = this;\r\n\r\n if (light.parent) {\r\n this._attachedMeshParent.freezeWorldMatrix(light.parent.getWorldMatrix());\r\n }\r\n\r\n // Get update position and direction if the light has it\r\n if ((light as any).position) {\r\n this.attachedMesh!.position.copyFrom((light as any).position);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n this._cachedPosition.copyFrom(this.attachedMesh!.position);\r\n }\r\n if ((light as any).direction) {\r\n this.attachedMesh!.setDirection((light as any).direction);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n const forward = this._getMeshForward();\r\n this._cachedForward.copyFrom(forward);\r\n }\r\n\r\n this._update();\r\n }\r\n }\r\n public get light() {\r\n return this._light;\r\n }\r\n\r\n /**\r\n * Gets the material used to render the light gizmo\r\n */\r\n public get material() {\r\n return this._material;\r\n }\r\n\r\n /**\r\n * @internal\r\n * returns mesh forward\r\n */\r\n protected _getMeshForward(): Vector3 {\r\n let forward = this.attachedMesh!.forward;\r\n if (this.attachedMesh!.getScene().useRightHandedSystem) {\r\n forward.negateToRef(TmpVectors.Vector3[0]);\r\n forward = TmpVectors.Vector3[0];\r\n }\r\n return forward;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n protected override _update() {\r\n super._update();\r\n if (!this._light) {\r\n return;\r\n }\r\n\r\n if (this._light.parent) {\r\n this._attachedMeshParent.freezeWorldMatrix(this._light.parent.getWorldMatrix());\r\n }\r\n\r\n // For light position and direction, a dirty flag is set to true in the setter\r\n // It means setting values individually or copying values will not call setter and\r\n // dirty flag will not be set to true. Hence creating a new Vector3.\r\n if ((this._light as any).position) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n if (!this.attachedMesh!.position.equals(this._cachedPosition)) {\r\n // update light to match gizmo\r\n const position = this.attachedMesh!.position;\r\n (this._light as any).position = new Vector3(position.x, position.y, position.z);\r\n this._cachedPosition.copyFrom(this.attachedMesh!.position);\r\n } else {\r\n // update gizmo to match light\r\n this.attachedMesh!.position.copyFrom((this._light as any).position);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n this._cachedPosition.copyFrom(this.attachedMesh!.position);\r\n }\r\n }\r\n if ((this._light as any).direction) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n const forward = this._getMeshForward();\r\n if (Vector3.DistanceSquared(forward, this._cachedForward) > 0.0001) {\r\n // update light to match gizmo\r\n const direction = forward;\r\n (this._light as any).direction = new Vector3(direction.x, direction.y, direction.z);\r\n this._cachedForward.copyFrom(forward);\r\n } else if (Vector3.DistanceSquared(forward, (this._light as any).direction) > 0.0001) {\r\n // update gizmo to match light\r\n this.attachedMesh!.setDirection((this._light as any).direction);\r\n this.attachedMesh!.computeWorldMatrix(true);\r\n this._cachedForward.copyFrom(forward);\r\n }\r\n }\r\n }\r\n\r\n // Static helper methods\r\n private static _Scale = 0.007;\r\n\r\n /**\r\n * Creates the lines for a light mesh\r\n * @param levels\r\n * @param scene\r\n * @returns the light lines mesh\r\n */\r\n private static _CreateLightLines = (levels: number, scene: Scene) => {\r\n const distFromSphere = 1.2;\r\n\r\n const root = new Mesh(\"root\", scene);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n // Create the top line, this will be cloned for all other lines\r\n const linePivot = new Mesh(\"linePivot\", scene);\r\n linePivot.parent = root;\r\n const line = CreateCylinder(\r\n \"line\",\r\n {\r\n updatable: false,\r\n height: 2,\r\n diameterTop: 0.2,\r\n diameterBottom: 0.3,\r\n tessellation: 6,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n line.position.y = line.scaling.y / 2 + distFromSphere;\r\n line.parent = linePivot;\r\n\r\n if (levels < 2) {\r\n return linePivot;\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n const l = linePivot.clone(\"lineParentClone\")!;\r\n l.rotation.z = Math.PI / 4;\r\n l.rotation.y = Math.PI / 2 + (Math.PI / 2) * i;\r\n\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n\r\n if (levels < 3) {\r\n return root;\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n const l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI / 2;\r\n l.rotation.y = (Math.PI / 2) * i;\r\n }\r\n\r\n if (levels < 4) {\r\n return root;\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n const l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI + Math.PI / 4;\r\n l.rotation.y = Math.PI / 2 + (Math.PI / 2) * i;\r\n\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n\r\n if (levels < 5) {\r\n return root;\r\n }\r\n const l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI;\r\n\r\n return root;\r\n };\r\n\r\n /**\r\n * Disposes of the light gizmo\r\n */\r\n public override dispose() {\r\n this.onClickedObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this._material.dispose();\r\n super.dispose();\r\n this._attachedMeshParent.dispose();\r\n }\r\n\r\n private static _CreateHemisphericLightMesh(scene: Scene) {\r\n const root = new Mesh(\"hemisphereLight\", scene);\r\n const hemisphere = CreateHemisphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n hemisphere.position.z = -0.15;\r\n hemisphere.rotation.x = Math.PI / 2;\r\n hemisphere.parent = root;\r\n\r\n const lines = this._CreateLightLines(3, scene);\r\n lines.parent = root;\r\n\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n return root;\r\n }\r\n\r\n private static _CreatePointLightMesh(scene: Scene) {\r\n const root = new Mesh(\"pointLight\", scene);\r\n const sphere = CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.rotation.x = Math.PI / 2;\r\n sphere.parent = root;\r\n\r\n const lines = this._CreateLightLines(5, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n return root;\r\n }\r\n\r\n private static _CreateSpotLightMesh(scene: Scene) {\r\n const root = new Mesh(\"spotLight\", scene);\r\n const sphere = CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.parent = root;\r\n\r\n const hemisphere = CreateHemisphere(root.name, { segments: 10, diameter: 2 }, scene);\r\n hemisphere.parent = root;\r\n hemisphere.rotation.x = -Math.PI / 2;\r\n\r\n const lines = this._CreateLightLines(2, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n\r\n return root;\r\n }\r\n\r\n private static _CreateDirectionalLightMesh(scene: Scene) {\r\n const root = new Mesh(\"directionalLight\", scene);\r\n\r\n const mesh = new Mesh(root.name, scene);\r\n mesh.parent = root;\r\n const sphere = CreateSphere(root.name, { diameter: 1.2, segments: 10 }, scene);\r\n sphere.parent = mesh;\r\n\r\n const line = CreateCylinder(\r\n root.name,\r\n {\r\n updatable: false,\r\n height: 6,\r\n diameterTop: 0.3,\r\n diameterBottom: 0.3,\r\n tessellation: 6,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n line.parent = mesh;\r\n\r\n let left = line.clone(root.name)!;\r\n left.scaling.y = 0.5;\r\n left.position.x += 1.25;\r\n\r\n let right = line.clone(root.name)!;\r\n right.scaling.y = 0.5;\r\n right.position.x += -1.25;\r\n\r\n const arrowHead = CreateCylinder(\r\n root.name,\r\n {\r\n updatable: false,\r\n height: 1,\r\n diameterTop: 0,\r\n diameterBottom: 0.6,\r\n tessellation: 6,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n arrowHead.position.y += 3;\r\n arrowHead.parent = mesh;\r\n\r\n left = arrowHead.clone(root.name);\r\n left.position.y = 1.5;\r\n left.position.x += 1.25;\r\n\r\n right = arrowHead.clone(root.name);\r\n right.position.y = 1.5;\r\n right.position.x += -1.25;\r\n\r\n mesh.scaling.scaleInPlace(LightGizmo._Scale);\r\n mesh.rotation.z = Math.PI / 2;\r\n mesh.rotation.y = Math.PI / 2;\r\n return root;\r\n }\r\n}\r\n"]}
@@ -289,6 +289,7 @@ export class EnvironmentHelper {
289
289
  if (!this._ground || this._ground.isDisposed()) {
290
290
  this._ground = CreatePlane("BackgroundPlane", { size: sceneSize.groundSize }, this._scene);
291
291
  this._ground.rotation.x = Math.PI / 2; // Face up by default.
292
+ this._ground.isPickable = false;
292
293
  this._ground.parent = this._rootMesh;
293
294
  this._ground.onDisposeObservable.add(() => {
294
295
  this._ground = null;
@@ -376,6 +377,7 @@ export class EnvironmentHelper {
376
377
  _setupSkybox(sceneSize) {
377
378
  if (!this._skybox || this._skybox.isDisposed()) {
378
379
  this._skybox = CreateBox("BackgroundSkybox", { size: sceneSize.skyboxSize, sideOrientation: Mesh.BACKSIDE }, this._scene);
380
+ this._skybox.isPickable = false;
379
381
  this._skybox.onDisposeObservable.add(() => {
380
382
  this._skybox = null;
381
383
  });
@@ -1 +1 @@
1
- {"version":3,"file":"environmentHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Helpers/environmentHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC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AAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,2CAAyB,GAAG,mEAAmE,AAAtE,CAAuE","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { MirrorTexture } from \"../Materials/Textures/mirrorTexture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { BackgroundMaterial } from \"../Materials/Background/backgroundMaterial\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\n\r\n/**\r\n * Represents the different options available during the creation of\r\n * a Environment helper.\r\n *\r\n * This can control the default ground, skybox and image processing setup of your scene.\r\n */\r\nexport interface IEnvironmentHelperOptions {\r\n /**\r\n * Specifies whether or not to create a ground.\r\n * True by default.\r\n */\r\n createGround: boolean;\r\n /**\r\n * Specifies the ground size.\r\n * 15 by default.\r\n */\r\n groundSize: number;\r\n /**\r\n * The texture used on the ground for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n groundTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the ground texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n groundColor: Color3;\r\n /**\r\n * Specifies the ground opacity.\r\n * 1 by default.\r\n */\r\n groundOpacity: number;\r\n /**\r\n * Enables the ground to receive shadows.\r\n * True by default.\r\n */\r\n enableGroundShadow: boolean;\r\n /**\r\n * Helps preventing the shadow to be fully black on the ground.\r\n * 0.5 by default.\r\n */\r\n groundShadowLevel: number;\r\n /**\r\n * Creates a mirror texture attach to the ground.\r\n * false by default.\r\n */\r\n enableGroundMirror: boolean;\r\n /**\r\n * Specifies the ground mirror size ratio.\r\n * 0.3 by default as the default kernel is 64.\r\n */\r\n groundMirrorSizeRatio: number;\r\n /**\r\n * Specifies the ground mirror blur kernel size.\r\n * 64 by default.\r\n */\r\n groundMirrorBlurKernel: number;\r\n /**\r\n * Specifies the ground mirror visibility amount.\r\n * 1 by default\r\n */\r\n groundMirrorAmount: number;\r\n /**\r\n * Specifies the ground mirror reflectance weight.\r\n * This uses the standard weight of the background material to setup the fresnel effect\r\n * of the mirror.\r\n * 1 by default.\r\n */\r\n groundMirrorFresnelWeight: number;\r\n /**\r\n * Specifies the ground mirror Falloff distance.\r\n * This can helps reducing the size of the reflection.\r\n * 0 by Default.\r\n */\r\n groundMirrorFallOffDistance: number;\r\n /**\r\n * Specifies the ground mirror texture type.\r\n * Unsigned Int by Default.\r\n */\r\n groundMirrorTextureType: number;\r\n /**\r\n * Specifies a bias applied to the ground vertical position to prevent z-fighting with\r\n * the shown objects.\r\n */\r\n groundYBias: number;\r\n\r\n /**\r\n * Specifies whether or not to create a skybox.\r\n * True by default.\r\n */\r\n createSkybox: boolean;\r\n /**\r\n * Specifies the skybox size.\r\n * 20 by default.\r\n */\r\n skyboxSize: number;\r\n /**\r\n * The texture used on the skybox for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n skyboxTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the skybox texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n skyboxColor: Color3;\r\n\r\n /**\r\n * The background rotation around the Y axis of the scene.\r\n * This helps aligning the key lights of your scene with the background.\r\n * 0 by default.\r\n */\r\n backgroundYRotation: number;\r\n\r\n /**\r\n * Compute automatically the size of the elements to best fit with the scene.\r\n */\r\n sizeAuto: boolean;\r\n\r\n /**\r\n * Default position of the rootMesh if autoSize is not true.\r\n */\r\n rootPosition: Vector3;\r\n\r\n /**\r\n * Sets up the image processing in the scene.\r\n * true by default.\r\n */\r\n setupImageProcessing: boolean;\r\n\r\n /**\r\n * The texture used as your environment texture in the scene.\r\n * Comes from the BabylonJS CDN by default and in use if setupImageProcessing is true.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n environmentTexture: string | BaseTexture;\r\n\r\n /**\r\n * The value of the exposure to apply to the scene.\r\n * 0.6 by default if setupImageProcessing is true.\r\n */\r\n cameraExposure: number;\r\n\r\n /**\r\n * The value of the contrast to apply to the scene.\r\n * 1.6 by default if setupImageProcessing is true.\r\n */\r\n cameraContrast: number;\r\n\r\n /**\r\n * Specifies whether or not tonemapping should be enabled in the scene.\r\n * true by default if setupImageProcessing is true.\r\n */\r\n toneMappingEnabled: boolean;\r\n}\r\n\r\ninterface ISceneSize {\r\n groundSize: number;\r\n skyboxSize: number;\r\n rootPosition: Vector3;\r\n}\r\n\r\n/**\r\n * The EnvironmentHelper class can be used to add a fully featured non-expensive background to your scene.\r\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\r\n * It also helps with the default setup of your ImageProcessingConfiguration.\r\n */\r\nexport class EnvironmentHelper {\r\n /**\r\n * Default ground texture URL.\r\n */\r\n private static _GroundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\r\n\r\n /**\r\n * Default skybox texture URL.\r\n */\r\n private static _SkyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\r\n\r\n /**\r\n * Default environment texture URL.\r\n */\r\n private static _EnvironmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\r\n\r\n /**\r\n * Creates the default options for the helper.\r\n * @param scene The scene the environment helper belongs to.\r\n * @returns default options for the helper.\r\n */\r\n private static _GetDefaultOptions(scene: Scene): IEnvironmentHelperOptions {\r\n return {\r\n createGround: true,\r\n groundSize: 15,\r\n groundTexture: this._GroundTextureCDNUrl,\r\n groundColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n groundOpacity: 0.9,\r\n enableGroundShadow: true,\r\n groundShadowLevel: 0.5,\r\n\r\n enableGroundMirror: false,\r\n groundMirrorSizeRatio: 0.3,\r\n groundMirrorBlurKernel: 64,\r\n groundMirrorAmount: 1,\r\n groundMirrorFresnelWeight: 1,\r\n groundMirrorFallOffDistance: 0,\r\n groundMirrorTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n\r\n groundYBias: 0.00001,\r\n\r\n createSkybox: true,\r\n skyboxSize: 20,\r\n skyboxTexture: this._SkyboxTextureCDNUrl,\r\n skyboxColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n\r\n backgroundYRotation: 0,\r\n sizeAuto: true,\r\n rootPosition: Vector3.Zero(),\r\n\r\n setupImageProcessing: true,\r\n environmentTexture: this._EnvironmentTextureCDNUrl,\r\n cameraExposure: 0.8,\r\n cameraContrast: 1.2,\r\n toneMappingEnabled: true,\r\n };\r\n }\r\n\r\n private _rootMesh: Mesh;\r\n /**\r\n * Gets the root mesh created by the helper.\r\n */\r\n public get rootMesh(): Mesh {\r\n return this._rootMesh;\r\n }\r\n\r\n private _skybox: Nullable<Mesh>;\r\n /**\r\n * Gets the skybox created by the helper.\r\n */\r\n public get skybox(): Nullable<Mesh> {\r\n return this._skybox;\r\n }\r\n\r\n private _skyboxTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the skybox texture created by the helper.\r\n */\r\n public get skyboxTexture(): Nullable<BaseTexture> {\r\n return this._skyboxTexture;\r\n }\r\n\r\n private _skyboxMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the skybox material created by the helper.\r\n */\r\n public get skyboxMaterial(): Nullable<BackgroundMaterial> {\r\n return this._skyboxMaterial;\r\n }\r\n\r\n private _ground: Nullable<Mesh>;\r\n /**\r\n * Gets the ground mesh created by the helper.\r\n */\r\n public get ground(): Nullable<Mesh> {\r\n return this._ground;\r\n }\r\n\r\n private _groundTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the ground texture created by the helper.\r\n */\r\n public get groundTexture(): Nullable<BaseTexture> {\r\n return this._groundTexture;\r\n }\r\n\r\n private _groundMirror: Nullable<MirrorTexture>;\r\n /**\r\n * Gets the ground mirror created by the helper.\r\n */\r\n public get groundMirror(): Nullable<MirrorTexture> {\r\n return this._groundMirror;\r\n }\r\n\r\n /**\r\n * Gets the ground mirror render list to helps pushing the meshes\r\n * you wish in the ground reflection.\r\n */\r\n public get groundMirrorRenderList(): Nullable<AbstractMesh[]> {\r\n if (this._groundMirror) {\r\n return this._groundMirror.renderList;\r\n }\r\n return null;\r\n }\r\n\r\n private _groundMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the ground material created by the helper.\r\n */\r\n public get groundMaterial(): Nullable<BackgroundMaterial> {\r\n return this._groundMaterial;\r\n }\r\n\r\n /**\r\n * Stores the creation options.\r\n */\r\n private readonly _scene: Scene;\r\n private _options: IEnvironmentHelperOptions;\r\n\r\n /**\r\n * This observable will be notified with any error during the creation of the environment,\r\n * mainly texture creation errors.\r\n */\r\n public onErrorObservable: Observable<{ message?: string; exception?: any }>;\r\n\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(options: Partial<IEnvironmentHelperOptions>, scene: Scene) {\r\n this._options = {\r\n ...EnvironmentHelper._GetDefaultOptions(scene),\r\n ...options,\r\n };\r\n this._scene = scene;\r\n this.onErrorObservable = new Observable();\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Updates the environment according to the new options\r\n * @param options options to configure the helper (IEnvironmentHelperOptions)\r\n */\r\n public updateOptions(options: Partial<IEnvironmentHelperOptions>) {\r\n const newOptions = {\r\n ...this._options,\r\n ...options,\r\n };\r\n\r\n if (this._ground && !newOptions.createGround) {\r\n this._ground.dispose();\r\n this._ground = null;\r\n }\r\n\r\n if (this._groundMaterial && !newOptions.createGround) {\r\n this._groundMaterial.dispose();\r\n this._groundMaterial = null;\r\n }\r\n\r\n if (this._groundTexture) {\r\n if (this._options.groundTexture != newOptions.groundTexture) {\r\n this._groundTexture.dispose();\r\n this._groundTexture = null;\r\n }\r\n }\r\n\r\n if (this._skybox && !newOptions.createSkybox) {\r\n this._skybox.dispose();\r\n this._skybox = null;\r\n }\r\n\r\n if (this._skyboxMaterial && !newOptions.createSkybox) {\r\n this._skyboxMaterial.dispose();\r\n this._skyboxMaterial = null;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\r\n this._skyboxTexture.dispose();\r\n this._skyboxTexture = null;\r\n }\r\n }\r\n\r\n if (this._groundMirror && !newOptions.enableGroundMirror) {\r\n this._groundMirror.dispose();\r\n this._groundMirror = null;\r\n }\r\n\r\n if (this._scene.environmentTexture) {\r\n if (this._options.environmentTexture != newOptions.environmentTexture) {\r\n this._scene.environmentTexture.dispose();\r\n }\r\n }\r\n\r\n this._options = newOptions;\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Sets the primary color of all the available elements.\r\n * @param color the main color to affect to the ground and the background\r\n */\r\n public setMainColor(color: Color3): void {\r\n if (this.groundMaterial) {\r\n this.groundMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.skyboxMaterial) {\r\n this.skyboxMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.groundMirror) {\r\n this.groundMirror.clearColor = new Color4(color.r, color.g, color.b, 1.0);\r\n }\r\n }\r\n\r\n /**\r\n * Setup the image processing according to the specified options.\r\n */\r\n private _setupImageProcessing(): void {\r\n if (this._options.setupImageProcessing) {\r\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\r\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\r\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\r\n this._setupEnvironmentTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Setup the environment texture according to the specified options.\r\n */\r\n private _setupEnvironmentTexture(): void {\r\n if (this._scene.environmentTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.environmentTexture instanceof BaseTexture) {\r\n this._scene.environmentTexture = this._options.environmentTexture;\r\n return;\r\n }\r\n\r\n const environmentTexture = CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\r\n this._scene.environmentTexture = environmentTexture;\r\n }\r\n\r\n /**\r\n * Setup the background according to the specified options.\r\n */\r\n private _setupBackground(): void {\r\n if (!this._rootMesh) {\r\n this._rootMesh = new Mesh(\"BackgroundHelper\", this._scene);\r\n }\r\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\r\n\r\n const sceneSize = this._getSceneSize();\r\n if (this._options.createGround) {\r\n this._setupGround(sceneSize);\r\n this._setupGroundMaterial();\r\n this._setupGroundDiffuseTexture();\r\n\r\n if (this._options.enableGroundMirror) {\r\n this._setupGroundMirrorTexture(sceneSize);\r\n }\r\n this._setupMirrorInGroundMaterial();\r\n }\r\n\r\n if (this._options.createSkybox) {\r\n this._setupSkybox(sceneSize);\r\n this._setupSkyboxMaterial();\r\n this._setupSkyboxReflectionTexture();\r\n }\r\n\r\n this._rootMesh.position.x = sceneSize.rootPosition.x;\r\n this._rootMesh.position.z = sceneSize.rootPosition.z;\r\n this._rootMesh.position.y = sceneSize.rootPosition.y;\r\n }\r\n\r\n /**\r\n * Get the scene sizes according to the setup.\r\n * @returns the different ground and skybox sizes.\r\n */\r\n private _getSceneSize(): ISceneSize {\r\n let groundSize = this._options.groundSize;\r\n let skyboxSize = this._options.skyboxSize;\r\n let rootPosition = this._options.rootPosition;\r\n if (!this._scene.meshes || this._scene.meshes.length === 1) {\r\n // 1 only means the root of the helper.\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n const sceneExtends = this._scene.getWorldExtends((mesh) => {\r\n return mesh !== this._ground && mesh !== this._rootMesh && mesh !== this._skybox;\r\n });\r\n const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\r\n\r\n if (this._options.sizeAuto) {\r\n if (this._scene.activeCamera instanceof ArcRotateCamera && this._scene.activeCamera.upperRadiusLimit) {\r\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n const sceneDiagonalLenght = sceneDiagonal.length();\r\n if (sceneDiagonalLenght > groundSize) {\r\n groundSize = sceneDiagonalLenght * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n // 10 % bigger.\r\n groundSize *= 1.1;\r\n skyboxSize *= 1.5;\r\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\r\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\r\n }\r\n\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n /**\r\n * Setup the ground according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGround(sceneSize: ISceneSize): void {\r\n if (!this._ground || this._ground.isDisposed()) {\r\n this._ground = CreatePlane(\"BackgroundPlane\", { size: sceneSize.groundSize }, this._scene);\r\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\r\n this._ground.parent = this._rootMesh;\r\n this._ground.onDisposeObservable.add(() => {\r\n this._ground = null;\r\n });\r\n }\r\n\r\n this._ground.receiveShadows = this._options.enableGroundShadow;\r\n }\r\n\r\n /**\r\n * Setup the ground material according to the specified options.\r\n */\r\n private _setupGroundMaterial(): void {\r\n if (!this._groundMaterial) {\r\n this._groundMaterial = new BackgroundMaterial(\"BackgroundPlaneMaterial\", this._scene);\r\n }\r\n this._groundMaterial.alpha = this._options.groundOpacity;\r\n this._groundMaterial.alphaMode = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\r\n this._groundMaterial.primaryColor = this._options.groundColor;\r\n this._groundMaterial.useRGBColor = false;\r\n this._groundMaterial.enableNoise = true;\r\n\r\n if (this._ground) {\r\n this._ground.material = this._groundMaterial;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the ground diffuse texture according to the specified options.\r\n */\r\n private _setupGroundDiffuseTexture(): void {\r\n if (!this._groundMaterial) {\r\n return;\r\n }\r\n\r\n if (this._groundTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.groundTexture instanceof BaseTexture) {\r\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\r\n return;\r\n }\r\n\r\n this._groundTexture = new Texture(this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._groundTexture.gammaSpace = false;\r\n this._groundTexture.hasAlpha = true;\r\n this._groundMaterial.diffuseTexture = this._groundTexture;\r\n }\r\n\r\n /**\r\n * Setup the ground mirror texture according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGroundMirrorTexture(sceneSize: ISceneSize): void {\r\n const wrapping = Texture.CLAMP_ADDRESSMODE;\r\n if (!this._groundMirror) {\r\n this._groundMirror = new MirrorTexture(\r\n \"BackgroundPlaneMirrorTexture\",\r\n { ratio: this._options.groundMirrorSizeRatio },\r\n this._scene,\r\n false,\r\n this._options.groundMirrorTextureType,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n true\r\n );\r\n this._groundMirror.mirrorPlane = new Plane(0, -1, 0, sceneSize.rootPosition.y);\r\n this._groundMirror.anisotropicFilteringLevel = 1;\r\n this._groundMirror.wrapU = wrapping;\r\n this._groundMirror.wrapV = wrapping;\r\n\r\n if (this._groundMirror.renderList) {\r\n for (let i = 0; i < this._scene.meshes.length; i++) {\r\n const mesh = this._scene.meshes[i];\r\n if (mesh !== this._ground && mesh !== this._skybox && mesh !== this._rootMesh) {\r\n this._groundMirror.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n }\r\n\r\n const gammaGround = this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions);\r\n this._groundMirror.clearColor = new Color4(gammaGround.r, gammaGround.g, gammaGround.b, 1);\r\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\r\n }\r\n\r\n /**\r\n * Setup the ground to receive the mirror texture.\r\n */\r\n private _setupMirrorInGroundMaterial(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.reflectionTexture = this._groundMirror;\r\n this._groundMaterial.reflectionFresnel = true;\r\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\r\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\r\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the skybox according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupSkybox(sceneSize: ISceneSize): void {\r\n if (!this._skybox || this._skybox.isDisposed()) {\r\n this._skybox = CreateBox(\"BackgroundSkybox\", { size: sceneSize.skyboxSize, sideOrientation: Mesh.BACKSIDE }, this._scene);\r\n this._skybox.onDisposeObservable.add(() => {\r\n this._skybox = null;\r\n });\r\n }\r\n this._skybox.parent = this._rootMesh;\r\n }\r\n\r\n /**\r\n * Setup the skybox material according to the specified options.\r\n */\r\n private _setupSkyboxMaterial(): void {\r\n if (!this._skybox) {\r\n return;\r\n }\r\n\r\n if (!this._skyboxMaterial) {\r\n this._skyboxMaterial = new BackgroundMaterial(\"BackgroundSkyboxMaterial\", this._scene);\r\n }\r\n this._skyboxMaterial.useRGBColor = false;\r\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\r\n this._skyboxMaterial.enableNoise = true;\r\n\r\n this._skybox.material = this._skyboxMaterial;\r\n }\r\n\r\n /**\r\n * Setup the skybox reflection texture according to the specified options.\r\n */\r\n private _setupSkyboxReflectionTexture(): void {\r\n if (!this._skyboxMaterial) {\r\n return;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.skyboxTexture instanceof BaseTexture) {\r\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\r\n return;\r\n }\r\n\r\n this._skyboxTexture = new CubeTexture(this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._skyboxTexture.coordinatesMode = Texture.SKYBOX_MODE;\r\n this._skyboxTexture.gammaSpace = false;\r\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\r\n }\r\n\r\n private _errorHandler = (message?: string, exception?: any) => {\r\n this.onErrorObservable.notifyObservers({ message: message, exception: exception });\r\n };\r\n\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n public dispose(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.dispose(true, true);\r\n }\r\n if (this._skyboxMaterial) {\r\n this._skyboxMaterial.dispose(true, true);\r\n }\r\n this._rootMesh.dispose(false);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"environmentHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Helpers/environmentHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,sB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AAC,IAAI,CAAC,eAAe,EAAE;YACvB,OAAO;SACV;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,OAAO;SACV;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,YAAY,WAAW,EAAE;YACpD,IAAI,CAAC,eAAe,CAAC,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;YACrE,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAChJ,IAAI,CAAC,cAAc,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;QAC1D,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,KAAK,CAAC;QACvC,IAAI,CAAC,eAAe,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC;IACjE,CAAC;IAMD;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAC5C;QACD,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAC5C;QACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;;AAzgBD;;GAEG;AACY,sCAAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,sCAAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,2CAAyB,GAAG,mEAAmE,AAAtE,CAAuE","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { MirrorTexture } from \"../Materials/Textures/mirrorTexture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { BackgroundMaterial } from \"../Materials/Background/backgroundMaterial\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\n\r\n/**\r\n * Represents the different options available during the creation of\r\n * a Environment helper.\r\n *\r\n * This can control the default ground, skybox and image processing setup of your scene.\r\n */\r\nexport interface IEnvironmentHelperOptions {\r\n /**\r\n * Specifies whether or not to create a ground.\r\n * True by default.\r\n */\r\n createGround: boolean;\r\n /**\r\n * Specifies the ground size.\r\n * 15 by default.\r\n */\r\n groundSize: number;\r\n /**\r\n * The texture used on the ground for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n groundTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the ground texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n groundColor: Color3;\r\n /**\r\n * Specifies the ground opacity.\r\n * 1 by default.\r\n */\r\n groundOpacity: number;\r\n /**\r\n * Enables the ground to receive shadows.\r\n * True by default.\r\n */\r\n enableGroundShadow: boolean;\r\n /**\r\n * Helps preventing the shadow to be fully black on the ground.\r\n * 0.5 by default.\r\n */\r\n groundShadowLevel: number;\r\n /**\r\n * Creates a mirror texture attach to the ground.\r\n * false by default.\r\n */\r\n enableGroundMirror: boolean;\r\n /**\r\n * Specifies the ground mirror size ratio.\r\n * 0.3 by default as the default kernel is 64.\r\n */\r\n groundMirrorSizeRatio: number;\r\n /**\r\n * Specifies the ground mirror blur kernel size.\r\n * 64 by default.\r\n */\r\n groundMirrorBlurKernel: number;\r\n /**\r\n * Specifies the ground mirror visibility amount.\r\n * 1 by default\r\n */\r\n groundMirrorAmount: number;\r\n /**\r\n * Specifies the ground mirror reflectance weight.\r\n * This uses the standard weight of the background material to setup the fresnel effect\r\n * of the mirror.\r\n * 1 by default.\r\n */\r\n groundMirrorFresnelWeight: number;\r\n /**\r\n * Specifies the ground mirror Falloff distance.\r\n * This can helps reducing the size of the reflection.\r\n * 0 by Default.\r\n */\r\n groundMirrorFallOffDistance: number;\r\n /**\r\n * Specifies the ground mirror texture type.\r\n * Unsigned Int by Default.\r\n */\r\n groundMirrorTextureType: number;\r\n /**\r\n * Specifies a bias applied to the ground vertical position to prevent z-fighting with\r\n * the shown objects.\r\n */\r\n groundYBias: number;\r\n\r\n /**\r\n * Specifies whether or not to create a skybox.\r\n * True by default.\r\n */\r\n createSkybox: boolean;\r\n /**\r\n * Specifies the skybox size.\r\n * 20 by default.\r\n */\r\n skyboxSize: number;\r\n /**\r\n * The texture used on the skybox for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n skyboxTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the skybox texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n skyboxColor: Color3;\r\n\r\n /**\r\n * The background rotation around the Y axis of the scene.\r\n * This helps aligning the key lights of your scene with the background.\r\n * 0 by default.\r\n */\r\n backgroundYRotation: number;\r\n\r\n /**\r\n * Compute automatically the size of the elements to best fit with the scene.\r\n */\r\n sizeAuto: boolean;\r\n\r\n /**\r\n * Default position of the rootMesh if autoSize is not true.\r\n */\r\n rootPosition: Vector3;\r\n\r\n /**\r\n * Sets up the image processing in the scene.\r\n * true by default.\r\n */\r\n setupImageProcessing: boolean;\r\n\r\n /**\r\n * The texture used as your environment texture in the scene.\r\n * Comes from the BabylonJS CDN by default and in use if setupImageProcessing is true.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n environmentTexture: string | BaseTexture;\r\n\r\n /**\r\n * The value of the exposure to apply to the scene.\r\n * 0.6 by default if setupImageProcessing is true.\r\n */\r\n cameraExposure: number;\r\n\r\n /**\r\n * The value of the contrast to apply to the scene.\r\n * 1.6 by default if setupImageProcessing is true.\r\n */\r\n cameraContrast: number;\r\n\r\n /**\r\n * Specifies whether or not tonemapping should be enabled in the scene.\r\n * true by default if setupImageProcessing is true.\r\n */\r\n toneMappingEnabled: boolean;\r\n}\r\n\r\ninterface ISceneSize {\r\n groundSize: number;\r\n skyboxSize: number;\r\n rootPosition: Vector3;\r\n}\r\n\r\n/**\r\n * The EnvironmentHelper class can be used to add a fully featured non-expensive background to your scene.\r\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\r\n * It also helps with the default setup of your ImageProcessingConfiguration.\r\n */\r\nexport class EnvironmentHelper {\r\n /**\r\n * Default ground texture URL.\r\n */\r\n private static _GroundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\r\n\r\n /**\r\n * Default skybox texture URL.\r\n */\r\n private static _SkyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\r\n\r\n /**\r\n * Default environment texture URL.\r\n */\r\n private static _EnvironmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\r\n\r\n /**\r\n * Creates the default options for the helper.\r\n * @param scene The scene the environment helper belongs to.\r\n * @returns default options for the helper.\r\n */\r\n private static _GetDefaultOptions(scene: Scene): IEnvironmentHelperOptions {\r\n return {\r\n createGround: true,\r\n groundSize: 15,\r\n groundTexture: this._GroundTextureCDNUrl,\r\n groundColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n groundOpacity: 0.9,\r\n enableGroundShadow: true,\r\n groundShadowLevel: 0.5,\r\n\r\n enableGroundMirror: false,\r\n groundMirrorSizeRatio: 0.3,\r\n groundMirrorBlurKernel: 64,\r\n groundMirrorAmount: 1,\r\n groundMirrorFresnelWeight: 1,\r\n groundMirrorFallOffDistance: 0,\r\n groundMirrorTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n\r\n groundYBias: 0.00001,\r\n\r\n createSkybox: true,\r\n skyboxSize: 20,\r\n skyboxTexture: this._SkyboxTextureCDNUrl,\r\n skyboxColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n\r\n backgroundYRotation: 0,\r\n sizeAuto: true,\r\n rootPosition: Vector3.Zero(),\r\n\r\n setupImageProcessing: true,\r\n environmentTexture: this._EnvironmentTextureCDNUrl,\r\n cameraExposure: 0.8,\r\n cameraContrast: 1.2,\r\n toneMappingEnabled: true,\r\n };\r\n }\r\n\r\n private _rootMesh: Mesh;\r\n /**\r\n * Gets the root mesh created by the helper.\r\n */\r\n public get rootMesh(): Mesh {\r\n return this._rootMesh;\r\n }\r\n\r\n private _skybox: Nullable<Mesh>;\r\n /**\r\n * Gets the skybox created by the helper.\r\n */\r\n public get skybox(): Nullable<Mesh> {\r\n return this._skybox;\r\n }\r\n\r\n private _skyboxTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the skybox texture created by the helper.\r\n */\r\n public get skyboxTexture(): Nullable<BaseTexture> {\r\n return this._skyboxTexture;\r\n }\r\n\r\n private _skyboxMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the skybox material created by the helper.\r\n */\r\n public get skyboxMaterial(): Nullable<BackgroundMaterial> {\r\n return this._skyboxMaterial;\r\n }\r\n\r\n private _ground: Nullable<Mesh>;\r\n /**\r\n * Gets the ground mesh created by the helper.\r\n */\r\n public get ground(): Nullable<Mesh> {\r\n return this._ground;\r\n }\r\n\r\n private _groundTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the ground texture created by the helper.\r\n */\r\n public get groundTexture(): Nullable<BaseTexture> {\r\n return this._groundTexture;\r\n }\r\n\r\n private _groundMirror: Nullable<MirrorTexture>;\r\n /**\r\n * Gets the ground mirror created by the helper.\r\n */\r\n public get groundMirror(): Nullable<MirrorTexture> {\r\n return this._groundMirror;\r\n }\r\n\r\n /**\r\n * Gets the ground mirror render list to helps pushing the meshes\r\n * you wish in the ground reflection.\r\n */\r\n public get groundMirrorRenderList(): Nullable<AbstractMesh[]> {\r\n if (this._groundMirror) {\r\n return this._groundMirror.renderList;\r\n }\r\n return null;\r\n }\r\n\r\n private _groundMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the ground material created by the helper.\r\n */\r\n public get groundMaterial(): Nullable<BackgroundMaterial> {\r\n return this._groundMaterial;\r\n }\r\n\r\n /**\r\n * Stores the creation options.\r\n */\r\n private readonly _scene: Scene;\r\n private _options: IEnvironmentHelperOptions;\r\n\r\n /**\r\n * This observable will be notified with any error during the creation of the environment,\r\n * mainly texture creation errors.\r\n */\r\n public onErrorObservable: Observable<{ message?: string; exception?: any }>;\r\n\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(options: Partial<IEnvironmentHelperOptions>, scene: Scene) {\r\n this._options = {\r\n ...EnvironmentHelper._GetDefaultOptions(scene),\r\n ...options,\r\n };\r\n this._scene = scene;\r\n this.onErrorObservable = new Observable();\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Updates the environment according to the new options\r\n * @param options options to configure the helper (IEnvironmentHelperOptions)\r\n */\r\n public updateOptions(options: Partial<IEnvironmentHelperOptions>) {\r\n const newOptions = {\r\n ...this._options,\r\n ...options,\r\n };\r\n\r\n if (this._ground && !newOptions.createGround) {\r\n this._ground.dispose();\r\n this._ground = null;\r\n }\r\n\r\n if (this._groundMaterial && !newOptions.createGround) {\r\n this._groundMaterial.dispose();\r\n this._groundMaterial = null;\r\n }\r\n\r\n if (this._groundTexture) {\r\n if (this._options.groundTexture != newOptions.groundTexture) {\r\n this._groundTexture.dispose();\r\n this._groundTexture = null;\r\n }\r\n }\r\n\r\n if (this._skybox && !newOptions.createSkybox) {\r\n this._skybox.dispose();\r\n this._skybox = null;\r\n }\r\n\r\n if (this._skyboxMaterial && !newOptions.createSkybox) {\r\n this._skyboxMaterial.dispose();\r\n this._skyboxMaterial = null;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\r\n this._skyboxTexture.dispose();\r\n this._skyboxTexture = null;\r\n }\r\n }\r\n\r\n if (this._groundMirror && !newOptions.enableGroundMirror) {\r\n this._groundMirror.dispose();\r\n this._groundMirror = null;\r\n }\r\n\r\n if (this._scene.environmentTexture) {\r\n if (this._options.environmentTexture != newOptions.environmentTexture) {\r\n this._scene.environmentTexture.dispose();\r\n }\r\n }\r\n\r\n this._options = newOptions;\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Sets the primary color of all the available elements.\r\n * @param color the main color to affect to the ground and the background\r\n */\r\n public setMainColor(color: Color3): void {\r\n if (this.groundMaterial) {\r\n this.groundMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.skyboxMaterial) {\r\n this.skyboxMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.groundMirror) {\r\n this.groundMirror.clearColor = new Color4(color.r, color.g, color.b, 1.0);\r\n }\r\n }\r\n\r\n /**\r\n * Setup the image processing according to the specified options.\r\n */\r\n private _setupImageProcessing(): void {\r\n if (this._options.setupImageProcessing) {\r\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\r\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\r\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\r\n this._setupEnvironmentTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Setup the environment texture according to the specified options.\r\n */\r\n private _setupEnvironmentTexture(): void {\r\n if (this._scene.environmentTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.environmentTexture instanceof BaseTexture) {\r\n this._scene.environmentTexture = this._options.environmentTexture;\r\n return;\r\n }\r\n\r\n const environmentTexture = CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\r\n this._scene.environmentTexture = environmentTexture;\r\n }\r\n\r\n /**\r\n * Setup the background according to the specified options.\r\n */\r\n private _setupBackground(): void {\r\n if (!this._rootMesh) {\r\n this._rootMesh = new Mesh(\"BackgroundHelper\", this._scene);\r\n }\r\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\r\n\r\n const sceneSize = this._getSceneSize();\r\n if (this._options.createGround) {\r\n this._setupGround(sceneSize);\r\n this._setupGroundMaterial();\r\n this._setupGroundDiffuseTexture();\r\n\r\n if (this._options.enableGroundMirror) {\r\n this._setupGroundMirrorTexture(sceneSize);\r\n }\r\n this._setupMirrorInGroundMaterial();\r\n }\r\n\r\n if (this._options.createSkybox) {\r\n this._setupSkybox(sceneSize);\r\n this._setupSkyboxMaterial();\r\n this._setupSkyboxReflectionTexture();\r\n }\r\n\r\n this._rootMesh.position.x = sceneSize.rootPosition.x;\r\n this._rootMesh.position.z = sceneSize.rootPosition.z;\r\n this._rootMesh.position.y = sceneSize.rootPosition.y;\r\n }\r\n\r\n /**\r\n * Get the scene sizes according to the setup.\r\n * @returns the different ground and skybox sizes.\r\n */\r\n private _getSceneSize(): ISceneSize {\r\n let groundSize = this._options.groundSize;\r\n let skyboxSize = this._options.skyboxSize;\r\n let rootPosition = this._options.rootPosition;\r\n if (!this._scene.meshes || this._scene.meshes.length === 1) {\r\n // 1 only means the root of the helper.\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n const sceneExtends = this._scene.getWorldExtends((mesh) => {\r\n return mesh !== this._ground && mesh !== this._rootMesh && mesh !== this._skybox;\r\n });\r\n const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\r\n\r\n if (this._options.sizeAuto) {\r\n if (this._scene.activeCamera instanceof ArcRotateCamera && this._scene.activeCamera.upperRadiusLimit) {\r\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n const sceneDiagonalLenght = sceneDiagonal.length();\r\n if (sceneDiagonalLenght > groundSize) {\r\n groundSize = sceneDiagonalLenght * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n // 10 % bigger.\r\n groundSize *= 1.1;\r\n skyboxSize *= 1.5;\r\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\r\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\r\n }\r\n\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n /**\r\n * Setup the ground according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGround(sceneSize: ISceneSize): void {\r\n if (!this._ground || this._ground.isDisposed()) {\r\n this._ground = CreatePlane(\"BackgroundPlane\", { size: sceneSize.groundSize }, this._scene);\r\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\r\n this._ground.isPickable = false;\r\n this._ground.parent = this._rootMesh;\r\n this._ground.onDisposeObservable.add(() => {\r\n this._ground = null;\r\n });\r\n }\r\n\r\n this._ground.receiveShadows = this._options.enableGroundShadow;\r\n }\r\n\r\n /**\r\n * Setup the ground material according to the specified options.\r\n */\r\n private _setupGroundMaterial(): void {\r\n if (!this._groundMaterial) {\r\n this._groundMaterial = new BackgroundMaterial(\"BackgroundPlaneMaterial\", this._scene);\r\n }\r\n this._groundMaterial.alpha = this._options.groundOpacity;\r\n this._groundMaterial.alphaMode = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\r\n this._groundMaterial.primaryColor = this._options.groundColor;\r\n this._groundMaterial.useRGBColor = false;\r\n this._groundMaterial.enableNoise = true;\r\n\r\n if (this._ground) {\r\n this._ground.material = this._groundMaterial;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the ground diffuse texture according to the specified options.\r\n */\r\n private _setupGroundDiffuseTexture(): void {\r\n if (!this._groundMaterial) {\r\n return;\r\n }\r\n\r\n if (this._groundTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.groundTexture instanceof BaseTexture) {\r\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\r\n return;\r\n }\r\n\r\n this._groundTexture = new Texture(this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._groundTexture.gammaSpace = false;\r\n this._groundTexture.hasAlpha = true;\r\n this._groundMaterial.diffuseTexture = this._groundTexture;\r\n }\r\n\r\n /**\r\n * Setup the ground mirror texture according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGroundMirrorTexture(sceneSize: ISceneSize): void {\r\n const wrapping = Texture.CLAMP_ADDRESSMODE;\r\n if (!this._groundMirror) {\r\n this._groundMirror = new MirrorTexture(\r\n \"BackgroundPlaneMirrorTexture\",\r\n { ratio: this._options.groundMirrorSizeRatio },\r\n this._scene,\r\n false,\r\n this._options.groundMirrorTextureType,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n true\r\n );\r\n this._groundMirror.mirrorPlane = new Plane(0, -1, 0, sceneSize.rootPosition.y);\r\n this._groundMirror.anisotropicFilteringLevel = 1;\r\n this._groundMirror.wrapU = wrapping;\r\n this._groundMirror.wrapV = wrapping;\r\n\r\n if (this._groundMirror.renderList) {\r\n for (let i = 0; i < this._scene.meshes.length; i++) {\r\n const mesh = this._scene.meshes[i];\r\n if (mesh !== this._ground && mesh !== this._skybox && mesh !== this._rootMesh) {\r\n this._groundMirror.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n }\r\n\r\n const gammaGround = this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions);\r\n this._groundMirror.clearColor = new Color4(gammaGround.r, gammaGround.g, gammaGround.b, 1);\r\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\r\n }\r\n\r\n /**\r\n * Setup the ground to receive the mirror texture.\r\n */\r\n private _setupMirrorInGroundMaterial(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.reflectionTexture = this._groundMirror;\r\n this._groundMaterial.reflectionFresnel = true;\r\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\r\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\r\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the skybox according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupSkybox(sceneSize: ISceneSize): void {\r\n if (!this._skybox || this._skybox.isDisposed()) {\r\n this._skybox = CreateBox(\"BackgroundSkybox\", { size: sceneSize.skyboxSize, sideOrientation: Mesh.BACKSIDE }, this._scene);\r\n this._skybox.isPickable = false;\r\n this._skybox.onDisposeObservable.add(() => {\r\n this._skybox = null;\r\n });\r\n }\r\n this._skybox.parent = this._rootMesh;\r\n }\r\n\r\n /**\r\n * Setup the skybox material according to the specified options.\r\n */\r\n private _setupSkyboxMaterial(): void {\r\n if (!this._skybox) {\r\n return;\r\n }\r\n\r\n if (!this._skyboxMaterial) {\r\n this._skyboxMaterial = new BackgroundMaterial(\"BackgroundSkyboxMaterial\", this._scene);\r\n }\r\n this._skyboxMaterial.useRGBColor = false;\r\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\r\n this._skyboxMaterial.enableNoise = true;\r\n\r\n this._skybox.material = this._skyboxMaterial;\r\n }\r\n\r\n /**\r\n * Setup the skybox reflection texture according to the specified options.\r\n */\r\n private _setupSkyboxReflectionTexture(): void {\r\n if (!this._skyboxMaterial) {\r\n return;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.skyboxTexture instanceof BaseTexture) {\r\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\r\n return;\r\n }\r\n\r\n this._skyboxTexture = new CubeTexture(this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._skyboxTexture.coordinatesMode = Texture.SKYBOX_MODE;\r\n this._skyboxTexture.gammaSpace = false;\r\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\r\n }\r\n\r\n private _errorHandler = (message?: string, exception?: any) => {\r\n this.onErrorObservable.notifyObservers({ message: message, exception: exception });\r\n };\r\n\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n public dispose(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.dispose(true, true);\r\n }\r\n if (this._skyboxMaterial) {\r\n this._skyboxMaterial.dispose(true, true);\r\n }\r\n this._rootMesh.dispose(false);\r\n }\r\n}\r\n"]}
@@ -1,10 +1,10 @@
1
1
  import type { NodeMaterialBlock } from "./nodeMaterialBlock";
2
2
  import { PushMaterial } from "../pushMaterial";
3
3
  import type { Scene } from "../../scene";
4
- import { AbstractMesh } from "../../Meshes/abstractMesh";
4
+ import type { AbstractMesh } from "../../Meshes/abstractMesh";
5
5
  import { Matrix } from "../../Maths/math.vector";
6
6
  import { Color4 } from "../../Maths/math.color";
7
- import type { Mesh } from "../../Meshes/mesh";
7
+ import { Mesh } from "../../Meshes/mesh";
8
8
  import { Effect } from "../effect";
9
9
  import type { BaseTexture } from "../../Materials/Textures/baseTexture";
10
10
  import { Observable } from "../../Misc/observable";
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "../../tslib.es6.js";
2
2
  import { PushMaterial } from "../pushMaterial.js";
3
- import { AbstractMesh } from "../../Meshes/abstractMesh.js";
4
3
  import { Matrix, Vector2 } from "../../Maths/math.vector.js";
5
4
  import { Color3, Color4 } from "../../Maths/math.color.js";
5
+ import { Mesh } from "../../Meshes/mesh.js";
6
6
  import { NodeMaterialBuildState } from "./nodeMaterialBuildState.js";
7
7
  import { Effect } from "../effect.js";
8
8
  import { Observable } from "../../Misc/observable.js";
@@ -828,7 +828,7 @@ export class NodeMaterial extends PushMaterial {
828
828
  _createEffectForPostProcess(postProcess, camera, options = 1, samplingMode = 1, engine, reusable, textureType = 0, textureFormat = 5) {
829
829
  let tempName = this.name + this._buildId;
830
830
  const defines = new NodeMaterialDefines();
831
- const dummyMesh = new AbstractMesh(tempName + "PostProcess", this.getScene());
831
+ const dummyMesh = new Mesh(tempName + "PostProcess", this.getScene());
832
832
  let buildId = this._buildId;
833
833
  this._processDefines(dummyMesh, defines);
834
834
  Effect.RegisterShader(tempName, this._fragmentCompilationState._builtCompilationString, this._vertexCompilationState._builtCompilationString);
@@ -869,7 +869,7 @@ export class NodeMaterial extends PushMaterial {
869
869
  }
870
870
  let tempName = this.name + this._buildId;
871
871
  const proceduralTexture = new ProceduralTexture(tempName, size, null, scene);
872
- const dummyMesh = new AbstractMesh(tempName + "Procedural", this.getScene());
872
+ const dummyMesh = new Mesh(tempName + "Procedural", this.getScene());
873
873
  dummyMesh.reservedDataStore = {
874
874
  hidden: true,
875
875
  };
@@ -914,7 +914,7 @@ export class NodeMaterial extends PushMaterial {
914
914
  if (!dummyMesh) {
915
915
  dummyMesh = this.getScene().getMeshByName(this.name + "Particle");
916
916
  if (!dummyMesh) {
917
- dummyMesh = new AbstractMesh(this.name + "Particle", this.getScene());
917
+ dummyMesh = new Mesh(this.name + "Particle", this.getScene());
918
918
  dummyMesh.reservedDataStore = {
919
919
  hidden: true,
920
920
  };