@babylonjs/core 8.44.1 → 8.45.1

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 (131) hide show
  1. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +6 -10
  2. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  3. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
  4. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
  5. package/Cameras/Limits/geospatialLimits.d.ts +4 -22
  6. package/Cameras/Limits/geospatialLimits.js +4 -36
  7. package/Cameras/Limits/geospatialLimits.js.map +1 -1
  8. package/Cameras/geospatialCamera.d.ts +15 -4
  9. package/Cameras/geospatialCamera.js +90 -37
  10. package/Cameras/geospatialCamera.js.map +1 -1
  11. package/Cameras/geospatialCameraMovement.d.ts +1 -3
  12. package/Cameras/geospatialCameraMovement.js +15 -51
  13. package/Cameras/geospatialCameraMovement.js.map +1 -1
  14. package/Collisions/collisionCoordinator.d.ts +2 -2
  15. package/Collisions/collisionCoordinator.js +1 -0
  16. package/Collisions/collisionCoordinator.js.map +1 -1
  17. package/Engines/Extensions/engine.debugging.d.ts +3 -5
  18. package/Engines/Extensions/engine.debugging.js +3 -4
  19. package/Engines/Extensions/engine.debugging.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.debugging.js +15 -65
  21. package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
  22. package/Engines/WebGPU/webgpuTextureManager.js +9 -9
  23. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  24. package/Engines/abstractEngine.d.ts +2 -0
  25. package/Engines/abstractEngine.js +4 -2
  26. package/Engines/abstractEngine.js.map +1 -1
  27. package/Engines/thinWebGPUEngine.d.ts +0 -2
  28. package/Engines/thinWebGPUEngine.js +0 -8
  29. package/Engines/thinWebGPUEngine.js.map +1 -1
  30. package/Engines/webgpuEngine.d.ts +1 -3
  31. package/Engines/webgpuEngine.js +4 -10
  32. package/Engines/webgpuEngine.js.map +1 -1
  33. package/FrameGraph/Passes/renderPass.js +4 -9
  34. package/FrameGraph/Passes/renderPass.js.map +1 -1
  35. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
  36. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  37. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -1
  38. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +4 -1
  39. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  40. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -1
  41. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +31 -7
  42. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  43. package/FrameGraph/frameGraph.js +2 -2
  44. package/FrameGraph/frameGraph.js.map +1 -1
  45. package/FrameGraph/frameGraphContext.d.ts +9 -0
  46. package/FrameGraph/frameGraphContext.js +13 -2
  47. package/FrameGraph/frameGraphContext.js.map +1 -1
  48. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  49. package/FrameGraph/frameGraphRenderContext.d.ts +9 -8
  50. package/FrameGraph/frameGraphRenderContext.js +23 -20
  51. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  52. package/FrameGraph/frameGraphTask.d.ts +2 -0
  53. package/FrameGraph/frameGraphTask.js +14 -4
  54. package/FrameGraph/frameGraphTask.js.map +1 -1
  55. package/Lights/Shadows/cascadedShadowGenerator.js +4 -1
  56. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  57. package/Lights/Shadows/shadowGenerator.js +8 -3
  58. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  59. package/Lights/areaLight.d.ts +2 -1
  60. package/Lights/areaLight.js +3 -2
  61. package/Lights/areaLight.js.map +1 -1
  62. package/Lights/directionalLight.d.ts +2 -1
  63. package/Lights/directionalLight.js +3 -2
  64. package/Lights/directionalLight.js.map +1 -1
  65. package/Lights/hemisphericLight.d.ts +2 -1
  66. package/Lights/hemisphericLight.js +3 -2
  67. package/Lights/hemisphericLight.js.map +1 -1
  68. package/Lights/light.d.ts +2 -1
  69. package/Lights/light.js +8 -3
  70. package/Lights/light.js.map +1 -1
  71. package/Lights/lightingVolume.js +11 -6
  72. package/Lights/lightingVolume.js.map +1 -1
  73. package/Lights/pointLight.d.ts +2 -1
  74. package/Lights/pointLight.js +3 -2
  75. package/Lights/pointLight.js.map +1 -1
  76. package/Lights/rectAreaLight.d.ts +2 -1
  77. package/Lights/rectAreaLight.js +3 -2
  78. package/Lights/rectAreaLight.js.map +1 -1
  79. package/Lights/spotLight.d.ts +2 -1
  80. package/Lights/spotLight.js +3 -2
  81. package/Lights/spotLight.js.map +1 -1
  82. package/Loading/Plugins/babylonFileLoader.js +17 -0
  83. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  84. package/Materials/Node/Blocks/Input/inputBlock.js +3 -0
  85. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  86. package/Materials/Node/nodeMaterial.d.ts +1 -0
  87. package/Materials/Node/nodeMaterial.js +4 -0
  88. package/Materials/Node/nodeMaterial.js.map +1 -1
  89. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +6 -0
  90. package/Materials/Node/nodeMaterialBuildStateSharedData.js +4 -0
  91. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  92. package/Materials/Textures/Loaders/iesTextureLoader.js +1 -1
  93. package/Materials/Textures/Loaders/iesTextureLoader.js.map +1 -1
  94. package/Materials/Textures/Procedurals/proceduralTexture.js +7 -2
  95. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  96. package/Materials/Textures/internalTexture.d.ts +6 -4
  97. package/Materials/Textures/internalTexture.js +6 -4
  98. package/Materials/Textures/internalTexture.js.map +1 -1
  99. package/Materials/Textures/renderTargetTexture.js +2 -2
  100. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  101. package/Materials/Textures/textureSampler.d.ts +3 -3
  102. package/Materials/Textures/textureSampler.js.map +1 -1
  103. package/Misc/minMaxReducer.js +2 -2
  104. package/Misc/minMaxReducer.js.map +1 -1
  105. package/Misc/screenshotTools.d.ts +3 -1
  106. package/Misc/screenshotTools.js +5 -2
  107. package/Misc/screenshotTools.js.map +1 -1
  108. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.d.ts +4 -0
  109. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js +10 -0
  110. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -1
  111. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  112. package/Particles/Node/Blocks/systemBlock.js +32 -1
  113. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  114. package/Particles/Node/nodeParticleSystemSet.helper.js +65 -46
  115. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  116. package/Particles/thinParticleSystem.js +10 -6
  117. package/Particles/thinParticleSystem.js.map +1 -1
  118. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js +4 -1
  119. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js.map +1 -1
  120. package/Probes/reflectionProbe.js +9 -2
  121. package/Probes/reflectionProbe.js.map +1 -1
  122. package/Rendering/depthRenderer.js +7 -2
  123. package/Rendering/depthRenderer.js.map +1 -1
  124. package/Shaders/particles.vertex.js +8 -1
  125. package/Shaders/particles.vertex.js.map +1 -1
  126. package/ShadersWGSL/particles.vertex.js +6 -0
  127. package/ShadersWGSL/particles.vertex.js.map +1 -1
  128. package/package.json +1 -1
  129. package/scene.d.ts +10 -0
  130. package/scene.js +30 -5
  131. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"spotLight.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/spotLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE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OAIG;IACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QAC/D,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;QACzC,OAAO,CAAC,uBAAuB,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1H,OAAO,CAAC,iBAAiB,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1H,CAAC;CACJ;AA3bG;IADC,SAAS,EAAE;sCAGX;AAkBD;IADC,SAAS,EAAE;2CAGX;AAgBD;IADC,SAAS,EAAE;iDAGX;AAaM;IADN,SAAS,EAAE;2CACY;AAexB;IADC,SAAS,EAAE;2DAGX;AAcD;IADC,SAAS,EAAE;0DAGX;AAcD;IADC,SAAS,EAAE;6DAGX;AAUO;IADP,kBAAkB,CAAC,uBAAuB,CAAC;qDACM;AA6UtD,sBAAsB;AACtB,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsTexture } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport type { ProceduralTexture } from \"../Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_2\", (name, scene) => {\r\n return () => new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene);\r\n});\r\n\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class SpotLight extends ShadowLight {\r\n /*\r\n upVector , rightVector and direction will form the coordinate system for this spot light.\r\n These three vectors will be used as projection matrix when doing texture projection.\r\n\r\n Also we have the following rules always holds:\r\n direction cross up = right\r\n right cross direction = up\r\n up cross right = forward\r\n\r\n light_near and light_far will control the range of the texture projection. If a plane is\r\n out of the range in spot light space, there is no texture projection.\r\n */\r\n\r\n private _angle: number;\r\n private _innerAngle: number = 0;\r\n /** @internal */\r\n public _cosHalfAngle: number;\r\n\r\n /** @internal */\r\n public _lightAngleScale: number;\r\n /** @internal */\r\n public _lightAngleOffset: number;\r\n\r\n private _iesProfileTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Gets or sets the IES profile texture used to create the spotlight\r\n * @see https://playground.babylonjs.com/#UIAXAU#1\r\n */\r\n public get iesProfileTexture(): Nullable<BaseTexture> {\r\n return this._iesProfileTexture;\r\n }\r\n\r\n public set iesProfileTexture(value: Nullable<BaseTexture>) {\r\n if (this._iesProfileTexture === value) {\r\n return;\r\n }\r\n\r\n this._iesProfileTexture = value;\r\n\r\n if (this._iesProfileTexture && SpotLight._IsTexture(this._iesProfileTexture)) {\r\n this._iesProfileTexture.onLoadObservable.addOnce(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n @serialize()\r\n public get angle(): number {\r\n return this._angle;\r\n }\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n public set angle(value: number) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n }\r\n\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n @serialize()\r\n public get innerAngle(): number {\r\n return this._innerAngle;\r\n }\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n public set innerAngle(value: number) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n }\r\n\r\n private _shadowAngleScale: number;\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n @serialize()\r\n public get shadowAngleScale(): number {\r\n return this._shadowAngleScale;\r\n }\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n public set shadowAngleScale(value: number) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * The light decay speed with the distance from the emission spot.\r\n */\r\n @serialize()\r\n public exponent: number;\r\n\r\n private _projectionTextureMatrix = Matrix.Zero();\r\n /**\r\n * Allows reading the projection texture\r\n */\r\n public get projectionTextureMatrix(): Matrix {\r\n return this._projectionTextureMatrix;\r\n }\r\n\r\n protected _projectionTextureLightNear: number = 1e-6;\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightNear(): number {\r\n return this._projectionTextureLightNear;\r\n }\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightNear(value: number) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureLightFar: number = 1000.0;\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightFar(): number {\r\n return this._projectionTextureLightFar;\r\n }\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightFar(value: number) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureUpDirection: Vector3 = Vector3.Up();\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureUpDirection(): Vector3 {\r\n return this._projectionTextureUpDirection;\r\n }\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureUpDirection(value: Vector3) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n @serializeAsTexture(\"projectedLightTexture\")\r\n private _projectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n public get projectionTexture(): Nullable<BaseTexture> {\r\n return this._projectionTexture;\r\n }\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n public set projectionTexture(value: Nullable<BaseTexture>) {\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\r\n this._projectionTexture.getEffect().executeWhenCompiled(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n } else if (SpotLight._IsTexture(this._projectionTexture)) {\r\n this._projectionTexture.onLoadObservable.addOnce(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n }\r\n\r\n private static _IsProceduralTexture(texture: BaseTexture): texture is ProceduralTexture {\r\n return (texture as ProceduralTexture).onGeneratedObservable !== undefined;\r\n }\r\n\r\n private static _IsTexture(texture: BaseTexture): texture is Texture {\r\n return (texture as Texture).onLoadObservable !== undefined;\r\n }\r\n\r\n private _projectionTextureViewLightDirty = true;\r\n private _projectionTextureProjectionLightDirty = true;\r\n private _projectionTextureDirty = true;\r\n private _projectionTextureViewTargetVector = Vector3.Zero();\r\n private _projectionTextureViewLightMatrix = Matrix.Zero();\r\n\r\n private _projectionTextureProjectionLightMatrix = Matrix.Zero();\r\n /**\r\n * Gets or sets the light projection matrix as used by the projection texture\r\n */\r\n public get projectionTextureProjectionLightMatrix(): Matrix {\r\n return this._projectionTextureProjectionLightMatrix;\r\n }\r\n\r\n public set projectionTextureProjectionLightMatrix(projection: Matrix) {\r\n this._projectionTextureProjectionLightMatrix = projection;\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n }\r\n\r\n private _projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.position = position;\r\n this.direction = direction;\r\n this.angle = angle;\r\n this.exponent = exponent;\r\n }\r\n\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"SpotLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public override getTypeID(): number {\r\n return Light.LIGHTTYPEID_SPOTLIGHT;\r\n }\r\n\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected override _setDirection(value: Vector3) {\r\n super._setDirection(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected override _setPosition(value: Vector3) {\r\n super._setPosition(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n if (!activeCamera) {\r\n return;\r\n }\r\n\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n const angle = this._shadowAngleScale * this._angle;\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.PerspectiveFovLHToRef(\r\n angle,\r\n 1.0,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n true,\r\n this._scene.getEngine().isNDCHalfZRange,\r\n undefined,\r\n useReverseDepthBuffer\r\n );\r\n }\r\n\r\n protected _computeProjectionTextureViewLightMatrix(): void {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n this.getAbsolutePosition().addToRef(this.getShadowDirection(), this._projectionTextureViewTargetVector);\r\n Matrix.LookAtLHToRef(this.getAbsolutePosition(), this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n }\r\n\r\n protected _computeProjectionTextureProjectionLightMatrix(): void {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n const lightFar = this.projectionTextureLightFar;\r\n const lightNear = this.projectionTextureLightNear;\r\n\r\n const p = lightFar / (lightFar - lightNear);\r\n const q = -p * lightNear;\r\n const s = 1.0 / Math.tan(this._angle / 2.0);\r\n const a = 1.0;\r\n\r\n Matrix.FromValuesToRef(s / a, 0.0, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, 0.0, p, 1.0, 0.0, 0.0, q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n }\r\n\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n protected _computeProjectionTextureMatrix(): void {\r\n this._projectionTextureDirty = false;\r\n\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n if (this._projectionTexture instanceof Texture) {\r\n const u = this._projectionTexture.uScale / 2.0;\r\n const v = this._projectionTexture.vScale / 2.0;\r\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\r\n }\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n private _computeAngleValues(): void {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle);\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n public override transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightTexture\" + lightIndex, this.projectionTexture);\r\n }\r\n\r\n if (this._iesProfileTexture && this._iesProfileTexture.isReady()) {\r\n effect.setTexture(\"iesLightTexture\" + lightIndex, this._iesProfileTexture);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect object with the SpotLight transformed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): SpotLight {\r\n let normalizeDirection;\r\n const offset = this._scene.floatingOriginOffset;\r\n\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\r\n \"vLightData\",\r\n this.transformedPosition.x - offset.x,\r\n this.transformedPosition.y - offset.y,\r\n this.transformedPosition.z - offset.z,\r\n this.exponent,\r\n lightIndex\r\n );\r\n\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x - offset.x, this.position.y - offset.y, this.position.z - offset.z, this.exponent, lightIndex);\r\n\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n let normalizeDirection;\r\n\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n if (this._iesProfileTexture) {\r\n this._iesProfileTexture.dispose();\r\n this._iesProfileTexture = null;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n public override getDepthMinZ(activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : (activeCamera?.minZ ?? Constants.ShadowMinZ);\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? minZ : this._scene.getEngine().isNDCHalfZRange ? 0 : minZ;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n public override getDepthMaxZ(activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : (activeCamera?.maxZ ?? Constants.ShadowMaxZ);\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : maxZ;\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n defines[\"IESLIGHTTEXTURE\" + lightIndex] = this._iesProfileTexture && this._iesProfileTexture.isReady() ? true : false;\r\n }\r\n}\r\n\r\n// Register Class Name\r\nRegisterClass(\"BABYLON.SpotLight\", SpotLight);\r\n"]}
1
+ {"version":3,"file":"spotLight.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/spotLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAGxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,gCAA+B;AAEnD,IAAI,CAAC,kB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AI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1H,CAAC;CACJ;AA5bG;IADC,SAAS,EAAE;sCAGX;AAkBD;IADC,SAAS,EAAE;2CAGX;AAgBD;IADC,SAAS,EAAE;iDAGX;AAaM;IADN,SAAS,EAAE;2CACY;AAexB;IADC,SAAS,EAAE;2DAGX;AAcD;IADC,SAAS,EAAE;0DAGX;AAcD;IADC,SAAS,EAAE;6DAGX;AAUO;IADP,kBAAkB,CAAC,uBAAuB,CAAC;qDACM;AA8UtD,sBAAsB;AACtB,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsTexture } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport type { ProceduralTexture } from \"../Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_2\", (name, scene) => {\r\n return () => new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene);\r\n});\r\n\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class SpotLight extends ShadowLight {\r\n /*\r\n upVector , rightVector and direction will form the coordinate system for this spot light.\r\n These three vectors will be used as projection matrix when doing texture projection.\r\n\r\n Also we have the following rules always holds:\r\n direction cross up = right\r\n right cross direction = up\r\n up cross right = forward\r\n\r\n light_near and light_far will control the range of the texture projection. If a plane is\r\n out of the range in spot light space, there is no texture projection.\r\n */\r\n\r\n private _angle: number;\r\n private _innerAngle: number = 0;\r\n /** @internal */\r\n public _cosHalfAngle: number;\r\n\r\n /** @internal */\r\n public _lightAngleScale: number;\r\n /** @internal */\r\n public _lightAngleOffset: number;\r\n\r\n private _iesProfileTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Gets or sets the IES profile texture used to create the spotlight\r\n * @see https://playground.babylonjs.com/#UIAXAU#1\r\n */\r\n public get iesProfileTexture(): Nullable<BaseTexture> {\r\n return this._iesProfileTexture;\r\n }\r\n\r\n public set iesProfileTexture(value: Nullable<BaseTexture>) {\r\n if (this._iesProfileTexture === value) {\r\n return;\r\n }\r\n\r\n this._iesProfileTexture = value;\r\n\r\n if (this._iesProfileTexture && SpotLight._IsTexture(this._iesProfileTexture)) {\r\n this._iesProfileTexture.onLoadObservable.addOnce(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n @serialize()\r\n public get angle(): number {\r\n return this._angle;\r\n }\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n public set angle(value: number) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n }\r\n\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n @serialize()\r\n public get innerAngle(): number {\r\n return this._innerAngle;\r\n }\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n public set innerAngle(value: number) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n }\r\n\r\n private _shadowAngleScale: number;\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n @serialize()\r\n public get shadowAngleScale(): number {\r\n return this._shadowAngleScale;\r\n }\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n public set shadowAngleScale(value: number) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * The light decay speed with the distance from the emission spot.\r\n */\r\n @serialize()\r\n public exponent: number;\r\n\r\n private _projectionTextureMatrix = Matrix.Zero();\r\n /**\r\n * Allows reading the projection texture\r\n */\r\n public get projectionTextureMatrix(): Matrix {\r\n return this._projectionTextureMatrix;\r\n }\r\n\r\n protected _projectionTextureLightNear: number = 1e-6;\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightNear(): number {\r\n return this._projectionTextureLightNear;\r\n }\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightNear(value: number) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureLightFar: number = 1000.0;\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightFar(): number {\r\n return this._projectionTextureLightFar;\r\n }\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightFar(value: number) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureUpDirection: Vector3 = Vector3.Up();\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureUpDirection(): Vector3 {\r\n return this._projectionTextureUpDirection;\r\n }\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureUpDirection(value: Vector3) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n @serializeAsTexture(\"projectedLightTexture\")\r\n private _projectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n public get projectionTexture(): Nullable<BaseTexture> {\r\n return this._projectionTexture;\r\n }\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n public set projectionTexture(value: Nullable<BaseTexture>) {\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\r\n this._projectionTexture.getEffect().executeWhenCompiled(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n } else if (SpotLight._IsTexture(this._projectionTexture)) {\r\n this._projectionTexture.onLoadObservable.addOnce(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n }\r\n\r\n private static _IsProceduralTexture(texture: BaseTexture): texture is ProceduralTexture {\r\n return (texture as ProceduralTexture).onGeneratedObservable !== undefined;\r\n }\r\n\r\n private static _IsTexture(texture: BaseTexture): texture is Texture {\r\n return (texture as Texture).onLoadObservable !== undefined;\r\n }\r\n\r\n private _projectionTextureViewLightDirty = true;\r\n private _projectionTextureProjectionLightDirty = true;\r\n private _projectionTextureDirty = true;\r\n private _projectionTextureViewTargetVector = Vector3.Zero();\r\n private _projectionTextureViewLightMatrix = Matrix.Zero();\r\n\r\n private _projectionTextureProjectionLightMatrix = Matrix.Zero();\r\n /**\r\n * Gets or sets the light projection matrix as used by the projection texture\r\n */\r\n public get projectionTextureProjectionLightMatrix(): Matrix {\r\n return this._projectionTextureProjectionLightMatrix;\r\n }\r\n\r\n public set projectionTextureProjectionLightMatrix(projection: Matrix) {\r\n this._projectionTextureProjectionLightMatrix = projection;\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n }\r\n\r\n private _projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n * @param dontAddToScene True to not add the light to the scene\r\n */\r\n constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene?: Scene, dontAddToScene?: boolean) {\r\n super(name, scene, dontAddToScene);\r\n\r\n this.position = position;\r\n this.direction = direction;\r\n this.angle = angle;\r\n this.exponent = exponent;\r\n }\r\n\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"SpotLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public override getTypeID(): number {\r\n return Light.LIGHTTYPEID_SPOTLIGHT;\r\n }\r\n\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected override _setDirection(value: Vector3) {\r\n super._setDirection(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected override _setPosition(value: Vector3) {\r\n super._setPosition(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n if (!activeCamera) {\r\n return;\r\n }\r\n\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n const angle = this._shadowAngleScale * this._angle;\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.PerspectiveFovLHToRef(\r\n angle,\r\n 1.0,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n true,\r\n this._scene.getEngine().isNDCHalfZRange,\r\n undefined,\r\n useReverseDepthBuffer\r\n );\r\n }\r\n\r\n protected _computeProjectionTextureViewLightMatrix(): void {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n this.getAbsolutePosition().addToRef(this.getShadowDirection(), this._projectionTextureViewTargetVector);\r\n Matrix.LookAtLHToRef(this.getAbsolutePosition(), this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n }\r\n\r\n protected _computeProjectionTextureProjectionLightMatrix(): void {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n const lightFar = this.projectionTextureLightFar;\r\n const lightNear = this.projectionTextureLightNear;\r\n\r\n const p = lightFar / (lightFar - lightNear);\r\n const q = -p * lightNear;\r\n const s = 1.0 / Math.tan(this._angle / 2.0);\r\n const a = 1.0;\r\n\r\n Matrix.FromValuesToRef(s / a, 0.0, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, 0.0, p, 1.0, 0.0, 0.0, q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n }\r\n\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n protected _computeProjectionTextureMatrix(): void {\r\n this._projectionTextureDirty = false;\r\n\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n if (this._projectionTexture instanceof Texture) {\r\n const u = this._projectionTexture.uScale / 2.0;\r\n const v = this._projectionTexture.vScale / 2.0;\r\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\r\n }\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n private _computeAngleValues(): void {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle);\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n public override transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightTexture\" + lightIndex, this.projectionTexture);\r\n }\r\n\r\n if (this._iesProfileTexture && this._iesProfileTexture.isReady()) {\r\n effect.setTexture(\"iesLightTexture\" + lightIndex, this._iesProfileTexture);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect object with the SpotLight transformed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): SpotLight {\r\n let normalizeDirection;\r\n const offset = this._scene.floatingOriginOffset;\r\n\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\r\n \"vLightData\",\r\n this.transformedPosition.x - offset.x,\r\n this.transformedPosition.y - offset.y,\r\n this.transformedPosition.z - offset.z,\r\n this.exponent,\r\n lightIndex\r\n );\r\n\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x - offset.x, this.position.y - offset.y, this.position.z - offset.z, this.exponent, lightIndex);\r\n\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n let normalizeDirection;\r\n\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n if (this._iesProfileTexture) {\r\n this._iesProfileTexture.dispose();\r\n this._iesProfileTexture = null;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n public override getDepthMinZ(activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : (activeCamera?.minZ ?? Constants.ShadowMinZ);\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? minZ : this._scene.getEngine().isNDCHalfZRange ? 0 : minZ;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n public override getDepthMaxZ(activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : (activeCamera?.maxZ ?? Constants.ShadowMaxZ);\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : maxZ;\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n defines[\"IESLIGHTTEXTURE\" + lightIndex] = this._iesProfileTexture && this._iesProfileTexture.isReady() ? true : false;\r\n }\r\n}\r\n\r\n// Register Class Name\r\nRegisterClass(\"BABYLON.SpotLight\", SpotLight);\r\n"]}
@@ -28,6 +28,7 @@ import { Tools } from "../../Misc/tools.js";
28
28
  import { PostProcess } from "../../PostProcesses/postProcess.js";
29
29
  import { SpriteManager } from "../../Sprites/spriteManager.js";
30
30
  import { GetIndividualParser, Parse } from "./babylonFileParser.function.js";
31
+ import { Observable } from "../../Misc/observable.js";
31
32
  /** @internal */
32
33
  // eslint-disable-next-line @typescript-eslint/naming-convention, no-var
33
34
  export var _BabylonLoaderRegistered = true;
@@ -146,6 +147,9 @@ export function LoadAssetContainerFromSerializedScene(scene, serializedScene, ro
146
147
  }
147
148
  const LoadAssetContainer = (scene, data, rootUrl, onError, addToScene = false) => {
148
149
  const container = new AssetContainer(scene);
150
+ if (!addToScene) {
151
+ scene._blockEntityCollection = true;
152
+ }
149
153
  // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
150
154
  // when SceneLoader.debugLogging = true (default), or exception encountered.
151
155
  // Everything stored in var log instead of writing separate lines to support only writing in exception,
@@ -316,7 +320,17 @@ const LoadAssetContainer = (scene, data, rootUrl, onError, addToScene = false) =
316
320
  if (vertexData !== undefined && vertexData !== null) {
317
321
  for (index = 0, cache = vertexData.length; index < cache; index++) {
318
322
  const parsedVertexData = vertexData[index];
323
+ // Geometies are found by loadedUniqueId when imported
324
+ // So we need to temporarily unblock the entity collection to add them to the scene
325
+ scene._blockEntityCollection = false;
326
+ // Temporarily replace the onNewGeometryAddedObservable to avoid multiple notifications
327
+ const onNewGeometryAddedObservable = scene.onNewGeometryAddedObservable;
328
+ scene.onNewGeometryAddedObservable = new Observable();
319
329
  addedGeometry.push(Geometry.Parse(parsedVertexData, scene, rootUrl));
330
+ // Restore the onNewGeometryAddedObservable
331
+ scene.onNewGeometryAddedObservable = onNewGeometryAddedObservable;
332
+ // Restore the previous state of entity collection blocking
333
+ scene._blockEntityCollection = !addToScene;
320
334
  }
321
335
  }
322
336
  for (const g of addedGeometry) {
@@ -573,7 +587,10 @@ const LoadAssetContainer = (scene, data, rootUrl, onError, addToScene = false) =
573
587
  TempMaterialIndexContainer = {};
574
588
  TempMorphTargetManagerIndexContainer = {};
575
589
  if (!addToScene) {
590
+ // Removes any breadcrumb left during the loading like geometries
576
591
  container.removeAllFromScene();
592
+ // Unblock entity collection
593
+ scene._blockEntityCollection = false;
577
594
  }
578
595
  if (log !== null && SceneLoaderFlags.loggingLevel !== 0) {
579
596
  Logger.Log(logOperation("loadAssets", parsedData ? parsedData.producer : "Unknown") + (SceneLoaderFlags.loggingLevel !== 1 ? log : ""));