@babylonjs/core 5.35.0 → 5.35.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/Engines/Extensions/engine.renderTarget.js +15 -15
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.d.ts +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Native/nativeHardwareTexture.d.ts +14 -0
- package/Engines/Native/nativeHardwareTexture.js +24 -0
- package/Engines/Native/nativeHardwareTexture.js.map +1 -0
- package/Engines/Native/nativeInterfaces.d.ts +22 -15
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativePipelineContext.d.ts +252 -0
- package/Engines/Native/nativePipelineContext.js +502 -0
- package/Engines/Native/nativePipelineContext.js.map +1 -0
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +16 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +33 -0
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -0
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/engine.d.ts +1 -0
- package/Engines/engine.js +24 -18
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +18 -17
- package/Engines/nativeEngine.js +100 -598
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +1 -1
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.js +41 -38
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +53 -3
- package/Materials/Textures/renderTargetTexture.js +25 -25
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +4 -1
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,19 +11,19 @@ ThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti, isC
|
|
|
11
11
|
ThinEngine.prototype.createRenderTargetTexture = function (size, options) {
|
|
12
12
|
var _a;
|
|
13
13
|
const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size);
|
|
14
|
-
|
|
14
|
+
let generateDepthBuffer = true;
|
|
15
|
+
let generateStencilBuffer = false;
|
|
16
|
+
let noColorAttachment = false;
|
|
17
|
+
let colorAttachment = undefined;
|
|
18
|
+
let samples = 1;
|
|
15
19
|
if (options !== undefined && typeof options === "object") {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
generateDepthBuffer = !!options.generateDepthBuffer;
|
|
21
|
+
generateStencilBuffer = !!options.generateStencilBuffer;
|
|
22
|
+
noColorAttachment = !!options.noColorAttachment;
|
|
23
|
+
colorAttachment = options.colorAttachment;
|
|
24
|
+
samples = (_a = options.samples) !== null && _a !== void 0 ? _a : 1;
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
fullOptions.generateDepthBuffer = true;
|
|
23
|
-
fullOptions.generateStencilBuffer = false;
|
|
24
|
-
fullOptions.noColorTarget = false;
|
|
25
|
-
}
|
|
26
|
-
const texture = fullOptions.noColorTarget ? null : this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget);
|
|
26
|
+
const texture = colorAttachment || (noColorAttachment ? null : this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget));
|
|
27
27
|
const width = size.width || size;
|
|
28
28
|
const height = size.height || size;
|
|
29
29
|
const currentFrameBuffer = this._currentFramebuffer;
|
|
@@ -31,17 +31,17 @@ ThinEngine.prototype.createRenderTargetTexture = function (size, options) {
|
|
|
31
31
|
// Create the framebuffer
|
|
32
32
|
const framebuffer = gl.createFramebuffer();
|
|
33
33
|
this._bindUnboundFramebuffer(framebuffer);
|
|
34
|
-
rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(
|
|
34
|
+
rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);
|
|
35
35
|
// No need to rebind on every frame
|
|
36
36
|
if (texture && !texture.is2DArray) {
|
|
37
37
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, 0);
|
|
38
38
|
}
|
|
39
39
|
this._bindUnboundFramebuffer(currentFrameBuffer);
|
|
40
40
|
rtWrapper._framebuffer = framebuffer;
|
|
41
|
-
rtWrapper._generateDepthBuffer =
|
|
42
|
-
rtWrapper._generateStencilBuffer =
|
|
41
|
+
rtWrapper._generateDepthBuffer = generateDepthBuffer;
|
|
42
|
+
rtWrapper._generateStencilBuffer = generateStencilBuffer;
|
|
43
43
|
rtWrapper.setTextures(texture);
|
|
44
|
-
this.updateRenderTargetTextureSampleCount(rtWrapper,
|
|
44
|
+
this.updateRenderTargetTextureSampleCount(rtWrapper, samples);
|
|
45
45
|
return rtWrapper;
|
|
46
46
|
};
|
|
47
47
|
ThinEngine.prototype.createDepthStencilTexture = function (size, options, rtWrapper) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.renderTarget.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Extensions/engine.renderTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA6CzC,UAAU,CAAC,SAAS,CAAC,kCAAkC,GAAG,UAAU,OAAgB,EAAE,MAAe,EAA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;QAEzD,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAC9C,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,EACP,CAAC,CAAC,CAAC,cAAc,EACjB,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5D,EAAE,CAAC,iBAAiB,EACpB,KAAK,CACR,CAAC;QAEF,IAAI,CAAC,iBAAiB,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SACjE;QAED,eAAe,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KACzD;SAAM;QACH,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;KACxD;IAED,SAAS,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC7B,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,iCAAiC,CAClE,SAAS,CAAC,sBAAsB,EAChC,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,CACV,CAAC;IAEF,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { RenderTargetCreationOptions, DepthTextureCreationOptions, TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport type { WebGLHardwareTexture } from \"../WebGL/webGLHardwareTexture\";\r\n\r\nimport { Constants } from \"../constants\";\r\n\r\n/**\r\n * Type used to define a texture size (either with a number or with a rect width and height)\r\n * @deprecated please use TextureSize instead\r\n */\r\nexport type RenderTargetTextureSize = TextureSize;\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a new render target texture\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target wrapper ready to render texture\r\n */\r\n createRenderTargetTexture(size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper;\r\n\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @param rtWrapper The render target wrapper for which the depth/stencil texture must be created\r\n * @returns The texture\r\n */\r\n createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number;\r\n\r\n /** @internal */\r\n _createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /** @internal */\r\n _createHardwareRenderTargetWrapper(isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper;\r\n }\r\n}\r\n\r\nThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper {\r\n const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);\r\n this._renderTargetWrapperCache.push(rtWrapper);\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createRenderTargetTexture = function (this: ThinEngine, size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper {\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size) as WebGLRenderTargetWrapper;\r\n\r\n const fullOptions: RenderTargetCreationOptions = {};\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateDepthBuffer = !!options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = !!options.generateStencilBuffer;\r\n fullOptions.noColorTarget = !!options.noColorTarget;\r\n fullOptions.samples = options.samples;\r\n } else {\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.noColorTarget = false;\r\n }\r\n\r\n const texture = fullOptions.noColorTarget ? null : this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget);\r\n const width = (<{ width: number; height: number; layers?: number }>size).width || <number>size;\r\n const height = (<{ width: number; height: number; layers?: number }>size).height || <number>size;\r\n\r\n const currentFrameBuffer = this._currentFramebuffer;\r\n const gl = this._gl;\r\n\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n\r\n // No need to rebind on every frame\r\n if (texture && !texture.is2DArray) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource, 0);\r\n }\r\n\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n\r\n rtWrapper.setTextures(texture);\r\n\r\n this.updateRenderTargetTextureSampleCount(rtWrapper, fullOptions.samples ?? 1);\r\n\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n if (options.isCube) {\r\n const width = (<{ width: number; height: number }>size).width || <number>size;\r\n return this._createDepthStencilCubeTexture(width, options, rtWrapper);\r\n } else {\r\n return this._createDepthStencilTexture(size, options, rtWrapper);\r\n }\r\n};\r\n\r\nThinEngine.prototype._createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n const gl = this._gl;\r\n const layers = (<{ width: number; height: number; layers?: number }>size).layers || 0;\r\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\r\n if (!this._caps.depthTextureExtension) {\r\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n ...options,\r\n };\r\n\r\n this._bindTextureDirectly(target, internalTexture, true);\r\n\r\n this._setupDepthStencilTexture(\r\n internalTexture,\r\n size,\r\n internalOptions.generateStencil,\r\n internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering,\r\n internalOptions.comparisonFunction,\r\n internalOptions.samples\r\n );\r\n\r\n if (internalOptions.depthTextureFormat !== undefined) {\r\n if (\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH16 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32_FLOAT &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8\r\n ) {\r\n Logger.Error(\"Depth texture format is not supported.\");\r\n return internalTexture;\r\n }\r\n internalTexture.format = internalOptions.depthTextureFormat;\r\n } else {\r\n internalTexture.format = internalOptions.generateStencil ? Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 : Constants.TEXTUREFORMAT_DEPTH24;\r\n }\r\n\r\n const hasStencil =\r\n internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||\r\n internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||\r\n internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8;\r\n\r\n rtWrapper._depthStencilTexture = internalTexture;\r\n rtWrapper._depthStencilTextureWithStencil = hasStencil;\r\n\r\n let type = gl.UNSIGNED_INT;\r\n if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH16) {\r\n type = gl.UNSIGNED_SHORT;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 || internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8) {\r\n type = gl.UNSIGNED_INT_24_8;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {\r\n type = gl.FLOAT;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {\r\n type = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n\r\n const format = hasStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\r\n let internalFormat = format;\r\n if (this.webGLVersion > 1) {\r\n if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH16) {\r\n internalFormat = gl.DEPTH_COMPONENT16;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24) {\r\n internalFormat = gl.DEPTH_COMPONENT24;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 || internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8) {\r\n internalFormat = gl.DEPTH24_STENCIL8;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {\r\n internalFormat = gl.DEPTH_COMPONENT32F;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {\r\n internalFormat = gl.DEPTH32F_STENCIL8;\r\n }\r\n }\r\n\r\n if (internalTexture.is2DArray) {\r\n gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, layers, 0, format, type, null);\r\n } else {\r\n gl.texImage2D(target, 0, internalFormat, internalTexture.width, internalTexture.height, 0, format, type, null);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\r\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\r\n const glRtWrapper = <WebGLRenderTargetWrapper>(rtWrapper as any);\r\n if (glRtWrapper._depthStencilBuffer) {\r\n const currentFrameBuffer = this._currentFramebuffer;\r\n this._bindUnboundFramebuffer(glRtWrapper._framebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n\r\n gl.deleteRenderbuffer(glRtWrapper._depthStencilBuffer);\r\n glRtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n return internalTexture;\r\n};\r\n\r\nThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper: Nullable<WebGLRenderTargetWrapper>, samples: number): number {\r\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\r\n return 1;\r\n }\r\n\r\n if (rtWrapper.samples === samples) {\r\n return samples;\r\n }\r\n\r\n const gl = this._gl;\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n // Dispose previous render buffers\r\n if (rtWrapper._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\r\n rtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\r\n rtWrapper._MSAAFramebuffer = null;\r\n }\r\n\r\n const hardwareTexture = rtWrapper.texture._hardwareTexture as WebGLHardwareTexture;\r\n if (hardwareTexture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(hardwareTexture._MSAARenderBuffer);\r\n hardwareTexture._MSAARenderBuffer = null;\r\n }\r\n\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n const framebuffer = gl.createFramebuffer();\r\n\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n rtWrapper._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);\r\n\r\n const colorRenderbuffer = this._createRenderBuffer(\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples,\r\n -1 /* not used */,\r\n this._getRGBAMultiSampleBufferFormat(rtWrapper.texture.type),\r\n gl.COLOR_ATTACHMENT0,\r\n false\r\n );\r\n\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n hardwareTexture._MSAARenderBuffer = colorRenderbuffer;\r\n } else {\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n\r\n rtWrapper.texture.samples = samples;\r\n rtWrapper._samples = samples;\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(\r\n rtWrapper._generateStencilBuffer,\r\n rtWrapper._generateDepthBuffer,\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples\r\n );\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n return samples;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"engine.renderTarget.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Extensions/engine.renderTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA6CzC,UAAU,CAAC,SAAS,CAAC,kCAAkC,GAAG,UAAU,OAAgB,EAAE,MAAe,EAAE,IAAiB;IACpH,MAAM,SAAS,GAAG,IAAI,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtF,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,yBAAyB,GAAG,UAA4B,IAAiB,EAAE,OAA8C;;IAC1I,MAAM,SAAS,GAAG,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAA6B,CAAC;IAE1G,IAAI,mBAAmB,GAAG,IAAI,CAAC;IAC/B,IAAI,qBAAqB,GAAG,KAAK,CAAC;IAClC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAC9B,IAAI,eAAe,GAAgC,SAAS,CAAC;IAC7D,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,O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SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,CACV,CAAC;IAEF,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { RenderTargetCreationOptions, DepthTextureCreationOptions, TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport type { WebGLHardwareTexture } from \"../WebGL/webGLHardwareTexture\";\r\n\r\nimport { Constants } from \"../constants\";\r\n\r\n/**\r\n * Type used to define a texture size (either with a number or with a rect width and height)\r\n * @deprecated please use TextureSize instead\r\n */\r\nexport type RenderTargetTextureSize = TextureSize;\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a new render target texture\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target wrapper ready to render texture\r\n */\r\n createRenderTargetTexture(size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper;\r\n\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @param rtWrapper The render target wrapper for which the depth/stencil texture must be created\r\n * @returns The texture\r\n */\r\n createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number;\r\n\r\n /** @internal */\r\n _createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /** @internal */\r\n _createHardwareRenderTargetWrapper(isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper;\r\n }\r\n}\r\n\r\nThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper {\r\n const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);\r\n this._renderTargetWrapperCache.push(rtWrapper);\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createRenderTargetTexture = function (this: ThinEngine, size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper {\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size) as WebGLRenderTargetWrapper;\r\n\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let noColorAttachment = false;\r\n let colorAttachment: InternalTexture | undefined = undefined;\r\n let samples = 1;\r\n if (options !== undefined && typeof options === \"object\") {\r\n generateDepthBuffer = !!options.generateDepthBuffer;\r\n generateStencilBuffer = !!options.generateStencilBuffer;\r\n noColorAttachment = !!options.noColorAttachment;\r\n colorAttachment = options.colorAttachment;\r\n samples = options.samples ?? 1;\r\n }\r\n\r\n const texture = colorAttachment || (noColorAttachment ? null : this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget));\r\n const width = (<{ width: number; height: number; layers?: number }>size).width || <number>size;\r\n const height = (<{ width: number; height: number; layers?: number }>size).height || <number>size;\r\n\r\n const currentFrameBuffer = this._currentFramebuffer;\r\n const gl = this._gl;\r\n\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);\r\n\r\n // No need to rebind on every frame\r\n if (texture && !texture.is2DArray) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource, 0);\r\n }\r\n\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\r\n\r\n rtWrapper.setTextures(texture);\r\n\r\n this.updateRenderTargetTextureSampleCount(rtWrapper, samples);\r\n\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n if (options.isCube) {\r\n const width = (<{ width: number; height: number }>size).width || <number>size;\r\n return this._createDepthStencilCubeTexture(width, options, rtWrapper);\r\n } else {\r\n return this._createDepthStencilTexture(size, options, rtWrapper);\r\n }\r\n};\r\n\r\nThinEngine.prototype._createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n const gl = this._gl;\r\n const layers = (<{ width: number; height: number; layers?: number }>size).layers || 0;\r\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\r\n if (!this._caps.depthTextureExtension) {\r\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n ...options,\r\n };\r\n\r\n this._bindTextureDirectly(target, internalTexture, true);\r\n\r\n this._setupDepthStencilTexture(\r\n internalTexture,\r\n size,\r\n internalOptions.generateStencil,\r\n internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering,\r\n internalOptions.comparisonFunction,\r\n internalOptions.samples\r\n );\r\n\r\n if (internalOptions.depthTextureFormat !== undefined) {\r\n if (\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH16 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32_FLOAT &&\r\n internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8\r\n ) {\r\n Logger.Error(\"Depth texture format is not supported.\");\r\n return internalTexture;\r\n }\r\n internalTexture.format = internalOptions.depthTextureFormat;\r\n } else {\r\n internalTexture.format = internalOptions.generateStencil ? Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 : Constants.TEXTUREFORMAT_DEPTH24;\r\n }\r\n\r\n const hasStencil =\r\n internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||\r\n internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||\r\n internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8;\r\n\r\n rtWrapper._depthStencilTexture = internalTexture;\r\n rtWrapper._depthStencilTextureWithStencil = hasStencil;\r\n\r\n let type = gl.UNSIGNED_INT;\r\n if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH16) {\r\n type = gl.UNSIGNED_SHORT;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 || internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8) {\r\n type = gl.UNSIGNED_INT_24_8;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {\r\n type = gl.FLOAT;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {\r\n type = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n\r\n const format = hasStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\r\n let internalFormat = format;\r\n if (this.webGLVersion > 1) {\r\n if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH16) {\r\n internalFormat = gl.DEPTH_COMPONENT16;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24) {\r\n internalFormat = gl.DEPTH_COMPONENT24;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 || internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8) {\r\n internalFormat = gl.DEPTH24_STENCIL8;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {\r\n internalFormat = gl.DEPTH_COMPONENT32F;\r\n } else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {\r\n internalFormat = gl.DEPTH32F_STENCIL8;\r\n }\r\n }\r\n\r\n if (internalTexture.is2DArray) {\r\n gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, layers, 0, format, type, null);\r\n } else {\r\n gl.texImage2D(target, 0, internalFormat, internalTexture.width, internalTexture.height, 0, format, type, null);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\r\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\r\n const glRtWrapper = <WebGLRenderTargetWrapper>(rtWrapper as any);\r\n if (glRtWrapper._depthStencilBuffer) {\r\n const currentFrameBuffer = this._currentFramebuffer;\r\n this._bindUnboundFramebuffer(glRtWrapper._framebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n\r\n gl.deleteRenderbuffer(glRtWrapper._depthStencilBuffer);\r\n glRtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n return internalTexture;\r\n};\r\n\r\nThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper: Nullable<WebGLRenderTargetWrapper>, samples: number): number {\r\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\r\n return 1;\r\n }\r\n\r\n if (rtWrapper.samples === samples) {\r\n return samples;\r\n }\r\n\r\n const gl = this._gl;\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n // Dispose previous render buffers\r\n if (rtWrapper._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\r\n rtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\r\n rtWrapper._MSAAFramebuffer = null;\r\n }\r\n\r\n const hardwareTexture = rtWrapper.texture._hardwareTexture as WebGLHardwareTexture;\r\n if (hardwareTexture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(hardwareTexture._MSAARenderBuffer);\r\n hardwareTexture._MSAARenderBuffer = null;\r\n }\r\n\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n const framebuffer = gl.createFramebuffer();\r\n\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n rtWrapper._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);\r\n\r\n const colorRenderbuffer = this._createRenderBuffer(\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples,\r\n -1 /* not used */,\r\n this._getRGBAMultiSampleBufferFormat(rtWrapper.texture.type),\r\n gl.COLOR_ATTACHMENT0,\r\n false\r\n );\r\n\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n hardwareTexture._MSAARenderBuffer = colorRenderbuffer;\r\n } else {\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n\r\n rtWrapper.texture.samples = samples;\r\n rtWrapper._samples = samples;\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(\r\n rtWrapper._generateStencilBuffer,\r\n rtWrapper._generateDepthBuffer,\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples\r\n );\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n return samples;\r\n};\r\n"]}
|
|
@@ -8,6 +8,6 @@ declare module "../../Engines/thinEngine" {
|
|
|
8
8
|
* @param options defines the options used to create the texture
|
|
9
9
|
* @returns a new render target cube wrapper
|
|
10
10
|
*/
|
|
11
|
-
createRenderTargetCubeTexture(size: number, options?:
|
|
11
|
+
createRenderTargetCubeTexture(size: number, options?: RenderTargetCreationOptions): RenderTargetWrapper;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.renderTargetCube.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Extensions/engine.renderTargetCube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiB3C,UAAU,CAAC,SAAS,CAAC,6BAA6B,GAAG,UAAU,IAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"engine.renderTargetCube.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Extensions/engine.renderTargetCube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiB3C,UAAU,CAAC,SAAS,CAAC,6BAA6B,GAAG,UAAU,IAAY,EAAE,OAAqC;IAC9G,MAAM,SAAS,GAAG,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAA6B,CAAC;IAEzG,MAAM,WAAW,GAAG;QAChB,eAAe,EAAE,IAAI;QACrB,mBAAmB,EAAE,IAAI;QACzB,qBAAqB,EAAE,KAAK;QAC5B,IAAI,EAAE,SAAS,CAAC,wBAAwB;QACxC,YAAY,EAAE,SAAS,CAAC,8BAA8B;QACtD,MAAM,EAAE,SAAS,CAAC,kBAAkB;QACpC,GAAG,OAAO;KACb,CAAC;IACF,WAAW,CAAC,qBAAqB,GAAG,WAAW,CAAC,mBAAmB,IAAI,WAAW,CAAC,qBAAqB,CAAC;IAEzG,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,2BAA2B,EAAE;QAC7F,yEAAyE;QACzE,WAAW,CAAC,YAAY,GAAG,SAAS,CAAC,4BAA4B,CAAC;KACrE;SAAM,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,+BAA+B,EAAE;QAC7G,2EAA2E;QAC3E,WAAW,CAAC,YAAY,GAAG,SAAS,CAAC,4BAA4B,CAAC;KAC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C,IAAI,CAAC;IAChC,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAEpC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAE/B,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport type { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport type { RenderTargetCreationOptions } from \"../../Materials/Textures/textureCreationOptions\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a new render target cube wrapper\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target cube wrapper\r\n */\r\n createRenderTargetCubeTexture(size: number, options?: RenderTargetCreationOptions): RenderTargetWrapper;\r\n }\r\n}\r\n\r\nThinEngine.prototype.createRenderTargetCubeTexture = function (size: number, options?: RenderTargetCreationOptions): RenderTargetWrapper {\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, true, size) as WebGLRenderTargetWrapper;\r\n\r\n const fullOptions = {\r\n generateMipMaps: true,\r\n generateDepthBuffer: true,\r\n generateStencilBuffer: false,\r\n type: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n ...options,\r\n };\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;\r\n\r\n if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (fullOptions.type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n const gl = this._gl;\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.RenderTarget);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n const filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);\r\n\r\n if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n Logger.Warn(\"Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type\");\r\n }\r\n\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n\r\n for (let face = 0; face < 6; face++) {\r\n gl.texImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + face,\r\n 0,\r\n this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format),\r\n size,\r\n size,\r\n 0,\r\n this._getInternalFormat(fullOptions.format),\r\n this._getWebGLTextureType(fullOptions.type),\r\n null\r\n );\r\n }\r\n\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);\r\n\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n this._bindUnboundFramebuffer(null);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer;\r\n\r\n texture.width = size;\r\n texture.height = size;\r\n texture.isReady = true;\r\n texture.isCube = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n\r\n this._internalTexturesCache.push(texture);\r\n rtWrapper.setTextures(texture);\r\n\r\n return rtWrapper;\r\n};\r\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HardwareTextureWrapper } from "../../Materials/Textures/hardwareTextureWrapper";
|
|
2
|
+
import type { Nullable } from "../../types";
|
|
3
|
+
import type { INativeEngine, NativeTexture } from "./nativeInterfaces";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare class NativeHardwareTexture implements HardwareTextureWrapper {
|
|
6
|
+
private readonly _engine;
|
|
7
|
+
private _nativeTexture;
|
|
8
|
+
get underlyingResource(): Nullable<NativeTexture>;
|
|
9
|
+
constructor(existingTexture: NativeTexture, engine: INativeEngine);
|
|
10
|
+
setUsage(): void;
|
|
11
|
+
set(hardwareTexture: NativeTexture): void;
|
|
12
|
+
reset(): void;
|
|
13
|
+
release(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export class NativeHardwareTexture {
|
|
3
|
+
constructor(existingTexture, engine) {
|
|
4
|
+
this._engine = engine;
|
|
5
|
+
this.set(existingTexture);
|
|
6
|
+
}
|
|
7
|
+
get underlyingResource() {
|
|
8
|
+
return this._nativeTexture;
|
|
9
|
+
}
|
|
10
|
+
setUsage() { }
|
|
11
|
+
set(hardwareTexture) {
|
|
12
|
+
this._nativeTexture = hardwareTexture;
|
|
13
|
+
}
|
|
14
|
+
reset() {
|
|
15
|
+
this._nativeTexture = null;
|
|
16
|
+
}
|
|
17
|
+
release() {
|
|
18
|
+
if (this._nativeTexture) {
|
|
19
|
+
this._engine.deleteTexture(this._nativeTexture);
|
|
20
|
+
}
|
|
21
|
+
this.reset();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=nativeHardwareTexture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeHardwareTexture.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Native/nativeHardwareTexture.ts"],"names":[],"mappings":"AAIA,gBAAgB;AAChB,MAAM,OAAO,qBAAqB;IAQ9B,YAAY,eAA8B,EAAE,MAAqB;QAC7D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC9B,CAAC;IAPD,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAOM,QAAQ,KAAU,CAAC;IAEnB,GAAG,CAAC,eAA8B;QACrC,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC;IAC1C,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAEM,OAAO;QACV,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import type { HardwareTextureWrapper } from \"../../Materials/Textures/hardwareTextureWrapper\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { INativeEngine, NativeTexture } from \"./nativeInterfaces\";\r\n\r\n/** @internal */\r\nexport class NativeHardwareTexture implements HardwareTextureWrapper {\r\n private readonly _engine: INativeEngine;\r\n private _nativeTexture: Nullable<NativeTexture>;\r\n\r\n public get underlyingResource(): Nullable<NativeTexture> {\r\n return this._nativeTexture;\r\n }\r\n\r\n constructor(existingTexture: NativeTexture, engine: INativeEngine) {\r\n this._engine = engine;\r\n this.set(existingTexture);\r\n }\r\n\r\n public setUsage(): void {}\r\n\r\n public set(hardwareTexture: NativeTexture) {\r\n this._nativeTexture = hardwareTexture;\r\n }\r\n\r\n public reset() {\r\n this._nativeTexture = null;\r\n }\r\n\r\n public release() {\r\n if (this._nativeTexture) {\r\n this._engine.deleteTexture(this._nativeTexture);\r\n }\r\n\r\n this.reset();\r\n }\r\n}\r\n"]}
|
|
@@ -4,6 +4,11 @@ import type { InternalTexture } from "../../Materials/Textures/internalTexture";
|
|
|
4
4
|
import type { Nullable } from "../../types";
|
|
5
5
|
import type { ICanvas, IImage } from "../ICanvas";
|
|
6
6
|
import type { NativeData, NativeDataStream } from "./nativeDataStream";
|
|
7
|
+
export declare type NativeTexture = NativeData;
|
|
8
|
+
export declare type NativeFramebuffer = NativeData;
|
|
9
|
+
export declare type NativeVertexArrayObject = NativeData;
|
|
10
|
+
export declare type NativeProgram = NativeData;
|
|
11
|
+
export declare type NativeUniform = NativeData;
|
|
7
12
|
/** @internal */
|
|
8
13
|
export interface INativeEngine {
|
|
9
14
|
dispose(): void;
|
|
@@ -15,23 +20,24 @@ export interface INativeEngine {
|
|
|
15
20
|
createVertexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, dynamic: boolean): NativeData;
|
|
16
21
|
recordVertexBuffer(vertexArray: NativeData, vertexBuffer: NativeData, location: number, byteOffset: number, byteStride: number, numElements: number, type: number, normalized: boolean, instanceDivisor: number): void;
|
|
17
22
|
updateDynamicVertexBuffer(vertexBuffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number): void;
|
|
18
|
-
createProgram(vertexShader: string, fragmentShader: string):
|
|
19
|
-
getUniforms(shaderProgram:
|
|
20
|
-
getAttributes(shaderProgram:
|
|
21
|
-
createTexture():
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
createProgram(vertexShader: string, fragmentShader: string): NativeProgram;
|
|
24
|
+
getUniforms(shaderProgram: NativeProgram, uniformsNames: string[]): WebGLUniformLocation[];
|
|
25
|
+
getAttributes(shaderProgram: NativeProgram, attributeNames: string[]): number[];
|
|
26
|
+
createTexture(): NativeTexture;
|
|
27
|
+
initializeTexture(texture: NativeTexture, width: number, height: number, hasMips: boolean, format: number, renderTarget: boolean, srgb: boolean): void;
|
|
28
|
+
loadTexture(texture: NativeTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;
|
|
29
|
+
loadRawTexture(texture: NativeTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;
|
|
30
|
+
loadRawTexture2DArray(texture: NativeTexture, data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean): void;
|
|
31
|
+
loadCubeTexture(texture: NativeTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;
|
|
32
|
+
loadCubeTextureWithMips(texture: NativeTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;
|
|
33
|
+
getTextureWidth(texture: NativeTexture): number;
|
|
34
|
+
getTextureHeight(texture: NativeTexture): number;
|
|
35
|
+
copyTexture(desination: NativeTexture, source: NativeTexture): void;
|
|
36
|
+
deleteTexture(texture: NativeTexture): void;
|
|
37
|
+
readTexture(texture: NativeTexture, mipLevel: number, x: number, y: number, width: number, height: number, buffer: Nullable<ArrayBuffer>, bufferOffset: number, bufferLength: number): Promise<ArrayBuffer>;
|
|
32
38
|
createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;
|
|
33
39
|
resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;
|
|
34
|
-
createFrameBuffer(texture:
|
|
40
|
+
createFrameBuffer(texture: Nullable<NativeTexture>, width: number, height: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean): NativeFramebuffer;
|
|
35
41
|
getRenderWidth(): number;
|
|
36
42
|
getRenderHeight(): number;
|
|
37
43
|
getHardwareScalingLevel(): number;
|
|
@@ -74,6 +80,7 @@ interface INativeEngineConstructor {
|
|
|
74
80
|
readonly ADDRESS_MODE_MIRROR_ONCE: number;
|
|
75
81
|
readonly TEXTURE_FORMAT_RGB8: number;
|
|
76
82
|
readonly TEXTURE_FORMAT_RGBA8: number;
|
|
83
|
+
readonly TEXTURE_FORMAT_RGBA16F: number;
|
|
77
84
|
readonly TEXTURE_FORMAT_RGBA32F: number;
|
|
78
85
|
readonly ATTRIB_TYPE_INT8: number;
|
|
79
86
|
readonly ATTRIB_TYPE_UINT8: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\n/** @internal */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(buffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): any;\r\n getUniforms(shaderProgram: any, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: any, attributeNames: string[]): number[];\r\n\r\n createTexture(): WebGLTexture;\r\n loadTexture(texture: WebGLTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: WebGLTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: WebGLTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: WebGLTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: WebGLTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: WebGLTexture): number;\r\n getTextureHeight(texture: WebGLTexture): number;\r\n copyTexture(desination: Nullable<WebGLTexture>, source: Nullable<WebGLTexture>): void;\r\n deleteTexture(texture: Nullable<WebGLTexture>): void;\r\n readTexture(\r\n texture: WebGLTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: WebGLTexture,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n generateMips: boolean\r\n ): WebGLFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n getHardwareScalingLevel(): number;\r\n setHardwareScalingLevel(level: number): void;\r\n\r\n setViewPort(x: number, y: number, width: number, height: number): void;\r\n\r\n setCommandDataStream(dataStream: NativeDataStream): void;\r\n submitCommands(): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n\r\n readonly ATTRIB_TYPE_INT8: number;\r\n readonly ATTRIB_TYPE_UINT8: number;\r\n readonly ATTRIB_TYPE_INT16: number;\r\n readonly ATTRIB_TYPE_UINT16: number;\r\n readonly ATTRIB_TYPE_FLOAT: number;\r\n\r\n readonly ALPHA_DISABLE: number;\r\n readonly ALPHA_ADD: number;\r\n readonly ALPHA_COMBINE: number;\r\n readonly ALPHA_SUBTRACT: number;\r\n readonly ALPHA_MULTIPLY: number;\r\n readonly ALPHA_MAXIMIZED: number;\r\n readonly ALPHA_ONEONE: number;\r\n readonly ALPHA_PREMULTIPLIED: number;\r\n readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;\r\n readonly ALPHA_INTERPOLATE: number;\r\n readonly ALPHA_SCREENMODE: number;\r\n\r\n readonly STENCIL_TEST_LESS: number;\r\n readonly STENCIL_TEST_LEQUAL: number;\r\n readonly STENCIL_TEST_EQUAL: number;\r\n readonly STENCIL_TEST_GEQUAL: number;\r\n readonly STENCIL_TEST_GREATER: number;\r\n readonly STENCIL_TEST_NOTEQUAL: number;\r\n readonly STENCIL_TEST_NEVER: number;\r\n readonly STENCIL_TEST_ALWAYS: number;\r\n\r\n readonly STENCIL_OP_FAIL_S_ZERO: number;\r\n readonly STENCIL_OP_FAIL_S_KEEP: number;\r\n readonly STENCIL_OP_FAIL_S_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_S_INCR: number;\r\n readonly STENCIL_OP_FAIL_S_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_DECR: number;\r\n readonly STENCIL_OP_FAIL_S_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_INVERT: number;\r\n\r\n readonly STENCIL_OP_FAIL_Z_ZERO: number;\r\n readonly STENCIL_OP_FAIL_Z_KEEP: number;\r\n readonly STENCIL_OP_FAIL_Z_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_Z_INCR: number;\r\n readonly STENCIL_OP_FAIL_Z_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_DECR: number;\r\n readonly STENCIL_OP_FAIL_Z_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_INVERT: number;\r\n\r\n readonly STENCIL_OP_PASS_Z_ZERO: number;\r\n readonly STENCIL_OP_PASS_Z_KEEP: number;\r\n readonly STENCIL_OP_PASS_Z_REPLACE: number;\r\n readonly STENCIL_OP_PASS_Z_INCR: number;\r\n readonly STENCIL_OP_PASS_Z_INCRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_DECR: number;\r\n readonly STENCIL_OP_PASS_Z_DECRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_INVERT: number;\r\n\r\n readonly COMMAND_DELETEVERTEXARRAY: NativeData;\r\n readonly COMMAND_DELETEINDEXBUFFER: NativeData;\r\n readonly COMMAND_DELETEVERTEXBUFFER: NativeData;\r\n readonly COMMAND_SETPROGRAM: NativeData;\r\n readonly COMMAND_SETMATRIX: NativeData;\r\n readonly COMMAND_SETMATRIX3X3: NativeData;\r\n readonly COMMAND_SETMATRIX2X2: NativeData;\r\n readonly COMMAND_SETMATRICES: NativeData;\r\n readonly COMMAND_SETINT: NativeData;\r\n readonly COMMAND_SETINTARRAY: NativeData;\r\n readonly COMMAND_SETINTARRAY2: NativeData;\r\n readonly COMMAND_SETINTARRAY3: NativeData;\r\n readonly COMMAND_SETINTARRAY4: NativeData;\r\n readonly COMMAND_SETFLOATARRAY: NativeData;\r\n readonly COMMAND_SETFLOATARRAY2: NativeData;\r\n readonly COMMAND_SETFLOATARRAY3: NativeData;\r\n readonly COMMAND_SETFLOATARRAY4: NativeData;\r\n readonly COMMAND_SETTEXTURESAMPLING: NativeData;\r\n readonly COMMAND_SETTEXTUREWRAPMODE: NativeData;\r\n readonly COMMAND_SETTEXTUREANISOTROPICLEVEL: NativeData;\r\n readonly COMMAND_SETTEXTURE: NativeData;\r\n readonly COMMAND_BINDVERTEXARRAY: NativeData;\r\n readonly COMMAND_SETSTATE: NativeData;\r\n readonly COMMAND_DELETEPROGRAM: NativeData;\r\n readonly COMMAND_SETZOFFSET: NativeData;\r\n readonly COMMAND_SETZOFFSETUNITS: NativeData;\r\n readonly COMMAND_SETDEPTHTEST: NativeData;\r\n readonly COMMAND_SETDEPTHWRITE: NativeData;\r\n readonly COMMAND_SETCOLORWRITE: NativeData;\r\n readonly COMMAND_SETBLENDMODE: NativeData;\r\n readonly COMMAND_SETFLOAT: NativeData;\r\n readonly COMMAND_SETFLOAT2: NativeData;\r\n readonly COMMAND_SETFLOAT3: NativeData;\r\n readonly COMMAND_SETFLOAT4: NativeData;\r\n readonly COMMAND_BINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_UNBINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DELETEFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DRAWINDEXED: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeCamera {\r\n createVideo(constraints: MediaTrackConstraints): any;\r\n updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCanvasConstructor {\r\n prototype: ICanvas;\r\n new (): ICanvas;\r\n\r\n loadTTFAsync(fontName: string, buffer: ArrayBuffer): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @internal */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeDataStreamConstructor {\r\n prototype: INativeDataStream;\r\n new (requestFlushCallback: () => void): INativeDataStream;\r\n\r\n readonly VALIDATION_ENABLED: boolean;\r\n readonly VALIDATION_UINT_32: number;\r\n readonly VALIDATION_INT_32: number;\r\n readonly VALIDATION_FLOAT_32: number;\r\n readonly VALIDATION_UINT_32_ARRAY: number;\r\n readonly VALIDATION_INT_32_ARRAY: number;\r\n readonly VALIDATION_FLOAT_32_ARRAY: number;\r\n readonly VALIDATION_NATIVE_DATA: number;\r\n readonly VALIDATION_BOOLEAN: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n XMLHttpRequest: any; // TODO: how to do this?\r\n DeviceInputSystem: IDeviceInputSystemConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\nexport type NativeTexture = NativeData;\r\nexport type NativeFramebuffer = NativeData;\r\nexport type NativeVertexArrayObject = NativeData;\r\nexport type NativeProgram = NativeData;\r\nexport type NativeUniform = NativeData;\r\n\r\n/** @internal */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(buffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): NativeProgram;\r\n getUniforms(shaderProgram: NativeProgram, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: NativeProgram, attributeNames: string[]): number[];\r\n\r\n createTexture(): NativeTexture;\r\n initializeTexture(texture: NativeTexture, width: number, height: number, hasMips: boolean, format: number, renderTarget: boolean, srgb: boolean): void;\r\n loadTexture(texture: NativeTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: NativeTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: NativeTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: NativeTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: NativeTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: NativeTexture): number;\r\n getTextureHeight(texture: NativeTexture): number;\r\n copyTexture(desination: NativeTexture, source: NativeTexture): void;\r\n deleteTexture(texture: NativeTexture): void;\r\n readTexture(\r\n texture: NativeTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(texture: Nullable<NativeTexture>, width: number, height: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean): NativeFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n getHardwareScalingLevel(): number;\r\n setHardwareScalingLevel(level: number): void;\r\n\r\n setViewPort(x: number, y: number, width: number, height: number): void;\r\n\r\n setCommandDataStream(dataStream: NativeDataStream): void;\r\n submitCommands(): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA16F: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n\r\n readonly ATTRIB_TYPE_INT8: number;\r\n readonly ATTRIB_TYPE_UINT8: number;\r\n readonly ATTRIB_TYPE_INT16: number;\r\n readonly ATTRIB_TYPE_UINT16: number;\r\n readonly ATTRIB_TYPE_FLOAT: number;\r\n\r\n readonly ALPHA_DISABLE: number;\r\n readonly ALPHA_ADD: number;\r\n readonly ALPHA_COMBINE: number;\r\n readonly ALPHA_SUBTRACT: number;\r\n readonly ALPHA_MULTIPLY: number;\r\n readonly ALPHA_MAXIMIZED: number;\r\n readonly ALPHA_ONEONE: number;\r\n readonly ALPHA_PREMULTIPLIED: number;\r\n readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;\r\n readonly ALPHA_INTERPOLATE: number;\r\n readonly ALPHA_SCREENMODE: number;\r\n\r\n readonly STENCIL_TEST_LESS: number;\r\n readonly STENCIL_TEST_LEQUAL: number;\r\n readonly STENCIL_TEST_EQUAL: number;\r\n readonly STENCIL_TEST_GEQUAL: number;\r\n readonly STENCIL_TEST_GREATER: number;\r\n readonly STENCIL_TEST_NOTEQUAL: number;\r\n readonly STENCIL_TEST_NEVER: number;\r\n readonly STENCIL_TEST_ALWAYS: number;\r\n\r\n readonly STENCIL_OP_FAIL_S_ZERO: number;\r\n readonly STENCIL_OP_FAIL_S_KEEP: number;\r\n readonly STENCIL_OP_FAIL_S_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_S_INCR: number;\r\n readonly STENCIL_OP_FAIL_S_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_DECR: number;\r\n readonly STENCIL_OP_FAIL_S_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_INVERT: number;\r\n\r\n readonly STENCIL_OP_FAIL_Z_ZERO: number;\r\n readonly STENCIL_OP_FAIL_Z_KEEP: number;\r\n readonly STENCIL_OP_FAIL_Z_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_Z_INCR: number;\r\n readonly STENCIL_OP_FAIL_Z_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_DECR: number;\r\n readonly STENCIL_OP_FAIL_Z_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_INVERT: number;\r\n\r\n readonly STENCIL_OP_PASS_Z_ZERO: number;\r\n readonly STENCIL_OP_PASS_Z_KEEP: number;\r\n readonly STENCIL_OP_PASS_Z_REPLACE: number;\r\n readonly STENCIL_OP_PASS_Z_INCR: number;\r\n readonly STENCIL_OP_PASS_Z_INCRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_DECR: number;\r\n readonly STENCIL_OP_PASS_Z_DECRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_INVERT: number;\r\n\r\n readonly COMMAND_DELETEVERTEXARRAY: NativeData;\r\n readonly COMMAND_DELETEINDEXBUFFER: NativeData;\r\n readonly COMMAND_DELETEVERTEXBUFFER: NativeData;\r\n readonly COMMAND_SETPROGRAM: NativeData;\r\n readonly COMMAND_SETMATRIX: NativeData;\r\n readonly COMMAND_SETMATRIX3X3: NativeData;\r\n readonly COMMAND_SETMATRIX2X2: NativeData;\r\n readonly COMMAND_SETMATRICES: NativeData;\r\n readonly COMMAND_SETINT: NativeData;\r\n readonly COMMAND_SETINTARRAY: NativeData;\r\n readonly COMMAND_SETINTARRAY2: NativeData;\r\n readonly COMMAND_SETINTARRAY3: NativeData;\r\n readonly COMMAND_SETINTARRAY4: NativeData;\r\n readonly COMMAND_SETFLOATARRAY: NativeData;\r\n readonly COMMAND_SETFLOATARRAY2: NativeData;\r\n readonly COMMAND_SETFLOATARRAY3: NativeData;\r\n readonly COMMAND_SETFLOATARRAY4: NativeData;\r\n readonly COMMAND_SETTEXTURESAMPLING: NativeData;\r\n readonly COMMAND_SETTEXTUREWRAPMODE: NativeData;\r\n readonly COMMAND_SETTEXTUREANISOTROPICLEVEL: NativeData;\r\n readonly COMMAND_SETTEXTURE: NativeData;\r\n readonly COMMAND_BINDVERTEXARRAY: NativeData;\r\n readonly COMMAND_SETSTATE: NativeData;\r\n readonly COMMAND_DELETEPROGRAM: NativeData;\r\n readonly COMMAND_SETZOFFSET: NativeData;\r\n readonly COMMAND_SETZOFFSETUNITS: NativeData;\r\n readonly COMMAND_SETDEPTHTEST: NativeData;\r\n readonly COMMAND_SETDEPTHWRITE: NativeData;\r\n readonly COMMAND_SETCOLORWRITE: NativeData;\r\n readonly COMMAND_SETBLENDMODE: NativeData;\r\n readonly COMMAND_SETFLOAT: NativeData;\r\n readonly COMMAND_SETFLOAT2: NativeData;\r\n readonly COMMAND_SETFLOAT3: NativeData;\r\n readonly COMMAND_SETFLOAT4: NativeData;\r\n readonly COMMAND_BINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_UNBINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DELETEFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DRAWINDEXED: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeCamera {\r\n createVideo(constraints: MediaTrackConstraints): any;\r\n updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCanvasConstructor {\r\n prototype: ICanvas;\r\n new (): ICanvas;\r\n\r\n loadTTFAsync(fontName: string, buffer: ArrayBuffer): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @internal */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeDataStreamConstructor {\r\n prototype: INativeDataStream;\r\n new (requestFlushCallback: () => void): INativeDataStream;\r\n\r\n readonly VALIDATION_ENABLED: boolean;\r\n readonly VALIDATION_UINT_32: number;\r\n readonly VALIDATION_INT_32: number;\r\n readonly VALIDATION_FLOAT_32: number;\r\n readonly VALIDATION_UINT_32_ARRAY: number;\r\n readonly VALIDATION_INT_32_ARRAY: number;\r\n readonly VALIDATION_FLOAT_32_ARRAY: number;\r\n readonly VALIDATION_NATIVE_DATA: number;\r\n readonly VALIDATION_BOOLEAN: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n XMLHttpRequest: any; // TODO: how to do this?\r\n DeviceInputSystem: IDeviceInputSystemConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n}\r\n"]}
|