@babylonjs/loaders 9.22.2 → 9.24.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/OBJ/objFileLoader.metadata.d.ts +5 -1
- package/OBJ/objFileLoader.metadata.js +4 -1
- package/OBJ/objFileLoader.metadata.js.map +1 -1
- package/OBJ/objFileLoader.pure.d.ts +12 -3
- package/OBJ/objFileLoader.pure.js +30 -2
- package/OBJ/objFileLoader.pure.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +6 -0
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/SPLAT/gaussianSplattingStream.d.ts +162 -15
- package/SPLAT/gaussianSplattingStream.js +523 -96
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/dynamic.js +16 -6
- package/dynamic.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +4 -14
- package/glTF/1.0/glTFBinaryExtension.js +6 -62
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.pure.d.ts +21 -0
- package/glTF/1.0/glTFBinaryExtension.pure.js +76 -0
- package/glTF/1.0/glTFBinaryExtension.pure.js.map +1 -0
- package/glTF/1.0/glTFLoader.d.ts +3 -142
- package/glTF/1.0/glTFLoader.js +7 -1840
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoader.pure.d.ts +149 -0
- package/glTF/1.0/glTFLoader.pure.js +1854 -0
- package/glTF/1.0/glTFLoader.pure.js.map +1 -0
- package/glTF/1.0/glTFLoaderUtils.d.ts +2 -2
- package/glTF/1.0/glTFLoaderUtils.js +5 -5
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +4 -11
- package/glTF/1.0/glTFMaterialsCommonExtension.js +6 -128
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.pure.d.ts +18 -0
- package/glTF/1.0/glTFMaterialsCommonExtension.pure.js +142 -0
- package/glTF/1.0/glTFMaterialsCommonExtension.pure.js.map +1 -0
- package/glTF/1.0/pure.d.ts +3 -0
- package/glTF/1.0/pure.js +3 -0
- package/glTF/1.0/pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +0 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.d.ts +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js +3 -251
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.pure.js +267 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.js +2 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +15 -4
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +19 -6
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +19 -6
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js +19 -6
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js.map +1 -1
- package/glTF/2.0/Extensions/dynamic.js +59 -42
- package/glTF/2.0/Extensions/dynamic.js.map +1 -1
- package/glTF/2.0/Extensions/pure.d.ts +1 -0
- package/glTF/2.0/Extensions/pure.js +1 -0
- package/glTF/2.0/Extensions/pure.js.map +1 -1
- package/glTF/2.0/glTFLoader.pure.d.ts +2 -2
- package/glTF/2.0/glTFLoader.pure.js +6 -5
- package/glTF/2.0/glTFLoader.pure.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.d.ts +1 -42
- package/glTF/2.0/glTFLoaderAnimation.js +3 -79
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.pure.d.ts +47 -0
- package/glTF/2.0/glTFLoaderAnimation.pure.js +91 -0
- package/glTF/2.0/glTFLoaderAnimation.pure.js.map +1 -0
- package/glTF/2.0/pure.d.ts +1 -0
- package/glTF/2.0/pure.js +1 -0
- package/glTF/2.0/pure.js.map +1 -1
- package/glTF/glTFFileLoader.pure.d.ts +8 -4
- package/glTF/glTFFileLoader.pure.js +13 -6
- package/glTF/glTFFileLoader.pure.js.map +1 -1
- package/package.json +3 -4
- /package/{bvh → BVH}/license.md +0 -0
package/dynamic.js
CHANGED
|
@@ -16,7 +16,7 @@ export function registerBuiltInLoaders() {
|
|
|
16
16
|
RegisterSceneLoaderPlugin({
|
|
17
17
|
...BVHFileLoaderMetadata,
|
|
18
18
|
createPlugin: async (options) => {
|
|
19
|
-
const { BVHFileLoader } = await import("./BVH/bvhFileLoader.js");
|
|
19
|
+
const { BVHFileLoader } = await import("./BVH/bvhFileLoader.pure.js");
|
|
20
20
|
return new BVHFileLoader(options[BVHFileLoaderMetadata.name]);
|
|
21
21
|
},
|
|
22
22
|
});
|
|
@@ -24,7 +24,7 @@ export function registerBuiltInLoaders() {
|
|
|
24
24
|
RegisterSceneLoaderPlugin({
|
|
25
25
|
...FBXFileLoaderMetadata,
|
|
26
26
|
createPlugin: async (options) => {
|
|
27
|
-
const { FBXFileLoader } = await import("./FBX/fbxFileLoader.js");
|
|
27
|
+
const { FBXFileLoader } = await import("./FBX/fbxFileLoader.pure.js");
|
|
28
28
|
return new FBXFileLoader(options[FBXFileLoaderMetadata.name]);
|
|
29
29
|
},
|
|
30
30
|
});
|
|
@@ -32,7 +32,12 @@ export function registerBuiltInLoaders() {
|
|
|
32
32
|
RegisterSceneLoaderPlugin({
|
|
33
33
|
...GLTFFileLoaderMetadata,
|
|
34
34
|
createPlugin: async (options) => {
|
|
35
|
-
const { GLTFFileLoader } = await
|
|
35
|
+
const [{ GLTFFileLoader, RegisterGLTF2Loader }, { RegisterInstancedMesh }] = await Promise.all([
|
|
36
|
+
import("./glTF/2.0/glTFLoader.pure.js"),
|
|
37
|
+
import("@babylonjs/core/Meshes/instancedMesh.pure.js"),
|
|
38
|
+
]);
|
|
39
|
+
RegisterInstancedMesh();
|
|
40
|
+
RegisterGLTF2Loader();
|
|
36
41
|
return new GLTFFileLoader(options[GLTFFileLoaderMetadata.name]);
|
|
37
42
|
},
|
|
38
43
|
});
|
|
@@ -42,7 +47,7 @@ export function registerBuiltInLoaders() {
|
|
|
42
47
|
RegisterSceneLoaderPlugin({
|
|
43
48
|
...OBJFileLoaderMetadata,
|
|
44
49
|
createPlugin: async (options) => {
|
|
45
|
-
const { OBJFileLoader } = await import("./OBJ/objFileLoader.js");
|
|
50
|
+
const { OBJFileLoader } = await import("./OBJ/objFileLoader.pure.js");
|
|
46
51
|
return new OBJFileLoader(options[OBJFileLoaderMetadata.name]);
|
|
47
52
|
},
|
|
48
53
|
});
|
|
@@ -50,7 +55,11 @@ export function registerBuiltInLoaders() {
|
|
|
50
55
|
RegisterSceneLoaderPlugin({
|
|
51
56
|
...SPLATFileLoaderMetadata,
|
|
52
57
|
createPlugin: async (options) => {
|
|
53
|
-
const { SPLATFileLoader } = await
|
|
58
|
+
const [{ SPLATFileLoader }, { RegisterEnginesExtensionsEngineDynamicTexture }] = await Promise.all([
|
|
59
|
+
import("./SPLAT/splatFileLoader.pure.js"),
|
|
60
|
+
import("@babylonjs/core/Engines/Extensions/engine.dynamicTexture.pure.js"),
|
|
61
|
+
]);
|
|
62
|
+
RegisterEnginesExtensionsEngineDynamicTexture();
|
|
54
63
|
return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);
|
|
55
64
|
},
|
|
56
65
|
});
|
|
@@ -58,7 +67,8 @@ export function registerBuiltInLoaders() {
|
|
|
58
67
|
RegisterSceneLoaderPlugin({
|
|
59
68
|
...STLFileLoaderMetadata,
|
|
60
69
|
createPlugin: async () => {
|
|
61
|
-
const { STLFileLoader } = await import("./STL/stlFileLoader.js");
|
|
70
|
+
const [{ STLFileLoader }, { RegisterStandardMaterial }] = await Promise.all([import("./STL/stlFileLoader.pure.js"), import("@babylonjs/core/Materials/standardMaterial.pure.js")]);
|
|
71
|
+
RegisterStandardMaterial();
|
|
62
72
|
return new STLFileLoader();
|
|
63
73
|
},
|
|
64
74
|
});
|
package/dynamic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../../dev/loaders/src/dynamic.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAiE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAEpI,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAE9E;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IAClC,2BAA2B;IAC3B,yBAAyB,CAAC;QACtB,GAAG,qBAAqB;QACxB,YAAY,EAAE,KAAK,EAAE,OAAiC,EAAE,EAAE;YACtD,MAAM,EAAE,aAAa,EAA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C;QACtB,GAAG,qBAAqB;QACxB,YAAY,EAAE,KAAK,IAAI,EAAE;YACrB,MAAM,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,wBAAwB,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC,CAAC;YAClK,wBAAwB,EAAE,CAAC;YAC3B,OAAO,IAAI,aAAa,EAAE,CAAC;QAC/B,CAAC;KACgC,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { type ISceneLoaderPluginFactory, type SceneLoaderPluginOptions, RegisterSceneLoaderPlugin } from \"core/Loading/sceneLoader\";\r\n\r\nimport { BVHFileLoaderMetadata } from \"./BVH/bvhFileLoader.metadata\";\r\nimport { FBXFileLoaderMetadata } from \"./FBX/fbxFileLoader.metadata\";\r\nimport { GLTFFileLoaderMetadata } from \"./glTF/glTFFileLoader.metadata\";\r\nimport { OBJFileLoaderMetadata } from \"./OBJ/objFileLoader.metadata\";\r\nimport { SPLATFileLoaderMetadata } from \"./SPLAT/splatFileLoader.metadata\";\r\nimport { STLFileLoaderMetadata } from \"./STL/stlFileLoader.metadata\";\r\n\r\nimport { registerBuiltInGLTFExtensions } from \"./glTF/2.0/Extensions/dynamic\";\r\n\r\n/**\r\n * Registers the async plugin factories for all built-in loaders.\r\n * Loaders will be dynamically imported on demand, only when a SceneLoader load operation needs each respective loader.\r\n */\r\nexport function registerBuiltInLoaders() {\r\n // Register the BVH loader.\r\n RegisterSceneLoaderPlugin({\r\n ...BVHFileLoaderMetadata,\r\n createPlugin: async (options: SceneLoaderPluginOptions) => {\r\n const { BVHFileLoader } = await import(\"./BVH/bvhFileLoader.pure\");\r\n return new BVHFileLoader(options[BVHFileLoaderMetadata.name]);\r\n },\r\n } satisfies ISceneLoaderPluginFactory);\r\n\r\n // Register the FBX loader.\r\n RegisterSceneLoaderPlugin({\r\n ...FBXFileLoaderMetadata,\r\n createPlugin: async (options: SceneLoaderPluginOptions) => {\r\n const { FBXFileLoader } = await import(\"./FBX/fbxFileLoader.pure\");\r\n return new FBXFileLoader(options[FBXFileLoaderMetadata.name]);\r\n },\r\n } satisfies ISceneLoaderPluginFactory);\r\n\r\n // Register the glTF loader (2.0) specifically/only.\r\n RegisterSceneLoaderPlugin({\r\n ...GLTFFileLoaderMetadata,\r\n createPlugin: async (options: SceneLoaderPluginOptions) => {\r\n const [{ GLTFFileLoader, RegisterGLTF2Loader }, { RegisterInstancedMesh }] = await Promise.all([\r\n import(\"./glTF/2.0/glTFLoader.pure\"),\r\n import(\"core/Meshes/instancedMesh.pure\"),\r\n ]);\r\n RegisterInstancedMesh();\r\n RegisterGLTF2Loader();\r\n return new GLTFFileLoader(options[GLTFFileLoaderMetadata.name]);\r\n },\r\n } satisfies ISceneLoaderPluginFactory);\r\n\r\n // Register the built-in glTF (2.0) extensions.\r\n registerBuiltInGLTFExtensions();\r\n\r\n // Register the OBJ loader.\r\n RegisterSceneLoaderPlugin({\r\n ...OBJFileLoaderMetadata,\r\n createPlugin: async (options: SceneLoaderPluginOptions) => {\r\n const { OBJFileLoader } = await import(\"./OBJ/objFileLoader.pure\");\r\n return new OBJFileLoader(options[OBJFileLoaderMetadata.name]);\r\n },\r\n } satisfies ISceneLoaderPluginFactory);\r\n\r\n // Register the SPLAT loader.\r\n RegisterSceneLoaderPlugin({\r\n ...SPLATFileLoaderMetadata,\r\n createPlugin: async (options: SceneLoaderPluginOptions) => {\r\n const [{ SPLATFileLoader }, { RegisterEnginesExtensionsEngineDynamicTexture }] = await Promise.all([\r\n import(\"./SPLAT/splatFileLoader.pure\"),\r\n import(\"core/Engines/Extensions/engine.dynamicTexture.pure\"),\r\n ]);\r\n RegisterEnginesExtensionsEngineDynamicTexture();\r\n return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);\r\n },\r\n } satisfies ISceneLoaderPluginFactory);\r\n\r\n // Register the STL loader.\r\n RegisterSceneLoaderPlugin({\r\n ...STLFileLoaderMetadata,\r\n createPlugin: async () => {\r\n const [{ STLFileLoader }, { RegisterStandardMaterial }] = await Promise.all([import(\"./STL/stlFileLoader.pure\"), import(\"core/Materials/standardMaterial.pure\")]);\r\n RegisterStandardMaterial();\r\n return new STLFileLoader();\r\n },\r\n } satisfies ISceneLoaderPluginFactory);\r\n}\r\n"]}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { GLTFLoaderExtension } from "./glTFLoader.js";
|
|
2
|
-
import { type Scene } from "@babylonjs/core/scene.js";
|
|
3
|
-
import { type IGLTFLoaderData } from "../glTFFileLoader.js";
|
|
4
|
-
import { type IGLTFRuntime } from "./glTFLoaderInterfaces.js";
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./glTFBinaryExtension.pure" for tree-shakeable, side-effect-free usage.
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
constructor();
|
|
12
|
-
loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void): boolean;
|
|
13
|
-
loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
|
|
14
|
-
loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void): boolean;
|
|
15
|
-
loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void): boolean;
|
|
16
|
-
}
|
|
5
|
+
export * from "./glTFBinaryExtension.pure.js";
|
|
6
|
+
import "./glTFLoader.js";
|
|
@@ -1,65 +1,9 @@
|
|
|
1
|
-
import { GLTFLoaderExtension, GLTFLoader, GLTFLoaderBase } from "./glTFLoader.js";
|
|
2
|
-
import { GLTFUtils } from "./glTFLoaderUtils.js";
|
|
3
|
-
import { EComponentType } from "./glTFLoaderInterfaces.js";
|
|
4
|
-
const BinaryExtensionBufferName = "binary_glTF";
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./glTFBinaryExtension.pure" for tree-shakeable, side-effect-free usage.
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
14
|
-
loadRuntimeAsync(scene, data, rootUrl, onSuccess) {
|
|
15
|
-
const extensionsUsed = data.json.extensionsUsed;
|
|
16
|
-
if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
this._bin = data.bin;
|
|
20
|
-
onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
24
|
-
loadBufferAsync(gltfRuntime, id, onSuccess, onError) {
|
|
25
|
-
if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
if (id !== BinaryExtensionBufferName) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
// eslint-disable-next-line github/no-then
|
|
32
|
-
this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
36
|
-
loadTextureBufferAsync(gltfRuntime, id, onSuccess) {
|
|
37
|
-
const texture = gltfRuntime.textures[id];
|
|
38
|
-
const source = gltfRuntime.images[texture.source];
|
|
39
|
-
if (!source.extensions || !(this.name in source.extensions)) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const sourceExt = source.extensions[this.name];
|
|
43
|
-
const bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];
|
|
44
|
-
const buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
|
|
45
|
-
onSuccess(buffer);
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
49
|
-
loadShaderStringAsync(gltfRuntime, id, onSuccess) {
|
|
50
|
-
const shader = gltfRuntime.shaders[id];
|
|
51
|
-
if (!shader.extensions || !(this.name in shader.extensions)) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
const binaryExtensionShader = shader.extensions[this.name];
|
|
55
|
-
const bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];
|
|
56
|
-
const shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
const shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);
|
|
59
|
-
onSuccess(shaderString);
|
|
60
|
-
});
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
GLTFLoader.RegisterExtension(new GLTFBinaryExtension());
|
|
5
|
+
export * from "./glTFBinaryExtension.pure.js";
|
|
6
|
+
import "./glTFLoader.js";
|
|
7
|
+
import { RegisterGLTFBinaryExtension } from "./glTFBinaryExtension.pure.js";
|
|
8
|
+
RegisterGLTFBinaryExtension();
|
|
65
9
|
//# sourceMappingURL=glTFBinaryExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTFBinaryExtension.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFBinaryExtension.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"glTFBinaryExtension.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFBinaryExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,4BAA4B,CAAC;AAE3C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,2BAA2B,EAAE,CAAC","sourcesContent":["/**\n * Re-exports the pure implementation and applies the runtime registration side effect.\n * Import \"./glTFBinaryExtension.pure\" for tree-shakeable, side-effect-free usage.\n */\nexport * from \"./glTFBinaryExtension.pure\";\n\nimport \"./glTFLoader\";\nimport { RegisterGLTFBinaryExtension } from \"./glTFBinaryExtension.pure\";\nRegisterGLTFBinaryExtension();\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GLTFLoaderExtension } from "./glTFLoader.pure.js";
|
|
2
|
+
import { type Scene } from "@babylonjs/core/scene.pure.js";
|
|
3
|
+
import { type IGLTFLoaderData } from "../glTFFileLoader.pure.js";
|
|
4
|
+
import { type IGLTFRuntime } from "./glTFLoaderInterfaces.js";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
9
|
+
export declare class GLTFBinaryExtension extends GLTFLoaderExtension {
|
|
10
|
+
private _bin;
|
|
11
|
+
constructor();
|
|
12
|
+
loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void): boolean;
|
|
13
|
+
loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
|
|
14
|
+
loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void): boolean;
|
|
15
|
+
loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void): boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Registers the KHR_binary_glTF extension.
|
|
19
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
20
|
+
*/
|
|
21
|
+
export declare function RegisterGLTFBinaryExtension(): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GLTFLoaderExtension, GLTFLoader, GLTFLoaderBase } from "./glTFLoader.pure.js";
|
|
2
|
+
import { GLTFUtils } from "./glTFLoaderUtils.js";
|
|
3
|
+
import { EComponentType } from "./glTFLoaderInterfaces.js";
|
|
4
|
+
const BinaryExtensionBufferName = "binary_glTF";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
9
|
+
export class GLTFBinaryExtension extends GLTFLoaderExtension {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("KHR_binary_glTF");
|
|
12
|
+
}
|
|
13
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
14
|
+
loadRuntimeAsync(scene, data, rootUrl, onSuccess) {
|
|
15
|
+
const extensionsUsed = data.json.extensionsUsed;
|
|
16
|
+
if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
this._bin = data.bin;
|
|
20
|
+
onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
24
|
+
loadBufferAsync(gltfRuntime, id, onSuccess, onError) {
|
|
25
|
+
if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (id !== BinaryExtensionBufferName) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line github/no-then
|
|
32
|
+
this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
36
|
+
loadTextureBufferAsync(gltfRuntime, id, onSuccess) {
|
|
37
|
+
const texture = gltfRuntime.textures[id];
|
|
38
|
+
const source = gltfRuntime.images[texture.source];
|
|
39
|
+
if (!source.extensions || !(this.name in source.extensions)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const sourceExt = source.extensions[this.name];
|
|
43
|
+
const bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];
|
|
44
|
+
const buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
|
|
45
|
+
onSuccess(buffer);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
49
|
+
loadShaderStringAsync(gltfRuntime, id, onSuccess) {
|
|
50
|
+
const shader = gltfRuntime.shaders[id];
|
|
51
|
+
if (!shader.extensions || !(this.name in shader.extensions)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const binaryExtensionShader = shader.extensions[this.name];
|
|
55
|
+
const bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];
|
|
56
|
+
const shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
const shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);
|
|
59
|
+
onSuccess(shaderString);
|
|
60
|
+
});
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
let _Registered = false;
|
|
65
|
+
/**
|
|
66
|
+
* Registers the KHR_binary_glTF extension.
|
|
67
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
68
|
+
*/
|
|
69
|
+
export function RegisterGLTFBinaryExtension() {
|
|
70
|
+
if (_Registered) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
_Registered = true;
|
|
74
|
+
GLTFLoader.RegisterExtension(new GLTFBinaryExtension());
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=glTFBinaryExtension.pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glTFBinaryExtension.pure.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFBinaryExtension.pure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAAiG,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAIvJ,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAahD;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,mBAAmB;IAGxD;QACI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC7B,CAAC;IAED,gDAAgD;IAChC,gBAAgB,CAAC,KAAY,EAAE,IAAqB,EAAE,OAAe,EAAE,SAA8C;QACjI,MAAM,cAAc,GAAS,IAAI,CAAC,IAAK,CAAC,cAAc,CAAC;QACvD,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3E,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gDAAgD;IAChC,eAAe,CAAC,WAAyB,EAAE,EAAU,EAAE,SAA4C,EAAE,OAAkC;QACnJ,IAAI,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAA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CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,MAAM,qBAAqB,GAA+B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,UAAU,GAAoB,WAAW,CAAC,WAAW,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC9F,MAAM,WAAW,GAAG,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;QAEvI,UAAU,CAAC,GAAG,EAAE;YACZ,MAAM,YAAY,GAAG,SAAS,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC/D,SAAS,CAAC,YAAY,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,UAAU,2BAA2B;IACvC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,UAAU,CAAC,iBAAiB,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import { GLTFLoaderExtension, GLTFLoader, GLTFLoaderBase } from \"./glTFLoader.pure\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport { type Scene } from \"core/scene.pure\";\r\nimport { type IGLTFLoaderData } from \"../glTFFileLoader.pure\";\r\nimport { type IGLTFRuntime, type IGLTFTexture, type IGLTFImage, type IGLTFBufferView, type IGLTFShader, EComponentType } from \"./glTFLoaderInterfaces\";\r\n\r\nimport { type IDataBuffer } from \"core/Misc/dataReader\";\r\n\r\nconst BinaryExtensionBufferName = \"binary_glTF\";\r\n\r\ninterface IGLTFBinaryExtensionShader {\r\n bufferView: string;\r\n}\r\n\r\ninterface IGLTFBinaryExtensionImage {\r\n bufferView: string;\r\n mimeType: string;\r\n height: number;\r\n width: number;\r\n}\r\n\r\n/**\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFBinaryExtension extends GLTFLoaderExtension {\r\n private _bin: IDataBuffer;\r\n\r\n public constructor() {\r\n super(\"KHR_binary_glTF\");\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n public override loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void): boolean {\r\n const extensionsUsed = (<any>data.json).extensionsUsed;\r\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\r\n return false;\r\n }\r\n\r\n this._bin = data.bin;\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n return true;\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n public override loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\r\n return false;\r\n }\r\n\r\n if (id !== BinaryExtensionBufferName) {\r\n return false;\r\n }\r\n\r\n // eslint-disable-next-line github/no-then\r\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));\r\n return true;\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n public override loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void): boolean {\r\n const texture: IGLTFTexture = gltfRuntime.textures[id];\r\n const source: IGLTFImage = gltfRuntime.images[texture.source];\r\n if (!source.extensions || !(this.name in source.extensions)) {\r\n return false;\r\n }\r\n\r\n const sourceExt: IGLTFBinaryExtensionImage = source.extensions[this.name];\r\n const bufferView: IGLTFBufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\r\n const buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n onSuccess(buffer);\r\n return true;\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n public override loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void): boolean {\r\n const shader: IGLTFShader = gltfRuntime.shaders[id];\r\n if (!shader.extensions || !(this.name in shader.extensions)) {\r\n return false;\r\n }\r\n\r\n const binaryExtensionShader: IGLTFBinaryExtensionShader = shader.extensions[this.name];\r\n const bufferView: IGLTFBufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\r\n const shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n\r\n setTimeout(() => {\r\n const shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\r\n onSuccess(shaderString);\r\n });\r\n\r\n return true;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n\r\n/**\r\n * Registers the KHR_binary_glTF extension.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterGLTFBinaryExtension(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n GLTFLoader.RegisterExtension(new GLTFBinaryExtension());\r\n}\r\n"]}
|
package/glTF/1.0/glTFLoader.d.ts
CHANGED
|
@@ -1,144 +1,5 @@
|
|
|
1
|
-
import { type IGLTFRuntime } from "./glTFLoaderInterfaces.js";
|
|
2
|
-
import { type Nullable } from "@babylonjs/core/types.js";
|
|
3
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
|
4
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
5
|
-
import { type ISceneLoaderAsyncResult, type ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
|
|
6
|
-
import { type Scene } from "@babylonjs/core/scene.js";
|
|
7
|
-
import { type IGLTFLoader, type IGLTFLoaderData } from "../glTFFileLoader.js";
|
|
8
|
-
import { type AssetContainer } from "@babylonjs/core/assetContainer.js";
|
|
9
1
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./glTFLoader.pure" for tree-shakeable, side-effect-free usage.
|
|
12
4
|
*/
|
|
13
|
-
export
|
|
14
|
-
static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
|
|
15
|
-
static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
|
|
16
|
-
static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
|
|
17
|
-
static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void): void;
|
|
18
|
-
static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
|
|
19
|
-
static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* glTF V1 Loader
|
|
23
|
-
* @internal
|
|
24
|
-
* @deprecated
|
|
25
|
-
*/
|
|
26
|
-
export declare class GLTFLoader implements IGLTFLoader {
|
|
27
|
-
static Extensions: {
|
|
28
|
-
[name: string]: GLTFLoaderExtension;
|
|
29
|
-
};
|
|
30
|
-
static RegisterExtension(extension: GLTFLoaderExtension): void;
|
|
31
|
-
dispose(): void;
|
|
32
|
-
private _importMeshAsync;
|
|
33
|
-
/**
|
|
34
|
-
* Imports one or more meshes from a loaded gltf file and adds them to the scene
|
|
35
|
-
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
|
36
|
-
* @param scene the scene the meshes should be added to
|
|
37
|
-
* @param assetContainer defines the asset container to use (can be null)
|
|
38
|
-
* @param data gltf data containing information of the meshes in a loaded file
|
|
39
|
-
* @param rootUrl root url to load from
|
|
40
|
-
* @param onProgress event that fires when loading progress has occured
|
|
41
|
-
* @returns a promise containg the loaded meshes, particles, skeletons and animations
|
|
42
|
-
*/
|
|
43
|
-
importMeshAsync(meshesNames: any, scene: Scene, assetContainer: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<ISceneLoaderAsyncResult>;
|
|
44
|
-
private _loadAsync;
|
|
45
|
-
/**
|
|
46
|
-
* Imports all objects from a loaded gltf file and adds them to the scene
|
|
47
|
-
* @param scene the scene the objects should be added to
|
|
48
|
-
* @param data gltf data containing information of the meshes in a loaded file
|
|
49
|
-
* @param rootUrl root url to load from
|
|
50
|
-
* @param onProgress event that fires when loading progress has occured
|
|
51
|
-
* @returns a promise which completes when objects have been loaded to the scene
|
|
52
|
-
*/
|
|
53
|
-
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void>;
|
|
54
|
-
private _loadShadersAsync;
|
|
55
|
-
private _loadBuffersAsync;
|
|
56
|
-
private _createNodes;
|
|
57
|
-
}
|
|
58
|
-
/** @internal */
|
|
59
|
-
export declare abstract class GLTFLoaderExtension {
|
|
60
|
-
private _name;
|
|
61
|
-
constructor(name: string);
|
|
62
|
-
get name(): string;
|
|
63
|
-
/**
|
|
64
|
-
* Defines an override for loading the runtime
|
|
65
|
-
* Return true to stop further extensions from loading the runtime
|
|
66
|
-
* @param scene
|
|
67
|
-
* @param data
|
|
68
|
-
* @param rootUrl
|
|
69
|
-
* @param onSuccess
|
|
70
|
-
* @param onError
|
|
71
|
-
* @returns true to stop further extensions from loading the runtime
|
|
72
|
-
*/
|
|
73
|
-
loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Defines an onverride for creating gltf runtime
|
|
76
|
-
* Return true to stop further extensions from creating the runtime
|
|
77
|
-
* @param gltfRuntime
|
|
78
|
-
* @param onSuccess
|
|
79
|
-
* @param onError
|
|
80
|
-
* @returns true to stop further extensions from creating the runtime
|
|
81
|
-
*/
|
|
82
|
-
loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Defines an override for loading buffers
|
|
85
|
-
* Return true to stop further extensions from loading this buffer
|
|
86
|
-
* @param gltfRuntime
|
|
87
|
-
* @param id
|
|
88
|
-
* @param onSuccess
|
|
89
|
-
* @param onError
|
|
90
|
-
* @param onProgress
|
|
91
|
-
* @returns true to stop further extensions from loading this buffer
|
|
92
|
-
*/
|
|
93
|
-
loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Defines an override for loading texture buffers
|
|
96
|
-
* Return true to stop further extensions from loading this texture data
|
|
97
|
-
* @param gltfRuntime
|
|
98
|
-
* @param id
|
|
99
|
-
* @param onSuccess
|
|
100
|
-
* @param onError
|
|
101
|
-
* @returns true to stop further extensions from loading this texture data
|
|
102
|
-
*/
|
|
103
|
-
loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Defines an override for creating textures
|
|
106
|
-
* Return true to stop further extensions from loading this texture
|
|
107
|
-
* @param gltfRuntime
|
|
108
|
-
* @param id
|
|
109
|
-
* @param buffer
|
|
110
|
-
* @param onSuccess
|
|
111
|
-
* @param onError
|
|
112
|
-
* @returns true to stop further extensions from loading this texture
|
|
113
|
-
*/
|
|
114
|
-
createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Defines an override for loading shader strings
|
|
117
|
-
* Return true to stop further extensions from loading this shader data
|
|
118
|
-
* @param gltfRuntime
|
|
119
|
-
* @param id
|
|
120
|
-
* @param onSuccess
|
|
121
|
-
* @param onError
|
|
122
|
-
* @returns true to stop further extensions from loading this shader data
|
|
123
|
-
*/
|
|
124
|
-
loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Defines an override for loading materials
|
|
127
|
-
* Return true to stop further extensions from loading this material
|
|
128
|
-
* @param gltfRuntime
|
|
129
|
-
* @param id
|
|
130
|
-
* @param onSuccess
|
|
131
|
-
* @param onError
|
|
132
|
-
* @returns true to stop further extensions from loading this material
|
|
133
|
-
*/
|
|
134
|
-
loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
|
|
135
|
-
static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
|
|
136
|
-
static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
|
|
137
|
-
static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
|
|
138
|
-
static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
|
|
139
|
-
static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
|
|
140
|
-
static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
|
|
141
|
-
private static _LoadTextureBufferAsync;
|
|
142
|
-
private static _CreateTextureAsync;
|
|
143
|
-
private static _ApplyExtensions;
|
|
144
|
-
}
|
|
5
|
+
export * from "./glTFLoader.pure.js";
|