@galacean/engine-rhi-webgl 1.3.23 → 1.3.25
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/dist/main.js +77 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +77 -1
- package/dist/module.js +77 -1
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/WebGLGraphicDevice.d.ts +6 -2
package/dist/main.js
CHANGED
|
@@ -1885,7 +1885,7 @@ exports.WebGLMode = void 0;
|
|
|
1885
1885
|
var gl = this._gl;
|
|
1886
1886
|
var _engine__lastRenderState = engine._lastRenderState, targetBlendState = _engine__lastRenderState.blendState.targetBlendState, depthState = _engine__lastRenderState.depthState, stencilState = _engine__lastRenderState.stencilState;
|
|
1887
1887
|
var clearFlag = 0;
|
|
1888
|
-
if (clearFlags & engineCore.CameraClearFlags.Color) {
|
|
1888
|
+
if (clearFlags & engineCore.CameraClearFlags.Color && clearColor) {
|
|
1889
1889
|
clearFlag |= gl.COLOR_BUFFER_BIT;
|
|
1890
1890
|
var lc = this._lastClearColor;
|
|
1891
1891
|
var r = clearColor.r, g = clearColor.g, b = clearColor.b, a = clearColor.a;
|
|
@@ -1949,6 +1949,75 @@ exports.WebGLMode = void 0;
|
|
|
1949
1949
|
this.viewport(x, y, width, height);
|
|
1950
1950
|
this.scissor(x, y, width, height);
|
|
1951
1951
|
};
|
|
1952
|
+
_proto.blitInternalRTByBlitFrameBuffer = function blitInternalRTByBlitFrameBuffer(srcRT, destRT, clearFlags, viewport) {
|
|
1953
|
+
if (!this._isWebGL2) {
|
|
1954
|
+
engineCore.Logger.warn("WebGL1.0 not support blit frame buffer.");
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
var gl = this._gl;
|
|
1958
|
+
// @ts-ignore
|
|
1959
|
+
var srcFrameBuffer = srcRT ? srcRT._platformRenderTarget._frameBuffer : null;
|
|
1960
|
+
// @ts-ignore
|
|
1961
|
+
var destFrameBuffer = destRT ? destRT._platformRenderTarget._frameBuffer : null;
|
|
1962
|
+
var bufferWidth = this.getMainFrameBufferWidth();
|
|
1963
|
+
var bufferHeight = this.getMainFrameBufferHeight();
|
|
1964
|
+
var srcWidth = srcRT ? srcRT.width : bufferWidth;
|
|
1965
|
+
var srcHeight = srcRT ? srcRT.height : bufferHeight;
|
|
1966
|
+
var blitWidth = destRT.width;
|
|
1967
|
+
var blitHeight = destRT.height;
|
|
1968
|
+
var needFlipY = !srcRT;
|
|
1969
|
+
var needBlitColor = (clearFlags & engineCore.CameraClearFlags.Color) === 0;
|
|
1970
|
+
var needBlitDepth = (clearFlags & engineCore.CameraClearFlags.Depth) === 0;
|
|
1971
|
+
var needBlitStencil = (clearFlags & engineCore.CameraClearFlags.Stencil) === 0;
|
|
1972
|
+
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, srcFrameBuffer);
|
|
1973
|
+
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, destFrameBuffer);
|
|
1974
|
+
var blitMask = needBlitColor ? gl.COLOR_BUFFER_BIT : 0;
|
|
1975
|
+
if (needBlitDepth || needBlitStencil) {
|
|
1976
|
+
// @ts-ignore
|
|
1977
|
+
var depthFormat = destRT._depthFormat;
|
|
1978
|
+
if (needBlitDepth) {
|
|
1979
|
+
if (depthFormat === engineCore.TextureFormat.Depth || depthFormat >= engineCore.TextureFormat.DepthStencil && depthFormat <= engineCore.TextureFormat.Depth32Stencil8) {
|
|
1980
|
+
blitMask |= gl.DEPTH_BUFFER_BIT;
|
|
1981
|
+
} else {
|
|
1982
|
+
engineCore.Logger.warn("Do not clear depth, or set depth format of target which is " + engineCore.TextureFormat[depthFormat] + " now.");
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
if (needBlitStencil) {
|
|
1986
|
+
if (depthFormat === engineCore.TextureFormat.Stencil || depthFormat === engineCore.TextureFormat.DepthStencil || depthFormat >= engineCore.TextureFormat.Depth24Stencil8 || depthFormat >= engineCore.TextureFormat.Depth32Stencil8) {
|
|
1987
|
+
blitMask |= gl.STENCIL_BUFFER_BIT;
|
|
1988
|
+
} else {
|
|
1989
|
+
engineCore.Logger.warn("Do not clear stencil, or set stencil format of target which is " + engineCore.TextureFormat[depthFormat] + " now.");
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
var xStart = viewport.x * srcWidth;
|
|
1994
|
+
var xEnd = xStart + blitWidth;
|
|
1995
|
+
var yStart = needFlipY ? srcHeight - viewport.y * srcHeight : srcHeight - viewport.y * srcHeight - blitHeight;
|
|
1996
|
+
var yEnd = needFlipY ? yStart - blitHeight : yStart + blitHeight;
|
|
1997
|
+
gl.blitFramebuffer(xStart, yStart, xEnd, yEnd, 0, 0, blitWidth, blitHeight, blitMask, gl.NEAREST);
|
|
1998
|
+
};
|
|
1999
|
+
_proto.copyRenderTargetToSubTexture = function copyRenderTargetToSubTexture(srcRT, grabTexture, viewport) {
|
|
2000
|
+
var _srcRT;
|
|
2001
|
+
var gl = this._gl;
|
|
2002
|
+
var bufferWidth = this.getMainFrameBufferWidth();
|
|
2003
|
+
var bufferHeight = this.getMainFrameBufferHeight();
|
|
2004
|
+
var srcWidth = srcRT ? srcRT.width : bufferWidth;
|
|
2005
|
+
var srcHeight = srcRT ? srcRT.height : bufferHeight;
|
|
2006
|
+
var copyWidth = grabTexture.width;
|
|
2007
|
+
var copyHeight = grabTexture.height;
|
|
2008
|
+
var flipY = !srcRT;
|
|
2009
|
+
var xStart = viewport.x * srcWidth;
|
|
2010
|
+
var yStart = flipY ? srcHeight - viewport.y * srcHeight - copyHeight : viewport.y * srcHeight;
|
|
2011
|
+
var _srcRT__platformRenderTarget__frameBuffer;
|
|
2012
|
+
// @ts-ignore
|
|
2013
|
+
var frameBuffer = (_srcRT__platformRenderTarget__frameBuffer = (_srcRT = srcRT) == null ? void 0 : _srcRT._platformRenderTarget._frameBuffer) != null ? _srcRT__platformRenderTarget__frameBuffer : null;
|
|
2014
|
+
// @ts-ignore
|
|
2015
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);
|
|
2016
|
+
// @ts-ignore
|
|
2017
|
+
var glTexture = grabTexture._platformTexture;
|
|
2018
|
+
glTexture._bind();
|
|
2019
|
+
gl.copyTexSubImage2D(glTexture._target, 0, 0, 0, xStart, yStart, copyWidth, copyHeight);
|
|
2020
|
+
};
|
|
1952
2021
|
_proto.activeTexture = function activeTexture(textureID) {
|
|
1953
2022
|
if (this._activeTextureID !== textureID) {
|
|
1954
2023
|
this._gl.activeTexture(textureID);
|
|
@@ -2009,6 +2078,7 @@ exports.WebGLMode = void 0;
|
|
|
2009
2078
|
if (debugRenderInfo != null) {
|
|
2010
2079
|
this._renderer = gl.getParameter(debugRenderInfo.UNMASKED_RENDERER_WEBGL);
|
|
2011
2080
|
}
|
|
2081
|
+
this._contextAttributes = gl.getContextAttributes();
|
|
2012
2082
|
};
|
|
2013
2083
|
_proto.destroy = function destroy() {
|
|
2014
2084
|
var webCanvas = this._webCanvas;
|
|
@@ -2065,6 +2135,12 @@ exports.WebGLMode = void 0;
|
|
|
2065
2135
|
get: function get() {
|
|
2066
2136
|
return this.capability.canIUseMoreJoints;
|
|
2067
2137
|
}
|
|
2138
|
+
},
|
|
2139
|
+
{
|
|
2140
|
+
key: "context",
|
|
2141
|
+
get: function get() {
|
|
2142
|
+
return this._contextAttributes;
|
|
2143
|
+
}
|
|
2068
2144
|
}
|
|
2069
2145
|
]);
|
|
2070
2146
|
return WebGLGraphicDevice;
|