@babylonjs/core 5.53.0 → 5.53.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/Animations/animationGroup.js +8 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +3 -0
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +74 -19
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +2 -5
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGL/webGLHardwareTexture.d.ts +3 -1
- package/Engines/WebGL/webGLHardwareTexture.js +19 -7
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +14 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +76 -6
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +20 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +22 -7
- package/Engines/WebGPU/webgpuConstants.js +24 -8
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +0 -3
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +20 -53
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +3 -2
- package/Engines/WebGPU/webgpuTextureHelper.js +33 -14
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.d.ts +3 -2
- package/Engines/WebGPU/webgpuTintWASM.js +10 -8
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/constants.d.ts +12 -0
- package/Engines/constants.js +12 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +128 -72
- package/Engines/nativeEngine.d.ts +1 -0
- package/Engines/nativeEngine.js +16 -5
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +28 -4
- package/Engines/renderTargetWrapper.js +107 -10
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +6 -6
- package/Engines/thinEngine.js +28 -20
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +25 -8
- package/Engines/webgpuEngine.js +112 -48
- package/Engines/webgpuEngine.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +0 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +3 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +4 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +40 -0
- package/Materials/Textures/multiRenderTarget.js +143 -4
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +4 -0
- package/Materials/Textures/renderTargetTexture.js +10 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +4 -2
- package/Materials/Textures/texture.js +1 -0
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +4 -0
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Misc/interfaces/screenshotSize.d.ts +17 -3
- package/Misc/interfaces/screenshotSize.js.map +1 -1
- package/Misc/screenshotTools.d.ts +2 -2
- package/Misc/screenshotTools.js +49 -9
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/textureTools.d.ts +1 -1
- package/Misc/textureTools.js +4 -2
- package/Misc/textureTools.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.d.ts +5 -0
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js +7 -0
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.d.ts +0 -23
- package/PostProcesses/depthOfFieldMergePostProcess.js +0 -5
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +1 -0
- package/PostProcesses/postProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +1 -0
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +3 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +2 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTextures.js +2 -0
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
- package/Shaders/default.fragment.js +1 -1
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/depthOfFieldMerge.fragment.js +10 -5
- package/Shaders/depthOfFieldMerge.fragment.js.map +1 -1
- package/Shaders/fluidRenderingRender.fragment.js +3 -3
- package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
- package/Shaders/motionBlur.fragment.js +8 -2
- package/Shaders/motionBlur.fragment.js.map +1 -1
- package/Shaders/screenSpaceReflection2.fragment.js +11 -4
- package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
- package/Shaders/screenSpaceReflection2Blur.fragment.js +6 -1
- package/Shaders/screenSpaceReflection2Blur.fragment.js.map +1 -1
- package/Shaders/ssao2.fragment.js +1 -0
- package/Shaders/ssao2.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimation.js +9 -9
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimation.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bonesVertex.js +16 -16
- package/ShadersWGSL/ShadersInclude/bonesVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneFragment.js +6 -6
- package/ShadersWGSL/ShadersInclude/clipPlaneFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertex.js +6 -6
- package/ShadersWGSL/ShadersInclude/clipPlaneVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesVertex.js +1 -1
- package/ShadersWGSL/ShadersInclude/instancesVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +8 -8
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -171,6 +171,10 @@ export declare class InternalTexture extends TextureSampler {
|
|
|
171
171
|
* Gets a boolean indicating if the texture is inverted on Y axis
|
|
172
172
|
*/
|
|
173
173
|
invertY: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Used for debugging purpose only
|
|
176
|
+
*/
|
|
177
|
+
label?: string;
|
|
174
178
|
/** @internal */
|
|
175
179
|
_invertVScale: boolean;
|
|
176
180
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalTexture.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Materials/Textures/internalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;GAEG;AACH,MAAM,CAAN,IAAY,qBA6DX;AA7DD,WAAY,qBAAqB;IAC7B;;OAEG;IACH,uEAAO,CAAA;IACP;;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../types\";\r\nimport type { ICanvas, ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport type { HardwareTextureWrapper } from \"./hardwareTextureWrapper\";\r\nimport { TextureSampler } from \"./textureSampler\";\r\n\r\ndeclare type ThinEngine = import(\"../../Engines/thinEngine\").ThinEngine;\r\ndeclare type BaseTexture = import(\"../../Materials/Textures/baseTexture\").BaseTexture;\r\ndeclare type SphericalPolynomial = import(\"../../Maths/sphericalPolynomial\").SphericalPolynomial;\r\n\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport enum InternalTextureSource {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n Unknown,\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n Url,\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n Temp,\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n Raw,\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n Dynamic,\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n RenderTarget,\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n MultiRenderTarget,\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n Cube,\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n CubeRaw,\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n CubePrefiltered,\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n Raw3D,\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n Raw2DArray,\r\n /**\r\n * Texture content is a depth/stencil texture\r\n */\r\n DepthStencil,\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n CubeRawRGBD,\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n Depth,\r\n}\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nexport class InternalTexture extends TextureSampler {\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n public isReady: boolean = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n public isCube: boolean = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n public is3D: boolean = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n public is2DArray: boolean = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n public isMultiview: boolean = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n public url: string = \"\";\r\n /** @internal */\r\n public _originalUrl: string; // not empty only if different from url\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n public generateMipMaps: boolean = false;\r\n /**\r\n * Gets a boolean indicating if the texture uses mipmaps\r\n * TODO implements useMipMaps as a separate setting from generateMipMaps\r\n */\r\n public get useMipMaps() {\r\n return this.generateMipMaps;\r\n }\r\n public set useMipMaps(value: boolean) {\r\n this.generateMipMaps = value;\r\n }\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n public samples: number = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n public type: number = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n public format: number = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n public onLoadedObservable = new Observable<InternalTexture>();\r\n /**\r\n * Observable called when the texture load is raising an error\r\n */\r\n public onErrorObservable = new Observable<Partial<{ message: string; exception: any }>>();\r\n /**\r\n * If this callback is defined it will be called instead of the default _rebuild function\r\n */\r\n public onRebuildCallback: Nullable<\r\n (internalTexture: InternalTexture) => {\r\n proxy: Nullable<InternalTexture | Promise<InternalTexture>>;\r\n isReady: boolean;\r\n isAsync: boolean;\r\n }\r\n > = null;\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public width: number = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public height: number = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public depth: number = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseWidth: number = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseHeight: number = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseDepth: number = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n public invertY: boolean = false;\r\n\r\n // Private\r\n /** @internal */\r\n public _invertVScale = false;\r\n /** @internal */\r\n public _associatedChannel = -1;\r\n /** @internal */\r\n public _source = InternalTextureSource.Unknown;\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n /** @internal */\r\n public _bufferView: Nullable<ArrayBufferView> = null;\r\n /** @internal */\r\n public _bufferViewArray: Nullable<ArrayBufferView[]> = null;\r\n /** @internal */\r\n public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;\r\n /** @internal */\r\n public _size: number = 0;\r\n /** @internal */\r\n public _extension: string = \"\";\r\n /** @internal */\r\n public _files: Nullable<string[]> = null;\r\n /** @internal */\r\n public _workingCanvas: Nullable<ICanvas> = null;\r\n /** @internal */\r\n public _workingContext: Nullable<ICanvasRenderingContext> = null;\r\n /** @internal */\r\n public _cachedCoordinatesMode: Nullable<number> = null;\r\n /** @internal */\r\n public _isDisabled: boolean = false;\r\n /** @internal */\r\n public _compression: Nullable<string> = null;\r\n /** @internal */\r\n public _sphericalPolynomial: Nullable<SphericalPolynomial> = null;\r\n /** @internal */\r\n public _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>> = null;\r\n /** @internal */\r\n public _sphericalPolynomialComputed = false;\r\n /** @internal */\r\n public _lodGenerationScale: number = 0;\r\n /** @internal */\r\n public _lodGenerationOffset: number = 0;\r\n /** @internal */\r\n public _useSRGBBuffer: boolean = false;\r\n\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @internal */\r\n public _lodTextureHigh: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureMid: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureLow: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _isRGBD: boolean = false;\r\n\r\n /** @internal */\r\n public _linearSpecularLOD: boolean = false;\r\n /** @internal */\r\n public _irradianceTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n public _hardwareTexture: Nullable<HardwareTextureWrapper> = null;\r\n\r\n /** @internal */\r\n public _maxLodLevel: Nullable<number> = null;\r\n\r\n /** @internal */\r\n public _references: number = 1;\r\n\r\n /** @internal */\r\n public _gammaSpace: Nullable<boolean> = null;\r\n\r\n private _engine: ThinEngine;\r\n private _uniqueId: number;\r\n\r\n /** @internal */\r\n public static _Counter = 0;\r\n\r\n /** Gets the unique id of the internal texture */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /** @internal */\r\n public _setUniqueId(id: number) {\r\n this._uniqueId = id;\r\n }\r\n\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n public getEngine(): ThinEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n public get source(): InternalTextureSource {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n constructor(engine: ThinEngine, source: InternalTextureSource, delayAllocation = false) {\r\n super();\r\n\r\n this._engine = engine;\r\n this._source = source;\r\n this._uniqueId = InternalTexture._Counter++;\r\n\r\n if (!delayAllocation) {\r\n this._hardwareTexture = engine._createHardwareTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n public incrementReferences(): void {\r\n this._references++;\r\n }\r\n\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n public updateSize(width: int, height: int, depth: int = 1): void {\r\n this._engine.updateTextureDimensions(this, width, height, depth);\r\n\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n\r\n this._size = width * height * depth;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedWrapR = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n if (this.onRebuildCallback) {\r\n const data = this.onRebuildCallback(this);\r\n const swapAndSetIsReady = (proxyInternalTexture: InternalTexture) => {\r\n proxyInternalTexture._swapAndDie(this, false);\r\n this.isReady = data.isReady;\r\n };\r\n if (data.isAsync) {\r\n (data.proxy as Promise<InternalTexture>).then(swapAndSetIsReady);\r\n } else {\r\n swapAndSetIsReady(data.proxy as InternalTexture);\r\n }\r\n return;\r\n }\r\n\r\n let proxy: InternalTexture;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n break;\r\n\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(\r\n this._originalUrl ?? this.url,\r\n !this.generateMipMaps,\r\n this.invertY,\r\n null,\r\n this.samplingMode,\r\n // Do not use Proxy here as it could be fully synchronous\r\n // and proxy would be undefined.\r\n (temp) => {\r\n temp._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this._buffer,\r\n undefined,\r\n this.format,\r\n this._extension,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this, false);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas()!, this.invertY, undefined, undefined, true);\r\n\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n break;\r\n\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(\r\n this.url,\r\n null,\r\n this._files,\r\n !this.generateMipMaps,\r\n () => {\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension,\r\n false,\r\n 0,\r\n 0,\r\n null,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(\r\n this._bufferViewArray!,\r\n this.width,\r\n this.format,\r\n this.type,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression\r\n );\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.CubeRawRGBD:\r\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\r\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\r\n return;\r\n\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(\r\n this.url,\r\n null,\r\n this._lodGenerationScale,\r\n this._lodGenerationOffset,\r\n (proxy) => {\r\n if (proxy) {\r\n proxy._swapAndDie(this, false);\r\n }\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension\r\n );\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture, swapAll = true): void {\r\n // TODO what about refcount on target?\r\n\r\n this._hardwareTexture?.setUsage(target._source, this.generateMipMaps, this.isCube, this.width, this.height);\r\n\r\n target._hardwareTexture = this._hardwareTexture;\r\n if (swapAll) {\r\n target._isRGBD = this._isRGBD;\r\n }\r\n\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n\r\n const cache = this._engine.getLoadedTexturesCache();\r\n let index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n\r\n index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n public dispose(): void {\r\n this._references--;\r\n this.onLoadedObservable.clear();\r\n this.onErrorObservable.clear();\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._hardwareTexture = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"internalTexture.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Materials/Textures/internalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;GAEG;AACH,MAAM,CAAN,IAAY,qBA6DX;AA7DD,WAAY,qBAAqB;IAC7B;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,iFAAY,CAAA;IACZ;;OAEG;IACH,2FAAiB,CAAA;IACjB;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,uFAAe,CAAA;IACf;;OAEG;IACH,oEAAK,CAAA;IACL;;OAEG;IACH,8EAAU,CAAA;IACV;;OAEG;IACH,kFAAY,CAAA;IACZ;;OAEG;IACH,gFAAW,CAAA;IACX;;OAEG;IACH,oEAAK,CAAA;AACT,CAAC,EA7DW,qBAAqB,KAArB,qBAAqB,QA6DhC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IA+B/C;;;OAGG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IACD,IAAW,UAAU,CAAC,KAAc;QAChC,IAAI,CAAC,eAAe,GA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C,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACtB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;SAChC;IACL,CAAC;;AA3TD,gBAAgB;AACF,wBAAQ,GAAG,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable, int } from \"../../types\";\r\nimport type { ICanvas, ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport type { HardwareTextureWrapper } from \"./hardwareTextureWrapper\";\r\nimport { TextureSampler } from \"./textureSampler\";\r\n\r\ndeclare type ThinEngine = import(\"../../Engines/thinEngine\").ThinEngine;\r\ndeclare type BaseTexture = import(\"../../Materials/Textures/baseTexture\").BaseTexture;\r\ndeclare type SphericalPolynomial = import(\"../../Maths/sphericalPolynomial\").SphericalPolynomial;\r\n\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport enum InternalTextureSource {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n Unknown,\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n Url,\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n Temp,\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n Raw,\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n Dynamic,\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n RenderTarget,\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n MultiRenderTarget,\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n Cube,\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n CubeRaw,\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n CubePrefiltered,\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n Raw3D,\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n Raw2DArray,\r\n /**\r\n * Texture content is a depth/stencil texture\r\n */\r\n DepthStencil,\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n CubeRawRGBD,\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n Depth,\r\n}\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nexport class InternalTexture extends TextureSampler {\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n public isReady: boolean = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n public isCube: boolean = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n public is3D: boolean = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n public is2DArray: boolean = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n public isMultiview: boolean = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n public url: string = \"\";\r\n /** @internal */\r\n public _originalUrl: string; // not empty only if different from url\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n public generateMipMaps: boolean = false;\r\n /**\r\n * Gets a boolean indicating if the texture uses mipmaps\r\n * TODO implements useMipMaps as a separate setting from generateMipMaps\r\n */\r\n public get useMipMaps() {\r\n return this.generateMipMaps;\r\n }\r\n public set useMipMaps(value: boolean) {\r\n this.generateMipMaps = value;\r\n }\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n public samples: number = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n public type: number = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n public format: number = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n public onLoadedObservable = new Observable<InternalTexture>();\r\n /**\r\n * Observable called when the texture load is raising an error\r\n */\r\n public onErrorObservable = new Observable<Partial<{ message: string; exception: any }>>();\r\n /**\r\n * If this callback is defined it will be called instead of the default _rebuild function\r\n */\r\n public onRebuildCallback: Nullable<\r\n (internalTexture: InternalTexture) => {\r\n proxy: Nullable<InternalTexture | Promise<InternalTexture>>;\r\n isReady: boolean;\r\n isAsync: boolean;\r\n }\r\n > = null;\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public width: number = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public height: number = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public depth: number = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseWidth: number = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseHeight: number = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseDepth: number = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n public invertY: boolean = false;\r\n /**\r\n * Used for debugging purpose only\r\n */\r\n public label?: string;\r\n\r\n // Private\r\n /** @internal */\r\n public _invertVScale = false;\r\n /** @internal */\r\n public _associatedChannel = -1;\r\n /** @internal */\r\n public _source = InternalTextureSource.Unknown;\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n /** @internal */\r\n public _bufferView: Nullable<ArrayBufferView> = null;\r\n /** @internal */\r\n public _bufferViewArray: Nullable<ArrayBufferView[]> = null;\r\n /** @internal */\r\n public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;\r\n /** @internal */\r\n public _size: number = 0;\r\n /** @internal */\r\n public _extension: string = \"\";\r\n /** @internal */\r\n public _files: Nullable<string[]> = null;\r\n /** @internal */\r\n public _workingCanvas: Nullable<ICanvas> = null;\r\n /** @internal */\r\n public _workingContext: Nullable<ICanvasRenderingContext> = null;\r\n /** @internal */\r\n public _cachedCoordinatesMode: Nullable<number> = null;\r\n /** @internal */\r\n public _isDisabled: boolean = false;\r\n /** @internal */\r\n public _compression: Nullable<string> = null;\r\n /** @internal */\r\n public _sphericalPolynomial: Nullable<SphericalPolynomial> = null;\r\n /** @internal */\r\n public _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>> = null;\r\n /** @internal */\r\n public _sphericalPolynomialComputed = false;\r\n /** @internal */\r\n public _lodGenerationScale: number = 0;\r\n /** @internal */\r\n public _lodGenerationOffset: number = 0;\r\n /** @internal */\r\n public _useSRGBBuffer: boolean = false;\r\n\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @internal */\r\n public _lodTextureHigh: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureMid: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureLow: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _isRGBD: boolean = false;\r\n\r\n /** @internal */\r\n public _linearSpecularLOD: boolean = false;\r\n /** @internal */\r\n public _irradianceTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n public _hardwareTexture: Nullable<HardwareTextureWrapper> = null;\r\n\r\n /** @internal */\r\n public _maxLodLevel: Nullable<number> = null;\r\n\r\n /** @internal */\r\n public _references: number = 1;\r\n\r\n /** @internal */\r\n public _gammaSpace: Nullable<boolean> = null;\r\n\r\n private _engine: ThinEngine;\r\n private _uniqueId: number;\r\n\r\n /** @internal */\r\n public static _Counter = 0;\r\n\r\n /** Gets the unique id of the internal texture */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /** @internal */\r\n public _setUniqueId(id: number) {\r\n this._uniqueId = id;\r\n }\r\n\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n public getEngine(): ThinEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n public get source(): InternalTextureSource {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n constructor(engine: ThinEngine, source: InternalTextureSource, delayAllocation = false) {\r\n super();\r\n\r\n this._engine = engine;\r\n this._source = source;\r\n this._uniqueId = InternalTexture._Counter++;\r\n\r\n if (!delayAllocation) {\r\n this._hardwareTexture = engine._createHardwareTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n public incrementReferences(): void {\r\n this._references++;\r\n }\r\n\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n public updateSize(width: int, height: int, depth: int = 1): void {\r\n this._engine.updateTextureDimensions(this, width, height, depth);\r\n\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n\r\n this._size = width * height * depth;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedWrapR = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n if (this.onRebuildCallback) {\r\n const data = this.onRebuildCallback(this);\r\n const swapAndSetIsReady = (proxyInternalTexture: InternalTexture) => {\r\n proxyInternalTexture._swapAndDie(this, false);\r\n this.isReady = data.isReady;\r\n };\r\n if (data.isAsync) {\r\n (data.proxy as Promise<InternalTexture>).then(swapAndSetIsReady);\r\n } else {\r\n swapAndSetIsReady(data.proxy as InternalTexture);\r\n }\r\n return;\r\n }\r\n\r\n let proxy: InternalTexture;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n break;\r\n\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(\r\n this._originalUrl ?? this.url,\r\n !this.generateMipMaps,\r\n this.invertY,\r\n null,\r\n this.samplingMode,\r\n // Do not use Proxy here as it could be fully synchronous\r\n // and proxy would be undefined.\r\n (temp) => {\r\n temp._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this._buffer,\r\n undefined,\r\n this.format,\r\n this._extension,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this, false);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas()!, this.invertY, undefined, undefined, true);\r\n\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n break;\r\n\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(\r\n this.url,\r\n null,\r\n this._files,\r\n !this.generateMipMaps,\r\n () => {\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension,\r\n false,\r\n 0,\r\n 0,\r\n null,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(\r\n this._bufferViewArray!,\r\n this.width,\r\n this.format,\r\n this.type,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression\r\n );\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.CubeRawRGBD:\r\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\r\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\r\n return;\r\n\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(\r\n this.url,\r\n null,\r\n this._lodGenerationScale,\r\n this._lodGenerationOffset,\r\n (proxy) => {\r\n if (proxy) {\r\n proxy._swapAndDie(this, false);\r\n }\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension\r\n );\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture, swapAll = true): void {\r\n // TODO what about refcount on target?\r\n\r\n this._hardwareTexture?.setUsage(target._source, this.generateMipMaps, this.isCube, this.width, this.height);\r\n\r\n target._hardwareTexture = this._hardwareTexture;\r\n if (swapAll) {\r\n target._isRGBD = this._isRGBD;\r\n }\r\n\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n\r\n const cache = this._engine.getLoadedTexturesCache();\r\n let index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n\r\n index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n public dispose(): void {\r\n this._references--;\r\n this.onLoadedObservable.clear();\r\n this.onErrorObservable.clear();\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._hardwareTexture = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -36,6 +36,10 @@ export interface IMultiRenderTargetOptions {
|
|
|
36
36
|
* Define if a depth texture is required instead of a depth buffer
|
|
37
37
|
*/
|
|
38
38
|
generateDepthTexture?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Define the internal format of the buffer in the RTT (RED, RG, RGB, RGBA (default), ALPHA...) of all the draw buffers we want to create
|
|
41
|
+
*/
|
|
42
|
+
formats?: number[];
|
|
39
43
|
/**
|
|
40
44
|
* Define depth texture format to use
|
|
41
45
|
*/
|
|
@@ -56,6 +60,27 @@ export interface IMultiRenderTargetOptions {
|
|
|
56
60
|
* Define the default type of the buffers we are creating
|
|
57
61
|
*/
|
|
58
62
|
drawOnlyOnFirstAttachmentByDefault?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 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).
|
|
65
|
+
* 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.
|
|
66
|
+
* 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
|
|
67
|
+
* method for that purpose, after the MultiRenderTarget has been created.
|
|
68
|
+
*/
|
|
69
|
+
targetTypes?: number[];
|
|
70
|
+
/**
|
|
71
|
+
* 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).
|
|
72
|
+
* Can be changed at any time by calling setLayerAndFaceIndices or setLayerAndFaceIndex
|
|
73
|
+
*/
|
|
74
|
+
faceIndex?: number[];
|
|
75
|
+
/**
|
|
76
|
+
* 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).
|
|
77
|
+
* Can be changed at any time by calling setLayerAndFaceIndices or setLayerAndFaceIndex
|
|
78
|
+
*/
|
|
79
|
+
layerIndex?: number[];
|
|
80
|
+
/**
|
|
81
|
+
* 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)
|
|
82
|
+
*/
|
|
83
|
+
layerCounts?: number[];
|
|
59
84
|
}
|
|
60
85
|
/**
|
|
61
86
|
* A multi render target, like a render target provides the ability to render to a texture.
|
|
@@ -68,6 +93,7 @@ export declare class MultiRenderTarget extends RenderTargetTexture {
|
|
|
68
93
|
private _multiRenderTargetOptions;
|
|
69
94
|
private _count;
|
|
70
95
|
private _drawOnlyOnFirstAttachmentByDefault;
|
|
96
|
+
private _textureNames?;
|
|
71
97
|
/**
|
|
72
98
|
* Get if draw buffers are currently supported by the used hardware and browser.
|
|
73
99
|
*/
|
|
@@ -109,6 +135,7 @@ export declare class MultiRenderTarget extends RenderTargetTexture {
|
|
|
109
135
|
*/
|
|
110
136
|
constructor(name: string, size: any, count: number, scene?: Scene, options?: IMultiRenderTargetOptions, textureNames?: string[]);
|
|
111
137
|
private _initTypes;
|
|
138
|
+
private _createInternaTextureIndexMapping;
|
|
112
139
|
/**
|
|
113
140
|
* @internal
|
|
114
141
|
*/
|
|
@@ -123,6 +150,19 @@ export declare class MultiRenderTarget extends RenderTargetTexture {
|
|
|
123
150
|
* @param disposePrevious Set to true if the previous internal texture should be disposed
|
|
124
151
|
*/
|
|
125
152
|
setInternalTexture(texture: InternalTexture, index: number, disposePrevious?: boolean): void;
|
|
153
|
+
/**
|
|
154
|
+
* Changes an attached texture's face index or layer.
|
|
155
|
+
* @param index The index of the texture to modify the attachment of
|
|
156
|
+
* @param layerIndex The layer index of the texture to be attached to the framebuffer
|
|
157
|
+
* @param faceIndex The face index of the texture to be attached to the framebuffer
|
|
158
|
+
*/
|
|
159
|
+
setLayerAndFaceIndex(index: number, layerIndex?: number, faceIndex?: number): void;
|
|
160
|
+
/**
|
|
161
|
+
* Changes every attached texture's face index or layer.
|
|
162
|
+
* @param layerIndices The layer indices of the texture to be attached to the framebuffer
|
|
163
|
+
* @param faceIndices The face indices of the texture to be attached to the framebuffer
|
|
164
|
+
*/
|
|
165
|
+
setLayerAndFaceIndices(layerIndices: number[], faceIndices: number[]): void;
|
|
126
166
|
/**
|
|
127
167
|
* Define the number of samples used if MSAA is enabled.
|
|
128
168
|
*/
|
|
@@ -80,10 +80,16 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
80
80
|
this.dispose();
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
+
this._textureNames = textureNames;
|
|
83
84
|
const types = [];
|
|
84
85
|
const samplingModes = [];
|
|
85
86
|
const useSRGBBuffers = [];
|
|
86
|
-
|
|
87
|
+
const formats = [];
|
|
88
|
+
const targetTypes = [];
|
|
89
|
+
const faceIndex = [];
|
|
90
|
+
const layerIndex = [];
|
|
91
|
+
const layerCounts = [];
|
|
92
|
+
this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);
|
|
87
93
|
const generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;
|
|
88
94
|
const generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;
|
|
89
95
|
this._size = size;
|
|
@@ -97,6 +103,11 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
97
103
|
types: types,
|
|
98
104
|
textureCount: count,
|
|
99
105
|
useSRGBBuffers: useSRGBBuffers,
|
|
106
|
+
formats: formats,
|
|
107
|
+
targetTypes: targetTypes,
|
|
108
|
+
faceIndex: faceIndex,
|
|
109
|
+
layerIndex: layerIndex,
|
|
110
|
+
layerCounts: layerCounts,
|
|
100
111
|
};
|
|
101
112
|
this._count = count;
|
|
102
113
|
this._drawOnlyOnFirstAttachmentByDefault = drawOnlyOnFirstAttachmentByDefault;
|
|
@@ -105,7 +116,7 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
105
116
|
this._createTextures(textureNames);
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
|
-
_initTypes(count, types, samplingModes, useSRGBBuffers, options) {
|
|
119
|
+
_initTypes(count, types, samplingModes, useSRGBBuffers, formats, targets, faceIndex, layerIndex, layerCounts, options) {
|
|
109
120
|
for (let i = 0; i < count; i++) {
|
|
110
121
|
if (options && options.types && options.types[i] !== undefined) {
|
|
111
122
|
types.push(options.types[i]);
|
|
@@ -125,7 +136,59 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
125
136
|
else {
|
|
126
137
|
useSRGBBuffers.push(false);
|
|
127
138
|
}
|
|
139
|
+
if (options && options.formats && options.formats[i] !== undefined) {
|
|
140
|
+
formats.push(options.formats[i]);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
formats.push(5);
|
|
144
|
+
}
|
|
145
|
+
if (options && options.targetTypes && options.targetTypes[i] !== undefined) {
|
|
146
|
+
targets.push(options.targetTypes[i]);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
targets.push(3553);
|
|
150
|
+
}
|
|
151
|
+
if (options && options.faceIndex && options.faceIndex[i] !== undefined) {
|
|
152
|
+
faceIndex.push(options.faceIndex[i]);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
faceIndex.push(0);
|
|
156
|
+
}
|
|
157
|
+
if (options && options.layerIndex && options.layerIndex[i] !== undefined) {
|
|
158
|
+
layerIndex.push(options.layerIndex[i]);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
layerIndex.push(0);
|
|
162
|
+
}
|
|
163
|
+
if (options && options.layerCounts && options.layerCounts[i] !== undefined) {
|
|
164
|
+
layerCounts.push(options.layerCounts[i]);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
layerCounts.push(1);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
_createInternaTextureIndexMapping() {
|
|
172
|
+
const mapMainInternalTexture2Index = {};
|
|
173
|
+
const mapInternalTexture2MainIndex = [];
|
|
174
|
+
if (!this._renderTarget) {
|
|
175
|
+
return mapInternalTexture2MainIndex;
|
|
176
|
+
}
|
|
177
|
+
const internalTextures = this._renderTarget.textures;
|
|
178
|
+
for (let i = 0; i < internalTextures.length; i++) {
|
|
179
|
+
const texture = internalTextures[i];
|
|
180
|
+
if (!texture) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const mainIndex = mapMainInternalTexture2Index[texture.uniqueId];
|
|
184
|
+
if (mainIndex !== undefined) {
|
|
185
|
+
mapInternalTexture2MainIndex[i] = mainIndex;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
mapMainInternalTexture2Index[texture.uniqueId] = i;
|
|
189
|
+
}
|
|
128
190
|
}
|
|
191
|
+
return mapInternalTexture2MainIndex;
|
|
129
192
|
}
|
|
130
193
|
/**
|
|
131
194
|
* @internal
|
|
@@ -134,6 +197,7 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
134
197
|
if (this._count < 1) {
|
|
135
198
|
return;
|
|
136
199
|
}
|
|
200
|
+
const mapInternalTexture2MainIndex = this._createInternaTextureIndexMapping();
|
|
137
201
|
this.releaseInternalTextures();
|
|
138
202
|
this._createInternalTextures();
|
|
139
203
|
if (forceFullRebuild) {
|
|
@@ -143,7 +207,14 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
143
207
|
const internalTextures = this._renderTarget.textures;
|
|
144
208
|
for (let i = 0; i < internalTextures.length; i++) {
|
|
145
209
|
const texture = this._textures[i];
|
|
210
|
+
if (mapInternalTexture2MainIndex[i] !== undefined) {
|
|
211
|
+
this._renderTarget.setTexture(internalTextures[mapInternalTexture2MainIndex[i]], i);
|
|
212
|
+
}
|
|
146
213
|
texture._texture = internalTextures[i];
|
|
214
|
+
if (texture._texture) {
|
|
215
|
+
texture._noMipmap = !texture._texture.useMipMaps;
|
|
216
|
+
texture._useSRGBBuffer = texture._texture._useSRGBBuffer;
|
|
217
|
+
}
|
|
147
218
|
}
|
|
148
219
|
if (this.samples !== 1) {
|
|
149
220
|
this._renderTarget.setSamples(this.samples, !this._drawOnlyOnFirstAttachmentByDefault, true);
|
|
@@ -170,6 +241,10 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
170
241
|
texture.name = textureNames[i];
|
|
171
242
|
}
|
|
172
243
|
texture._texture = internalTextures[i];
|
|
244
|
+
if (texture._texture) {
|
|
245
|
+
texture._noMipmap = !texture._texture.useMipMaps;
|
|
246
|
+
texture._useSRGBBuffer = texture._texture._useSRGBBuffer;
|
|
247
|
+
}
|
|
173
248
|
this._textures.push(texture);
|
|
174
249
|
}
|
|
175
250
|
}
|
|
@@ -180,6 +255,7 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
180
255
|
* @param disposePrevious Set to true if the previous internal texture should be disposed
|
|
181
256
|
*/
|
|
182
257
|
setInternalTexture(texture, index, disposePrevious = true) {
|
|
258
|
+
var _a, _b;
|
|
183
259
|
if (!this.renderTarget) {
|
|
184
260
|
return;
|
|
185
261
|
}
|
|
@@ -189,8 +265,11 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
189
265
|
this.renderTarget.setTexture(texture, index, disposePrevious);
|
|
190
266
|
if (!this.textures[index]) {
|
|
191
267
|
this.textures[index] = new Texture(null, this.getScene());
|
|
268
|
+
this.textures[index].name = (_b = (_a = this._textureNames) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : this.textures[index].name;
|
|
192
269
|
}
|
|
193
270
|
this.textures[index]._texture = texture;
|
|
271
|
+
this.textures[index]._noMipmap = !texture.useMipMaps;
|
|
272
|
+
this.textures[index]._useSRGBBuffer = texture._useSRGBBuffer;
|
|
194
273
|
this._count = this.renderTarget.textures ? this.renderTarget.textures.length : 0;
|
|
195
274
|
if (this._multiRenderTargetOptions.types) {
|
|
196
275
|
this._multiRenderTargetOptions.types[index] = texture.type;
|
|
@@ -201,6 +280,55 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
201
280
|
if (this._multiRenderTargetOptions.useSRGBBuffers) {
|
|
202
281
|
this._multiRenderTargetOptions.useSRGBBuffers[index] = texture._useSRGBBuffer;
|
|
203
282
|
}
|
|
283
|
+
if (this._multiRenderTargetOptions.targetTypes && this._multiRenderTargetOptions.targetTypes[index] !== -1) {
|
|
284
|
+
let target = 0;
|
|
285
|
+
if (texture.is2DArray) {
|
|
286
|
+
target = 35866;
|
|
287
|
+
}
|
|
288
|
+
else if (texture.isCube) {
|
|
289
|
+
target = 34067;
|
|
290
|
+
} /*else if (texture.isCubeArray) {
|
|
291
|
+
target = 3735928559;
|
|
292
|
+
}*/
|
|
293
|
+
else if (texture.is3D) {
|
|
294
|
+
target = 32879;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
target = 3553;
|
|
298
|
+
}
|
|
299
|
+
this._multiRenderTargetOptions.targetTypes[index] = target;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Changes an attached texture's face index or layer.
|
|
304
|
+
* @param index The index of the texture to modify the attachment of
|
|
305
|
+
* @param layerIndex The layer index of the texture to be attached to the framebuffer
|
|
306
|
+
* @param faceIndex The face index of the texture to be attached to the framebuffer
|
|
307
|
+
*/
|
|
308
|
+
setLayerAndFaceIndex(index, layerIndex = -1, faceIndex = -1) {
|
|
309
|
+
if (!this.textures[index] || !this.renderTarget) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (this._multiRenderTargetOptions.layerIndex) {
|
|
313
|
+
this._multiRenderTargetOptions.layerIndex[index] = layerIndex;
|
|
314
|
+
}
|
|
315
|
+
if (this._multiRenderTargetOptions.faceIndex) {
|
|
316
|
+
this._multiRenderTargetOptions.faceIndex[index] = faceIndex;
|
|
317
|
+
}
|
|
318
|
+
this.renderTarget.setLayerAndFaceIndex(index, layerIndex, faceIndex);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Changes every attached texture's face index or layer.
|
|
322
|
+
* @param layerIndices The layer indices of the texture to be attached to the framebuffer
|
|
323
|
+
* @param faceIndices The face indices of the texture to be attached to the framebuffer
|
|
324
|
+
*/
|
|
325
|
+
setLayerAndFaceIndices(layerIndices, faceIndices) {
|
|
326
|
+
if (!this.renderTarget) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
this._multiRenderTargetOptions.layerIndex = layerIndices;
|
|
330
|
+
this._multiRenderTargetOptions.faceIndex = faceIndices;
|
|
331
|
+
this.renderTarget.setLayerAndFaceIndices(layerIndices, faceIndices);
|
|
204
332
|
}
|
|
205
333
|
/**
|
|
206
334
|
* Define the number of samples used if MSAA is enabled.
|
|
@@ -224,7 +352,7 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
224
352
|
*/
|
|
225
353
|
resize(size) {
|
|
226
354
|
this._size = size;
|
|
227
|
-
this._rebuild();
|
|
355
|
+
this._rebuild(undefined, this._textureNames);
|
|
228
356
|
}
|
|
229
357
|
/**
|
|
230
358
|
* Changes the number of render targets in this MRT
|
|
@@ -239,10 +367,21 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
239
367
|
const types = [];
|
|
240
368
|
const samplingModes = [];
|
|
241
369
|
const useSRGBBuffers = [];
|
|
242
|
-
|
|
370
|
+
const formats = [];
|
|
371
|
+
const targetTypes = [];
|
|
372
|
+
const faceIndex = [];
|
|
373
|
+
const layerIndex = [];
|
|
374
|
+
const layerCounts = [];
|
|
375
|
+
this._textureNames = textureNames;
|
|
376
|
+
this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);
|
|
243
377
|
this._multiRenderTargetOptions.types = types;
|
|
244
378
|
this._multiRenderTargetOptions.samplingModes = samplingModes;
|
|
245
379
|
this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;
|
|
380
|
+
this._multiRenderTargetOptions.formats = formats;
|
|
381
|
+
this._multiRenderTargetOptions.targetTypes = targetTypes;
|
|
382
|
+
this._multiRenderTargetOptions.faceIndex = faceIndex;
|
|
383
|
+
this._multiRenderTargetOptions.layerIndex = layerIndex;
|
|
384
|
+
this._multiRenderTargetOptions.layerCounts = layerCounts;
|
|
246
385
|
this._rebuild(true, textureNames);
|
|
247
386
|
}
|
|
248
387
|
_unbindFrameBuffer(engine, faceIndex) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiRenderTarget.js","sourceRoot":"","sources":["../../../../../lts/core/generated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C;IACtC,CAAC;IAES,kBAAkB,CAAC,MAAc,EAAE,SAAiB;QAC1D,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,MAAM,CAAC,qCAAqC,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;gBAC/E,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,4BAA4B,GAAG,KAAK;QAC/C,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,4BAA4B,EAAE;YAC/B,IAAI,CAAC,uBAAuB,EAAE,CAAC;SAClC;aAAM;YACH,oDAAoD;YACpD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACxB;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,uBAAuB;;QAC1B,MAAM,gBAAgB,GAAG,MAAA,IAAI,CAAC,aAAa,0CAAE,QAAQ,CAAC;QAEtD,IAAI,CAAC,gBAAgB,EAAE;YACnB,OAAO;SACV;QAED,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YACnD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC;SACrC;QAED,MAAA,IAAI,CAAC,aAAa,0CAAE,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 * Define if the texture needs to create mip maps after render.\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Define the types of all the draw buffers we want to create\r\n */\r\n types?: number[];\r\n /**\r\n * Define the sampling modes of all the draw buffers 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 we want to create\r\n */\r\n useSRGBBuffers?: boolean[];\r\n /**\r\n * Define if a depth buffer is required\r\n */\r\n generateDepthBuffer?: boolean;\r\n /**\r\n * Define if a stencil buffer is required\r\n */\r\n generateStencilBuffer?: boolean;\r\n /**\r\n * Define if a depth texture is required instead of a depth buffer\r\n */\r\n generateDepthTexture?: boolean;\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\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\r\n */\r\n doNotChangeAspectRatio?: boolean;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n defaultType?: number;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n drawOnlyOnFirstAttachmentByDefault?: 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 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\r\n /**\r\n * Get if draw buffers 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 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 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 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 const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, 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\r\n this._size = size;\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 };\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(count: number, types: number[], samplingModes: number[], useSRGBBuffers: boolean[], options?: IMultiRenderTargetOptions) {\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 }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _rebuild(forceFullRebuild: boolean = false, textureNames?: string[]): void {\r\n if (this._count < 1) {\r\n return;\r\n }\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 texture._texture = internalTextures[i];\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 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 }\r\n this.textures[index]._texture = texture;\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 }\r\n\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n public get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n public 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 resize(size: any) {\r\n this._size = size;\r\n this._rebuild();\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\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, options);\r\n this._multiRenderTargetOptions.types = types;\r\n this._multiRenderTargetOptions.samplingModes = samplingModes;\r\n this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;\r\n this._rebuild(true, textureNames);\r\n }\r\n\r\n protected _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\r\n */\r\n public 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.\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":["../../../../../lts/core/generated/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;AAkFrD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ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,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 * Define if the texture needs to create mip maps after render.\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Define the types of all the draw buffers we want to create\r\n */\r\n types?: number[];\r\n /**\r\n * Define the sampling modes of all the draw buffers 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 we want to create\r\n */\r\n useSRGBBuffers?: boolean[];\r\n /**\r\n * Define if a depth buffer is required\r\n */\r\n generateDepthBuffer?: boolean;\r\n /**\r\n * Define if a stencil buffer is required\r\n */\r\n generateStencilBuffer?: boolean;\r\n /**\r\n * Define if a depth texture is required instead of a depth buffer\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 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\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\r\n */\r\n doNotChangeAspectRatio?: boolean;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n defaultType?: number;\r\n /**\r\n * Define the default type of the buffers we are creating\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\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 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 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 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 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 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\r\n this._size = size;\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 formats: formats,\r\n targetTypes: targetTypes,\r\n faceIndex: faceIndex,\r\n layerIndex: layerIndex,\r\n layerCounts: layerCounts,\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 _rebuild(forceFullRebuild: boolean = false, textureNames?: string[]): void {\r\n if (this._count < 1) {\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 get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n public 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 resize(size: any) {\r\n this._size = size;\r\n this._rebuild(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\r\n this._rebuild(true, textureNames);\r\n }\r\n\r\n protected _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\r\n */\r\n public 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.\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"]}
|
|
@@ -234,6 +234,10 @@ export declare class RenderTargetTexture extends Texture implements IRenderTarge
|
|
|
234
234
|
*/
|
|
235
235
|
setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material | Material[]): void;
|
|
236
236
|
private _isCubeData;
|
|
237
|
+
/**
|
|
238
|
+
* Define if the texture has multiple draw buffers or if false a single draw buffer.
|
|
239
|
+
*/
|
|
240
|
+
get isMulti(): boolean;
|
|
237
241
|
/**
|
|
238
242
|
* Gets render target creation options that were used.
|
|
239
243
|
*/
|