@babylonjs/core 9.3.2 → 9.3.3

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.
Files changed (31) hide show
  1. package/Engines/AbstractEngine/abstractEngine.textureSelector.d.ts +45 -0
  2. package/Engines/AbstractEngine/abstractEngine.textureSelector.js +69 -0
  3. package/Engines/AbstractEngine/abstractEngine.textureSelector.js.map +1 -0
  4. package/Engines/AbstractEngine/index.d.ts +2 -0
  5. package/Engines/AbstractEngine/index.js +4 -0
  6. package/Engines/AbstractEngine/index.js.map +1 -1
  7. package/Engines/Extensions/engine.textureSelector.d.ts +2 -45
  8. package/Engines/Extensions/engine.textureSelector.js +8 -68
  9. package/Engines/Extensions/engine.textureSelector.js.map +1 -1
  10. package/Engines/abstractEngine.js +2 -2
  11. package/Engines/abstractEngine.js.map +1 -1
  12. package/FlowGraph/flowGraph.d.ts +22 -0
  13. package/FlowGraph/flowGraph.js +11 -0
  14. package/FlowGraph/flowGraph.js.map +1 -1
  15. package/FlowGraph/flowGraphCoordinator.d.ts +2 -1
  16. package/FlowGraph/flowGraphCoordinator.js +4 -2
  17. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  18. package/FlowGraph/flowGraphParser.js +7 -0
  19. package/FlowGraph/flowGraphParser.js.map +1 -1
  20. package/FlowGraph/typeDefinitions.d.ts +8 -0
  21. package/FlowGraph/typeDefinitions.js.map +1 -1
  22. package/Misc/tools.js +1 -1
  23. package/Misc/tools.js.map +1 -1
  24. package/Particles/gpuParticleSystem.d.ts +35 -2
  25. package/Particles/gpuParticleSystem.js +272 -6
  26. package/Particles/gpuParticleSystem.js.map +1 -1
  27. package/Particles/thinParticleSystem.js +5 -0
  28. package/Particles/thinParticleSystem.js.map +1 -1
  29. package/Shaders/gpuRenderParticles.vertex.js +7 -0
  30. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  31. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ import { type Nullable } from "../../types.js";
