|
@@ -30657,6 +30657,137 @@ var SkeletonViewer = /** @class */ (function () {
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
+/***/ "./Engines/Extensions/engine.alpha.ts":
|
|
|
|
+/*!********************************************!*\
|
|
|
|
+ !*** ./Engines/Extensions/engine.alpha.ts ***!
|
|
|
|
+ \********************************************/
|
|
|
|
+/*! no exports provided */
|
|
|
|
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
+
|
|
|
|
+"use strict";
|
|
|
|
+__webpack_require__.r(__webpack_exports__);
|
|
|
|
+/* harmony import */ var _Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/thinEngine */ "./Engines/thinEngine.ts");
|
|
|
|
+/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants */ "./Engines/constants.ts");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+_Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__["ThinEngine"].prototype.setAlphaConstants = function (r, g, b, a) {
|
|
|
|
+ this._alphaState.setAlphaBlendConstants(r, g, b, a);
|
|
|
|
+};
|
|
|
|
+_Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__["ThinEngine"].prototype.setAlphaMode = function (mode, noDepthWriteChange) {
|
|
|
|
+ if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }
|
|
|
|
+ if (this._alphaMode === mode) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ switch (mode) {
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_DISABLE:
|
|
|
|
+ this._alphaState.alphaBlend = false;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_PREMULTIPLIED:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_PREMULTIPLIED_PORTERDUFF:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_COMBINE:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_ONEONE:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_ADD:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_SUBTRACT:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_MULTIPLY:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_MAXIMIZED:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_INTERPOLATE:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_SCREENMODE:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_ONEONE_ONEONE:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_ALPHATOCOLOR:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_REVERSEONEMINUS:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_SRC_DSTONEMINUSSRCALPHA:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_ONEONE_ONEZERO:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EXCLUSION:
|
|
|
|
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);
|
|
|
|
+ this._alphaState.alphaBlend = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (!noDepthWriteChange) {
|
|
|
|
+ this.depthCullingState.depthMask = (mode === _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_DISABLE);
|
|
|
|
+ }
|
|
|
|
+ this._alphaMode = mode;
|
|
|
|
+};
|
|
|
|
+_Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__["ThinEngine"].prototype.getAlphaMode = function () {
|
|
|
|
+ return this._alphaMode;
|
|
|
|
+};
|
|
|
|
+_Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__["ThinEngine"].prototype.setAlphaEquation = function (equation) {
|
|
|
|
+ if (this._alphaEquation === equation) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ switch (equation) {
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EQUATION_ADD:
|
|
|
|
+ this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD, this._gl.FUNC_ADD);
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EQUATION_SUBSTRACT:
|
|
|
|
+ this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT, this._gl.FUNC_SUBTRACT);
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EQUATION_REVERSE_SUBTRACT:
|
|
|
|
+ this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT, this._gl.FUNC_REVERSE_SUBTRACT);
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EQUATION_MAX:
|
|
|
|
+ this._alphaState.setAlphaEquationParameters(this._gl.MAX, this._gl.MAX);
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EQUATION_MIN:
|
|
|
|
+ this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.MIN);
|
|
|
|
+ break;
|
|
|
|
+ case _constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ALPHA_EQUATION_DARKEN:
|
|
|
|
+ this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.FUNC_ADD);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ this._alphaEquation = equation;
|
|
|
|
+};
|
|
|
|
+_Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__["ThinEngine"].prototype.getAlphaEquation = function () {
|
|
|
|
+ return this._alphaEquation;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/***/ }),
|
|
|
|
+
|
|
/***/ "./Engines/Extensions/engine.cubeTexture.ts":
|
|
/***/ "./Engines/Extensions/engine.cubeTexture.ts":
|
|
/*!**************************************************!*\
|
|
/*!**************************************************!*\
|
|
!*** ./Engines/Extensions/engine.cubeTexture.ts ***!
|
|
!*** ./Engines/Extensions/engine.cubeTexture.ts ***!
|
|
@@ -31969,8 +32100,8 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_5__["ThinEngine"].prototype.createRenderTar
|
|
var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_3__["RenderTargetCreationOptions"]();
|
|
var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_3__["RenderTargetCreationOptions"]();
|
|
if (options !== undefined && typeof options === "object") {
|
|
if (options !== undefined && typeof options === "object") {
|
|
fullOptions.generateMipMaps = options.generateMipMaps;
|
|
fullOptions.generateMipMaps = options.generateMipMaps;
|
|
- fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;
|
|
|
|
- fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;
|
|
|
|
|
|
+ fullOptions.generateDepthBuffer = !!options.generateDepthBuffer;
|
|
|
|
+ fullOptions.generateStencilBuffer = !!options.generateStencilBuffer;
|
|
fullOptions.type = options.type === undefined ? _constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURETYPE_UNSIGNED_INT : options.type;
|
|
fullOptions.type = options.type === undefined ? _constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURETYPE_UNSIGNED_INT : options.type;
|
|
fullOptions.samplingMode = options.samplingMode === undefined ? _constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;
|
|
fullOptions.samplingMode = options.samplingMode === undefined ? _constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;
|
|
fullOptions.format = options.format === undefined ? _constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTUREFORMAT_RGBA : options.format;
|
|
fullOptions.format = options.format === undefined ? _constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTUREFORMAT_RGBA : options.format;
|
|
@@ -33608,56 +33739,61 @@ var Constants = /** @class */ (function () {
|
|
}
|
|
}
|
|
/** Defines that alpha blending is disabled */
|
|
/** Defines that alpha blending is disabled */
|
|
Constants.ALPHA_DISABLE = 0;
|
|
Constants.ALPHA_DISABLE = 0;
|
|
- /** Defines that alpha blending to SRC ALPHA * SRC + DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is SRC ALPHA * SRC + DEST */
|
|
Constants.ALPHA_ADD = 1;
|
|
Constants.ALPHA_ADD = 1;
|
|
- /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
|
|
Constants.ALPHA_COMBINE = 2;
|
|
Constants.ALPHA_COMBINE = 2;
|
|
- /** Defines that alpha blending to DEST - SRC * DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is DEST - SRC * DEST */
|
|
Constants.ALPHA_SUBTRACT = 3;
|
|
Constants.ALPHA_SUBTRACT = 3;
|
|
- /** Defines that alpha blending to SRC * DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is SRC * DEST */
|
|
Constants.ALPHA_MULTIPLY = 4;
|
|
Constants.ALPHA_MULTIPLY = 4;
|
|
- /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC) * DEST */
|
|
Constants.ALPHA_MAXIMIZED = 5;
|
|
Constants.ALPHA_MAXIMIZED = 5;
|
|
- /** Defines that alpha blending to SRC + DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is SRC + DEST */
|
|
Constants.ALPHA_ONEONE = 6;
|
|
Constants.ALPHA_ONEONE = 6;
|
|
- /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST */
|
|
Constants.ALPHA_PREMULTIPLIED = 7;
|
|
Constants.ALPHA_PREMULTIPLIED = 7;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
|
|
|
|
|
|
+ * Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST
|
|
* Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
|
|
* Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
|
|
*/
|
|
*/
|
|
Constants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;
|
|
Constants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;
|
|
- /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */
|
|
|
|
|
|
+ /** Defines that alpha blending is CST * SRC + (1 - CST) * DEST */
|
|
Constants.ALPHA_INTERPOLATE = 9;
|
|
Constants.ALPHA_INTERPOLATE = 9;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC + (1 - SRC) * DEST
|
|
|
|
|
|
+ * Defines that alpha blending is SRC + (1 - SRC) * DEST
|
|
* Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
|
|
* Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
|
|
*/
|
|
*/
|
|
Constants.ALPHA_SCREENMODE = 10;
|
|
Constants.ALPHA_SCREENMODE = 10;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC + DST
|
|
|
|
|
|
+ * Defines that alpha blending is SRC + DST
|
|
* Alpha will be set to SRC ALPHA + DST ALPHA
|
|
* Alpha will be set to SRC ALPHA + DST ALPHA
|
|
*/
|
|
*/
|
|
Constants.ALPHA_ONEONE_ONEONE = 11;
|
|
Constants.ALPHA_ONEONE_ONEONE = 11;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC * DST ALPHA + DST
|
|
|
|
|
|
+ * Defines that alpha blending is SRC * DST ALPHA + DST
|
|
* Alpha will be set to 0
|
|
* Alpha will be set to 0
|
|
*/
|
|
*/
|
|
Constants.ALPHA_ALPHATOCOLOR = 12;
|
|
Constants.ALPHA_ALPHATOCOLOR = 12;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC * (1 - DST) + DST * (1 - SRC)
|
|
|
|
|
|
+ * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)
|
|
*/
|
|
*/
|
|
Constants.ALPHA_REVERSEONEMINUS = 13;
|
|
Constants.ALPHA_REVERSEONEMINUS = 13;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC + DST * (1 - SRC ALPHA)
|
|
|
|
|
|
+ * Defines that alpha blending is SRC + DST * (1 - SRC ALPHA)
|
|
* Alpha will be set to SRC ALPHA + DST ALPHA * (1 - SRC ALPHA)
|
|
* Alpha will be set to SRC ALPHA + DST ALPHA * (1 - SRC ALPHA)
|
|
*/
|
|
*/
|
|
Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA = 14;
|
|
Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA = 14;
|
|
/**
|
|
/**
|
|
- * Defines that alpha blending to SRC + DST
|
|
|
|
|
|
+ * Defines that alpha blending is SRC + DST
|
|
* Alpha will be set to SRC ALPHA
|
|
* Alpha will be set to SRC ALPHA
|
|
*/
|
|
*/
|
|
Constants.ALPHA_ONEONE_ONEZERO = 15;
|
|
Constants.ALPHA_ONEONE_ONEZERO = 15;
|
|
|
|
+ /**
|
|
|
|
+ * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)
|
|
|
|
+ * Alpha will be set to DST ALPHA
|
|
|
|
+ */
|
|
|
|
+ Constants.ALPHA_EXCLUSION = 16;
|
|
/** Defines that alpha blending equation a SUM */
|
|
/** Defines that alpha blending equation a SUM */
|
|
Constants.ALPHA_EQUATION_ADD = 0;
|
|
Constants.ALPHA_EQUATION_ADD = 0;
|
|
/** Defines that alpha blending equation a SUBSTRACTION */
|
|
/** Defines that alpha blending equation a SUBSTRACTION */
|
|
@@ -34080,6 +34216,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/perfCounter */ "./Misc/perfCounter.ts");
|
|
/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/perfCounter */ "./Misc/perfCounter.ts");
|
|
/* harmony import */ var _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/WebGL/webGLDataBuffer */ "./Meshes/WebGL/webGLDataBuffer.ts");
|
|
/* harmony import */ var _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/WebGL/webGLDataBuffer */ "./Meshes/WebGL/webGLDataBuffer.ts");
|
|
/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Misc/logger */ "./Misc/logger.ts");
|
|
/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Misc/logger */ "./Misc/logger.ts");
|
|
|
|
+/* harmony import */ var _Extensions_engine_alpha__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Extensions/engine.alpha */ "./Engines/Extensions/engine.alpha.ts");
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -34168,10 +34306,6 @@ var Engine = /** @class */ (function (_super) {
|
|
* Observable raised when the engine has jsut compiled a shader
|
|
* Observable raised when the engine has jsut compiled a shader
|
|
*/
|
|
*/
|
|
_this.onAfterShaderCompilationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
|
|
_this.onAfterShaderCompilationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
|
|
- /** @hidden */
|
|
|
|
- _this._alphaMode = _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_ADD;
|
|
|
|
- /** @hidden */
|
|
|
|
- _this._alphaEquation = _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_DISABLE;
|
|
|
|
// Deterministic lockstepMaxSteps
|
|
// Deterministic lockstepMaxSteps
|
|
_this._deterministicLockstep = false;
|
|
_this._deterministicLockstep = false;
|
|
_this._lockstepMaxSteps = 4;
|
|
_this._lockstepMaxSteps = 4;
|
|
@@ -34515,157 +34649,6 @@ var Engine = /** @class */ (function (_super) {
|
|
this._depthCullingState.depthMask = enable;
|
|
this._depthCullingState.depthMask = enable;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Enable or disable color writing
|
|
|
|
- * @param enable defines the state to set
|
|
|
|
- */
|
|
|
|
- Engine.prototype.setColorWrite = function (enable) {
|
|
|
|
- this._gl.colorMask(enable, enable, enable, enable);
|
|
|
|
- this._colorWrite = enable;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Gets a boolean indicating if color writing is enabled
|
|
|
|
- * @returns the current color writing state
|
|
|
|
- */
|
|
|
|
- Engine.prototype.getColorWrite = function () {
|
|
|
|
- return this._colorWrite;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Sets alpha constants used by some alpha blending modes
|
|
|
|
- * @param r defines the red component
|
|
|
|
- * @param g defines the green component
|
|
|
|
- * @param b defines the blue component
|
|
|
|
- * @param a defines the alpha component
|
|
|
|
- */
|
|
|
|
- Engine.prototype.setAlphaConstants = function (r, g, b, a) {
|
|
|
|
- this._alphaState.setAlphaBlendConstants(r, g, b, a);
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Sets the current alpha mode
|
|
|
|
- * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)
|
|
|
|
- * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)
|
|
|
|
- * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered
|
|
|
|
- */
|
|
|
|
- Engine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {
|
|
|
|
- if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }
|
|
|
|
- if (this._alphaMode === mode) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- switch (mode) {
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_DISABLE:
|
|
|
|
- this._alphaState.alphaBlend = false;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_PREMULTIPLIED:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_PREMULTIPLIED_PORTERDUFF:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_COMBINE:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_ONEONE:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_ADD:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_SUBTRACT:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_MULTIPLY:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_MAXIMIZED:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_INTERPOLATE:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_SCREENMODE:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_ONEONE_ONEONE:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_ALPHATOCOLOR:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_REVERSEONEMINUS:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_SRC_DSTONEMINUSSRCALPHA:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_ONEONE_ONEZERO:
|
|
|
|
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);
|
|
|
|
- this._alphaState.alphaBlend = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- if (!noDepthWriteChange) {
|
|
|
|
- this.setDepthWrite(mode === _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_DISABLE);
|
|
|
|
- }
|
|
|
|
- this._alphaMode = mode;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Gets the current alpha mode
|
|
|
|
- * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered
|
|
|
|
- * @returns the current alpha mode
|
|
|
|
- */
|
|
|
|
- Engine.prototype.getAlphaMode = function () {
|
|
|
|
- return this._alphaMode;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Sets the current alpha equation
|
|
|
|
- * @param equation defines the equation to use (one of the Engine.ALPHA_EQUATION_XXX)
|
|
|
|
- */
|
|
|
|
- Engine.prototype.setAlphaEquation = function (equation) {
|
|
|
|
- if (this._alphaEquation === equation) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- switch (equation) {
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_EQUATION_ADD:
|
|
|
|
- this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD, this._gl.FUNC_ADD);
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_EQUATION_SUBSTRACT:
|
|
|
|
- this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT, this._gl.FUNC_SUBTRACT);
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_EQUATION_REVERSE_SUBTRACT:
|
|
|
|
- this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT, this._gl.FUNC_REVERSE_SUBTRACT);
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_EQUATION_MAX:
|
|
|
|
- this._alphaState.setAlphaEquationParameters(this._gl.MAX, this._gl.MAX);
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_EQUATION_MIN:
|
|
|
|
- this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.MIN);
|
|
|
|
- break;
|
|
|
|
- case _constants__WEBPACK_IMPORTED_MODULE_6__["Constants"].ALPHA_EQUATION_DARKEN:
|
|
|
|
- this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.FUNC_ADD);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- this._alphaEquation = equation;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Gets the current alpha equation.
|
|
|
|
- * @returns the current alpha equation
|
|
|
|
- */
|
|
|
|
- Engine.prototype.getAlphaEquation = function () {
|
|
|
|
- return this._alphaEquation;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
* Gets a boolean indicating if stencil buffer is enabled
|
|
* Gets a boolean indicating if stencil buffer is enabled
|
|
* @returns the current stencil buffer state
|
|
* @returns the current stencil buffer state
|
|
*/
|
|
*/
|
|
@@ -38176,7 +38159,6 @@ var ThinEngine = /** @class */ (function () {
|
|
this._badOS = false;
|
|
this._badOS = false;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._badDesktopOS = false;
|
|
this._badDesktopOS = false;
|
|
- this._colorWrite = true;
|
|
|
|
this._renderingQueueLaunched = false;
|
|
this._renderingQueueLaunched = false;
|
|
this._activeRenderLoops = new Array();
|
|
this._activeRenderLoops = new Array();
|
|
// Lost context
|
|
// Lost context
|
|
@@ -38197,11 +38179,19 @@ var ThinEngine = /** @class */ (function () {
|
|
this.disableVertexArrayObjects = false;
|
|
this.disableVertexArrayObjects = false;
|
|
// States
|
|
// States
|
|
/** @hidden */
|
|
/** @hidden */
|
|
|
|
+ this._colorWrite = true;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._colorWriteChanged = true;
|
|
|
|
+ /** @hidden */
|
|
this._depthCullingState = new _States_depthCullingState__WEBPACK_IMPORTED_MODULE_4__["DepthCullingState"]();
|
|
this._depthCullingState = new _States_depthCullingState__WEBPACK_IMPORTED_MODULE_4__["DepthCullingState"]();
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._stencilState = new _States_stencilState__WEBPACK_IMPORTED_MODULE_5__["StencilState"]();
|
|
this._stencilState = new _States_stencilState__WEBPACK_IMPORTED_MODULE_5__["StencilState"]();
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._alphaState = new _States_alphaCullingState__WEBPACK_IMPORTED_MODULE_6__["AlphaState"]();
|
|
this._alphaState = new _States_alphaCullingState__WEBPACK_IMPORTED_MODULE_6__["AlphaState"]();
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._alphaMode = _constants__WEBPACK_IMPORTED_MODULE_7__["Constants"].ALPHA_ADD;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._alphaEquation = _constants__WEBPACK_IMPORTED_MODULE_7__["Constants"].ALPHA_DISABLE;
|
|
// Cache
|
|
// Cache
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._internalTexturesCache = new Array();
|
|
this._internalTexturesCache = new Array();
|
|
@@ -38242,6 +38232,19 @@ var ThinEngine = /** @class */ (function () {
|
|
* value would be set.
|
|
* value would be set.
|
|
*/
|
|
*/
|
|
this.enableUnpackFlipYCached = true;
|
|
this.enableUnpackFlipYCached = true;
|
|
|
|
+ this._getDepthStencilBuffer = function (width, height, samples, internalFormat, msInternalFormat, attachment) {
|
|
|
|
+ var gl = _this._gl;
|
|
|
|
+ var depthStencilBuffer = gl.createRenderbuffer();
|
|
|
|
+ gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
|
|
|
|
+ if (samples > 1) {
|
|
|
|
+ gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, msInternalFormat, width, height);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
|
|
+ }
|
|
|
|
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthStencilBuffer);
|
|
|
|
+ return depthStencilBuffer;
|
|
|
|
+ };
|
|
this._boundUniforms = {};
|
|
this._boundUniforms = {};
|
|
var canvas = null;
|
|
var canvas = null;
|
|
if (!canvasOrContext) {
|
|
if (!canvasOrContext) {
|
|
@@ -39597,22 +39600,7 @@ var ThinEngine = /** @class */ (function () {
|
|
this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);
|
|
this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);
|
|
}
|
|
}
|
|
if (offsetLocations[0].index !== undefined) {
|
|
if (offsetLocations[0].index !== undefined) {
|
|
- var stride = 0;
|
|
|
|
- for (var i = 0; i < offsetLocations.length; i++) {
|
|
|
|
- var ai = offsetLocations[i];
|
|
|
|
- stride += ai.attributeSize * 4;
|
|
|
|
- }
|
|
|
|
- for (var i = 0; i < offsetLocations.length; i++) {
|
|
|
|
- var ai = offsetLocations[i];
|
|
|
|
- if (!this._vertexAttribArraysEnabled[ai.index]) {
|
|
|
|
- this._gl.enableVertexAttribArray(ai.index);
|
|
|
|
- this._vertexAttribArraysEnabled[ai.index] = true;
|
|
|
|
- }
|
|
|
|
- this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);
|
|
|
|
- this._gl.vertexAttribDivisor(ai.index, 1);
|
|
|
|
- this._currentInstanceLocations.push(ai.index);
|
|
|
|
- this._currentInstanceBuffers.push(instancesBuffer);
|
|
|
|
- }
|
|
|
|
|
|
+ this.bindInstancesBuffer(instancesBuffer, offsetLocations, true);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
for (var index = 0; index < 4; index++) {
|
|
for (var index = 0; index < 4; index++) {
|
|
@@ -39629,12 +39617,73 @@ var ThinEngine = /** @class */ (function () {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Apply all cached states (depth, culling, stencil and alpha)
|
|
|
|
|
|
+ * Bind the content of a webGL buffer used with instanciation
|
|
|
|
+ * @param instancesBuffer defines the webGL buffer to bind
|
|
|
|
+ * @param attributesInfo defines the offsets or attributes information used to determine where data must be stored in the buffer
|
|
|
|
+ * @param computeStride defines Wether to compute the strides from the info or use the default 0
|
|
*/
|
|
*/
|
|
- ThinEngine.prototype.applyStates = function () {
|
|
|
|
- this._depthCullingState.apply(this._gl);
|
|
|
|
- this._stencilState.apply(this._gl);
|
|
|
|
- this._alphaState.apply(this._gl);
|
|
|
|
|
|
+ ThinEngine.prototype.bindInstancesBuffer = function (instancesBuffer, attributesInfo, computeStride) {
|
|
|
|
+ if (computeStride === void 0) { computeStride = true; }
|
|
|
|
+ this.bindArrayBuffer(instancesBuffer);
|
|
|
|
+ var stride = 0;
|
|
|
|
+ if (computeStride) {
|
|
|
|
+ for (var i = 0; i < attributesInfo.length; i++) {
|
|
|
|
+ var ai = attributesInfo[i];
|
|
|
|
+ stride += ai.attributeSize * 4;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (var i = 0; i < attributesInfo.length; i++) {
|
|
|
|
+ var ai = attributesInfo[i];
|
|
|
|
+ if (ai.index === undefined) {
|
|
|
|
+ ai.index = this._currentEffect.getAttributeLocationByName(ai.attributeName);
|
|
|
|
+ }
|
|
|
|
+ if (!this._vertexAttribArraysEnabled[ai.index]) {
|
|
|
|
+ this._gl.enableVertexAttribArray(ai.index);
|
|
|
|
+ this._vertexAttribArraysEnabled[ai.index] = true;
|
|
|
|
+ }
|
|
|
|
+ this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);
|
|
|
|
+ this._gl.vertexAttribDivisor(ai.index, ai.divisor === undefined ? 1 : ai.divisor);
|
|
|
|
+ this._currentInstanceLocations.push(ai.index);
|
|
|
|
+ this._currentInstanceBuffers.push(instancesBuffer);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Disable the instance attribute corresponding to the name in parameter
|
|
|
|
+ * @param name defines the name of the attribute to disable
|
|
|
|
+ */
|
|
|
|
+ ThinEngine.prototype.disableInstanceAttributeByName = function (name) {
|
|
|
|
+ if (!this._currentEffect) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var attributeLocation = this._currentEffect.getAttributeLocationByName(name);
|
|
|
|
+ this.disableInstanceAttribute(attributeLocation);
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Disable the instance attribute corresponding to the location in parameter
|
|
|
|
+ * @param attributeLocation defines the attribute location of the attribute to disable
|
|
|
|
+ */
|
|
|
|
+ ThinEngine.prototype.disableInstanceAttribute = function (attributeLocation) {
|
|
|
|
+ var shouldClean = false;
|
|
|
|
+ var index;
|
|
|
|
+ while ((index = this._currentInstanceLocations.indexOf(attributeLocation)) !== -1) {
|
|
|
|
+ this._currentInstanceLocations.splice(index, 1);
|
|
|
|
+ this._currentInstanceBuffers.splice(index, 1);
|
|
|
|
+ shouldClean = true;
|
|
|
|
+ index = this._currentInstanceLocations.indexOf(attributeLocation);
|
|
|
|
+ }
|
|
|
|
+ if (shouldClean) {
|
|
|
|
+ this._gl.vertexAttribDivisor(attributeLocation, 0);
|
|
|
|
+ this.disableAttributeByIndex(attributeLocation);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Disable the attribute corresponding to the location in parameter
|
|
|
|
+ * @param attributeLocation defines the attribute location of the attribute to disable
|
|
|
|
+ */
|
|
|
|
+ ThinEngine.prototype.disableAttributeByIndex = function (attributeLocation) {
|
|
|
|
+ this._gl.disableVertexAttribArray(attributeLocation);
|
|
|
|
+ this._vertexAttribArraysEnabled[attributeLocation] = false;
|
|
|
|
+ this._currentBufferPointers[attributeLocation].active = false;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Send a draw order
|
|
* Send a draw order
|
|
@@ -39934,7 +39983,16 @@ var ThinEngine = /** @class */ (function () {
|
|
action();
|
|
action();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- webGLPipelineContext.onCompiled = action;
|
|
|
|
|
|
+ var oldHandler = webGLPipelineContext.onCompiled;
|
|
|
|
+ if (oldHandler) {
|
|
|
|
+ webGLPipelineContext.onCompiled = function () {
|
|
|
|
+ oldHandler();
|
|
|
|
+ action();
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ webGLPipelineContext.onCompiled = action;
|
|
|
|
+ }
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names
|
|
* Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names
|
|
@@ -40169,8 +40227,38 @@ var ThinEngine = /** @class */ (function () {
|
|
}
|
|
}
|
|
this._gl.uniform4f(uniform, x, y, z, w);
|
|
this._gl.uniform4f(uniform, x, y, z, w);
|
|
};
|
|
};
|
|
|
|
+ // States
|
|
|
|
+ /**
|
|
|
|
+ * Apply all cached states (depth, culling, stencil and alpha)
|
|
|
|
+ */
|
|
|
|
+ ThinEngine.prototype.applyStates = function () {
|
|
|
|
+ this._depthCullingState.apply(this._gl);
|
|
|
|
+ this._stencilState.apply(this._gl);
|
|
|
|
+ this._alphaState.apply(this._gl);
|
|
|
|
+ if (this._colorWriteChanged) {
|
|
|
|
+ this._colorWriteChanged = false;
|
|
|
|
+ var enable = this._colorWrite;
|
|
|
|
+ this._gl.colorMask(enable, enable, enable, enable);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Enable or disable color writing
|
|
|
|
+ * @param enable defines the state to set
|
|
|
|
+ */
|
|
|
|
+ ThinEngine.prototype.setColorWrite = function (enable) {
|
|
|
|
+ if (enable !== this._colorWrite) {
|
|
|
|
+ this._colorWriteChanged = true;
|
|
|
|
+ this._colorWrite = enable;
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Gets a boolean indicating if color writing is enabled
|
|
|
|
+ * @returns the current color writing state
|
|
|
|
+ */
|
|
|
|
+ ThinEngine.prototype.getColorWrite = function () {
|
|
|
|
+ return this._colorWrite;
|
|
|
|
+ };
|
|
Object.defineProperty(ThinEngine.prototype, "depthCullingState", {
|
|
Object.defineProperty(ThinEngine.prototype, "depthCullingState", {
|
|
- // States
|
|
|
|
/**
|
|
/**
|
|
* Gets the depth culling state manager
|
|
* Gets the depth culling state manager
|
|
*/
|
|
*/
|
|
@@ -40229,6 +40317,8 @@ var ThinEngine = /** @class */ (function () {
|
|
this._depthCullingState.reset();
|
|
this._depthCullingState.reset();
|
|
this._depthCullingState.depthFunc = this._gl.LEQUAL;
|
|
this._depthCullingState.depthFunc = this._gl.LEQUAL;
|
|
this._alphaState.reset();
|
|
this._alphaState.reset();
|
|
|
|
+ this._colorWrite = true;
|
|
|
|
+ this._colorWriteChanged = true;
|
|
this._unpackFlipYCached = null;
|
|
this._unpackFlipYCached = null;
|
|
this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
|
|
this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
|
|
this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
|
|
this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
|
|
@@ -40775,32 +40865,18 @@ var ThinEngine = /** @class */ (function () {
|
|
/** @hidden */
|
|
/** @hidden */
|
|
ThinEngine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {
|
|
ThinEngine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {
|
|
if (samples === void 0) { samples = 1; }
|
|
if (samples === void 0) { samples = 1; }
|
|
- var depthStencilBuffer = null;
|
|
|
|
var gl = this._gl;
|
|
var gl = this._gl;
|
|
// Create the depth/stencil buffer
|
|
// Create the depth/stencil buffer
|
|
- if (generateStencilBuffer) {
|
|
|
|
- depthStencilBuffer = gl.createRenderbuffer();
|
|
|
|
- gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
|
|
|
|
- if (samples > 1) {
|
|
|
|
- gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);
|
|
|
|
- }
|
|
|
|
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);
|
|
|
|
|
|
+ if (generateStencilBuffer && generateDepthBuffer) {
|
|
|
|
+ return this._getDepthStencilBuffer(width, height, samples, gl.DEPTH_STENCIL, gl.DEPTH24_STENCIL8, gl.DEPTH_STENCIL_ATTACHMENT);
|
|
}
|
|
}
|
|
- else if (generateDepthBuffer) {
|
|
|
|
- depthStencilBuffer = gl.createRenderbuffer();
|
|
|
|
- gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
|
|
|
|
- if (samples > 1) {
|
|
|
|
- gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH_COMPONENT16, width, height);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);
|
|
|
|
- }
|
|
|
|
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);
|
|
|
|
|
|
+ if (generateDepthBuffer) {
|
|
|
|
+ return this._getDepthStencilBuffer(width, height, samples, gl.DEPTH_COMPONENT16, gl.DEPTH_COMPONENT16, gl.DEPTH_ATTACHMENT);
|
|
|
|
+ }
|
|
|
|
+ if (generateStencilBuffer) {
|
|
|
|
+ return this._getDepthStencilBuffer(width, height, samples, gl.STENCIL_INDEX8, gl.STENCIL_INDEX8, gl.STENCIL_ATTACHMENT);
|
|
}
|
|
}
|
|
- return depthStencilBuffer;
|
|
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
ThinEngine.prototype._releaseFramebufferObjects = function (texture) {
|
|
ThinEngine.prototype._releaseFramebufferObjects = function (texture) {
|
|
@@ -41141,9 +41217,7 @@ var ThinEngine = /** @class */ (function () {
|
|
if (this._mustWipeVertexAttributes) {
|
|
if (this._mustWipeVertexAttributes) {
|
|
this._mustWipeVertexAttributes = false;
|
|
this._mustWipeVertexAttributes = false;
|
|
for (var i = 0; i < this._caps.maxVertexAttribs; i++) {
|
|
for (var i = 0; i < this._caps.maxVertexAttribs; i++) {
|
|
- this._gl.disableVertexAttribArray(i);
|
|
|
|
- this._vertexAttribArraysEnabled[i] = false;
|
|
|
|
- this._currentBufferPointers[i].active = false;
|
|
|
|
|
|
+ this.disableAttributeByIndex(i);
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -41151,9 +41225,7 @@ var ThinEngine = /** @class */ (function () {
|
|
if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {
|
|
if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- this._gl.disableVertexAttribArray(i);
|
|
|
|
- this._vertexAttribArraysEnabled[i] = false;
|
|
|
|
- this._currentBufferPointers[i].active = false;
|
|
|
|
|
|
+ this.disableAttributeByIndex(i);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
@@ -87434,6 +87506,7 @@ var Effect = /** @class */ (function () {
|
|
this._indexParameters = indexParameters;
|
|
this._indexParameters = indexParameters;
|
|
this._fallbacks = fallbacks;
|
|
this._fallbacks = fallbacks;
|
|
}
|
|
}
|
|
|
|
+ this._attributeLocationByName = {};
|
|
this.uniqueId = Effect._uniqueIdSeed++;
|
|
this.uniqueId = Effect._uniqueIdSeed++;
|
|
var vertexSource;
|
|
var vertexSource;
|
|
var fragmentSource;
|
|
var fragmentSource;
|
|
@@ -87577,8 +87650,7 @@ var Effect = /** @class */ (function () {
|
|
* @returns the attribute location.
|
|
* @returns the attribute location.
|
|
*/
|
|
*/
|
|
Effect.prototype.getAttributeLocationByName = function (name) {
|
|
Effect.prototype.getAttributeLocationByName = function (name) {
|
|
- var index = this._attributesNames.indexOf(name);
|
|
|
|
- return this._attributes[index];
|
|
|
|
|
|
+ return this._attributeLocationByName[name];
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* The number of attributes.
|
|
* The number of attributes.
|
|
@@ -87758,6 +87830,12 @@ var Effect = /** @class */ (function () {
|
|
_this._uniforms[_this._uniformsNames[index]] = uniform;
|
|
_this._uniforms[_this._uniformsNames[index]] = uniform;
|
|
});
|
|
});
|
|
_this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);
|
|
_this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);
|
|
|
|
+ if (attributesNames) {
|
|
|
|
+ for (var i = 0; i < attributesNames.length; i++) {
|
|
|
|
+ var name_1 = attributesNames[i];
|
|
|
|
+ _this._attributeLocationByName[name_1] = _this._attributes[i];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
var index;
|
|
var index;
|
|
for (index = 0; index < _this._samplerList.length; index++) {
|
|
for (index = 0; index < _this._samplerList.length; index++) {
|
|
var sampler = _this.getUniform(_this._samplerList[index]);
|
|
var sampler = _this.getUniform(_this._samplerList[index]);
|