@galacean/engine-rhi-webgl 2.0.0-alpha.44 → 2.0.0-alpha.45

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 CHANGED
@@ -248,7 +248,6 @@ function _create_class(Constructor, protoProps, staticProps) {
248
248
  var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
249
249
  var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
250
250
  webCanvas.setAutoResolution();
251
- // @ts-ignore
252
251
  var promise = engine._initialize(configuration);
253
252
  return promise.then(function() {
254
253
  engine.sceneManager.addScene(new engineCore.Scene(engine, "DefaultScene"));
@@ -261,7 +260,6 @@ function _create_class(Constructor, protoProps, staticProps) {
261
260
  get: /**
262
261
  * The web canvas the engine renders to.
263
262
  */ function get() {
264
- // @ts-ignore
265
263
  return this._canvas;
266
264
  }
267
265
  }
@@ -842,7 +840,6 @@ var GLBuffer = /*#__PURE__*/ function() {
842
840
  * Generate multi-level textures based on the 0th level data.
843
841
  */ _proto.generateMipmaps = function generateMipmaps() {
844
842
  var texture = this._texture;
845
- //@ts-ignore
846
843
  var mipmap = texture._mipmap;
847
844
  if (!engineCore.TextureUtils.supportGenerateMipmaps(texture.format, mipmap, texture.isSRGBColorSpace, this._isWebGL2)) {
848
845
  engineCore.Logger.warn("Auto-generating mipmaps for sRGB textures is only supported in [WebGL2 + R8G8B8A8], you must generate mipmaps manually.");
@@ -863,7 +860,6 @@ var GLBuffer = /*#__PURE__*/ function() {
863
860
  var gl = this._gl;
864
861
  var isWebGL2 = this._isWebGL2;
865
862
  var _this__formatDetail = this._formatDetail, internalFormat = _this__formatDetail.internalFormat, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
866
- // @ts-ignore
867
863
  var _this__texture = this._texture, mipmapCount = _this__texture.mipmapCount, width = _this__texture.width, height = _this__texture.height, usage = _this__texture.usage, _isDepthTexture = _this__texture._isDepthTexture;
868
864
  this._bind();
869
865
  if (isWebGL2 && !(baseFormat === gl.LUMINANCE_ALPHA || baseFormat === gl.ALPHA) && usage !== engineCore.TextureUsage.Dynamic) {
@@ -935,11 +931,10 @@ var GLBuffer = /*#__PURE__*/ function() {
935
931
  }
936
932
  var isWebGL2 = rhi.isWebGL2;
937
933
  // Validate mipmap
938
- // @ts-ignore
939
934
  var mipmap = texture._mipmap;
940
935
  if (mipmap && !engineCore.TextureUtils.supportMipmaps(width, height, isWebGL2)) {
941
936
  engineCore.Logger.warn("Non-power-2 texture is not supported for mipmap in WebGL1, and has automatically downgraded to non-mipmap");
942
- /** @ts-ignore */ texture._mipmap = false;
937
+ texture._mipmap = false;
943
938
  /** @ts-ignore */ texture._mipmapCount = texture._getMipmapCount();
944
939
  }
945
940
  };
@@ -1372,7 +1367,7 @@ var GLBuffer = /*#__PURE__*/ function() {
1372
1367
  */ function set(value) {
1373
1368
  var gl = this._gl;
1374
1369
  var target = this._target;
1375
- /** @ts-ignore */ var _mipmap = this._texture._mipmap;
1370
+ var _mipmap = this._texture._mipmap;
1376
1371
  this._bind();
1377
1372
  switch(value){
1378
1373
  case engineCore.TextureFilterMode.Point:
@@ -1505,15 +1500,13 @@ var GLBuffer = /*#__PURE__*/ function() {
1505
1500
  if (colorTexture) {
1506
1501
  var isCube = _instanceof(colorTexture, engineCore.TextureCube);
1507
1502
  if (mipChanged || isCube && faceChanged) {
1508
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, isCube ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex : gl.TEXTURE_2D, // @ts-ignore
1509
- colorTexture._platformTexture._glTexture, mipLevel);
1503
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, isCube ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex : gl.TEXTURE_2D, colorTexture._platformTexture._glTexture, mipLevel);
1510
1504
  }
1511
1505
  }
1512
1506
  var depthTexture = target.depthTexture;
1513
1507
  if (depthTexture) {
1514
1508
  var isCube1 = _instanceof(depthTexture, engineCore.TextureCube);
1515
1509
  if (mipChanged || isCube1) {
1516
- // @ts-ignore
1517
1510
  var platformTexture = depthTexture._platformTexture;
1518
1511
  gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, isCube1 ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex : gl.TEXTURE_2D, platformTexture._glTexture, mipLevel);
1519
1512
  }
@@ -1570,7 +1563,7 @@ var GLBuffer = /*#__PURE__*/ function() {
1570
1563
  _proto._bindMainFBO = function _bindMainFBO() {
1571
1564
  var gl = this._gl;
1572
1565
  var isWebGL2 = this._isWebGL2;
1573
- /** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount; _this__target.width; _this__target.height;
1566
+ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount; _this__target.width; _this__target.height;
1574
1567
  var drawBuffers = new Array(colorTextureCount);
1575
1568
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
1576
1569
  /** color render buffer */ for(var i = 0; i < colorTextureCount; i++){
@@ -1578,7 +1571,7 @@ var GLBuffer = /*#__PURE__*/ function() {
1578
1571
  var attachment = gl.COLOR_ATTACHMENT0 + i;
1579
1572
  drawBuffers[i] = attachment;
1580
1573
  if (!_instanceof(colorTexture, engineCore.TextureCube)) {
1581
- gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, /** @ts-ignore */ colorTexture._platformTexture._glTexture, 0);
1574
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, colorTexture._platformTexture._glTexture, 0);
1582
1575
  }
1583
1576
  }
1584
1577
  if (colorTextureCount > 1) {
@@ -1586,10 +1579,11 @@ var GLBuffer = /*#__PURE__*/ function() {
1586
1579
  }
1587
1580
  this._oriDrawBuffers = drawBuffers;
1588
1581
  /** depth render buffer */ if (_depth !== null) {
1589
- if (_instanceof(_depth, engineCore.Texture) && !_instanceof(_depth, engineCore.TextureCube)) {
1590
- // @ts-ignore
1591
- var platformTexture = _depth._platformTexture;
1592
- gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, gl.TEXTURE_2D, platformTexture._glTexture, 0);
1582
+ if (_instanceof(_depth, engineCore.Texture)) {
1583
+ if (!_instanceof(_depth, engineCore.TextureCube)) {
1584
+ var platformTexture = _depth._platformTexture;
1585
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, gl.TEXTURE_2D, platformTexture._glTexture, 0);
1586
+ }
1593
1587
  } else if (this._target.antiAliasing <= 1) {
1594
1588
  var _GLTexture__getRenderBufferDepthFormatDetail = GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat = _GLTexture__getRenderBufferDepthFormatDetail.internalFormat, attachment1 = _GLTexture__getRenderBufferDepthFormatDetail.attachment;
1595
1589
  this._depthRenderBuffer = this._createRenderBuffer(internalFormat, attachment1);
@@ -1601,19 +1595,19 @@ var GLBuffer = /*#__PURE__*/ function() {
1601
1595
  _proto._bindMSAAFBO = function _bindMSAAFBO() {
1602
1596
  var gl = this._gl;
1603
1597
  var isWebGL2 = this._isWebGL2;
1604
- /** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
1598
+ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
1605
1599
  this._blitDrawBuffers = new Array(colorTextureCount);
1606
1600
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._MSAAFrameBuffer);
1607
1601
  // prepare MRT+MSAA color RBOs
1608
1602
  for(var i = 0; i < colorTextureCount; i++){
1609
1603
  this._blitDrawBuffers[i] = gl.NONE;
1610
- var internalFormat = /** @ts-ignore */ this._target.getColorTexture(i)._platformTexture._formatDetail.internalFormat;
1604
+ var internalFormat = this._target.getColorTexture(i)._platformTexture._formatDetail.internalFormat;
1611
1605
  this._MSAAColorRenderBuffers[i] = this._createRenderBuffer(internalFormat, gl.COLOR_ATTACHMENT0 + i);
1612
1606
  }
1613
1607
  gl.drawBuffers(this._oriDrawBuffers);
1614
1608
  // prepare MSAA depth RBO
1615
1609
  if (_depth !== null) {
1616
- var _ref = _instanceof(_depth, engineCore.Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat1 = _ref.internalFormat, attachment = _ref.attachment;
1610
+ var _ref = _instanceof(_depth, engineCore.Texture) ? _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat1 = _ref.internalFormat, attachment = _ref.attachment;
1617
1611
  this._MSAADepthRenderBuffer = this._createRenderBuffer(internalFormat1, attachment);
1618
1612
  }
1619
1613
  this._checkFrameBuffer();
@@ -1996,10 +1990,8 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1996
1990
  var gl = this._gl;
1997
1991
  var vao = gl.createVertexArray();
1998
1992
  gl.bindVertexArray(vao);
1999
- // @ts-ignore: Access internal _platformBuffer across packages
2000
1993
  gl.bindBuffer(gl.ARRAY_BUFFER, feedbackBinding.buffer._platformBuffer._glBuffer);
2001
1994
  this._bindElements(gl, attribs, feedbackElements, feedbackBinding.stride);
2002
- // @ts-ignore: Access internal _platformBuffer across packages
2003
1995
  gl.bindBuffer(gl.ARRAY_BUFFER, inputBinding.buffer._platformBuffer._glBuffer);
2004
1996
  this._bindElements(gl, attribs, inputElements, inputBinding.stride);
2005
1997
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
@@ -2271,8 +2263,8 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2271
2263
  _proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, isFlipProjection, mipLevel, faceIndex) {
2272
2264
  var bufferWidth, bufferHeight;
2273
2265
  if (renderTarget) {
2274
- /** @ts-ignore */ renderTarget._isContentLost = false;
2275
- /** @ts-ignore */ var platformRenderTarget = renderTarget._platformRenderTarget;
2266
+ renderTarget._isContentLost = false;
2267
+ var platformRenderTarget = renderTarget._platformRenderTarget;
2276
2268
  platformRenderTarget.activeRenderTarget(mipLevel, faceIndex);
2277
2269
  bufferWidth = renderTarget.width >> mipLevel;
2278
2270
  bufferHeight = renderTarget.height >> mipLevel;
@@ -2313,7 +2305,6 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2313
2305
  gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, destFrameBuffer);
2314
2306
  var blitMask = needBlitColor ? gl.COLOR_BUFFER_BIT : 0;
2315
2307
  if (needBlitDepth || needBlitStencil) {
2316
- // @ts-ignore
2317
2308
  var depthFormat = destRT._depthFormat;
2318
2309
  if (needBlitDepth) {
2319
2310
  if (depthFormat === engineCore.TextureFormat.Depth || depthFormat >= engineCore.TextureFormat.DepthStencil && depthFormat <= engineCore.TextureFormat.Depth32Stencil8) {
@@ -2350,11 +2341,9 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2350
2341
  var _srcRT__platformRenderTarget__frameBuffer;
2351
2342
  // @ts-ignore
2352
2343
  var frameBuffer = (_srcRT__platformRenderTarget__frameBuffer = srcRT == null ? void 0 : srcRT._platformRenderTarget._frameBuffer) != null ? _srcRT__platformRenderTarget__frameBuffer : this._mainFrameBuffer;
2353
- // @ts-ignore
2354
2344
  gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);
2355
- // @ts-ignore
2356
2345
  var glTexture = grabTexture._platformTexture;
2357
- glTexture._bind();
2346
+ this.bindTexture(glTexture);
2358
2347
  gl.copyTexSubImage2D(glTexture._target, 0, 0, 0, xStart, yStart, copyWidth, copyHeight);
2359
2348
  };
2360
2349
  _proto.activeTexture = function activeTexture(textureID) {