@onerjs/core 8.26.4 → 8.26.6

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 (151) hide show
  1. package/Engines/abstractEngine.js +2 -2
  2. package/Engines/abstractEngine.js.map +1 -1
  3. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +6 -0
  4. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  5. package/FrameGraph/frameGraphContext.d.ts +2 -1
  6. package/FrameGraph/frameGraphContext.js +4 -1
  7. package/FrameGraph/frameGraphContext.js.map +1 -1
  8. package/Lights/Clustered/clusteredLightContainer.d.ts +1 -1
  9. package/Lights/Clustered/clusteredLightContainer.js +4 -5
  10. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  11. package/Lights/pointLight.js +4 -4
  12. package/Lights/pointLight.js.map +1 -1
  13. package/Lights/rectAreaLight.js +4 -4
  14. package/Lights/rectAreaLight.js.map +1 -1
  15. package/Lights/spotLight.js +2 -2
  16. package/Lights/spotLight.js.map +1 -1
  17. package/Materials/Background/backgroundMaterial.d.ts +19 -91
  18. package/Materials/Background/backgroundMaterial.js +17 -245
  19. package/Materials/Background/backgroundMaterial.js.map +1 -1
  20. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +3 -1
  21. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +15 -6
  22. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  23. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -1
  24. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  25. package/Materials/Node/Blocks/Dual/lightBlock.js +15 -4
  26. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  27. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +20 -0
  28. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +41 -3
  29. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  30. package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.js +0 -1
  31. package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.js.map +1 -1
  32. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -5
  33. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  34. package/Materials/Node/nodeMaterial.d.ts +57 -69
  35. package/Materials/Node/nodeMaterial.js +9 -86
  36. package/Materials/Node/nodeMaterial.js.map +1 -1
  37. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -1
  38. package/Materials/Node/nodeMaterialBuildState.js +35 -15
  39. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  40. package/Materials/PBR/index.d.ts +5 -0
  41. package/Materials/PBR/index.js +5 -0
  42. package/Materials/PBR/index.js.map +1 -1
  43. package/Materials/PBR/openPbrMaterial.d.ts +998 -0
  44. package/Materials/PBR/openPbrMaterial.js +2069 -0
  45. package/Materials/PBR/openPbrMaterial.js.map +1 -0
  46. package/Materials/PBR/pbrBaseMaterial.d.ts +65 -43
  47. package/Materials/PBR/pbrBaseMaterial.js +37 -308
  48. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  49. package/Materials/PBR/pbrMaterial.d.ts +0 -78
  50. package/Materials/PBR/pbrMaterial.js +0 -110
  51. package/Materials/PBR/pbrMaterial.js.map +1 -1
  52. package/Materials/floatingOriginMatrixOverrides.d.ts +3 -0
  53. package/Materials/floatingOriginMatrixOverrides.js +91 -0
  54. package/Materials/floatingOriginMatrixOverrides.js.map +1 -0
  55. package/Materials/imageProcessing.d.ts +65 -0
  56. package/Materials/imageProcessing.js +162 -0
  57. package/Materials/imageProcessing.js.map +1 -0
  58. package/Materials/imageProcessingConfiguration.defines.d.ts +25 -0
  59. package/Materials/imageProcessingConfiguration.defines.js +27 -0
  60. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  61. package/Materials/index.d.ts +2 -0
  62. package/Materials/index.js +2 -0
  63. package/Materials/index.js.map +1 -1
  64. package/Materials/material.d.ts +14 -0
  65. package/Materials/material.js +14 -0
  66. package/Materials/material.js.map +1 -1
  67. package/Materials/materialHelper.functions.d.ts +53 -0
  68. package/Materials/materialHelper.functions.js +297 -0
  69. package/Materials/materialHelper.functions.js.map +1 -1
  70. package/Materials/standardMaterial.d.ts +57 -121
  71. package/Materials/standardMaterial.js +21 -250
  72. package/Materials/standardMaterial.js.map +1 -1
  73. package/Materials/uv.defines.d.ts +22 -0
  74. package/Materials/uv.defines.js +24 -0
  75. package/Materials/uv.defines.js.map +1 -0
  76. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -0
  77. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  78. package/Misc/decorators.d.ts +7 -0
  79. package/Misc/decorators.js +34 -0
  80. package/Misc/decorators.js.map +1 -1
  81. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +10 -1
  82. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  83. package/Particles/Node/Blocks/index.d.ts +2 -0
  84. package/Particles/Node/Blocks/index.js +2 -0
  85. package/Particles/Node/Blocks/index.js.map +1 -1
  86. package/Particles/Node/Blocks/particleInputBlock.js +4 -1
  87. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  88. package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +38 -0
  89. package/Particles/Node/Blocks/particleLocalVariableBlock.js +108 -0
  90. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -0
  91. package/Particles/Node/Blocks/particleVectorLengthBlock.d.ts +26 -0
  92. package/Particles/Node/Blocks/particleVectorLengthBlock.js +50 -0
  93. package/Particles/Node/Blocks/particleVectorLengthBlock.js.map +1 -0
  94. package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +2 -1
  95. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +45 -0
  96. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  97. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
  98. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  99. package/Rendering/geometryBufferRenderer.js +6 -4
  100. package/Rendering/geometryBufferRenderer.js.map +1 -1
  101. package/Rendering/iblCdfGenerator.js +28 -20
  102. package/Rendering/iblCdfGenerator.js.map +1 -1
  103. package/Rendering/reflectiveShadowMap.d.ts +3 -3
  104. package/Shaders/ShadersInclude/backgroundUboDeclaration.js +1 -1
  105. package/Shaders/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
  106. package/Shaders/ShadersInclude/clusteredLightingFunctions.js +3 -1
  107. package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -1
  108. package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
  109. package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  110. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +34 -0
  111. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  112. package/Shaders/ShadersInclude/helperFunctions.js +1 -1
  113. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  114. package/Shaders/ShadersInclude/importanceSampling.js +4 -0
  115. package/Shaders/ShadersInclude/importanceSampling.js.map +1 -1
  116. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +1 -0
  117. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  118. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
  119. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  120. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -0
  121. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  122. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +3 -1
  123. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  124. package/Shaders/ShadersInclude/pbrHelperFunctions.js +2 -0
  125. package/Shaders/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  126. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  127. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  128. package/Shaders/openpbr.vertex.js +1 -1
  129. package/Shaders/openpbr.vertex.js.map +1 -1
  130. package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js +1 -1
  131. package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
  132. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
  133. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  134. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -0
  135. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  136. package/ShadersWGSL/ShadersInclude/importanceSampling.js +4 -0
  137. package/ShadersWGSL/ShadersInclude/importanceSampling.js.map +1 -1
  138. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +1 -1
  139. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  140. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +3 -1
  141. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  142. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +2 -0
  143. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  144. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  145. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  146. package/ShadersWGSL/openpbr.vertex.js +1 -1
  147. package/ShadersWGSL/openpbr.vertex.js.map +1 -1
  148. package/package.json +1 -1
  149. package/scene.d.ts +21 -0
  150. package/scene.js +29 -3
  151. package/scene.js.map +1 -1
@@ -277,6 +277,9 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
277
277
  this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {
278
278
  for (let i = 0; i < this._scene.lights.length; i++) {
279
279
  const light = this._scene.lights[i];
280
+ if (!light.setShadowProjectionMatrix) {
281
+ continue; // Ignore lights that cannot cast shadows
282
+ }
280
283
  shadowEnabled.set(light, light.shadowEnabled);
281
284
  light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);
282
285
  }
@@ -285,6 +288,9 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
285
288
  this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {
286
289
  for (let i = 0; i < this._scene.lights.length; i++) {
287
290
  const light = this._scene.lights[i];
291
+ if (!light.setShadowProjectionMatrix) {
292
+ continue; // Ignore lights that cannot cast shadows
293
+ }
288
294
  light.shadowEnabled = shadowEnabled.get(light);
289
295
  }
290
296
  });
