@babylonjs/core 7.53.1 → 7.53.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.
- package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSound.js +12 -12
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +15 -8
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +23 -11
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.js +8 -0
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/staticSoundInstance.d.ts +2 -0
- package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +4 -4
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +3 -3
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +23 -16
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +3 -3
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +13 -6
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +13 -8
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +18 -14
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +10 -6
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +7 -3
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +5 -5
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +9 -9
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +4 -4
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +4 -0
- package/AudioV2/webAudio/webAudioStaticSound.js +14 -0
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.d.ts +2 -2
- package/Culling/Helper/boundingInfoHelper.js +2 -2
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Engines/abstractEngine.js +2 -3
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/Lights/IES/iesLoader.d.ts +1 -1
- package/Lights/IES/iesLoader.js +1 -1
- package/Lights/IES/iesLoader.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +2 -2
- package/Lights/Shadows/shadowGenerator.js +2 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/spotLight.d.ts +1 -1
- package/Lights/spotLight.js +1 -1
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -2
- package/Materials/PBR/pbrBaseMaterial.js +2 -2
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/basisTextureLoader.d.ts +1 -0
- package/Materials/Textures/Loaders/basisTextureLoader.js +1 -0
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/exrTextureLoader.d.ts +5 -4
- package/Materials/Textures/Loaders/exrTextureLoader.js +5 -4
- package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
- package/Materials/Textures/internalTexture.js +2 -2
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/material.js +1 -1
- package/Materials/material.js.map +1 -1
- package/Maths/math.scalar.d.ts +1 -0
- package/Maths/math.scalar.functions.d.ts +9 -0
- package/Maths/math.scalar.functions.js +11 -0
- package/Maths/math.scalar.functions.js.map +1 -1
- package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +96 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js +318 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/csg2.d.ts +3 -3
- package/Meshes/csg2.js +3 -3
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/lattice.d.ts +2 -2
- package/Meshes/lattice.js +5 -4
- package/Meshes/lattice.js.map +1 -1
- package/Meshes/lattice.material.d.ts +2 -2
- package/Meshes/lattice.material.js +2 -2
- package/Meshes/lattice.material.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -2
- package/Meshes/mesh.js +2 -2
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/fileTools.d.ts +1 -1
- package/Misc/fileTools.js +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Physics/v2/characterController.d.ts +3 -2
- package/Physics/v2/characterController.js +12 -0
- package/Physics/v2/characterController.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +4 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +11 -16
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +6 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +7 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +3 -0
- package/scene.js +5 -0
- package/scene.js.map +1 -1
|
@@ -3,6 +3,7 @@ import type { InternalTexture } from "../../../Materials/Textures/internalTextur
|
|
|
3
3
|
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
4
4
|
/**
|
|
5
5
|
* Loader for .basis file format
|
|
6
|
+
* @internal
|
|
6
7
|
*/
|
|
7
8
|
export declare class _BasisTextureLoader implements IInternalTextureLoader {
|
|
8
9
|
/**
|
|
@@ -2,6 +2,7 @@ import { LoadTextureFromTranscodeResult, TranscodeAsync } from "../../../Misc/ba
|
|
|
2
2
|
import { Tools } from "../../../Misc/tools.js";
|
|
3
3
|
/**
|
|
4
4
|
* Loader for .basis file format
|
|
5
|
+
* @internal
|
|
5
6
|
*/
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
8
|
export class _BasisTextureLoader {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basisTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/basisTextureLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"basisTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/basisTextureLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,M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C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;gBAC9B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;aAChC;SACJ,CAAC;QACF,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC;aAChC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACb,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACtD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,eAAe,CAAC;YACzF,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE;gBAC9E,8BAA8B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,KAAK,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;YAC9F,KAAK,CAAC,IAAI,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;YACrD,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACX,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\nimport { LoadTextureFromTranscodeResult, TranscodeAsync } from \"../../../Misc/basis\";\r\nimport { Tools } from \"../../../Misc/tools\";\r\n\r\n/**\r\n * Loader for .basis file format\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _BasisTextureLoader implements IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n public readonly supportCascades = false;\r\n\r\n /**\r\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n public loadCubeData(\r\n data: ArrayBufferView | ArrayBufferView[],\r\n texture: InternalTexture,\r\n createPolynomials: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): void {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n const caps = texture.getEngine().getCaps();\r\n const transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false,\r\n astc: caps.astc ? true : false,\r\n bc7: caps.bptc ? true : false,\r\n },\r\n };\r\n TranscodeAsync(data, transcodeConfig)\r\n .then((result) => {\r\n const hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n LoadTextureFromTranscodeResult(texture, result);\r\n texture.getEngine()._setCubeMapTextureParams(texture, hasMipmap);\r\n texture.isReady = true;\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n })\r\n .catch((err) => {\r\n const errorMessage = \"Failed to transcode Basis file, transcoding may not be supported on this device\";\r\n Tools.Warn(errorMessage);\r\n texture.isReady = true;\r\n if (onError) {\r\n onError(err);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n public loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, failedLoading?: boolean) => void\r\n ): void {\r\n const caps = texture.getEngine().getCaps();\r\n const transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false,\r\n astc: caps.astc ? true : false,\r\n bc7: caps.bptc ? true : false,\r\n },\r\n };\r\n TranscodeAsync(data, transcodeConfig)\r\n .then((result) => {\r\n const rootImage = result.fileInfo.images[0].levels[0];\r\n const hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n callback(rootImage.width, rootImage.height, hasMipmap, result.format !== -1, () => {\r\n LoadTextureFromTranscodeResult(texture, result);\r\n });\r\n })\r\n .catch((err) => {\r\n Tools.Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\r\n Tools.Warn(`Failed to transcode Basis file: ${err}`);\r\n callback(0, 0, false, false, () => {}, true);\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -8,10 +8,11 @@ import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* Loader for .exr file format
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* @see [PIZ compression](https://playground.babylonjs.com/#4RN0VF#151)
|
|
12
|
+
* @see [ZIP compression](https://playground.babylonjs.com/#4RN0VF#146)
|
|
13
|
+
* @see [RLE compression](https://playground.babylonjs.com/#4RN0VF#149)
|
|
14
|
+
* @see [PXR24 compression](https://playground.babylonjs.com/#4RN0VF#150)
|
|
15
|
+
* @internal
|
|
15
16
|
*/
|
|
16
17
|
export declare class _ExrTextureLoader implements IInternalTextureLoader {
|
|
17
18
|
/**
|
|
@@ -67,10 +67,11 @@ import { ExrLoaderGlobalConfiguration } from "./EXR/exrLoader.configuration.js";
|
|
|
67
67
|
// // End of OpenEXR license -------------------------------------------------
|
|
68
68
|
/**
|
|
69
69
|
* Loader for .exr file format
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* @see [PIZ compression](https://playground.babylonjs.com/#4RN0VF#151)
|
|
71
|
+
* @see [ZIP compression](https://playground.babylonjs.com/#4RN0VF#146)
|
|
72
|
+
* @see [RLE compression](https://playground.babylonjs.com/#4RN0VF#149)
|
|
73
|
+
* @see [PXR24 compression](https://playground.babylonjs.com/#4RN0VF#150)
|
|
74
|
+
* @internal
|
|
74
75
|
*/
|
|
75
76
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
76
77
|
export class _ExrTextureLoader {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exrTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/exrTextureLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E;;;;GAIG;AAEH,KAAK;AACL,0CAA0C;AAC1C,uBAAuB;AAEvB,qEAAqE;AACrE,8EAA8E;AAC9E,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,qDAAqD;AACrD,6EAA6E;AAC7E,8EAA8E;AAE9E,kFAAkF;AAClF,gFAAgF;AAChF,yEAAyE;AACzE,qEAAqE;AACrE,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,+D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,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE5C,mBAAmB;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;QACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE;YACzD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YAC/B,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC;YACnC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;YACxB,OAAO,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;YAC1C,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACpB,MAAM,CAAC,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAC3F,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { InternalTexture } from \"../internalTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\nimport { GetExrHeader } from \"./EXR/exrLoader.header\";\r\nimport { CreateDecoderAsync, ScanData } from \"./EXR/exrLoader.decoder\";\r\nimport { ExrLoaderGlobalConfiguration } from \"./EXR/exrLoader.configuration\";\r\n\r\n/**\r\n * Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js\r\n * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita\r\n * implementation.\r\n */\r\n\r\n// /*\r\n// Copyright (c) 2014 - 2017, Syoyo Fujita\r\n// All rights reserved.\r\n\r\n// Redistribution and use in source and binary forms, with or without\r\n// modification, are permitted provided that the following conditions are met:\r\n// * Redistributions of source code must retain the above copyright\r\n// notice, this list of conditions and the following disclaimer.\r\n// * Redistributions in binary form must reproduce the above copyright\r\n// notice, this list of conditions and the following disclaimer in the\r\n// documentation and/or other materials provided with the distribution.\r\n// * Neither the name of the Syoyo Fujita nor the\r\n// names of its contributors may be used to endorse or promote products\r\n// derived from this software without specific prior written permission.\r\n\r\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\r\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\r\n// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// */\r\n\r\n// // TinyEXR contains some OpenEXR code, which is licensed under ------------\r\n\r\n// ///////////////////////////////////////////////////////////////////////////\r\n// //\r\n// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas\r\n// // Digital Ltd. LLC\r\n// //\r\n// // All rights reserved.\r\n// //\r\n// // Redistribution and use in source and binary forms, with or without\r\n// // modification, are permitted provided that the following conditions are\r\n// // met:\r\n// // * Redistributions of source code must retain the above copyright\r\n// // notice, this list of conditions and the following disclaimer.\r\n// // * Redistributions in binary form must reproduce the above\r\n// // copyright notice, this list of conditions and the following disclaimer\r\n// // in the documentation and/or other materials provided with the\r\n// // distribution.\r\n// // * Neither the name of Industrial Light & Magic nor the names of\r\n// // its contributors may be used to endorse or promote products derived\r\n// // from this software without specific prior written permission.\r\n// //\r\n// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n// // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// //\r\n// ///////////////////////////////////////////////////////////////////////////\r\n\r\n// // End of OpenEXR license -------------------------------------------------\r\n\r\n/**\r\n * Loader for .exr file format\r\n * #4RN0VF#151: PIZ compression\r\n * #4RN0VF#146: ZIP compression\r\n * #4RN0VF#149: RLE compression\r\n * #4RN0VF#150: PXR24 compression\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _ExrTextureLoader implements IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n public readonly supportCascades = false;\r\n\r\n /**\r\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\r\n * @param _data contains the texture data\r\n * @param _texture defines the BabylonJS internal texture\r\n * @param _createPolynomials will be true if polynomials have been requested\r\n * @param _onLoad defines the callback to trigger once the texture is ready\r\n * @param _onError defines the callback to trigger in case of error\r\n * Cube texture are not supported by .exr files\r\n */\r\n public loadCubeData(\r\n _data: ArrayBufferView | ArrayBufferView[],\r\n _texture: InternalTexture,\r\n _createPolynomials: boolean,\r\n _onLoad: Nullable<(data?: any) => void>,\r\n _onError: Nullable<(message?: string, exception?: any) => void>\r\n ): void {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \".exr not supported in Cube.\";\r\n }\r\n\r\n /**\r\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n public async loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, failedLoading?: boolean) => void\r\n ) {\r\n const dataView = new DataView(data.buffer);\r\n\r\n const offset = { value: 0 };\r\n const header = GetExrHeader(dataView, offset);\r\n const decoder = await CreateDecoderAsync(header, dataView, offset, ExrLoaderGlobalConfiguration.DefaultOutputType);\r\n\r\n ScanData(decoder, header, dataView, offset);\r\n\r\n // Updating texture\r\n const width = header.dataWindow.xMax - header.dataWindow.xMin + 1;\r\n const height = header.dataWindow.yMax - header.dataWindow.yMin + 1;\r\n callback(width, height, texture.generateMipMaps, false, () => {\r\n const engine = texture.getEngine();\r\n texture.format = header.format;\r\n texture.type = decoder.textureType;\r\n texture.invertY = false;\r\n texture._gammaSpace = !header.linearSpace;\r\n if (decoder.byteArray) {\r\n engine._uploadDataToTextureDirectly(texture, decoder.byteArray, 0, 0, undefined, true);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"exrTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/exrTextureLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E;;;;GAIG;AAEH,KAAK;AACL,0CAA0C;AAC1C,uBAAuB;AAEvB,qEAAqE;AACrE,8EAA8E;AAC9E,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,qDAAqD;AACrD,6EAA6E;AAC7E,8EAA8E;AAE9E,kFAAkF;AAClF,gFAAgF;AAChF,yEAAyE;AACzE,qEAAqE;AACrE,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,+DAA+D;AAC/D,KAAK;AAEL,8EAA8E;AAE9E,8EAA8E;AAC9E,KAAK;AACL,uEAAuE;AACvE,sBAAsB;AACtB,KAAK;AACL,0BAA0B;AAC1B,KAAK;AACL,wEAAwE;AACxE,4EAA4E;AAC5E,UAAU;AACV,4EAA4E;AAC5E,mEAAmE;AACnE,qEAAqE;AACrE,4EAA4E;AAC5E,mEAAmE;AACnE,mBAAmB;AACnB,2EAA2E;AAC3E,yEAAyE;AACzE,mEAAmE;AACnE,KAAK;AACL,yEAAyE;AACzE,uEAAuE;AACvE,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,KAAK;AACL,8EAA8E;AAE9E,8EAA8E;AA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AW,CAAC;YACnC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;YACxB,OAAO,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;YAC1C,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACpB,MAAM,CAAC,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAC3F,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { InternalTexture } from \"../internalTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\nimport { GetExrHeader } from \"./EXR/exrLoader.header\";\r\nimport { CreateDecoderAsync, ScanData } from \"./EXR/exrLoader.decoder\";\r\nimport { ExrLoaderGlobalConfiguration } from \"./EXR/exrLoader.configuration\";\r\n\r\n/**\r\n * Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js\r\n * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita\r\n * implementation.\r\n */\r\n\r\n// /*\r\n// Copyright (c) 2014 - 2017, Syoyo Fujita\r\n// All rights reserved.\r\n\r\n// Redistribution and use in source and binary forms, with or without\r\n// modification, are permitted provided that the following conditions are met:\r\n// * Redistributions of source code must retain the above copyright\r\n// notice, this list of conditions and the following disclaimer.\r\n// * Redistributions in binary form must reproduce the above copyright\r\n// notice, this list of conditions and the following disclaimer in the\r\n// documentation and/or other materials provided with the distribution.\r\n// * Neither the name of the Syoyo Fujita nor the\r\n// names of its contributors may be used to endorse or promote products\r\n// derived from this software without specific prior written permission.\r\n\r\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\r\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\r\n// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// */\r\n\r\n// // TinyEXR contains some OpenEXR code, which is licensed under ------------\r\n\r\n// ///////////////////////////////////////////////////////////////////////////\r\n// //\r\n// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas\r\n// // Digital Ltd. LLC\r\n// //\r\n// // All rights reserved.\r\n// //\r\n// // Redistribution and use in source and binary forms, with or without\r\n// // modification, are permitted provided that the following conditions are\r\n// // met:\r\n// // * Redistributions of source code must retain the above copyright\r\n// // notice, this list of conditions and the following disclaimer.\r\n// // * Redistributions in binary form must reproduce the above\r\n// // copyright notice, this list of conditions and the following disclaimer\r\n// // in the documentation and/or other materials provided with the\r\n// // distribution.\r\n// // * Neither the name of Industrial Light & Magic nor the names of\r\n// // its contributors may be used to endorse or promote products derived\r\n// // from this software without specific prior written permission.\r\n// //\r\n// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n// // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// //\r\n// ///////////////////////////////////////////////////////////////////////////\r\n\r\n// // End of OpenEXR license -------------------------------------------------\r\n\r\n/**\r\n * Loader for .exr file format\r\n * @see [PIZ compression](https://playground.babylonjs.com/#4RN0VF#151)\r\n * @see [ZIP compression](https://playground.babylonjs.com/#4RN0VF#146)\r\n * @see [RLE compression](https://playground.babylonjs.com/#4RN0VF#149)\r\n * @see [PXR24 compression](https://playground.babylonjs.com/#4RN0VF#150)\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _ExrTextureLoader implements IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n public readonly supportCascades = false;\r\n\r\n /**\r\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\r\n * @param _data contains the texture data\r\n * @param _texture defines the BabylonJS internal texture\r\n * @param _createPolynomials will be true if polynomials have been requested\r\n * @param _onLoad defines the callback to trigger once the texture is ready\r\n * @param _onError defines the callback to trigger in case of error\r\n * Cube texture are not supported by .exr files\r\n */\r\n public loadCubeData(\r\n _data: ArrayBufferView | ArrayBufferView[],\r\n _texture: InternalTexture,\r\n _createPolynomials: boolean,\r\n _onLoad: Nullable<(data?: any) => void>,\r\n _onError: Nullable<(message?: string, exception?: any) => void>\r\n ): void {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \".exr not supported in Cube.\";\r\n }\r\n\r\n /**\r\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n public async loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, failedLoading?: boolean) => void\r\n ) {\r\n const dataView = new DataView(data.buffer);\r\n\r\n const offset = { value: 0 };\r\n const header = GetExrHeader(dataView, offset);\r\n const decoder = await CreateDecoderAsync(header, dataView, offset, ExrLoaderGlobalConfiguration.DefaultOutputType);\r\n\r\n ScanData(decoder, header, dataView, offset);\r\n\r\n // Updating texture\r\n const width = header.dataWindow.xMax - header.dataWindow.xMin + 1;\r\n const height = header.dataWindow.yMax - header.dataWindow.yMin + 1;\r\n callback(width, height, texture.generateMipMaps, false, () => {\r\n const engine = texture.getEngine();\r\n texture.format = header.format;\r\n texture.type = decoder.textureType;\r\n texture.invertY = false;\r\n texture._gammaSpace = !header.linearSpace;\r\n if (decoder.byteArray) {\r\n engine._uploadDataToTextureDirectly(texture, decoder.byteArray, 0, 0, undefined, true);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -431,9 +431,9 @@ export class InternalTexture extends TextureSampler {
|
|
|
431
431
|
*/
|
|
432
432
|
dispose() {
|
|
433
433
|
this._references--;
|
|
434
|
-
this.onLoadedObservable.clear();
|
|
435
|
-
this.onErrorObservable.clear();
|
|
436
434
|
if (this._references === 0) {
|
|
435
|
+
this.onLoadedObservable.clear();
|
|
436
|
+
this.onErrorObservable.clear();
|
|
437
437
|
this._engine._releaseTexture(this);
|
|
438
438
|
this._hardwareTexture = null;
|
|
439
439
|
this._dynamicTextureSource = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/internalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;GAEG;AACH,MAAM,CAAN,IAAkB,qBA6DjB;AA7DD,WAAkB,qBAAqB;IACnC;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,iFAAY,CAAA;IACZ;;OAEG;IACH,2FAAiB,CAAA;IACjB;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,uFAAe,CAAA;IACf;;OAEG;IACH,oEAAK,CAAA;IACL;;OAEG;IACH,8EAAU,CAAA;IACV;;OAEG;IACH,kFAAY,CAAA;IACZ;;OAEG;IACH,gFAAW,CAAA;IACX;;OAEG;IACH,oEAAK,CAAA;AACT,CAAC,EA7DiB,qBAAqB,KAArB,qBAAqB,QA6DtC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IA+B/C;;;OAGG;IACH,IAAoB,UAAU;QAC1B,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IACD,IAAoB,UAAU,CAAC,KAAc;QACzC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAwJD,iDAAiD;IACjD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,gBAAgB;IACT,YAAY,CAAC,EAAU;QAC1B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;I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C,IAAI,CAAC,CAAC;QAChC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QACtC,CAAC;IACL,CAAC;;AArUD,gBAAgB;AACF,wBAAQ,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { ImageSource, Nullable, int } from \"../../types\";\r\nimport type { ICanvas, ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport type { HardwareTextureWrapper } from \"./hardwareTextureWrapper\";\r\nimport { TextureSampler } from \"./textureSampler\";\r\n\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\n\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport const enum InternalTextureSource {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n Unknown,\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n Url,\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n Temp,\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n Raw,\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n Dynamic,\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n RenderTarget,\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n MultiRenderTarget,\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n Cube,\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n CubeRaw,\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n CubePrefiltered,\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n Raw3D,\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n Raw2DArray,\r\n /**\r\n * Texture content is a depth/stencil texture\r\n */\r\n DepthStencil,\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n CubeRawRGBD,\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n Depth,\r\n}\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nexport class InternalTexture extends TextureSampler {\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n public isReady: boolean = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n public isCube: boolean = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n public is3D: boolean = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n public is2DArray: boolean = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n public isMultiview: boolean = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n public url: string = \"\";\r\n /** @internal */\r\n public _originalUrl: string; // not empty only if different from url\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n public generateMipMaps: boolean = false;\r\n /**\r\n * Gets a boolean indicating if the texture uses mipmaps\r\n * TODO implements useMipMaps as a separate setting from generateMipMaps\r\n */\r\n public override get useMipMaps() {\r\n return this.generateMipMaps;\r\n }\r\n public override set useMipMaps(value: boolean) {\r\n this.generateMipMaps = value;\r\n }\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n public samples: number = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n public type: number = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n public format: number = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n public onLoadedObservable = new Observable<InternalTexture>();\r\n /**\r\n * Observable called when the texture load is raising an error\r\n */\r\n public onErrorObservable = new Observable<Partial<{ message: string; exception: any }>>();\r\n /**\r\n * If this callback is defined it will be called instead of the default _rebuild function\r\n */\r\n public onRebuildCallback: Nullable<\r\n (internalTexture: InternalTexture) => {\r\n proxy: Nullable<InternalTexture | Promise<InternalTexture>>;\r\n isReady: boolean;\r\n isAsync: boolean;\r\n }\r\n > = null;\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public width: number = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public height: number = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public depth: number = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseWidth: number = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseHeight: number = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseDepth: number = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n public invertY: boolean = false;\r\n\r\n // Private\r\n /** @internal */\r\n public _invertVScale = false;\r\n /** @internal */\r\n public _associatedChannel = -1;\r\n /** @internal */\r\n public _source = InternalTextureSource.Unknown;\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n /** @internal */\r\n public _bufferView: Nullable<ArrayBufferView> = null;\r\n /** @internal */\r\n public _bufferViewArray: Nullable<ArrayBufferView[]> = null;\r\n /** @internal */\r\n public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;\r\n /** @internal */\r\n public _size: number = 0;\r\n /** @internal */\r\n public _extension: string = \"\";\r\n /** @internal */\r\n public _files: Nullable<string[]> = null;\r\n /** @internal */\r\n public _workingCanvas: Nullable<ICanvas> = null;\r\n /** @internal */\r\n public _workingContext: Nullable<ICanvasRenderingContext> = null;\r\n /** @internal */\r\n public _cachedCoordinatesMode: Nullable<number> = null;\r\n /** @internal */\r\n public _isDisabled: boolean = false;\r\n /** @internal */\r\n public _compression: Nullable<string> = null;\r\n /** @internal */\r\n public _sphericalPolynomial: Nullable<SphericalPolynomial> = null;\r\n /** @internal */\r\n public _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>> = null;\r\n /** @internal */\r\n public _sphericalPolynomialComputed = false;\r\n /** @internal */\r\n public _lodGenerationScale: number = 0;\r\n /** @internal */\r\n public _lodGenerationOffset: number = 0;\r\n /** @internal */\r\n public _useSRGBBuffer: boolean = false;\r\n /** @internal */\r\n public _creationFlags: number = 0;\r\n /** @internal */\r\n public _originalFormat?: number;\r\n\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @internal */\r\n public _lodTextureHigh: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureMid: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureLow: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _isRGBD: boolean = false;\r\n\r\n /** @internal */\r\n public _linearSpecularLOD: boolean = false;\r\n /** @internal */\r\n public _irradianceTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n public _hardwareTexture: Nullable<HardwareTextureWrapper> = null;\r\n\r\n /** @internal */\r\n public _maxLodLevel: Nullable<number> = null;\r\n\r\n /** @internal */\r\n public _references: number = 1;\r\n\r\n /** @internal */\r\n public _gammaSpace: Nullable<boolean> = null;\r\n\r\n /** @internal */\r\n public _premulAlpha = false;\r\n\r\n /** @internal */\r\n public _dynamicTextureSource: Nullable<ImageSource> = null;\r\n\r\n /** @internal */\r\n public _autoMSAAManagement = false;\r\n\r\n private _engine: AbstractEngine;\r\n private _uniqueId: number;\r\n\r\n /** @internal */\r\n public static _Counter = 0;\r\n\r\n /** Gets the unique id of the internal texture */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /** @internal */\r\n public _setUniqueId(id: number) {\r\n this._uniqueId = id;\r\n }\r\n\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n public getEngine(): AbstractEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n public get source(): InternalTextureSource {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n constructor(engine: AbstractEngine, source: InternalTextureSource, delayAllocation = false) {\r\n super();\r\n\r\n this._engine = engine;\r\n this._source = source;\r\n this._uniqueId = InternalTexture._Counter++;\r\n\r\n if (!delayAllocation) {\r\n this._hardwareTexture = engine._createHardwareTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n public incrementReferences(): void {\r\n this._references++;\r\n }\r\n\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n public updateSize(width: int, height: int, depth: int = 1): void {\r\n this._engine.updateTextureDimensions(this, width, height, depth);\r\n\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n\r\n this._size = width * height * depth;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedWrapR = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n if (this.onRebuildCallback) {\r\n const data = this.onRebuildCallback(this);\r\n const swapAndSetIsReady = (proxyInternalTexture: InternalTexture) => {\r\n proxyInternalTexture._swapAndDie(this, false);\r\n this.isReady = data.isReady;\r\n };\r\n if (data.isAsync) {\r\n (data.proxy as Promise<InternalTexture>).then(swapAndSetIsReady);\r\n } else {\r\n swapAndSetIsReady(data.proxy as InternalTexture);\r\n }\r\n return;\r\n }\r\n\r\n let proxy: InternalTexture;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n break;\r\n\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(\r\n this._originalUrl ?? this.url,\r\n !this.generateMipMaps,\r\n this.invertY,\r\n null,\r\n this.samplingMode,\r\n // Do not use Proxy here as it could be fully synchronous\r\n // and proxy would be undefined.\r\n (temp) => {\r\n temp._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this._buffer,\r\n undefined,\r\n this.format,\r\n this._extension,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type,\r\n this._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this, false);\r\n if (this._dynamicTextureSource) {\r\n this._engine.updateDynamicTexture(this, this._dynamicTextureSource, this.invertY, this._premulAlpha, this.format, true);\r\n }\r\n\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n break;\r\n\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(\r\n this.url,\r\n null,\r\n this._files,\r\n !this.generateMipMaps,\r\n () => {\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension,\r\n false,\r\n 0,\r\n 0,\r\n null,\r\n undefined,\r\n this._useSRGBBuffer,\r\n ArrayBuffer.isView(this._buffer) ? this._buffer : null\r\n );\r\n return;\r\n\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(\r\n this._bufferViewArray!,\r\n this.width,\r\n this._originalFormat ?? this.format,\r\n this.type,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression\r\n );\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.CubeRawRGBD:\r\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\r\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\r\n return;\r\n\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(\r\n this.url,\r\n null,\r\n this._lodGenerationScale,\r\n this._lodGenerationOffset,\r\n (proxy) => {\r\n if (proxy) {\r\n proxy._swapAndDie(this, false);\r\n }\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension\r\n );\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n\r\n case InternalTextureSource.DepthStencil:\r\n case InternalTextureSource.Depth: {\r\n // Will be handled at the RenderTargetWrapper level\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture, swapAll = true): void {\r\n // TODO what about refcount on target?\r\n\r\n this._hardwareTexture?.setUsage(target._source, this.generateMipMaps, this.is2DArray, this.isCube, this.is3D, this.width, this.height, this.depth);\r\n\r\n target._hardwareTexture = this._hardwareTexture;\r\n if (swapAll) {\r\n target._isRGBD = this._isRGBD;\r\n }\r\n\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n\r\n const cache = this._engine.getLoadedTexturesCache();\r\n let index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n\r\n index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n public dispose(): void {\r\n this._references--;\r\n this.onLoadedObservable.clear();\r\n this.onErrorObservable.clear();\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._hardwareTexture = null;\r\n this._dynamicTextureSource = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"internalTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/internalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;GAEG;AACH,MAAM,CAAN,IAAkB,qBA6DjB;AA7DD,WAAkB,qBAAqB;IACnC;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,iFAAY,CAAA;IACZ;;OAEG;IACH,2FAAiB,CAAA;IACjB;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,uFAAe,CAAA;IACf;;OAEG;IACH,oEAAK,CAAA;IACL;;OAEG;IACH,8EAAU,CAAA;IACV;;OAEG;IACH,kFAAY,CAAA;IACZ;;OAEG;IACH,gFAAW,CAAA;IACX;;OAEG;IACH,oEAAK,CAAA;AACT,CAAC,EA7DiB,qBAAqB,KAArB,qBAAqB,QA6DtC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IA+B/C;;;OAGG;IACH,IAAoB,UAAU;QAC1B,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IACD,IAAoB,UAAU,CAAC,KAAc;QACzC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC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AC5B,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;YACxC,CAAC;YACD,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACxD,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACpD,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QACtC,CAAC;IACL,CAAC;;AArUD,gBAAgB;AACF,wBAAQ,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { ImageSource, Nullable, int } from \"../../types\";\r\nimport type { ICanvas, ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport type { HardwareTextureWrapper } from \"./hardwareTextureWrapper\";\r\nimport { TextureSampler } from \"./textureSampler\";\r\n\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\n\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport const enum InternalTextureSource {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n Unknown,\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n Url,\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n Temp,\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n Raw,\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n Dynamic,\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n RenderTarget,\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n MultiRenderTarget,\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n Cube,\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n CubeRaw,\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n CubePrefiltered,\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n Raw3D,\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n Raw2DArray,\r\n /**\r\n * Texture content is a depth/stencil texture\r\n */\r\n DepthStencil,\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n CubeRawRGBD,\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n Depth,\r\n}\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nexport class InternalTexture extends TextureSampler {\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n public isReady: boolean = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n public isCube: boolean = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n public is3D: boolean = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n public is2DArray: boolean = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n public isMultiview: boolean = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n public url: string = \"\";\r\n /** @internal */\r\n public _originalUrl: string; // not empty only if different from url\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n public generateMipMaps: boolean = false;\r\n /**\r\n * Gets a boolean indicating if the texture uses mipmaps\r\n * TODO implements useMipMaps as a separate setting from generateMipMaps\r\n */\r\n public override get useMipMaps() {\r\n return this.generateMipMaps;\r\n }\r\n public override set useMipMaps(value: boolean) {\r\n this.generateMipMaps = value;\r\n }\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n public samples: number = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n public type: number = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n public format: number = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n public onLoadedObservable = new Observable<InternalTexture>();\r\n /**\r\n * Observable called when the texture load is raising an error\r\n */\r\n public onErrorObservable = new Observable<Partial<{ message: string; exception: any }>>();\r\n /**\r\n * If this callback is defined it will be called instead of the default _rebuild function\r\n */\r\n public onRebuildCallback: Nullable<\r\n (internalTexture: InternalTexture) => {\r\n proxy: Nullable<InternalTexture | Promise<InternalTexture>>;\r\n isReady: boolean;\r\n isAsync: boolean;\r\n }\r\n > = null;\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public width: number = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public height: number = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public depth: number = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseWidth: number = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseHeight: number = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseDepth: number = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n public invertY: boolean = false;\r\n\r\n // Private\r\n /** @internal */\r\n public _invertVScale = false;\r\n /** @internal */\r\n public _associatedChannel = -1;\r\n /** @internal */\r\n public _source = InternalTextureSource.Unknown;\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n /** @internal */\r\n public _bufferView: Nullable<ArrayBufferView> = null;\r\n /** @internal */\r\n public _bufferViewArray: Nullable<ArrayBufferView[]> = null;\r\n /** @internal */\r\n public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;\r\n /** @internal */\r\n public _size: number = 0;\r\n /** @internal */\r\n public _extension: string = \"\";\r\n /** @internal */\r\n public _files: Nullable<string[]> = null;\r\n /** @internal */\r\n public _workingCanvas: Nullable<ICanvas> = null;\r\n /** @internal */\r\n public _workingContext: Nullable<ICanvasRenderingContext> = null;\r\n /** @internal */\r\n public _cachedCoordinatesMode: Nullable<number> = null;\r\n /** @internal */\r\n public _isDisabled: boolean = false;\r\n /** @internal */\r\n public _compression: Nullable<string> = null;\r\n /** @internal */\r\n public _sphericalPolynomial: Nullable<SphericalPolynomial> = null;\r\n /** @internal */\r\n public _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>> = null;\r\n /** @internal */\r\n public _sphericalPolynomialComputed = false;\r\n /** @internal */\r\n public _lodGenerationScale: number = 0;\r\n /** @internal */\r\n public _lodGenerationOffset: number = 0;\r\n /** @internal */\r\n public _useSRGBBuffer: boolean = false;\r\n /** @internal */\r\n public _creationFlags: number = 0;\r\n /** @internal */\r\n public _originalFormat?: number;\r\n\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @internal */\r\n public _lodTextureHigh: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureMid: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureLow: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _isRGBD: boolean = false;\r\n\r\n /** @internal */\r\n public _linearSpecularLOD: boolean = false;\r\n /** @internal */\r\n public _irradianceTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n public _hardwareTexture: Nullable<HardwareTextureWrapper> = null;\r\n\r\n /** @internal */\r\n public _maxLodLevel: Nullable<number> = null;\r\n\r\n /** @internal */\r\n public _references: number = 1;\r\n\r\n /** @internal */\r\n public _gammaSpace: Nullable<boolean> = null;\r\n\r\n /** @internal */\r\n public _premulAlpha = false;\r\n\r\n /** @internal */\r\n public _dynamicTextureSource: Nullable<ImageSource> = null;\r\n\r\n /** @internal */\r\n public _autoMSAAManagement = false;\r\n\r\n private _engine: AbstractEngine;\r\n private _uniqueId: number;\r\n\r\n /** @internal */\r\n public static _Counter = 0;\r\n\r\n /** Gets the unique id of the internal texture */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /** @internal */\r\n public _setUniqueId(id: number) {\r\n this._uniqueId = id;\r\n }\r\n\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n public getEngine(): AbstractEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n public get source(): InternalTextureSource {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n constructor(engine: AbstractEngine, source: InternalTextureSource, delayAllocation = false) {\r\n super();\r\n\r\n this._engine = engine;\r\n this._source = source;\r\n this._uniqueId = InternalTexture._Counter++;\r\n\r\n if (!delayAllocation) {\r\n this._hardwareTexture = engine._createHardwareTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n public incrementReferences(): void {\r\n this._references++;\r\n }\r\n\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n public updateSize(width: int, height: int, depth: int = 1): void {\r\n this._engine.updateTextureDimensions(this, width, height, depth);\r\n\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n\r\n this._size = width * height * depth;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedWrapR = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n if (this.onRebuildCallback) {\r\n const data = this.onRebuildCallback(this);\r\n const swapAndSetIsReady = (proxyInternalTexture: InternalTexture) => {\r\n proxyInternalTexture._swapAndDie(this, false);\r\n this.isReady = data.isReady;\r\n };\r\n if (data.isAsync) {\r\n (data.proxy as Promise<InternalTexture>).then(swapAndSetIsReady);\r\n } else {\r\n swapAndSetIsReady(data.proxy as InternalTexture);\r\n }\r\n return;\r\n }\r\n\r\n let proxy: InternalTexture;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n break;\r\n\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(\r\n this._originalUrl ?? this.url,\r\n !this.generateMipMaps,\r\n this.invertY,\r\n null,\r\n this.samplingMode,\r\n // Do not use Proxy here as it could be fully synchronous\r\n // and proxy would be undefined.\r\n (temp) => {\r\n temp._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this._buffer,\r\n undefined,\r\n this.format,\r\n this._extension,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type,\r\n this._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this, false);\r\n if (this._dynamicTextureSource) {\r\n this._engine.updateDynamicTexture(this, this._dynamicTextureSource, this.invertY, this._premulAlpha, this.format, true);\r\n }\r\n\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n break;\r\n\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(\r\n this.url,\r\n null,\r\n this._files,\r\n !this.generateMipMaps,\r\n () => {\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension,\r\n false,\r\n 0,\r\n 0,\r\n null,\r\n undefined,\r\n this._useSRGBBuffer,\r\n ArrayBuffer.isView(this._buffer) ? this._buffer : null\r\n );\r\n return;\r\n\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(\r\n this._bufferViewArray!,\r\n this.width,\r\n this._originalFormat ?? this.format,\r\n this.type,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression\r\n );\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.CubeRawRGBD:\r\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\r\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\r\n return;\r\n\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(\r\n this.url,\r\n null,\r\n this._lodGenerationScale,\r\n this._lodGenerationOffset,\r\n (proxy) => {\r\n if (proxy) {\r\n proxy._swapAndDie(this, false);\r\n }\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension\r\n );\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n\r\n case InternalTextureSource.DepthStencil:\r\n case InternalTextureSource.Depth: {\r\n // Will be handled at the RenderTargetWrapper level\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture, swapAll = true): void {\r\n // TODO what about refcount on target?\r\n\r\n this._hardwareTexture?.setUsage(target._source, this.generateMipMaps, this.is2DArray, this.isCube, this.is3D, this.width, this.height, this.depth);\r\n\r\n target._hardwareTexture = this._hardwareTexture;\r\n if (swapAll) {\r\n target._isRGBD = this._isRGBD;\r\n }\r\n\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n\r\n const cache = this._engine.getLoadedTexturesCache();\r\n let index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n\r\n index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n public dispose(): void {\r\n this._references--;\r\n if (this._references === 0) {\r\n this.onLoadedObservable.clear();\r\n this.onErrorObservable.clear();\r\n this._engine._releaseTexture(this);\r\n this._hardwareTexture = null;\r\n this._dynamicTextureSource = null;\r\n }\r\n }\r\n}\r\n"]}
|
package/Materials/material.js
CHANGED
|
@@ -1141,7 +1141,7 @@ export class Material {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
for (const subMesh of mesh.subMeshes) {
|
|
1143
1143
|
// We want to skip the submeshes which are not using this material or which have not yet rendered at least once
|
|
1144
|
-
const material = subMesh.getMaterial() || scene.defaultMaterial;
|
|
1144
|
+
const material = subMesh.getMaterial() || (scene._hasDefaultMaterial ? scene.defaultMaterial : null);
|
|
1145
1145
|
if (material !== this) {
|
|
1146
1146
|
continue;
|
|
1147
1147
|
}
|