@babylonjs/core 7.21.4 → 7.22.0
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/Audio/analyser.js +3 -3
- package/Audio/analyser.js.map +1 -1
- package/Audio/audioSceneComponent.js +7 -7
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +55 -50
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.js +11 -11
- package/Audio/soundTrack.js.map +1 -1
- package/Cameras/flyCamera.js +2 -2
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/freeCamera.js +2 -2
- package/Cameras/freeCamera.js.map +1 -1
- package/Collisions/collisionCoordinator.js +2 -2
- package/Collisions/collisionCoordinator.js.map +1 -1
- package/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +25 -28
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/abstractEngine.d.ts +18 -3
- package/Engines/abstractEngine.js +32 -13
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +0 -7
- package/Engines/engine.js +0 -13
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +3 -9
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +0 -37
- package/Engines/thinEngine.js +2 -40
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -2
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/gamepadManager.js +2 -2
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Loading/sceneLoader.d.ts +2 -2
- package/Loading/sceneLoader.js +3 -3
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.d.ts +31 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.huf.d.ts +9 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.huf.js +454 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.huf.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.js +147 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.d.ts +7 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.js +91 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.configuration.d.ts +17 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.configuration.js +19 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.configuration.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.core.d.ts +130 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.core.js +452 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.core.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.decoder.d.ts +25 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.decoder.js +284 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.decoder.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.header.d.ts +9 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.header.js +112 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.header.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.interfaces.d.ts +75 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.interfaces.js +16 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.interfaces.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/index.d.ts +7 -0
- package/Materials/Textures/Loaders/EXR/index.js +8 -0
- package/Materials/Textures/Loaders/EXR/index.js.map +1 -0
- package/Materials/Textures/Loaders/basisTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/basisTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/ddsTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/envTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/exrTextureLoader.d.ts +37 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js +122 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -0
- package/Materials/Textures/Loaders/hdrTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/hdrTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/index.d.ts +4 -0
- package/Materials/Textures/Loaders/index.js +5 -0
- package/Materials/Textures/Loaders/index.js.map +1 -1
- package/Materials/Textures/{internalTextureLoader.d.ts → Loaders/internalTextureLoader.d.ts} +2 -9
- package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -0
- package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +1 -8
- package/Materials/Textures/Loaders/ktxTextureLoader.js +0 -13
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/textureLoaderManager.d.ts +9 -0
- package/Materials/Textures/Loaders/textureLoaderManager.js +32 -0
- package/Materials/Textures/Loaders/textureLoaderManager.js.map +1 -0
- package/Materials/Textures/Loaders/tgaTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/tgaTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/tgaTextureLoader.js.map +1 -1
- package/Materials/Textures/Packer/packer.js +2 -2
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/index.d.ts +0 -1
- package/Materials/Textures/index.js +0 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/fresnelParameters.js +2 -2
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/materialFlags.js +24 -24
- package/Materials/materialFlags.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +2 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/abstractMesh.js +2 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Misc/fileTools.d.ts +13 -0
- package/Misc/fileTools.js +16 -0
- package/Misc/fileTools.js.map +1 -1
- package/Offline/database.js +2 -2
- package/Offline/database.js.map +1 -1
- package/Rendering/boundingBoxRenderer.d.ts +2 -2
- package/Rendering/boundingBoxRenderer.js +2 -2
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.d.ts +7 -2
- package/Rendering/edgesRenderer.js +23 -6
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/index.d.ts +12 -4
- package/Rendering/index.js +14 -4
- package/Rendering/index.js.map +1 -1
- package/Rendering/outlineRenderer.d.ts +7 -2
- package/Rendering/outlineRenderer.js +64 -11
- package/Rendering/outlineRenderer.js.map +1 -1
- package/ShadersWGSL/line.fragment.d.ts +9 -0
- package/ShadersWGSL/line.fragment.js +24 -0
- package/ShadersWGSL/line.fragment.js.map +1 -0
- package/ShadersWGSL/line.vertex.d.ts +13 -0
- package/ShadersWGSL/line.vertex.js +36 -0
- package/ShadersWGSL/line.vertex.js.map +1 -0
- package/ShadersWGSL/outline.fragment.d.ts +9 -0
- package/ShadersWGSL/outline.fragment.js +30 -0
- package/ShadersWGSL/outline.fragment.js.map +1 -0
- package/ShadersWGSL/outline.vertex.d.ts +19 -0
- package/ShadersWGSL/outline.vertex.js +66 -0
- package/ShadersWGSL/outline.vertex.js.map +1 -0
- package/Sprites/spriteMap.js +4 -4
- package/Sprites/spriteMap.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +2 -3
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/webXRExperienceHelper.js +2 -2
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +2 -3
- package/scene.js.map +1 -1
- package/Materials/Textures/internalTextureLoader.js.map +0 -1
- /package/Materials/Textures/{internalTextureLoader.js → Loaders/internalTextureLoader.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LoadTextureFromTranscodeResult, TranscodeAsync } from "../../../Misc/basis.js";
|
|
2
2
|
import { Tools } from "../../../Misc/tools.js";
|
|
3
|
-
import { AbstractEngine } from "../../../Engines/abstractEngine.js";
|
|
4
3
|
import "../../../Engines/Extensions/engine.cubeTexture.js";
|
|
5
4
|
/**
|
|
6
5
|
* Loader for .basis file format
|
|
@@ -13,14 +12,6 @@ export class _BasisTextureLoader {
|
|
|
13
12
|
*/
|
|
14
13
|
this.supportCascades = false;
|
|
15
14
|
}
|
|
16
|
-
/**
|
|
17
|
-
* This returns if the loader support the current file information.
|
|
18
|
-
* @param extension defines the file extension of the file being loaded
|
|
19
|
-
* @returns true if the loader can load the specified file
|
|
20
|
-
*/
|
|
21
|
-
canLoad(extension) {
|
|
22
|
-
return extension.endsWith(".basis");
|
|
23
|
-
}
|
|
24
15
|
/**
|
|
25
16
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
26
17
|
* @param data contains the texture data
|
|
@@ -98,6 +89,4 @@ export class _BasisTextureLoader {
|
|
|
98
89
|
});
|
|
99
90
|
}
|
|
100
91
|
}
|
|
101
|
-
// Register the loader.
|
|
102
|
-
AbstractEngine._TextureLoaders.push(new _BasisTextureLoader());
|
|
103
92
|
//# sourceMappingURL=basisTextureLoader.js.map
|
|
@@ -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;
|
|
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,OAAO,gDAAgD,CAAC;AAExD;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,mBAAmB;IAAhC;QACI;;WAEG;QACa,oBAAe,GAAG,KAAK,CAAC;IAyF5C,CAAC;IAvFG;;;;;;;OAOG;IACI,YAAY,CACf,IAAyC,EACzC,OAAwB,EACxB,iBAA0B,EAC1B,MAAsC,EACtC,OAA8D;QAE9D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO;SACV;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC;QAC3C,MAAM,eAAe,GAAG;YACpB,2BAA2B,EAAE;gBACzB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;gBAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;gBAC9B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;gBAChC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;gBAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,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,CA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alTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\nimport { LoadTextureFromTranscodeResult, TranscodeAsync } from \"../../../Misc/basis\";\r\nimport { Tools } from \"../../../Misc/tools\";\r\n\r\nimport \"../../../Engines/Extensions/engine.cubeTexture\";\r\n\r\n/**\r\n * Loader for .basis file format\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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from "../../../types";
|
|
2
2
|
import type { InternalTexture } from "../../../Materials/Textures/internalTexture";
|
|
3
|
-
import type { IInternalTextureLoader } from "
|
|
3
|
+
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
4
4
|
import "../../../Engines/Extensions/engine.cubeTexture";
|
|
5
5
|
/**
|
|
6
6
|
* Implementation of the DDS Texture Loader.
|
|
@@ -11,12 +11,6 @@ export declare class _DDSTextureLoader implements IInternalTextureLoader {
|
|
|
11
11
|
* Defines whether the loader supports cascade loading the different faces.
|
|
12
12
|
*/
|
|
13
13
|
readonly supportCascades = true;
|
|
14
|
-
/**
|
|
15
|
-
* This returns if the loader support the current file information.
|
|
16
|
-
* @param extension defines the file extension of the file being loaded
|
|
17
|
-
* @returns true if the loader can load the specified file
|
|
18
|
-
*/
|
|
19
|
-
canLoad(extension: string): boolean;
|
|
20
14
|
/**
|
|
21
15
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
22
16
|
* @param imgs contains the cube maps
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SphericalPolynomial } from "../../../Maths/sphericalPolynomial.js";
|
|
2
|
-
import { Engine } from "../../../Engines/engine.js";
|
|
3
2
|
import { DDSTools } from "../../../Misc/dds.js";
|
|
4
3
|
import "../../../Engines/Extensions/engine.cubeTexture.js";
|
|
5
4
|
/**
|
|
@@ -14,14 +13,6 @@ export class _DDSTextureLoader {
|
|
|
14
13
|
*/
|
|
15
14
|
this.supportCascades = true;
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
* This returns if the loader support the current file information.
|
|
19
|
-
* @param extension defines the file extension of the file being loaded
|
|
20
|
-
* @returns true if the loader can load the specified file
|
|
21
|
-
*/
|
|
22
|
-
canLoad(extension) {
|
|
23
|
-
return extension.endsWith(".dds");
|
|
24
|
-
}
|
|
25
16
|
/**
|
|
26
17
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
27
18
|
* @param imgs contains the cube maps
|
|
@@ -92,6 +83,4 @@ export class _DDSTextureLoader {
|
|
|
92
83
|
});
|
|
93
84
|
}
|
|
94
85
|
}
|
|
95
|
-
// Register the loader.
|
|
96
|
-
Engine._TextureLoaders.push(new _DDSTextureLoader());
|
|
97
86
|
//# sourceMappingURL=ddsTextureLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddsTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/ddsTextureLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"ddsTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/ddsTextureLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,gDAAgD,CAAC;AAGxD;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,iBAAiB;IAA9B;QACI;;WAEG;QACa,oBAAe,GAAG,IAAI,CAAC;IAqF3C,CAAC;IAnFG;;;;;;OAMG;IACI,YAAY,CAAC,IAAyC,EAAE,OAAwB,EAAE,iBAA0B,EAAE,MAAsC;QACvJ,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAY,CAAC;QAC7C,IAAI,IAAyB,CAAC;QAC9B,IAAI,UAAU,GAAY,KAAK,CAAC;QAChC,IAAI,QAAQ,GAAW,IAAI,CAAC;QAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAEjC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBAE7B,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,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ourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { SphericalPolynomial } from \"../../../Maths/sphericalPolynomial\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\nimport type { DDSInfo } from \"../../../Misc/dds\";\r\nimport { DDSTools } from \"../../../Misc/dds\";\r\n\r\nimport \"../../../Engines/Extensions/engine.cubeTexture\";\r\nimport type { Engine } from \"core/Engines/engine\";\r\n\r\n/**\r\n * Implementation of the DDS Texture Loader.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _DDSTextureLoader implements IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n public readonly supportCascades = true;\r\n\r\n /**\r\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\r\n * @param imgs contains the cube maps\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 */\r\n public loadCubeData(imgs: ArrayBufferView | ArrayBufferView[], texture: InternalTexture, createPolynomials: boolean, onLoad: Nullable<(data?: any) => void>): void {\r\n const engine = texture.getEngine() as Engine;\r\n let info: DDSInfo | undefined;\r\n let loadMipmap: boolean = false;\r\n let maxLevel: number = 1000;\r\n if (Array.isArray(imgs)) {\r\n for (let index = 0; index < imgs.length; index++) {\r\n const data = imgs[index];\r\n info = DDSTools.GetDDSInfo(data);\r\n\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n\r\n engine._unpackFlipY(info.isCompressed);\r\n\r\n DDSTools.UploadDDSLevels(engine, texture, data, info, loadMipmap, 6, -1, index);\r\n\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n engine.generateMipMapsForCubemap(texture);\r\n } else {\r\n maxLevel = info.mipmapCount - 1;\r\n }\r\n }\r\n } else {\r\n const data = imgs;\r\n info = DDSTools.GetDDSInfo(data);\r\n\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n\r\n if (createPolynomials) {\r\n info.sphericalPolynomial = new SphericalPolynomial();\r\n }\r\n\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n engine._unpackFlipY(info.isCompressed);\r\n\r\n DDSTools.UploadDDSLevels(engine, texture, data, info, loadMipmap, 6);\r\n\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n // Do not unbind as we still need to set the parameters.\r\n engine.generateMipMapsForCubemap(texture, false);\r\n } else {\r\n maxLevel = info.mipmapCount - 1;\r\n }\r\n }\r\n engine._setCubeMapTextureParams(texture, loadMipmap, maxLevel);\r\n texture.isReady = true;\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad({ isDDS: true, width: texture.width, info, data: imgs, texture });\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) => void\r\n ): void {\r\n const info = DDSTools.GetDDSInfo(data);\r\n\r\n const loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps && Math.max(info.width, info.height) >> (info.mipmapCount - 1) === 1;\r\n callback(info.width, info.height, loadMipmap, info.isFourCC, () => {\r\n DDSTools.UploadDDSLevels(texture.getEngine(), texture, data, info, loadMipmap, 1);\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from "../../../types";
|
|
2
2
|
import type { InternalTexture } from "../../../Materials/Textures/internalTexture";
|
|
3
|
-
import type { IInternalTextureLoader } from "
|
|
3
|
+
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
4
4
|
/**
|
|
5
5
|
* Implementation of the ENV Texture Loader.
|
|
6
6
|
* @internal
|
|
@@ -10,12 +10,6 @@ export declare class _ENVTextureLoader implements IInternalTextureLoader {
|
|
|
10
10
|
* Defines whether the loader supports cascade loading the different faces.
|
|
11
11
|
*/
|
|
12
12
|
readonly supportCascades = false;
|
|
13
|
-
/**
|
|
14
|
-
* This returns if the loader support the current file information.
|
|
15
|
-
* @param extension defines the file extension of the file being loaded
|
|
16
|
-
* @returns true if the loader can load the specified file
|
|
17
|
-
*/
|
|
18
|
-
canLoad(extension: string): boolean;
|
|
19
13
|
/**
|
|
20
14
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
21
15
|
* @param data contains the texture data
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GetEnvInfo, UploadEnvLevelsAsync, UploadEnvSpherical } from "../../../Misc/environmentTextureTools.js";
|
|
2
|
-
import { Engine } from "../../../Engines/engine.js";
|
|
3
2
|
/**
|
|
4
3
|
* Implementation of the ENV Texture Loader.
|
|
5
4
|
* @internal
|
|
@@ -12,14 +11,6 @@ export class _ENVTextureLoader {
|
|
|
12
11
|
*/
|
|
13
12
|
this.supportCascades = false;
|
|
14
13
|
}
|
|
15
|
-
/**
|
|
16
|
-
* This returns if the loader support the current file information.
|
|
17
|
-
* @param extension defines the file extension of the file being loaded
|
|
18
|
-
* @returns true if the loader can load the specified file
|
|
19
|
-
*/
|
|
20
|
-
canLoad(extension) {
|
|
21
|
-
return extension.endsWith(".env");
|
|
22
|
-
}
|
|
23
14
|
/**
|
|
24
15
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
25
16
|
* @param data contains the texture data
|
|
@@ -65,6 +56,4 @@ export class _ENVTextureLoader {
|
|
|
65
56
|
throw ".env not supported in 2d.";
|
|
66
57
|
}
|
|
67
58
|
}
|
|
68
|
-
// Register the loader.
|
|
69
|
-
Engine._TextureLoaders.push(new _ENVTextureLoader());
|
|
70
59
|
//# sourceMappingURL=envTextureLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/envTextureLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"envTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/envTextureLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAK7G;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,iBAAiB;IAA9B;QACI;;WAEG;QACa,oBAAe,GAAG,KAAK,CAAC;IAwD5C,CAAC;IAtDG;;;;;;;OAOG;IACI,YAAY,CACf,IAAyC,EACzC,OAAwB,EACxB,iBAA0B,EAC1B,MAAsC,EACtC,OAA8D;QAE9D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO;SACV;QAED,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAI,EAAE;YACN,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;YAE5B,IAAI;gBACA,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAClC,oBAAoB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAC1C,GAAG,EAAE;oBACD,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;oBACvB,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;oBACpD,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;oBACnC,IAAI,MAAM,EAAE;wBACR,MAAM,EAAE,CAAC;qBACZ;gBACL,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;oBACP,OAAO,EAAE,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;gBAC3D,CAAC,CACJ,CAAC;aACL;YAAC,OAAO,CAAC,EAAE;gBACR,OAAO,EAAE,CAAC,iCAAiC,EAAE,CAAC,CAAC,CAAC;aACnD;SACJ;aAAM,IAAI,OAAO,EAAE;YAChB,OAAO,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;SACvD;IACL,CAAC;IAED;;OAEG;IACI,QAAQ;QACX,4CAA4C;QAC5C,MAAM,2BAA2B,CAAC;IACtC,CAAC;CACJ","sourcesContent":["import { GetEnvInfo, UploadEnvLevelsAsync, UploadEnvSpherical } from \"../../../Misc/environmentTextureTools\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\n\r\n/**\r\n * Implementation of the ENV Texture Loader.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _ENVTextureLoader 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\r\n const info = GetEnvInfo(data);\r\n if (info) {\r\n texture.width = info.width;\r\n texture.height = info.width;\r\n\r\n try {\r\n UploadEnvSpherical(texture, info);\r\n UploadEnvLevelsAsync(texture, data, info).then(\r\n () => {\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 (reason) => {\r\n onError?.(\"Can not upload environment levels\", reason);\r\n }\r\n );\r\n } catch (e) {\r\n onError?.(\"Can not upload environment file\", e);\r\n }\r\n } else if (onError) {\r\n onError(\"Can not parse the environment file\", null);\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 */\r\n public loadData(): void {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \".env not supported in 2d.\";\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Nullable } from "../../../types.js";
|
|
2
|
+
import type { InternalTexture } from "../internalTexture";
|
|
3
|
+
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
4
|
+
/**
|
|
5
|
+
* Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js
|
|
6
|
+
* Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
|
|
7
|
+
* implementation.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Loader for .exr file format
|
|
11
|
+
* #4RN0VF#151: PIZ compression
|
|
12
|
+
* #4RN0VF#146: ZIP compression
|
|
13
|
+
* #4RN0VF#149: RLE compression
|
|
14
|
+
* #4RN0VF#150: PXR24 compression
|
|
15
|
+
*/
|
|
16
|
+
export declare class _ExrTextureLoader implements IInternalTextureLoader {
|
|
17
|
+
/**
|
|
18
|
+
* Defines whether the loader supports cascade loading the different faces.
|
|
19
|
+
*/
|
|
20
|
+
readonly supportCascades = false;
|
|
21
|
+
/**
|
|
22
|
+
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
23
|
+
* @param _data contains the texture data
|
|
24
|
+
* @param _texture defines the BabylonJS internal texture
|
|
25
|
+
* @param _createPolynomials will be true if polynomials have been requested
|
|
26
|
+
* @param _onLoad defines the callback to trigger once the texture is ready
|
|
27
|
+
* @param _onError defines the callback to trigger in case of error
|
|
28
|
+
*/
|
|
29
|
+
loadCubeData(_data: ArrayBufferView | ArrayBufferView[], _texture: InternalTexture, _createPolynomials: boolean, _onLoad: Nullable<(data?: any) => void>, _onError: Nullable<(message?: string, exception?: any) => void>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.
|
|
32
|
+
* @param data contains the texture data
|
|
33
|
+
* @param texture defines the BabylonJS internal texture
|
|
34
|
+
* @param callback defines the method to call once ready to upload
|
|
35
|
+
*/
|
|
36
|
+
loadData(data: ArrayBufferView, texture: InternalTexture, callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, failedLoading?: boolean) => void): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { GetExrHeader } from "./EXR/exrLoader.header.js";
|
|
2
|
+
import { CreateDecoderAsync, ScanData } from "./EXR/exrLoader.decoder.js";
|
|
3
|
+
import { ExrLoaderGlobalConfiguration } from "./EXR/exrLoader.configuration.js";
|
|
4
|
+
/**
|
|
5
|
+
* Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js
|
|
6
|
+
* Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
|
|
7
|
+
* implementation.
|
|
8
|
+
*/
|
|
9
|
+
// /*
|
|
10
|
+
// Copyright (c) 2014 - 2017, Syoyo Fujita
|
|
11
|
+
// All rights reserved.
|
|
12
|
+
// Redistribution and use in source and binary forms, with or without
|
|
13
|
+
// modification, are permitted provided that the following conditions are met:
|
|
14
|
+
// * Redistributions of source code must retain the above copyright
|
|
15
|
+
// notice, this list of conditions and the following disclaimer.
|
|
16
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
17
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
18
|
+
// documentation and/or other materials provided with the distribution.
|
|
19
|
+
// * Neither the name of the Syoyo Fujita nor the
|
|
20
|
+
// names of its contributors may be used to endorse or promote products
|
|
21
|
+
// derived from this software without specific prior written permission.
|
|
22
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
23
|
+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
24
|
+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
25
|
+
// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
26
|
+
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
27
|
+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
28
|
+
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
29
|
+
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
31
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
// */
|
|
33
|
+
// // TinyEXR contains some OpenEXR code, which is licensed under ------------
|
|
34
|
+
// ///////////////////////////////////////////////////////////////////////////
|
|
35
|
+
// //
|
|
36
|
+
// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
|
37
|
+
// // Digital Ltd. LLC
|
|
38
|
+
// //
|
|
39
|
+
// // All rights reserved.
|
|
40
|
+
// //
|
|
41
|
+
// // Redistribution and use in source and binary forms, with or without
|
|
42
|
+
// // modification, are permitted provided that the following conditions are
|
|
43
|
+
// // met:
|
|
44
|
+
// // * Redistributions of source code must retain the above copyright
|
|
45
|
+
// // notice, this list of conditions and the following disclaimer.
|
|
46
|
+
// // * Redistributions in binary form must reproduce the above
|
|
47
|
+
// // copyright notice, this list of conditions and the following disclaimer
|
|
48
|
+
// // in the documentation and/or other materials provided with the
|
|
49
|
+
// // distribution.
|
|
50
|
+
// // * Neither the name of Industrial Light & Magic nor the names of
|
|
51
|
+
// // its contributors may be used to endorse or promote products derived
|
|
52
|
+
// // from this software without specific prior written permission.
|
|
53
|
+
// //
|
|
54
|
+
// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
55
|
+
// // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
56
|
+
// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
57
|
+
// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
58
|
+
// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
59
|
+
// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
60
|
+
// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
61
|
+
// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
62
|
+
// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
63
|
+
// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
64
|
+
// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
65
|
+
// //
|
|
66
|
+
// ///////////////////////////////////////////////////////////////////////////
|
|
67
|
+
// // End of OpenEXR license -------------------------------------------------
|
|
68
|
+
/**
|
|
69
|
+
* Loader for .exr file format
|
|
70
|
+
* #4RN0VF#151: PIZ compression
|
|
71
|
+
* #4RN0VF#146: ZIP compression
|
|
72
|
+
* #4RN0VF#149: RLE compression
|
|
73
|
+
* #4RN0VF#150: PXR24 compression
|
|
74
|
+
*/
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
76
|
+
export class _ExrTextureLoader {
|
|
77
|
+
constructor() {
|
|
78
|
+
/**
|
|
79
|
+
* Defines whether the loader supports cascade loading the different faces.
|
|
80
|
+
*/
|
|
81
|
+
this.supportCascades = false;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
85
|
+
* @param _data contains the texture data
|
|
86
|
+
* @param _texture defines the BabylonJS internal texture
|
|
87
|
+
* @param _createPolynomials will be true if polynomials have been requested
|
|
88
|
+
* @param _onLoad defines the callback to trigger once the texture is ready
|
|
89
|
+
* @param _onError defines the callback to trigger in case of error
|
|
90
|
+
*/
|
|
91
|
+
loadCubeData(_data, _texture, _createPolynomials, _onLoad, _onError) {
|
|
92
|
+
// eslint-disable-next-line no-throw-literal
|
|
93
|
+
throw ".exr not supported in Cube.";
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.
|
|
97
|
+
* @param data contains the texture data
|
|
98
|
+
* @param texture defines the BabylonJS internal texture
|
|
99
|
+
* @param callback defines the method to call once ready to upload
|
|
100
|
+
*/
|
|
101
|
+
async loadData(data, texture, callback) {
|
|
102
|
+
const dataView = new DataView(data.buffer);
|
|
103
|
+
const offset = { value: 0 };
|
|
104
|
+
const header = GetExrHeader(dataView, offset);
|
|
105
|
+
const decoder = await CreateDecoderAsync(header, dataView, offset, ExrLoaderGlobalConfiguration.DefaultOutputType);
|
|
106
|
+
ScanData(decoder, header, dataView, offset);
|
|
107
|
+
// Updating texture
|
|
108
|
+
const width = header.dataWindow.xMax - header.dataWindow.xMin + 1;
|
|
109
|
+
const height = header.dataWindow.yMax - header.dataWindow.yMin + 1;
|
|
110
|
+
callback(width, height, texture.generateMipMaps, false, () => {
|
|
111
|
+
const engine = texture.getEngine();
|
|
112
|
+
texture.format = header.format;
|
|
113
|
+
texture.type = decoder.textureType;
|
|
114
|
+
texture.invertY = false;
|
|
115
|
+
texture._gammaSpace = !header.linearSpace;
|
|
116
|
+
if (decoder.byteArray) {
|
|
117
|
+
engine._uploadDataToTextureDirectly(texture, decoder.byteArray, 0, 0, undefined, true);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=exrTextureLoader.js.map
|
|
@@ -0,0 +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,gFA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,OAAO,EAAE,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;gBACnB,MAAM,CAAC,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;aAC1F;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 */\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,5 +1,5 @@
|
|
|
1
1
|
import type { InternalTexture } from "../../../Materials/Textures/internalTexture";
|
|
2
|
-
import type { IInternalTextureLoader } from "
|
|
2
|
+
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
3
3
|
/**
|
|
4
4
|
* Implementation of the HDR Texture Loader.
|
|
5
5
|
* @internal
|
|
@@ -9,12 +9,6 @@ export declare class _HDRTextureLoader implements IInternalTextureLoader {
|
|
|
9
9
|
* Defines whether the loader supports cascade loading the different faces.
|
|
10
10
|
*/
|
|
11
11
|
readonly supportCascades = false;
|
|
12
|
-
/**
|
|
13
|
-
* This returns if the loader support the current file information.
|
|
14
|
-
* @param extension defines the file extension of the file being loaded
|
|
15
|
-
* @returns true if the loader can load the specified file
|
|
16
|
-
*/
|
|
17
|
-
canLoad(extension: string): boolean;
|
|
18
12
|
/**
|
|
19
13
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
20
14
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RGBE_ReadHeader, RGBE_ReadPixels } from "../../../Misc/HighDynamicRange/hdr.js";
|
|
2
|
-
import { Engine } from "../../../Engines/engine.js";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Implementation of the HDR Texture Loader.
|
|
@@ -13,14 +12,6 @@ export class _HDRTextureLoader {
|
|
|
13
12
|
*/
|
|
14
13
|
this.supportCascades = false;
|
|
15
14
|
}
|
|
16
|
-
/**
|
|
17
|
-
* This returns if the loader support the current file information.
|
|
18
|
-
* @param extension defines the file extension of the file being loaded
|
|
19
|
-
* @returns true if the loader can load the specified file
|
|
20
|
-
*/
|
|
21
|
-
canLoad(extension) {
|
|
22
|
-
return extension.endsWith(".hdr");
|
|
23
|
-
}
|
|
24
15
|
/**
|
|
25
16
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
26
17
|
*/
|
|
@@ -55,6 +46,4 @@ export class _HDRTextureLoader {
|
|
|
55
46
|
});
|
|
56
47
|
}
|
|
57
48
|
}
|
|
58
|
-
// Register the loader.
|
|
59
|
-
Engine._TextureLoaders.push(new _HDRTextureLoader());
|
|
60
49
|
//# sourceMappingURL=hdrTextureLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hdrTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/hdrTextureLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"hdrTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/hdrTextureLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGtF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,iBAAiB;IAA9B;QACI;;WAEG;QACa,oBAAe,GAAG,KAAK,CAAC;IA0C5C,CAAC;IAxCG;;OAEG;IACI,YAAY;QACf,4CAA4C;QAC5C,MAAM,6BAA6B,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CACX,IAAqB,EACrB,OAAwB,EACxB,QAA+G;QAE/G,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACjF,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE7D,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9C,MAAM,gBAAgB,GAAG,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAChC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,gBAAgB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACzD,gBAAgB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACzD,gBAAgB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;SACnC;QAED,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE;YACzE,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,iBAAiB,CAAC;YAC3C,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,kBAAkB,CAAC;YAC9C,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;YAC5B,MAAM,CAAC,4BAA4B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { RGBE_ReadHeader, RGBE_ReadPixels } from \"../../../Misc/HighDynamicRange/hdr\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IInternalTextureLoader } from \"./internalTextureLoader\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\n\r\n/**\r\n * Implementation of the HDR Texture Loader.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _HDRTextureLoader 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 */\r\n public loadCubeData(): void {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \".env 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 loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void) => void\r\n ): void {\r\n const uint8array = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\r\n const hdrInfo = RGBE_ReadHeader(uint8array);\r\n const pixelsDataRGB32 = RGBE_ReadPixels(uint8array, hdrInfo);\r\n\r\n const pixels = hdrInfo.width * hdrInfo.height;\r\n const pixelsDataRGBA32 = new Float32Array(pixels * 4);\r\n for (let i = 0; i < pixels; i += 1) {\r\n pixelsDataRGBA32[i * 4] = pixelsDataRGB32[i * 3];\r\n pixelsDataRGBA32[i * 4 + 1] = pixelsDataRGB32[i * 3 + 1];\r\n pixelsDataRGBA32[i * 4 + 2] = pixelsDataRGB32[i * 3 + 2];\r\n pixelsDataRGBA32[i * 4 + 3] = 1;\r\n }\r\n\r\n callback(hdrInfo.width, hdrInfo.height, texture.generateMipMaps, false, () => {\r\n const engine = texture.getEngine();\r\n texture.type = Constants.TEXTURETYPE_FLOAT;\r\n texture.format = Constants.TEXTUREFORMAT_RGBA;\r\n texture._gammaSpace = false;\r\n engine._uploadDataToTextureDirectly(texture, pixelsDataRGBA32);\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export * from "./internalTextureLoader";
|
|
1
2
|
export * from "./ddsTextureLoader";
|
|
2
3
|
export * from "./envTextureLoader";
|
|
3
4
|
export * from "./ktxTextureLoader";
|
|
4
5
|
export * from "./tgaTextureLoader";
|
|
5
6
|
export * from "./hdrTextureLoader";
|
|
6
7
|
export * from "./basisTextureLoader";
|
|
8
|
+
export * from "./exrTextureLoader";
|
|
9
|
+
export * from "./textureLoaderManager";
|
|
10
|
+
export * from "./EXR/index";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
export * from "./internalTextureLoader.js";
|
|
1
2
|
export * from "./ddsTextureLoader.js";
|
|
2
3
|
export * from "./envTextureLoader.js";
|
|
3
4
|
export * from "./ktxTextureLoader.js";
|
|
4
5
|
export * from "./tgaTextureLoader.js";
|
|
5
6
|
export * from "./hdrTextureLoader.js";
|
|
6
7
|
export * from "./basisTextureLoader.js";
|
|
8
|
+
export * from "./exrTextureLoader.js";
|
|
9
|
+
export * from "./textureLoaderManager.js";
|
|
10
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
11
|
+
export * from "./EXR/index.js";
|
|
7
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC","sourcesContent":["export * from \"./ddsTextureLoader\";\r\nexport * from \"./envTextureLoader\";\r\nexport * from \"./ktxTextureLoader\";\r\nexport * from \"./tgaTextureLoader\";\r\nexport * from \"./hdrTextureLoader\";\r\nexport * from \"./basisTextureLoader\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,sDAAsD;AACtD,cAAc,aAAa,CAAC","sourcesContent":["export * from \"./internalTextureLoader\";\r\nexport * from \"./ddsTextureLoader\";\r\nexport * from \"./envTextureLoader\";\r\nexport * from \"./ktxTextureLoader\";\r\nexport * from \"./tgaTextureLoader\";\r\nexport * from \"./hdrTextureLoader\";\r\nexport * from \"./basisTextureLoader\";\r\nexport * from \"./exrTextureLoader\";\r\nexport * from \"./textureLoaderManager\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./EXR/index\";\r\n"]}
|
package/Materials/Textures/{internalTextureLoader.d.ts → Loaders/internalTextureLoader.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Nullable } from "
|
|
2
|
-
import type { InternalTexture } from "
|
|
1
|
+
import type { Nullable } from "../../../types";
|
|
2
|
+
import type { InternalTexture } from "../internalTexture";
|
|
3
3
|
/**
|
|
4
4
|
* This represents the required contract to create a new type of texture loader.
|
|
5
5
|
*/
|
|
@@ -8,13 +8,6 @@ export interface IInternalTextureLoader {
|
|
|
8
8
|
* Defines whether the loader supports cascade loading the different faces.
|
|
9
9
|
*/
|
|
10
10
|
supportCascades: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* This returns if the loader support the current file information.
|
|
13
|
-
* @param extension defines the file extension of the file being loaded
|
|
14
|
-
* @param mimeType defines the optional mime type of the file being loaded
|
|
15
|
-
* @returns true if the loader can load the specified file
|
|
16
|
-
*/
|
|
17
|
-
canLoad(extension: string, mimeType?: string): boolean;
|
|
18
11
|
/**
|
|
19
12
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
20
13
|
* @param data contains the texture data
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/internalTextureLoader.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport type { InternalTexture } from \"../internalTexture\";\r\n\r\n/**\r\n * This represents the required contract to create a new type of texture loader.\r\n */\r\nexport interface IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n supportCascades: boolean;\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 * @param options options to be passed to the loader\r\n */\r\n 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 options?: any\r\n ): void;\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 * @param options options to be passed to the loader\r\n */\r\n loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, loadFailed?: boolean) => void,\r\n options?: any\r\n ): void;\r\n}\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from "../../../types";
|
|
2
2
|
import type { InternalTexture } from "../../../Materials/Textures/internalTexture";
|
|
3
|
-
import type { IInternalTextureLoader } from "
|
|
3
|
+
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
4
4
|
import "../../../Engines/Extensions/engine.cubeTexture";
|
|
5
5
|
/**
|
|
6
6
|
* Implementation of the KTX Texture Loader.
|
|
@@ -11,13 +11,6 @@ export declare class _KTXTextureLoader implements IInternalTextureLoader {
|
|
|
11
11
|
* Defines whether the loader supports cascade loading the different faces.
|
|
12
12
|
*/
|
|
13
13
|
readonly supportCascades = false;
|
|
14
|
-
/**
|
|
15
|
-
* This returns if the loader support the current file information.
|
|
16
|
-
* @param extension defines the file extension of the file being loaded
|
|
17
|
-
* @param mimeType defines the optional mime type of the file being loaded
|
|
18
|
-
* @returns true if the loader can load the specified file
|
|
19
|
-
*/
|
|
20
|
-
canLoad(extension: string, mimeType?: string): boolean;
|
|
21
14
|
/**
|
|
22
15
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
23
16
|
* @param data contains the texture data
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { KhronosTextureContainer } from "../../../Misc/khronosTextureContainer.js";
|
|
2
2
|
import { KhronosTextureContainer2 } from "../../../Misc/khronosTextureContainer2.js";
|
|
3
|
-
import { Engine } from "../../../Engines/engine.js";
|
|
4
3
|
import { Logger } from "../../../Misc/logger.js";
|
|
5
4
|
|
|
6
5
|
import "../../../Engines/Extensions/engine.cubeTexture.js";
|
|
@@ -37,16 +36,6 @@ export class _KTXTextureLoader {
|
|
|
37
36
|
*/
|
|
38
37
|
this.supportCascades = false;
|
|
39
38
|
}
|
|
40
|
-
/**
|
|
41
|
-
* This returns if the loader support the current file information.
|
|
42
|
-
* @param extension defines the file extension of the file being loaded
|
|
43
|
-
* @param mimeType defines the optional mime type of the file being loaded
|
|
44
|
-
* @returns true if the loader can load the specified file
|
|
45
|
-
*/
|
|
46
|
-
canLoad(extension, mimeType) {
|
|
47
|
-
// The ".ktx2" file extension is still up for debate: https://github.com/KhronosGroup/KTX-Specification/issues/18
|
|
48
|
-
return extension.endsWith(".ktx") || extension.endsWith(".ktx2") || mimeType === "image/ktx" || mimeType === "image/ktx2";
|
|
49
|
-
}
|
|
50
39
|
/**
|
|
51
40
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
52
41
|
* @param data contains the texture data
|
|
@@ -115,6 +104,4 @@ export class _KTXTextureLoader {
|
|
|
115
104
|
}
|
|
116
105
|
}
|
|
117
106
|
}
|
|
118
|
-
// Register the loader.
|
|
119
|
-
Engine._TextureLoaders.push(new _KTXTextureLoader());
|
|
120
107
|
//# sourceMappingURL=ktxTextureLoader.js.map
|