@babylonjs/core 5.47.0 → 5.47.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.
@@ -5,6 +5,13 @@ ThinEngine.prototype.setAlphaConstants = function (r, g, b, a) {
5
5
  };
6
6
  ThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
7
7
  if (this._alphaMode === mode) {
8
+ if (!noDepthWriteChange) {
9
+ // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)
10
+ const depthMask = mode === 0;
11
+ if (this.depthCullingState.depthMask !== depthMask) {
12
+ this.depthCullingState.depthMask = depthMask;
13
+ }
14
+ }
8
15
  return;
9
16
  }
10
17
  switch (mode) {
@@ -1 +1 @@
1
- {"version":3,"file":"engine.alpha.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Extensions/engine.alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA0CzC,UAAU,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IACzF,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAY,EAAE,qBAA8B,KAAK;IAC3F,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;QAC1B,OAAO;KACV;IAED,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS,CAAC,aAAa;YACxB,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC;YACpC,MAAM;QACV,KAAK,SAAS,CAAC,mBAAmB;YAC9B,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,IAAI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;YAChC,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;YAC9G,MAAM;KACb;IACD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;AACnC,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG;IACpC,OAAO,IAAI,CAAC,cAAc,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { Constants } from \"../constants\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Sets alpha constants used by some alpha blending modes\r\n * @param r defines the red component\r\n * @param g defines the green component\r\n * @param b defines the blue component\r\n * @param a defines the alpha component\r\n */\r\n setAlphaConstants(r: number, g: number, b: number, a: number): void;\r\n\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering\r\n */\r\n setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;\r\n\r\n /**\r\n * Gets the current alpha mode\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering\r\n * @returns the current alpha mode\r\n */\r\n getAlphaMode(): number;\r\n\r\n /**\r\n * Sets the current alpha equation\r\n * @param equation defines the equation to use (one of the Engine.ALPHA_EQUATION_XXX)\r\n */\r\n setAlphaEquation(equation: number): void;\r\n\r\n /**\r\n * Gets the current alpha equation.\r\n * @returns the current alpha equation\r\n */\r\n getAlphaEquation(): number;\r\n }\r\n}\r\n\r\nThinEngine.prototype.setAlphaConstants = function (r: number, g: number, b: number, a: number) {\r\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\r\n};\r\n\r\nThinEngine.prototype.setAlphaMode = function (mode: number, noDepthWriteChange: boolean = false): void {\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n this._gl.CONSTANT_COLOR,\r\n this._gl.ONE_MINUS_CONSTANT_COLOR,\r\n this._gl.CONSTANT_ALPHA,\r\n this._gl.ONE_MINUS_CONSTANT_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ALPHATOCOLOR:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_REVERSEONEMINUS:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n this._gl.ONE_MINUS_DST_COLOR,\r\n this._gl.ONE_MINUS_SRC_COLOR,\r\n this._gl.ONE_MINUS_DST_ALPHA,\r\n this._gl.ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEZERO:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_EXCLUSION:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_LAYER_ACCUMULATE:\r\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.depthCullingState.depthMask = mode === Constants.ALPHA_DISABLE;\r\n }\r\n this._alphaMode = mode;\r\n};\r\n\r\nThinEngine.prototype.getAlphaMode = function (): number {\r\n return this._alphaMode;\r\n};\r\n\r\nThinEngine.prototype.setAlphaEquation = function (equation: number): void {\r\n if (this._alphaEquation === equation) {\r\n return;\r\n }\r\n\r\n switch (equation) {\r\n case Constants.ALPHA_EQUATION_ADD:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_ADD, Constants.GL_ALPHA_EQUATION_ADD);\r\n break;\r\n case Constants.ALPHA_EQUATION_SUBSTRACT:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_SUBTRACT, Constants.GL_ALPHA_EQUATION_SUBTRACT);\r\n break;\r\n case Constants.ALPHA_EQUATION_REVERSE_SUBTRACT:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT, Constants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT);\r\n break;\r\n case Constants.ALPHA_EQUATION_MAX:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MAX, Constants.GL_ALPHA_EQUATION_MAX);\r\n break;\r\n case Constants.ALPHA_EQUATION_MIN:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MIN, Constants.GL_ALPHA_EQUATION_MIN);\r\n break;\r\n case Constants.ALPHA_EQUATION_DARKEN:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MIN, Constants.GL_ALPHA_EQUATION_ADD);\r\n break;\r\n }\r\n this._alphaEquation = equation;\r\n};\r\n\r\nThinEngine.prototype.getAlphaEquation = function () {\r\n return this._alphaEquation;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.alpha.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/Extensions/engine.alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA0CzC,UAAU,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IACzF,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAY,EAAE,qBAA8B,KAAK;IAC3F,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;QAC1B,IAAI,CAAC,kBAAkB,EAAE;YACrB,mKAAmK;YACnK,MAAM,SAAS,GAAG,IAAI,KAAK,SAAS,CAAC,aAAa,CAAC;YACnD,IAAI,IAAI,CAAC,iBAAiB,CAAC,SAAS,KAAK,SAAS,EAAE;gBAChD,IAAI,CAAC,iBAAiB,CAAC,SAAS,GAAG,SAAS,CAAC;aAChD;SACJ;QACD,OAAO;KACV;IAED,QAAQ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C9G,MAAM;QACV,KAAK,SAAS,CAAC,kBAAkB;YAC7B,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;YAC9G,MAAM;QACV,KAAK,SAAS,CAAC,qBAAqB;YAChC,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;YAC9G,MAAM;KACb;IACD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;AACnC,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG;IACpC,OAAO,IAAI,CAAC,cAAc,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { Constants } from \"../constants\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Sets alpha constants used by some alpha blending modes\r\n * @param r defines the red component\r\n * @param g defines the green component\r\n * @param b defines the blue component\r\n * @param a defines the alpha component\r\n */\r\n setAlphaConstants(r: number, g: number, b: number, a: number): void;\r\n\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering\r\n */\r\n setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;\r\n\r\n /**\r\n * Gets the current alpha mode\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering\r\n * @returns the current alpha mode\r\n */\r\n getAlphaMode(): number;\r\n\r\n /**\r\n * Sets the current alpha equation\r\n * @param equation defines the equation to use (one of the Engine.ALPHA_EQUATION_XXX)\r\n */\r\n setAlphaEquation(equation: number): void;\r\n\r\n /**\r\n * Gets the current alpha equation.\r\n * @returns the current alpha equation\r\n */\r\n getAlphaEquation(): number;\r\n }\r\n}\r\n\r\nThinEngine.prototype.setAlphaConstants = function (r: number, g: number, b: number, a: number) {\r\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\r\n};\r\n\r\nThinEngine.prototype.setAlphaMode = function (mode: number, noDepthWriteChange: boolean = false): void {\r\n if (this._alphaMode === mode) {\r\n if (!noDepthWriteChange) {\r\n // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)\r\n const depthMask = mode === Constants.ALPHA_DISABLE;\r\n if (this.depthCullingState.depthMask !== depthMask) {\r\n this.depthCullingState.depthMask = depthMask;\r\n }\r\n }\r\n return;\r\n }\r\n\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n this._gl.CONSTANT_COLOR,\r\n this._gl.ONE_MINUS_CONSTANT_COLOR,\r\n this._gl.CONSTANT_ALPHA,\r\n this._gl.ONE_MINUS_CONSTANT_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ALPHATOCOLOR:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_REVERSEONEMINUS:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n this._gl.ONE_MINUS_DST_COLOR,\r\n this._gl.ONE_MINUS_SRC_COLOR,\r\n this._gl.ONE_MINUS_DST_ALPHA,\r\n this._gl.ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEZERO:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_EXCLUSION:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_LAYER_ACCUMULATE:\r\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.depthCullingState.depthMask = mode === Constants.ALPHA_DISABLE;\r\n }\r\n this._alphaMode = mode;\r\n};\r\n\r\nThinEngine.prototype.getAlphaMode = function (): number {\r\n return this._alphaMode;\r\n};\r\n\r\nThinEngine.prototype.setAlphaEquation = function (equation: number): void {\r\n if (this._alphaEquation === equation) {\r\n return;\r\n }\r\n\r\n switch (equation) {\r\n case Constants.ALPHA_EQUATION_ADD:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_ADD, Constants.GL_ALPHA_EQUATION_ADD);\r\n break;\r\n case Constants.ALPHA_EQUATION_SUBSTRACT:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_SUBTRACT, Constants.GL_ALPHA_EQUATION_SUBTRACT);\r\n break;\r\n case Constants.ALPHA_EQUATION_REVERSE_SUBTRACT:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT, Constants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT);\r\n break;\r\n case Constants.ALPHA_EQUATION_MAX:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MAX, Constants.GL_ALPHA_EQUATION_MAX);\r\n break;\r\n case Constants.ALPHA_EQUATION_MIN:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MIN, Constants.GL_ALPHA_EQUATION_MIN);\r\n break;\r\n case Constants.ALPHA_EQUATION_DARKEN:\r\n this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MIN, Constants.GL_ALPHA_EQUATION_ADD);\r\n break;\r\n }\r\n this._alphaEquation = equation;\r\n};\r\n\r\nThinEngine.prototype.getAlphaEquation = function () {\r\n return this._alphaEquation;\r\n};\r\n"]}
@@ -3,6 +3,14 @@ import { Engine } from "../../engine.js";
3
3
  import { WebGPUEngine } from "../../webgpuEngine.js";
