@galacean/engine-rhi-webgl 1.1.0-beta.9 → 1.2.0-alpha.0
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 +41 -58
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +41 -58
- package/dist/module.js +41 -58
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/WebCanvas.d.ts +2 -13
- package/types/WebGLGraphicDevice.d.ts +2 -2
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
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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,11 @@ function _instanceof(left, right) {
|
|
|
123
147
|
this._scale.set(x, y);
|
|
124
148
|
this.scale = this._scale;
|
|
125
149
|
};
|
|
150
|
+
_proto._onSizeChanged = function _onSizeChanged(width, height) {
|
|
151
|
+
this._webCanvas.width = width;
|
|
152
|
+
this._webCanvas.height = height;
|
|
153
|
+
};
|
|
126
154
|
_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
155
|
{
|
|
156
156
|
key: "scale",
|
|
157
157
|
get: /**
|
|
@@ -174,27 +174,7 @@ function _instanceof(left, right) {
|
|
|
174
174
|
}
|
|
175
175
|
]);
|
|
176
176
|
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
|
-
}
|
|
177
|
+
}(engineCore.Canvas);
|
|
198
178
|
|
|
199
179
|
/**
|
|
200
180
|
* WebGL platform engine,support includes WebGL1.0 and WebGL2.0.
|
|
@@ -1755,6 +1735,9 @@ exports.WebGLMode = void 0;
|
|
|
1755
1735
|
function WebGLGraphicDevice(initializeOptions) {
|
|
1756
1736
|
if (initializeOptions === void 0) initializeOptions = {};
|
|
1757
1737
|
/** @internal */ this._readFrameBuffer = null;
|
|
1738
|
+
/** @internal */ this._mainFrameBuffer = null;
|
|
1739
|
+
/** @internal */ this._mainFrameWidth = 0;
|
|
1740
|
+
/** @internal */ this._mainFrameHeight = 0;
|
|
1758
1741
|
/** @internal */ this._enableGlobalDepthBias = false;
|
|
1759
1742
|
this._activeTextures = new Array(32);
|
|
1760
1743
|
this._lastViewport = new engineMath.Vector4(null, null, null, null);
|
|
@@ -1926,9 +1909,9 @@ exports.WebGLMode = void 0;
|
|
|
1926
1909
|
bufferWidth = renderTarget.width >> mipLevel;
|
|
1927
1910
|
bufferHeight = renderTarget.height >> mipLevel;
|
|
1928
1911
|
} else {
|
|
1929
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER,
|
|
1930
|
-
bufferWidth = gl.drawingBufferWidth;
|
|
1931
|
-
bufferHeight = gl.drawingBufferHeight;
|
|
1912
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this._mainFrameBuffer);
|
|
1913
|
+
bufferWidth = this._mainFrameWidth || gl.drawingBufferWidth;
|
|
1914
|
+
bufferHeight = this._mainFrameHeight || gl.drawingBufferHeight;
|
|
1932
1915
|
}
|
|
1933
1916
|
var width = bufferWidth * viewport.z;
|
|
1934
1917
|
var height = bufferHeight * viewport.w;
|