@babylonjs/core 7.35.2 → 7.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/Collisions/gpuPicker.js.map +1 -1
  2. package/Engines/Extensions/engine.multiRender.d.ts +11 -0
  3. package/Engines/Extensions/engine.multiRender.js +71 -32
  4. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  5. package/Engines/Extensions/engine.rawTexture.d.ts +8 -8
  6. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  7. package/Engines/Extensions/engine.renderTarget.js +1 -13
  8. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  9. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  10. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +2 -0
  11. package/Engines/WebGL/webGLRenderTargetWrapper.js +37 -7
  12. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  13. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +11 -0
  14. package/Engines/WebGPU/Extensions/engine.multiRender.js +30 -11
  15. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  16. package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +9 -9
  17. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  18. package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -5
  19. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  21. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
  22. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  23. package/Engines/WebGPU/webgpuConstants.d.ts +6 -0
  24. package/Engines/WebGPU/webgpuConstants.js +6 -0
  25. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  26. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
  27. package/Engines/WebGPU/webgpuHardwareTexture.js +5 -4
  28. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  29. package/Engines/WebGPU/webgpuTextureHelper.js +18 -0
  30. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  31. package/Engines/WebGPU/webgpuTextureManager.js +8 -2
  32. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  33. package/Engines/abstractEngine.d.ts +12 -1
  34. package/Engines/abstractEngine.js +4 -4
  35. package/Engines/abstractEngine.js.map +1 -1
  36. package/Engines/constants.d.ts +17 -1
  37. package/Engines/constants.js +17 -1
  38. package/Engines/constants.js.map +1 -1
  39. package/Engines/engine.d.ts +31 -1
  40. package/Engines/engine.js +17 -1
  41. package/Engines/engine.js.map +1 -1
  42. package/Engines/engineCapabilities.d.ts +2 -0
  43. package/Engines/engineCapabilities.js.map +1 -1
  44. package/Engines/nativeEngine.js +1 -0
  45. package/Engines/nativeEngine.js.map +1 -1
  46. package/Engines/nullEngine.d.ts +2 -2
  47. package/Engines/nullEngine.js +3 -2
  48. package/Engines/nullEngine.js.map +1 -1
  49. package/Engines/renderTargetWrapper.d.ts +33 -1
  50. package/Engines/renderTargetWrapper.js +64 -4
  51. package/Engines/renderTargetWrapper.js.map +1 -1
  52. package/Engines/thinEngine.d.ts +13 -1
  53. package/Engines/thinEngine.functions.d.ts +4 -0
  54. package/Engines/thinEngine.functions.js +17 -0
  55. package/Engines/thinEngine.functions.js.map +1 -1
  56. package/Engines/thinEngine.js +151 -32
  57. package/Engines/thinEngine.js.map +1 -1
  58. package/Engines/thinWebGPUEngine.d.ts +2 -0
  59. package/Engines/thinWebGPUEngine.js +7 -0
  60. package/Engines/thinWebGPUEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.d.ts +12 -3
  62. package/Engines/webgpuEngine.js +40 -9
  63. package/Engines/webgpuEngine.js.map +1 -1
  64. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +8 -0
  65. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +22 -1
  66. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  67. package/FrameGraph/Node/Blocks/inputBlock.d.ts +4 -9
  68. package/FrameGraph/Node/Blocks/inputBlock.js +15 -25
  69. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  70. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -2
  71. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
  72. package/FrameGraph/Passes/renderPass.d.ts +10 -10
  73. package/FrameGraph/Passes/renderPass.js +10 -10
  74. package/FrameGraph/Passes/renderPass.js.map +1 -1
  75. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +10 -5
  76. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +29 -14
  77. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  78. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -0
  79. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
  80. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +11 -6
  81. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +30 -13
  82. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
  83. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -6
  84. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  85. package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +1 -1
  86. package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -1
  87. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +3 -3
  88. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +33 -32
  89. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  90. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -2
  91. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +8 -12
  92. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  93. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +13 -18
  94. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  95. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +15 -2
  96. package/FrameGraph/Tasks/Texture/clearTextureTask.js +17 -4
  97. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  98. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +2 -2
  99. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  100. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -3
  101. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
  102. package/FrameGraph/frameGraph.d.ts +11 -74
  103. package/FrameGraph/frameGraph.js +12 -126
  104. package/FrameGraph/frameGraph.js.map +1 -1
  105. package/FrameGraph/frameGraphRenderContext.d.ts +17 -8
  106. package/FrameGraph/frameGraphRenderContext.js +55 -43
  107. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  108. package/FrameGraph/frameGraphRenderTarget.d.ts +16 -0
  109. package/FrameGraph/frameGraphRenderTarget.js +67 -0
  110. package/FrameGraph/frameGraphRenderTarget.js.map +1 -0
  111. package/FrameGraph/frameGraphTask.d.ts +4 -3
  112. package/FrameGraph/frameGraphTask.js +41 -8
  113. package/FrameGraph/frameGraphTask.js.map +1 -1
  114. package/FrameGraph/frameGraphTextureManager.d.ts +130 -22
  115. package/FrameGraph/frameGraphTextureManager.js +312 -130
  116. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  117. package/FrameGraph/frameGraphTypes.d.ts +28 -13
  118. package/FrameGraph/frameGraphTypes.js.map +1 -1
  119. package/FrameGraph/index.d.ts +1 -0
  120. package/FrameGraph/index.js +1 -0
  121. package/FrameGraph/index.js.map +1 -1
  122. package/Helpers/environmentHelper.js.map +1 -1
  123. package/Layers/effectLayer.d.ts +1 -1
  124. package/Layers/effectLayer.js.map +1 -1
  125. package/Layers/glowLayer.d.ts +1 -1
  126. package/Layers/glowLayer.js.map +1 -1
  127. package/Layers/highlightLayer.d.ts +1 -1
  128. package/Layers/highlightLayer.js.map +1 -1
  129. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  130. package/Materials/Node/Blocks/conditionalBlock.d.ts +2 -0
  131. package/Materials/Node/Blocks/conditionalBlock.js +13 -0
  132. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  133. package/Materials/Node/nodeMaterial.js.map +1 -1
  134. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
  135. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  136. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  137. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  138. package/Materials/Textures/baseTexture.js.map +1 -1
  139. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  140. package/Materials/Textures/internalTexture.d.ts +20 -0
  141. package/Materials/Textures/internalTexture.js +48 -0
  142. package/Materials/Textures/internalTexture.js.map +1 -1
  143. package/Materials/Textures/mirrorTexture.js.map +1 -1
  144. package/Materials/Textures/multiRenderTarget.d.ts +5 -0
  145. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  146. package/Materials/Textures/rawCubeTexture.d.ts +2 -2
  147. package/Materials/Textures/rawCubeTexture.js +2 -2
  148. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  149. package/Materials/Textures/rawTexture.js.map +1 -1
  150. package/Materials/Textures/rawTexture2DArray.d.ts +1 -1
  151. package/Materials/Textures/rawTexture2DArray.js +1 -1
  152. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  153. package/Materials/Textures/rawTexture3D.d.ts +1 -1
  154. package/Materials/Textures/rawTexture3D.js +1 -1
  155. package/Materials/Textures/rawTexture3D.js.map +1 -1
  156. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  157. package/Materials/Textures/textureCreationOptions.d.ts +6 -6
  158. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  159. package/Materials/drawWrapper.d.ts +6 -1
  160. package/Materials/drawWrapper.js +18 -2
  161. package/Materials/drawWrapper.js.map +1 -1
  162. package/Materials/effect.d.ts +6 -1
  163. package/Materials/effect.functions.d.ts +5 -0
  164. package/Materials/effect.functions.js +19 -0
  165. package/Materials/effect.functions.js.map +1 -1
  166. package/Materials/effect.js +22 -20
  167. package/Materials/effect.js.map +1 -1
  168. package/Materials/effect.webgl.functions.js +12 -4
  169. package/Materials/effect.webgl.functions.js.map +1 -1
  170. package/Maths/math.color.d.ts +16 -0
  171. package/Maths/math.color.js +16 -0
  172. package/Maths/math.color.js.map +1 -1
  173. package/Maths/math.vector.d.ts +32 -0
  174. package/Maths/math.vector.js +32 -0
  175. package/Maths/math.vector.js.map +1 -1
  176. package/Meshes/Compression/dracoCompression.d.ts +3 -1
  177. package/Meshes/Compression/dracoCompression.js +5 -2
  178. package/Meshes/Compression/dracoCompression.js.map +1 -1
  179. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -1
  180. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -0
  181. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  182. package/Meshes/Node/Blocks/Matrices/rotationXBlock.d.ts +0 -1
  183. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js +1 -9
  184. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
  185. package/Meshes/Node/Blocks/Matrices/rotationYBlock.d.ts +0 -1
  186. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js +1 -9
  187. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
  188. package/Meshes/Node/Blocks/Matrices/rotationZBlock.d.ts +0 -1
  189. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js +1 -9
  190. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
  191. package/Meshes/Node/Blocks/Set/latticeBlock.js +3 -1
  192. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  193. package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
  194. package/Meshes/Node/Blocks/conditionBlock.js +15 -0
  195. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  196. package/Meshes/Node/Blocks/geometryClampBlock.d.ts +4 -4
  197. package/Meshes/Node/Blocks/geometryClampBlock.js +16 -25
  198. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  199. package/Meshes/Node/Blocks/geometryLerpBlock.js +2 -2
  200. package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
  201. package/Meshes/Node/Blocks/geometryNLerpBlock.js +2 -2
  202. package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
  203. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +2 -2
  204. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
  205. package/Meshes/Node/Blocks/geometryRotate2dBlock.js +2 -2
  206. package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
  207. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +3 -3
  208. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
  209. package/Meshes/Node/Blocks/geometryStepBlock.js +2 -2
  210. package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
  211. package/Meshes/Node/nodeGeometry.js +1 -1
  212. package/Meshes/Node/nodeGeometry.js.map +1 -1
  213. package/Meshes/Node/nodeGeometryBlock.d.ts +3 -1
  214. package/Meshes/Node/nodeGeometryBlock.js +2 -1
  215. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  216. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +10 -2
  217. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  218. package/Meshes/abstractMesh.d.ts +5 -3
  219. package/Meshes/abstractMesh.js +9 -7
  220. package/Meshes/abstractMesh.js.map +1 -1
  221. package/Meshes/subMesh.d.ts +5 -3
  222. package/Meshes/subMesh.js +9 -7
  223. package/Meshes/subMesh.js.map +1 -1
  224. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  225. package/Misc/dds.d.ts +1 -1
  226. package/Misc/dds.js.map +1 -1
  227. package/Misc/environmentTextureTools.js.map +1 -1
  228. package/Misc/observable.d.ts +1 -3
  229. package/Misc/observable.js +9 -7
  230. package/Misc/observable.js.map +1 -1
  231. package/Misc/screenshotTools.js.map +1 -1
  232. package/Misc/snapshotRenderingHelper.js +3 -0
  233. package/Misc/snapshotRenderingHelper.js.map +1 -1
  234. package/Misc/textureTools.js.map +1 -1
  235. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  236. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
  237. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  238. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  239. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  240. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  241. package/PostProcesses/blurPostProcess.js.map +1 -1
  242. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  243. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  244. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  245. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  246. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  247. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  248. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  249. package/PostProcesses/grainPostProcess.js.map +1 -1
  250. package/PostProcesses/highlightsPostProcess.d.ts +1 -1
  251. package/PostProcesses/highlightsPostProcess.js +1 -1
  252. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  253. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  254. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  255. package/PostProcesses/passPostProcess.js.map +1 -1
  256. package/PostProcesses/postProcess.d.ts +1 -1
  257. package/PostProcesses/postProcess.js.map +1 -1
  258. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  259. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  260. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  261. package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
  262. package/PostProcesses/tonemapPostProcess.d.ts +1 -1
  263. package/PostProcesses/tonemapPostProcess.js +1 -1
  264. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  265. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  266. package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +1 -1
  267. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  268. package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
  269. package/Rendering/prePassRenderer.js.map +1 -1
  270. package/ShadersWGSL/pbr.fragment.js +4 -3
  271. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  272. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphTextureManager.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTextureManager.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAoBjD,IAAK,0BAIJ;AAJD,WAAK,0BAA0B;IAC3B,2EAAI,CAAA;IACJ,6EAAK,CAAA;IACL,mFAAQ,CAAA;AACZ,CAAC,EAJI,0BAA0B,KAA1B,0BAA0B,QAI9B;AAED;;;GAGG;AACH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G,CAAC,AAAJ,CAAK,CAAC,+CAA+C","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type {\r\n Scene,\r\n AbstractEngine,\r\n RenderTargetWrapper,\r\n RenderTargetCreationOptions,\r\n TextureSize,\r\n Nullable,\r\n FrameGraphTextureCreationOptions,\r\n FrameGraphTextureHandle,\r\n} from \"core/index\";\r\nimport { getDimensionsFromTextureSize } from \"../Materials/Textures/textureCreationOptions\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"./frameGraphTypes\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\ntype HistoryTexture = {\r\n textures: Array<Nullable<RenderTargetWrapper>>;\r\n handles: Array<FrameGraphTextureHandle>;\r\n index: number;\r\n refHandles: Array<FrameGraphTextureHandle>; // (dangling) handles that reference this history texture\r\n};\r\n\r\ntype TextureEntry = {\r\n texture: Nullable<RenderTargetWrapper>;\r\n name: string;\r\n creationOptions: FrameGraphTextureCreationOptions;\r\n namespace: FrameGraphTextureNamespace;\r\n debug?: Texture;\r\n parentHandle?: FrameGraphTextureHandle; // Parent handle if the texture comes from a multi-target texture\r\n parentTextureIndex?: number; // Index of the texture in the parent if the texture comes from a multi-target texture\r\n refHandle?: FrameGraphTextureHandle; // Handle of the texture this one is referencing - used for dangling handles\r\n};\r\n\r\nenum FrameGraphTextureNamespace {\r\n Task,\r\n Graph,\r\n External,\r\n}\r\n\r\n/**\r\n * @experimental\r\n * @internal\r\n */\r\nexport class FrameGraphTextureManager {\r\n private static _Counter = 2; // 0 and 1 are reserved for backbuffer textures\r\n\r\n public _textures: Map<FrameGraphTextureHandle, TextureEntry> = new Map();\r\n public _historyTextures: Map<FrameGraphTextureHandle, HistoryTexture> = new Map();\r\n\r\n constructor(\r\n private _engine: AbstractEngine,\r\n private _debugTextures = false,\r\n private _scene?: Scene\r\n ) {\r\n this._addSystemTextures();\r\n }\r\n\r\n public isBackbuffer(handle: FrameGraphTextureHandle): boolean {\r\n if (handle === backbufferColorTextureHandle || handle === backbufferDepthStencilTextureHandle) {\r\n return true;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n if (!textureEntry) {\r\n return false;\r\n }\r\n\r\n return textureEntry.refHandle === backbufferColorTextureHandle || textureEntry.refHandle === backbufferDepthStencilTextureHandle;\r\n }\r\n\r\n public isBackbufferColor(handle: FrameGraphTextureHandle): boolean {\r\n if (handle === backbufferColorTextureHandle) {\r\n return true;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n if (!textureEntry) {\r\n return false;\r\n }\r\n\r\n return textureEntry.refHandle === backbufferColorTextureHandle;\r\n }\r\n\r\n public isBackbufferDepthStencil(handle: FrameGraphTextureHandle): boolean {\r\n if (handle === backbufferDepthStencilTextureHandle) {\r\n return true;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n if (!textureEntry) {\r\n return false;\r\n }\r\n\r\n return textureEntry.refHandle === backbufferDepthStencilTextureHandle;\r\n }\r\n\r\n public getTextureCreationOptions(handle: FrameGraphTextureHandle): FrameGraphTextureCreationOptions {\r\n return this._textures.get(handle)!.creationOptions;\r\n }\r\n\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<RenderTargetWrapper> {\r\n const historyEntry = this._historyTextures.get(handle);\r\n if (historyEntry) {\r\n return historyEntry.textures[historyEntry.index ^ 1]; // get the read texture\r\n }\r\n return this._textures.get(handle)!.texture;\r\n }\r\n\r\n public importTexture(name: string, texture: RenderTargetWrapper, handle?: FrameGraphTextureHandle): FrameGraphTextureHandle {\r\n const internalTexture = texture.texture;\r\n\r\n if (!internalTexture) {\r\n throw new Error(\"importTexture: Texture must have an internal texture to be imported\");\r\n }\r\n\r\n if (handle !== undefined) {\r\n this._freeEntry(handle);\r\n }\r\n\r\n const creationOptions: FrameGraphTextureCreationOptions = {\r\n size: { width: texture.width, height: texture.height },\r\n options: {\r\n generateMipMaps: internalTexture.generateMipMaps,\r\n generateDepthBuffer: texture._generateDepthBuffer,\r\n generateStencilBuffer: texture._generateStencilBuffer,\r\n samples: internalTexture.samples,\r\n label: internalTexture.label,\r\n types: [internalTexture.type],\r\n samplingModes: [internalTexture.samplingMode],\r\n formats: [internalTexture.format],\r\n targetTypes: [\r\n internalTexture.isCube\r\n ? Constants.TEXTURE_CUBE_MAP\r\n : internalTexture.is3D\r\n ? Constants.TEXTURE_3D\r\n : internalTexture.is2DArray\r\n ? Constants.TEXTURE_2D_ARRAY\r\n : Constants.TEXTURE_2D,\r\n ],\r\n useSRGBBuffers: [internalTexture._useSRGBBuffer],\r\n labels: internalTexture.label ? [internalTexture.label] : undefined,\r\n },\r\n sizeIsPercentage: false,\r\n };\r\n\r\n return this._createHandleForTexture(name, texture, creationOptions, FrameGraphTextureNamespace.External, false, handle);\r\n }\r\n\r\n public createRenderTargetTexture(\r\n name: string,\r\n taskNamespace: boolean,\r\n creationOptions: FrameGraphTextureCreationOptions,\r\n multiTargetMode = false,\r\n handle?: FrameGraphTextureHandle\r\n ): FrameGraphTextureHandle {\r\n return this._createHandleForTexture(\r\n name,\r\n null,\r\n creationOptions,\r\n taskNamespace ? FrameGraphTextureNamespace.Task : FrameGraphTextureNamespace.Graph,\r\n multiTargetMode,\r\n handle\r\n );\r\n }\r\n\r\n public getAbsoluteDimensions(\r\n size: TextureSize,\r\n screenWidth = this._engine.getRenderWidth(true),\r\n screenHeight = this._engine.getRenderHeight(true)\r\n ): { width: number; height: number } {\r\n const { width, height } = getDimensionsFromTextureSize(size);\r\n\r\n return {\r\n width: Math.floor((width * screenWidth) / 100),\r\n height: Math.floor((height * screenHeight) / 100),\r\n };\r\n }\r\n\r\n public updateHistoryTextures(): void {\r\n this._historyTextures.forEach((entry) => {\r\n entry.index = entry.index ^ 1;\r\n for (const refHandle of entry.refHandles) {\r\n const textureEntry = this._textures.get(refHandle)!;\r\n textureEntry.texture = entry.textures[entry.index];\r\n }\r\n });\r\n }\r\n\r\n public dispose(): void {\r\n this.releaseTextures();\r\n }\r\n\r\n public allocateTextures() {\r\n this._textures.forEach((entry) => {\r\n if (!entry.texture) {\r\n if (entry.refHandle !== undefined) {\r\n const refEntry = this._textures.get(entry.refHandle)!;\r\n\r\n entry.texture = refEntry.texture;\r\n entry.texture?.texture?.incrementReferences();\r\n\r\n if (refEntry.refHandle === backbufferColorTextureHandle) {\r\n entry.refHandle = backbufferColorTextureHandle;\r\n }\r\n if (refEntry.refHandle === backbufferDepthStencilTextureHandle) {\r\n entry.refHandle = backbufferDepthStencilTextureHandle;\r\n }\r\n } else if (entry.namespace !== FrameGraphTextureNamespace.External) {\r\n if (entry.parentHandle !== undefined) {\r\n const creationOptions = entry.creationOptions;\r\n const size = creationOptions.sizeIsPercentage ? this.getAbsoluteDimensions(creationOptions.size) : creationOptions.size;\r\n\r\n const parentEntry = this._textures.get(entry.parentHandle)!;\r\n const parentInternalTexture = parentEntry.texture!.textures![entry.parentTextureIndex!];\r\n\r\n const creationOptionsForTexture: RenderTargetCreationOptions = {\r\n createMipMaps: creationOptions.options.createMipMaps,\r\n generateMipMaps: creationOptions.options.generateMipMaps,\r\n generateDepthBuffer: creationOptions.options.generateDepthBuffer,\r\n generateStencilBuffer: creationOptions.options.generateStencilBuffer,\r\n samples: creationOptions.options.samples,\r\n type: creationOptions.options.types![0],\r\n format: creationOptions.options.formats![0],\r\n useSRGBBuffer: creationOptions.options.useSRGBBuffers![0],\r\n colorAttachment: parentInternalTexture,\r\n label: creationOptions.options.label,\r\n };\r\n\r\n entry.texture = this._engine.createRenderTargetTexture(size, creationOptionsForTexture);\r\n parentInternalTexture.incrementReferences();\r\n } else {\r\n const creationOptions = entry.creationOptions;\r\n const size = creationOptions.sizeIsPercentage ? this.getAbsoluteDimensions(creationOptions.size) : creationOptions.size;\r\n\r\n entry.texture = this._engine.createMultipleRenderTarget(size, creationOptions.options, false);\r\n }\r\n }\r\n }\r\n\r\n if (entry.texture && entry.refHandle === undefined) {\r\n entry.debug?.dispose();\r\n entry.debug = this._createDebugTexture(entry.name, entry.texture);\r\n }\r\n });\r\n\r\n this._historyTextures.forEach((entry) => {\r\n for (let i = 0; i < entry.handles.length; i++) {\r\n entry.textures[i] = this._textures.get(entry.handles[i])!.texture;\r\n }\r\n });\r\n }\r\n\r\n public createDanglingHandle() {\r\n return FrameGraphTextureManager._Counter++;\r\n }\r\n\r\n public resolveDanglingHandle(danglingHandle: FrameGraphTextureHandle, handle: FrameGraphTextureHandle) {\r\n const textureEntry = this._textures.get(handle);\r\n\r\n if (textureEntry === undefined) {\r\n throw new Error(`resolveDanglingHandle: Handle ${handle} does not exist!`);\r\n }\r\n\r\n this._textures.set(danglingHandle, {\r\n texture: textureEntry.texture,\r\n refHandle: handle,\r\n name: textureEntry.name,\r\n creationOptions: {\r\n size: { ...(textureEntry.creationOptions.size as { width: number; height: number; depth?: number; layers?: number }) },\r\n options: { ...textureEntry.creationOptions.options, label: textureEntry.name },\r\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\r\n isHistoryTexture: false,\r\n },\r\n namespace: textureEntry.namespace,\r\n parentHandle: textureEntry.parentHandle,\r\n parentTextureIndex: textureEntry.parentTextureIndex,\r\n });\r\n\r\n const historyEntry = this._historyTextures.get(handle);\r\n if (historyEntry) {\r\n historyEntry.refHandles.push(danglingHandle);\r\n }\r\n }\r\n\r\n public releaseTextures(releaseAll = true): void {\r\n this._textures.forEach((entry, handle) => {\r\n if (releaseAll || entry.namespace !== FrameGraphTextureNamespace.External) {\r\n entry.debug?.dispose();\r\n entry.debug = undefined;\r\n }\r\n\r\n if (entry.namespace === FrameGraphTextureNamespace.External) {\r\n return;\r\n }\r\n\r\n entry.texture?.dispose();\r\n entry.texture = null;\r\n\r\n if (releaseAll || entry.namespace === FrameGraphTextureNamespace.Task) {\r\n this._textures.delete(handle);\r\n }\r\n });\r\n\r\n this._historyTextures.forEach((entry) => {\r\n for (let i = 0; i < entry.handles.length; i++) {\r\n entry.textures[i] = null;\r\n }\r\n });\r\n\r\n if (releaseAll) {\r\n this._textures.clear();\r\n this._historyTextures.clear();\r\n this._addSystemTextures();\r\n }\r\n }\r\n\r\n private _addSystemTextures() {\r\n const size = { width: this._engine.getRenderWidth(true), height: this._engine.getRenderHeight(true) };\r\n\r\n this._textures.set(backbufferColorTextureHandle, {\r\n name: \"backbuffer color\",\r\n texture: null,\r\n creationOptions: {\r\n size,\r\n options: {},\r\n sizeIsPercentage: false,\r\n },\r\n namespace: FrameGraphTextureNamespace.External,\r\n });\r\n\r\n this._textures.set(backbufferDepthStencilTextureHandle, {\r\n name: \"backbuffer depth/stencil\",\r\n texture: null,\r\n creationOptions: {\r\n size,\r\n options: {},\r\n sizeIsPercentage: false,\r\n },\r\n namespace: FrameGraphTextureNamespace.External,\r\n });\r\n }\r\n\r\n private _createDebugTexture(name: string, texture: RenderTargetWrapper): Texture | undefined {\r\n if (!this._debugTextures || !this._scene) {\r\n return;\r\n }\r\n\r\n const textureDebug = new Texture(null, this._scene);\r\n\r\n textureDebug.name = name;\r\n textureDebug._texture = texture.texture || texture._depthStencilTexture!;\r\n textureDebug._texture.incrementReferences();\r\n\r\n return textureDebug;\r\n }\r\n\r\n private _freeEntry(handle: number): void {\r\n const entry = this._textures.get(handle);\r\n\r\n if (entry) {\r\n entry.debug?.dispose();\r\n this._textures.delete(handle);\r\n }\r\n }\r\n\r\n private _createHandleForTexture(\r\n name: string,\r\n texture: Nullable<RenderTargetWrapper>,\r\n creationOptions: FrameGraphTextureCreationOptions,\r\n namespace: FrameGraphTextureNamespace,\r\n multiTargetMode = false,\r\n handle?: FrameGraphTextureHandle,\r\n parentHandle?: FrameGraphTextureHandle,\r\n parentTextureIndex?: number\r\n ): FrameGraphTextureHandle {\r\n handle = handle ?? FrameGraphTextureManager._Counter++;\r\n\r\n const textureName = creationOptions.isHistoryTexture ? `${name} - ping` : name;\r\n\r\n const textureEntry: TextureEntry = {\r\n texture,\r\n name: textureName,\r\n creationOptions: {\r\n size: getDimensionsFromTextureSize(creationOptions.size),\r\n options: { ...creationOptions.options, label: textureName },\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n isHistoryTexture: creationOptions.isHistoryTexture,\r\n },\r\n namespace,\r\n parentHandle,\r\n parentTextureIndex,\r\n };\r\n\r\n this._textures.set(handle, textureEntry);\r\n\r\n if (namespace === FrameGraphTextureNamespace.External) {\r\n return handle;\r\n }\r\n\r\n if (creationOptions.isHistoryTexture) {\r\n const pongCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: { ...(textureEntry.creationOptions.size as { width: number; height: number }) },\r\n options: { ...textureEntry.creationOptions.options },\r\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\r\n isHistoryTexture: false,\r\n };\r\n\r\n const pongTexture = this._createHandleForTexture(`${name} - pong`, null, pongCreationOptions, namespace, false);\r\n\r\n this._historyTextures.set(handle, { textures: [null, null], handles: [handle, pongTexture], index: 0, refHandles: [] });\r\n\r\n return handle;\r\n }\r\n\r\n if (multiTargetMode) {\r\n const textureCount = creationOptions.options.textureCount ?? 1;\r\n for (let i = 0; i < textureCount; i++) {\r\n const label = creationOptions.options.labels?.[i] ?? `${i}`;\r\n const textureName = `${name} - ${label}`;\r\n const creationOptionsForTexture: FrameGraphTextureCreationOptions = {\r\n size: getDimensionsFromTextureSize(creationOptions.size),\r\n options: {\r\n ...creationOptions.options,\r\n formats: [creationOptions.options.formats![i]],\r\n types: [creationOptions.options.types![i]],\r\n textureCount: 1,\r\n },\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n };\r\n this._createHandleForTexture(textureName, null, creationOptionsForTexture, namespace, false, handle + i + 1, handle, i);\r\n }\r\n\r\n FrameGraphTextureManager._Counter += textureCount;\r\n }\r\n\r\n return handle;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphTextureManager.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTextureManager.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,8CAA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OAAO,CAAC,OAAO;gBACxB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;gBACrD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC3D,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS;gBAChF,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC7E,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;aAC3D,CAAC;IACZ,CAAC;;AAjlBc,iCAAQ,GAAG,CAAC,AAAJ,CAAK,CAAC,+CAA+C","sourcesContent":["import type {\r\n Scene,\r\n AbstractEngine,\r\n TextureSize,\r\n Nullable,\r\n FrameGraphTextureCreationOptions,\r\n FrameGraphTextureHandle,\r\n InternalTextureCreationOptions,\r\n InternalTexture,\r\n FrameGraphTextureOptions,\r\n FrameGraphTextureDescription,\r\n RenderTargetWrapper,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { getDimensionsFromTextureSize, textureSizeIsObject } from \"../Materials/Textures/textureCreationOptions\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"./frameGraphTypes\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { InternalTextureSource, GetTypeForDepthTexture, IsDepthTexture, HasStencilAspect } from \"../Materials/Textures/internalTexture\";\r\nimport { FrameGraphRenderTarget } from \"./frameGraphRenderTarget\";\r\n\r\ntype HistoryTexture = {\r\n textures: Array<Nullable<InternalTexture>>;\r\n handles: Array<FrameGraphTextureHandle>;\r\n index: number; // current index in textures array\r\n references: Array<{ renderTargetWrapper: RenderTargetWrapper; textureIndex: number }>; // render target wrappers that reference this history texture\r\n};\r\n\r\ntype TextureEntry = {\r\n texture: Nullable<InternalTexture>;\r\n name: string;\r\n creationOptions: FrameGraphTextureCreationOptions; // in TextureEntry, creationOptions.size is always an object\r\n namespace: FrameGraphTextureNamespace;\r\n textureIndex?: number; // Index of the texture in the types, formats, etc array of FrameGraphTextureOptions (default: 0)\r\n debug?: Texture;\r\n refHandle?: FrameGraphTextureHandle; // Handle of the texture this one is referencing - used for dangling handles\r\n};\r\n\r\nenum FrameGraphTextureNamespace {\r\n Task,\r\n Graph,\r\n External,\r\n}\r\n\r\n/**\r\n * Manages the textures used by a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraphTextureManager {\r\n private static _Counter = 2; // 0 and 1 are reserved for backbuffer textures\r\n\r\n /** @internal */\r\n public readonly _textures: Map<FrameGraphTextureHandle, TextureEntry> = new Map();\r\n\r\n /** @internal */\r\n public readonly _historyTextures: Map<FrameGraphTextureHandle, HistoryTexture> = new Map();\r\n\r\n /** @internal */\r\n public _isRecordingTask = false;\r\n\r\n /**\r\n * Constructs a new instance of the texture manager\r\n * @param engine The engine to use\r\n * @param _debugTextures If true, debug textures will be created so that they are visible in the inspector\r\n * @param _scene The scene the manager belongs to\r\n */\r\n constructor(\r\n public readonly engine: AbstractEngine,\r\n private readonly _debugTextures = false,\r\n private readonly _scene: Scene\r\n ) {\r\n this._addSystemTextures();\r\n }\r\n\r\n /**\r\n * Checks if a handle is a backbuffer handle (color or depth/stencil)\r\n * @param handle The handle to check\r\n * @returns True if the handle is a backbuffer handle\r\n */\r\n public isBackbuffer(handle: FrameGraphTextureHandle): boolean {\r\n if (handle === backbufferColorTextureHandle || handle === backbufferDepthStencilTextureHandle) {\r\n return true;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n if (!textureEntry) {\r\n return false;\r\n }\r\n\r\n return textureEntry.refHandle === backbufferColorTextureHandle || textureEntry.refHandle === backbufferDepthStencilTextureHandle;\r\n }\r\n\r\n /**\r\n * Checks if a handle is a backbuffer color handle\r\n * @param handle The handle to check\r\n * @returns True if the handle is a backbuffer color handle\r\n */\r\n public isBackbufferColor(handle: FrameGraphTextureHandle): boolean {\r\n if (handle === backbufferColorTextureHandle) {\r\n return true;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n if (!textureEntry) {\r\n return false;\r\n }\r\n\r\n return textureEntry.refHandle === backbufferColorTextureHandle;\r\n }\r\n\r\n /**\r\n * Checks if a handle is a backbuffer depth/stencil handle\r\n * @param handle The handle to check\r\n * @returns True if the handle is a backbuffer depth/stencil handle\r\n */\r\n public isBackbufferDepthStencil(handle: FrameGraphTextureHandle): boolean {\r\n if (handle === backbufferDepthStencilTextureHandle) {\r\n return true;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n if (!textureEntry) {\r\n return false;\r\n }\r\n\r\n return textureEntry.refHandle === backbufferDepthStencilTextureHandle;\r\n }\r\n\r\n /**\r\n * Checks if a handle is a history texture (or points to a history texture, for a dangling handle)\r\n * @param handle The handle to check\r\n * @returns True if the handle is a history texture, otherwise false\r\n */\r\n public isHistoryTexture(handle: FrameGraphTextureHandle): boolean {\r\n const entry = this._textures.get(handle);\r\n if (!entry) {\r\n return false;\r\n }\r\n\r\n handle = entry.refHandle ?? handle;\r\n\r\n return this._historyTextures.has(handle);\r\n }\r\n\r\n /**\r\n * Gets the creation options of a texture\r\n * @param handle Handle of the texture\r\n * @returns The creation options of the texture\r\n */\r\n public getTextureCreationOptions(handle: FrameGraphTextureHandle): FrameGraphTextureCreationOptions {\r\n const entry = this._textures.get(handle)!;\r\n const creationOptions = entry.creationOptions;\r\n\r\n return {\r\n size: textureSizeIsObject(creationOptions.size) ? { ...creationOptions.size } : creationOptions.size,\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n options: this._cloneTextureOptions(creationOptions.options, entry.textureIndex),\r\n isHistoryTexture: creationOptions.isHistoryTexture,\r\n };\r\n }\r\n\r\n /**\r\n * Gets the description of a texture\r\n * @param handle Handle of the texture\r\n * @returns The description of the texture\r\n */\r\n public getTextureDescription(handle: FrameGraphTextureHandle): FrameGraphTextureDescription {\r\n const creationOptions = this.getTextureCreationOptions(handle);\r\n\r\n const size = !creationOptions.sizeIsPercentage\r\n ? textureSizeIsObject(creationOptions.size)\r\n ? creationOptions.size\r\n : { width: creationOptions.size, height: creationOptions.size }\r\n : this.getAbsoluteDimensions(creationOptions.size);\r\n\r\n return {\r\n size,\r\n options: creationOptions.options,\r\n };\r\n }\r\n\r\n /**\r\n * Gets a texture handle or creates a new texture if the handle is not provided.\r\n * If handle is not provided, newTextureName and creationOptions must be provided.\r\n * @param handle If provided, will simply return the handle\r\n * @param newTextureName Name of the new texture to create\r\n * @param creationOptions Options to use when creating the new texture\r\n * @returns The handle to the texture.\r\n */\r\n public getTextureHandleOrCreateTexture(handle?: FrameGraphTextureHandle, newTextureName?: string, creationOptions?: FrameGraphTextureCreationOptions): FrameGraphTextureHandle {\r\n if (handle === undefined) {\r\n if (newTextureName === undefined || creationOptions === undefined) {\r\n throw new Error(\"getTextureHandleOrCreateTexture: Either handle or newTextureName and creationOptions must be provided.\");\r\n }\r\n return this.createRenderTargetTexture(newTextureName, creationOptions);\r\n }\r\n return handle;\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 const historyEntry = this._historyTextures.get(handle);\r\n if (historyEntry) {\r\n return historyEntry.textures[historyEntry.index ^ 1]; // gets the read texture\r\n }\r\n return this._textures.get(handle)!.texture;\r\n }\r\n\r\n /**\r\n * Imports a texture into the texture manager\r\n * @param name Name of the texture\r\n * @param texture Texture to import\r\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\r\n * @returns The handle to the texture\r\n */\r\n public importTexture(name: string, texture: InternalTexture, handle?: FrameGraphTextureHandle): FrameGraphTextureHandle {\r\n if (handle !== undefined) {\r\n this._freeEntry(handle);\r\n }\r\n\r\n const creationOptions: FrameGraphTextureCreationOptions = {\r\n size: { width: texture.width, height: texture.height },\r\n sizeIsPercentage: false,\r\n isHistoryTexture: false,\r\n options: {\r\n createMipMaps: texture.generateMipMaps,\r\n samples: texture.samples,\r\n types: [texture.type],\r\n formats: [texture.format],\r\n useSRGBBuffers: [texture._useSRGBBuffer],\r\n creationFlags: [texture._creationFlags],\r\n labels: texture.label ? [texture.label] : [\"imported\"],\r\n },\r\n };\r\n\r\n return this._createHandleForTexture(name, texture, creationOptions, FrameGraphTextureNamespace.External, handle);\r\n }\r\n\r\n /**\r\n * Creates a new render target texture\r\n * If multiple textures are described in FrameGraphTextureCreationOptions, the handle of the first texture is returned, handle+1 is the handle of the second texture, etc.\r\n * @param name Name of the texture\r\n * @param creationOptions Options to use when creating the texture\r\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\r\n * @returns The handle to the texture\r\n */\r\n public createRenderTargetTexture(name: string, creationOptions: FrameGraphTextureCreationOptions, handle?: FrameGraphTextureHandle): FrameGraphTextureHandle {\r\n return this._createHandleForTexture(\r\n name,\r\n null,\r\n {\r\n size: textureSizeIsObject(creationOptions.size) ? { ...creationOptions.size } : creationOptions.size,\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n isHistoryTexture: creationOptions.isHistoryTexture,\r\n options: this._cloneTextureOptions(creationOptions.options),\r\n },\r\n this._isRecordingTask ? FrameGraphTextureNamespace.Task : FrameGraphTextureNamespace.Graph,\r\n handle\r\n );\r\n }\r\n\r\n /**\r\n * Creates a (frame graph) render target wrapper\r\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\r\n * @param name Name of the render target wrapper\r\n * @param renderTargets Render target handles (textures) to use\r\n * @param renderTargetDepth Render target depth handle (texture) to use\r\n * @returns The created render target wrapper\r\n */\r\n public createRenderTarget(\r\n name: string,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ): FrameGraphRenderTarget {\r\n const renderTarget = new FrameGraphRenderTarget(name, this, renderTargets, renderTargetDepth);\r\n\r\n const rtw = renderTarget.renderTargetWrapper;\r\n\r\n if (rtw !== undefined && renderTargets) {\r\n const handles = Array.isArray(renderTargets) ? renderTargets : [renderTargets];\r\n\r\n for (let i = 0; i < handles.length; i++) {\r\n let handle = handles[i];\r\n handle = this._textures.get(handle)?.refHandle ?? handle;\r\n\r\n const historyEntry = this._historyTextures.get(handle);\r\n if (historyEntry) {\r\n historyEntry.references.push({ renderTargetWrapper: rtw, textureIndex: i });\r\n\r\n rtw.setTexture(historyEntry.textures[historyEntry.index]!, i, false);\r\n }\r\n }\r\n }\r\n\r\n return renderTarget;\r\n }\r\n\r\n /**\r\n * Creates a handle which is not associated with any texture.\r\n * Call resolveDanglingHandle to associate the handle with a valid texture handle.\r\n * @returns The dangling handle\r\n */\r\n public createDanglingHandle() {\r\n return FrameGraphTextureManager._Counter++;\r\n }\r\n\r\n /**\r\n * Associates a texture with a dangling handle\r\n * @param danglingHandle The dangling handle\r\n * @param handle The handle to associate with the dangling handle (if not provided, a new texture handle will be created, using the newTextureName and creationOptions parameters)\r\n * @param newTextureName The name of the new texture to create (if handle is not provided)\r\n * @param creationOptions The options to use when creating the new texture (if handle is not provided)\r\n */\r\n public resolveDanglingHandle(\r\n danglingHandle: FrameGraphTextureHandle,\r\n handle?: FrameGraphTextureHandle,\r\n newTextureName?: string,\r\n creationOptions?: FrameGraphTextureCreationOptions\r\n ) {\r\n if (handle === undefined) {\r\n if (newTextureName === undefined || creationOptions === undefined) {\r\n throw new Error(\"resolveDanglingHandle: Either handle or newTextureName and creationOptions must be provided.\");\r\n }\r\n this.createRenderTargetTexture(newTextureName, creationOptions, danglingHandle);\r\n return;\r\n }\r\n\r\n const textureEntry = this._textures.get(handle);\r\n\r\n if (textureEntry === undefined) {\r\n throw new Error(`resolveDanglingHandle: Handle ${handle} does not exist!`);\r\n }\r\n\r\n this._textures.set(danglingHandle, {\r\n texture: textureEntry.texture,\r\n refHandle: handle,\r\n name: textureEntry.name,\r\n creationOptions: {\r\n size: { ...(textureEntry.creationOptions.size as { width: number; height: number; depth?: number; layers?: number }) },\r\n options: this._cloneTextureOptions(textureEntry.creationOptions.options),\r\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\r\n isHistoryTexture: false,\r\n },\r\n namespace: textureEntry.namespace,\r\n textureIndex: textureEntry.textureIndex,\r\n });\r\n }\r\n\r\n /**\r\n * Gets the absolute dimensions of a texture.\r\n * @param size The size of the texture. Width and height must be expressed as a percentage of the screen size (100=100%)!\r\n * @param screenWidth The width of the screen (default: the width of the rendering canvas)\r\n * @param screenHeight The height of the screen (default: the height of the rendering canvas)\r\n * @returns The absolute dimensions of the texture\r\n */\r\n public getAbsoluteDimensions(\r\n size: TextureSize,\r\n screenWidth = this.engine.getRenderWidth(true),\r\n screenHeight = this.engine.getRenderHeight(true)\r\n ): { width: number; height: number } {\r\n const { width, height } = getDimensionsFromTextureSize(size);\r\n\r\n return {\r\n width: Math.floor((width * screenWidth) / 100),\r\n height: Math.floor((height * screenHeight) / 100),\r\n };\r\n }\r\n\r\n /** @internal */\r\n public _dispose(): void {\r\n this._releaseTextures();\r\n }\r\n\r\n /** @internal */\r\n public _allocateTextures() {\r\n this._textures.forEach((entry) => {\r\n if (!entry.texture) {\r\n if (entry.refHandle !== undefined) {\r\n // entry is a dangling handle which has been resolved to point to refHandle\r\n // We simply update the texture to point to the refHandle texture\r\n const refEntry = this._textures.get(entry.refHandle)!;\r\n\r\n entry.texture = refEntry.texture;\r\n\r\n if (refEntry.refHandle === backbufferColorTextureHandle) {\r\n entry.refHandle = backbufferColorTextureHandle;\r\n }\r\n if (refEntry.refHandle === backbufferDepthStencilTextureHandle) {\r\n entry.refHandle = backbufferDepthStencilTextureHandle;\r\n }\r\n } else if (entry.namespace !== FrameGraphTextureNamespace.External) {\r\n const creationOptions = entry.creationOptions;\r\n const size = creationOptions.sizeIsPercentage ? this.getAbsoluteDimensions(creationOptions.size) : creationOptions.size;\r\n const textureIndex = entry.textureIndex || 0;\r\n\r\n const internalTextureCreationOptions: InternalTextureCreationOptions = {\r\n createMipMaps: creationOptions.options.createMipMaps,\r\n samples: creationOptions.options.samples,\r\n type: creationOptions.options.types?.[textureIndex],\r\n format: creationOptions.options.formats?.[textureIndex],\r\n useSRGBBuffer: creationOptions.options.useSRGBBuffers?.[textureIndex],\r\n creationFlags: creationOptions.options.creationFlags?.[textureIndex],\r\n label: creationOptions.options.labels?.[textureIndex] ?? `${entry.name}${textureIndex > 0 ? \"#\" + textureIndex : \"\"}`,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n createMSAATexture: creationOptions.options.samples! > 1,\r\n };\r\n\r\n const isDepthTexture = IsDepthTexture(internalTextureCreationOptions.format!);\r\n const hasStencil = HasStencilAspect(internalTextureCreationOptions.format!);\r\n const source =\r\n isDepthTexture && hasStencil\r\n ? InternalTextureSource.DepthStencil\r\n : isDepthTexture || hasStencil\r\n ? InternalTextureSource.Depth\r\n : InternalTextureSource.RenderTarget;\r\n\r\n const internalTexture = this.engine._createInternalTexture(size, internalTextureCreationOptions, false, source);\r\n\r\n if (isDepthTexture) {\r\n internalTexture.type = GetTypeForDepthTexture(internalTexture.format);\r\n }\r\n\r\n entry.texture = internalTexture;\r\n }\r\n }\r\n\r\n if (entry.texture && entry.refHandle === undefined) {\r\n entry.debug?.dispose();\r\n entry.debug = this._createDebugTexture(entry.name, entry.texture);\r\n }\r\n });\r\n\r\n this._historyTextures.forEach((entry) => {\r\n for (let i = 0; i < entry.handles.length; i++) {\r\n entry.textures[i] = this._textures.get(entry.handles[i])!.texture;\r\n }\r\n });\r\n }\r\n\r\n /** @internal */\r\n public _releaseTextures(releaseAll = true): void {\r\n this._textures.forEach((entry, handle) => {\r\n if (releaseAll || entry.namespace !== FrameGraphTextureNamespace.External) {\r\n entry.debug?.dispose();\r\n entry.debug = undefined;\r\n }\r\n\r\n if (entry.namespace === FrameGraphTextureNamespace.External) {\r\n return;\r\n }\r\n\r\n entry.texture?.dispose();\r\n entry.texture = null;\r\n\r\n if (releaseAll || entry.namespace === FrameGraphTextureNamespace.Task) {\r\n this._textures.delete(handle);\r\n }\r\n });\r\n\r\n this._historyTextures.forEach((entry) => {\r\n for (let i = 0; i < entry.handles.length; i++) {\r\n entry.textures[i] = null;\r\n }\r\n });\r\n\r\n if (releaseAll) {\r\n this._textures.clear();\r\n this._historyTextures.clear();\r\n this._addSystemTextures();\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateHistoryTextures(): void {\r\n this._historyTextures.forEach((entry) => {\r\n entry.index = entry.index ^ 1;\r\n const currentTexture = entry.textures[entry.index];\r\n if (currentTexture) {\r\n for (const { renderTargetWrapper, textureIndex } of entry.references) {\r\n renderTargetWrapper.setTexture(currentTexture, textureIndex, false);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private _addSystemTextures() {\r\n const size = { width: this.engine.getRenderWidth(true), height: this.engine.getRenderHeight(true) };\r\n\r\n this._textures.set(backbufferColorTextureHandle, {\r\n name: \"backbuffer color\",\r\n texture: null,\r\n creationOptions: {\r\n size,\r\n options: {\r\n createMipMaps: false,\r\n samples: this.engine.getCreationOptions().antialias ? 4 : 1,\r\n types: [Constants.TEXTURETYPE_UNSIGNED_BYTE], // todo? get from engine\r\n formats: [Constants.TEXTUREFORMAT_RGBA], // todo? get from engine\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n labels: [\"backbuffer color\"],\r\n },\r\n sizeIsPercentage: false,\r\n },\r\n namespace: FrameGraphTextureNamespace.External,\r\n });\r\n\r\n this._textures.set(backbufferDepthStencilTextureHandle, {\r\n name: \"backbuffer depth/stencil\",\r\n texture: null,\r\n creationOptions: {\r\n size,\r\n options: {\r\n createMipMaps: false,\r\n samples: this.engine.getCreationOptions().antialias ? 4 : 1,\r\n types: [Constants.TEXTURETYPE_UNSIGNED_BYTE], // todo? get from engine\r\n formats: [Constants.TEXTUREFORMAT_DEPTH24], // todo? get from engine\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n labels: [\"backbuffer depth/stencil\"],\r\n },\r\n sizeIsPercentage: false,\r\n },\r\n namespace: FrameGraphTextureNamespace.External,\r\n });\r\n }\r\n\r\n private _createDebugTexture(name: string, texture: InternalTexture): Texture | undefined {\r\n if (!this._debugTextures) {\r\n return;\r\n }\r\n\r\n const textureDebug = new Texture(null, this._scene);\r\n\r\n textureDebug.name = name;\r\n textureDebug._texture = texture;\r\n textureDebug._texture.incrementReferences();\r\n\r\n return textureDebug;\r\n }\r\n\r\n private _freeEntry(handle: number): void {\r\n const entry = this._textures.get(handle);\r\n\r\n if (entry) {\r\n entry.debug?.dispose();\r\n this._textures.delete(handle);\r\n }\r\n }\r\n\r\n private _createHandleForTexture(\r\n name: string,\r\n texture: Nullable<InternalTexture>,\r\n creationOptions: FrameGraphTextureCreationOptions,\r\n namespace: FrameGraphTextureNamespace,\r\n handle?: FrameGraphTextureHandle,\r\n textureIndex?: number\r\n ): FrameGraphTextureHandle {\r\n handle = handle ?? FrameGraphTextureManager._Counter++;\r\n textureIndex = textureIndex || 0;\r\n\r\n const textureName = creationOptions.isHistoryTexture ? `${name} ping` : name;\r\n\r\n const label = creationOptions.options.labels?.[textureIndex] ?? \"\";\r\n\r\n const textureEntry: TextureEntry = {\r\n texture,\r\n name: `${textureName}${label ? \" \" + label : \"\"}`,\r\n creationOptions: {\r\n size: textureSizeIsObject(creationOptions.size) ? creationOptions.size : { width: creationOptions.size, height: creationOptions.size },\r\n options: creationOptions.options,\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n isHistoryTexture: creationOptions.isHistoryTexture,\r\n },\r\n namespace,\r\n textureIndex,\r\n };\r\n\r\n this._textures.set(handle, textureEntry);\r\n\r\n if (namespace === FrameGraphTextureNamespace.External) {\r\n return handle;\r\n }\r\n\r\n if (creationOptions.isHistoryTexture) {\r\n const pongCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: { ...(textureEntry.creationOptions.size as { width: number; height: number }) },\r\n options: { ...textureEntry.creationOptions.options },\r\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\r\n isHistoryTexture: false,\r\n };\r\n\r\n const pongTexture = this._createHandleForTexture(`${name} pong`, null, pongCreationOptions, namespace);\r\n\r\n this._historyTextures.set(handle, { textures: [null, null], handles: [handle, pongTexture], index: 0, references: [] });\r\n\r\n return handle;\r\n }\r\n\r\n if (creationOptions.options.types && creationOptions.options.types.length > 1 && textureIndex === 0) {\r\n const textureCount = creationOptions.options.types.length;\r\n const creationOptionsForTexture: FrameGraphTextureCreationOptions = {\r\n size: textureSizeIsObject(creationOptions.size) ? creationOptions.size : { width: creationOptions.size, height: creationOptions.size },\r\n options: creationOptions.options,\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n };\r\n\r\n for (let i = 1; i < textureCount; i++) {\r\n this._createHandleForTexture(textureName, null, creationOptionsForTexture, namespace, handle + i, i);\r\n }\r\n\r\n FrameGraphTextureManager._Counter += textureCount - 1;\r\n }\r\n\r\n return handle;\r\n }\r\n\r\n private _cloneTextureOptions(options: FrameGraphTextureOptions, textureIndex?: number): FrameGraphTextureOptions {\r\n return textureIndex !== undefined\r\n ? {\r\n createMipMaps: options.createMipMaps,\r\n samples: options.samples,\r\n types: options.types ? [options.types[textureIndex]] : undefined,\r\n formats: options.formats ? [options.formats[textureIndex]] : undefined,\r\n useSRGBBuffers: options.useSRGBBuffers ? [options.useSRGBBuffers[textureIndex]] : undefined,\r\n creationFlags: options.creationFlags ? [options.creationFlags[textureIndex]] : undefined,\r\n labels: options.labels ? [options.labels[textureIndex]] : undefined,\r\n }\r\n : {\r\n createMipMaps: options.createMipMaps,\r\n samples: options.samples,\r\n types: options.types ? [...options.types] : undefined,\r\n formats: options.formats ? [...options.formats] : undefined,\r\n useSRGBBuffers: options.useSRGBBuffers ? [...options.useSRGBBuffers] : undefined,\r\n creationFlags: options.creationFlags ? [...options.creationFlags] : undefined,\r\n labels: options.labels ? [...options.labels] : undefined,\r\n };\r\n }\r\n}\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { Nullable, TextureSize, FrameGraphContext, IMultiRenderTargetOptions } from "../index.js";
1
+ import type { Nullable, TextureSize, FrameGraphContext } from "../index.js";
2
2
  /**
3
3
  * Represents a texture handle in the frame graph.
4
4
  */
@@ -12,16 +12,35 @@ export declare const backbufferColorTextureHandle: FrameGraphTextureHandle;
12
12
  */
13
13
  export declare const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle;
14
14
  /**
15
- * Options used to create a texture in the frame graph.
15
+ * Options used to describe a texture to be created in the frame graph.
16
+ */
17
+ export type FrameGraphTextureOptions = {
18
+ /** Specifies if mipmaps must be created for the textures (default: false) */
19
+ createMipMaps?: boolean;
20
+ /** Defines sample count (default: 1) */
21
+ samples?: number;
22
+ /** Defines the types of the textures */
23
+ types?: number[];
24
+ /** Defines the format of the textures (RED, RG, RGB, RGBA, ALPHA...) */
25
+ formats?: number[];
26
+ /** Defines if sRGB format should be used for each of texture */
27
+ useSRGBBuffers?: boolean[];
28
+ /** Defines the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) */
29
+ creationFlags?: number[];
30
+ /** Defines the names of the textures (used for debugging purpose) */
31
+ labels?: string[];
32
+ };
33
+ /**
34
+ * Options used to create a texture / list of textures in the frame graph.
16
35
  */
17
36
  export type FrameGraphTextureCreationOptions = {
18
- /** Size of the texture. If sizeIsPercentage is true, these are percentages relative to the screen size */
37
+ /** Size of the textures. If sizeIsPercentage is true, these are percentages relative to the screen size (100 = 100%) */
19
38
  size: TextureSize;
20
- /** Options used to create the (multi) render target texture */
21
- options: IMultiRenderTargetOptions;
39
+ /** Options used to create the textures */
40
+ options: FrameGraphTextureOptions;
22
41
  /** If true, indicates that "size" is percentages relative to the screen size */
23
42
  sizeIsPercentage: boolean;
24
- /** Indicates that the texture is a history texture */
43
+ /** Indicates that the texture is a history texture (default: false) */
25
44
  isHistoryTexture?: boolean;
26
45
  };
27
46
  /**
@@ -29,17 +48,13 @@ export type FrameGraphTextureCreationOptions = {
29
48
  * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.
30
49
  */
31
50
  export type FrameGraphTextureDescription = {
32
- /**
33
- * Size of the texture.
34
- */
51
+ /** Size of the texture */
35
52
  size: {
36
53
  width: number;
37
54
  height: number;
38
55
  };
39
- /**
40
- * Options used when the (multi) render target texture had been created.
41
- */
42
- options: IMultiRenderTargetOptions;
56
+ /** Options used to create the texture */
57
+ options: FrameGraphTextureOptions;
43
58
  };
44
59
  /**
45
60
  * Defines a pass in the frame graph.
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTypes.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA4B,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAA4B,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, TextureSize, FrameGraphContext, IMultiRenderTargetOptions } from \"core/index\";\r\n\r\n/**\r\n * Represents a texture handle in the frame graph.\r\n */\r\nexport type FrameGraphTextureHandle = number;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer color texture.\r\n */\r\nexport const backbufferColorTextureHandle: FrameGraphTextureHandle = 0;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer depth/stencil texture.\r\n */\r\nexport const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle = 1;\r\n\r\n/**\r\n * Options used to create a texture in the frame graph.\r\n */\r\nexport type FrameGraphTextureCreationOptions = {\r\n /** Size of the texture. If sizeIsPercentage is true, these are percentages relative to the screen size */\r\n size: TextureSize;\r\n\r\n /** Options used to create the (multi) render target texture */\r\n options: IMultiRenderTargetOptions;\r\n\r\n /** If true, indicates that \"size\" is percentages relative to the screen size */\r\n sizeIsPercentage: boolean;\r\n\r\n /** Indicates that the texture is a history texture */\r\n isHistoryTexture?: boolean;\r\n};\r\n\r\n/**\r\n * Represents a texture description in the frame graph.\r\n * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.\r\n */\r\nexport type FrameGraphTextureDescription = {\r\n /**\r\n * Size of the texture.\r\n */\r\n size: { width: number; height: number };\r\n\r\n /**\r\n * Options used when the (multi) render target texture had been created.\r\n */\r\n options: IMultiRenderTargetOptions;\r\n};\r\n\r\n/**\r\n * Defines a pass in the frame graph.\r\n */\r\nexport interface IFrameGraphPass {\r\n /**\r\n * The name of the pass.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Sets the function to execute when the pass is executed\r\n * @param func The function to execute when the pass is executed\r\n */\r\n setExecuteFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /** @internal */\r\n _execute(): void;\r\n\r\n /** @internal */\r\n _isValid(): Nullable<string>;\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTypes.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA4B,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAA4B,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, TextureSize, FrameGraphContext } from \"core/index\";\r\n\r\n/**\r\n * Represents a texture handle in the frame graph.\r\n */\r\nexport type FrameGraphTextureHandle = number;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer color texture.\r\n */\r\nexport const backbufferColorTextureHandle: FrameGraphTextureHandle = 0;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer depth/stencil texture.\r\n */\r\nexport const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle = 1;\r\n\r\n/**\r\n * Options used to describe a texture to be created in the frame graph.\r\n */\r\nexport type FrameGraphTextureOptions = {\r\n /** Specifies if mipmaps must be created for the textures (default: false) */\r\n createMipMaps?: boolean;\r\n\r\n /** Defines sample count (default: 1) */\r\n samples?: number;\r\n\r\n /** Defines the types of the textures */\r\n types?: number[];\r\n\r\n /** Defines the format of the textures (RED, RG, RGB, RGBA, ALPHA...) */\r\n formats?: number[];\r\n\r\n /** Defines if sRGB format should be used for each of texture */\r\n useSRGBBuffers?: boolean[];\r\n\r\n /** Defines the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) */\r\n creationFlags?: number[];\r\n\r\n /** Defines the names of the textures (used for debugging purpose) */\r\n labels?: string[];\r\n};\r\n\r\n/**\r\n * Options used to create a texture / list of textures in the frame graph.\r\n */\r\nexport type FrameGraphTextureCreationOptions = {\r\n /** Size of the textures. If sizeIsPercentage is true, these are percentages relative to the screen size (100 = 100%) */\r\n size: TextureSize;\r\n\r\n /** Options used to create the textures */\r\n options: FrameGraphTextureOptions;\r\n\r\n /** If true, indicates that \"size\" is percentages relative to the screen size */\r\n sizeIsPercentage: boolean;\r\n\r\n /** Indicates that the texture is a history texture (default: false) */\r\n isHistoryTexture?: boolean;\r\n};\r\n\r\n/**\r\n * Represents a texture description in the frame graph.\r\n * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.\r\n */\r\nexport type FrameGraphTextureDescription = {\r\n /** Size of the texture */\r\n size: { width: number; height: number };\r\n\r\n /** Options used to create the texture */\r\n options: FrameGraphTextureOptions;\r\n};\r\n\r\n/**\r\n * Defines a pass in the frame graph.\r\n */\r\nexport interface IFrameGraphPass {\r\n /**\r\n * The name of the pass.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Sets the function to execute when the pass is executed\r\n * @param func The function to execute when the pass is executed\r\n */\r\n setExecuteFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /** @internal */\r\n _execute(): void;\r\n\r\n /** @internal */\r\n _isValid(): Nullable<string>;\r\n}\r\n"]}
@@ -24,6 +24,7 @@ export * from "./frameGraph";
24
24
  export * from "./frameGraphContext";
