@galacean/engine-rhi-webgl 1.5.0-alpha.0 → 1.5.0-alpha.1
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 +30 -16
- package/dist/main.js.map +1 -1
- package/dist/module.js +30 -16
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/WebGLGraphicDevice.d.ts +11 -3
package/dist/main.js
CHANGED
|
@@ -1810,9 +1810,17 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1810
1810
|
this._scissorEnable = false;
|
|
1811
1811
|
var options = _extends({
|
|
1812
1812
|
webGLMode: 0,
|
|
1813
|
-
stencil: true,
|
|
1814
1813
|
_forceFlush: false,
|
|
1815
|
-
_maxAllowSkinUniformVectorCount: 256
|
|
1814
|
+
_maxAllowSkinUniformVectorCount: 256,
|
|
1815
|
+
alpha: true,
|
|
1816
|
+
depth: true,
|
|
1817
|
+
stencil: true,
|
|
1818
|
+
failIfMajorPerformanceCaveat: false,
|
|
1819
|
+
powerPreference: "default",
|
|
1820
|
+
premultipliedAlpha: true,
|
|
1821
|
+
preserveDrawingBuffer: false,
|
|
1822
|
+
desynchronized: false,
|
|
1823
|
+
xrCompatible: false
|
|
1816
1824
|
}, initializeOptions);
|
|
1817
1825
|
if (engineCore.SystemInfo.platform === engineCore.Platform.IPhone || engineCore.SystemInfo.platform === engineCore.Platform.IPad) {
|
|
1818
1826
|
var version = engineCore.SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
|
|
@@ -1825,37 +1833,50 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1825
1833
|
}
|
|
1826
1834
|
}
|
|
1827
1835
|
this._options = options;
|
|
1836
|
+
// Force disable stencil, antialias and depth, we configure them in internal render target
|
|
1837
|
+
this._webGLOptions = {
|
|
1838
|
+
antialias: false,
|
|
1839
|
+
depth: false,
|
|
1840
|
+
stencil: false,
|
|
1841
|
+
alpha: options.alpha,
|
|
1842
|
+
failIfMajorPerformanceCaveat: options.failIfMajorPerformanceCaveat,
|
|
1843
|
+
powerPreference: options.powerPreference,
|
|
1844
|
+
premultipliedAlpha: options.premultipliedAlpha,
|
|
1845
|
+
preserveDrawingBuffer: options.preserveDrawingBuffer,
|
|
1846
|
+
desynchronized: options.desynchronized,
|
|
1847
|
+
xrCompatible: options.xrCompatible
|
|
1848
|
+
};
|
|
1828
1849
|
this._onWebGLContextLost = this._onWebGLContextLost.bind(this);
|
|
1829
1850
|
this._onWebGLContextRestored = this._onWebGLContextRestored.bind(this);
|
|
1830
1851
|
}
|
|
1831
1852
|
var _proto = WebGLGraphicDevice.prototype;
|
|
1832
1853
|
_proto.init = function init(canvas, onDeviceLost, onDeviceRestored) {
|
|
1833
|
-
var options = this._options;
|
|
1834
1854
|
var webCanvas = canvas._webCanvas;
|
|
1835
|
-
var webGLMode =
|
|
1855
|
+
var webGLMode = this._options.webGLMode;
|
|
1836
1856
|
this._onDeviceLost = onDeviceLost;
|
|
1837
1857
|
this._onDeviceRestored = onDeviceRestored;
|
|
1838
1858
|
webCanvas.addEventListener("webglcontextlost", this._onWebGLContextLost, false);
|
|
1839
1859
|
webCanvas.addEventListener("webglcontextrestored", this._onWebGLContextRestored, false);
|
|
1840
1860
|
webCanvas.addEventListener("webglcontextcreationerror", this._onContextCreationError, false);
|
|
1841
1861
|
this._webCanvas = webCanvas;
|
|
1862
|
+
var webGLOptions = this._webGLOptions;
|
|
1842
1863
|
var gl;
|
|
1843
1864
|
if (webGLMode == 0 || webGLMode == 1) {
|
|
1844
|
-
gl = webCanvas.getContext("webgl2",
|
|
1865
|
+
gl = webCanvas.getContext("webgl2", webGLOptions);
|
|
1845
1866
|
if (!gl && (typeof OffscreenCanvas === "undefined" || !_instanceof(webCanvas, OffscreenCanvas))) {
|
|
1846
|
-
gl = webCanvas.getContext("experimental-webgl2",
|
|
1867
|
+
gl = webCanvas.getContext("experimental-webgl2", webGLOptions);
|
|
1847
1868
|
}
|
|
1848
1869
|
this._isWebGL2 = true;
|
|
1849
|
-
// Prevent weird browsers to lie (such as safari!)
|
|
1870
|
+
// Prevent weird browsers to lie (such as safari!)ƒ
|
|
1850
1871
|
if (gl && !gl.deleteQuery) {
|
|
1851
1872
|
this._isWebGL2 = false;
|
|
1852
1873
|
}
|
|
1853
1874
|
}
|
|
1854
1875
|
if (!gl) {
|
|
1855
1876
|
if (webGLMode == 0 || webGLMode == 2) {
|
|
1856
|
-
gl = webCanvas.getContext("webgl",
|
|
1877
|
+
gl = webCanvas.getContext("webgl", webGLOptions);
|
|
1857
1878
|
if (!gl && (typeof OffscreenCanvas === "undefined" || !_instanceof(webCanvas, OffscreenCanvas))) {
|
|
1858
|
-
gl = webCanvas.getContext("experimental-webgl",
|
|
1879
|
+
gl = webCanvas.getContext("experimental-webgl", webGLOptions);
|
|
1859
1880
|
}
|
|
1860
1881
|
this._isWebGL2 = false;
|
|
1861
1882
|
}
|
|
@@ -2119,7 +2140,6 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
2119
2140
|
if (debugRenderInfo != null) {
|
|
2120
2141
|
this._renderer = gl.getParameter(debugRenderInfo.UNMASKED_RENDERER_WEBGL);
|
|
2121
2142
|
}
|
|
2122
|
-
this._contextAttributes = gl.getContextAttributes();
|
|
2123
2143
|
};
|
|
2124
2144
|
_proto.destroy = function destroy() {
|
|
2125
2145
|
var webCanvas = this._webCanvas;
|
|
@@ -2176,12 +2196,6 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
2176
2196
|
get: function get() {
|
|
2177
2197
|
return this.capability.canIUseMoreJoints;
|
|
2178
2198
|
}
|
|
2179
|
-
},
|
|
2180
|
-
{
|
|
2181
|
-
key: "context",
|
|
2182
|
-
get: function get() {
|
|
2183
|
-
return this._contextAttributes;
|
|
2184
|
-
}
|
|
2185
2199
|
}
|
|
2186
2200
|
]);
|
|
2187
2201
|
return WebGLGraphicDevice;
|