@babylonjs/loaders 5.0.0-rc.4 → 5.0.0-rc.7
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.js.map +1 -1
- package/OBJ/mtlFileLoader.d.ts +7 -6
- package/OBJ/mtlFileLoader.js +15 -14
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +11 -18
- package/OBJ/objFileLoader.js +19 -23
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +6 -5
- package/OBJ/solidParser.js +15 -21
- package/OBJ/solidParser.js.map +1 -1
- package/STL/index.js.map +1 -1
- package/STL/stlFileLoader.d.ts +7 -14
- package/STL/stlFileLoader.js +15 -21
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +4 -4
- package/glTF/1.0/glTFBinaryExtension.js +4 -5
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +80 -50
- package/glTF/1.0/glTFLoader.js +265 -146
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +10 -10
- package/glTF/1.0/glTFLoaderInterfaces.js +3 -3
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +25 -25
- package/glTF/1.0/glTFLoaderUtils.js +70 -52
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +2 -2
- package/glTF/1.0/glTFMaterialsCommonExtension.js +13 -11
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/1.0/index.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +11 -4
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +9 -2
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +13 -5
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +12 -4
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +10 -3
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +10 -3
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +12 -4
- package/glTF/2.0/Extensions/EXT_texture_webp.js +11 -3
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +26 -8
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +22 -4
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +14 -6
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +17 -6
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +11 -3
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_ior.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +11 -3
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_specular.js +11 -3
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +11 -4
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +24 -13
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +17 -6
- package/glTF/2.0/Extensions/KHR_materials_variants.js +19 -8
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_volume.js +12 -5
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +4 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +5 -3
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +11 -3
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_texture_transform.js +10 -2
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +4 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +4 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +23 -7
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +38 -14
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +45 -11
- package/glTF/2.0/Extensions/MSFT_lod.js +44 -8
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +2 -2
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +2 -2
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +70 -22
- package/glTF/2.0/glTFLoader.js +170 -85
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +11 -11
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +7 -7
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +79 -27
- package/glTF/glTFFileLoader.js +94 -45
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +1 -1
- package/glTF/glTFValidation.js +12 -12
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.js.map +1 -1
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +5 -5
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +1 -1
- package/legacy/legacy-glTF1.js +2 -2
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.js +1 -0
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +1 -1
- package/legacy/legacy-glTF2.js +11 -11
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.js +1 -0
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.js +1 -0
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +3 -3
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +3 -3
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +2 -1
- package/legacy/legacy.js.map +1 -1
- package/package.json +23 -198
- package/readme.md +2 -2
@@ -1,16 +1,16 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
|
3
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
4
|
-
import { Camera } from "@babylonjs/core/Cameras/camera";
|
5
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry";
|
6
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
7
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture";
|
8
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh";
|
9
|
-
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
|
10
|
-
import { IDisposable } from "@babylonjs/core/scene";
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
|
3
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
4
|
+
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
5
|
+
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
6
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
7
|
+
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
8
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
9
|
+
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
10
|
+
import { IDisposable } from "@babylonjs/core/scene.js";
|
11
11
|
import { IScene, INode, IMesh, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation, ITexture, IBufferView, IBuffer } from "./glTFLoaderInterfaces";
|
12
12
|
import { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from "../glTFFileLoader";
|
13
|
-
import { IProperty } from
|
13
|
+
import { IProperty } from "babylonjs-gltf2interface";
|
14
14
|
/**
|
15
15
|
* Interface for a glTF loader extension.
|
16
16
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFLoaderExtension.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"glTFLoaderExtension.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/glTFLoaderExtension.ts"],"names":[],"mappings":"","sourcesContent":["import { Nullable } from \"core/types\";\r\nimport { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { IDisposable } from \"core/scene\";\r\nimport { IScene, INode, IMesh, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation, ITexture, IBufferView, IBuffer } from \"./glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from \"../glTFFileLoader\";\r\nimport { IProperty } from \"babylonjs-gltf2interface\";\r\n\r\n/**\r\n * Interface for a glTF loader extension.\r\n */\r\nexport interface IGLTFLoaderExtension extends IGLTFBaseLoaderExtension, IDisposable {\r\n /**\r\n * Called after the loader state changes to LOADING.\r\n */\r\n onLoading?(): void;\r\n\r\n /**\r\n * Called after the loader state changes to READY.\r\n */\r\n onReady?(): void;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading scenes.\r\n * @param context The context when loading the asset\r\n * @param scene The glTF scene property\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading nodes.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled\r\n */\r\n loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading cameras.\r\n * @param context The context when loading the asset\r\n * @param camera The glTF camera property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled\r\n */\r\n loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;\r\n\r\n /**\r\n * @hidden\r\n * Define this method to modify the default behavior when loading vertex data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled\r\n */\r\n _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;\r\n\r\n /**\r\n * @hidden\r\n * Define this method to modify the default behavior when loading data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param name The mesh name when loading the asset\r\n * @param node The glTF node when loading the asset\r\n * @param mesh The glTF mesh when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\r\n */\r\n _loadMeshPrimitiveAsync?(\r\n context: string,\r\n name: string,\r\n node: INode,\r\n mesh: IMesh,\r\n primitive: IMeshPrimitive,\r\n assign: (babylonMesh: AbstractMesh) => void\r\n ): Nullable<Promise<AbstractMesh>>;\r\n\r\n /**\r\n * @hidden\r\n * Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled\r\n */\r\n _loadMaterialAsync?(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void\r\n ): Nullable<Promise<Material>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when creating materials.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonDrawMode The draw mode for the Babylon material\r\n * @returns The Babylon material or null if not handled\r\n */\r\n createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading material properties.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading texture infos.\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled\r\n */\r\n loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;\r\n\r\n /**\r\n * @hidden\r\n * Define this method to modify the default behavior when loading textures.\r\n * @param context The context when loading the asset\r\n * @param texture The glTF texture property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled\r\n */\r\n _loadTextureAsync?(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading animations.\r\n * @param context The context when loading the asset\r\n * @param animation The glTF animation property\r\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled\r\n */\r\n loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;\r\n\r\n /**\r\n * @hidden\r\n * Define this method to modify the default behavior when loading skins.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param skin The glTF skin property\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n _loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;\r\n\r\n /**\r\n * @hidden\r\n * Define this method to modify the default behavior when loading uris.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property associated with the uri\r\n * @param uri The uri to load\r\n * @returns A promise that resolves with the loaded data when the load is complete or null if not handled\r\n */\r\n _loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading buffer views.\r\n * @param context The context when loading the asset\r\n * @param bufferView The glTF buffer view property\r\n * @returns A promise that resolves with the loaded data when the load is complete or null if not handled\r\n */\r\n loadBufferViewAsync?(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading buffers.\r\n * @param context The context when loading the asset\r\n * @param buffer The glTF buffer property\r\n * @param byteOffset The byte offset to load\r\n * @param byteLength The byte length to load\r\n * @returns A promise that resolves with the loaded data when the load is complete or null if not handled\r\n */\r\n loadBufferAsync?(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;\r\n}\r\n"]}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
|
2
|
-
import { Skeleton } from "@babylonjs/core/Bones/skeleton";
|
3
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
4
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
5
|
-
import { Buffer, VertexBuffer } from "@babylonjs/core/Buffers/buffer";
|
6
|
-
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
|
7
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh";
|
1
|
+
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
|
2
|
+
import { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
|
3
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
4
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
5
|
+
import { Buffer, VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
6
|
+
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
7
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
8
8
|
import * as GLTF2 from "babylonjs-gltf2interface";
|
9
9
|
/**
|
10
10
|
* Loader interface with an index field.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/glTFLoaderInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport { Skeleton } from \"core/Bones/skeleton\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Buffer, VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport * as GLTF2 from \"babylonjs-gltf2interface\";\r\n\r\n/**\r\n * Loader interface with an index field.\r\n */\r\nexport interface IArrayItem {\r\n /**\r\n * The index of this item in the array.\r\n */\r\n index: number;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAccessor extends GLTF2.IAccessor, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n\r\n /** @hidden */\r\n _babylonVertexBuffer?: { [kind: string]: Promise<VertexBuffer> };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAnimationChannel extends GLTF2.IAnimationChannel, IArrayItem {}\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface _IAnimationSamplerData {\r\n input: Float32Array;\r\n interpolation: GLTF2.AnimationSamplerInterpolation;\r\n output: Float32Array;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAnimationSampler extends GLTF2.IAnimationSampler, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<_IAnimationSamplerData>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAnimation extends GLTF2.IAnimation, IArrayItem {\r\n channels: IAnimationChannel[];\r\n samplers: IAnimationSampler[];\r\n\r\n /** @hidden */\r\n _babylonAnimationGroup?: AnimationGroup;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IBuffer extends GLTF2.IBuffer, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IBufferView extends GLTF2.IBufferView, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n\r\n /** @hidden */\r\n _babylonBuffer?: Promise<Buffer>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ICamera extends GLTF2.ICamera, IArrayItem {}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IImage extends GLTF2.IImage, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterialNormalTextureInfo extends GLTF2.IMaterialNormalTextureInfo, ITextureInfo {}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterialOcclusionTextureInfo extends GLTF2.IMaterialOcclusionTextureInfo, ITextureInfo {}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterialPbrMetallicRoughness extends GLTF2.IMaterialPbrMetallicRoughness {\r\n baseColorTexture?: ITextureInfo;\r\n metallicRoughnessTexture?: ITextureInfo;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterial extends GLTF2.IMaterial, IArrayItem {\r\n pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;\r\n normalTexture?: IMaterialNormalTextureInfo;\r\n occlusionTexture?: IMaterialOcclusionTextureInfo;\r\n emissiveTexture?: ITextureInfo;\r\n\r\n /** @hidden */\r\n _data?: {\r\n [babylonDrawMode: number]: {\r\n babylonMaterial: Material;\r\n babylonMeshes: AbstractMesh[];\r\n promise: Promise<void>;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMesh extends GLTF2.IMesh, IArrayItem {\r\n primitives: IMeshPrimitive[];\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMeshPrimitive extends GLTF2.IMeshPrimitive, IArrayItem {\r\n /** @hidden */\r\n _instanceData?: {\r\n babylonSourceMesh: Mesh;\r\n promise: Promise<any>;\r\n };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface INode extends GLTF2.INode, IArrayItem {\r\n /**\r\n * The parent glTF node.\r\n */\r\n parent?: INode;\r\n\r\n /** @hidden */\r\n _babylonTransformNode?: TransformNode;\r\n\r\n /** @hidden */\r\n _babylonTransformNodeForSkin?: TransformNode;\r\n\r\n /** @hidden */\r\n _primitiveBabylonMeshes?: AbstractMesh[];\r\n\r\n /** @hidden */\r\n _numMorphTargets?: number;\r\n}\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface _ISamplerData {\r\n noMipMaps: boolean;\r\n samplingMode: number;\r\n wrapU: number;\r\n wrapV: number;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ISampler extends GLTF2.ISampler, IArrayItem {\r\n /** @hidden */\r\n _data?: _ISamplerData;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IScene extends GLTF2.IScene, IArrayItem {}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ISkin extends GLTF2.ISkin, IArrayItem {\r\n /** @hidden */\r\n _data?: {\r\n babylonSkeleton: Skeleton;\r\n promise: Promise<void>;\r\n };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ITexture extends GLTF2.ITexture, IArrayItem {\r\n /** @hidden */\r\n _textureInfo: ITextureInfo;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ITextureInfo extends GLTF2.ITextureInfo {\r\n /** false or undefined if the texture holds color data (true if data are roughness, normal, ...) */\r\n nonColorData?: boolean;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IGLTF extends GLTF2.IGLTF {\r\n accessors?: IAccessor[];\r\n animations?: IAnimation[];\r\n buffers?: IBuffer[];\r\n bufferViews?: IBufferView[];\r\n cameras?: ICamera[];\r\n images?: IImage[];\r\n materials?: IMaterial[];\r\n meshes?: IMesh[];\r\n nodes?: INode[];\r\n samplers?: ISampler[];\r\n scenes?: IScene[];\r\n skins?: ISkin[];\r\n textures?: ITexture[];\r\n}\r\n"]}
|
package/glTF/2.0/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./glTFLoader\";\r\nexport * from \"./glTFLoaderExtension\";\r\nexport * from \"./glTFLoaderInterfaces\";\r\nexport * from \"./Extensions/index\";\r\n"]}
|
package/glTF/glTFFileLoader.d.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
import * as GLTF2 from "babylonjs-gltf2interface";
|
2
|
-
import { Nullable } from "@babylonjs/core/types";
|
3
|
-
import { Observable } from "@babylonjs/core/Misc/observable";
|
4
|
-
import { Camera } from "@babylonjs/core/Cameras/camera";
|
5
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture";
|
6
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
7
|
-
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
|
8
|
-
import { ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from "@babylonjs/core/Loading/sceneLoader";
|
9
|
-
import { AssetContainer } from "@babylonjs/core/assetContainer";
|
10
|
-
import { Scene, IDisposable } from "@babylonjs/core/scene";
|
11
|
-
import { WebRequest } from "@babylonjs/core/Misc/webRequest";
|
12
|
-
import { IFileRequest } from "@babylonjs/core/Misc/fileRequest";
|
13
|
-
import { IDataBuffer } from "@babylonjs/core/Misc/dataReader";
|
14
|
-
import { LoadFileError } from "@babylonjs/core/Misc/fileTools";
|
2
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
4
|
+
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
5
|
+
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
6
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
7
|
+
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
8
|
+
import { ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from "@babylonjs/core/Loading/sceneLoader.js";
|
9
|
+
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
10
|
+
import { Scene, IDisposable } from "@babylonjs/core/scene.js";
|
11
|
+
import { WebRequest } from "@babylonjs/core/Misc/webRequest.js";
|
12
|
+
import { IFileRequest } from "@babylonjs/core/Misc/fileRequest.js";
|
13
|
+
import { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
|
14
|
+
import { LoadFileError } from "@babylonjs/core/Misc/fileTools.js";
|
15
15
|
/**
|
16
16
|
* Mode that determines the coordinate system to use.
|
17
17
|
*/
|
@@ -130,8 +130,8 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
130
130
|
*/
|
131
131
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
132
132
|
/**
|
133
|
-
|
134
|
-
|
133
|
+
* The animation start mode. Defaults to FIRST.
|
134
|
+
*/
|
135
135
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
136
136
|
/**
|
137
137
|
* Defines if the loader should compile materials before raising the success callback. Defaults to false.
|
@@ -191,8 +191,9 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
191
191
|
*/
|
192
192
|
alwaysComputeSkeletonRootNode: boolean;
|
193
193
|
/**
|
194
|
-
|
195
|
-
|
194
|
+
* Function called before loading a url referenced by the asset.
|
195
|
+
* @param url
|
196
|
+
*/
|
196
197
|
preprocessUrlAsync: (url: string) => Promise<string>;
|
197
198
|
/**
|
198
199
|
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
@@ -300,7 +301,7 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
300
301
|
private _state;
|
301
302
|
private _progressCallback?;
|
302
303
|
private _requests;
|
303
|
-
private static
|
304
|
+
private static _MagicBase64Encoded;
|
304
305
|
/**
|
305
306
|
* Name of the loader ("gltf")
|
306
307
|
*/
|
@@ -311,17 +312,54 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
311
312
|
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
312
313
|
*/
|
313
314
|
dispose(): void;
|
314
|
-
/**
|
315
|
+
/**
|
316
|
+
* @param scene
|
317
|
+
* @param fileOrUrl
|
318
|
+
* @param onSuccess
|
319
|
+
* @param onProgress
|
320
|
+
* @param useArrayBuffer
|
321
|
+
* @param onError
|
322
|
+
* @hidden
|
323
|
+
*/
|
315
324
|
loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest;
|
316
|
-
/**
|
325
|
+
/**
|
326
|
+
* @param meshesNames
|
327
|
+
* @param scene
|
328
|
+
* @param data
|
329
|
+
* @param rootUrl
|
330
|
+
* @param onProgress
|
331
|
+
* @param fileName
|
332
|
+
* @hidden
|
333
|
+
*/
|
317
334
|
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
|
318
|
-
/**
|
335
|
+
/**
|
336
|
+
* @param scene
|
337
|
+
* @param data
|
338
|
+
* @param rootUrl
|
339
|
+
* @param onProgress
|
340
|
+
* @param fileName
|
341
|
+
* @hidden
|
342
|
+
*/
|
319
343
|
loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
|
320
|
-
/**
|
344
|
+
/**
|
345
|
+
* @param scene
|
346
|
+
* @param data
|
347
|
+
* @param rootUrl
|
348
|
+
* @param onProgress
|
349
|
+
* @param fileName
|
350
|
+
* @hidden
|
351
|
+
*/
|
321
352
|
loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
|
322
|
-
/**
|
353
|
+
/**
|
354
|
+
* @param data
|
355
|
+
* @hidden
|
356
|
+
*/
|
323
357
|
canDirectLoad(data: string): boolean;
|
324
|
-
/**
|
358
|
+
/**
|
359
|
+
* @param scene
|
360
|
+
* @param data
|
361
|
+
* @hidden
|
362
|
+
*/
|
325
363
|
directLoad(scene: Scene, data: string): Promise<any>;
|
326
364
|
/**
|
327
365
|
* The callback that allows custom handling of the root url based on the response url.
|
@@ -345,9 +383,20 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
345
383
|
* @returns a promise that resolves when the asset is completely loaded.
|
346
384
|
*/
|
347
385
|
whenCompleteAsync(): Promise<void>;
|
348
|
-
/**
|
386
|
+
/**
|
387
|
+
* @param state
|
388
|
+
* @hidden
|
389
|
+
*/
|
349
390
|
_setState(state: GLTFLoaderState): void;
|
350
|
-
/**
|
391
|
+
/**
|
392
|
+
* @param scene
|
393
|
+
* @param fileOrUrl
|
394
|
+
* @param onSuccess
|
395
|
+
* @param useArrayBuffer
|
396
|
+
* @param onError
|
397
|
+
* @param onOpened
|
398
|
+
* @hidden
|
399
|
+
*/
|
351
400
|
_loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void, onOpened?: (request: WebRequest) => void): IFileRequest;
|
352
401
|
private _onProgress;
|
353
402
|
private _validate;
|
@@ -363,7 +412,10 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
363
412
|
private _loggingEnabled;
|
364
413
|
/** @hidden */
|
365
414
|
_log: (message: string) => void;
|
366
|
-
/**
|
415
|
+
/**
|
416
|
+
* @param message
|
417
|
+
* @hidden
|
418
|
+
*/
|
367
419
|
_logOpen(message: string): void;
|
368
420
|
/** @hidden */
|
369
421
|
_logClose(): void;
|
package/glTF/glTFFileLoader.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
2
2
|
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
3
|
-
import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader.js";
|
3
|
+
import { SceneLoader, } from "@babylonjs/core/Loading/sceneLoader.js";
|
4
4
|
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
5
5
|
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
6
6
|
import { DataReader } from "@babylonjs/core/Misc/dataReader.js";
|
@@ -86,8 +86,8 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
86
86
|
*/
|
87
87
|
this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;
|
88
88
|
/**
|
89
|
-
|
90
|
-
|
89
|
+
* The animation start mode. Defaults to FIRST.
|
90
|
+
*/
|
91
91
|
this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;
|
92
92
|
/**
|
93
93
|
* Defines if the loader should compile materials before raising the success callback. Defaults to false.
|
@@ -147,8 +147,9 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
147
147
|
*/
|
148
148
|
this.alwaysComputeSkeletonRootNode = false;
|
149
149
|
/**
|
150
|
-
|
151
|
-
|
150
|
+
* Function called before loading a url referenced by the asset.
|
151
|
+
* @param url
|
152
|
+
*/
|
152
153
|
this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
|
153
154
|
/**
|
154
155
|
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
@@ -204,7 +205,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
204
205
|
/** @hidden */
|
205
206
|
this.extensions = {
|
206
207
|
".gltf": { isBinary: false },
|
207
|
-
".glb": { isBinary: true }
|
208
|
+
".glb": { isBinary: true },
|
208
209
|
};
|
209
210
|
/**
|
210
211
|
* Observable raised when the loader state changes.
|
@@ -423,7 +424,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
423
424
|
this.onDisposeObservable.notifyObservers(undefined);
|
424
425
|
this.onDisposeObservable.clear();
|
425
426
|
};
|
426
|
-
/**
|
427
|
+
/**
|
428
|
+
* @param scene
|
429
|
+
* @param fileOrUrl
|
430
|
+
* @param onSuccess
|
431
|
+
* @param onProgress
|
432
|
+
* @param useArrayBuffer
|
433
|
+
* @param onError
|
434
|
+
* @hidden
|
435
|
+
*/
|
427
436
|
GLTFFileLoader.prototype.loadFile = function (scene, fileOrUrl, onSuccess, onProgress, useArrayBuffer, onError) {
|
428
437
|
var _this = this;
|
429
438
|
this._progressCallback = onProgress;
|
@@ -436,7 +445,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
436
445
|
}
|
437
446
|
var fileRequest_1 = {
|
438
447
|
abort: function () { },
|
439
|
-
onCompleteObservable: new Observable()
|
448
|
+
onCompleteObservable: new Observable(),
|
440
449
|
};
|
441
450
|
var dataBuffer = {
|
442
451
|
readAsync: function (byteOffset, byteLength) {
|
@@ -450,7 +459,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
450
459
|
});
|
451
460
|
});
|
452
461
|
},
|
453
|
-
byteLength: 0
|
462
|
+
byteLength: 0,
|
454
463
|
};
|
455
464
|
this._unpackBinaryAsync(new DataReader(dataBuffer)).then(function (loaderData) {
|
456
465
|
fileRequest_1.onCompleteObservable.notifyObservers(fileRequest_1);
|
@@ -462,7 +471,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
462
471
|
_this._validate(scene, data, rootUrl, fileName);
|
463
472
|
_this._unpackBinaryAsync(new DataReader({
|
464
473
|
readAsync: function (byteOffset, byteLength) { return readAsync(data, byteOffset, byteLength); },
|
465
|
-
byteLength: data.byteLength
|
474
|
+
byteLength: data.byteLength,
|
466
475
|
})).then(function (loaderData) {
|
467
476
|
onSuccess(loaderData);
|
468
477
|
}, onError ? function (error) { return onError(undefined, error); } : undefined);
|
@@ -473,7 +482,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
473
482
|
onSuccess({ json: _this._parseJson(data) });
|
474
483
|
}, useArrayBuffer, onError);
|
475
484
|
};
|
476
|
-
/**
|
485
|
+
/**
|
486
|
+
* @param meshesNames
|
487
|
+
* @param scene
|
488
|
+
* @param data
|
489
|
+
* @param rootUrl
|
490
|
+
* @param onProgress
|
491
|
+
* @param fileName
|
492
|
+
* @hidden
|
493
|
+
*/
|
477
494
|
GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress, fileName) {
|
478
495
|
var _this = this;
|
479
496
|
return Promise.resolve().then(function () {
|
@@ -484,7 +501,14 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
484
501
|
return _this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);
|
485
502
|
});
|
486
503
|
};
|
487
|
-
/**
|
504
|
+
/**
|
505
|
+
* @param scene
|
506
|
+
* @param data
|
507
|
+
* @param rootUrl
|
508
|
+
* @param onProgress
|
509
|
+
* @param fileName
|
510
|
+
* @hidden
|
511
|
+
*/
|
488
512
|
GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {
|
489
513
|
var _this = this;
|
490
514
|
return Promise.resolve().then(function () {
|
@@ -495,7 +519,14 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
495
519
|
return _this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);
|
496
520
|
});
|
497
521
|
};
|
498
|
-
/**
|
522
|
+
/**
|
523
|
+
* @param scene
|
524
|
+
* @param data
|
525
|
+
* @param rootUrl
|
526
|
+
* @param onProgress
|
527
|
+
* @param fileName
|
528
|
+
* @hidden
|
529
|
+
*/
|
499
530
|
GLTFFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {
|
500
531
|
var _this = this;
|
501
532
|
return Promise.resolve().then(function () {
|
@@ -533,25 +564,32 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
533
564
|
});
|
534
565
|
});
|
535
566
|
};
|
536
|
-
/**
|
567
|
+
/**
|
568
|
+
* @param data
|
569
|
+
* @hidden
|
570
|
+
*/
|
537
571
|
GLTFFileLoader.prototype.canDirectLoad = function (data) {
|
538
|
-
return (data.indexOf("asset") !== -1 && data.indexOf("version") !== -1)
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
572
|
+
return ((data.indexOf("asset") !== -1 && data.indexOf("version") !== -1) ||
|
573
|
+
StringTools.StartsWith(data, "data:base64," + GLTFFileLoader._MagicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.
|
574
|
+
StringTools.StartsWith(data, "data:;base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
575
|
+
StringTools.StartsWith(data, "data:application/octet-stream;base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
576
|
+
StringTools.StartsWith(data, "data:model/gltf-binary;base64," + GLTFFileLoader._MagicBase64Encoded));
|
543
577
|
};
|
544
|
-
/**
|
578
|
+
/**
|
579
|
+
* @param scene
|
580
|
+
* @param data
|
581
|
+
* @hidden
|
582
|
+
*/
|
545
583
|
GLTFFileLoader.prototype.directLoad = function (scene, data) {
|
546
|
-
if (StringTools.StartsWith(data, "base64," + GLTFFileLoader.
|
547
|
-
StringTools.StartsWith(data, ";base64," + GLTFFileLoader.
|
548
|
-
StringTools.StartsWith(data, "application/octet-stream;base64," + GLTFFileLoader.
|
549
|
-
StringTools.StartsWith(data, "model/gltf-binary;base64," + GLTFFileLoader.
|
584
|
+
if (StringTools.StartsWith(data, "base64," + GLTFFileLoader._MagicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.
|
585
|
+
StringTools.StartsWith(data, ";base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
586
|
+
StringTools.StartsWith(data, "application/octet-stream;base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
587
|
+
StringTools.StartsWith(data, "model/gltf-binary;base64," + GLTFFileLoader._MagicBase64Encoded)) {
|
550
588
|
var arrayBuffer_1 = DecodeBase64UrlToBinary(data);
|
551
589
|
this._validate(scene, arrayBuffer_1);
|
552
590
|
return this._unpackBinaryAsync(new DataReader({
|
553
591
|
readAsync: function (byteOffset, byteLength) { return readAsync(arrayBuffer_1, byteOffset, byteLength); },
|
554
|
-
byteLength: arrayBuffer_1.byteLength
|
592
|
+
byteLength: arrayBuffer_1.byteLength,
|
555
593
|
}));
|
556
594
|
}
|
557
595
|
this._validate(scene, data);
|
@@ -586,7 +624,10 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
586
624
|
});
|
587
625
|
});
|
588
626
|
};
|
589
|
-
/**
|
627
|
+
/**
|
628
|
+
* @param state
|
629
|
+
* @hidden
|
630
|
+
*/
|
590
631
|
GLTFFileLoader.prototype._setState = function (state) {
|
591
632
|
if (this._state === state) {
|
592
633
|
return;
|
@@ -595,7 +636,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
595
636
|
this.onLoaderStateChangedObservable.notifyObservers(this._state);
|
596
637
|
this._log(GLTFLoaderState[this._state]);
|
597
638
|
};
|
598
|
-
/**
|
639
|
+
/**
|
640
|
+
* @param scene
|
641
|
+
* @param fileOrUrl
|
642
|
+
* @param onSuccess
|
643
|
+
* @param useArrayBuffer
|
644
|
+
* @param onError
|
645
|
+
* @param onOpened
|
646
|
+
* @hidden
|
647
|
+
*/
|
599
648
|
GLTFFileLoader.prototype._loadFile = function (scene, fileOrUrl, onSuccess, useArrayBuffer, onError, onOpened) {
|
600
649
|
var _this = this;
|
601
650
|
var request = scene._loadFile(fileOrUrl, onSuccess, function (event) {
|
@@ -629,7 +678,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
629
678
|
this._progressCallback({
|
630
679
|
lengthComputable: lengthComputable,
|
631
680
|
loaded: loaded,
|
632
|
-
total: lengthComputable ? total : 0
|
681
|
+
total: lengthComputable ? total : 0,
|
633
682
|
});
|
634
683
|
};
|
635
684
|
GLTFFileLoader.prototype._validate = function (scene, data, rootUrl, fileName) {
|
@@ -672,7 +721,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
672
721
|
}
|
673
722
|
var createLoaders = {
|
674
723
|
1: GLTFFileLoader._CreateGLTF1Loader,
|
675
|
-
2: GLTFFileLoader._CreateGLTF2Loader
|
724
|
+
2: GLTFFileLoader._CreateGLTF2Loader,
|
676
725
|
};
|
677
726
|
var createLoader = createLoaders[version.major];
|
678
727
|
if (!createLoader) {
|
@@ -693,7 +742,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
693
742
|
// Read magic + version + length + json length + json format
|
694
743
|
return dataReader.loadAsync(20).then(function () {
|
695
744
|
var Binary = {
|
696
|
-
Magic:
|
745
|
+
Magic: 0x46546c67,
|
697
746
|
};
|
698
747
|
var magic = dataReader.readUint32();
|
699
748
|
if (magic !== Binary.Magic) {
|
@@ -727,7 +776,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
727
776
|
};
|
728
777
|
GLTFFileLoader.prototype._unpackBinaryV1Async = function (dataReader, length) {
|
729
778
|
var ContentFormat = {
|
730
|
-
JSON: 0
|
779
|
+
JSON: 0,
|
731
780
|
};
|
732
781
|
var contentLength = dataReader.readUint32();
|
733
782
|
var contentFormat = dataReader.readUint32();
|
@@ -740,7 +789,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
740
789
|
var startByteOffset_1 = dataReader.byteOffset;
|
741
790
|
data.bin = {
|
742
791
|
readAsync: function (byteOffset, byteLength) { return dataReader.buffer.readAsync(startByteOffset_1 + byteOffset, byteLength); },
|
743
|
-
byteLength: bodyLength
|
792
|
+
byteLength: bodyLength,
|
744
793
|
};
|
745
794
|
}
|
746
795
|
return Promise.resolve(data);
|
@@ -748,8 +797,8 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
748
797
|
GLTFFileLoader.prototype._unpackBinaryV2Async = function (dataReader, length) {
|
749
798
|
var _this = this;
|
750
799
|
var ChunkFormat = {
|
751
|
-
JSON:
|
752
|
-
BIN:
|
800
|
+
JSON: 0x4e4f534a,
|
801
|
+
BIN: 0x004e4942,
|
753
802
|
};
|
754
803
|
// Read the JSON chunk header.
|
755
804
|
var chunkLength = dataReader.readUint32();
|
@@ -777,7 +826,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
777
826
|
var startByteOffset_2 = dataReader.byteOffset;
|
778
827
|
data.bin = {
|
779
828
|
readAsync: function (byteOffset, byteLength) { return dataReader.buffer.readAsync(startByteOffset_2 + byteOffset, byteLength); },
|
780
|
-
byteLength: chunkLength
|
829
|
+
byteLength: chunkLength,
|
781
830
|
};
|
782
831
|
dataReader.skipBytes(chunkLength);
|
783
832
|
break;
|
@@ -800,7 +849,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
800
849
|
if (version === "1.0" || version === "1.0.1") {
|
801
850
|
return {
|
802
851
|
major: 1,
|
803
|
-
minor: 0
|
852
|
+
minor: 0,
|
804
853
|
};
|
805
854
|
}
|
806
855
|
var match = (version + "").match(/^(\d+)\.(\d+)/);
|
@@ -809,7 +858,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
809
858
|
}
|
810
859
|
return {
|
811
860
|
major: parseInt(match[1]),
|
812
|
-
minor: parseInt(match[2])
|
861
|
+
minor: parseInt(match[2]),
|
813
862
|
};
|
814
863
|
};
|
815
864
|
GLTFFileLoader._compareVersion = function (a, b) {
|
@@ -827,7 +876,10 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
827
876
|
}
|
828
877
|
return 0;
|
829
878
|
};
|
830
|
-
/**
|
879
|
+
/**
|
880
|
+
* @param message
|
881
|
+
* @hidden
|
882
|
+
*/
|
831
883
|
GLTFFileLoader.prototype._logOpen = function (message) {
|
832
884
|
this._log(message);
|
833
885
|
this._logIndentLevel++;
|
@@ -840,18 +892,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
840
892
|
var spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);
|
841
893
|
Logger.Log("".concat(spaces).concat(message));
|
842
894
|
};
|
843
|
-
GLTFFileLoader.prototype._logDisabled = function (message) {
|
844
|
-
};
|
895
|
+
GLTFFileLoader.prototype._logDisabled = function (message) { };
|
845
896
|
GLTFFileLoader.prototype._startPerformanceCounterEnabled = function (counterName) {
|
846
897
|
Tools.StartPerformanceCounter(counterName);
|
847
898
|
};
|
848
|
-
GLTFFileLoader.prototype._startPerformanceCounterDisabled = function (counterName) {
|
849
|
-
};
|
899
|
+
GLTFFileLoader.prototype._startPerformanceCounterDisabled = function (counterName) { };
|
850
900
|
GLTFFileLoader.prototype._endPerformanceCounterEnabled = function (counterName) {
|
851
901
|
Tools.EndPerformanceCounter(counterName);
|
852
902
|
};
|
853
|
-
GLTFFileLoader.prototype._endPerformanceCounterDisabled = function (counterName) {
|
854
|
-
};
|
903
|
+
GLTFFileLoader.prototype._endPerformanceCounterDisabled = function (counterName) { };
|
855
904
|
// ----------
|
856
905
|
// V1 options
|
857
906
|
// ----------
|
@@ -868,7 +917,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
868
917
|
* @hidden
|
869
918
|
*/
|
870
919
|
GLTFFileLoader.HomogeneousCoordinates = false;
|
871
|
-
GLTFFileLoader.
|
920
|
+
GLTFFileLoader._MagicBase64Encoded = "Z2xURg"; // "glTF" base64 encoded (without the quotes!)
|
872
921
|
GLTFFileLoader._logSpaces = " ";
|
873
922
|
return GLTFFileLoader;
|
874
923
|
}());
|