@galacean/engine-rhi-webgl 1.1.0-beta.9 → 1.1.2

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
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var engineMath = require('@galacean/engine-math');
6
5
  var engineCore = require('@galacean/engine-core');
6
+ var engineMath = require('@galacean/engine-math');
7
7
 
8
8
  /**
9
9
  * Smoothing plug-in.
@@ -86,6 +86,26 @@ function _create_class(Constructor, protoProps, staticProps) {
86
86
  return Constructor;
87
87
  }
88
88
 
89
+ function _set_prototype_of(o, p) {
90
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
91
+ o.__proto__ = p;
92
+
93
+ return o;
94
+ };
95
+
96
+ return _set_prototype_of(o, p);
97
+ }
98
+
99
+ function _inherits(subClass, superClass) {
100
+ if (typeof superClass !== "function" && superClass !== null) {
101
+ throw new TypeError("Super expression must either be null or a function");
102
+ }
103
+
104
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
105
+
106
+ if (superClass) _set_prototype_of(subClass, superClass);
107
+ }
108
+
89
109
  function _instanceof(left, right) {
90
110
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
91
111
  return !!right[Symbol.hasInstance](left);
@@ -94,14 +114,18 @@ function _instanceof(left, right) {
94
114
 
95
115
  /**
96
116
  * The canvas used on the web, which can support HTMLCanvasElement and OffscreenCanvas.
97
- */ var WebCanvas = /*#__PURE__*/ function() {
117
+ */ var WebCanvas = /*#__PURE__*/ function(Canvas1) {
118
+ _inherits(WebCanvas, Canvas1);
98
119
  function WebCanvas(webCanvas) {
99
- this._scale = new engineMath.Vector2();
120
+ var _this;
121
+ _this = Canvas1.call(this) || this;
122
+ _this._scale = new engineMath.Vector2();
100
123
  var width = webCanvas.width;
101
124
  var height = webCanvas.height;
102
- this._webCanvas = webCanvas;
103
- this._width = width;
104
- this._height = height;
125
+ _this._webCanvas = webCanvas;
126
+ _this.width = width;
127
+ _this.height = height;
128
+ return _this;
105
129
  }
106
130
  var _proto = WebCanvas.prototype;
107
131
  /**
@@ -123,35 +147,13 @@ function _instanceof(left, right) {
123
147
  this._scale.set(x, y);
124
148
  this.scale = this._scale;
125
149
  };
150
+ _proto._onWidthChanged = function _onWidthChanged(value) {
151
+ this._webCanvas.width = value;
152
+ };
153
+ _proto._onHeightChange = function _onHeightChange(value) {
154
+ this._webCanvas.height = value;
155
+ };
126
156
  _create_class(WebCanvas, [
127
- {
128
- key: "width",
129
- get: /**
130
- * @inheritdoc
131
- */ function get() {
132
- return this._width;
133
- },
134
- set: function set(value) {
135
- if (this._width !== value) {
136
- this._webCanvas.width = value;
137
- this._width = value;
138
- }
139
- }
140
- },
141
- {
142
- key: "height",
143
- get: /**
144
- * @inheritdoc
145
- */ function get() {
146
- return this._height;
147
- },
148
- set: function set(value) {
149
- if (this._height !== value) {
150
- this._webCanvas.height = value;
151
- this._height = value;
152
- }
153
- }
154
- },
155
157
  {
156
158
  key: "scale",
157
159
  get: /**
@@ -174,27 +176,7 @@ function _instanceof(left, right) {
174
176
  }
175
177
  ]);
176
178
  return WebCanvas;
177
- }();
178
-
179
- function _set_prototype_of(o, p) {
180
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
181
- o.__proto__ = p;
182
-
183
- return o;
184
- };
185
-
186
- return _set_prototype_of(o, p);
187
- }
188
-
189
- function _inherits(subClass, superClass) {
190
- if (typeof superClass !== "function" && superClass !== null) {
191
- throw new TypeError("Super expression must either be null or a function");
192
- }
193
-
194
- subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
195
-
196
- if (superClass) _set_prototype_of(subClass, superClass);
197
- }
179
+ }(engineCore.Canvas);
198
180
 
199
181
  /**
200
182
  * WebGL platform engine,support includes WebGL1.0 and WebGL2.0.
@@ -366,7 +348,7 @@ var GLBuffer = /*#__PURE__*/ function() {
366
348
  var cap = this.capabilityList;
367
349
  var isWebGL2 = this.rhi.isWebGL2;
368
350
  var requireExtension = this.rhi.requireExtension.bind(this.rhi);
369
- var shaderVertexID = engineCore.GLCapabilityType.shaderVertexID, standardDerivatives = engineCore.GLCapabilityType.standardDerivatives, shaderTextureLod = engineCore.GLCapabilityType.shaderTextureLod, elementIndexUint = engineCore.GLCapabilityType.elementIndexUint, depthTexture = engineCore.GLCapabilityType.depthTexture, vertexArrayObject = engineCore.GLCapabilityType.vertexArrayObject, instancedArrays = engineCore.GLCapabilityType.instancedArrays, multipleSample = engineCore.GLCapabilityType.multipleSample, drawBuffers = engineCore.GLCapabilityType.drawBuffers, astc = engineCore.GLCapabilityType.astc, astc_webkit = engineCore.GLCapabilityType.astc_webkit, etc = engineCore.GLCapabilityType.etc, etc_webkit = engineCore.GLCapabilityType.etc_webkit, etc1 = engineCore.GLCapabilityType.etc1, etc1_webkit = engineCore.GLCapabilityType.etc1_webkit, pvrtc = engineCore.GLCapabilityType.pvrtc, pvrtc_webkit = engineCore.GLCapabilityType.pvrtc_webkit, s3tc = engineCore.GLCapabilityType.s3tc, s3tc_webkit = engineCore.GLCapabilityType.s3tc_webkit, bptc = engineCore.GLCapabilityType.bptc, textureFloat = engineCore.GLCapabilityType.textureFloat, textureHalfFloat = engineCore.GLCapabilityType.textureHalfFloat, textureFloatLinear = engineCore.GLCapabilityType.textureFloatLinear, textureHalfFloatLinear = engineCore.GLCapabilityType.textureHalfFloatLinear, WEBGL_colorBufferFloat = engineCore.GLCapabilityType.WEBGL_colorBufferFloat, colorBufferFloat = engineCore.GLCapabilityType.colorBufferFloat, colorBufferHalfFloat = engineCore.GLCapabilityType.colorBufferHalfFloat, textureFilterAnisotropic = engineCore.GLCapabilityType.textureFilterAnisotropic;
351
+ var shaderVertexID = engineCore.GLCapabilityType.shaderVertexID, standardDerivatives = engineCore.GLCapabilityType.standardDerivatives, shaderTextureLod = engineCore.GLCapabilityType.shaderTextureLod, elementIndexUint = engineCore.GLCapabilityType.elementIndexUint, depthTexture = engineCore.GLCapabilityType.depthTexture, vertexArrayObject = engineCore.GLCapabilityType.vertexArrayObject, instancedArrays = engineCore.GLCapabilityType.instancedArrays, multipleSample = engineCore.GLCapabilityType.multipleSample, drawBuffers = engineCore.GLCapabilityType.drawBuffers, blendMinMax = engineCore.GLCapabilityType.blendMinMax, astc = engineCore.GLCapabilityType.astc, astc_webkit = engineCore.GLCapabilityType.astc_webkit, etc = engineCore.GLCapabilityType.etc, etc_webkit = engineCore.GLCapabilityType.etc_webkit, etc1 = engineCore.GLCapabilityType.etc1, etc1_webkit = engineCore.GLCapabilityType.etc1_webkit, pvrtc = engineCore.GLCapabilityType.pvrtc, pvrtc_webkit = engineCore.GLCapabilityType.pvrtc_webkit, s3tc = engineCore.GLCapabilityType.s3tc, s3tc_webkit = engineCore.GLCapabilityType.s3tc_webkit, bptc = engineCore.GLCapabilityType.bptc, textureFloat = engineCore.GLCapabilityType.textureFloat, textureHalfFloat = engineCore.GLCapabilityType.textureHalfFloat, textureFloatLinear = engineCore.GLCapabilityType.textureFloatLinear, textureHalfFloatLinear = engineCore.GLCapabilityType.textureHalfFloatLinear, WEBGL_colorBufferFloat = engineCore.GLCapabilityType.WEBGL_colorBufferFloat, colorBufferFloat = engineCore.GLCapabilityType.colorBufferFloat, colorBufferHalfFloat = engineCore.GLCapabilityType.colorBufferHalfFloat, textureFilterAnisotropic = engineCore.GLCapabilityType.textureFilterAnisotropic;
370
352
  cap.set(shaderVertexID, isWebGL2);
371
353
  cap.set(standardDerivatives, isWebGL2 || !!requireExtension(standardDerivatives));
372
354
  cap.set(shaderTextureLod, isWebGL2 || !!requireExtension(shaderTextureLod));
@@ -376,6 +358,7 @@ var GLBuffer = /*#__PURE__*/ function() {
376
358
  cap.set(instancedArrays, isWebGL2 || !!requireExtension(instancedArrays));
377
359
  cap.set(multipleSample, isWebGL2);
378
360
  cap.set(drawBuffers, isWebGL2 || !!requireExtension(drawBuffers));
361
+ cap.set(blendMinMax, isWebGL2 || !!requireExtension(blendMinMax));
379
362
  cap.set(textureFloat, isWebGL2 || !!requireExtension(textureFloat));
380
363
  cap.set(textureHalfFloat, isWebGL2 || !!requireExtension(textureHalfFloat));
381
364
  cap.set(textureFloatLinear, !!requireExtension(textureFloatLinear));
@@ -416,9 +399,13 @@ var GLBuffer = /*#__PURE__*/ function() {
416
399
  }
417
400
  };
418
401
  _proto._compatibleAllInterface = function _compatibleAllInterface() {
419
- var depthTexture = engineCore.GLCapabilityType.depthTexture, vertexArrayObject = engineCore.GLCapabilityType.vertexArrayObject, instancedArrays = engineCore.GLCapabilityType.instancedArrays, drawBuffers = engineCore.GLCapabilityType.drawBuffers, textureFilterAnisotropic = engineCore.GLCapabilityType.textureFilterAnisotropic, textureHalfFloat = engineCore.GLCapabilityType.textureHalfFloat, colorBufferHalfFloat = engineCore.GLCapabilityType.colorBufferHalfFloat, WEBGL_colorBufferFloat = engineCore.GLCapabilityType.WEBGL_colorBufferFloat;
402
+ var depthTexture = engineCore.GLCapabilityType.depthTexture, vertexArrayObject = engineCore.GLCapabilityType.vertexArrayObject, instancedArrays = engineCore.GLCapabilityType.instancedArrays, drawBuffers = engineCore.GLCapabilityType.drawBuffers, textureFilterAnisotropic = engineCore.GLCapabilityType.textureFilterAnisotropic, textureHalfFloat = engineCore.GLCapabilityType.textureHalfFloat, colorBufferHalfFloat = engineCore.GLCapabilityType.colorBufferHalfFloat, WEBGL_colorBufferFloat = engineCore.GLCapabilityType.WEBGL_colorBufferFloat, blendMinMax = engineCore.GLCapabilityType.blendMinMax;
420
403
  var isWebGL2 = this.rhi.isWebGL2;
421
404
  if (!isWebGL2) {
405
+ this._compatibleInterface(blendMinMax, {
406
+ MIN: "MIN_EXT",
407
+ MAX: "MAX_EXT"
408
+ });
422
409
  this._compatibleInterface(depthTexture, {
423
410
  UNSIGNED_INT_24_8: "UNSIGNED_INT_24_8_WEBGL"
424
411
  });