@galacean/engine-rhi-webgl 2.0.0-alpha.17 → 2.0.0-alpha.19
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 +20 -18
- package/dist/main.js.map +1 -1
- package/dist/module.js +20 -18
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/GLRenderTarget.d.ts +1 -0
package/dist/main.js
CHANGED
|
@@ -1511,7 +1511,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1511
1511
|
_proto._bindMainFBO = function _bindMainFBO() {
|
|
1512
1512
|
var gl = this._gl;
|
|
1513
1513
|
var isWebGL2 = this._isWebGL2;
|
|
1514
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount
|
|
1514
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount; _this__target.width; _this__target.height;
|
|
1515
1515
|
var drawBuffers = new Array(colorTextureCount);
|
|
1516
1516
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
1517
1517
|
/** color render buffer */ for(var i = 0; i < colorTextureCount; i++){
|
|
@@ -1533,11 +1533,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1533
1533
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, gl.TEXTURE_2D, platformTexture._glTexture, 0);
|
|
1534
1534
|
} else if (this._target.antiAliasing <= 1) {
|
|
1535
1535
|
var _GLTexture__getRenderBufferDepthFormatDetail = GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat = _GLTexture__getRenderBufferDepthFormatDetail.internalFormat, attachment1 = _GLTexture__getRenderBufferDepthFormatDetail.attachment;
|
|
1536
|
-
|
|
1537
|
-
this._depthRenderBuffer = depthRenderBuffer;
|
|
1538
|
-
gl.bindRenderbuffer(gl.RENDERBUFFER, depthRenderBuffer);
|
|
1539
|
-
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
1540
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment1, gl.RENDERBUFFER, depthRenderBuffer);
|
|
1536
|
+
this._depthRenderBuffer = this._createRenderBuffer(internalFormat, attachment1);
|
|
1541
1537
|
}
|
|
1542
1538
|
}
|
|
1543
1539
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
@@ -1546,32 +1542,38 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1546
1542
|
_proto._bindMSAAFBO = function _bindMSAAFBO() {
|
|
1547
1543
|
var gl = this._gl;
|
|
1548
1544
|
var isWebGL2 = this._isWebGL2;
|
|
1549
|
-
var
|
|
1550
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount, antiAliasing = _this__target.antiAliasing, width = _this__target.width, height = _this__target.height;
|
|
1545
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
|
|
1551
1546
|
this._blitDrawBuffers = new Array(colorTextureCount);
|
|
1552
|
-
this._MSAADepthRenderBuffer = MSAADepthRenderBuffer;
|
|
1553
1547
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._MSAAFrameBuffer);
|
|
1554
1548
|
// prepare MRT+MSAA color RBOs
|
|
1555
1549
|
for(var i = 0; i < colorTextureCount; i++){
|
|
1556
|
-
var MSAAColorRenderBuffer = gl.createRenderbuffer();
|
|
1557
|
-
this._MSAAColorRenderBuffers[i] = MSAAColorRenderBuffer;
|
|
1558
1550
|
this._blitDrawBuffers[i] = gl.NONE;
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, MSAAColorRenderBuffer);
|
|
1551
|
+
var internalFormat = /** @ts-ignore */ this._target.getColorTexture(i)._platformTexture._formatDetail.internalFormat;
|
|
1552
|
+
this._MSAAColorRenderBuffers[i] = this._createRenderBuffer(internalFormat, gl.COLOR_ATTACHMENT0 + i);
|
|
1562
1553
|
}
|
|
1563
1554
|
gl.drawBuffers(this._oriDrawBuffers);
|
|
1564
1555
|
// prepare MSAA depth RBO
|
|
1565
1556
|
if (_depth !== null) {
|
|
1566
|
-
var _ref = _instanceof(_depth, engineCore.Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2),
|
|
1567
|
-
|
|
1568
|
-
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
1569
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, MSAADepthRenderBuffer);
|
|
1557
|
+
var _ref = _instanceof(_depth, engineCore.Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat1 = _ref.internalFormat, attachment = _ref.attachment;
|
|
1558
|
+
this._MSAADepthRenderBuffer = this._createRenderBuffer(internalFormat1, attachment);
|
|
1570
1559
|
}
|
|
1571
1560
|
this._checkFrameBuffer();
|
|
1572
1561
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
1573
1562
|
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
1574
1563
|
};
|
|
1564
|
+
_proto._createRenderBuffer = function _createRenderBuffer(internalFormat, attachment) {
|
|
1565
|
+
var gl = this._gl;
|
|
1566
|
+
var _this__target = this._target, width = _this__target.width, height = _this__target.height, antiAliasing = _this__target.antiAliasing;
|
|
1567
|
+
var renderBuffer = gl.createRenderbuffer();
|
|
1568
|
+
gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);
|
|
1569
|
+
if (antiAliasing > 1) {
|
|
1570
|
+
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
1571
|
+
} else {
|
|
1572
|
+
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
1573
|
+
}
|
|
1574
|
+
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);
|
|
1575
|
+
return renderBuffer;
|
|
1576
|
+
};
|
|
1575
1577
|
_proto._checkFrameBuffer = function _checkFrameBuffer() {
|
|
1576
1578
|
var gl = this._gl;
|
|
1577
1579
|
var e = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
|