2
+ declare module "../abstractEngine.js" {
3
+ interface AbstractEngine {
4
+ /** @internal */
5
+ _excludedCompressedTextures: string[];
6
+ /** @internal */
7
+ _textureFormatInUse: string;
8
+ /**
9
+ * Gets the list of texture formats supported
10
+ */
11
+ readonly texturesSupported: Array<string>;
12
+ /**
13
+ * Gets the texture format in use
14
+ */
15
+ readonly textureFormatInUse: Nullable<string>;
16
+ /**
17
+ * Set the compressed texture extensions or file names to skip.
18
+ *
19
+ * @param skippedFiles defines the list of those texture files you want to skip
20
+ * Example: [".dds", ".env", "myfile.png"]
21
+ */
22
+ setCompressedTextureExclusions(skippedFiles: Array<string>): void;
23
+ /**
24
+ * Set the compressed texture format to use, based on the formats you have, and the formats
25
+ * supported by the hardware / browser.
26
+ *
27
+ * Khronos Texture Container (.ktx) files are used to support this. This format has the
28
+ * advantage of being specifically designed for OpenGL. Header elements directly correspond
29
+ * to API arguments needed to compressed textures. This puts the burden on the container
30
+ * generator to house the arcane code for determining these for current & future formats.
31
+ *
32
+ * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
33
+ * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
34
+ *
35
+ * Note: The result of this call is not taken into account when a texture is base64.
36
+ *
37
+ * @param formatsAvailable defines the list of those format families you have created
38
+ * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
39
+ *
40
+ * Current families are astc, dxt, pvrtc, etc2, & etc1.
41
+ * @returns The extension selected.
42
+ */
43
+ setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>;
44
+ }
45
+ }
@@ -0,0 +1,69 @@
1
+ import { AbstractEngine } from "../abstractEngine.js";
2
+ function TransformTextureUrl(url) {
3
+ const excludeFn = (entry) => {
4
+ const strRegExPattern = "\\b" + entry + "\\b";
5
+ return url && (url === entry || url.match(new RegExp(strRegExPattern, "g")));
6
+ };
7
+ if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(excludeFn)) {
8
+ return url;
9
+ }
10
+ const lastDot = url.lastIndexOf(".");
11
+ const lastQuestionMark = url.lastIndexOf("?");
12
+ const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : "";
13
+ return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;
14
+ }
15
+ Object.defineProperty(AbstractEngine.prototype, "texturesSupported", {
16
+ get: function () {
17
+ // Intelligently add supported compressed formats in order to check for.
18
+ // Check for ASTC support first as it is most powerful and to be very cross platform.
19
+ // Next PVRTC & DXT, which are probably superior to ETC1/2.
20
+ // Likely no hardware which supports both PVR & DXT, so order matters little.
21
+ // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.
22
+ const texturesSupported = [];
23
+ if (this._caps.astc) {
24
+ texturesSupported.push("-astc.ktx");
25
+ }
26
+ if (this._caps.s3tc) {
27
+ texturesSupported.push("-dxt.ktx");
28
+ }
29
+ if (this._caps.pvrtc) {
30
+ texturesSupported.push("-pvrtc.ktx");
31
+ }
32
+ if (this._caps.etc2) {
33
+ texturesSupported.push("-etc2.ktx");
34
+ }
35
+ if (this._caps.etc1) {
36
+ texturesSupported.push("-etc1.ktx");
37
+ }
38
+ return texturesSupported;
39
+ },
40
+ enumerable: true,
41
+ configurable: true,
42
+ });
43
+ Object.defineProperty(AbstractEngine.prototype, "textureFormatInUse", {
44
+ get: function () {
45
+ return this._textureFormatInUse || null;
46
+ },
47
+ enumerable: true,
48
+ configurable: true,
49
+ });
50
+ AbstractEngine.prototype.setCompressedTextureExclusions = function (skippedFiles) {
51
+ this._excludedCompressedTextures = skippedFiles;
52
+ };
53
+ AbstractEngine.prototype.setTextureFormatToUse = function (formatsAvailable) {
54
+ const texturesSupported = this.texturesSupported;
55
+ for (let i = 0, len1 = texturesSupported.length; i < len1; i++) {
56
+ for (let j = 0, len2 = formatsAvailable.length; j < len2; j++) {
57
+ if (texturesSupported[i] === formatsAvailable[j].toLowerCase()) {
58
+ this._transformTextureUrl = (url) => TransformTextureUrl.call(this, url);
59
+ return (this._textureFormatInUse = texturesSupported[i]);
60
+ }
61
+ }
62
+ }
63
+ // actively set format to nothing, to allow this to be called more than once
64
+ // and possibly fail the 2nd time
65
+ this._textureFormatInUse = "";
66
+ this._transformTextureUrl = null;
67
+ return null;
68
+ };
69
+ //# sourceMappingURL=abstractEngine.textureSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractEngine.textureSelector.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/abstractEngine.textureSelector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAqDnD,SAAS,mBAAmB,CAAuB,GAAW;IAC1D,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE;QAChC,MAAM,eAAe,GAAW,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;QACtD,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC;IAEF,IAAI,IAAI,CAAC,2BAA2B,IAAI,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACvF,OAAO,GAAG,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,gBAAgB,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GA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CAAC,2BAA2B,GAAG,YAAY,CAAC;AACpD,CAAC,CAAC;AAEF,cAAc,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,gBAA+B;IACtF,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5D,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC7D,IAAI,CAAC,oBAAoB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBACjF,OAAO,CAAC,IAAI,CAAC,mBAAmB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,CAAC;QACL,CAAC;IACL,CAAC;IACD,4EAA4E;IAC5E,iCAAiC;IACjC,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAC9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACjC,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { type Nullable } from \"../../types\";\r\nimport { AbstractEngine } from \"../abstractEngine\";\r\n\r\ndeclare module \"../abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /** @internal */\r\n _excludedCompressedTextures: string[];\r\n\r\n /** @internal */\r\n _textureFormatInUse: string;\r\n\r\n /**\r\n * Gets the list of texture formats supported\r\n */\r\n readonly texturesSupported: Array<string>;\r\n\r\n /**\r\n * Gets the texture format in use\r\n */\r\n readonly textureFormatInUse: Nullable<string>;\r\n\r\n /**\r\n * Set the compressed texture extensions or file names to skip.\r\n *\r\n * @param skippedFiles defines the list of those texture files you want to skip\r\n * Example: [\".dds\", \".env\", \"myfile.png\"]\r\n */\r\n setCompressedTextureExclusions(skippedFiles: Array<string>): void;\r\n\r\n /**\r\n * Set the compressed texture format to use, based on the formats you have, and the formats\r\n * supported by the hardware / browser.\r\n *\r\n * Khronos Texture Container (.ktx) files are used to support this. This format has the\r\n * advantage of being specifically designed for OpenGL. Header elements directly correspond\r\n * to API arguments needed to compressed textures. This puts the burden on the container\r\n * generator to house the arcane code for determining these for current & future formats.\r\n *\r\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\r\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\r\n *\r\n * Note: The result of this call is not taken into account when a texture is base64.\r\n *\r\n * @param formatsAvailable defines the list of those format families you have created\r\n * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)\r\n *\r\n * Current families are astc, dxt, pvrtc, etc2, & etc1.\r\n * @returns The extension selected.\r\n */\r\n setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>;\r\n }\r\n}\r\n\r\nfunction TransformTextureUrl(this: AbstractEngine, url: string): string {\r\n const excludeFn = (entry: string) => {\r\n const strRegExPattern: string = \"\\\\b\" + entry + \"\\\\b\";\r\n return url && (url === entry || url.match(new RegExp(strRegExPattern, \"g\")));\r\n };\r\n\r\n if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(excludeFn)) {\r\n return url;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const lastQuestionMark = url.lastIndexOf(\"?\");\r\n const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : \"\";\r\n return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;\r\n}\r\n\r\nObject.defineProperty(AbstractEngine.prototype, \"texturesSupported\", {\r\n get: function (this: AbstractEngine) {\r\n // Intelligently add supported compressed formats in order to check for.\r\n // Check for ASTC support first as it is most powerful and to be very cross platform.\r\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\r\n // Likely no hardware which supports both PVR & DXT, so order matters little.\r\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\r\n const texturesSupported: string[] = [];\r\n if (this._caps.astc) {\r\n texturesSupported.push(\"-astc.ktx\");\r\n }\r\n if (this._caps.s3tc) {\r\n texturesSupported.push(\"-dxt.ktx\");\r\n }\r\n if (this._caps.pvrtc) {\r\n texturesSupported.push(\"-pvrtc.ktx\");\r\n }\r\n if (this._caps.etc2) {\r\n texturesSupported.push(\"-etc2.ktx\");\r\n }\r\n if (this._caps.etc1) {\r\n texturesSupported.push(\"-etc1.ktx\");\r\n }\r\n return texturesSupported;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractEngine.prototype, \"textureFormatInUse\", {\r\n get: function (this: AbstractEngine) {\r\n return this._textureFormatInUse || null;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nAbstractEngine.prototype.setCompressedTextureExclusions = function (skippedFiles: Array<string>): void {\r\n this._excludedCompressedTextures = skippedFiles;\r\n};\r\n\r\nAbstractEngine.prototype.setTextureFormatToUse = function (formatsAvailable: Array<string>): Nullable<string> {\r\n const texturesSupported = this.texturesSupported;\r\n for (let i = 0, len1 = texturesSupported.length; i < len1; i++) {\r\n for (let j = 0, len2 = formatsAvailable.length; j < len2; j++) {\r\n if (texturesSupported[i] === formatsAvailable[j].toLowerCase()) {\r\n this._transformTextureUrl = (url: string) => TransformTextureUrl.call(this, url);\r\n return (this._textureFormatInUse = texturesSupported[i]);\r\n }\r\n }\r\n }\r\n // actively set format to nothing, to allow this to be called more than once\r\n // and possibly fail the 2nd time\r\n this._textureFormatInUse = \"\";\r\n this._transformTextureUrl = null;\r\n return null;\r\n};\r\n"]}
@@ -11,3 +11,5 @@ export * from "./abstractEngine.alpha.js";
11
11
  export * from "./abstractEngine.views.js";