4
4
  WebGPUEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
5
5
  if (this._alphaMode === mode && ((mode === 0 && !this._alphaState.alphaBlend) || (mode !== 0 && this._alphaState.alphaBlend))) {
6
+ if (!noDepthWriteChange) {
7
+ // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)
8
+ const depthMask = mode === 0;
9
+ if (this.depthCullingState.depthMask !== depthMask) {
10
+ this.setDepthWrite(depthMask);
11
+ this._cacheRenderPipeline.setDepthWriteEnabled(depthMask);
12
+ }
13
+ }
6
14
  return;
7
15
  }
8
16
  switch (mode) {
@@ -1 +1 @@
1
- {"version":3,"file":"engine.alpha.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/WebGPU/Extensions/engine.alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,YAAY,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAY,EAAE,qBAA8B,KAAK;IAC7F,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE;QACvK,OAAO;KACV;IAED,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS,CAAC,aAAa;YACxB,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC;YACpC,MAAM;QACV,KAAK,SAAS,CAAC,mBAAmB;YAC9B,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC,EAAE,SAAS,CAAC,qCAAqC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3G,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC;YACnC,MAAM;QACV,KAAK,SAAS,CAAC,8BAA8B;YACzC,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC,EAAE,SAAS,CAAC,qCAAqC,EAAE,CAAC,EAAE,SAAS,CAAC,qCAAqC,CAAC,CAAC;YACzJ,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC;YACnC,MAAM;QACV,KAAK,SAAS,CAAC,aAAa;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CAAC,wBAAwB,EAAE,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;AACzI,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,gBAAgB,GAAG,UAAU,QAAgB;IAChE,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEvD,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,wBAAwB,EAAE,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;AACzI,CAAC,CAAC","sourcesContent":["import { Constants } from \"../../constants\";\r\nimport { Engine } from \"../../engine\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\n\r\nWebGPUEngine.prototype.setAlphaMode = function (mode: number, noDepthWriteChange: boolean = false): void {\r\n if (this._alphaMode === mode && ((mode === Constants.ALPHA_DISABLE && !this._alphaState.alphaBlend) || (mode !== Constants.ALPHA_DISABLE && this._alphaState.alphaBlend))) {\r\n return;\r\n }\r\n\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(0, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_COLOR, 0, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ALPHATOCOLOR:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_ALPHA, 1, 0, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_REVERSEONEMINUS:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEZERO:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_EXCLUSION:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_LAYER_ACCUMULATE:\r\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_SRC_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,\r\n 1,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === Engine.ALPHA_DISABLE);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(mode === Engine.ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend);\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n\r\nWebGPUEngine.prototype.setAlphaEquation = function (equation: number): void {\r\n Engine.prototype.setAlphaEquation.call(this, equation);\r\n\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.alpha.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/WebGPU/Extensions/engine.alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,YAAY,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAY,EAAE,qBAA8B,KAAK;IAC7F,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE;QACvK,IAAI,CAAC,kBAAkB,EAAE;YACrB,mKAAmK;YACnK,MAAM,SAAS,GAAG,IAA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";\r\nimport { Engine } from \"../../engine\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\n\r\nWebGPUEngine.prototype.setAlphaMode = function (mode: number, noDepthWriteChange: boolean = false): void {\r\n if (this._alphaMode === mode && ((mode === Constants.ALPHA_DISABLE && !this._alphaState.alphaBlend) || (mode !== Constants.ALPHA_DISABLE && this._alphaState.alphaBlend))) {\r\n if (!noDepthWriteChange) {\r\n // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)\r\n const depthMask = mode === Constants.ALPHA_DISABLE;\r\n if (this.depthCullingState.depthMask !== depthMask) {\r\n this.setDepthWrite(depthMask);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(depthMask);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(0, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_COLOR, 0, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ALPHATOCOLOR:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_ALPHA, 1, 0, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_REVERSEONEMINUS:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEZERO:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_EXCLUSION:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_LAYER_ACCUMULATE:\r\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_SRC_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,\r\n 1,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === Engine.ALPHA_DISABLE);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(mode === Engine.ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend);\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n\r\nWebGPUEngine.prototype.setAlphaEquation = function (equation: number): void {\r\n Engine.prototype.setAlphaEquation.call(this, equation);\r\n\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n"]}
@@ -428,10 +428,8 @@ export declare class Engine extends ThinEngine {
428
428
  /**
429
429
  * Shared initialization across engines types.
430
430
  * @param canvas The canvas associated with this instance of the engine.
431
- * @param doNotHandleTouchAction Defines that engine should ignore modifying touch action attribute and style
432
- * @param audioEngine Defines if an audio engine should be created by default
433
431
  */
434
- protected _sharedInit(canvas: HTMLCanvasElement, doNotHandleTouchAction: boolean, audioEngine: boolean): void;
432
+ protected _sharedInit(canvas: HTMLCanvasElement): void;
435
433
  /**
436
434
  * Gets current aspect ratio
437
435
  * @param viewportOwner defines the camera to use to get the aspect ratio
package/Engines/engine.js CHANGED
@@ -258,34 +258,8 @@ export class Engine extends ThinEngine {
258
258
  options = this._creationOptions;
259
259
  if (canvasOrContext.getContext) {
260
260
  const canvas = canvasOrContext;
261
- this._sharedInit(canvas, !!options.doNotHandleTouchAction, options.audioEngine);
262
- if (IsDocumentAvailable()) {
263
- // Fullscreen
264
- this._onFullscreenChange = () => {
265
- this.isFullscreen = !!document.fullscreenElement;
266
- // Pointer lock
267
- if (this.isFullscreen && this._pointerLockRequested && canvas) {
268
- Engine._RequestPointerlock(canvas);
269
- }
270
- };
271
- document.addEventListener("fullscreenchange", this._onFullscreenChange, false);
272
- document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, false);
273
- // Pointer lock
274
- this._onPointerLockChange = () => {
275
- this.isPointerLock = document.pointerLockElement === canvas;
276
- };
277
- document.addEventListener("pointerlockchange", this._onPointerLockChange, false);
278
- document.addEventListener("webkitpointerlockchange", this._onPointerLockChange, false);
279
- // Create Audio Engine if needed.
280
- if (!Engine.audioEngine && options.audioEngine && Engine.AudioEngineFactory) {
281
- Engine.audioEngine = Engine.AudioEngineFactory(this.getRenderingCanvas(), this.getAudioContext(), this.getAudioDestination());
282
- }
283
- }
261
+ this._sharedInit(canvas);
284
262
  this._connectVREvents();
285
- this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;
286
- this._deterministicLockstep = !!options.deterministicLockstep;
287
- this._lockstepMaxSteps = options.lockstepMaxSteps || 0;
288
- this._timeStep = options.timeStep || 1 / 60;
289
263
  }
290
264
  // Load WebVR Devices
291
265
  this._prepareVRComponent();
@@ -300,11 +274,9 @@ export class Engine extends ThinEngine {
300
274
  /**
301
275
  * Shared initialization across engines types.
302
276
  * @param canvas The canvas associated with this instance of the engine.
303
- * @param doNotHandleTouchAction Defines that engine should ignore modifying touch action attribute and style
304
- * @param audioEngine Defines if an audio engine should be created by default
305
277
  */
306
- _sharedInit(canvas, doNotHandleTouchAction, audioEngine) {
307
- super._sharedInit(canvas, doNotHandleTouchAction, audioEngine);
278
+ _sharedInit(canvas) {
279
+ super._sharedInit(canvas);
308
280
  this._onCanvasFocus = () => {
309
281
  this.onCanvasFocusObservable.notifyObservers(this);
310
282
  };
@@ -344,13 +316,35 @@ export class Engine extends ThinEngine {
344
316
  hostWindow.addEventListener("focus", this._onFocus);
345
317
  }
346
318
  canvas.addEventListener("pointerout", this._onCanvasPointerOut);
347
- if (!doNotHandleTouchAction) {
319
+ if (!this._creationOptions.doNotHandleTouchAction) {
348
320
  this._disableTouchAction();
349
321
  }
350
322
  // Create Audio Engine if needed.
351
- if (!Engine.audioEngine && audioEngine && Engine.AudioEngineFactory) {
323
+ if (!Engine.audioEngine && this._creationOptions.audioEngine && Engine.AudioEngineFactory) {
352
324
  Engine.audioEngine = Engine.AudioEngineFactory(this.getRenderingCanvas(), this.getAudioContext(), this.getAudioDestination());
353
325
  }
326
+ if (IsDocumentAvailable()) {
327
+ // Fullscreen
328
+ this._onFullscreenChange = () => {
329
+ this.isFullscreen = !!document.fullscreenElement;
330
+ // Pointer lock
331
+ if (this.isFullscreen && this._pointerLockRequested && canvas) {
332
+ Engine._RequestPointerlock(canvas);
333
+ }
334
+ };
335
+ document.addEventListener("fullscreenchange", this._onFullscreenChange, false);
336
+ document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, false);
337
+ // Pointer lock
338
+ this._onPointerLockChange = () => {
339
+ this.isPointerLock = document.pointerLockElement === canvas;
340
+ };
341
+ document.addEventListener("pointerlockchange", this._onPointerLockChange, false);
342
+ document.addEventListener("webkitpointerlockchange", this._onPointerLockChange, false);
343
+ }
344
+ this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;
345
+ this._deterministicLockstep = !!this._creationOptions.deterministicLockstep;
346
+ this._lockstepMaxSteps = this._creationOptions.lockstepMaxSteps || 0;
347
+ this._timeStep = this._creationOptions.timeStep || 1 / 60;
354
348
  }
355
349
  /**
356
350
  * Gets current aspect ratio