@babylonjs/core 7.36.0 → 7.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/arcRotateCamera.d.ts +3 -1
- package/Cameras/arcRotateCamera.js +14 -3
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.d.ts +8 -8
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +9 -9
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +6 -0
- package/Engines/WebGPU/webgpuConstants.js +6 -0
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +18 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +6 -0
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +1 -1
- package/Engines/abstractEngine.js +4 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +17 -1
- package/Engines/constants.js +17 -1
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +31 -1
- package/Engines/engine.js +17 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +2 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -2
- package/Engines/nullEngine.js +3 -2
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.functions.d.ts +4 -0
- package/Engines/thinEngine.functions.js +17 -0
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +39 -9
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +1 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +5 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +21 -5
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +52 -176
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +158 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +177 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/matrixSplitterBlock.d.ts +56 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js +130 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js.map +1 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +12 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.d.ts +2 -2
- package/Materials/Textures/rawCubeTexture.js +2 -2
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.d.ts +1 -1
- package/Materials/Textures/rawTexture2DArray.js +1 -1
- package/Materials/Textures/rawTexture2DArray.js.map +1 -1
- package/Materials/Textures/rawTexture3D.d.ts +1 -1
- package/Materials/Textures/rawTexture3D.js +1 -1
- package/Materials/Textures/rawTexture3D.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/drawWrapper.d.ts +6 -1
- package/Materials/drawWrapper.js +18 -2
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +6 -1
- package/Materials/effect.functions.d.ts +5 -0
- package/Materials/effect.functions.js +19 -0
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +22 -20
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +12 -4
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Materials/effectRenderer.js +1 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Maths/math.scalar.d.ts +0 -1
- package/Maths/math.scalar.js +1 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +2 -2
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +17 -3
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +69 -20
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +5 -3
- package/Meshes/abstractMesh.hotSpot.d.ts +8 -1
- package/Meshes/abstractMesh.hotSpot.js +17 -0
- package/Meshes/abstractMesh.hotSpot.js.map +1 -1
- package/Meshes/abstractMesh.js +9 -7
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/linesMesh.js +1 -1
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +5 -3
- package/Meshes/subMesh.js +9 -7
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/dds.d.ts +1 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/observable.d.ts +1 -3
- package/Misc/observable.js +7 -7
- package/Misc/observable.js.map +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +3 -0
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/textureTools.js.map +1 -1
- package/Misc/virtualJoystick.js +2 -0
- package/Misc/virtualJoystick.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/highlightsPostProcess.d.ts +1 -1
- package/PostProcesses/highlightsPostProcess.js +1 -1
- package/PostProcesses/highlightsPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +1 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -1
- package/PostProcesses/tonemapPostProcess.js +1 -1
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +3 -23
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +30 -67
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +8 -4
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.d.ts → iblCdfGenerator.d.ts} +15 -12
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.js → iblCdfGenerator.js} +37 -27
- package/Rendering/iblCdfGenerator.js.map +1 -0
- package/Rendering/iblCdfGeneratorSceneComponent.d.ts +59 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js +83 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -0
- package/Rendering/index.d.ts +12 -10
- package/Rendering/index.js +12 -10
- package/Rendering/index.js.map +1 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +72 -2
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -4
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +16 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.d.ts → iblCdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/Shaders/iblCdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsCdfx.fragment.d.ts → iblCdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/Shaders/iblCdfy.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfx.fragment.d.ts → iblIcdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/Shaders/iblIcdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfy.fragment.d.ts → iblIcdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/Shaders/iblIcdfy.fragment.js.map +1 -0
- package/Shaders/importanceSamplingDebug.fragment.d.ts +5 -0
- package/Shaders/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/Shaders/importanceSamplingDebug.fragment.js.map +1 -0
- package/Shaders/pbr.fragment.js +8 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +77 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -4
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +18 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/iblCdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblCdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfy.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfy.fragment.js.map +1 -0
- package/ShadersWGSL/importanceSamplingDebug.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/ShadersWGSL/importanceSamplingDebug.fragment.js.map +1 -0
- package/ShadersWGSL/pbr.fragment.js +12 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +4 -0
- package/scene.js +6 -0
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js +1 -1
- package/sceneComponent.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +0 -1
- package/Shaders/iblShadowsCdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsCdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirrorTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/mirrorTexture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,mBAAmB;IAQlD;;OAEG;IACH,IAAW,SAAS,CAAC,KAAa;QAC9B,IAAI,IAAI,CA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AAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAE7D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,IAAI,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC5G,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACJ;AAED,OAAO,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,gBAAwB,EAAE,KAAY,EAAE,eAAwB,EAAiB,EAAE;IACtH,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAC7E,CAAC,CAAC","sourcesContent":["import type { Observer } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport { BlurPostProcess } from \"../../PostProcesses/blurPostProcess\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Plane } from \"../../Maths/math.plane\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\n/**\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#mirrortexture\r\n */\r\nexport class MirrorTexture extends RenderTargetTexture {\r\n /**\r\n * Define the reflection plane we want to use. The mirrorPlane is usually set to the constructed reflector.\r\n * It is possible to directly set the mirrorPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the mirrorPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the reflector as stated in the doc.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#mirrors\r\n */\r\n public mirrorPlane = new Plane(0, 1, 0, 1);\r\n\r\n /**\r\n * Define the blur ratio used to blur the reflection if needed.\r\n */\r\n public set blurRatio(value: number) {\r\n if (this._blurRatio === value) {\r\n return;\r\n }\r\n\r\n this._blurRatio = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurRatio(): number {\r\n return this._blurRatio;\r\n }\r\n\r\n /**\r\n * Define the adaptive blur kernel used to blur the reflection if needed.\r\n * This will autocompute the closest best match for the `blurKernel`\r\n */\r\n public set adaptiveBlurKernel(value: number) {\r\n this._adaptiveBlurKernel = value;\r\n this._autoComputeBlurKernel();\r\n }\r\n\r\n /**\r\n * Define the blur kernel used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernel(value: number) {\r\n this.blurKernelX = value;\r\n this.blurKernelY = value;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the X Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelX(value: number) {\r\n if (this._blurKernelX === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelX = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelX(): number {\r\n return this._blurKernelX;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the Y Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelY(value: number) {\r\n if (this._blurKernelY === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelY = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelY(): number {\r\n return this._blurKernelY;\r\n }\r\n\r\n private _autoComputeBlurKernel(): void {\r\n const engine = this.getScene()!.getEngine();\r\n\r\n const dw = this.getRenderWidth() / engine.getRenderWidth();\r\n const dh = this.getRenderHeight() / engine.getRenderHeight();\r\n this.blurKernelX = this._adaptiveBlurKernel * dw;\r\n this.blurKernelY = this._adaptiveBlurKernel * dh;\r\n }\r\n\r\n protected override _onRatioRescale(): void {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n if (!this._adaptiveBlurKernel) {\r\n this._preparePostProcesses();\r\n }\r\n }\r\n\r\n if (this._adaptiveBlurKernel) {\r\n this._autoComputeBlurKernel();\r\n }\r\n }\r\n\r\n private _updateGammaSpace() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.gammaSpace = !scene.imageProcessingConfiguration.isEnabled || !scene.imageProcessingConfiguration.applyByPostProcess;\r\n }\r\n\r\n private _imageProcessingConfigChangeObserver: Nullable<Observer<ImageProcessingConfiguration>>;\r\n\r\n private _transformMatrix = Matrix.Zero();\r\n private _mirrorMatrix = Matrix.Zero();\r\n\r\n private _blurX: Nullable<BlurPostProcess>;\r\n private _blurY: Nullable<BlurPostProcess>;\r\n private _adaptiveBlurKernel = 0;\r\n private _blurKernelX = 0;\r\n private _blurKernelY = 0;\r\n private _blurRatio = 1.0;\r\n private _sceneUBO: UniformBuffer;\r\n private _currentSceneUBO: UniformBuffer;\r\n\r\n /**\r\n * Instantiates a Mirror Texture.\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#mirrors\r\n * @param name\r\n * @param size\r\n * @param scene\r\n * @param generateMipMaps\r\n * @param type\r\n * @param samplingMode\r\n * @param generateDepthBuffer\r\n */\r\n constructor(\r\n name: string,\r\n size: number | { width: number; height: number } | { ratio: number },\r\n scene?: Scene,\r\n generateMipMaps?: boolean,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n samplingMode = Texture.BILINEAR_SAMPLINGMODE,\r\n generateDepthBuffer = true\r\n ) {\r\n super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);\r\n\r\n scene = <Scene>this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n this.ignoreCameraViewport = true;\r\n\r\n this._updateGammaSpace();\r\n this._imageProcessingConfigChangeObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(() => {\r\n this._updateGammaSpace();\r\n });\r\n\r\n const engine = scene.getEngine();\r\n\r\n if (engine.supportsUniformBuffers) {\r\n this._sceneUBO = scene.createSceneUniformBuffer(`Scene for Mirror Texture (name \"${name}\")`);\r\n }\r\n\r\n let saveClipPlane: Nullable<Plane>;\r\n\r\n this.onBeforeRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n this._currentSceneUBO = scene!.getSceneUniformBuffer();\r\n scene!.setSceneUniformBuffer(this._sceneUBO);\r\n scene!.getSceneUniformBuffer().unbindEffect();\r\n }\r\n\r\n Matrix.ReflectionToRef(this.mirrorPlane, this._mirrorMatrix);\r\n this._mirrorMatrix.multiplyToRef(scene!.getViewMatrix(), this._transformMatrix);\r\n\r\n scene!.setTransformMatrix(this._transformMatrix, scene!.getProjectionMatrix());\r\n\r\n saveClipPlane = scene!.clipPlane;\r\n scene!.clipPlane = this.mirrorPlane;\r\n\r\n scene!._mirroredCameraPosition = Vector3.TransformCoordinates((<Camera>scene!.activeCamera).globalPosition, this._mirrorMatrix);\r\n });\r\n\r\n this.onAfterRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n scene!.setSceneUniformBuffer(this._currentSceneUBO);\r\n }\r\n scene!.updateTransformMatrix();\r\n scene!._mirroredCameraPosition = null;\r\n\r\n scene!.clipPlane = saveClipPlane;\r\n });\r\n }\r\n\r\n private _preparePostProcesses(): void {\r\n this.clearPostProcesses(true);\r\n\r\n if (this._blurKernelX && this._blurKernelY) {\r\n const engine = (<Scene>this.getScene()).getEngine();\r\n\r\n const textureType =\r\n engine.getCaps().textureFloatRender && engine.getCaps().textureFloatLinearFiltering ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n this._blurX = new BlurPostProcess(\r\n \"horizontal blur\",\r\n new Vector2(1.0, 0),\r\n this._blurKernelX,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurX.autoClear = false;\r\n\r\n if (this._blurRatio === 1 && this.samples < 2 && this._texture) {\r\n this._blurX.inputTexture = this._renderTarget!;\r\n } else {\r\n this._blurX.alwaysForcePOT = true;\r\n }\r\n\r\n this._blurY = new BlurPostProcess(\r\n \"vertical blur\",\r\n new Vector2(0, 1.0),\r\n this._blurKernelY,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurY.autoClear = false;\r\n this._blurY.alwaysForcePOT = this._blurRatio !== 1;\r\n\r\n this.addPostProcess(this._blurX);\r\n this.addPostProcess(this._blurY);\r\n } else {\r\n if (this._blurY) {\r\n this.removePostProcess(this._blurY);\r\n this._blurY.dispose();\r\n this._blurY = null;\r\n }\r\n if (this._blurX) {\r\n this.removePostProcess(this._blurX);\r\n this._blurX.dispose();\r\n this._blurX = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clone the mirror texture.\r\n * @returns the cloned texture\r\n */\r\n public override clone(): MirrorTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const textureSize = this.getSize();\r\n const newTexture = new MirrorTexture(\r\n this.name,\r\n textureSize.width,\r\n scene,\r\n this._renderTargetOptions.generateMipMaps,\r\n this._renderTargetOptions.type,\r\n this._renderTargetOptions.samplingMode,\r\n this._renderTargetOptions.generateDepthBuffer\r\n );\r\n\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n\r\n // Mirror Texture\r\n newTexture.mirrorPlane = this.mirrorPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n public override serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.mirrorPlane = this.mirrorPlane.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n const scene = this.getScene();\r\n\r\n if (scene) {\r\n scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);\r\n }\r\n this._sceneUBO?.dispose();\r\n }\r\n}\r\n\r\nTexture._CreateMirror = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean): MirrorTexture => {\r\n return new MirrorTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"mirrorTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/mirrorTexture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,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ClB,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAE7D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,IAAI,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC5G,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACJ;AAED,OAAO,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,gBAAwB,EAAE,KAAY,EAAE,eAAwB,EAAiB,EAAE;IACtH,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAC7E,CAAC,CAAC","sourcesContent":["import type { Observer } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport { BlurPostProcess } from \"../../PostProcesses/blurPostProcess\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Plane } from \"../../Maths/math.plane\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\n/**\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#mirrortexture\r\n */\r\nexport class MirrorTexture extends RenderTargetTexture {\r\n /**\r\n * Define the reflection plane we want to use. The mirrorPlane is usually set to the constructed reflector.\r\n * It is possible to directly set the mirrorPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the mirrorPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the reflector as stated in the doc.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#mirrors\r\n */\r\n public mirrorPlane = new Plane(0, 1, 0, 1);\r\n\r\n /**\r\n * Define the blur ratio used to blur the reflection if needed.\r\n */\r\n public set blurRatio(value: number) {\r\n if (this._blurRatio === value) {\r\n return;\r\n }\r\n\r\n this._blurRatio = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurRatio(): number {\r\n return this._blurRatio;\r\n }\r\n\r\n /**\r\n * Define the adaptive blur kernel used to blur the reflection if needed.\r\n * This will autocompute the closest best match for the `blurKernel`\r\n */\r\n public set adaptiveBlurKernel(value: number) {\r\n this._adaptiveBlurKernel = value;\r\n this._autoComputeBlurKernel();\r\n }\r\n\r\n /**\r\n * Define the blur kernel used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernel(value: number) {\r\n this.blurKernelX = value;\r\n this.blurKernelY = value;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the X Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelX(value: number) {\r\n if (this._blurKernelX === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelX = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelX(): number {\r\n return this._blurKernelX;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the Y Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelY(value: number) {\r\n if (this._blurKernelY === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelY = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelY(): number {\r\n return this._blurKernelY;\r\n }\r\n\r\n private _autoComputeBlurKernel(): void {\r\n const engine = this.getScene()!.getEngine();\r\n\r\n const dw = this.getRenderWidth() / engine.getRenderWidth();\r\n const dh = this.getRenderHeight() / engine.getRenderHeight();\r\n this.blurKernelX = this._adaptiveBlurKernel * dw;\r\n this.blurKernelY = this._adaptiveBlurKernel * dh;\r\n }\r\n\r\n protected override _onRatioRescale(): void {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n if (!this._adaptiveBlurKernel) {\r\n this._preparePostProcesses();\r\n }\r\n }\r\n\r\n if (this._adaptiveBlurKernel) {\r\n this._autoComputeBlurKernel();\r\n }\r\n }\r\n\r\n private _updateGammaSpace() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.gammaSpace = !scene.imageProcessingConfiguration.isEnabled || !scene.imageProcessingConfiguration.applyByPostProcess;\r\n }\r\n\r\n private _imageProcessingConfigChangeObserver: Nullable<Observer<ImageProcessingConfiguration>>;\r\n\r\n private _transformMatrix = Matrix.Zero();\r\n private _mirrorMatrix = Matrix.Zero();\r\n\r\n private _blurX: Nullable<BlurPostProcess>;\r\n private _blurY: Nullable<BlurPostProcess>;\r\n private _adaptiveBlurKernel = 0;\r\n private _blurKernelX = 0;\r\n private _blurKernelY = 0;\r\n private _blurRatio = 1.0;\r\n private _sceneUBO: UniformBuffer;\r\n private _currentSceneUBO: UniformBuffer;\r\n\r\n /**\r\n * Instantiates a Mirror Texture.\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#mirrors\r\n * @param name\r\n * @param size\r\n * @param scene\r\n * @param generateMipMaps\r\n * @param type\r\n * @param samplingMode\r\n * @param generateDepthBuffer\r\n */\r\n constructor(\r\n name: string,\r\n size: number | { width: number; height: number } | { ratio: number },\r\n scene?: Scene,\r\n generateMipMaps?: boolean,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n samplingMode = Texture.BILINEAR_SAMPLINGMODE,\r\n generateDepthBuffer = true\r\n ) {\r\n super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);\r\n\r\n scene = <Scene>this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n this.ignoreCameraViewport = true;\r\n\r\n this._updateGammaSpace();\r\n this._imageProcessingConfigChangeObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(() => {\r\n this._updateGammaSpace();\r\n });\r\n\r\n const engine = scene.getEngine();\r\n\r\n if (engine.supportsUniformBuffers) {\r\n this._sceneUBO = scene.createSceneUniformBuffer(`Scene for Mirror Texture (name \"${name}\")`);\r\n }\r\n\r\n let saveClipPlane: Nullable<Plane>;\r\n\r\n this.onBeforeRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n this._currentSceneUBO = scene!.getSceneUniformBuffer();\r\n scene!.setSceneUniformBuffer(this._sceneUBO);\r\n scene!.getSceneUniformBuffer().unbindEffect();\r\n }\r\n\r\n Matrix.ReflectionToRef(this.mirrorPlane, this._mirrorMatrix);\r\n this._mirrorMatrix.multiplyToRef(scene!.getViewMatrix(), this._transformMatrix);\r\n\r\n scene!.setTransformMatrix(this._transformMatrix, scene!.getProjectionMatrix());\r\n\r\n saveClipPlane = scene!.clipPlane;\r\n scene!.clipPlane = this.mirrorPlane;\r\n\r\n scene!._mirroredCameraPosition = Vector3.TransformCoordinates((<Camera>scene!.activeCamera).globalPosition, this._mirrorMatrix);\r\n });\r\n\r\n this.onAfterRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n scene!.setSceneUniformBuffer(this._currentSceneUBO);\r\n }\r\n scene!.updateTransformMatrix();\r\n scene!._mirroredCameraPosition = null;\r\n\r\n scene!.clipPlane = saveClipPlane;\r\n });\r\n }\r\n\r\n private _preparePostProcesses(): void {\r\n this.clearPostProcesses(true);\r\n\r\n if (this._blurKernelX && this._blurKernelY) {\r\n const engine = (<Scene>this.getScene()).getEngine();\r\n\r\n const textureType =\r\n engine.getCaps().textureFloatRender && engine.getCaps().textureFloatLinearFiltering ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n this._blurX = new BlurPostProcess(\r\n \"horizontal blur\",\r\n new Vector2(1.0, 0),\r\n this._blurKernelX,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurX.autoClear = false;\r\n\r\n if (this._blurRatio === 1 && this.samples < 2 && this._texture) {\r\n this._blurX.inputTexture = this._renderTarget!;\r\n } else {\r\n this._blurX.alwaysForcePOT = true;\r\n }\r\n\r\n this._blurY = new BlurPostProcess(\r\n \"vertical blur\",\r\n new Vector2(0, 1.0),\r\n this._blurKernelY,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurY.autoClear = false;\r\n this._blurY.alwaysForcePOT = this._blurRatio !== 1;\r\n\r\n this.addPostProcess(this._blurX);\r\n this.addPostProcess(this._blurY);\r\n } else {\r\n if (this._blurY) {\r\n this.removePostProcess(this._blurY);\r\n this._blurY.dispose();\r\n this._blurY = null;\r\n }\r\n if (this._blurX) {\r\n this.removePostProcess(this._blurX);\r\n this._blurX.dispose();\r\n this._blurX = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clone the mirror texture.\r\n * @returns the cloned texture\r\n */\r\n public override clone(): MirrorTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const textureSize = this.getSize();\r\n const newTexture = new MirrorTexture(\r\n this.name,\r\n textureSize.width,\r\n scene,\r\n this._renderTargetOptions.generateMipMaps,\r\n this._renderTargetOptions.type,\r\n this._renderTargetOptions.samplingMode,\r\n this._renderTargetOptions.generateDepthBuffer\r\n );\r\n\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n\r\n // Mirror Texture\r\n newTexture.mirrorPlane = this.mirrorPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n public override serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.mirrorPlane = this.mirrorPlane.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n const scene = this.getScene();\r\n\r\n if (scene) {\r\n scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);\r\n }\r\n this._sceneUBO?.dispose();\r\n }\r\n}\r\n\r\nTexture._CreateMirror = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean): MirrorTexture => {\r\n return new MirrorTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiRenderTarget.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/multiRenderTarget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,6CAA6C,CAAC;AA2GrD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IAOtD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,oBAAoB,IAAI,KAAK,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,IAAoB,KAAK,CAAC,IAAY;QAClC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;YACnC,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAoB,KAAK,CAAC,IAAY;QAClC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC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AAC;QACtC,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\nimport \"../../Engines/Extensions/engine.multiRender\";\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\n/**\r\n * Creation options of the multi render target texture.\r\n */\r\nexport interface IMultiRenderTargetOptions {\r\n /**\r\n * Specifies if mipmaps must be created. If undefined, the value from generateMipMaps is taken instead\r\n */\r\n createMipMaps?: boolean;\r\n /**\r\n * Define if the texture needs to create mip maps after render (default: false).\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Define the types of all the draw buffers (render textures) we want to create\r\n */\r\n types?: number[];\r\n /**\r\n * Define the sampling modes of all the draw buffers (render textures) we want to create\r\n */\r\n samplingModes?: number[];\r\n /**\r\n * Define if sRGB format should be used for each of the draw buffers (render textures) we want to create\r\n */\r\n useSRGBBuffers?: boolean[];\r\n /**\r\n * Define if a depth buffer is required (default: true)\r\n */\r\n generateDepthBuffer?: boolean;\r\n /**\r\n * Define if a stencil buffer is required (default: false)\r\n */\r\n generateStencilBuffer?: boolean;\r\n /**\r\n * Define if a depth texture is required instead of a depth buffer (default: false)\r\n */\r\n generateDepthTexture?: boolean;\r\n /**\r\n * Define the internal format of the buffer in the RTT (RED, RG, RGB, RGBA (default), ALPHA...) of all the draw buffers (render textures) we want to create\r\n */\r\n formats?: number[];\r\n /**\r\n * Define depth texture format to use\r\n */\r\n depthTextureFormat?: number;\r\n /**\r\n * Define the number of desired draw buffers (render textures). You can set it to 0 if you don't need any color attachment. (default: 1)\r\n */\r\n textureCount?: number;\r\n /**\r\n * Define if aspect ratio should be adapted to the texture or stay the scene one (default: true)\r\n */\r\n doNotChangeAspectRatio?: boolean;\r\n /**\r\n * Define the default type of the buffers we are creating (default: Constants.TEXTURETYPE_UNSIGNED_BYTE). types[] is prioritized over defaultType if provided.\r\n */\r\n defaultType?: number;\r\n /**\r\n * Defines sample count (1 by default)\r\n */\r\n samples?: number;\r\n /**\r\n * Defines if we should draw into all attachments or the first one only by default (default: false)\r\n */\r\n drawOnlyOnFirstAttachmentByDefault?: boolean;\r\n /**\r\n * Define the type of texture at each attahment index (of Constants.TEXTURE_2D, .TEXTURE_2D_ARRAY, .TEXTURE_CUBE_MAP, .TEXTURE_CUBE_MAP_ARRAY, .TEXTURE_3D).\r\n * You can also use the -1 value to indicate that no texture should be created but that you will assign a texture to that attachment index later.\r\n * Can be useful when you want to attach several layers of the same 2DArrayTexture / 3DTexture or several faces of the same CubeMapTexture: Use the setInternalTexture\r\n * method for that purpose, after the MultiRenderTarget has been created.\r\n */\r\n targetTypes?: number[];\r\n /**\r\n * Define the face index of each texture in the textures array (if applicable, given the corresponding targetType) at creation time (for Constants.TEXTURE_CUBE_MAP and .TEXTURE_CUBE_MAP_ARRAY).\r\n * Can be changed at any time by calling setLayerAndFaceIndices or setLayerAndFaceIndex\r\n */\r\n faceIndex?: number[];\r\n /**\r\n * Define the layer index of each texture in the textures array (if applicable, given the corresponding targetType) at creation time (for Constants.TEXTURE_3D, .TEXTURE_2D_ARRAY, and .TEXTURE_CUBE_MAP_ARRAY).\r\n * Can be changed at any time by calling setLayerAndFaceIndices or setLayerAndFaceIndex\r\n */\r\n layerIndex?: number[];\r\n /**\r\n * Define the number of layer of each texture in the textures array (if applicable, given the corresponding targetType) (for Constants.TEXTURE_3D, .TEXTURE_2D_ARRAY, and .TEXTURE_CUBE_MAP_ARRAY)\r\n */\r\n layerCounts?: number[];\r\n /**\r\n * Define the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n */\r\n creationFlags?: number[];\r\n /**\r\n * Define the names of the textures (used for debugging purpose)\r\n */\r\n labels?: string[];\r\n /**\r\n * Label of the RenderTargetWrapper (used for debugging only)\r\n */\r\n label?: string;\r\n /**\r\n * Define if the textures should not be created by the MultiRenderTarget (default: false)\r\n * If true, you will need to set the textures yourself by calling setTexture on the MultiRenderTarget.\r\n */\r\n dontCreateTextures?: boolean;\r\n}\r\n\r\n/**\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers (render textures) in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n */\r\nexport class MultiRenderTarget extends RenderTargetTexture {\r\n private _textures: Texture[];\r\n private _multiRenderTargetOptions: IMultiRenderTargetOptions;\r\n private _count: number;\r\n private _drawOnlyOnFirstAttachmentByDefault: boolean;\r\n private _textureNames?: string[];\r\n\r\n /**\r\n * Get if draw buffers (render textures) are currently supported by the used hardware and browser.\r\n */\r\n public get isSupported(): boolean {\r\n return this._engine?.getCaps().drawBuffersExtension ?? false;\r\n }\r\n\r\n /**\r\n * Get the list of textures generated by the multi render target.\r\n */\r\n public get textures(): Texture[] {\r\n return this._textures;\r\n }\r\n\r\n /**\r\n * Gets the number of textures in this MRT. This number can be different from `_textures.length` in case a depth texture is generated.\r\n */\r\n public get count(): number {\r\n return this._count;\r\n }\r\n\r\n /**\r\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\r\n */\r\n public get depthTexture(): Texture {\r\n return this._textures[this._textures.length - 1];\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on U of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public override set wrapU(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapU = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on V of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public override set wrapV(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapV = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Instantiate a new multi render target texture.\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers (render textures) in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the buffers to render to\r\n * @param count Define the number of target we are rendering into\r\n * @param scene Define the scene the texture belongs to\r\n * @param options Define the options used to create the multi render target\r\n * @param textureNames Define the names to set to the textures (if count \\> 0 - optional)\r\n */\r\n constructor(name: string, size: any, count: number, scene?: Scene, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n const generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\r\n const generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\r\n const depthTextureFormat = options && options.depthTextureFormat ? options.depthTextureFormat : Constants.TEXTUREFORMAT_DEPTH16;\r\n const doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\r\n const drawOnlyOnFirstAttachmentByDefault = options && options.drawOnlyOnFirstAttachmentByDefault ? options.drawOnlyOnFirstAttachmentByDefault : false;\r\n super(name, size, scene, generateMipMaps, doNotChangeAspectRatio, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\r\n\r\n if (!this.isSupported) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n this._textureNames = textureNames;\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n const formats: number[] = [];\r\n const targetTypes: number[] = [];\r\n const faceIndex: number[] = [];\r\n const layerIndex: number[] = [];\r\n const layerCounts: number[] = [];\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);\r\n\r\n const generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n const generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n const samples = options && options.samples ? options.samples : 1;\r\n\r\n this._multiRenderTargetOptions = {\r\n samplingModes: samplingModes,\r\n generateMipMaps: generateMipMaps,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer,\r\n generateDepthTexture: generateDepthTexture,\r\n depthTextureFormat: depthTextureFormat,\r\n types: types,\r\n textureCount: count,\r\n useSRGBBuffers: useSRGBBuffers,\r\n samples,\r\n formats: formats,\r\n targetTypes: targetTypes,\r\n faceIndex: faceIndex,\r\n layerIndex: layerIndex,\r\n layerCounts: layerCounts,\r\n labels: textureNames,\r\n label: name,\r\n };\r\n\r\n this._count = count;\r\n this._drawOnlyOnFirstAttachmentByDefault = drawOnlyOnFirstAttachmentByDefault;\r\n\r\n if (count > 0) {\r\n this._createInternalTextures();\r\n this._createTextures(textureNames);\r\n }\r\n }\r\n\r\n private _initTypes(\r\n count: number,\r\n types: number[],\r\n samplingModes: number[],\r\n useSRGBBuffers: boolean[],\r\n formats: number[],\r\n targets: number[],\r\n faceIndex: number[],\r\n layerIndex: number[],\r\n layerCounts: number[],\r\n options?: IMultiRenderTargetOptions\r\n ) {\r\n for (let i = 0; i < count; i++) {\r\n if (options && options.types && options.types[i] !== undefined) {\r\n types.push(options.types[i]);\r\n } else {\r\n types.push(options && options.defaultType ? options.defaultType : Constants.TEXTURETYPE_UNSIGNED_INT);\r\n }\r\n\r\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\r\n samplingModes.push(options.samplingModes[i]);\r\n } else {\r\n samplingModes.push(Texture.BILINEAR_SAMPLINGMODE);\r\n }\r\n\r\n if (options && options.useSRGBBuffers && options.useSRGBBuffers[i] !== undefined) {\r\n useSRGBBuffers.push(options.useSRGBBuffers[i]);\r\n } else {\r\n useSRGBBuffers.push(false);\r\n }\r\n\r\n if (options && options.formats && options.formats[i] !== undefined) {\r\n formats.push(options.formats[i]);\r\n } else {\r\n formats.push(Constants.TEXTUREFORMAT_RGBA);\r\n }\r\n\r\n if (options && options.targetTypes && options.targetTypes[i] !== undefined) {\r\n targets.push(options.targetTypes[i]);\r\n } else {\r\n targets.push(Constants.TEXTURE_2D);\r\n }\r\n\r\n if (options && options.faceIndex && options.faceIndex[i] !== undefined) {\r\n faceIndex.push(options.faceIndex[i]);\r\n } else {\r\n faceIndex.push(0);\r\n }\r\n\r\n if (options && options.layerIndex && options.layerIndex[i] !== undefined) {\r\n layerIndex.push(options.layerIndex[i]);\r\n } else {\r\n layerIndex.push(0);\r\n }\r\n\r\n if (options && options.layerCounts && options.layerCounts[i] !== undefined) {\r\n layerCounts.push(options.layerCounts[i]);\r\n } else {\r\n layerCounts.push(1);\r\n }\r\n }\r\n }\r\n\r\n private _createInternaTextureIndexMapping() {\r\n const mapMainInternalTexture2Index: { [key: number]: number } = {};\r\n const mapInternalTexture2MainIndex: number[] = [];\r\n\r\n if (!this._renderTarget) {\r\n return mapInternalTexture2MainIndex;\r\n }\r\n\r\n const internalTextures = this._renderTarget!.textures!;\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = internalTextures[i];\r\n if (!texture) {\r\n continue;\r\n }\r\n const mainIndex = mapMainInternalTexture2Index[texture.uniqueId];\r\n if (mainIndex !== undefined) {\r\n mapInternalTexture2MainIndex[i] = mainIndex;\r\n } else {\r\n mapMainInternalTexture2Index[texture.uniqueId] = i;\r\n }\r\n }\r\n\r\n return mapInternalTexture2MainIndex;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _rebuild(fromContextLost = false, forceFullRebuild: boolean = false, textureNames?: string[]): void {\r\n if (this._count < 1 || fromContextLost) {\r\n return;\r\n }\r\n\r\n const mapInternalTexture2MainIndex = this._createInternaTextureIndexMapping();\r\n\r\n this.releaseInternalTextures();\r\n this._createInternalTextures();\r\n\r\n if (forceFullRebuild) {\r\n this._releaseTextures();\r\n this._createTextures(textureNames);\r\n }\r\n\r\n const internalTextures = this._renderTarget!.textures!;\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = this._textures[i];\r\n if (mapInternalTexture2MainIndex[i] !== undefined) {\r\n this._renderTarget!.setTexture(internalTextures[mapInternalTexture2MainIndex[i]], i);\r\n }\r\n texture._texture = internalTextures[i];\r\n if (texture._texture) {\r\n texture._noMipmap = !texture._texture.useMipMaps;\r\n texture._useSRGBBuffer = texture._texture._useSRGBBuffer;\r\n }\r\n }\r\n\r\n if (this.samples !== 1) {\r\n this._renderTarget!.setSamples(this.samples, !this._drawOnlyOnFirstAttachmentByDefault, true);\r\n }\r\n }\r\n\r\n private _createInternalTextures(): void {\r\n this._renderTarget = this._getEngine()!.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions, !this._drawOnlyOnFirstAttachmentByDefault);\r\n this._texture = this._renderTarget.texture;\r\n }\r\n\r\n private _releaseTextures(): void {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i]._texture = null; // internal textures are released by a call to releaseInternalTextures()\r\n this._textures[i].dispose();\r\n }\r\n }\r\n }\r\n\r\n private _createTextures(textureNames?: string[]): void {\r\n const internalTextures = this._renderTarget!.textures!;\r\n this._textures = [];\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = new Texture(null, this.getScene());\r\n if (textureNames?.[i]) {\r\n texture.name = textureNames[i];\r\n }\r\n texture._texture = internalTextures[i];\r\n if (texture._texture) {\r\n texture._noMipmap = !texture._texture.useMipMaps;\r\n texture._useSRGBBuffer = texture._texture._useSRGBBuffer;\r\n }\r\n this._textures.push(texture);\r\n }\r\n }\r\n\r\n /**\r\n * Replaces an internal texture within the MRT. Useful to share textures between MultiRenderTarget.\r\n * @param texture The new texture to set in the MRT\r\n * @param index The index of the texture to replace\r\n * @param disposePrevious Set to true if the previous internal texture should be disposed\r\n */\r\n public setInternalTexture(texture: InternalTexture, index: number, disposePrevious: boolean = true) {\r\n if (!this.renderTarget) {\r\n return;\r\n }\r\n\r\n if (index === 0) {\r\n this._texture = texture;\r\n }\r\n\r\n this.renderTarget.setTexture(texture, index, disposePrevious);\r\n\r\n if (!this.textures[index]) {\r\n this.textures[index] = new Texture(null, this.getScene());\r\n this.textures[index].name = this._textureNames?.[index] ?? this.textures[index].name;\r\n }\r\n this.textures[index]._texture = texture;\r\n this.textures[index]._noMipmap = !texture.useMipMaps;\r\n this.textures[index]._useSRGBBuffer = texture._useSRGBBuffer;\r\n\r\n this._count = this.renderTarget.textures ? this.renderTarget.textures.length : 0;\r\n\r\n if (this._multiRenderTargetOptions.types) {\r\n this._multiRenderTargetOptions.types[index] = texture.type;\r\n }\r\n if (this._multiRenderTargetOptions.samplingModes) {\r\n this._multiRenderTargetOptions.samplingModes[index] = texture.samplingMode;\r\n }\r\n if (this._multiRenderTargetOptions.useSRGBBuffers) {\r\n this._multiRenderTargetOptions.useSRGBBuffers[index] = texture._useSRGBBuffer;\r\n }\r\n if (this._multiRenderTargetOptions.targetTypes && this._multiRenderTargetOptions.targetTypes[index] !== -1) {\r\n let target: number = 0;\r\n if (texture.is2DArray) {\r\n target = Constants.TEXTURE_2D_ARRAY;\r\n } else if (texture.isCube) {\r\n target = Constants.TEXTURE_CUBE_MAP;\r\n } /*else if (texture.isCubeArray) {\r\n target = Constants.TEXTURE_CUBE_MAP_ARRAY;\r\n }*/ else if (texture.is3D) {\r\n target = Constants.TEXTURE_3D;\r\n } else {\r\n target = Constants.TEXTURE_2D;\r\n }\r\n this._multiRenderTargetOptions.targetTypes[index] = target;\r\n }\r\n }\r\n\r\n /**\r\n * Changes an attached texture's face index or layer.\r\n * @param index The index of the texture to modify the attachment of\r\n * @param layerIndex The layer index of the texture to be attached to the framebuffer\r\n * @param faceIndex The face index of the texture to be attached to the framebuffer\r\n */\r\n public setLayerAndFaceIndex(index: number, layerIndex: number = -1, faceIndex: number = -1) {\r\n if (!this.textures[index] || !this.renderTarget) {\r\n return;\r\n }\r\n\r\n if (this._multiRenderTargetOptions.layerIndex) {\r\n this._multiRenderTargetOptions.layerIndex[index] = layerIndex;\r\n }\r\n if (this._multiRenderTargetOptions.faceIndex) {\r\n this._multiRenderTargetOptions.faceIndex[index] = faceIndex;\r\n }\r\n\r\n this.renderTarget.setLayerAndFaceIndex(index, layerIndex, faceIndex);\r\n }\r\n\r\n /**\r\n * Changes every attached texture's face index or layer.\r\n * @param layerIndices The layer indices of the texture to be attached to the framebuffer\r\n * @param faceIndices The face indices of the texture to be attached to the framebuffer\r\n */\r\n public setLayerAndFaceIndices(layerIndices: number[], faceIndices: number[]) {\r\n if (!this.renderTarget) {\r\n return;\r\n }\r\n\r\n this._multiRenderTargetOptions.layerIndex = layerIndices;\r\n this._multiRenderTargetOptions.faceIndex = faceIndices;\r\n\r\n this.renderTarget.setLayerAndFaceIndices(layerIndices, faceIndices);\r\n }\r\n\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n public override get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n public override set samples(value: number) {\r\n if (this._renderTarget) {\r\n this._samples = this._renderTarget.setSamples(value);\r\n } else {\r\n // In case samples are set with 0 textures created, we must save the desired samples value\r\n this._samples = value;\r\n }\r\n }\r\n\r\n /**\r\n * Resize all the textures in the multi render target.\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param size Define the new size\r\n */\r\n public override resize(size: any) {\r\n this._processSizeParameter(size);\r\n this._rebuild(false, undefined, this._textureNames);\r\n }\r\n\r\n /**\r\n * Changes the number of render targets in this MRT\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param count new texture count\r\n * @param options Specifies texture types and sampling modes for new textures\r\n * @param textureNames Specifies the names of the textures (optional)\r\n */\r\n public updateCount(count: number, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n this._multiRenderTargetOptions.textureCount = count;\r\n this._count = count;\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n const formats: number[] = [];\r\n const targetTypes: number[] = [];\r\n const faceIndex: number[] = [];\r\n const layerIndex: number[] = [];\r\n const layerCounts: number[] = [];\r\n\r\n this._textureNames = textureNames;\r\n\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);\r\n this._multiRenderTargetOptions.types = types;\r\n this._multiRenderTargetOptions.samplingModes = samplingModes;\r\n this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;\r\n this._multiRenderTargetOptions.formats = formats;\r\n this._multiRenderTargetOptions.targetTypes = targetTypes;\r\n this._multiRenderTargetOptions.faceIndex = faceIndex;\r\n this._multiRenderTargetOptions.layerIndex = layerIndex;\r\n this._multiRenderTargetOptions.layerCounts = layerCounts;\r\n this._multiRenderTargetOptions.labels = textureNames;\r\n\r\n this._rebuild(false, true, textureNames);\r\n }\r\n\r\n protected override _unbindFrameBuffer(engine: Engine, faceIndex: number): void {\r\n if (this._renderTarget) {\r\n engine.unBindMultiColorAttachmentFramebuffer(this._renderTarget, this.isCube, () => {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the render targets and their associated resources\r\n * @param doNotDisposeInternalTextures if set to true, internal textures won't be disposed (default: false).\r\n */\r\n public override dispose(doNotDisposeInternalTextures = false): void {\r\n this._releaseTextures();\r\n if (!doNotDisposeInternalTextures) {\r\n this.releaseInternalTextures();\r\n } else {\r\n // Prevent internal texture dispose in super.dispose\r\n this._texture = null;\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Release all the underlying texture used as draw buffers (render textures).\r\n */\r\n public releaseInternalTextures(): void {\r\n const internalTextures = this._renderTarget?.textures;\r\n\r\n if (!internalTextures) {\r\n return;\r\n }\r\n\r\n for (let i = internalTextures.length - 1; i >= 0; i--) {\r\n this._textures[i]._texture = null;\r\n }\r\n\r\n this._renderTarget?.dispose();\r\n this._renderTarget = null;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"multiRenderTarget.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/multiRenderTarget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,6CAA6C,CAAC;AA2GrD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IAOtD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,oBAAoB,IAAI,KAAK,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,IAAoB,KAAK,CAAC,IAAY;QAClC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;YACnC,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAoB,KAAK,CAAC,IAAY;QAClC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,KA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YACpD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC;QACtC,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\nimport \"../../Engines/Extensions/engine.multiRender\";\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\n/**\r\n * Creation options of the multi render target texture.\r\n */\r\nexport interface IMultiRenderTargetOptions {\r\n /**\r\n * Specifies if mipmaps must be created. If undefined, the value from generateMipMaps is taken instead\r\n */\r\n createMipMaps?: boolean;\r\n /**\r\n * Define if the texture needs to create mip maps after render (default: false).\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Define the types of all the draw buffers (render textures) we want to create\r\n */\r\n types?: number[];\r\n /**\r\n * Define the sampling modes of all the draw buffers (render textures) we want to create\r\n */\r\n samplingModes?: number[];\r\n /**\r\n * Define if sRGB format should be used for each of the draw buffers (render textures) we want to create\r\n */\r\n useSRGBBuffers?: boolean[];\r\n /**\r\n * Define if a depth buffer is required (default: true)\r\n */\r\n generateDepthBuffer?: boolean;\r\n /**\r\n * Define if a stencil buffer is required (default: false)\r\n */\r\n generateStencilBuffer?: boolean;\r\n /**\r\n * Define if a depth texture is required instead of a depth buffer (default: false)\r\n */\r\n generateDepthTexture?: boolean;\r\n /**\r\n * Define the internal format of the buffer in the RTT (RED, RG, RGB, RGBA (default), ALPHA...) of all the draw buffers (render textures) we want to create\r\n */\r\n formats?: number[];\r\n /**\r\n * Define depth texture format to use\r\n */\r\n depthTextureFormat?: number;\r\n /**\r\n * Define the number of desired draw buffers (render textures). You can set it to 0 if you don't need any color attachment. (default: 1)\r\n */\r\n textureCount?: number;\r\n /**\r\n * Define if aspect ratio should be adapted to the texture or stay the scene one (default: true)\r\n */\r\n doNotChangeAspectRatio?: boolean;\r\n /**\r\n * Define the default type of the buffers we are creating (default: Constants.TEXTURETYPE_UNSIGNED_BYTE). types[] is prioritized over defaultType if provided.\r\n */\r\n defaultType?: number;\r\n /**\r\n * Defines sample count (1 by default)\r\n */\r\n samples?: number;\r\n /**\r\n * Defines if we should draw into all attachments or the first one only by default (default: false)\r\n */\r\n drawOnlyOnFirstAttachmentByDefault?: boolean;\r\n /**\r\n * Define the type of texture at each attahment index (of Constants.TEXTURE_2D, .TEXTURE_2D_ARRAY, .TEXTURE_CUBE_MAP, .TEXTURE_CUBE_MAP_ARRAY, .TEXTURE_3D).\r\n * You can also use the -1 value to indicate that no texture should be created but that you will assign a texture to that attachment index later.\r\n * Can be useful when you want to attach several layers of the same 2DArrayTexture / 3DTexture or several faces of the same CubeMapTexture: Use the setInternalTexture\r\n * method for that purpose, after the MultiRenderTarget has been created.\r\n */\r\n targetTypes?: number[];\r\n /**\r\n * Define the face index of each texture in the textures array (if applicable, given the corresponding targetType) at creation time (for Constants.TEXTURE_CUBE_MAP and .TEXTURE_CUBE_MAP_ARRAY).\r\n * Can be changed at any time by calling setLayerAndFaceIndices or setLayerAndFaceIndex\r\n */\r\n faceIndex?: number[];\r\n /**\r\n * Define the layer index of each texture in the textures array (if applicable, given the corresponding targetType) at creation time (for Constants.TEXTURE_3D, .TEXTURE_2D_ARRAY, and .TEXTURE_CUBE_MAP_ARRAY).\r\n * Can be changed at any time by calling setLayerAndFaceIndices or setLayerAndFaceIndex\r\n */\r\n layerIndex?: number[];\r\n /**\r\n * Define the number of layer of each texture in the textures array (if applicable, given the corresponding targetType) (for Constants.TEXTURE_3D, .TEXTURE_2D_ARRAY, and .TEXTURE_CUBE_MAP_ARRAY)\r\n */\r\n layerCounts?: number[];\r\n /**\r\n * Define the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n */\r\n creationFlags?: number[];\r\n /**\r\n * Define the names of the textures (used for debugging purpose)\r\n */\r\n labels?: string[];\r\n /**\r\n * Label of the RenderTargetWrapper (used for debugging only)\r\n */\r\n label?: string;\r\n /**\r\n * Define if the textures should not be created by the MultiRenderTarget (default: false)\r\n * If true, you will need to set the textures yourself by calling setTexture on the MultiRenderTarget.\r\n */\r\n dontCreateTextures?: boolean;\r\n}\r\n\r\n/**\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers (render textures) in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n */\r\nexport class MultiRenderTarget extends RenderTargetTexture {\r\n private _textures: Texture[];\r\n private _multiRenderTargetOptions: IMultiRenderTargetOptions;\r\n private _count: number;\r\n private _drawOnlyOnFirstAttachmentByDefault: boolean;\r\n private _textureNames?: string[];\r\n\r\n /**\r\n * Get if draw buffers (render textures) are currently supported by the used hardware and browser.\r\n */\r\n public get isSupported(): boolean {\r\n return this._engine?.getCaps().drawBuffersExtension ?? false;\r\n }\r\n\r\n /**\r\n * Get the list of textures generated by the multi render target.\r\n */\r\n public get textures(): Texture[] {\r\n return this._textures;\r\n }\r\n\r\n /**\r\n * Gets the number of textures in this MRT. This number can be different from `_textures.length` in case a depth texture is generated.\r\n */\r\n public get count(): number {\r\n return this._count;\r\n }\r\n\r\n /**\r\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\r\n */\r\n public get depthTexture(): Texture {\r\n return this._textures[this._textures.length - 1];\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on U of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public override set wrapU(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapU = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on V of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public override set wrapV(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapV = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Instantiate a new multi render target texture.\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers (render textures) in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the buffers to render to\r\n * @param count Define the number of target we are rendering into\r\n * @param scene Define the scene the texture belongs to\r\n * @param options Define the options used to create the multi render target\r\n * @param textureNames Define the names to set to the textures (if count \\> 0 - optional)\r\n */\r\n constructor(name: string, size: any, count: number, scene?: Scene, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n const generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\r\n const generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\r\n const depthTextureFormat = options && options.depthTextureFormat ? options.depthTextureFormat : Constants.TEXTUREFORMAT_DEPTH16;\r\n const doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\r\n const drawOnlyOnFirstAttachmentByDefault = options && options.drawOnlyOnFirstAttachmentByDefault ? options.drawOnlyOnFirstAttachmentByDefault : false;\r\n super(name, size, scene, generateMipMaps, doNotChangeAspectRatio, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\r\n\r\n if (!this.isSupported) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n this._textureNames = textureNames;\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n const formats: number[] = [];\r\n const targetTypes: number[] = [];\r\n const faceIndex: number[] = [];\r\n const layerIndex: number[] = [];\r\n const layerCounts: number[] = [];\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);\r\n\r\n const generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n const generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n const samples = options && options.samples ? options.samples : 1;\r\n\r\n this._multiRenderTargetOptions = {\r\n samplingModes: samplingModes,\r\n generateMipMaps: generateMipMaps,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer,\r\n generateDepthTexture: generateDepthTexture,\r\n depthTextureFormat: depthTextureFormat,\r\n types: types,\r\n textureCount: count,\r\n useSRGBBuffers: useSRGBBuffers,\r\n samples,\r\n formats: formats,\r\n targetTypes: targetTypes,\r\n faceIndex: faceIndex,\r\n layerIndex: layerIndex,\r\n layerCounts: layerCounts,\r\n labels: textureNames,\r\n label: name,\r\n };\r\n\r\n this._count = count;\r\n this._drawOnlyOnFirstAttachmentByDefault = drawOnlyOnFirstAttachmentByDefault;\r\n\r\n if (count > 0) {\r\n this._createInternalTextures();\r\n this._createTextures(textureNames);\r\n }\r\n }\r\n\r\n private _initTypes(\r\n count: number,\r\n types: number[],\r\n samplingModes: number[],\r\n useSRGBBuffers: boolean[],\r\n formats: number[],\r\n targets: number[],\r\n faceIndex: number[],\r\n layerIndex: number[],\r\n layerCounts: number[],\r\n options?: IMultiRenderTargetOptions\r\n ) {\r\n for (let i = 0; i < count; i++) {\r\n if (options && options.types && options.types[i] !== undefined) {\r\n types.push(options.types[i]);\r\n } else {\r\n types.push(options && options.defaultType ? options.defaultType : Constants.TEXTURETYPE_UNSIGNED_BYTE);\r\n }\r\n\r\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\r\n samplingModes.push(options.samplingModes[i]);\r\n } else {\r\n samplingModes.push(Texture.BILINEAR_SAMPLINGMODE);\r\n }\r\n\r\n if (options && options.useSRGBBuffers && options.useSRGBBuffers[i] !== undefined) {\r\n useSRGBBuffers.push(options.useSRGBBuffers[i]);\r\n } else {\r\n useSRGBBuffers.push(false);\r\n }\r\n\r\n if (options && options.formats && options.formats[i] !== undefined) {\r\n formats.push(options.formats[i]);\r\n } else {\r\n formats.push(Constants.TEXTUREFORMAT_RGBA);\r\n }\r\n\r\n if (options && options.targetTypes && options.targetTypes[i] !== undefined) {\r\n targets.push(options.targetTypes[i]);\r\n } else {\r\n targets.push(Constants.TEXTURE_2D);\r\n }\r\n\r\n if (options && options.faceIndex && options.faceIndex[i] !== undefined) {\r\n faceIndex.push(options.faceIndex[i]);\r\n } else {\r\n faceIndex.push(0);\r\n }\r\n\r\n if (options && options.layerIndex && options.layerIndex[i] !== undefined) {\r\n layerIndex.push(options.layerIndex[i]);\r\n } else {\r\n layerIndex.push(0);\r\n }\r\n\r\n if (options && options.layerCounts && options.layerCounts[i] !== undefined) {\r\n layerCounts.push(options.layerCounts[i]);\r\n } else {\r\n layerCounts.push(1);\r\n }\r\n }\r\n }\r\n\r\n private _createInternaTextureIndexMapping() {\r\n const mapMainInternalTexture2Index: { [key: number]: number } = {};\r\n const mapInternalTexture2MainIndex: number[] = [];\r\n\r\n if (!this._renderTarget) {\r\n return mapInternalTexture2MainIndex;\r\n }\r\n\r\n const internalTextures = this._renderTarget!.textures!;\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = internalTextures[i];\r\n if (!texture) {\r\n continue;\r\n }\r\n const mainIndex = mapMainInternalTexture2Index[texture.uniqueId];\r\n if (mainIndex !== undefined) {\r\n mapInternalTexture2MainIndex[i] = mainIndex;\r\n } else {\r\n mapMainInternalTexture2Index[texture.uniqueId] = i;\r\n }\r\n }\r\n\r\n return mapInternalTexture2MainIndex;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _rebuild(fromContextLost = false, forceFullRebuild: boolean = false, textureNames?: string[]): void {\r\n if (this._count < 1 || fromContextLost) {\r\n return;\r\n }\r\n\r\n const mapInternalTexture2MainIndex = this._createInternaTextureIndexMapping();\r\n\r\n this.releaseInternalTextures();\r\n this._createInternalTextures();\r\n\r\n if (forceFullRebuild) {\r\n this._releaseTextures();\r\n this._createTextures(textureNames);\r\n }\r\n\r\n const internalTextures = this._renderTarget!.textures!;\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = this._textures[i];\r\n if (mapInternalTexture2MainIndex[i] !== undefined) {\r\n this._renderTarget!.setTexture(internalTextures[mapInternalTexture2MainIndex[i]], i);\r\n }\r\n texture._texture = internalTextures[i];\r\n if (texture._texture) {\r\n texture._noMipmap = !texture._texture.useMipMaps;\r\n texture._useSRGBBuffer = texture._texture._useSRGBBuffer;\r\n }\r\n }\r\n\r\n if (this.samples !== 1) {\r\n this._renderTarget!.setSamples(this.samples, !this._drawOnlyOnFirstAttachmentByDefault, true);\r\n }\r\n }\r\n\r\n private _createInternalTextures(): void {\r\n this._renderTarget = this._getEngine()!.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions, !this._drawOnlyOnFirstAttachmentByDefault);\r\n this._texture = this._renderTarget.texture;\r\n }\r\n\r\n private _releaseTextures(): void {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i]._texture = null; // internal textures are released by a call to releaseInternalTextures()\r\n this._textures[i].dispose();\r\n }\r\n }\r\n }\r\n\r\n private _createTextures(textureNames?: string[]): void {\r\n const internalTextures = this._renderTarget!.textures!;\r\n this._textures = [];\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = new Texture(null, this.getScene());\r\n if (textureNames?.[i]) {\r\n texture.name = textureNames[i];\r\n }\r\n texture._texture = internalTextures[i];\r\n if (texture._texture) {\r\n texture._noMipmap = !texture._texture.useMipMaps;\r\n texture._useSRGBBuffer = texture._texture._useSRGBBuffer;\r\n }\r\n this._textures.push(texture);\r\n }\r\n }\r\n\r\n /**\r\n * Replaces an internal texture within the MRT. Useful to share textures between MultiRenderTarget.\r\n * @param texture The new texture to set in the MRT\r\n * @param index The index of the texture to replace\r\n * @param disposePrevious Set to true if the previous internal texture should be disposed\r\n */\r\n public setInternalTexture(texture: InternalTexture, index: number, disposePrevious: boolean = true) {\r\n if (!this.renderTarget) {\r\n return;\r\n }\r\n\r\n if (index === 0) {\r\n this._texture = texture;\r\n }\r\n\r\n this.renderTarget.setTexture(texture, index, disposePrevious);\r\n\r\n if (!this.textures[index]) {\r\n this.textures[index] = new Texture(null, this.getScene());\r\n this.textures[index].name = this._textureNames?.[index] ?? this.textures[index].name;\r\n }\r\n this.textures[index]._texture = texture;\r\n this.textures[index]._noMipmap = !texture.useMipMaps;\r\n this.textures[index]._useSRGBBuffer = texture._useSRGBBuffer;\r\n\r\n this._count = this.renderTarget.textures ? this.renderTarget.textures.length : 0;\r\n\r\n if (this._multiRenderTargetOptions.types) {\r\n this._multiRenderTargetOptions.types[index] = texture.type;\r\n }\r\n if (this._multiRenderTargetOptions.samplingModes) {\r\n this._multiRenderTargetOptions.samplingModes[index] = texture.samplingMode;\r\n }\r\n if (this._multiRenderTargetOptions.useSRGBBuffers) {\r\n this._multiRenderTargetOptions.useSRGBBuffers[index] = texture._useSRGBBuffer;\r\n }\r\n if (this._multiRenderTargetOptions.targetTypes && this._multiRenderTargetOptions.targetTypes[index] !== -1) {\r\n let target: number = 0;\r\n if (texture.is2DArray) {\r\n target = Constants.TEXTURE_2D_ARRAY;\r\n } else if (texture.isCube) {\r\n target = Constants.TEXTURE_CUBE_MAP;\r\n } /*else if (texture.isCubeArray) {\r\n target = Constants.TEXTURE_CUBE_MAP_ARRAY;\r\n }*/ else if (texture.is3D) {\r\n target = Constants.TEXTURE_3D;\r\n } else {\r\n target = Constants.TEXTURE_2D;\r\n }\r\n this._multiRenderTargetOptions.targetTypes[index] = target;\r\n }\r\n }\r\n\r\n /**\r\n * Changes an attached texture's face index or layer.\r\n * @param index The index of the texture to modify the attachment of\r\n * @param layerIndex The layer index of the texture to be attached to the framebuffer\r\n * @param faceIndex The face index of the texture to be attached to the framebuffer\r\n */\r\n public setLayerAndFaceIndex(index: number, layerIndex: number = -1, faceIndex: number = -1) {\r\n if (!this.textures[index] || !this.renderTarget) {\r\n return;\r\n }\r\n\r\n if (this._multiRenderTargetOptions.layerIndex) {\r\n this._multiRenderTargetOptions.layerIndex[index] = layerIndex;\r\n }\r\n if (this._multiRenderTargetOptions.faceIndex) {\r\n this._multiRenderTargetOptions.faceIndex[index] = faceIndex;\r\n }\r\n\r\n this.renderTarget.setLayerAndFaceIndex(index, layerIndex, faceIndex);\r\n }\r\n\r\n /**\r\n * Changes every attached texture's face index or layer.\r\n * @param layerIndices The layer indices of the texture to be attached to the framebuffer\r\n * @param faceIndices The face indices of the texture to be attached to the framebuffer\r\n */\r\n public setLayerAndFaceIndices(layerIndices: number[], faceIndices: number[]) {\r\n if (!this.renderTarget) {\r\n return;\r\n }\r\n\r\n this._multiRenderTargetOptions.layerIndex = layerIndices;\r\n this._multiRenderTargetOptions.faceIndex = faceIndices;\r\n\r\n this.renderTarget.setLayerAndFaceIndices(layerIndices, faceIndices);\r\n }\r\n\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n public override get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n public override set samples(value: number) {\r\n if (this._renderTarget) {\r\n this._samples = this._renderTarget.setSamples(value);\r\n } else {\r\n // In case samples are set with 0 textures created, we must save the desired samples value\r\n this._samples = value;\r\n }\r\n }\r\n\r\n /**\r\n * Resize all the textures in the multi render target.\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param size Define the new size\r\n */\r\n public override resize(size: any) {\r\n this._processSizeParameter(size);\r\n this._rebuild(false, undefined, this._textureNames);\r\n }\r\n\r\n /**\r\n * Changes the number of render targets in this MRT\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param count new texture count\r\n * @param options Specifies texture types and sampling modes for new textures\r\n * @param textureNames Specifies the names of the textures (optional)\r\n */\r\n public updateCount(count: number, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n this._multiRenderTargetOptions.textureCount = count;\r\n this._count = count;\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n const formats: number[] = [];\r\n const targetTypes: number[] = [];\r\n const faceIndex: number[] = [];\r\n const layerIndex: number[] = [];\r\n const layerCounts: number[] = [];\r\n\r\n this._textureNames = textureNames;\r\n\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);\r\n this._multiRenderTargetOptions.types = types;\r\n this._multiRenderTargetOptions.samplingModes = samplingModes;\r\n this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;\r\n this._multiRenderTargetOptions.formats = formats;\r\n this._multiRenderTargetOptions.targetTypes = targetTypes;\r\n this._multiRenderTargetOptions.faceIndex = faceIndex;\r\n this._multiRenderTargetOptions.layerIndex = layerIndex;\r\n this._multiRenderTargetOptions.layerCounts = layerCounts;\r\n this._multiRenderTargetOptions.labels = textureNames;\r\n\r\n this._rebuild(false, true, textureNames);\r\n }\r\n\r\n protected override _unbindFrameBuffer(engine: Engine, faceIndex: number): void {\r\n if (this._renderTarget) {\r\n engine.unBindMultiColorAttachmentFramebuffer(this._renderTarget, this.isCube, () => {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the render targets and their associated resources\r\n * @param doNotDisposeInternalTextures if set to true, internal textures won't be disposed (default: false).\r\n */\r\n public override dispose(doNotDisposeInternalTextures = false): void {\r\n this._releaseTextures();\r\n if (!doNotDisposeInternalTextures) {\r\n this.releaseInternalTextures();\r\n } else {\r\n // Prevent internal texture dispose in super.dispose\r\n this._texture = null;\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Release all the underlying texture used as draw buffers (render textures).\r\n */\r\n public releaseInternalTextures(): void {\r\n const internalTextures = this._renderTarget?.textures;\r\n\r\n if (!internalTextures) {\r\n return;\r\n }\r\n\r\n for (let i = internalTextures.length - 1; i >= 0; i--) {\r\n this._textures[i]._texture = null;\r\n }\r\n\r\n this._renderTarget?.dispose();\r\n this._renderTarget = null;\r\n }\r\n}\r\n"]}
|
|
@@ -12,7 +12,7 @@ export declare class RawCubeTexture extends CubeTexture {
|
|
|
12
12
|
* @param data defines the array of data to use to create each face
|
|
13
13
|
* @param size defines the size of the textures
|
|
14
14
|
* @param format defines the format of the data
|
|
15
|
-
* @param type defines the type of the data (like Engine.
|
|
15
|
+
* @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)
|
|
16
16
|
* @param generateMipMaps defines if the engine should generate the mip levels
|
|
17
17
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
18
18
|
* @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)
|
|
@@ -23,7 +23,7 @@ export declare class RawCubeTexture extends CubeTexture {
|
|
|
23
23
|
* Updates the raw cube texture.
|
|
24
24
|
* @param data defines the data to store
|
|
25
25
|
* @param format defines the data format
|
|
26
|
-
* @param type defines the type fo the data (Engine.
|
|
26
|
+
* @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
|
|
27
27
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
28
28
|
* @param compression defines the compression used (null by default)
|
|
29
29
|
*/
|
|
@@ -12,7 +12,7 @@ export class RawCubeTexture extends CubeTexture {
|
|
|
12
12
|
* @param data defines the array of data to use to create each face
|
|
13
13
|
* @param size defines the size of the textures
|
|
14
14
|
* @param format defines the format of the data
|
|
15
|
-
* @param type defines the type of the data (like Engine.
|
|
15
|
+
* @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)
|
|
16
16
|
* @param generateMipMaps defines if the engine should generate the mip levels
|
|
17
17
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
18
18
|
* @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)
|
|
@@ -26,7 +26,7 @@ export class RawCubeTexture extends CubeTexture {
|
|
|
26
26
|
* Updates the raw cube texture.
|
|
27
27
|
* @param data defines the data to store
|
|
28
28
|
* @param format defines the data format
|
|
29
|
-
* @param type defines the type fo the data (Engine.
|
|
29
|
+
* @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
|
|
30
30
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
31
31
|
* @param compression defines the compression used (null by default)
|
|
32
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAKjG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC3C;;;;;;;;;;;OAWG;IACH,YACI,KAAY,EACZ,IAAiC,EACjC,IAAY,EACZ,SAAiB,SAAS,CAAC,kBAAkB,EAC7C,OAAe,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"rawCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAKjG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC3C;;;;;;;;;;;OAWG;IACH,YACI,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AAe,CAAC,KAAK,EACrB,eAAe,CAAC,MAAM,EACtB,eAAe,CAAC,IAAI,EACpB,eAAe,CAAC,eAAe,EAC/B,eAAe,CAAC,OAAO,EACvB,eAAe,CAAC,YAAY,EAC5B,eAAe,CAAC,YAAY,CAC/B,CAAC;YAEF,IAAI,eAAe,CAAC,MAAM,+CAAsC,EAAE,CAAC;gBAC/D,OAAO,CAAC,eAAe,CACnB,eAAe,CAAC,qBAAsB,EACtC,eAAe,CAAC,oBAAoB,EACpC,eAAe,CAAC,mBAAmB,EACnC,eAAe,CAAC,oBAAoB,CACvC,CAAC;YACN,CAAC;YAED,OAAO,OAAO,CAAC;QACnB,CAAC,EAAE,IAAI,CAAC,CAAC;IACb,CAAC;CACJ","sourcesContent":["import { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { _UpdateRGBDAsync as UpdateRGBDAsyncEnvTools } from \"../../Misc/environmentTextureTools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\nimport { InternalTextureSource } from \"./internalTexture\";\r\nimport { CubeTexture } from \"./cubeTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\n/**\r\n * Raw cube texture where the raw buffers are passed in\r\n */\r\nexport class RawCubeTexture extends CubeTexture {\r\n /**\r\n * Creates a cube texture where the raw buffers are passed in.\r\n * @param scene defines the scene the texture is attached to\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n */\r\n constructor(\r\n scene: Scene,\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n generateMipMaps: boolean = false,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n compression: Nullable<string> = null\r\n ) {\r\n super(\"\", scene);\r\n\r\n this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\r\n }\r\n\r\n /**\r\n * Updates the raw cube texture.\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n public update(data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string> = null): void {\r\n this._texture!.getEngine().updateRawCubeTexture(this._texture!, data, format, type, invertY, compression);\r\n }\r\n\r\n /**\r\n * Updates a raw cube texture with RGBD encoded data.\r\n * @param data defines the array of data [mipmap][face] to use to create each face\r\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns a promise that resolves when the operation is complete\r\n */\r\n public updateRGBDAsync(data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial> = null, lodScale: number = 0.8, lodOffset: number = 0): Promise<void> {\r\n return UpdateRGBDAsyncEnvTools(this._texture!, data, sphericalPolynomial, lodScale, lodOffset).then(() => {});\r\n }\r\n\r\n /**\r\n * Clones the raw cube texture.\r\n * @returns a new cube texture\r\n */\r\n public override clone(): CubeTexture {\r\n return SerializationHelper.Clone(() => {\r\n const scene = this.getScene()!;\r\n const internalTexture = this._texture!;\r\n\r\n const texture = new RawCubeTexture(\r\n scene,\r\n internalTexture._bufferViewArray!,\r\n internalTexture.width,\r\n internalTexture.format,\r\n internalTexture.type,\r\n internalTexture.generateMipMaps,\r\n internalTexture.invertY,\r\n internalTexture.samplingMode,\r\n internalTexture._compression\r\n );\r\n\r\n if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {\r\n texture.updateRGBDAsync(\r\n internalTexture._bufferViewArrayArray!,\r\n internalTexture._sphericalPolynomial,\r\n internalTexture._lodGenerationScale,\r\n internalTexture._lodGenerationOffset\r\n );\r\n }\r\n\r\n return texture;\r\n }, this);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IACnC;;;;;;;;;;;;;;;;OAgBG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc;IACd;;OAEG;IACI,MAAc,EACrB,aAA+C,EAC/C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,SAAS,CAAC,8BAA8B,EAC/D,OAAe,SAAS,CAAC,wBAAwB,EACjD,aAAsB,EACtB,aAAuB;QAEvB,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QATtJ,WAAM,GAAN,MAAM,CAAQ;QAWrB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,IAAI,KAAK,SAAS,CAAC,iBAAiB,EAAE,CAAC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jB,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,CAAC,kBAAkB,EAC5B,aAAa,EACb,eAAe,EACf,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,SAAS,CAAC,4BAA4B,EACtC,aAAa,CAChB,CAAC;IACN,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,cAAc,CACxB,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,aAA+C,EAC/C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACvI,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,qBAAqB,CAC/B,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,aAA+C,EAC/C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAC/K,CAAC;CACJ","sourcesContent":["import { Texture } from \"./texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\n\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nexport class RawTexture extends Texture {\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture (null to create an empty texture)\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n constructor(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n public format: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(null, sceneOrEngine, !generateMipMaps, invertY, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, creationFlags);\r\n\r\n if (!this._engine) {\r\n return;\r\n }\r\n\r\n if (!this._engine._caps.textureFloatLinearFiltering && type === Constants.TEXTURETYPE_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n if (!this._engine._caps.textureHalfFloatLinearFiltering && type === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags ?? 0, useSRGBBuffer ?? false);\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n }\r\n\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n public update(data: ArrayBufferView): void {\r\n this._getEngine()!.updateRawTexture(this._texture, data, this._texture!.format, this._texture!.invertY, null, this._texture!.type, this._texture!._useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public override clone(): Texture {\r\n if (!this._texture) {\r\n return super.clone();\r\n }\r\n\r\n const rawTexture = new RawTexture(\r\n null,\r\n this.getSize().width,\r\n this.getSize().height,\r\n this.format,\r\n this.getScene(),\r\n this._texture.generateMipMaps,\r\n this._invertY,\r\n this.samplingMode,\r\n this._texture.type,\r\n this._texture._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n\r\n rawTexture._texture = this._texture;\r\n this._texture.incrementReferences();\r\n\r\n return rawTexture;\r\n }\r\n\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n public static CreateLuminanceTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n public static CreateLuminanceAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n public static CreateAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGB alpha texture\r\n */\r\n public static CreateRGBTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGB, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBATexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBAStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(\r\n data,\r\n width,\r\n height,\r\n Constants.TEXTUREFORMAT_RGBA,\r\n sceneOrEngine,\r\n generateMipMaps,\r\n invertY,\r\n samplingMode,\r\n type,\r\n Constants.TEXTURE_CREATIONFLAG_STORAGE,\r\n useSRGBBuffer\r\n );\r\n }\r\n\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n }\r\n\r\n /**\r\n * Creates a R storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, Constants.TEXTURE_CREATIONFLAG_STORAGE);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"rawTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IACnC;;;;;;;;;;;;;;;;OAgBG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc;IACd;;OAEG;IACI,MAAc,EACrB,aAA+C,EAC/C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,SAAS,CAAC,8BAA8B,EAC/D,OAAe,SAAS,CAAC,yBAAyB,EAClD,aAAsB,EACtB,aAAuB;QAEvB,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QATtJ,WAAM,GAAN,MAAM,CAAQ;QAWrB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,IAAI,KAAK,SAAS,CAAC,iBAAiB,EAAE,CAAC;YAC1F,YAAY,GAAG,SAAS,CAAC,4BAA4B,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,IAAI,IAAI,KAAK,SAAS,CAAC,sBAAsB,EAAE,CAAC;YACnG,YAAY,GAA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;;;;;OAWG;IACI,MAAM,CAAC,cAAc,CACxB,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,aAA+C,EAC/C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACvI,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,qBAAqB,CAC/B,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,aAA+C,EAC/C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAC/K,CAAC;CACJ","sourcesContent":["import { Texture } from \"./texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\n\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nexport class RawTexture extends Texture {\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture (null to create an empty texture)\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n constructor(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n public format: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(null, sceneOrEngine, !generateMipMaps, invertY, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, creationFlags);\r\n\r\n if (!this._engine) {\r\n return;\r\n }\r\n\r\n if (!this._engine._caps.textureFloatLinearFiltering && type === Constants.TEXTURETYPE_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n if (!this._engine._caps.textureHalfFloatLinearFiltering && type === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags ?? 0, useSRGBBuffer ?? false);\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n }\r\n\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n public update(data: ArrayBufferView): void {\r\n this._getEngine()!.updateRawTexture(this._texture, data, this._texture!.format, this._texture!.invertY, null, this._texture!.type, this._texture!._useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public override clone(): Texture {\r\n if (!this._texture) {\r\n return super.clone();\r\n }\r\n\r\n const rawTexture = new RawTexture(\r\n null,\r\n this.getSize().width,\r\n this.getSize().height,\r\n this.format,\r\n this.getScene(),\r\n this._texture.generateMipMaps,\r\n this._invertY,\r\n this.samplingMode,\r\n this._texture.type,\r\n this._texture._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n\r\n rawTexture._texture = this._texture;\r\n this._texture.incrementReferences();\r\n\r\n return rawTexture;\r\n }\r\n\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n public static CreateLuminanceTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n public static CreateLuminanceAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n public static CreateAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGB alpha texture\r\n */\r\n public static CreateRGBTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGB, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBATexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBAStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(\r\n data,\r\n width,\r\n height,\r\n Constants.TEXTUREFORMAT_RGBA,\r\n sceneOrEngine,\r\n generateMipMaps,\r\n invertY,\r\n samplingMode,\r\n type,\r\n Constants.TEXTURE_CREATIONFLAG_STORAGE,\r\n useSRGBBuffer\r\n );\r\n }\r\n\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n }\r\n\r\n /**\r\n * Creates a R storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | AbstractEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, Constants.TEXTURE_CREATIONFLAG_STORAGE);\r\n }\r\n}\r\n"]}
|
|
@@ -23,7 +23,7 @@ export declare class RawTexture2DArray extends Texture {
|
|
|
23
23
|
* @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)
|
|
24
24
|
* @param invertY defines if texture must be stored with Y axis inverted
|
|
25
25
|
* @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)
|
|
26
|
-
* @param textureType defines the texture Type (Engine.
|
|
26
|
+
* @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
|
|
27
27
|
* @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
|
|
28
28
|
*/
|
|
29
29
|
constructor(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number,
|
|
@@ -21,7 +21,7 @@ export class RawTexture2DArray extends Texture {
|
|
|
21
21
|
* @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)
|
|
22
22
|
* @param invertY defines if texture must be stored with Y axis inverted
|
|
23
23
|
* @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)
|
|
24
|
-
* @param textureType defines the texture Type (Engine.
|
|
24
|
+
* @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
|
|
25
25
|
* @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)
|
|
26
26
|
*/
|
|
27
27
|
constructor(data, width, height, depth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawTexture2DArray.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawTexture2DArray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAKpD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO;IAG1C;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,KAAa;IACb,6CAA6C;IACtC,MAAc,EACrB,KAAY,EACZ,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,WAAW,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"rawTexture2DArray.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawTexture2DArray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAKpD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO;IAG1C;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,KAAa;IACb,6CAA6C;IACtC,MAAc,EACrB,KAAY,EACZ,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,WAAW,GAAG,SAAS,CAAC,yBAAyB,EACjD,aAAsB;QAEtB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QARvC,WAAM,GAAN,MAAM,CAAQ;QAUrB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,uBAAuB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;QAExK,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAqB;QAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,UAAU,EAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,QAAS,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5I,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,iBAAiB,CAC3B,IAAqB,EACrB,KAAa,EACb,MAAc,EACd,KAAa,EACb,KAAY,EACZ,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,SAAS,CAAC,8BAA8B,EAC/D,OAAe,SAAS,CAAC,yBAAyB;QAElD,OAAO,IAAI,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,kBAAkB,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IAChJ,CAAC;CACJ","sourcesContent":["import { Texture } from \"./texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Class used to store 2D array textures containing user data\r\n */\r\nexport class RawTexture2DArray extends Texture {\r\n private _depth: number;\r\n\r\n /**\r\n * Gets the number of layers of the texture\r\n */\r\n public get depth() {\r\n return this._depth;\r\n }\r\n\r\n /**\r\n * Create a new RawTexture2DArray\r\n * @param data defines the data of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the texture format to use\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)\r\n * @param invertY defines if texture must be stored with Y axis inverted\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n */\r\n constructor(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n /** Gets or sets the texture format to use */\r\n public format: number,\r\n scene: Scene,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n creationFlags?: number\r\n ) {\r\n super(null, scene, !generateMipMaps, invertY);\r\n\r\n this._texture = scene.getEngine().createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, null, textureType, creationFlags);\r\n\r\n this._depth = depth;\r\n this.is2DArray = true;\r\n }\r\n\r\n /**\r\n * Update the texture with new data\r\n * @param data defines the data to store in the texture\r\n */\r\n public update(data: ArrayBufferView): void {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._getEngine()!.updateRawTexture2DArray(this._texture, data, this._texture.format, this._texture!.invertY, null, this._texture.type);\r\n }\r\n\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param scene defines the scene the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBATexture(\r\n data: ArrayBufferView,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n scene: Scene,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ): RawTexture2DArray {\r\n return new RawTexture2DArray(data, width, height, depth, Constants.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);\r\n }\r\n}\r\n"]}
|
|
@@ -30,7 +30,7 @@ export declare class RawTexture3D extends Texture {
|
|
|
30
30
|
* @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)
|
|
31
31
|
* @param invertY defines if texture must be stored with Y axis inverted
|
|
32
32
|
* @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)
|
|
33
|
-
* @param textureType defines the texture Type (Engine.
|
|
33
|
+
* @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
|
|
34
34
|
* @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
|
|
35
35
|
*/
|
|
36
36
|
constructor(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number,
|
|
@@ -33,7 +33,7 @@ export class RawTexture3D extends Texture {
|
|
|
33
33
|
* @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)
|
|
34
34
|
* @param invertY defines if texture must be stored with Y axis inverted
|
|
35
35
|
* @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)
|
|
36
|
-
* @param textureType defines the texture Type (Engine.
|
|
36
|
+
* @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
|
|
37
37
|
* @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)
|
|
38
38
|
*/
|
|
39
39
|
constructor(data, width, height, depth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawTexture3D.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawTexture3D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,OAAO;IACrC;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,KAAa;IACb,6CAA6C;IACtC,MAAc,EACrB,KAAY,EACZ,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,WAAW,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"rawTexture3D.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawTexture3D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,OAAO;IACrC;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,Q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AAS,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvI,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Texture } from \"./texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { Nullable } from \"../../types\";\r\n/**\r\n * Class used to store 3D textures containing user data\r\n */\r\nexport class RawTexture3D extends Texture {\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public get width(): number {\r\n return this._texture ? this._texture.width : 0;\r\n }\r\n\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public get height(): number {\r\n return this._texture ? this._texture.height : 0;\r\n }\r\n\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public get depth(): number {\r\n return this._texture ? this._texture.depth : 0;\r\n }\r\n\r\n /**\r\n * Create a new RawTexture3D\r\n * @param data defines the data of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the texture format to use\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)\r\n * @param invertY defines if texture must be stored with Y axis inverted\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n */\r\n constructor(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n /** Gets or sets the texture format to use */\r\n public format: number,\r\n scene: Scene,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n creationFlags?: number\r\n ) {\r\n super(null, scene, !generateMipMaps, invertY);\r\n\r\n this._texture = scene.getEngine().createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, null, textureType, creationFlags);\r\n\r\n this.is3D = true;\r\n }\r\n\r\n /**\r\n * Update the texture with new data\r\n * @param data defines the data to store in the texture\r\n */\r\n public update(data: ArrayBufferView): void {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._getEngine()!.updateRawTexture3D(this._texture, data, this._texture.format, this._texture!.invertY, null, this._texture.type);\r\n }\r\n}\r\n"]}
|