12
12
  export * from "./abstractEngine.loadFile.js";
13
13
  export * from "./abstractEngine.textureLoaders.js";
14
+ import "./abstractEngine.textureSelector.js";
15
+ export * from "./abstractEngine.textureSelector.js";
@@ -12,4 +12,8 @@ export * from "./abstractEngine.alpha.js";
12
12
  export * from "./abstractEngine.views.js";
13
13
  export * from "./abstractEngine.loadFile.js";
14
14
  export * from "./abstractEngine.textureLoaders.js";
15
+ // must import first since nothing references the exports
16
+ import "./abstractEngine.textureSelector.js";
17
+ // eslint-disable-next-line no-duplicate-imports
18
+ export * from "./abstractEngine.textureSelector.js";
15
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable import/export */\r\nexport * from \"./abstractEngine.cubeTexture\";\r\nexport * from \"./abstractEngine.loadingScreen\";\r\nexport * from \"./abstractEngine.dom\";\r\nexport * from \"./abstractEngine.states\";\r\nexport * from \"./abstractEngine.stencil\";\r\nexport * from \"./abstractEngine.timeQuery\";\r\nexport * from \"./abstractEngine.query\";\r\nexport * from \"./abstractEngine.renderPass\";\r\nexport * from \"./abstractEngine.texture\";\r\nexport * from \"./abstractEngine.alpha\";\r\nexport * from \"./abstractEngine.views\";\r\nexport * from \"./abstractEngine.loadFile\";\r\nexport * from \"./abstractEngine.textureLoaders\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,yDAAyD;AACzD,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,cAAc,kCAAkC,CAAC","sourcesContent":["/* eslint-disable import/export */\r\nexport * from \"./abstractEngine.cubeTexture\";\r\nexport * from \"./abstractEngine.loadingScreen\";\r\nexport * from \"./abstractEngine.dom\";\r\nexport * from \"./abstractEngine.states\";\r\nexport * from \"./abstractEngine.stencil\";\r\nexport * from \"./abstractEngine.timeQuery\";\r\nexport * from \"./abstractEngine.query\";\r\nexport * from \"./abstractEngine.renderPass\";\r\nexport * from \"./abstractEngine.texture\";\r\nexport * from \"./abstractEngine.alpha\";\r\nexport * from \"./abstractEngine.views\";\r\nexport * from \"./abstractEngine.loadFile\";\r\nexport * from \"./abstractEngine.textureLoaders\";\r\n// must import first since nothing references the exports\r\nimport \"./abstractEngine.textureSelector\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nexport * from \"./abstractEngine.textureSelector\";\r\n"]}
@@ -1,45 +1,2 @@
1
- import { type Nullable } from "../../types.js";
2
- declare module "../../Engines/engine.js" {
3
- interface Engine {
4
- /** @internal */
5
- _excludedCompressedTextures: string[];
6
- /** @internal */
7
- _textureFormatInUse: string;
8
- /**
9
- * Gets the list of texture formats supported
10
- */
11
- readonly texturesSupported: Array<string>;
12
- /**
13
- * Gets the texture format in use
14
- */
15
- readonly textureFormatInUse: Nullable<string>;
16
- /**
17
- * Set the compressed texture extensions or file names to skip.
18
- *
19
- * @param skippedFiles defines the list of those texture files you want to skip
20
- * Example: [".dds", ".env", "myfile.png"]
21
- */
22
- setCompressedTextureExclusions(skippedFiles: Array<string>): void;
23
- /**
24
- * Set the compressed texture format to use, based on the formats you have, and the formats
25
- * supported by the hardware / browser.
26
- *
27
- * Khronos Texture Container (.ktx) files are used to support this. This format has the
28
- * advantage of being specifically designed for OpenGL. Header elements directly correspond
29
- * to API arguments needed to compressed textures. This puts the burden on the container
30
- * generator to house the arcane code for determining these for current & future formats.
31
- *
32
- * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
33
- * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
34
- *
35
- * Note: The result of this call is not taken into account when a texture is base64.
36
- *
37
- * @param formatsAvailable defines the list of those format families you have created
38
- * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
39
- *
40
- * Current families are astc, dxt, pvrtc, etc2, & etc1.
41
- * @returns The extension selected.
42
- */
43
- setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>;
44
- }
45
- }
1
+ import "../AbstractEngine/abstractEngine.textureSelector.js";
2
+ export * from "../AbstractEngine/abstractEngine.textureSelector.js";
@@ -1,69 +1,9 @@
1
- import { Engine } from "../engine.js";
2
- function TransformTextureUrl(url) {
3
- const excludeFn = (entry) => {
4
- const strRegExPattern = "\\b" + entry + "\\b";
5
- return url && (url === entry || url.match(new RegExp(strRegExPattern, "g")));
6
- };
7
- if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(excludeFn)) {
8
- return url;
9
- }
10
- const lastDot = url.lastIndexOf(".");
11
- const lastQuestionMark = url.lastIndexOf("?");
12
- const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : "";
13
- return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;
14
- }
15
- Object.defineProperty(Engine.prototype, "texturesSupported", {
16
- get: function () {
17
- // Intelligently add supported compressed formats in order to check for.
18
- // Check for ASTC support first as it is most powerful and to be very cross platform.
19
- // Next PVRTC & DXT, which are probably superior to ETC1/2.
20
- // Likely no hardware which supports both PVR & DXT, so order matters little.
21
- // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.
22
- const texturesSupported = [];
23
- if (this._caps.astc) {
24
- texturesSupported.push("-astc.ktx");
25
- }
26
- if (this._caps.s3tc) {
27
- texturesSupported.push("-dxt.ktx");
28
- }
29
- if (this._caps.pvrtc) {
30
- texturesSupported.push("-pvrtc.ktx");
31
- }
32
- if (this._caps.etc2) {
33
- texturesSupported.push("-etc2.ktx");
34
- }
35
- if (this._caps.etc1) {
36
- texturesSupported.push("-etc1.ktx");
37
- }
38
- return texturesSupported;
39
- },
40
- enumerable: true,
41
- configurable: true,
42
- });
43
- Object.defineProperty(Engine.prototype, "textureFormatInUse", {
44
- get: function () {
45
- return this._textureFormatInUse || null;
46
- },
47
- enumerable: true,
48
- configurable: true,
49
- });
50
- Engine.prototype.setCompressedTextureExclusions = function (skippedFiles) {
51
- this._excludedCompressedTextures = skippedFiles;
52
- };
53
- Engine.prototype.setTextureFormatToUse = function (formatsAvailable) {
54
- const texturesSupported = this.texturesSupported;
55
- for (let i = 0, len1 = texturesSupported.length; i < len1; i++) {
56
- for (let j = 0, len2 = formatsAvailable.length; j < len2; j++) {
57
- if (texturesSupported[i] === formatsAvailable[j].toLowerCase()) {
58
- this._transformTextureUrl = TransformTextureUrl.bind(this);
59
- return (this._textureFormatInUse = texturesSupported[i]);
60
- }
61
- }
62
- }
63
- // actively set format to nothing, to allow this to be called more than once
64
- // and possibly fail the 2nd time
65
- this._textureFormatInUse = "";
66
- this._transformTextureUrl = null;
67
- return null;
68
- };
1
+ // Re-export the augmentation moved to AbstractEngine so that existing
2
+ // side-effect imports of this file (e.g. `import "core/Engines/Extensions/engine.textureSelector"`)
3
+ // continue to register setTextureFormatToUse / setCompressedTextureExclusions / texturesSupported /
4
+ // textureFormatInUse / _textureFormatInUse / _excludedCompressedTextures on the engine prototype.
5
+ // The methods are now defined on AbstractEngine so they are available on every engine (WebGL, WebGPU, Native).
6
+ import "../AbstractEngine/abstractEngine.textureSelector.js";
7
+ // eslint-disable-next-line no-duplicate-imports
8
+ export * from "../AbstractEngine/abstractEngine.textureSelector.js";
69
9
  //# sourceMappingURL=engine.textureSelector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.textureSelector.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.textureSelector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAqDnC,SAAS,mBAAmB,CAAe,GAAW;IAClD,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE;QAChC,MAAM,eAAe,GAAW,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;QACtD,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC;IAEF,IAAI,IAAI,CAAC,2BAA2B,IAAI,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACvF,OAAO,GAAG,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,gBAAgB,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7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,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,SAAS,CAAC,8BAA8B,GAAG,UAAU,YAA2B;IACnF,IAAI,CAAC,2BAA2B,GAAG,YAAY,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,gBAA+B;IAC9E,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5D,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC7D,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC3D,OAAO,CAAC,IAAI,CAAC,mBAAmB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,CAAC;QACL,CAAC;IACL,CAAC;IACD,4EAA4E;IAC5E,iCAAiC;IACjC,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAC9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACjC,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { type Nullable } from \"../../types\";\r\nimport { Engine } from \"../engine\";\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Engine {\r\n /** @internal */\r\n _excludedCompressedTextures: string[];\r\n\r\n /** @internal */\r\n _textureFormatInUse: string;\r\n\r\n /**\r\n * Gets the list of texture formats supported\r\n */\r\n readonly texturesSupported: Array<string>;\r\n\r\n /**\r\n * Gets the texture format in use\r\n */\r\n readonly textureFormatInUse: Nullable<string>;\r\n\r\n /**\r\n * Set the compressed texture extensions or file names to skip.\r\n *\r\n * @param skippedFiles defines the list of those texture files you want to skip\r\n * Example: [\".dds\", \".env\", \"myfile.png\"]\r\n */\r\n setCompressedTextureExclusions(skippedFiles: Array<string>): void;\r\n\r\n /**\r\n * Set the compressed texture format to use, based on the formats you have, and the formats\r\n * supported by the hardware / browser.\r\n *\r\n * Khronos Texture Container (.ktx) files are used to support this. This format has the\r\n * advantage of being specifically designed for OpenGL. Header elements directly correspond\r\n * to API arguments needed to compressed textures. This puts the burden on the container\r\n * generator to house the arcane code for determining these for current & future formats.\r\n *\r\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\r\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\r\n *\r\n * Note: The result of this call is not taken into account when a texture is base64.\r\n *\r\n * @param formatsAvailable defines the list of those format families you have created\r\n * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)\r\n *\r\n * Current families are astc, dxt, pvrtc, etc2, & etc1.\r\n * @returns The extension selected.\r\n */\r\n setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>;\r\n }\r\n}\r\n\r\nfunction TransformTextureUrl(this: Engine, url: string): string {\r\n const excludeFn = (entry: string) => {\r\n const strRegExPattern: string = \"\\\\b\" + entry + \"\\\\b\";\r\n return url && (url === entry || url.match(new RegExp(strRegExPattern, \"g\")));\r\n };\r\n\r\n if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(excludeFn)) {\r\n return url;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const lastQuestionMark = url.lastIndexOf(\"?\");\r\n const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : \"\";\r\n return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;\r\n}\r\n\r\nObject.defineProperty(Engine.prototype, \"texturesSupported\", {\r\n get: function (this: Engine) {\r\n // Intelligently add supported compressed formats in order to check for.\r\n // Check for ASTC support first as it is most powerful and to be very cross platform.\r\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\r\n // Likely no hardware which supports both PVR & DXT, so order matters little.\r\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\r\n const texturesSupported: string[] = [];\r\n if (this._caps.astc) {\r\n texturesSupported.push(\"-astc.ktx\");\r\n }\r\n if (this._caps.s3tc) {\r\n texturesSupported.push(\"-dxt.ktx\");\r\n }\r\n if (this._caps.pvrtc) {\r\n texturesSupported.push(\"-pvrtc.ktx\");\r\n }\r\n if (this._caps.etc2) {\r\n texturesSupported.push(\"-etc2.ktx\");\r\n }\r\n if (this._caps.etc1) {\r\n texturesSupported.push(\"-etc1.ktx\");\r\n }\r\n return texturesSupported;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"textureFormatInUse\", {\r\n get: function (this: Engine) {\r\n return this._textureFormatInUse || null;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nEngine.prototype.setCompressedTextureExclusions = function (skippedFiles: Array<string>): void {\r\n this._excludedCompressedTextures = skippedFiles;\r\n};\r\n\r\nEngine.prototype.setTextureFormatToUse = function (formatsAvailable: Array<string>): Nullable<string> {\r\n const texturesSupported = this.texturesSupported;\r\n for (let i = 0, len1 = texturesSupported.length; i < len1; i++) {\r\n for (let j = 0, len2 = formatsAvailable.length; j < len2; j++) {\r\n if (texturesSupported[i] === formatsAvailable[j].toLowerCase()) {\r\n this._transformTextureUrl = TransformTextureUrl.bind(this);\r\n return (this._textureFormatInUse = texturesSupported[i]);\r\n }\r\n }\r\n }\r\n // actively set format to nothing, to allow this to be called more than once\r\n // and possibly fail the 2nd time\r\n this._textureFormatInUse = \"\";\r\n this._transformTextureUrl = null;\r\n return null;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.textureSelector.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.textureSelector.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oGAAoG;AACpG,oGAAoG;AACpG,kGAAkG;AAClG,+GAA+G;AAC/G,OAAO,kDAAkD,CAAC;AAC1D,gDAAgD;AAChD,cAAc,kDAAkD,CAAC","sourcesContent":["// Re-export the augmentation moved to AbstractEngine so that existing\r\n// side-effect imports of this file (e.g. `import \"core/Engines/Extensions/engine.textureSelector\"`)\r\n// continue to register setTextureFormatToUse / setCompressedTextureExclusions / texturesSupported /\r\n// textureFormatInUse / _textureFormatInUse / _excludedCompressedTextures on the engine prototype.\r\n// The methods are now defined on AbstractEngine so they are available on every engine (WebGL, WebGPU, Native).\r\nimport \"../AbstractEngine/abstractEngine.textureSelector\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nexport * from \"../AbstractEngine/abstractEngine.textureSelector\";\r\n"]}
@@ -803,13 +803,13 @@ export class AbstractEngine {
803
803
  */
804
804
  // Not mixed with Version for tooling purpose.
805
805
  static get NpmPackage() {
806
- return "babylonjs@9.3.2";
806
+ return "babylonjs@9.3.3";
807
807
  }
808
808
  /**
809
809
  * Returns the current version of the framework
810
810
  */
811
811
  static get Version() {
812
- return "9.3.2";
812
+ return "9.3.3";
813
813
  }
814
814
  /**
815
815
  * Gets the HTML canvas attached with the current webGL context