@@ -1 +1 @@
1
- {"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,CAAC;IAuBD;;;OAGG;IACH,IAAW,sBAAsB;QAC7B,OAAO,IAAI,CAAC,uBAAuB,CAAC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E,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC9C,KAAK,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n AbstractEngine,\r\n BoundingBoxRenderer,\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle | FrameGraphTextureHandle[];\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n private _disableImageProcessing = false;\r\n /**\r\n * If image processing should be disabled (default is false).\r\n * false means that the default image processing configuration will be applied (the one from the scene)\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._renderer.disableImageProcessing = value;\r\n }\r\n\r\n /**\r\n * Sets this property to true if this task is the main object renderer of the frame graph.\r\n * It will help to locate the main object renderer in the frame graph when multiple object renderers are used.\r\n * This is useful for the inspector to know which object renderer to use for additional rendering features like wireframe rendering or frustum light debugging.\r\n * It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.\r\n */\r\n public isMainObjectRenderer = false;\r\n\r\n private _renderParticles = true;\r\n /**\r\n * Define if particles should be rendered (default is true).\r\n */\r\n public get renderParticles() {\r\n return this._renderParticles;\r\n }\r\n\r\n public set renderParticles(value: boolean) {\r\n if (value === this._renderParticles) {\r\n return;\r\n }\r\n\r\n this._renderParticles = value;\r\n this._renderer.renderParticles = value;\r\n }\r\n\r\n private _renderSprites = true;\r\n /**\r\n * Define if sprites should be rendered (default is true).\r\n */\r\n public get renderSprites() {\r\n return this._renderSprites;\r\n }\r\n\r\n public set renderSprites(value: boolean) {\r\n if (value === this._renderSprites) {\r\n return;\r\n }\r\n\r\n this._renderSprites = value;\r\n this._renderer.renderSprites = value;\r\n }\r\n\r\n private _forceLayerMaskCheck = true;\r\n /**\r\n * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.\r\n */\r\n public get forceLayerMaskCheck() {\r\n return this._forceLayerMaskCheck;\r\n }\r\n\r\n public set forceLayerMaskCheck(value: boolean) {\r\n if (value === this._forceLayerMaskCheck) {\r\n return;\r\n }\r\n\r\n this._forceLayerMaskCheck = value;\r\n this._renderer.forceLayerMaskCheck = value;\r\n }\r\n\r\n private _enableBoundingBoxRendering = true;\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is true.\r\n */\r\n public get enableBoundingBoxRendering() {\r\n return this._enableBoundingBoxRendering;\r\n }\r\n\r\n public set enableBoundingBoxRendering(value: boolean) {\r\n if (value === this._enableBoundingBoxRendering) {\r\n return;\r\n }\r\n\r\n this._enableBoundingBoxRendering = value;\r\n this._renderer.enableBoundingBoxRendering = value;\r\n }\r\n\r\n private _enableOutlineRendering = true;\r\n /**\r\n * Enables the rendering of outlines/overlays for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public get enableOutlineRendering() {\r\n return this._enableOutlineRendering;\r\n }\r\n\r\n public set enableOutlineRendering(value: boolean) {\r\n if (value === this._enableOutlineRendering) {\r\n return;\r\n }\r\n\r\n this._enableOutlineRendering = value;\r\n this._renderer.enableOutlineRendering = value;\r\n }\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _engine: AbstractEngine;\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n\r\n /**\r\n * Constructs a new object renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n this._renderer.disableImageProcessing = this._disableImageProcessing;\r\n this._renderer.renderParticles = this._renderParticles;\r\n this._renderer.renderSprites = this._renderSprites;\r\n this._renderer.enableBoundingBoxRendering = this._enableBoundingBoxRendering;\r\n this._renderer.forceLayerMaskCheck = this._forceLayerMaskCheck;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture and objectList are required`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const targetTextures = Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(targetTextures[0]);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && (targetTextures[0] !== backbufferColorTextureHandle || targetTextures.length > 1)) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`\r\n );\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(targetTextures);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (this as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n const currentBoundingBoxMeshList = boundingBoxRenderer && boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];\r\n if (boundingBoxRenderer) {\r\n currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;\r\n }\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n const camera = this._renderer.activeCamera;\r\n if (camera && camera.cameraRigMode !== Constants.RIG_MODE_NONE && !camera._renderingMultiview) {\r\n for (let index = 0; index < camera._rigCameras.length; index++) {\r\n const rigCamera = camera._rigCameras[index];\r\n\r\n rigCamera.rigParent = undefined; // for some reasons, ObjectRenderer uses the rigParent viewport if rigParent is defined (we want to use rigCamera.viewport instead)\r\n\r\n this._renderer.activeCamera = rigCamera;\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n rigCamera.rigParent = camera;\r\n }\r\n this._renderer.activeCamera = camera;\r\n } else {\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n }\r\n\r\n additionalExecute?.(context);\r\n\r\n if (boundingBoxRenderer) {\r\n boundingBoxRenderer.renderList.data = currentBoundingBoxMeshList;\r\n boundingBoxRenderer.renderList.length = currentBoundingBoxMeshList.length;\r\n }\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(targetTextures);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,CAAC;IAuBD;;;OAGG;IACH,IAAW,sBAAsB;QAC7B,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAED,IAAW,sBAAsB,CAAC,KAAc;QAC5C,IAAI,KAAK,KAAK,IAAI,CAAC,uBAAuB,EAAE,CAAC;YACzC,OAAO;QACX,CAAC;QAED,IAAI,CAAC,u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AC;oBACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC9C,KAAK,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,CAAE,KAAqB,CAAC,yBAAyB,EAAE,CAAC;oBACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n AbstractEngine,\r\n BoundingBoxRenderer,\r\n ShadowLight,\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle | FrameGraphTextureHandle[];\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n private _disableImageProcessing = false;\r\n /**\r\n * If image processing should be disabled (default is false).\r\n * false means that the default image processing configuration will be applied (the one from the scene)\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._renderer.disableImageProcessing = value;\r\n }\r\n\r\n /**\r\n * Sets this property to true if this task is the main object renderer of the frame graph.\r\n * It will help to locate the main object renderer in the frame graph when multiple object renderers are used.\r\n * This is useful for the inspector to know which object renderer to use for additional rendering features like wireframe rendering or frustum light debugging.\r\n * It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.\r\n */\r\n public isMainObjectRenderer = false;\r\n\r\n private _renderParticles = true;\r\n /**\r\n * Define if particles should be rendered (default is true).\r\n */\r\n public get renderParticles() {\r\n return this._renderParticles;\r\n }\r\n\r\n public set renderParticles(value: boolean) {\r\n if (value === this._renderParticles) {\r\n return;\r\n }\r\n\r\n this._renderParticles = value;\r\n this._renderer.renderParticles = value;\r\n }\r\n\r\n private _renderSprites = true;\r\n /**\r\n * Define if sprites should be rendered (default is true).\r\n */\r\n public get renderSprites() {\r\n return this._renderSprites;\r\n }\r\n\r\n public set renderSprites(value: boolean) {\r\n if (value === this._renderSprites) {\r\n return;\r\n }\r\n\r\n this._renderSprites = value;\r\n this._renderer.renderSprites = value;\r\n }\r\n\r\n private _forceLayerMaskCheck = true;\r\n /**\r\n * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.\r\n */\r\n public get forceLayerMaskCheck() {\r\n return this._forceLayerMaskCheck;\r\n }\r\n\r\n public set forceLayerMaskCheck(value: boolean) {\r\n if (value === this._forceLayerMaskCheck) {\r\n return;\r\n }\r\n\r\n this._forceLayerMaskCheck = value;\r\n this._renderer.forceLayerMaskCheck = value;\r\n }\r\n\r\n private _enableBoundingBoxRendering = true;\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is true.\r\n */\r\n public get enableBoundingBoxRendering() {\r\n return this._enableBoundingBoxRendering;\r\n }\r\n\r\n public set enableBoundingBoxRendering(value: boolean) {\r\n if (value === this._enableBoundingBoxRendering) {\r\n return;\r\n }\r\n\r\n this._enableBoundingBoxRendering = value;\r\n this._renderer.enableBoundingBoxRendering = value;\r\n }\r\n\r\n private _enableOutlineRendering = true;\r\n /**\r\n * Enables the rendering of outlines/overlays for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public get enableOutlineRendering() {\r\n return this._enableOutlineRendering;\r\n }\r\n\r\n public set enableOutlineRendering(value: boolean) {\r\n if (value === this._enableOutlineRendering) {\r\n return;\r\n }\r\n\r\n this._enableOutlineRendering = value;\r\n this._renderer.enableOutlineRendering = value;\r\n }\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _engine: AbstractEngine;\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n\r\n /**\r\n * Constructs a new object renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n this._renderer.disableImageProcessing = this._disableImageProcessing;\r\n this._renderer.renderParticles = this._renderParticles;\r\n this._renderer.renderSprites = this._renderSprites;\r\n this._renderer.enableBoundingBoxRendering = this._enableBoundingBoxRendering;\r\n this._renderer.forceLayerMaskCheck = this._forceLayerMaskCheck;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture and objectList are required`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const targetTextures = Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(targetTextures[0]);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && (targetTextures[0] !== backbufferColorTextureHandle || targetTextures.length > 1)) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`\r\n );\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(targetTextures);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (this as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n const currentBoundingBoxMeshList = boundingBoxRenderer && boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];\r\n if (boundingBoxRenderer) {\r\n currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;\r\n }\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n const camera = this._renderer.activeCamera;\r\n if (camera && camera.cameraRigMode !== Constants.RIG_MODE_NONE && !camera._renderingMultiview) {\r\n for (let index = 0; index < camera._rigCameras.length; index++) {\r\n const rigCamera = camera._rigCameras[index];\r\n\r\n rigCamera.rigParent = undefined; // for some reasons, ObjectRenderer uses the rigParent viewport if rigParent is defined (we want to use rigCamera.viewport instead)\r\n\r\n this._renderer.activeCamera = rigCamera;\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n rigCamera.rigParent = camera;\r\n }\r\n this._renderer.activeCamera = camera;\r\n } else {\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n }\r\n\r\n additionalExecute?.(context);\r\n\r\n if (boundingBoxRenderer) {\r\n boundingBoxRenderer.renderList.data = currentBoundingBoxMeshList;\r\n boundingBoxRenderer.renderList.length = currentBoundingBoxMeshList.length;\r\n }\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(targetTextures);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n}\r\n"]}
@@ -14,10 +14,11 @@ export declare class FrameGraphContext {
14
14
  * Renders a component without managing the render target.
15
15
  * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.
16
16
  * @param component The component to render.
17
+ * @param intermediateRendering If true, the scene's intermediate rendering flag will be set to true during the render call (default: true)
17
18
  */
18
19
  renderUnmanaged(component: {
19
20
  render: () => void;
20
- }): void;
21
+ }, intermediateRendering?: boolean): void;
21
22
  /**
22
23
  * Gets a texture from a handle.
23
24
  * Note that if the texture is a history texture, the read texture for the current frame will be returned.
@@ -12,12 +12,15 @@ export class FrameGraphContext {
12
12
  * Renders a component without managing the render target.
13
13
  * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.
14
14
  * @param component The component to render.
15
+ * @param intermediateRendering If true, the scene's intermediate rendering flag will be set to true during the render call (default: true)
15
16
  */