25
25
  export * from "./frameGraphObjectList";
26
26
  export * from "./frameGraphRenderContext";
27
+ export * from "./frameGraphRenderTarget";
27
28
  export * from "./frameGraphTask";
28
29
  export * from "./frameGraphTextureManager";
29
30
  export * from "./frameGraphTypes";
@@ -25,6 +25,7 @@ export * from "./frameGraph.js";
25
25
  export * from "./frameGraphContext.js";
26
26
  export * from "./frameGraphObjectList.js";
27
27
  export * from "./frameGraphRenderContext.js";
28
+ export * from "./frameGraphRenderTarget.js";
28
29
  export * from "./frameGraphTask.js";
29
30
  export * from "./frameGraphTextureManager.js";
30
31
  export * from "./frameGraphTypes.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AAEtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAElD,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AAExD,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./Node/nodeRenderGraph\";\r\nexport * from \"./Node/nodeRenderGraphBlock\";\r\nexport * from \"./Node/nodeRenderGraphBlockConnectionPoint\";\r\nexport * from \"./Node/nodeRenderGraphBuildState\";\r\nexport * from \"./Node/Types/nodeRenderGraphTypes\";\r\nexport * from \"./Node/Blocks/index\";\r\n\r\nexport * from \"./Passes/pass\";\r\nexport * from \"./Passes/renderPass\";\r\n\r\nexport * from \"./Tasks/PostProcesses/blackAndWhiteTask\";\r\nexport * from \"./Tasks/PostProcesses/bloomTask\";\r\nexport * from \"./Tasks/PostProcesses/blurTask\";\r\nexport * from \"./Tasks/PostProcesses/circleOfConfusionTask\";\r\nexport * from \"./Tasks/PostProcesses/depthOfFieldTask\";\r\nexport * from \"./Tasks/PostProcesses/extractHighlightsTask\";\r\nexport * from \"./Tasks/PostProcesses/postProcessTask\";\r\n\r\nexport * from \"./Tasks/Texture/clearTextureTask\";\r\nexport * from \"./Tasks/Texture/copyToBackbufferColorTask\";\r\nexport * from \"./Tasks/Texture/copyToTextureTask\";\r\n\r\nexport * from \"./Tasks/Rendering/cullObjectsTask\";\r\nexport * from \"./Tasks/Rendering/geometryRendererTask\";\r\nexport * from \"./Tasks/Rendering/objectRendererTask\";\r\nexport * from \"./Tasks/Rendering/taaObjectRendererTask\";\r\n\r\nexport * from \"./frameGraph\";\r\nexport * from \"./frameGraphContext\";\r\nexport * from \"./frameGraphObjectList\";\r\nexport * from \"./frameGraphRenderContext\";\r\nexport * from \"./frameGraphTask\";\r\nexport * from \"./frameGraphTextureManager\";\r\nexport * from \"./frameGraphTypes\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AAEtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAElD,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AAExD,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./Node/nodeRenderGraph\";\r\nexport * from \"./Node/nodeRenderGraphBlock\";\r\nexport * from \"./Node/nodeRenderGraphBlockConnectionPoint\";\r\nexport * from \"./Node/nodeRenderGraphBuildState\";\r\nexport * from \"./Node/Types/nodeRenderGraphTypes\";\r\nexport * from \"./Node/Blocks/index\";\r\n\r\nexport * from \"./Passes/pass\";\r\nexport * from \"./Passes/renderPass\";\r\n\r\nexport * from \"./Tasks/PostProcesses/blackAndWhiteTask\";\r\nexport * from \"./Tasks/PostProcesses/bloomTask\";\r\nexport * from \"./Tasks/PostProcesses/blurTask\";\r\nexport * from \"./Tasks/PostProcesses/circleOfConfusionTask\";\r\nexport * from \"./Tasks/PostProcesses/depthOfFieldTask\";\r\nexport * from \"./Tasks/PostProcesses/extractHighlightsTask\";\r\nexport * from \"./Tasks/PostProcesses/postProcessTask\";\r\n\r\nexport * from \"./Tasks/Texture/clearTextureTask\";\r\nexport * from \"./Tasks/Texture/copyToBackbufferColorTask\";\r\nexport * from \"./Tasks/Texture/copyToTextureTask\";\r\n\r\nexport * from \"./Tasks/Rendering/cullObjectsTask\";\r\nexport * from \"./Tasks/Rendering/geometryRendererTask\";\r\nexport * from \"./Tasks/Rendering/objectRendererTask\";\r\nexport * from \"./Tasks/Rendering/taaObjectRendererTask\";\r\n\r\nexport * from \"./frameGraph\";\r\nexport * from \"./frameGraphContext\";\r\nexport * from \"./frameGraphObjectList\";\r\nexport * from \"./frameGraphRenderContext\";\r\nexport * from \"./frameGraphRenderTarget\";\r\nexport * from \"./frameGraphTask\";\r\nexport * from \"./frameGraphTextureManager\";\r\nexport * from \"./frameGraphTypes\";\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"environmentHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Helpers/environmentHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,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AG,OAAO,CAAC,WAAW,CAAC;QAC1D,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,KAAK,CAAC;QACvC,IAAI,CAAC,eAAe,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC;IACjE,CAAC;IAMD;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;;AAzgBD;;GAEG;AACY,sCAAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,sCAAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,2CAAyB,GAAG,mEAAmE,AAAtE,CAAuE","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { MirrorTexture } from \"../Materials/Textures/mirrorTexture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { BackgroundMaterial } from \"../Materials/Background/backgroundMaterial\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\n\r\n/**\r\n * Represents the different options available during the creation of\r\n * a Environment helper.\r\n *\r\n * This can control the default ground, skybox and image processing setup of your scene.\r\n */\r\nexport interface IEnvironmentHelperOptions {\r\n /**\r\n * Specifies whether or not to create a ground.\r\n * True by default.\r\n */\r\n createGround: boolean;\r\n /**\r\n * Specifies the ground size.\r\n * 15 by default.\r\n */\r\n groundSize: number;\r\n /**\r\n * The texture used on the ground for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n groundTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the ground texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n groundColor: Color3;\r\n /**\r\n * Specifies the ground opacity.\r\n * 1 by default.\r\n */\r\n groundOpacity: number;\r\n /**\r\n * Enables the ground to receive shadows.\r\n * True by default.\r\n */\r\n enableGroundShadow: boolean;\r\n /**\r\n * Helps preventing the shadow to be fully black on the ground.\r\n * 0.5 by default.\r\n */\r\n groundShadowLevel: number;\r\n /**\r\n * Creates a mirror texture attach to the ground.\r\n * false by default.\r\n */\r\n enableGroundMirror: boolean;\r\n /**\r\n * Specifies the ground mirror size ratio.\r\n * 0.3 by default as the default kernel is 64.\r\n */\r\n groundMirrorSizeRatio: number;\r\n /**\r\n * Specifies the ground mirror blur kernel size.\r\n * 64 by default.\r\n */\r\n groundMirrorBlurKernel: number;\r\n /**\r\n * Specifies the ground mirror visibility amount.\r\n * 1 by default\r\n */\r\n groundMirrorAmount: number;\r\n /**\r\n * Specifies the ground mirror reflectance weight.\r\n * This uses the standard weight of the background material to setup the fresnel effect\r\n * of the mirror.\r\n * 1 by default.\r\n */\r\n groundMirrorFresnelWeight: number;\r\n /**\r\n * Specifies the ground mirror Falloff distance.\r\n * This can helps reducing the size of the reflection.\r\n * 0 by Default.\r\n */\r\n groundMirrorFallOffDistance: number;\r\n /**\r\n * Specifies the ground mirror texture type.\r\n * Unsigned Int by Default.\r\n */\r\n groundMirrorTextureType: number;\r\n /**\r\n * Specifies a bias applied to the ground vertical position to prevent z-fighting with\r\n * the shown objects.\r\n */\r\n groundYBias: number;\r\n\r\n /**\r\n * Specifies whether or not to create a skybox.\r\n * True by default.\r\n */\r\n createSkybox: boolean;\r\n /**\r\n * Specifies the skybox size.\r\n * 20 by default.\r\n */\r\n skyboxSize: number;\r\n /**\r\n * The texture used on the skybox for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n skyboxTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the skybox texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n skyboxColor: Color3;\r\n\r\n /**\r\n * The background rotation around the Y axis of the scene.\r\n * This helps aligning the key lights of your scene with the background.\r\n * 0 by default.\r\n */\r\n backgroundYRotation: number;\r\n\r\n /**\r\n * Compute automatically the size of the elements to best fit with the scene.\r\n */\r\n sizeAuto: boolean;\r\n\r\n /**\r\n * Default position of the rootMesh if autoSize is not true.\r\n */\r\n rootPosition: Vector3;\r\n\r\n /**\r\n * Sets up the image processing in the scene.\r\n * true by default.\r\n */\r\n setupImageProcessing: boolean;\r\n\r\n /**\r\n * The texture used as your environment texture in the scene.\r\n * Comes from the BabylonJS CDN by default and in use if setupImageProcessing is true.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n environmentTexture: string | BaseTexture;\r\n\r\n /**\r\n * The value of the exposure to apply to the scene.\r\n * 0.6 by default if setupImageProcessing is true.\r\n */\r\n cameraExposure: number;\r\n\r\n /**\r\n * The value of the contrast to apply to the scene.\r\n * 1.6 by default if setupImageProcessing is true.\r\n */\r\n cameraContrast: number;\r\n\r\n /**\r\n * Specifies whether or not tonemapping should be enabled in the scene.\r\n * true by default if setupImageProcessing is true.\r\n */\r\n toneMappingEnabled: boolean;\r\n}\r\n\r\ninterface ISceneSize {\r\n groundSize: number;\r\n skyboxSize: number;\r\n rootPosition: Vector3;\r\n}\r\n\r\n/**\r\n * The EnvironmentHelper class can be used to add a fully featured non-expensive background to your scene.\r\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\r\n * It also helps with the default setup of your ImageProcessingConfiguration.\r\n */\r\nexport class EnvironmentHelper {\r\n /**\r\n * Default ground texture URL.\r\n */\r\n private static _GroundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\r\n\r\n /**\r\n * Default skybox texture URL.\r\n */\r\n private static _SkyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\r\n\r\n /**\r\n * Default environment texture URL.\r\n */\r\n private static _EnvironmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\r\n\r\n /**\r\n * Creates the default options for the helper.\r\n * @param scene The scene the environment helper belongs to.\r\n * @returns default options for the helper.\r\n */\r\n private static _GetDefaultOptions(scene: Scene): IEnvironmentHelperOptions {\r\n return {\r\n createGround: true,\r\n groundSize: 15,\r\n groundTexture: this._GroundTextureCDNUrl,\r\n groundColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n groundOpacity: 0.9,\r\n enableGroundShadow: true,\r\n groundShadowLevel: 0.5,\r\n\r\n enableGroundMirror: false,\r\n groundMirrorSizeRatio: 0.3,\r\n groundMirrorBlurKernel: 64,\r\n groundMirrorAmount: 1,\r\n groundMirrorFresnelWeight: 1,\r\n groundMirrorFallOffDistance: 0,\r\n groundMirrorTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n\r\n groundYBias: 0.00001,\r\n\r\n createSkybox: true,\r\n skyboxSize: 20,\r\n skyboxTexture: this._SkyboxTextureCDNUrl,\r\n skyboxColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n\r\n backgroundYRotation: 0,\r\n sizeAuto: true,\r\n rootPosition: Vector3.Zero(),\r\n\r\n setupImageProcessing: true,\r\n environmentTexture: this._EnvironmentTextureCDNUrl,\r\n cameraExposure: 0.8,\r\n cameraContrast: 1.2,\r\n toneMappingEnabled: true,\r\n };\r\n }\r\n\r\n private _rootMesh: Mesh;\r\n /**\r\n * Gets the root mesh created by the helper.\r\n */\r\n public get rootMesh(): Mesh {\r\n return this._rootMesh;\r\n }\r\n\r\n private _skybox: Nullable<Mesh>;\r\n /**\r\n * Gets the skybox created by the helper.\r\n */\r\n public get skybox(): Nullable<Mesh> {\r\n return this._skybox;\r\n }\r\n\r\n private _skyboxTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the skybox texture created by the helper.\r\n */\r\n public get skyboxTexture(): Nullable<BaseTexture> {\r\n return this._skyboxTexture;\r\n }\r\n\r\n private _skyboxMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the skybox material created by the helper.\r\n */\r\n public get skyboxMaterial(): Nullable<BackgroundMaterial> {\r\n return this._skyboxMaterial;\r\n }\r\n\r\n private _ground: Nullable<Mesh>;\r\n /**\r\n * Gets the ground mesh created by the helper.\r\n */\r\n public get ground(): Nullable<Mesh> {\r\n return this._ground;\r\n }\r\n\r\n private _groundTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the ground texture created by the helper.\r\n */\r\n public get groundTexture(): Nullable<BaseTexture> {\r\n return this._groundTexture;\r\n }\r\n\r\n private _groundMirror: Nullable<MirrorTexture>;\r\n /**\r\n * Gets the ground mirror created by the helper.\r\n */\r\n public get groundMirror(): Nullable<MirrorTexture> {\r\n return this._groundMirror;\r\n }\r\n\r\n /**\r\n * Gets the ground mirror render list to helps pushing the meshes\r\n * you wish in the ground reflection.\r\n */\r\n public get groundMirrorRenderList(): Nullable<AbstractMesh[]> {\r\n if (this._groundMirror) {\r\n return this._groundMirror.renderList;\r\n }\r\n return null;\r\n }\r\n\r\n private _groundMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the ground material created by the helper.\r\n */\r\n public get groundMaterial(): Nullable<BackgroundMaterial> {\r\n return this._groundMaterial;\r\n }\r\n\r\n /**\r\n * Stores the creation options.\r\n */\r\n private readonly _scene: Scene;\r\n private _options: IEnvironmentHelperOptions;\r\n\r\n /**\r\n * This observable will be notified with any error during the creation of the environment,\r\n * mainly texture creation errors.\r\n */\r\n public onErrorObservable: Observable<{ message?: string; exception?: any }>;\r\n\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(options: Partial<IEnvironmentHelperOptions>, scene: Scene) {\r\n this._options = {\r\n ...EnvironmentHelper._GetDefaultOptions(scene),\r\n ...options,\r\n };\r\n this._scene = scene;\r\n this.onErrorObservable = new Observable();\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Updates the environment according to the new options\r\n * @param options options to configure the helper (IEnvironmentHelperOptions)\r\n */\r\n public updateOptions(options: Partial<IEnvironmentHelperOptions>) {\r\n const newOptions = {\r\n ...this._options,\r\n ...options,\r\n };\r\n\r\n if (this._ground && !newOptions.createGround) {\r\n this._ground.dispose();\r\n this._ground = null;\r\n }\r\n\r\n if (this._groundMaterial && !newOptions.createGround) {\r\n this._groundMaterial.dispose();\r\n this._groundMaterial = null;\r\n }\r\n\r\n if (this._groundTexture) {\r\n if (this._options.groundTexture != newOptions.groundTexture) {\r\n this._groundTexture.dispose();\r\n this._groundTexture = null;\r\n }\r\n }\r\n\r\n if (this._skybox && !newOptions.createSkybox) {\r\n this._skybox.dispose();\r\n this._skybox = null;\r\n }\r\n\r\n if (this._skyboxMaterial && !newOptions.createSkybox) {\r\n this._skyboxMaterial.dispose();\r\n this._skyboxMaterial = null;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\r\n this._skyboxTexture.dispose();\r\n this._skyboxTexture = null;\r\n }\r\n }\r\n\r\n if (this._groundMirror && !newOptions.enableGroundMirror) {\r\n this._groundMirror.dispose();\r\n this._groundMirror = null;\r\n }\r\n\r\n if (this._scene.environmentTexture) {\r\n if (this._options.environmentTexture != newOptions.environmentTexture) {\r\n this._scene.environmentTexture.dispose();\r\n }\r\n }\r\n\r\n this._options = newOptions;\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Sets the primary color of all the available elements.\r\n * @param color the main color to affect to the ground and the background\r\n */\r\n public setMainColor(color: Color3): void {\r\n if (this.groundMaterial) {\r\n this.groundMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.skyboxMaterial) {\r\n this.skyboxMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.groundMirror) {\r\n this.groundMirror.clearColor = new Color4(color.r, color.g, color.b, 1.0);\r\n }\r\n }\r\n\r\n /**\r\n * Setup the image processing according to the specified options.\r\n */\r\n private _setupImageProcessing(): void {\r\n if (this._options.setupImageProcessing) {\r\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\r\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\r\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\r\n this._setupEnvironmentTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Setup the environment texture according to the specified options.\r\n */\r\n private _setupEnvironmentTexture(): void {\r\n if (this._scene.environmentTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.environmentTexture instanceof BaseTexture) {\r\n this._scene.environmentTexture = this._options.environmentTexture;\r\n return;\r\n }\r\n\r\n const environmentTexture = CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\r\n this._scene.environmentTexture = environmentTexture;\r\n }\r\n\r\n /**\r\n * Setup the background according to the specified options.\r\n */\r\n private _setupBackground(): void {\r\n if (!this._rootMesh) {\r\n this._rootMesh = new Mesh(\"BackgroundHelper\", this._scene);\r\n }\r\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\r\n\r\n const sceneSize = this._getSceneSize();\r\n if (this._options.createGround) {\r\n this._setupGround(sceneSize);\r\n this._setupGroundMaterial();\r\n this._setupGroundDiffuseTexture();\r\n\r\n if (this._options.enableGroundMirror) {\r\n this._setupGroundMirrorTexture(sceneSize);\r\n }\r\n this._setupMirrorInGroundMaterial();\r\n }\r\n\r\n if (this._options.createSkybox) {\r\n this._setupSkybox(sceneSize);\r\n this._setupSkyboxMaterial();\r\n this._setupSkyboxReflectionTexture();\r\n }\r\n\r\n this._rootMesh.position.x = sceneSize.rootPosition.x;\r\n this._rootMesh.position.z = sceneSize.rootPosition.z;\r\n this._rootMesh.position.y = sceneSize.rootPosition.y;\r\n }\r\n\r\n /**\r\n * Get the scene sizes according to the setup.\r\n * @returns the different ground and skybox sizes.\r\n */\r\n private _getSceneSize(): ISceneSize {\r\n let groundSize = this._options.groundSize;\r\n let skyboxSize = this._options.skyboxSize;\r\n let rootPosition = this._options.rootPosition;\r\n if (!this._scene.meshes || this._scene.meshes.length === 1) {\r\n // 1 only means the root of the helper.\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n const sceneExtends = this._scene.getWorldExtends((mesh) => {\r\n return mesh !== this._ground && mesh !== this._rootMesh && mesh !== this._skybox;\r\n });\r\n const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\r\n\r\n if (this._options.sizeAuto) {\r\n if (this._scene.activeCamera instanceof ArcRotateCamera && this._scene.activeCamera.upperRadiusLimit) {\r\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n const sceneDiagonalLenght = sceneDiagonal.length();\r\n if (sceneDiagonalLenght > groundSize) {\r\n groundSize = sceneDiagonalLenght * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n // 10 % bigger.\r\n groundSize *= 1.1;\r\n skyboxSize *= 1.5;\r\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\r\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\r\n }\r\n\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n /**\r\n * Setup the ground according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGround(sceneSize: ISceneSize): void {\r\n if (!this._ground || this._ground.isDisposed()) {\r\n this._ground = CreatePlane(\"BackgroundPlane\", { size: sceneSize.groundSize }, this._scene);\r\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\r\n this._ground.isPickable = false;\r\n this._ground.parent = this._rootMesh;\r\n this._ground.onDisposeObservable.add(() => {\r\n this._ground = null;\r\n });\r\n }\r\n\r\n this._ground.receiveShadows = this._options.enableGroundShadow;\r\n }\r\n\r\n /**\r\n * Setup the ground material according to the specified options.\r\n */\r\n private _setupGroundMaterial(): void {\r\n if (!this._groundMaterial) {\r\n this._groundMaterial = new BackgroundMaterial(\"BackgroundPlaneMaterial\", this._scene);\r\n }\r\n this._groundMaterial.alpha = this._options.groundOpacity;\r\n this._groundMaterial.alphaMode = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\r\n this._groundMaterial.primaryColor = this._options.groundColor;\r\n this._groundMaterial.useRGBColor = false;\r\n this._groundMaterial.enableNoise = true;\r\n\r\n if (this._ground) {\r\n this._ground.material = this._groundMaterial;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the ground diffuse texture according to the specified options.\r\n */\r\n private _setupGroundDiffuseTexture(): void {\r\n if (!this._groundMaterial) {\r\n return;\r\n }\r\n\r\n if (this._groundTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.groundTexture instanceof BaseTexture) {\r\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\r\n return;\r\n }\r\n\r\n this._groundTexture = new Texture(this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._groundTexture.gammaSpace = false;\r\n this._groundTexture.hasAlpha = true;\r\n this._groundMaterial.diffuseTexture = this._groundTexture;\r\n }\r\n\r\n /**\r\n * Setup the ground mirror texture according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGroundMirrorTexture(sceneSize: ISceneSize): void {\r\n const wrapping = Texture.CLAMP_ADDRESSMODE;\r\n if (!this._groundMirror) {\r\n this._groundMirror = new MirrorTexture(\r\n \"BackgroundPlaneMirrorTexture\",\r\n { ratio: this._options.groundMirrorSizeRatio },\r\n this._scene,\r\n false,\r\n this._options.groundMirrorTextureType,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n true\r\n );\r\n this._groundMirror.mirrorPlane = new Plane(0, -1, 0, sceneSize.rootPosition.y);\r\n this._groundMirror.anisotropicFilteringLevel = 1;\r\n this._groundMirror.wrapU = wrapping;\r\n this._groundMirror.wrapV = wrapping;\r\n\r\n if (this._groundMirror.renderList) {\r\n for (let i = 0; i < this._scene.meshes.length; i++) {\r\n const mesh = this._scene.meshes[i];\r\n if (mesh !== this._ground && mesh !== this._skybox && mesh !== this._rootMesh) {\r\n this._groundMirror.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n }\r\n\r\n const gammaGround = this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions);\r\n this._groundMirror.clearColor = new Color4(gammaGround.r, gammaGround.g, gammaGround.b, 1);\r\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\r\n }\r\n\r\n /**\r\n * Setup the ground to receive the mirror texture.\r\n */\r\n private _setupMirrorInGroundMaterial(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.reflectionTexture = this._groundMirror;\r\n this._groundMaterial.reflectionFresnel = true;\r\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\r\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\r\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the skybox according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupSkybox(sceneSize: ISceneSize): void {\r\n if (!this._skybox || this._skybox.isDisposed()) {\r\n this._skybox = CreateBox(\"BackgroundSkybox\", { size: sceneSize.skyboxSize, sideOrientation: Mesh.BACKSIDE }, this._scene);\r\n this._skybox.isPickable = false;\r\n this._skybox.onDisposeObservable.add(() => {\r\n this._skybox = null;\r\n });\r\n }\r\n this._skybox.parent = this._rootMesh;\r\n }\r\n\r\n /**\r\n * Setup the skybox material according to the specified options.\r\n */\r\n private _setupSkyboxMaterial(): void {\r\n if (!this._skybox) {\r\n return;\r\n }\r\n\r\n if (!this._skyboxMaterial) {\r\n this._skyboxMaterial = new BackgroundMaterial(\"BackgroundSkyboxMaterial\", this._scene);\r\n }\r\n this._skyboxMaterial.useRGBColor = false;\r\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\r\n this._skyboxMaterial.enableNoise = true;\r\n\r\n this._skybox.material = this._skyboxMaterial;\r\n }\r\n\r\n /**\r\n * Setup the skybox reflection texture according to the specified options.\r\n */\r\n private _setupSkyboxReflectionTexture(): void {\r\n if (!this._skyboxMaterial) {\r\n return;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.skyboxTexture instanceof BaseTexture) {\r\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\r\n return;\r\n }\r\n\r\n this._skyboxTexture = new CubeTexture(this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._skyboxTexture.coordinatesMode = Texture.SKYBOX_MODE;\r\n this._skyboxTexture.gammaSpace = false;\r\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\r\n }\r\n\r\n private _errorHandler = (message?: string, exception?: any) => {\r\n this.onErrorObservable.notifyObservers({ message: message, exception: exception });\r\n };\r\n\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n public dispose(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.dispose(true, true);\r\n }\r\n if (this._skyboxMaterial) {\r\n this._skyboxMaterial.dispose(true, true);\r\n }\r\n this._rootMesh.dispose(false);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"environm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ED,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,YAAY,WAAW,EAAE,CAAC;YACrD,IAAI,CAAC,eAAe,CAAC,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;YACrE,OAAO;QACX,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAChJ,IAAI,CAAC,cAAc,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;QAC1D,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,KAAK,CAAC;QACvC,IAAI,CAAC,eAAe,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC;IACjE,CAAC;IAMD;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;;AAzgBD;;GAEG;AACY,sCAAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,sCAAoB,GAAG,gEAAgE,AAAnE,CAAoE;AAEvG;;GAEG;AACY,2CAAyB,GAAG,mEAAmE,AAAtE,CAAuE","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { MirrorTexture } from \"../Materials/Textures/mirrorTexture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { BackgroundMaterial } from \"../Materials/Background/backgroundMaterial\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\n\r\n/**\r\n * Represents the different options available during the creation of\r\n * a Environment helper.\r\n *\r\n * This can control the default ground, skybox and image processing setup of your scene.\r\n */\r\nexport interface IEnvironmentHelperOptions {\r\n /**\r\n * Specifies whether or not to create a ground.\r\n * True by default.\r\n */\r\n createGround: boolean;\r\n /**\r\n * Specifies the ground size.\r\n * 15 by default.\r\n */\r\n groundSize: number;\r\n /**\r\n * The texture used on the ground for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n groundTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the ground texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n groundColor: Color3;\r\n /**\r\n * Specifies the ground opacity.\r\n * 1 by default.\r\n */\r\n groundOpacity: number;\r\n /**\r\n * Enables the ground to receive shadows.\r\n * True by default.\r\n */\r\n enableGroundShadow: boolean;\r\n /**\r\n * Helps preventing the shadow to be fully black on the ground.\r\n * 0.5 by default.\r\n */\r\n groundShadowLevel: number;\r\n /**\r\n * Creates a mirror texture attach to the ground.\r\n * false by default.\r\n */\r\n enableGroundMirror: boolean;\r\n /**\r\n * Specifies the ground mirror size ratio.\r\n * 0.3 by default as the default kernel is 64.\r\n */\r\n groundMirrorSizeRatio: number;\r\n /**\r\n * Specifies the ground mirror blur kernel size.\r\n * 64 by default.\r\n */\r\n groundMirrorBlurKernel: number;\r\n /**\r\n * Specifies the ground mirror visibility amount.\r\n * 1 by default\r\n */\r\n groundMirrorAmount: number;\r\n /**\r\n * Specifies the ground mirror reflectance weight.\r\n * This uses the standard weight of the background material to setup the fresnel effect\r\n * of the mirror.\r\n * 1 by default.\r\n */\r\n groundMirrorFresnelWeight: number;\r\n /**\r\n * Specifies the ground mirror Falloff distance.\r\n * This can helps reducing the size of the reflection.\r\n * 0 by Default.\r\n */\r\n groundMirrorFallOffDistance: number;\r\n /**\r\n * Specifies the ground mirror texture type.\r\n * Unsigned Int by Default.\r\n */\r\n groundMirrorTextureType: number;\r\n /**\r\n * Specifies a bias applied to the ground vertical position to prevent z-fighting with\r\n * the shown objects.\r\n */\r\n groundYBias: number;\r\n\r\n /**\r\n * Specifies whether or not to create a skybox.\r\n * True by default.\r\n */\r\n createSkybox: boolean;\r\n /**\r\n * Specifies the skybox size.\r\n * 20 by default.\r\n */\r\n skyboxSize: number;\r\n /**\r\n * The texture used on the skybox for the main color.\r\n * Comes from the BabylonJS CDN by default.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n skyboxTexture: string | BaseTexture;\r\n /**\r\n * The color mixed in the skybox texture by default.\r\n * BabylonJS clearColor by default.\r\n */\r\n skyboxColor: Color3;\r\n\r\n /**\r\n * The background rotation around the Y axis of the scene.\r\n * This helps aligning the key lights of your scene with the background.\r\n * 0 by default.\r\n */\r\n backgroundYRotation: number;\r\n\r\n /**\r\n * Compute automatically the size of the elements to best fit with the scene.\r\n */\r\n sizeAuto: boolean;\r\n\r\n /**\r\n * Default position of the rootMesh if autoSize is not true.\r\n */\r\n rootPosition: Vector3;\r\n\r\n /**\r\n * Sets up the image processing in the scene.\r\n * true by default.\r\n */\r\n setupImageProcessing: boolean;\r\n\r\n /**\r\n * The texture used as your environment texture in the scene.\r\n * Comes from the BabylonJS CDN by default and in use if setupImageProcessing is true.\r\n *\r\n * Remarks: Can be either a texture or a url.\r\n */\r\n environmentTexture: string | BaseTexture;\r\n\r\n /**\r\n * The value of the exposure to apply to the scene.\r\n * 0.6 by default if setupImageProcessing is true.\r\n */\r\n cameraExposure: number;\r\n\r\n /**\r\n * The value of the contrast to apply to the scene.\r\n * 1.6 by default if setupImageProcessing is true.\r\n */\r\n cameraContrast: number;\r\n\r\n /**\r\n * Specifies whether or not tonemapping should be enabled in the scene.\r\n * true by default if setupImageProcessing is true.\r\n */\r\n toneMappingEnabled: boolean;\r\n}\r\n\r\ninterface ISceneSize {\r\n groundSize: number;\r\n skyboxSize: number;\r\n rootPosition: Vector3;\r\n}\r\n\r\n/**\r\n * The EnvironmentHelper class can be used to add a fully featured non-expensive background to your scene.\r\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\r\n * It also helps with the default setup of your ImageProcessingConfiguration.\r\n */\r\nexport class EnvironmentHelper {\r\n /**\r\n * Default ground texture URL.\r\n */\r\n private static _GroundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\r\n\r\n /**\r\n * Default skybox texture URL.\r\n */\r\n private static _SkyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\r\n\r\n /**\r\n * Default environment texture URL.\r\n */\r\n private static _EnvironmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\r\n\r\n /**\r\n * Creates the default options for the helper.\r\n * @param scene The scene the environment helper belongs to.\r\n * @returns default options for the helper.\r\n */\r\n private static _GetDefaultOptions(scene: Scene): IEnvironmentHelperOptions {\r\n return {\r\n createGround: true,\r\n groundSize: 15,\r\n groundTexture: this._GroundTextureCDNUrl,\r\n groundColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n groundOpacity: 0.9,\r\n enableGroundShadow: true,\r\n groundShadowLevel: 0.5,\r\n\r\n enableGroundMirror: false,\r\n groundMirrorSizeRatio: 0.3,\r\n groundMirrorBlurKernel: 64,\r\n groundMirrorAmount: 1,\r\n groundMirrorFresnelWeight: 1,\r\n groundMirrorFallOffDistance: 0,\r\n groundMirrorTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n\r\n groundYBias: 0.00001,\r\n\r\n createSkybox: true,\r\n skyboxSize: 20,\r\n skyboxTexture: this._SkyboxTextureCDNUrl,\r\n skyboxColor: new Color3(0.2, 0.2, 0.3).toLinearSpace(scene.getEngine().useExactSrgbConversions).scale(3),\r\n\r\n backgroundYRotation: 0,\r\n sizeAuto: true,\r\n rootPosition: Vector3.Zero(),\r\n\r\n setupImageProcessing: true,\r\n environmentTexture: this._EnvironmentTextureCDNUrl,\r\n cameraExposure: 0.8,\r\n cameraContrast: 1.2,\r\n toneMappingEnabled: true,\r\n };\r\n }\r\n\r\n private _rootMesh: Mesh;\r\n /**\r\n * Gets the root mesh created by the helper.\r\n */\r\n public get rootMesh(): Mesh {\r\n return this._rootMesh;\r\n }\r\n\r\n private _skybox: Nullable<Mesh>;\r\n /**\r\n * Gets the skybox created by the helper.\r\n */\r\n public get skybox(): Nullable<Mesh> {\r\n return this._skybox;\r\n }\r\n\r\n private _skyboxTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the skybox texture created by the helper.\r\n */\r\n public get skyboxTexture(): Nullable<BaseTexture> {\r\n return this._skyboxTexture;\r\n }\r\n\r\n private _skyboxMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the skybox material created by the helper.\r\n */\r\n public get skyboxMaterial(): Nullable<BackgroundMaterial> {\r\n return this._skyboxMaterial;\r\n }\r\n\r\n private _ground: Nullable<Mesh>;\r\n /**\r\n * Gets the ground mesh created by the helper.\r\n */\r\n public get ground(): Nullable<Mesh> {\r\n return this._ground;\r\n }\r\n\r\n private _groundTexture: Nullable<BaseTexture>;\r\n /**\r\n * Gets the ground texture created by the helper.\r\n */\r\n public get groundTexture(): Nullable<BaseTexture> {\r\n return this._groundTexture;\r\n }\r\n\r\n private _groundMirror: Nullable<MirrorTexture>;\r\n /**\r\n * Gets the ground mirror created by the helper.\r\n */\r\n public get groundMirror(): Nullable<MirrorTexture> {\r\n return this._groundMirror;\r\n }\r\n\r\n /**\r\n * Gets the ground mirror render list to helps pushing the meshes\r\n * you wish in the ground reflection.\r\n */\r\n public get groundMirrorRenderList(): Nullable<AbstractMesh[]> {\r\n if (this._groundMirror) {\r\n return this._groundMirror.renderList;\r\n }\r\n return null;\r\n }\r\n\r\n private _groundMaterial: Nullable<BackgroundMaterial>;\r\n /**\r\n * Gets the ground material created by the helper.\r\n */\r\n public get groundMaterial(): Nullable<BackgroundMaterial> {\r\n return this._groundMaterial;\r\n }\r\n\r\n /**\r\n * Stores the creation options.\r\n */\r\n private readonly _scene: Scene;\r\n private _options: IEnvironmentHelperOptions;\r\n\r\n /**\r\n * This observable will be notified with any error during the creation of the environment,\r\n * mainly texture creation errors.\r\n */\r\n public onErrorObservable: Observable<{ message?: string; exception?: any }>;\r\n\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(options: Partial<IEnvironmentHelperOptions>, scene: Scene) {\r\n this._options = {\r\n ...EnvironmentHelper._GetDefaultOptions(scene),\r\n ...options,\r\n };\r\n this._scene = scene;\r\n this.onErrorObservable = new Observable();\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Updates the environment according to the new options\r\n * @param options options to configure the helper (IEnvironmentHelperOptions)\r\n */\r\n public updateOptions(options: Partial<IEnvironmentHelperOptions>) {\r\n const newOptions = {\r\n ...this._options,\r\n ...options,\r\n };\r\n\r\n if (this._ground && !newOptions.createGround) {\r\n this._ground.dispose();\r\n this._ground = null;\r\n }\r\n\r\n if (this._groundMaterial && !newOptions.createGround) {\r\n this._groundMaterial.dispose();\r\n this._groundMaterial = null;\r\n }\r\n\r\n if (this._groundTexture) {\r\n if (this._options.groundTexture != newOptions.groundTexture) {\r\n this._groundTexture.dispose();\r\n this._groundTexture = null;\r\n }\r\n }\r\n\r\n if (this._skybox && !newOptions.createSkybox) {\r\n this._skybox.dispose();\r\n this._skybox = null;\r\n }\r\n\r\n if (this._skyboxMaterial && !newOptions.createSkybox) {\r\n this._skyboxMaterial.dispose();\r\n this._skyboxMaterial = null;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\r\n this._skyboxTexture.dispose();\r\n this._skyboxTexture = null;\r\n }\r\n }\r\n\r\n if (this._groundMirror && !newOptions.enableGroundMirror) {\r\n this._groundMirror.dispose();\r\n this._groundMirror = null;\r\n }\r\n\r\n if (this._scene.environmentTexture) {\r\n if (this._options.environmentTexture != newOptions.environmentTexture) {\r\n this._scene.environmentTexture.dispose();\r\n }\r\n }\r\n\r\n this._options = newOptions;\r\n\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n\r\n /**\r\n * Sets the primary color of all the available elements.\r\n * @param color the main color to affect to the ground and the background\r\n */\r\n public setMainColor(color: Color3): void {\r\n if (this.groundMaterial) {\r\n this.groundMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.skyboxMaterial) {\r\n this.skyboxMaterial.primaryColor = color;\r\n }\r\n\r\n if (this.groundMirror) {\r\n this.groundMirror.clearColor = new Color4(color.r, color.g, color.b, 1.0);\r\n }\r\n }\r\n\r\n /**\r\n * Setup the image processing according to the specified options.\r\n */\r\n private _setupImageProcessing(): void {\r\n if (this._options.setupImageProcessing) {\r\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\r\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\r\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\r\n this._setupEnvironmentTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Setup the environment texture according to the specified options.\r\n */\r\n private _setupEnvironmentTexture(): void {\r\n if (this._scene.environmentTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.environmentTexture instanceof BaseTexture) {\r\n this._scene.environmentTexture = this._options.environmentTexture;\r\n return;\r\n }\r\n\r\n const environmentTexture = CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\r\n this._scene.environmentTexture = environmentTexture;\r\n }\r\n\r\n /**\r\n * Setup the background according to the specified options.\r\n */\r\n private _setupBackground(): void {\r\n if (!this._rootMesh) {\r\n this._rootMesh = new Mesh(\"BackgroundHelper\", this._scene);\r\n }\r\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\r\n\r\n const sceneSize = this._getSceneSize();\r\n if (this._options.createGround) {\r\n this._setupGround(sceneSize);\r\n this._setupGroundMaterial();\r\n this._setupGroundDiffuseTexture();\r\n\r\n if (this._options.enableGroundMirror) {\r\n this._setupGroundMirrorTexture(sceneSize);\r\n }\r\n this._setupMirrorInGroundMaterial();\r\n }\r\n\r\n if (this._options.createSkybox) {\r\n this._setupSkybox(sceneSize);\r\n this._setupSkyboxMaterial();\r\n this._setupSkyboxReflectionTexture();\r\n }\r\n\r\n this._rootMesh.position.x = sceneSize.rootPosition.x;\r\n this._rootMesh.position.z = sceneSize.rootPosition.z;\r\n this._rootMesh.position.y = sceneSize.rootPosition.y;\r\n }\r\n\r\n /**\r\n * Get the scene sizes according to the setup.\r\n * @returns the different ground and skybox sizes.\r\n */\r\n private _getSceneSize(): ISceneSize {\r\n let groundSize = this._options.groundSize;\r\n let skyboxSize = this._options.skyboxSize;\r\n let rootPosition = this._options.rootPosition;\r\n if (!this._scene.meshes || this._scene.meshes.length === 1) {\r\n // 1 only means the root of the helper.\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n const sceneExtends = this._scene.getWorldExtends((mesh) => {\r\n return mesh !== this._ground && mesh !== this._rootMesh && mesh !== this._skybox;\r\n });\r\n const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\r\n\r\n if (this._options.sizeAuto) {\r\n if (this._scene.activeCamera instanceof ArcRotateCamera && this._scene.activeCamera.upperRadiusLimit) {\r\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n const sceneDiagonalLenght = sceneDiagonal.length();\r\n if (sceneDiagonalLenght > groundSize) {\r\n groundSize = sceneDiagonalLenght * 2;\r\n skyboxSize = groundSize;\r\n }\r\n\r\n // 10 % bigger.\r\n groundSize *= 1.1;\r\n skyboxSize *= 1.5;\r\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\r\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\r\n }\r\n\r\n return { groundSize, skyboxSize, rootPosition };\r\n }\r\n\r\n /**\r\n * Setup the ground according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGround(sceneSize: ISceneSize): void {\r\n if (!this._ground || this._ground.isDisposed()) {\r\n this._ground = CreatePlane(\"BackgroundPlane\", { size: sceneSize.groundSize }, this._scene);\r\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\r\n this._ground.isPickable = false;\r\n this._ground.parent = this._rootMesh;\r\n this._ground.onDisposeObservable.add(() => {\r\n this._ground = null;\r\n });\r\n }\r\n\r\n this._ground.receiveShadows = this._options.enableGroundShadow;\r\n }\r\n\r\n /**\r\n * Setup the ground material according to the specified options.\r\n */\r\n private _setupGroundMaterial(): void {\r\n if (!this._groundMaterial) {\r\n this._groundMaterial = new BackgroundMaterial(\"BackgroundPlaneMaterial\", this._scene);\r\n }\r\n this._groundMaterial.alpha = this._options.groundOpacity;\r\n this._groundMaterial.alphaMode = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\r\n this._groundMaterial.primaryColor = this._options.groundColor;\r\n this._groundMaterial.useRGBColor = false;\r\n this._groundMaterial.enableNoise = true;\r\n\r\n if (this._ground) {\r\n this._ground.material = this._groundMaterial;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the ground diffuse texture according to the specified options.\r\n */\r\n private _setupGroundDiffuseTexture(): void {\r\n if (!this._groundMaterial) {\r\n return;\r\n }\r\n\r\n if (this._groundTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.groundTexture instanceof BaseTexture) {\r\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\r\n return;\r\n }\r\n\r\n this._groundTexture = new Texture(this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._groundTexture.gammaSpace = false;\r\n this._groundTexture.hasAlpha = true;\r\n this._groundMaterial.diffuseTexture = this._groundTexture;\r\n }\r\n\r\n /**\r\n * Setup the ground mirror texture according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupGroundMirrorTexture(sceneSize: ISceneSize): void {\r\n const wrapping = Texture.CLAMP_ADDRESSMODE;\r\n if (!this._groundMirror) {\r\n this._groundMirror = new MirrorTexture(\r\n \"BackgroundPlaneMirrorTexture\",\r\n { ratio: this._options.groundMirrorSizeRatio },\r\n this._scene,\r\n false,\r\n this._options.groundMirrorTextureType,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n true\r\n );\r\n this._groundMirror.mirrorPlane = new Plane(0, -1, 0, sceneSize.rootPosition.y);\r\n this._groundMirror.anisotropicFilteringLevel = 1;\r\n this._groundMirror.wrapU = wrapping;\r\n this._groundMirror.wrapV = wrapping;\r\n\r\n if (this._groundMirror.renderList) {\r\n for (let i = 0; i < this._scene.meshes.length; i++) {\r\n const mesh = this._scene.meshes[i];\r\n if (mesh !== this._ground && mesh !== this._skybox && mesh !== this._rootMesh) {\r\n this._groundMirror.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n }\r\n\r\n const gammaGround = this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions);\r\n this._groundMirror.clearColor = new Color4(gammaGround.r, gammaGround.g, gammaGround.b, 1);\r\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\r\n }\r\n\r\n /**\r\n * Setup the ground to receive the mirror texture.\r\n */\r\n private _setupMirrorInGroundMaterial(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.reflectionTexture = this._groundMirror;\r\n this._groundMaterial.reflectionFresnel = true;\r\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\r\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\r\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\r\n }\r\n }\r\n\r\n /**\r\n * Setup the skybox according to the specified options.\r\n * @param sceneSize\r\n */\r\n private _setupSkybox(sceneSize: ISceneSize): void {\r\n if (!this._skybox || this._skybox.isDisposed()) {\r\n this._skybox = CreateBox(\"BackgroundSkybox\", { size: sceneSize.skyboxSize, sideOrientation: Mesh.BACKSIDE }, this._scene);\r\n this._skybox.isPickable = false;\r\n this._skybox.onDisposeObservable.add(() => {\r\n this._skybox = null;\r\n });\r\n }\r\n this._skybox.parent = this._rootMesh;\r\n }\r\n\r\n /**\r\n * Setup the skybox material according to the specified options.\r\n */\r\n private _setupSkyboxMaterial(): void {\r\n if (!this._skybox) {\r\n return;\r\n }\r\n\r\n if (!this._skyboxMaterial) {\r\n this._skyboxMaterial = new BackgroundMaterial(\"BackgroundSkyboxMaterial\", this._scene);\r\n }\r\n this._skyboxMaterial.useRGBColor = false;\r\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\r\n this._skyboxMaterial.enableNoise = true;\r\n\r\n this._skybox.material = this._skyboxMaterial;\r\n }\r\n\r\n /**\r\n * Setup the skybox reflection texture according to the specified options.\r\n */\r\n private _setupSkyboxReflectionTexture(): void {\r\n if (!this._skyboxMaterial) {\r\n return;\r\n }\r\n\r\n if (this._skyboxTexture) {\r\n return;\r\n }\r\n\r\n if (this._options.skyboxTexture instanceof BaseTexture) {\r\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\r\n return;\r\n }\r\n\r\n this._skyboxTexture = new CubeTexture(this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._skyboxTexture.coordinatesMode = Texture.SKYBOX_MODE;\r\n this._skyboxTexture.gammaSpace = false;\r\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\r\n }\r\n\r\n private _errorHandler = (message?: string, exception?: any) => {\r\n this.onErrorObservable.notifyObservers({ message: message, exception: exception });\r\n };\r\n\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n public dispose(): void {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.dispose(true, true);\r\n }\r\n if (this._skyboxMaterial) {\r\n this._skyboxMaterial.dispose(true, true);\r\n }\r\n this._rootMesh.dispose(false);\r\n }\r\n}\r\n"]}
@@ -41,7 +41,7 @@ export interface IEffectLayerOptions {
41
41
  */
42
42
  renderingGroupId: number;
43
43
  /**
44
- * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_INT
44
+ * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE
45
45
  */
46
46
  mainTextureType: number;
47
47
  /**