16
- renderUnmanaged(component) {
17
+ renderUnmanaged(component, intermediateRendering = true) {
17
18
  const currentRenderTarget = this._engine._currentRenderTarget;
18
19
  this._scene.incrementRenderId();
19
20
  this._scene.resetCachedMaterial();
21
+ this._scene._intermediateRendering = intermediateRendering;
20
22
  component.render();
23
+ this._scene._intermediateRendering = false;
21
24
  if (this._engine._currentRenderTarget !== currentRenderTarget) {
22
25
  if (!currentRenderTarget) {
23
26
  this._engine.restoreDefaultFramebuffer();
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI1B,gBAAgB;IAChB,YACuB,OAAuB,EACvB,eAAyC,EACzC,MAAa;QAFb,YAAO,GAAP,OAAO,CAAgB;QACvB,oBAAe,GAAf,eAAe,CAA0B;QACzC,WAAM,GAAN,MAAM,CAAO;IACjC,CAAC;IAEJ;;;;OAIG;IACI,eAAe,CAAC,SAAiC;QACpD,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;QAE9D,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAElC,SAAS,CAAC,MAAM,EAAE,CAAC;QAEnB,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,KAAK,mBAAmB,EAAE,CAAC;YAC5D,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACvB,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;YACtD,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,oBAAoB,CAAC,MAA+B;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,IAAY;QAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,aAAa;QAChB,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,eAAe;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,SAAkB,EAAE,UAAmB;QACzD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture } from \"core/index\";\r\n\r\n/**\r\n * Base class for frame graph context.\r\n */\r\nexport class FrameGraphContext {\r\n private _depthTest: boolean;\r\n private _depthWrite: boolean;\r\n\r\n /** @internal */\r\n constructor(\r\n protected readonly _engine: AbstractEngine,\r\n protected readonly _textureManager: FrameGraphTextureManager,\r\n protected readonly _scene: Scene\r\n ) {}\r\n\r\n /**\r\n * Renders a component without managing the render target.\r\n * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.\r\n * @param component The component to render.\r\n */\r\n public renderUnmanaged(component: { render: () => void }): void {\r\n const currentRenderTarget = this._engine._currentRenderTarget;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n component.render();\r\n\r\n if (this._engine._currentRenderTarget !== currentRenderTarget) {\r\n if (!currentRenderTarget) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n this._engine.bindFramebuffer(currentRenderTarget);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle.\r\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<InternalTexture> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Pushes a debug group to the engine's debug stack.\r\n * @param name The name of the debug group\r\n */\r\n public pushDebugGroup(name: string) {\r\n this._engine._debugPushGroup?.(name, 1);\r\n }\r\n\r\n /**\r\n * Pops a debug group from the engine's debug stack.\r\n */\r\n public popDebugGroup() {\r\n this._engine._debugPopGroup?.(1);\r\n }\r\n\r\n /**\r\n * Saves the current depth states (depth testing and depth writing)\r\n */\r\n public saveDepthStates(): void {\r\n this._depthTest = this._engine.getDepthBuffer();\r\n this._depthWrite = this._engine.getDepthWrite();\r\n }\r\n\r\n /**\r\n * Restores the depth states saved by saveDepthStates\r\n */\r\n public restoreDepthStates(): void {\r\n this._engine.setDepthBuffer(this._depthTest);\r\n this._engine.setDepthWrite(this._depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the depth states for the current render target\r\n * @param depthTest If true, depth testing is enabled\r\n * @param depthWrite If true, depth writing is enabled\r\n */\r\n public setDepthStates(depthTest: boolean, depthWrite: boolean): void {\r\n this._engine.setDepthBuffer(depthTest);\r\n this._engine.setDepthWrite(depthWrite);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI1B,gBAAgB;IAChB,YACuB,OAAuB,EACvB,eAAyC,EACzC,MAAa;QAFb,YAAO,GAAP,OAAO,CAAgB;QACvB,oBAAe,GAAf,eAAe,CAA0B;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E,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,SAAkB,EAAE,UAAmB;QACzD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture } from \"core/index\";\r\n\r\n/**\r\n * Base class for frame graph context.\r\n */\r\nexport class FrameGraphContext {\r\n private _depthTest: boolean;\r\n private _depthWrite: boolean;\r\n\r\n /** @internal */\r\n constructor(\r\n protected readonly _engine: AbstractEngine,\r\n protected readonly _textureManager: FrameGraphTextureManager,\r\n protected readonly _scene: Scene\r\n ) {}\r\n\r\n /**\r\n * Renders a component without managing the render target.\r\n * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.\r\n * @param component The component to render.\r\n * @param intermediateRendering If true, the scene's intermediate rendering flag will be set to true during the render call (default: true)\r\n */\r\n public renderUnmanaged(component: { render: () => void }, intermediateRendering = true): void {\r\n const currentRenderTarget = this._engine._currentRenderTarget;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._scene._intermediateRendering = intermediateRendering;\r\n\r\n component.render();\r\n\r\n this._scene._intermediateRendering = false;\r\n\r\n if (this._engine._currentRenderTarget !== currentRenderTarget) {\r\n if (!currentRenderTarget) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n this._engine.bindFramebuffer(currentRenderTarget);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle.\r\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<InternalTexture> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Pushes a debug group to the engine's debug stack.\r\n * @param name The name of the debug group\r\n */\r\n public pushDebugGroup(name: string) {\r\n this._engine._debugPushGroup?.(name, 1);\r\n }\r\n\r\n /**\r\n * Pops a debug group from the engine's debug stack.\r\n */\r\n public popDebugGroup() {\r\n this._engine._debugPopGroup?.(1);\r\n }\r\n\r\n /**\r\n * Saves the current depth states (depth testing and depth writing)\r\n */\r\n public saveDepthStates(): void {\r\n this._depthTest = this._engine.getDepthBuffer();\r\n this._depthWrite = this._engine.getDepthWrite();\r\n }\r\n\r\n /**\r\n * Restores the depth states saved by saveDepthStates\r\n */\r\n public restoreDepthStates(): void {\r\n this._engine.setDepthBuffer(this._depthTest);\r\n this._engine.setDepthWrite(this._depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the depth states for the current render target\r\n * @param depthTest If true, depth testing is enabled\r\n * @param depthWrite If true, depth writing is enabled\r\n */\r\n public setDepthStates(depthTest: boolean, depthWrite: boolean): void {\r\n this._engine.setDepthBuffer(depthTest);\r\n this._engine.setDepthWrite(depthWrite);\r\n }\r\n}\r\n"]}
@@ -96,7 +96,7 @@ export declare class ClusteredLightContainer extends Light {
96
96
  protected _buildUniformLayout(): void;
97
97
  transferToEffect(effect: Effect, lightIndex: string): Light;
98
98
  transferTexturesToEffect(effect: Effect, lightIndex: string): Light;
99
- transferToNodeMaterialEffect(): Light;
99
+ transferToNodeMaterialEffect(_effect: Effect): Light;
100
100
  prepareLightSpecificDefines(defines: any, lightIndex: number): void;
101
101
  _isReady(): boolean;
102
102
  }
@@ -313,9 +313,9 @@ export class ClusteredLightContainer extends Light {
313
313
  const range = Math.min(light.range, this.maxRange);
314
314
  const inverseSquaredRange = Math.max(light._inverseSquaredRange, this._minInverseSquaredRange);
315
315
  // vLightData
316
- buf[off + 0] = position.x;
317
- buf[off + 1] = position.y;
318
- buf[off + 2] = position.z;
316
+ buf[off + 0] = position.x - this._scene.floatingOriginOffset.x;
317
+ buf[off + 1] = position.y - this._scene.floatingOriginOffset.y;
318
+ buf[off + 2] = position.z - this._scene.floatingOriginOffset.z;
319
319
  buf[off + 3] = 0;
320
320
  // vLightDiffuse
321
321
  buf[off + 4] = diffuse.r;
@@ -455,8 +455,7 @@ export class ClusteredLightContainer extends Light {
455
455
  }
456
456
  return this;
457
457
  }
458
- transferToNodeMaterialEffect() {
459
- // TODO: ????
458
+ transferToNodeMaterialEffect(_effect) {
460
459
  return this;
461
460
  }
462
461
  prepareLightSpecificDefines(defines, lightIndex) {
@@ -1 +1 @@
1
- {"version":3,"file":"clusteredLightContainer.js","sourceRoot":"","sources":["../../../../../dev/core/src/Lights/Clustered/clusteredLightContainer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,uCAAmC;AAG3D,OAAO,EAAE,SAAS,EAAE,mCAA+B;AAInD,OAAO,EAAE,cAAc,EAAE,0CAAsC;AAC/D,OAAO,EAAE,UAAU,EAAE,+CAA2C;AAChE,OAAO,EAAE,mBAAmB,EAAE,wDAAoD;AAClF,OAAO,EAAE,aAAa,EAAE,yCAAqC;AAC7D,OAAO,EAAE,SAAS,EAAE,kCAA8B;AAClD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,mCAA+B;AAC7D,OAAO,EAAE,WAAW,EAAE,8CAA0C;AAEhE,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE,WAAW,EAAE,+BAA2B;AACjD,OAAO,EAAE,MAAM,EAAE,6BAAyB;AAC1C,OAAO,EAAE,aAAa,EAAE,gCAA4B;AACpD,OAAO,EAAE,IAAI,EAAE,sBAAkB;AAIjC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,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,CAAC,gBAAgB,GAAG,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACjG,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,UAAU,CAAC,iBAAiB,GAAG,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,4BAA4B;QACxC,aAAa;QACb,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QACxE,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;QAC1C,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAC9C,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;IACrD,CAAC;IAEe,QAAQ;QACpB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;;AAxdD,gBAAgB;AACF,qDAA6B,GAA2B,GAAG,EAAE;IACvE,MAAM,WAAW,CAAC,iCAAiC,CAAC,CAAC;AACzD,CAAC,AAF0C,CAEzC;AAoCF;IADC,SAAS,EAAE;8DAGX;AAiBD;IADC,SAAS,EAAE;4DAGX;AA8CD;IADC,SAAS,EAAE;uDAGX;AA+WL,sBAAsB;AACtB,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { StorageBuffer } from \"core/Buffers/storageBuffer\";\nimport type { Camera } from \"core/Cameras/camera\";\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\nimport { Constants } from \"core/Engines/constants\";\nimport type { WebGPUEngine } from \"core/Engines/webgpuEngine\";\nimport type { Effect } from \"core/Materials/effect\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\nimport { RawTexture } from \"core/Materials/Textures/rawTexture\";\nimport { RenderTargetTexture } from \"core/Materials/Textures/renderTargetTexture\";\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\nimport { TmpColors } from \"core/Maths/math.color\";\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\nimport type { Mesh } from \"core/Meshes/mesh\";\nimport { serialize } from \"core/Misc/decorators\";\nimport { _WarnImport } from \"core/Misc/devTools\";\nimport { Logger } from \"core/Misc/logger\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { Node } from \"core/node\";\nimport type { Scene } from \"core/scene\";\nimport type { Nullable } from \"core/types\";\n\nimport { Light } from \"../light\";\nimport { LightConstants } from \"../lightConstants\";\nimport type { PointLight } from \"../pointLight\";\nimport type { SpotLight } from \"../spotLight\";\n\nimport \"core/Meshes/thinInstanceMesh\";\n\nNode.AddNodeConstructor(\"Light_Type_5\", (name, scene) => {\n return () => new ClusteredLightContainer(name, [], scene);\n});\n\nconst DefaultDepthSlices = 16;\n\n/**\n * A special light that renders all its associated spot or point lights using a clustered or forward+ system.\n */\nexport class ClusteredLightContainer extends Light {\n private static _GetEngineBatchSize(engine: AbstractEngine): number {\n const caps = engine._caps;\n if (!caps.texelFetch) {\n return 0;\n } else if (engine.isWebGPU) {\n // On WebGPU we use atomic writes to storage textures\n return 32;\n } else if (engine.version > 1) {\n // On WebGL 2 we use additive float blending as the light mask\n if (!caps.colorBufferFloat || !caps.blendFloat) {\n return 0;\n }\n // Due to the use of floats we want to limit lights to the precision of floats\n return caps.shaderFloatPrecision;\n } else {\n // WebGL 1 is not supported due to lack of dynamic for loops\n return 0;\n }\n }\n\n /**\n * Checks if the clustered lighting system supports the given light with its current parameters.\n * This will also check if the light's associated engine supports clustered lighting.\n *\n * @param light The light to test\n * @returns true if the light and its engine is supported\n */\n public static IsLightSupported(light: Light): boolean {\n if (ClusteredLightContainer._GetEngineBatchSize(light.getEngine()) === 0) {\n return false;\n } else if (light.shadowEnabled && light._scene.shadowsEnabled && light.getShadowGenerators()) {\n // Shadows are not supported\n return false;\n } else if (light.falloffType !== Light.FALLOFF_DEFAULT) {\n // Only the default falloff is supported\n return false;\n } else if (light.getTypeID() === LightConstants.LIGHTTYPEID_POINTLIGHT) {\n return true;\n } else if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n // Extra texture bindings per light are not supported\n return !(<SpotLight>light).projectionTexture && !(<SpotLight>light).iesProfileTexture;\n } else {\n // Currently only point and spot lights are supported\n return false;\n }\n }\n\n /** @internal */\n public static _SceneComponentInitialization: (scene: Scene) => void = () => {\n throw _WarnImport(\"ClusteredLightingSceneComponent\");\n };\n\n private readonly _batchSize: number;\n\n /**\n * True if clustered lighting is supported.\n */\n public get isSupported(): boolean {\n return this._batchSize > 0;\n }\n\n private readonly _lights: Light[] = [];\n /**\n * Gets the current list of lights added to this clustering system.\n */\n public get lights(): readonly Light[] {\n return this._lights;\n }\n\n // The lights sorted by depth\n private readonly _sortedLights: (PointLight | SpotLight)[] = [];\n\n private _lightDataBuffer: Float32Array;\n private _lightDataTexture: RawTexture;\n private _lightDataRenderId = -1;\n\n private _tileMaskBatches = -1;\n private _tileMaskTexture: RenderTargetTexture;\n private _tileMaskBuffer: Nullable<StorageBuffer>;\n\n private _horizontalTiles = 64;\n /**\n * The number of tiles in the horizontal direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get horizontalTiles(): number {\n return this._horizontalTiles;\n }\n\n public set horizontalTiles(horizontal: number) {\n if (this._horizontalTiles === horizontal) {\n return;\n }\n this._horizontalTiles = horizontal;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _verticalTiles = 64;\n /**\n * The number of tiles in the vertical direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get verticalTiles(): number {\n return this._verticalTiles;\n }\n\n public set verticalTiles(vertical: number) {\n if (this._verticalTiles === vertical) {\n return;\n }\n this._verticalTiles = vertical;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _sliceScale = 0;\n private _sliceBias = 0;\n // List of vec2's that keep track of the min and max index per slice\n private _sliceRanges: Float32Array;\n\n private _depthSlices = DefaultDepthSlices;\n /**\n * The number of slices to split the depth range by and cluster lights into.\n */\n public get depthSlices(): number {\n return this._depthSlices;\n }\n\n public set depthSlices(slices: number) {\n if (this._depthSlices === slices) {\n return;\n }\n this._depthSlices = slices;\n this._sliceRanges = new Float32Array(slices * 2);\n\n // UBO size depends on the number of depth slices\n this._uniformBuffer.dispose();\n this._uniformBuffer = new UniformBuffer(this.getEngine(), undefined, undefined, this.name);\n this._buildUniformLayout();\n }\n\n private readonly _proxyMaterial: ShaderMaterial;\n private readonly _proxyMesh: Mesh;\n\n private _maxRange = 16383;\n private _minInverseSquaredRange = 1 / (this._maxRange * this._maxRange);\n /**\n * This limits the range of all the added lights, so even lights with extreme ranges will still have bounds for clustering.\n */\n @serialize()\n public get maxRange(): number {\n return this._maxRange;\n }\n\n public set maxRange(range: number) {\n if (this._maxRange === range) {\n return;\n }\n this._maxRange = range;\n this._minInverseSquaredRange = 1 / (range * range);\n }\n\n /**\n * Creates a new clustered light system with an initial set of lights.\n *\n * @param name The name of the clustered light container\n * @param lights The initial set of lights to add\n * @param scene The scene the clustered light container belongs to\n */\n constructor(name: string, lights: Light[] = [], scene?: Scene) {\n super(name, scene);\n const engine = this.getEngine();\n this._batchSize = ClusteredLightContainer._GetEngineBatchSize(engine);\n\n const proxyShader = { vertex: \"lightProxy\", fragment: \"lightProxy\" };\n this._proxyMaterial = new ShaderMaterial(\"ProxyMaterial\", this._scene, proxyShader, {\n attributes: [\"position\"],\n uniforms: [\"view\", \"projection\", \"tileMaskResolution\"],\n samplers: [\"lightDataTexture\"],\n uniformBuffers: [\"Scene\"],\n storageBuffers: [\"tileMaskBuffer\"],\n defines: [`CLUSTLIGHT_BATCH ${this._batchSize}`],\n shaderLanguage: engine.isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (engine.isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/lightProxy.vertex\"), import(\"../../ShadersWGSL/lightProxy.fragment\")]);\n } else {\n await Promise.all([import(\"../../Shaders/lightProxy.vertex\"), import(\"../../Shaders/lightProxy.fragment\")]);\n }\n },\n });\n\n // Additive blending is for merging masks on WebGL\n this._proxyMaterial.transparencyMode = ShaderMaterial.MATERIAL_ALPHABLEND;\n this._proxyMaterial.alphaMode = Constants.ALPHA_ADD;\n\n this._proxyMesh = CreatePlane(\"ProxyMesh\", { size: 2 });\n // Make sure it doesn't render for the default scene\n this._scene.removeMesh(this._proxyMesh);\n this._proxyMesh.material = this._proxyMaterial;\n\n this._updateBatches();\n\n this._sliceRanges = new Float32Array(this._depthSlices * 2);\n\n if (this._batchSize > 0) {\n ClusteredLightContainer._SceneComponentInitialization(this._scene);\n for (const light of lights) {\n this.addLight(light);\n }\n }\n }\n\n public override getClassName(): string {\n return \"ClusteredLightContainer\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public override getTypeID(): number {\n return LightConstants.LIGHTTYPEID_CLUSTERED_CONTAINER;\n }\n\n /** @internal */\n public _updateBatches(): RenderTargetTexture {\n this._proxyMesh.isVisible = this._sortedLights.length > 0;\n\n // Ensure space for atleast 1 batch\n const batches = Math.max(Math.ceil(this._sortedLights.length / this._batchSize), 1);\n if (this._tileMaskBatches >= batches) {\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n return this._tileMaskTexture;\n }\n const engine = this.getEngine();\n // Round up to a batch size so we don't have to reallocate as often\n const maxLights = batches * this._batchSize;\n\n this._lightDataBuffer = new Float32Array(20 * maxLights);\n this._lightDataTexture?.dispose();\n this._lightDataTexture = new RawTexture(\n this._lightDataBuffer,\n 5,\n maxLights,\n Constants.TEXTUREFORMAT_RGBA,\n this._scene,\n false,\n false,\n Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n Constants.TEXTURETYPE_FLOAT\n );\n this._proxyMaterial.setTexture(\"lightDataTexture\", this._lightDataTexture);\n\n this._tileMaskTexture?.dispose();\n const textureSize = { width: this._horizontalTiles, height: this._verticalTiles };\n if (!engine.isWebGPU) {\n // In WebGL we shift the light proxy by the batch number\n textureSize.height *= batches;\n }\n this._tileMaskTexture = new RenderTargetTexture(\"TileMaskTexture\", textureSize, this._scene, {\n // We don't write anything on WebGPU so make it as small as possible\n type: engine.isWebGPU ? Constants.TEXTURETYPE_UNSIGNED_BYTE : Constants.TEXTURETYPE_FLOAT,\n format: Constants.TEXTUREFORMAT_RED,\n generateDepthBuffer: false,\n });\n\n this._tileMaskTexture.renderParticles = false;\n this._tileMaskTexture.renderSprites = false;\n this._tileMaskTexture.noPrePassRenderer = true;\n this._tileMaskTexture.renderList = [this._proxyMesh];\n\n this._tileMaskTexture.onBeforeBindObservable.add(() => {\n this._updateLightData();\n });\n\n this._tileMaskTexture.onClearObservable.add(() => {\n if (engine.isWebGPU) {\n // Clear the storage buffer for WebGPU\n this._tileMaskBuffer?.clear();\n } else {\n // Only clear the texture on WebGL\n engine.clear({ r: 0, g: 0, b: 0, a: 1 }, true, false);\n }\n });\n\n if (engine.isWebGPU) {\n // WebGPU also needs a storage buffer to write to\n this._tileMaskBuffer?.dispose();\n const bufferSize = this._horizontalTiles * this._verticalTiles * batches * 4;\n this._tileMaskBuffer = new StorageBuffer(<WebGPUEngine>engine, bufferSize);\n this._proxyMaterial.setStorageBuffer(\"tileMaskBuffer\", this._tileMaskBuffer);\n }\n\n this._proxyMaterial.setVector3(\"tileMaskResolution\", new Vector3(this._horizontalTiles, this.verticalTiles, batches));\n\n // We don't actually use the matrix data but we need enough capacity for the lights\n this._proxyMesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(maxLights * 16));\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n this._tileMaskBatches = batches;\n return this._tileMaskTexture;\n }\n\n private _getSliceIndex(camera: Camera, depth: number): number {\n if (depth < camera.minZ) {\n // Prevent calling log on small or negative values\n return -1;\n }\n return Math.floor(Math.log(depth) * this._sliceScale + this._sliceBias);\n }\n\n private _updateLightData(): void {\n const camera = this._scene.activeCamera;\n const renderId = this._scene.getRenderId();\n if (!camera || this._lightDataRenderId === renderId) {\n return;\n }\n this._lightDataRenderId = renderId;\n\n // Resort lights based on distance from camera\n const view = camera.getViewMatrix();\n for (const light of this._sortedLights) {\n const position = light.computeTransformedInformation() ? light.transformedPosition : light.position;\n const viewPosition = Vector3.TransformCoordinatesToRef(position, view, TmpVectors.Vector3[0]);\n light._currentViewDepth = viewPosition.z;\n }\n this._sortedLights.sort((a, b) => a._currentViewDepth - b._currentViewDepth);\n\n // DOOM 2016 subdivision scheme, copied from: https://www.aortiz.me/2018/12/21/CG.html\n const logFarNear = Math.log(camera.maxZ / camera.minZ);\n this._sliceScale = this._depthSlices / logFarNear;\n this._sliceBias = -(this._depthSlices * Math.log(camera.minZ)) / logFarNear;\n\n this._sliceRanges.fill(0);\n // Last slice which had had its min index updated\n let minSlice = -1;\n\n const buf = this._lightDataBuffer;\n for (let i = 0; i < this._sortedLights.length; i += 1) {\n const light = this._sortedLights[i];\n const off = i * 20;\n const computed = light.computeTransformedInformation();\n const scaledIntensity = light.getScaledIntensity();\n\n const position = computed ? light.transformedPosition : light.position;\n const diffuse = light.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\n const specular = light.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\n const range = Math.min(light.range, this.maxRange);\n const inverseSquaredRange = Math.max(light._inverseSquaredRange, this._minInverseSquaredRange);\n\n // vLightData\n buf[off + 0] = position.x;\n buf[off + 1] = position.y;\n buf[off + 2] = position.z;\n buf[off + 3] = 0;\n // vLightDiffuse\n buf[off + 4] = diffuse.r;\n buf[off + 5] = diffuse.g;\n buf[off + 6] = diffuse.b;\n buf[off + 7] = range;\n // vLightSpecular\n buf[off + 8] = specular.r;\n buf[off + 9] = specular.g;\n buf[off + 10] = specular.b;\n buf[off + 11] = light.radius;\n // vLightDirection\n buf[off + 12] = 0;\n buf[off + 13] = 0;\n buf[off + 14] = 0;\n buf[off + 15] = -1;\n // vLightFalloff\n buf[off + 16] = range;\n buf[off + 17] = inverseSquaredRange;\n buf[off + 18] = 0;\n buf[off + 19] = 0;\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n const spotLight = <SpotLight>light;\n const direction = Vector3.NormalizeToRef(computed ? spotLight.transformedDirection : spotLight.direction, TmpVectors.Vector3[0]);\n\n // vLightData.a\n buf[off + 3] = spotLight.exponent;\n // vLightDirection\n buf[off + 12] = direction.x;\n buf[off + 13] = direction.y;\n buf[off + 14] = direction.z;\n buf[off + 15] = spotLight._cosHalfAngle;\n // vLightFalloff.zw\n buf[off + 18] = spotLight._lightAngleScale;\n buf[off + 19] = spotLight._lightAngleOffset;\n }\n\n // Update the depth slices that include this light\n const firstSlice = this._getSliceIndex(camera, light._currentViewDepth - range);\n const lastSlice = this._getSliceIndex(camera, light._currentViewDepth + range);\n for (let j = firstSlice; j <= lastSlice; j += 1) {\n if (j < 0 || j >= this._depthSlices) {\n continue;\n } else if (j > minSlice) {\n // Update min index\n this._sliceRanges[j * 2] = i;\n minSlice = j;\n }\n // Update max index\n this._sliceRanges[j * 2 + 1] = i;\n }\n }\n\n const engine = this.getEngine();\n if (engine.isWebGPU) {\n // Whenever the light data changes we have to flush pending WebGPU command buffers so that\n // previous render passes use the old data and later render passes use the new data.\n engine.flushFramebuffer();\n }\n this._lightDataTexture.update(this._lightDataBuffer);\n }\n\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void {\n for (const light of this._lights) {\n light.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n this._lightDataTexture.dispose();\n this._tileMaskTexture.dispose();\n this._tileMaskBuffer?.dispose();\n this._proxyMesh.dispose(doNotRecurse, disposeMaterialAndTextures);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n\n /**\n * Adds a light to the clustering system.\n * @param light The light to add\n */\n public addLight(light: Light): void {\n if (!ClusteredLightContainer.IsLightSupported(light)) {\n Logger.Warn(\"Attempting to add a light to cluster that does not support clustering\");\n return;\n }\n this._scene.removeLight(light);\n this._lights.push(light);\n this._sortedLights.push(<PointLight | SpotLight>light);\n\n this._proxyMesh.isVisible = true;\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n }\n\n /**\n * Removes a light from the clustering system.\n * @param light The light to remove\n * @returns the index where the light was in the light list\n */\n public removeLight(light: Light): number {\n // Convert to `Light` array without cast so `indexOf` has correct typing\n const sortedLights: Light[] = this._sortedLights;\n const sortedIndex = sortedLights.indexOf(light);\n if (sortedIndex !== -1) {\n sortedLights.splice(sortedIndex, 1);\n\n this._proxyMesh.thinInstanceCount = sortedLights.length;\n if (sortedLights.length === 0) {\n this._proxyMesh.isVisible = false;\n }\n }\n\n const index = this._lights.indexOf(light);\n if (index !== -1) {\n this._lights.splice(index, 1);\n // We treat the unsorted array as the \"real\" one so only add back to the scene if it was found in that\n this._scene.addLight(light);\n }\n return index;\n }\n\n protected override _buildUniformLayout(): void {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vSliceData\", 2);\n // _depthSlices might not be initialized yet\n this._uniformBuffer.addUniform(\"vSliceRanges\", 2, this._depthSlices ?? DefaultDepthSlices);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n\n public override transferToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n const hscale = this._horizontalTiles / engine.getRenderWidth();\n const vscale = this._verticalTiles / engine.getRenderHeight();\n this._uniformBuffer.updateFloat4(\"vLightData\", hscale, vscale, this._verticalTiles, this._tileMaskBatches, lightIndex);\n this._uniformBuffer.updateFloat2(\"vSliceData\", this._sliceScale, this._sliceBias, lightIndex);\n this._uniformBuffer.updateFloatArray(\"vSliceRanges\", this._sliceRanges, lightIndex);\n return this;\n }\n\n public override transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n effect.setTexture(\"lightDataTexture\" + lightIndex, this._lightDataTexture);\n if (engine.isWebGPU) {\n (<WebGPUEngine>engine).setStorageBuffer(\"tileMaskBuffer\" + lightIndex, this._tileMaskBuffer);\n } else {\n effect.setTexture(\"tileMaskTexture\" + lightIndex, this._tileMaskTexture);\n }\n return this;\n }\n\n public override transferToNodeMaterialEffect(): Light {\n // TODO: ????\n return this;\n }\n\n public override prepareLightSpecificDefines(defines: any, lightIndex: number): void {\n defines[\"CLUSTLIGHT\" + lightIndex] = true;\n defines[\"CLUSTLIGHT_BATCH\"] = this._batchSize;\n defines[\"CLUSTLIGHT_SLICES\"] = this._depthSlices;\n }\n\n public override _isReady(): boolean {\n this._updateBatches();\n return this._proxyMesh.isReady(true, true);\n }\n}\n\n// Register Class Name\nRegisterClass(\"BABYLON.ClusteredLightContainer\", ClusteredLightContainer);\n"]}
1
+ {"version":3,"file":"clusteredLightContainer.js","sourceRoot":"","sources":["../../../../../dev/core/src/Lights/Clustered/clusteredLightContainer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,uCAAmC;AAG3D,OAAO,EAAE,SAAS,EAAE,mCAA+B;AAInD,OAAO,EAAE,cAAc,EAAE,0CAAsC;AAC/D,OAAO,EAAE,UAAU,EAAE,+CAA2C;AAChE,OAAO,EAAE,mBAAmB,EAAE,wDAAoD;AAClF,OAAO,EAAE,aAAa,EAAE,yCAAqC;AAC7D,OAAO,EAAE,SAAS,EAAE,kCAA8B;AAClD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,mCAA+B;AAC7D,OAAO,EAAE,WA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AAoCF;IADC,SAAS,EAAE;8DAGX;AAiBD;IADC,SAAS,EAAE;4DAGX;AA8CD;IADC,SAAS,EAAE;uDAGX;AA8WL,sBAAsB;AACtB,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { StorageBuffer } from \"core/Buffers/storageBuffer\";\nimport type { Camera } from \"core/Cameras/camera\";\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\nimport { Constants } from \"core/Engines/constants\";\nimport type { WebGPUEngine } from \"core/Engines/webgpuEngine\";\nimport type { Effect } from \"core/Materials/effect\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\nimport { RawTexture } from \"core/Materials/Textures/rawTexture\";\nimport { RenderTargetTexture } from \"core/Materials/Textures/renderTargetTexture\";\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\nimport { TmpColors } from \"core/Maths/math.color\";\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\nimport type { Mesh } from \"core/Meshes/mesh\";\nimport { serialize } from \"core/Misc/decorators\";\nimport { _WarnImport } from \"core/Misc/devTools\";\nimport { Logger } from \"core/Misc/logger\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { Node } from \"core/node\";\nimport type { Scene } from \"core/scene\";\nimport type { Nullable } from \"core/types\";\n\nimport { Light } from \"../light\";\nimport { LightConstants } from \"../lightConstants\";\nimport type { PointLight } from \"../pointLight\";\nimport type { SpotLight } from \"../spotLight\";\n\nimport \"core/Meshes/thinInstanceMesh\";\n\nNode.AddNodeConstructor(\"Light_Type_5\", (name, scene) => {\n return () => new ClusteredLightContainer(name, [], scene);\n});\n\nconst DefaultDepthSlices = 16;\n\n/**\n * A special light that renders all its associated spot or point lights using a clustered or forward+ system.\n */\nexport class ClusteredLightContainer extends Light {\n private static _GetEngineBatchSize(engine: AbstractEngine): number {\n const caps = engine._caps;\n if (!caps.texelFetch) {\n return 0;\n } else if (engine.isWebGPU) {\n // On WebGPU we use atomic writes to storage textures\n return 32;\n } else if (engine.version > 1) {\n // On WebGL 2 we use additive float blending as the light mask\n if (!caps.colorBufferFloat || !caps.blendFloat) {\n return 0;\n }\n // Due to the use of floats we want to limit lights to the precision of floats\n return caps.shaderFloatPrecision;\n } else {\n // WebGL 1 is not supported due to lack of dynamic for loops\n return 0;\n }\n }\n\n /**\n * Checks if the clustered lighting system supports the given light with its current parameters.\n * This will also check if the light's associated engine supports clustered lighting.\n *\n * @param light The light to test\n * @returns true if the light and its engine is supported\n */\n public static IsLightSupported(light: Light): boolean {\n if (ClusteredLightContainer._GetEngineBatchSize(light.getEngine()) === 0) {\n return false;\n } else if (light.shadowEnabled && light._scene.shadowsEnabled && light.getShadowGenerators()) {\n // Shadows are not supported\n return false;\n } else if (light.falloffType !== Light.FALLOFF_DEFAULT) {\n // Only the default falloff is supported\n return false;\n } else if (light.getTypeID() === LightConstants.LIGHTTYPEID_POINTLIGHT) {\n return true;\n } else if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n // Extra texture bindings per light are not supported\n return !(<SpotLight>light).projectionTexture && !(<SpotLight>light).iesProfileTexture;\n } else {\n // Currently only point and spot lights are supported\n return false;\n }\n }\n\n /** @internal */\n public static _SceneComponentInitialization: (scene: Scene) => void = () => {\n throw _WarnImport(\"ClusteredLightingSceneComponent\");\n };\n\n private readonly _batchSize: number;\n\n /**\n * True if clustered lighting is supported.\n */\n public get isSupported(): boolean {\n return this._batchSize > 0;\n }\n\n private readonly _lights: Light[] = [];\n /**\n * Gets the current list of lights added to this clustering system.\n */\n public get lights(): readonly Light[] {\n return this._lights;\n }\n\n // The lights sorted by depth\n private readonly _sortedLights: (PointLight | SpotLight)[] = [];\n\n private _lightDataBuffer: Float32Array;\n private _lightDataTexture: RawTexture;\n private _lightDataRenderId = -1;\n\n private _tileMaskBatches = -1;\n private _tileMaskTexture: RenderTargetTexture;\n private _tileMaskBuffer: Nullable<StorageBuffer>;\n\n private _horizontalTiles = 64;\n /**\n * The number of tiles in the horizontal direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get horizontalTiles(): number {\n return this._horizontalTiles;\n }\n\n public set horizontalTiles(horizontal: number) {\n if (this._horizontalTiles === horizontal) {\n return;\n }\n this._horizontalTiles = horizontal;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _verticalTiles = 64;\n /**\n * The number of tiles in the vertical direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get verticalTiles(): number {\n return this._verticalTiles;\n }\n\n public set verticalTiles(vertical: number) {\n if (this._verticalTiles === vertical) {\n return;\n }\n this._verticalTiles = vertical;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _sliceScale = 0;\n private _sliceBias = 0;\n // List of vec2's that keep track of the min and max index per slice\n private _sliceRanges: Float32Array;\n\n private _depthSlices = DefaultDepthSlices;\n /**\n * The number of slices to split the depth range by and cluster lights into.\n */\n public get depthSlices(): number {\n return this._depthSlices;\n }\n\n public set depthSlices(slices: number) {\n if (this._depthSlices === slices) {\n return;\n }\n this._depthSlices = slices;\n this._sliceRanges = new Float32Array(slices * 2);\n\n // UBO size depends on the number of depth slices\n this._uniformBuffer.dispose();\n this._uniformBuffer = new UniformBuffer(this.getEngine(), undefined, undefined, this.name);\n this._buildUniformLayout();\n }\n\n private readonly _proxyMaterial: ShaderMaterial;\n private readonly _proxyMesh: Mesh;\n\n private _maxRange = 16383;\n private _minInverseSquaredRange = 1 / (this._maxRange * this._maxRange);\n /**\n * This limits the range of all the added lights, so even lights with extreme ranges will still have bounds for clustering.\n */\n @serialize()\n public get maxRange(): number {\n return this._maxRange;\n }\n\n public set maxRange(range: number) {\n if (this._maxRange === range) {\n return;\n }\n this._maxRange = range;\n this._minInverseSquaredRange = 1 / (range * range);\n }\n\n /**\n * Creates a new clustered light system with an initial set of lights.\n *\n * @param name The name of the clustered light container\n * @param lights The initial set of lights to add\n * @param scene The scene the clustered light container belongs to\n */\n constructor(name: string, lights: Light[] = [], scene?: Scene) {\n super(name, scene);\n const engine = this.getEngine();\n this._batchSize = ClusteredLightContainer._GetEngineBatchSize(engine);\n\n const proxyShader = { vertex: \"lightProxy\", fragment: \"lightProxy\" };\n this._proxyMaterial = new ShaderMaterial(\"ProxyMaterial\", this._scene, proxyShader, {\n attributes: [\"position\"],\n uniforms: [\"view\", \"projection\", \"tileMaskResolution\"],\n samplers: [\"lightDataTexture\"],\n uniformBuffers: [\"Scene\"],\n storageBuffers: [\"tileMaskBuffer\"],\n defines: [`CLUSTLIGHT_BATCH ${this._batchSize}`],\n shaderLanguage: engine.isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (engine.isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/lightProxy.vertex\"), import(\"../../ShadersWGSL/lightProxy.fragment\")]);\n } else {\n await Promise.all([import(\"../../Shaders/lightProxy.vertex\"), import(\"../../Shaders/lightProxy.fragment\")]);\n }\n },\n });\n\n // Additive blending is for merging masks on WebGL\n this._proxyMaterial.transparencyMode = ShaderMaterial.MATERIAL_ALPHABLEND;\n this._proxyMaterial.alphaMode = Constants.ALPHA_ADD;\n\n this._proxyMesh = CreatePlane(\"ProxyMesh\", { size: 2 });\n // Make sure it doesn't render for the default scene\n this._scene.removeMesh(this._proxyMesh);\n this._proxyMesh.material = this._proxyMaterial;\n\n this._updateBatches();\n\n this._sliceRanges = new Float32Array(this._depthSlices * 2);\n\n if (this._batchSize > 0) {\n ClusteredLightContainer._SceneComponentInitialization(this._scene);\n for (const light of lights) {\n this.addLight(light);\n }\n }\n }\n\n public override getClassName(): string {\n return \"ClusteredLightContainer\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public override getTypeID(): number {\n return LightConstants.LIGHTTYPEID_CLUSTERED_CONTAINER;\n }\n\n /** @internal */\n public _updateBatches(): RenderTargetTexture {\n this._proxyMesh.isVisible = this._sortedLights.length > 0;\n\n // Ensure space for atleast 1 batch\n const batches = Math.max(Math.ceil(this._sortedLights.length / this._batchSize), 1);\n if (this._tileMaskBatches >= batches) {\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n return this._tileMaskTexture;\n }\n const engine = this.getEngine();\n // Round up to a batch size so we don't have to reallocate as often\n const maxLights = batches * this._batchSize;\n\n this._lightDataBuffer = new Float32Array(20 * maxLights);\n this._lightDataTexture?.dispose();\n this._lightDataTexture = new RawTexture(\n this._lightDataBuffer,\n 5,\n maxLights,\n Constants.TEXTUREFORMAT_RGBA,\n this._scene,\n false,\n false,\n Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n Constants.TEXTURETYPE_FLOAT\n );\n this._proxyMaterial.setTexture(\"lightDataTexture\", this._lightDataTexture);\n\n this._tileMaskTexture?.dispose();\n const textureSize = { width: this._horizontalTiles, height: this._verticalTiles };\n if (!engine.isWebGPU) {\n // In WebGL we shift the light proxy by the batch number\n textureSize.height *= batches;\n }\n this._tileMaskTexture = new RenderTargetTexture(\"TileMaskTexture\", textureSize, this._scene, {\n // We don't write anything on WebGPU so make it as small as possible\n type: engine.isWebGPU ? Constants.TEXTURETYPE_UNSIGNED_BYTE : Constants.TEXTURETYPE_FLOAT,\n format: Constants.TEXTUREFORMAT_RED,\n generateDepthBuffer: false,\n });\n\n this._tileMaskTexture.renderParticles = false;\n this._tileMaskTexture.renderSprites = false;\n this._tileMaskTexture.noPrePassRenderer = true;\n this._tileMaskTexture.renderList = [this._proxyMesh];\n\n this._tileMaskTexture.onBeforeBindObservable.add(() => {\n this._updateLightData();\n });\n\n this._tileMaskTexture.onClearObservable.add(() => {\n if (engine.isWebGPU) {\n // Clear the storage buffer for WebGPU\n this._tileMaskBuffer?.clear();\n } else {\n // Only clear the texture on WebGL\n engine.clear({ r: 0, g: 0, b: 0, a: 1 }, true, false);\n }\n });\n\n if (engine.isWebGPU) {\n // WebGPU also needs a storage buffer to write to\n this._tileMaskBuffer?.dispose();\n const bufferSize = this._horizontalTiles * this._verticalTiles * batches * 4;\n this._tileMaskBuffer = new StorageBuffer(<WebGPUEngine>engine, bufferSize);\n this._proxyMaterial.setStorageBuffer(\"tileMaskBuffer\", this._tileMaskBuffer);\n }\n\n this._proxyMaterial.setVector3(\"tileMaskResolution\", new Vector3(this._horizontalTiles, this.verticalTiles, batches));\n\n // We don't actually use the matrix data but we need enough capacity for the lights\n this._proxyMesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(maxLights * 16));\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n this._tileMaskBatches = batches;\n return this._tileMaskTexture;\n }\n\n private _getSliceIndex(camera: Camera, depth: number): number {\n if (depth < camera.minZ) {\n // Prevent calling log on small or negative values\n return -1;\n }\n return Math.floor(Math.log(depth) * this._sliceScale + this._sliceBias);\n }\n\n private _updateLightData(): void {\n const camera = this._scene.activeCamera;\n const renderId = this._scene.getRenderId();\n if (!camera || this._lightDataRenderId === renderId) {\n return;\n }\n this._lightDataRenderId = renderId;\n\n // Resort lights based on distance from camera\n const view = camera.getViewMatrix();\n for (const light of this._sortedLights) {\n const position = light.computeTransformedInformation() ? light.transformedPosition : light.position;\n const viewPosition = Vector3.TransformCoordinatesToRef(position, view, TmpVectors.Vector3[0]);\n light._currentViewDepth = viewPosition.z;\n }\n this._sortedLights.sort((a, b) => a._currentViewDepth - b._currentViewDepth);\n\n // DOOM 2016 subdivision scheme, copied from: https://www.aortiz.me/2018/12/21/CG.html\n const logFarNear = Math.log(camera.maxZ / camera.minZ);\n this._sliceScale = this._depthSlices / logFarNear;\n this._sliceBias = -(this._depthSlices * Math.log(camera.minZ)) / logFarNear;\n\n this._sliceRanges.fill(0);\n // Last slice which had had its min index updated\n let minSlice = -1;\n\n const buf = this._lightDataBuffer;\n for (let i = 0; i < this._sortedLights.length; i += 1) {\n const light = this._sortedLights[i];\n const off = i * 20;\n const computed = light.computeTransformedInformation();\n const scaledIntensity = light.getScaledIntensity();\n\n const position = computed ? light.transformedPosition : light.position;\n const diffuse = light.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\n const specular = light.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\n const range = Math.min(light.range, this.maxRange);\n const inverseSquaredRange = Math.max(light._inverseSquaredRange, this._minInverseSquaredRange);\n\n // vLightData\n buf[off + 0] = position.x - this._scene.floatingOriginOffset.x;\n buf[off + 1] = position.y - this._scene.floatingOriginOffset.y;\n buf[off + 2] = position.z - this._scene.floatingOriginOffset.z;\n buf[off + 3] = 0;\n // vLightDiffuse\n buf[off + 4] = diffuse.r;\n buf[off + 5] = diffuse.g;\n buf[off + 6] = diffuse.b;\n buf[off + 7] = range;\n // vLightSpecular\n buf[off + 8] = specular.r;\n buf[off + 9] = specular.g;\n buf[off + 10] = specular.b;\n buf[off + 11] = light.radius;\n // vLightDirection\n buf[off + 12] = 0;\n buf[off + 13] = 0;\n buf[off + 14] = 0;\n buf[off + 15] = -1;\n // vLightFalloff\n buf[off + 16] = range;\n buf[off + 17] = inverseSquaredRange;\n buf[off + 18] = 0;\n buf[off + 19] = 0;\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n const spotLight = <SpotLight>light;\n const direction = Vector3.NormalizeToRef(computed ? spotLight.transformedDirection : spotLight.direction, TmpVectors.Vector3[0]);\n\n // vLightData.a\n buf[off + 3] = spotLight.exponent;\n // vLightDirection\n buf[off + 12] = direction.x;\n buf[off + 13] = direction.y;\n buf[off + 14] = direction.z;\n buf[off + 15] = spotLight._cosHalfAngle;\n // vLightFalloff.zw\n buf[off + 18] = spotLight._lightAngleScale;\n buf[off + 19] = spotLight._lightAngleOffset;\n }\n\n // Update the depth slices that include this light\n const firstSlice = this._getSliceIndex(camera, light._currentViewDepth - range);\n const lastSlice = this._getSliceIndex(camera, light._currentViewDepth + range);\n for (let j = firstSlice; j <= lastSlice; j += 1) {\n if (j < 0 || j >= this._depthSlices) {\n continue;\n } else if (j > minSlice) {\n // Update min index\n this._sliceRanges[j * 2] = i;\n minSlice = j;\n }\n // Update max index\n this._sliceRanges[j * 2 + 1] = i;\n }\n }\n\n const engine = this.getEngine();\n if (engine.isWebGPU) {\n // Whenever the light data changes we have to flush pending WebGPU command buffers so that\n // previous render passes use the old data and later render passes use the new data.\n engine.flushFramebuffer();\n }\n this._lightDataTexture.update(this._lightDataBuffer);\n }\n\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void {\n for (const light of this._lights) {\n light.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n this._lightDataTexture.dispose();\n this._tileMaskTexture.dispose();\n this._tileMaskBuffer?.dispose();\n this._proxyMesh.dispose(doNotRecurse, disposeMaterialAndTextures);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n\n /**\n * Adds a light to the clustering system.\n * @param light The light to add\n */\n public addLight(light: Light): void {\n if (!ClusteredLightContainer.IsLightSupported(light)) {\n Logger.Warn(\"Attempting to add a light to cluster that does not support clustering\");\n return;\n }\n this._scene.removeLight(light);\n this._lights.push(light);\n this._sortedLights.push(<PointLight | SpotLight>light);\n\n this._proxyMesh.isVisible = true;\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n }\n\n /**\n * Removes a light from the clustering system.\n * @param light The light to remove\n * @returns the index where the light was in the light list\n */\n public removeLight(light: Light): number {\n // Convert to `Light` array without cast so `indexOf` has correct typing\n const sortedLights: Light[] = this._sortedLights;\n const sortedIndex = sortedLights.indexOf(light);\n if (sortedIndex !== -1) {\n sortedLights.splice(sortedIndex, 1);\n\n this._proxyMesh.thinInstanceCount = sortedLights.length;\n if (sortedLights.length === 0) {\n this._proxyMesh.isVisible = false;\n }\n }\n\n const index = this._lights.indexOf(light);\n if (index !== -1) {\n this._lights.splice(index, 1);\n // We treat the unsorted array as the \"real\" one so only add back to the scene if it was found in that\n this._scene.addLight(light);\n }\n return index;\n }\n\n protected override _buildUniformLayout(): void {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vSliceData\", 2);\n // _depthSlices might not be initialized yet\n this._uniformBuffer.addUniform(\"vSliceRanges\", 2, this._depthSlices ?? DefaultDepthSlices);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n\n public override transferToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n const hscale = this._horizontalTiles / engine.getRenderWidth();\n const vscale = this._verticalTiles / engine.getRenderHeight();\n this._uniformBuffer.updateFloat4(\"vLightData\", hscale, vscale, this._verticalTiles, this._tileMaskBatches, lightIndex);\n this._uniformBuffer.updateFloat2(\"vSliceData\", this._sliceScale, this._sliceBias, lightIndex);\n this._uniformBuffer.updateFloatArray(\"vSliceRanges\", this._sliceRanges, lightIndex);\n return this;\n }\n\n public override transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n effect.setTexture(\"lightDataTexture\" + lightIndex, this._lightDataTexture);\n if (engine.isWebGPU) {\n (<WebGPUEngine>engine).setStorageBuffer(\"tileMaskBuffer\" + lightIndex, this._tileMaskBuffer);\n } else {\n effect.setTexture(\"tileMaskTexture\" + lightIndex, this._tileMaskTexture);\n }\n return this;\n }\n\n public override transferToNodeMaterialEffect(_effect: Effect): Light {\n return this;\n }\n\n public override prepareLightSpecificDefines(defines: any, lightIndex: number): void {\n defines[\"CLUSTLIGHT\" + lightIndex] = true;\n defines[\"CLUSTLIGHT_BATCH\"] = this._batchSize;\n defines[\"CLUSTLIGHT_SLICES\"] = this._depthSlices;\n }\n\n public override _isReady(): boolean {\n this._updateBatches();\n return this._proxyMesh.isReady(true, true);\n }\n}\n\n// Register Class Name\nRegisterClass(\"BABYLON.ClusteredLightContainer\", ClusteredLightContainer);\n"]}
@@ -160,20 +160,20 @@ export class PointLight extends ShadowLight {
160
160
  */
161
161
  transferToEffect(effect, lightIndex) {
162
162
  if (this.computeTransformedInformation()) {
163
- this._uniformBuffer.updateFloat4("vLightData", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);
163
+ this._uniformBuffer.updateFloat4("vLightData", this.transformedPosition.x - this._scene.floatingOriginOffset.x, this.transformedPosition.y - this._scene.floatingOriginOffset.y, this.transformedPosition.z - this._scene.floatingOriginOffset.z, 0.0, lightIndex);
164
164
  }
165
165
  else {
166
- this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, lightIndex);
166
+ this._uniformBuffer.updateFloat4("vLightData", this.position.x - this._scene.floatingOriginOffset.x, this.position.y - this._scene.floatingOriginOffset.y, this.position.z - this._scene.floatingOriginOffset.z, 0, lightIndex);
167
167
  }
168
168
  this._uniformBuffer.updateFloat4("vLightFalloff", this.range, this._inverseSquaredRange, 0, 0, lightIndex);
169
169
  return this;
170
170
  }
171
171
  transferToNodeMaterialEffect(effect, lightDataUniformName) {
172
172
  if (this.computeTransformedInformation()) {
173
- effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);
173
+ effect.setFloat3(lightDataUniformName, this.transformedPosition.x - this._scene.floatingOriginOffset.x, this.transformedPosition.y - this._scene.floatingOriginOffset.y, this.transformedPosition.z - this._scene.floatingOriginOffset.z);
174
174
  }
175
175
  else {
176
- effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);
176
+ effect.setFloat3(lightDataUniformName, this.position.x - this._scene.floatingOriginOffset.x, this.position.y - this._scene.floatingOriginOffset.y, this.position.z - this._scene.floatingOriginOffset.z);
177
177
  }
178
178
  return this;
179
179
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pointLight.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/p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B;QAC5E,IAAI,IAAI,CAAC,6BAA6B,EAAE,EAAE,CAAC;YACvC,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC/H,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9F,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QAC/D,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;IAC9C,CAAC;CACJ;AA7LG;IADC,SAAS,EAAE;6CAGX;AA6LL,sBAAsB;AACtB,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { serialize } from \"../Misc/decorators\";\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 { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_0\", (name, scene) => {\r\n return () => new PointLight(name, Vector3.Zero(), scene);\r\n});\r\n\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class PointLight extends ShadowLight {\r\n private _shadowAngle = Math.PI / 2;\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n @serialize()\r\n public get shadowAngle(): number {\r\n return this._shadowAngle;\r\n }\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n public set shadowAngle(value: number) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public override get direction(): Vector3 {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public override set direction(value: Vector3) {\r\n const previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerators) {\r\n const iterator = this._shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n shadowGenerator.recreateShadowMap();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\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 point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, scene?: Scene) {\r\n super(name, scene);\r\n this.position = position;\r\n }\r\n\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"PointLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 0.\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_POINTLIGHT;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n public override needCube(): boolean {\r\n return !this.direction;\r\n }\r\n\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n public override getShadowDirection(faceIndex?: number): Vector3 {\r\n if (this.direction) {\r\n return super.getShadowDirection(faceIndex);\r\n } else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new Vector3(1.0, 0.0, 0.0);\r\n case 1:\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n case 2:\r\n return new Vector3(0.0, -1.0, 0.0);\r\n case 3:\r\n return new Vector3(0.0, 1.0, 0.0);\r\n case 4:\r\n return new Vector3(0.0, 0.0, 1.0);\r\n case 5:\r\n return new Vector3(0.0, 0.0, -1.0);\r\n }\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\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 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 this.shadowAngle,\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 _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(\"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 /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\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 point light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): PointLight {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n\r\n return this;\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[\"POINTLIGHT\" + lightIndex] = true;\r\n }\r\n}\r\n\r\n// Register Class Name\r\nRegisterClass(\"BABYLON.PointLight\", PointLight);\r\n"]}
1
+ {"version":3,"file":"pointLight.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/pointLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;IACpD,OAAO,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IAEvC;;;;;OAKG;IAEH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD;;;;;OAKG;IACH,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,4BAA4B,E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,oBAAoB,CAAC,CAAC,EACpD,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,EACpD,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CACvD,CAAC;QACN,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QAC/D,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;IAC9C,CAAC;CACJ;AArNG;IADC,SAAS,EAAE;6CAGX;AAqNL,sBAAsB;AACtB,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { serialize } from \"../Misc/decorators\";\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 { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_0\", (name, scene) => {\r\n return () => new PointLight(name, Vector3.Zero(), scene);\r\n});\r\n\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class PointLight extends ShadowLight {\r\n private _shadowAngle = Math.PI / 2;\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n @serialize()\r\n public get shadowAngle(): number {\r\n return this._shadowAngle;\r\n }\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n public set shadowAngle(value: number) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public override get direction(): Vector3 {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public override set direction(value: Vector3) {\r\n const previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerators) {\r\n const iterator = this._shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n shadowGenerator.recreateShadowMap();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\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 point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, scene?: Scene) {\r\n super(name, scene);\r\n this.position = position;\r\n }\r\n\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"PointLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 0.\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_POINTLIGHT;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n public override needCube(): boolean {\r\n return !this.direction;\r\n }\r\n\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n public override getShadowDirection(faceIndex?: number): Vector3 {\r\n if (this.direction) {\r\n return super.getShadowDirection(faceIndex);\r\n } else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new Vector3(1.0, 0.0, 0.0);\r\n case 1:\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n case 2:\r\n return new Vector3(0.0, -1.0, 0.0);\r\n case 3:\r\n return new Vector3(0.0, 1.0, 0.0);\r\n case 4:\r\n return new Vector3(0.0, 0.0, 1.0);\r\n case 5:\r\n return new Vector3(0.0, 0.0, -1.0);\r\n }\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\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 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 this.shadowAngle,\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 _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(\"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 /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\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 point light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): PointLight {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\r\n \"vLightData\",\r\n this.transformedPosition.x - this._scene.floatingOriginOffset.x,\r\n this.transformedPosition.y - this._scene.floatingOriginOffset.y,\r\n this.transformedPosition.z - this._scene.floatingOriginOffset.z,\r\n 0.0,\r\n lightIndex\r\n );\r\n } else {\r\n this._uniformBuffer.updateFloat4(\r\n \"vLightData\",\r\n this.position.x - this._scene.floatingOriginOffset.x,\r\n this.position.y - this._scene.floatingOriginOffset.y,\r\n this.position.z - this._scene.floatingOriginOffset.z,\r\n 0,\r\n lightIndex\r\n );\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(\r\n lightDataUniformName,\r\n this.transformedPosition.x - this._scene.floatingOriginOffset.x,\r\n this.transformedPosition.y - this._scene.floatingOriginOffset.y,\r\n this.transformedPosition.z - this._scene.floatingOriginOffset.z\r\n );\r\n } else {\r\n effect.setFloat3(\r\n lightDataUniformName,\r\n this.position.x - this._scene.floatingOriginOffset.x,\r\n this.position.y - this._scene.floatingOriginOffset.y,\r\n this.position.z - this._scene.floatingOriginOffset.z\r\n );\r\n }\r\n\r\n return this;\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[\"POINTLIGHT\" + lightIndex] = true;\r\n }\r\n}\r\n\r\n// Register Class Name\r\nRegisterClass(\"BABYLON.PointLight\", PointLight);\r\n"]}
@@ -96,12 +96,12 @@ export class RectAreaLight extends AreaLight {
96
96
  */
97
97
  transferToEffect(effect, lightIndex) {
98
98
  if (this._computeTransformedInformation()) {
99
- this._uniformBuffer.updateFloat4("vLightData", this._pointTransformedPosition.x, this._pointTransformedPosition.y, this._pointTransformedPosition.z, 0, lightIndex);
99
+ this._uniformBuffer.updateFloat4("vLightData", this._pointTransformedPosition.x - this._scene.floatingOriginOffset.x, this._pointTransformedPosition.y - this._scene.floatingOriginOffset.y, this._pointTransformedPosition.z - this._scene.floatingOriginOffset.z, 0, lightIndex);
100
100
  this._uniformBuffer.updateFloat4("vLightWidth", this._pointTransformedWidth.x / 2, this._pointTransformedWidth.y / 2, this._pointTransformedWidth.z / 2, 0, lightIndex);
101
101
  this._uniformBuffer.updateFloat4("vLightHeight", this._pointTransformedHeight.x / 2, this._pointTransformedHeight.y / 2, this._pointTransformedHeight.z / 2, 0, lightIndex);
102
102
  }
103
103
  else {
104
- this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, lightIndex);
104
+ this._uniformBuffer.updateFloat4("vLightData", this.position.x - this._scene.floatingOriginOffset.x, this.position.y - this._scene.floatingOriginOffset.y, this.position.z - this._scene.floatingOriginOffset.z, 0, lightIndex);
105
105
  this._uniformBuffer.updateFloat4("vLightWidth", this._width.x / 2, this._width.y / 2, this._width.z / 2, 0.0, lightIndex);
106
106
  this._uniformBuffer.updateFloat4("vLightHeight", this._height.x / 2, this._height.y / 2, this._height.z / 2, 0.0, lightIndex);
107
107
  }
@@ -109,10 +109,10 @@ export class RectAreaLight extends AreaLight {
109
109
  }
110
110
  transferToNodeMaterialEffect(effect, lightDataUniformName) {
111
111
  if (this._computeTransformedInformation()) {
112
- effect.setFloat3(lightDataUniformName, this._pointTransformedPosition.x, this._pointTransformedPosition.y, this._pointTransformedPosition.z);
112
+ effect.setFloat3(lightDataUniformName, this._pointTransformedPosition.x - this._scene.floatingOriginOffset.x, this._pointTransformedPosition.y - this._scene.floatingOriginOffset.y, this._pointTransformedPosition.z - this._scene.floatingOriginOffset.z);
113
113
  }
114
114
  else {
115
- effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);
115
+ effect.setFloat3(lightDataUniformName, this.position.x - this._scene.floatingOriginOffset.x, this.position.y - this._scene.floatingOriginOffset.y, this.position.z - this._scene.floatingOriginOffset.z);
116
116
  }
117
117
  return this;
118
118
  }