@onerjs/loaders 8.23.1
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/index.d.ts +4 -0
- package/OBJ/index.js +5 -0
- package/OBJ/index.js.map +1 -0
- package/OBJ/mtlFileLoader.d.ts +41 -0
- package/OBJ/mtlFileLoader.js +231 -0
- package/OBJ/mtlFileLoader.js.map +1 -0
- package/OBJ/objFileLoader.d.ts +136 -0
- package/OBJ/objFileLoader.js +318 -0
- package/OBJ/objFileLoader.js.map +1 -0
- package/OBJ/objFileLoader.metadata.d.ts +4 -0
- package/OBJ/objFileLoader.metadata.js +5 -0
- package/OBJ/objFileLoader.metadata.js.map +1 -0
- package/OBJ/objLoadingOptions.d.ts +47 -0
- package/OBJ/objLoadingOptions.js +2 -0
- package/OBJ/objLoadingOptions.js.map +1 -0
- package/OBJ/solidParser.d.ts +174 -0
- package/OBJ/solidParser.js +862 -0
- package/OBJ/solidParser.js.map +1 -0
- package/SPLAT/index.d.ts +2 -0
- package/SPLAT/index.js +4 -0
- package/SPLAT/index.js.map +1 -0
- package/SPLAT/splatFileLoader.d.ts +88 -0
- package/SPLAT/splatFileLoader.js +562 -0
- package/SPLAT/splatFileLoader.js.map +1 -0
- package/SPLAT/splatFileLoader.metadata.d.ts +14 -0
- package/SPLAT/splatFileLoader.metadata.js +12 -0
- package/SPLAT/splatFileLoader.metadata.js.map +1 -0
- package/SPLAT/splatLoadingOptions.d.ts +13 -0
- package/SPLAT/splatLoadingOptions.js +2 -0
- package/SPLAT/splatLoadingOptions.js.map +1 -0
- package/STL/index.d.ts +1 -0
- package/STL/index.js +2 -0
- package/STL/index.js.map +1 -0
- package/STL/stlFileLoader.d.ts +78 -0
- package/STL/stlFileLoader.js +239 -0
- package/STL/stlFileLoader.js.map +1 -0
- package/STL/stlFileLoader.metadata.d.ts +8 -0
- package/STL/stlFileLoader.metadata.js +8 -0
- package/STL/stlFileLoader.metadata.js.map +1 -0
- package/bvh/bvhFileLoader.d.ts +69 -0
- package/bvh/bvhFileLoader.js +133 -0
- package/bvh/bvhFileLoader.js.map +1 -0
- package/bvh/bvhFileLoader.metadata.d.ts +8 -0
- package/bvh/bvhFileLoader.metadata.js +8 -0
- package/bvh/bvhFileLoader.metadata.js.map +1 -0
- package/bvh/bvhLoader.d.ts +14 -0
- package/bvh/bvhLoader.js +329 -0
- package/bvh/bvhLoader.js.map +1 -0
- package/bvh/bvhLoadingOptions.d.ts +9 -0
- package/bvh/bvhLoadingOptions.js +2 -0
- package/bvh/bvhLoadingOptions.js.map +1 -0
- package/bvh/index.d.ts +2 -0
- package/bvh/index.js +4 -0
- package/bvh/index.js.map +1 -0
- package/bvh/license.md +21 -0
- package/dynamic.d.ts +5 -0
- package/dynamic.js +57 -0
- package/dynamic.js.map +1 -0
- package/glTF/1.0/glTFBinaryExtension.d.ts +16 -0
- package/glTF/1.0/glTFBinaryExtension.js +65 -0
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -0
- package/glTF/1.0/glTFLoader.d.ts +144 -0
- package/glTF/1.0/glTFLoader.js +1841 -0
- package/glTF/1.0/glTFLoader.js.map +1 -0
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -0
- package/glTF/1.0/glTFLoaderInterfaces.js +96 -0
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -0
- package/glTF/1.0/glTFLoaderUtils.d.ts +71 -0
- package/glTF/1.0/glTFLoaderUtils.js +255 -0
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -0
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +13 -0
- package/glTF/1.0/glTFMaterialsCommonExtension.js +131 -0
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -0
- package/glTF/1.0/index.d.ts +5 -0
- package/glTF/1.0/index.js +6 -0
- package/glTF/1.0/index.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.d.ts +41 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.js +84 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +48 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +116 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.d.ts +43 -0
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js +69 -0
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +39 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +82 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +39 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +51 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +34 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.js +39 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +33 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.js +38 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +48 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +63 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +47 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.d.ts +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js +239 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.js +78 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +47 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +93 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +352 -0
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +1700 -0
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +33 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +20 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +3 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js +4 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +70 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +450 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity.d.ts +38 -0
- package/glTF/2.0/Extensions/KHR_interactivity.js +151 -0
- package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +92 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +61 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +95 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js +60 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +52 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +46 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +71 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +81 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +85 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.js +85 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +306 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +112 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.js +263 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js +86 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +29 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.d.ts +31 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.js +190 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.d.ts +30 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.js +124 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +30 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.js +69 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +33 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +38 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +37 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.js +59 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +48 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +56 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +227 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +104 -0
- package/glTF/2.0/Extensions/MSFT_lod.js +338 -0
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +27 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +41 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +27 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +42 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -0
- package/glTF/2.0/Extensions/dynamic.d.ts +4 -0
- package/glTF/2.0/Extensions/dynamic.js +156 -0
- package/glTF/2.0/Extensions/dynamic.js.map +1 -0
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.d.ts +45 -0
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.js +101 -0
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -0
- package/glTF/2.0/Extensions/index.d.ts +39 -0
- package/glTF/2.0/Extensions/index.js +41 -0
- package/glTF/2.0/Extensions/index.js.map +1 -0
- package/glTF/2.0/Extensions/objectModelMapping.d.ts +289 -0
- package/glTF/2.0/Extensions/objectModelMapping.js +828 -0
- package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -0
- package/glTF/2.0/glTFLoader.d.ts +429 -0
- package/glTF/2.0/glTFLoader.js +2408 -0
- package/glTF/2.0/glTFLoader.js.map +1 -0
- package/glTF/2.0/glTFLoaderAnimation.d.ts +42 -0
- package/glTF/2.0/glTFLoaderAnimation.js +80 -0
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -0
- package/glTF/2.0/glTFLoaderExtension.d.ts +165 -0
- package/glTF/2.0/glTFLoaderExtension.js +2 -0
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -0
- package/glTF/2.0/glTFLoaderExtensionRegistry.d.ts +25 -0
- package/glTF/2.0/glTFLoaderExtensionRegistry.js +33 -0
- package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -0
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +257 -0
- package/glTF/2.0/glTFLoaderInterfaces.js +2 -0
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -0
- package/glTF/2.0/index.d.ts +6 -0
- package/glTF/2.0/index.js +8 -0
- package/glTF/2.0/index.js.map +1 -0
- package/glTF/glTFFileLoader.d.ts +516 -0
- package/glTF/glTFFileLoader.js +968 -0
- package/glTF/glTFFileLoader.js.map +1 -0
- package/glTF/glTFFileLoader.metadata.d.ts +15 -0
- package/glTF/glTFFileLoader.metadata.js +18 -0
- package/glTF/glTFFileLoader.metadata.js.map +1 -0
- package/glTF/glTFValidation.d.ts +29 -0
- package/glTF/glTFValidation.js +126 -0
- package/glTF/glTFValidation.js.map +1 -0
- package/glTF/index.d.ts +5 -0
- package/glTF/index.js +7 -0
- package/glTF/index.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +7 -0
- package/index.js.map +1 -0
- package/legacy/legacy-bvhFileLoader.d.ts +1 -0
- package/legacy/legacy-bvhFileLoader.js +16 -0
- package/legacy/legacy-bvhFileLoader.js.map +1 -0
- package/legacy/legacy-glTF.d.ts +2 -0
- package/legacy/legacy-glTF.js +19 -0
- package/legacy/legacy-glTF.js.map +1 -0
- package/legacy/legacy-glTF1.d.ts +2 -0
- package/legacy/legacy-glTF1.js +16 -0
- package/legacy/legacy-glTF1.js.map +1 -0
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -0
- package/legacy/legacy-glTF1FileLoader.js +4 -0
- package/legacy/legacy-glTF1FileLoader.js.map +1 -0
- package/legacy/legacy-glTF2.d.ts +2 -0
- package/legacy/legacy-glTF2.js +35 -0
- package/legacy/legacy-glTF2.js.map +1 -0
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -0
- package/legacy/legacy-glTF2FileLoader.js +4 -0
- package/legacy/legacy-glTF2FileLoader.js.map +1 -0
- package/legacy/legacy-glTFFileLoader.d.ts +3 -0
- package/legacy/legacy-glTFFileLoader.js +5 -0
- package/legacy/legacy-glTFFileLoader.js.map +1 -0
- package/legacy/legacy-objFileLoader.d.ts +1 -0
- package/legacy/legacy-objFileLoader.js +16 -0
- package/legacy/legacy-objFileLoader.js.map +1 -0
- package/legacy/legacy-stlFileLoader.d.ts +1 -0
- package/legacy/legacy-stlFileLoader.js +16 -0
- package/legacy/legacy-stlFileLoader.js.map +1 -0
- package/legacy/legacy.d.ts +7 -0
- package/legacy/legacy.js +10 -0
- package/legacy/legacy.js.map +1 -0
- package/license.md +71 -0
- package/package.json +49 -0
- package/readme.md +23 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Animation } from "@babylonjs/core/Animations/animation.js";
|
|
2
|
+
import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
+
import { SetInterpolationForKey } from "./Extensions/objectModelMapping.js";
|
|
4
|
+
/** @internal */
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
6
|
+
export function getVector3(_target, source, offset, scale) {
|
|
7
|
+
return Vector3.FromArray(source, offset).scaleInPlace(scale);
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
export function getQuaternion(_target, source, offset, scale) {
|
|
12
|
+
return Quaternion.FromArray(source, offset).scaleInPlace(scale);
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
+
export function getWeights(target, source, offset, scale) {
|
|
17
|
+
const value = new Array(target._numMorphTargets);
|
|
18
|
+
for (let i = 0; i < value.length; i++) {
|
|
19
|
+
value[i] = source[offset++] * scale;
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
24
|
+
export class AnimationPropertyInfo {
|
|
25
|
+
/** @internal */
|
|
26
|
+
constructor(type, name, getValue, getStride) {
|
|
27
|
+
this.type = type;
|
|
28
|
+
this.name = name;
|
|
29
|
+
this.getValue = getValue;
|
|
30
|
+
this.getStride = getStride;
|
|
31
|
+
}
|
|
32
|
+
_buildAnimation(name, fps, keys) {
|
|
33
|
+
const babylonAnimation = new Animation(name, this.name, fps, this.type);
|
|
34
|
+
babylonAnimation.setKeys(keys);
|
|
35
|
+
return babylonAnimation;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
export class TransformNodeAnimationPropertyInfo extends AnimationPropertyInfo {
|
|
40
|
+
/** @internal */
|
|
41
|
+
buildAnimations(target, name, fps, keys) {
|
|
42
|
+
const babylonAnimations = [];
|
|
43
|
+
babylonAnimations.push({ babylonAnimatable: target._babylonTransformNode, babylonAnimation: this._buildAnimation(name, fps, keys) });
|
|
44
|
+
return babylonAnimations;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** @internal */
|
|
48
|
+
export class WeightAnimationPropertyInfo extends AnimationPropertyInfo {
|
|
49
|
+
buildAnimations(target, name, fps, keys) {
|
|
50
|
+
const babylonAnimations = [];
|
|
51
|
+
if (target._numMorphTargets) {
|
|
52
|
+
for (let targetIndex = 0; targetIndex < target._numMorphTargets; targetIndex++) {
|
|
53
|
+
const babylonAnimation = new Animation(`${name}_${targetIndex}`, this.name, fps, this.type);
|
|
54
|
+
babylonAnimation.setKeys(keys.map((key) => ({
|
|
55
|
+
frame: key.frame,
|
|
56
|
+
inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,
|
|
57
|
+
value: key.value[targetIndex],
|
|
58
|
+
outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,
|
|
59
|
+
interpolation: key.interpolation,
|
|
60
|
+
})));
|
|
61
|
+
if (target._primitiveBabylonMeshes) {
|
|
62
|
+
for (const babylonMesh of target._primitiveBabylonMeshes) {
|
|
63
|
+
if (babylonMesh.morphTargetManager) {
|
|
64
|
+
const morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
|
|
65
|
+
const babylonAnimationClone = babylonAnimation.clone();
|
|
66
|
+
morphTarget.animations.push(babylonAnimationClone);
|
|
67
|
+
babylonAnimations.push({ babylonAnimatable: morphTarget, babylonAnimation: babylonAnimationClone });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return babylonAnimations;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
SetInterpolationForKey("/nodes/{}/translation", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, "position", getVector3, () => 3)]);
|
|
77
|
+
SetInterpolationForKey("/nodes/{}/rotation", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_QUATERNION, "rotationQuaternion", getQuaternion, () => 4)]);
|
|
78
|
+
SetInterpolationForKey("/nodes/{}/scale", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, "scaling", getVector3, () => 3)]);
|
|
79
|
+
SetInterpolationForKey("/nodes/{}/weights", [new WeightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, "influence", getWeights, (target) => target._numMorphTargets)]);
|
|
80
|
+
//# sourceMappingURL=glTFLoaderAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glTFLoaderAnimation.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderAnimation.ts"],"names":[],"mappings":"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","sourcesContent":["import { Animation } from \"core/Animations/animation\";\r\nimport { Quaternion, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { INode } from \"./glTFLoaderInterfaces\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport { SetInterpolationForKey } from \"./Extensions/objectModelMapping\";\r\n\r\n/** @internal */\r\nexport type GetValueFn = (target: any, source: Float32Array, offset: number, scale: number) => any;\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function getVector3(_target: any, source: Float32Array, offset: number, scale: number): Vector3 {\r\n return Vector3.FromArray(source, offset).scaleInPlace(scale);\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function getQuaternion(_target: any, source: Float32Array, offset: number, scale: number): Quaternion {\r\n return Quaternion.FromArray(source, offset).scaleInPlace(scale);\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function getWeights(target: INode, source: Float32Array, offset: number, scale: number): Array<number> {\r\n const value = new Array<number>(target._numMorphTargets!);\r\n for (let i = 0; i < value.length; i++) {\r\n value[i] = source[offset++] * scale;\r\n }\r\n\r\n return value;\r\n}\r\n\r\n/** @internal */\r\nexport abstract class AnimationPropertyInfo {\r\n /** @internal */\r\n public constructor(\r\n public readonly type: number,\r\n public readonly name: string,\r\n public readonly getValue: GetValueFn,\r\n public readonly getStride: (target: any) => number\r\n ) {}\r\n\r\n protected _buildAnimation(name: string, fps: number, keys: any[]): Animation {\r\n const babylonAnimation = new Animation(name, this.name, fps, this.type);\r\n babylonAnimation.setKeys(keys);\r\n return babylonAnimation;\r\n }\r\n\r\n /** @internal */\r\n public abstract buildAnimations(target: any, name: string, fps: number, keys: any[]): { babylonAnimatable: IAnimatable; babylonAnimation: Animation }[];\r\n}\r\n\r\n/** @internal */\r\nexport class TransformNodeAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(target: INode, name: string, fps: number, keys: any[]) {\r\n const babylonAnimations: { babylonAnimatable: IAnimatable; babylonAnimation: Animation }[] = [];\r\n babylonAnimations.push({ babylonAnimatable: target._babylonTransformNode!, babylonAnimation: this._buildAnimation(name, fps, keys) });\r\n return babylonAnimations;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class WeightAnimationPropertyInfo extends AnimationPropertyInfo {\r\n public buildAnimations(target: INode, name: string, fps: number, keys: any[]) {\r\n const babylonAnimations: { babylonAnimatable: IAnimatable; babylonAnimation: Animation }[] = [];\r\n if (target._numMorphTargets) {\r\n for (let targetIndex = 0; targetIndex < target._numMorphTargets; targetIndex++) {\r\n const babylonAnimation = new Animation(`${name}_${targetIndex}`, this.name, fps, this.type);\r\n babylonAnimation.setKeys(\r\n keys.map((key) => ({\r\n frame: key.frame,\r\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\r\n value: key.value[targetIndex],\r\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,\r\n interpolation: key.interpolation,\r\n }))\r\n );\r\n\r\n if (target._primitiveBabylonMeshes) {\r\n for (const babylonMesh of target._primitiveBabylonMeshes) {\r\n if (babylonMesh.morphTargetManager) {\r\n const morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);\r\n const babylonAnimationClone = babylonAnimation.clone();\r\n morphTarget.animations.push(babylonAnimationClone);\r\n babylonAnimations.push({ babylonAnimatable: morphTarget, babylonAnimation: babylonAnimationClone });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return babylonAnimations;\r\n }\r\n}\r\n\r\nSetInterpolationForKey(\"/nodes/{}/translation\", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, \"position\", getVector3, () => 3)]);\r\nSetInterpolationForKey(\"/nodes/{}/rotation\", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_QUATERNION, \"rotationQuaternion\", getQuaternion, () => 4)]);\r\nSetInterpolationForKey(\"/nodes/{}/scale\", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, \"scaling\", getVector3, () => 3)]);\r\nSetInterpolationForKey(\"/nodes/{}/weights\", [new WeightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"influence\", getWeights, (target) => target._numMorphTargets!)]);\r\n"]}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
2
|
+
import type { Animation } from "@babylonjs/core/Animations/animation.js";
|
|
3
|
+
import type { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
|
|
4
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
|
5
|
+
import type { Camera } from "@babylonjs/core/Cameras/camera.js";
|
|
6
|
+
import type { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
|
7
|
+
import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
8
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
|
9
|
+
import type { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
10
|
+
import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
|
11
|
+
import type { IDisposable } from "@babylonjs/core/scene.js";
|
|
12
|
+
import type { IScene, INode, IMesh, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation, ITexture, IBufferView, IBuffer, IAnimationChannel } from "./glTFLoaderInterfaces.js";
|
|
13
|
+
import type { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from "../glTFFileLoader.js";
|
|
14
|
+
import type { IProperty } from "babylonjs-gltf2interface";
|
|
15
|
+
import type { IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
|
|
16
|
+
/**
|
|
17
|
+
* Interface for a glTF loader extension.
|
|
18
|
+
*/
|
|
19
|
+
export interface IGLTFLoaderExtension extends IGLTFBaseLoaderExtension, IDisposable {
|
|
20
|
+
/**
|
|
21
|
+
* Called after the loader state changes to LOADING.
|
|
22
|
+
*/
|
|
23
|
+
onLoading?(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Called after the loader state changes to READY.
|
|
26
|
+
*/
|
|
27
|
+
onReady?(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Define this method to modify the default behavior when loading scenes.
|
|
30
|
+
* @param context The context when loading the asset
|
|
31
|
+
* @param scene The glTF scene property
|
|
32
|
+
* @returns A promise that resolves when the load is complete or null if not handled
|
|
33
|
+
*/
|
|
34
|
+
loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;
|
|
35
|
+
/**
|
|
36
|
+
* Define this method to modify the default behavior when loading nodes.
|
|
37
|
+
* @param context The context when loading the asset
|
|
38
|
+
* @param node The glTF node property
|
|
39
|
+
* @param assign A function called synchronously after parsing the glTF properties
|
|
40
|
+
* @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled
|
|
41
|
+
*/
|
|
42
|
+
loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
|
43
|
+
/**
|
|
44
|
+
* Define this method to modify the default behavior when loading cameras.
|
|
45
|
+
* @param context The context when loading the asset
|
|
46
|
+
* @param camera The glTF camera property
|
|
47
|
+
* @param assign A function called synchronously after parsing the glTF properties
|
|
48
|
+
* @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
|
|
49
|
+
*/
|
|
50
|
+
loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
* Define this method to modify the default behavior when loading vertex data for mesh primitives.
|
|
54
|
+
* @param context The context when loading the asset
|
|
55
|
+
* @param primitive The glTF mesh primitive property
|
|
56
|
+
* @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
|
|
57
|
+
*/
|
|
58
|
+
_loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
* Define this method to modify the default behavior when loading data for mesh primitives.
|
|
62
|
+
* @param context The context when loading the asset
|
|
63
|
+
* @param name The mesh name when loading the asset
|
|
64
|
+
* @param node The glTF node when loading the asset
|
|
65
|
+
* @param mesh The glTF mesh when loading the asset
|
|
66
|
+
* @param primitive The glTF mesh primitive property
|
|
67
|
+
* @param assign A function called synchronously after parsing the glTF properties
|
|
68
|
+
* @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
|
|
69
|
+
*/
|
|
70
|
+
_loadMeshPrimitiveAsync?(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Nullable<Promise<AbstractMesh>>;
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
* Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
|
|
74
|
+
* @param context The context when loading the asset
|
|
75
|
+
* @param material The glTF material property
|
|
76
|
+
* @param assign A function called synchronously after parsing the glTF properties
|
|
77
|
+
* @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
|
|
78
|
+
*/
|
|
79
|
+
_loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
|
|
80
|
+
/**
|
|
81
|
+
* Define this method to modify the default behavior when creating materials.
|
|
82
|
+
* @param context The context when loading the asset
|
|
83
|
+
* @param material The glTF material property
|
|
84
|
+
* @param babylonDrawMode The draw mode for the Babylon material
|
|
85
|
+
* @returns The Babylon material or null if not handled
|
|
86
|
+
*/
|
|
87
|
+
createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
|
|
88
|
+
/**
|
|
89
|
+
* Define this method to modify the default behavior when loading material properties.
|
|
90
|
+
* @param context The context when loading the asset
|
|
91
|
+
* @param material The glTF material property
|
|
92
|
+
* @param babylonMaterial The Babylon material
|
|
93
|
+
* @returns A promise that resolves when the load is complete or null if not handled
|
|
94
|
+
*/
|
|
95
|
+
loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
|
96
|
+
/**
|
|
97
|
+
* Define this method to modify the default behavior when loading texture infos.
|
|
98
|
+
* @param context The context when loading the asset
|
|
99
|
+
* @param textureInfo The glTF texture info property
|
|
100
|
+
* @param assign A function called synchronously after parsing the glTF properties
|
|
101
|
+
* @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
|
|
102
|
+
*/
|
|
103
|
+
loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
|
|
104
|
+
/**
|
|
105
|
+
* @internal
|
|
106
|
+
* Define this method to modify the default behavior when loading textures.
|
|
107
|
+
* @param context The context when loading the asset
|
|
108
|
+
* @param texture The glTF texture property
|
|
109
|
+
* @param assign A function called synchronously after parsing the glTF properties
|
|
110
|
+
* @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
|
|
111
|
+
*/
|
|
112
|
+
_loadTextureAsync?(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
|
|
113
|
+
/**
|
|
114
|
+
* Define this method to modify the default behavior when loading animations.
|
|
115
|
+
* @param context The context when loading the asset
|
|
116
|
+
* @param animation The glTF animation property
|
|
117
|
+
* @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
|
|
118
|
+
*/
|
|
119
|
+
loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
|
|
120
|
+
/**
|
|
121
|
+
* @internal
|
|
122
|
+
* Define this method to modify the default behvaior when loading animation channels.
|
|
123
|
+
* @param context The context when loading the asset
|
|
124
|
+
* @param animationContext The context of the animation when loading the asset
|
|
125
|
+
* @param animation The glTF animation property
|
|
126
|
+
* @param channel The glTF animation channel property
|
|
127
|
+
* @param onLoad Called for each animation loaded
|
|
128
|
+
* @returns A void promise that resolves when the load is complete or null if not handled
|
|
129
|
+
*/
|
|
130
|
+
_loadAnimationChannelAsync?(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void): Nullable<Promise<void>>;
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
* Define this method to modify the default behavior when loading skins.
|
|
134
|
+
* @param context The context when loading the asset
|
|
135
|
+
* @param node The glTF node property
|
|
136
|
+
* @param skin The glTF skin property
|
|
137
|
+
* @returns A promise that resolves when the load is complete or null if not handled
|
|
138
|
+
*/
|
|
139
|
+
_loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
* Define this method to modify the default behavior when loading uris.
|
|
143
|
+
* @param context The context when loading the asset
|
|
144
|
+
* @param property The glTF property associated with the uri
|
|
145
|
+
* @param uri The uri to load
|
|
146
|
+
* @returns A promise that resolves with the loaded data when the load is complete or null if not handled
|
|
147
|
+
*/
|
|
148
|
+
_loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
|
|
149
|
+
/**
|
|
150
|
+
* Define this method to modify the default behavior when loading buffer views.
|
|
151
|
+
* @param context The context when loading the asset
|
|
152
|
+
* @param bufferView The glTF buffer view property
|
|
153
|
+
* @returns A promise that resolves with the loaded data when the load is complete or null if not handled
|
|
154
|
+
*/
|
|
155
|
+
loadBufferViewAsync?(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
|
|
156
|
+
/**
|
|
157
|
+
* Define this method to modify the default behavior when loading buffers.
|
|
158
|
+
* @param context The context when loading the asset
|
|
159
|
+
* @param buffer The glTF buffer property
|
|
160
|
+
* @param byteOffset The byte offset to load
|
|
161
|
+
* @param byteLength The byte length to load
|
|
162
|
+
* @returns A promise that resolves with the loaded data when the load is complete or null if not handled
|
|
163
|
+
*/
|
|
164
|
+
loadBufferAsync?(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
|
|
165
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glTFLoaderExtension.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderExtension.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Animation } from \"core/Animations/animation\";\r\nimport type { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport type { Geometry } from \"core/Meshes/geometry\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { IDisposable } from \"core/scene\";\r\nimport type {\r\n IScene,\r\n INode,\r\n IMesh,\r\n ISkin,\r\n ICamera,\r\n IMeshPrimitive,\r\n IMaterial,\r\n ITextureInfo,\r\n IAnimation,\r\n ITexture,\r\n IBufferView,\r\n IBuffer,\r\n IAnimationChannel,\r\n} from \"./glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from \"../glTFFileLoader\";\r\nimport type { IProperty } from \"babylonjs-gltf2interface\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\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 * @internal\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 * @internal\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 * @internal\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 * @internal\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 * @internal\r\n * Define this method to modify the default behvaior when loading animation channels.\r\n * @param context The context when loading the asset\r\n * @param animationContext The context of the animation when loading the asset\r\n * @param animation The glTF animation property\r\n * @param channel The glTF animation channel property\r\n * @param onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the load is complete or null if not handled\r\n */\r\n _loadAnimationChannelAsync?(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Nullable<Promise<void>>;\r\n\r\n /**\r\n * @internal\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 * @internal\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"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GLTFLoader } from "./glTFLoader.js";
|
|
2
|
+
import type { IGLTFLoaderExtension } from "./glTFLoaderExtension.js";
|
|
3
|
+
interface IRegisteredGLTFExtension {
|
|
4
|
+
isGLTFExtension: boolean;
|
|
5
|
+
factory: GLTFExtensionFactory;
|
|
6
|
+
}
|
|
7
|
+
export type GLTFExtensionFactory = (loader: GLTFLoader) => IGLTFLoaderExtension | Promise<IGLTFLoaderExtension>;
|
|
8
|
+
/**
|
|
9
|
+
* All currently registered glTF 2.0 loader extensions.
|
|
10
|
+
*/
|
|
11
|
+
export declare const registeredGLTFExtensions: ReadonlyMap<string, Readonly<IRegisteredGLTFExtension>>;
|
|
12
|
+
/**
|
|
13
|
+
* Registers a loader extension.
|
|
14
|
+
* @param name The name of the loader extension.
|
|
15
|
+
* @param isGLTFExtension If the loader extension is a glTF extension, then it will only be used for glTF files that use the corresponding glTF extension. Otherwise, it will be used for all loaded glTF files.
|
|
16
|
+
* @param factory The factory function that creates the loader extension.
|
|
17
|
+
*/
|
|
18
|
+
export declare function registerGLTFExtension(name: string, isGLTFExtension: boolean, factory: GLTFExtensionFactory): void;
|
|
19
|
+
/**
|
|
20
|
+
* Unregisters a loader extension.
|
|
21
|
+
* @param name The name of the loader extension.
|
|
22
|
+
* @returns A boolean indicating whether the extension has been unregistered
|
|
23
|
+
*/
|
|
24
|
+
export declare function unregisterGLTFExtension(name: string): boolean;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
|
2
|
+
const RegisteredGLTFExtensions = new Map();
|
|
3
|
+
/**
|
|
4
|
+
* All currently registered glTF 2.0 loader extensions.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const registeredGLTFExtensions = RegisteredGLTFExtensions;
|
|
8
|
+
/**
|
|
9
|
+
* Registers a loader extension.
|
|
10
|
+
* @param name The name of the loader extension.
|
|
11
|
+
* @param isGLTFExtension If the loader extension is a glTF extension, then it will only be used for glTF files that use the corresponding glTF extension. Otherwise, it will be used for all loaded glTF files.
|
|
12
|
+
* @param factory The factory function that creates the loader extension.
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
export function registerGLTFExtension(name, isGLTFExtension, factory) {
|
|
16
|
+
if (unregisterGLTFExtension(name)) {
|
|
17
|
+
Logger.Warn(`Extension with the name '${name}' already exists`);
|
|
18
|
+
}
|
|
19
|
+
RegisteredGLTFExtensions.set(name, {
|
|
20
|
+
isGLTFExtension,
|
|
21
|
+
factory,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Unregisters a loader extension.
|
|
26
|
+
* @param name The name of the loader extension.
|
|
27
|
+
* @returns A boolean indicating whether the extension has been unregistered
|
|
28
|
+
*/
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
30
|
+
export function unregisterGLTFExtension(name) {
|
|
31
|
+
return RegisteredGLTFExtensions.delete(name);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=glTFLoaderExtensionRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glTFLoaderExtensionRegistry.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderExtensionRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAS1C,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAoC,CAAC;AAE7E;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAA4D,wBAAwB,CAAC;AAE1H;;;;;GAKG;AACH,gEAAgE;AAChE,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,eAAwB,EAAE,OAA6B;IACvG,IAAI,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,4BAA4B,IAAI,kBAAkB,CAAC,CAAC;IACpE,CAAC;IAED,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE;QAC/B,eAAe;QACf,OAAO;KACV,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,gEAAgE;AAChE,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAChD,OAAO,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { GLTFLoader } from \"./glTFLoader\";\r\nimport type { IGLTFLoaderExtension } from \"./glTFLoaderExtension\";\r\n\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\ninterface IRegisteredGLTFExtension {\r\n isGLTFExtension: boolean;\r\n factory: GLTFExtensionFactory;\r\n}\r\n\r\nexport type GLTFExtensionFactory = (loader: GLTFLoader) => IGLTFLoaderExtension | Promise<IGLTFLoaderExtension>;\r\n\r\nconst RegisteredGLTFExtensions = new Map<string, IRegisteredGLTFExtension>();\r\n\r\n/**\r\n * All currently registered glTF 2.0 loader extensions.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const registeredGLTFExtensions: ReadonlyMap<string, Readonly<IRegisteredGLTFExtension>> = RegisteredGLTFExtensions;\r\n\r\n/**\r\n * Registers a loader extension.\r\n * @param name The name of the loader extension.\r\n * @param isGLTFExtension If the loader extension is a glTF extension, then it will only be used for glTF files that use the corresponding glTF extension. Otherwise, it will be used for all loaded glTF files.\r\n * @param factory The factory function that creates the loader extension.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function registerGLTFExtension(name: string, isGLTFExtension: boolean, factory: GLTFExtensionFactory): void {\r\n if (unregisterGLTFExtension(name)) {\r\n Logger.Warn(`Extension with the name '${name}' already exists`);\r\n }\r\n\r\n RegisteredGLTFExtensions.set(name, {\r\n isGLTFExtension,\r\n factory,\r\n });\r\n}\r\n\r\n/**\r\n * Unregisters a loader extension.\r\n * @param name The name of the loader extension.\r\n * @returns A boolean indicating whether the extension has been unregistered\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function unregisterGLTFExtension(name: string): boolean {\r\n return RegisteredGLTFExtensions.delete(name);\r\n}\r\n"]}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
|
|
2
|
+
import type { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
|
|
3
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
|
4
|
+
import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
5
|
+
import type { Buffer, VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
|
6
|
+
import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
|
7
|
+
import type { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
8
|
+
import type { Camera } from "@babylonjs/core/Cameras/camera.js";
|
|
9
|
+
import type { Light } from "@babylonjs/core/Lights/light.js";
|
|
10
|
+
import type * as GLTF2 from "babylonjs-gltf2interface";
|
|
11
|
+
/**
|
|
12
|
+
* Loader interface with an index field.
|
|
13
|
+
*/
|
|
14
|
+
export interface IArrayItem {
|
|
15
|
+
/**
|
|
16
|
+
* The index of this item in the array.
|
|
17
|
+
*/
|
|
18
|
+
index: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Loader interface with additional members.
|
|
22
|
+
*/
|
|
23
|
+
export interface IAccessor extends GLTF2.IAccessor, IArrayItem {
|
|
24
|
+
/** @internal */
|
|
25
|
+
_data?: Promise<ArrayBufferView>;
|
|
26
|
+
/** @internal */
|
|
27
|
+
_babylonVertexBuffer?: {
|
|
28
|
+
[kind: string]: Promise<VertexBuffer>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Loader interface with additional members.
|
|
33
|
+
*/
|
|
34
|
+
export interface IAnimationChannel extends GLTF2.IAnimationChannel, IArrayItem {
|
|
35
|
+
}
|
|
36
|
+
/** @internal */
|
|
37
|
+
export interface _IAnimationSamplerData {
|
|
38
|
+
/** @internal */
|
|
39
|
+
input: Float32Array;
|
|
40
|
+
/** @internal */
|
|
41
|
+
interpolation: GLTF2.AnimationSamplerInterpolation;
|
|
42
|
+
/** @internal */
|
|
43
|
+
output: Float32Array;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Loader interface with additional members.
|
|
47
|
+
*/
|
|
48
|
+
export interface IAnimationSampler extends GLTF2.IAnimationSampler, IArrayItem {
|
|
49
|
+
/** @internal */
|
|
50
|
+
_data?: Promise<_IAnimationSamplerData>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Loader interface with additional members.
|
|
54
|
+
*/
|
|
55
|
+
export interface IAnimation extends GLTF2.IAnimation, IArrayItem {
|
|
56
|
+
/** @internal */
|
|
57
|
+
channels: IAnimationChannel[];
|
|
58
|
+
/** @internal */
|
|
59
|
+
samplers: IAnimationSampler[];
|
|
60
|
+
/** @internal */
|
|
61
|
+
_babylonAnimationGroup?: AnimationGroup;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Loader interface with additional members.
|
|
65
|
+
*/
|
|
66
|
+
export interface IBuffer extends GLTF2.IBuffer, IArrayItem {
|
|
67
|
+
/** @internal */
|
|
68
|
+
_data?: Promise<ArrayBufferView>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Loader interface with additional members.
|
|
72
|
+
*/
|
|
73
|
+
export interface IBufferView extends GLTF2.IBufferView, IArrayItem {
|
|
74
|
+
/** @internal */
|
|
75
|
+
_data?: Promise<ArrayBufferView>;
|
|
76
|
+
/** @internal */
|
|
77
|
+
_babylonBuffer?: Promise<Buffer>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Loader interface with additional members.
|
|
81
|
+
*/
|
|
82
|
+
export interface ICamera extends GLTF2.ICamera, IArrayItem {
|
|
83
|
+
/** @internal */
|
|
84
|
+
_babylonCamera?: Camera;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Loader interface with additional members.
|
|
88
|
+
*/
|
|
89
|
+
export interface IImage extends GLTF2.IImage, IArrayItem {
|
|
90
|
+
/** @internal */
|
|
91
|
+
_data?: Promise<ArrayBufferView>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Loader interface with additional members.
|
|
95
|
+
*/
|
|
96
|
+
export interface IMaterialNormalTextureInfo extends GLTF2.IMaterialNormalTextureInfo, ITextureInfo {
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Loader interface with additional members.
|
|
100
|
+
*/
|
|
101
|
+
export interface IMaterialOcclusionTextureInfo extends GLTF2.IMaterialOcclusionTextureInfo, ITextureInfo {
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Loader interface with additional members.
|
|
105
|
+
*/
|
|
106
|
+
export interface IMaterialPbrMetallicRoughness extends GLTF2.IMaterialPbrMetallicRoughness {
|
|
107
|
+
/** @internal */
|
|
108
|
+
baseColorTexture?: ITextureInfo;
|
|
109
|
+
/** @internal */
|
|
110
|
+
metallicRoughnessTexture?: ITextureInfo;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Loader interface with additional members.
|
|
114
|
+
*/
|
|
115
|
+
export interface IMaterial extends GLTF2.IMaterial, IArrayItem {
|
|
116
|
+
/** @internal */
|
|
117
|
+
pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
|
|
118
|
+
/** @internal */
|
|
119
|
+
normalTexture?: IMaterialNormalTextureInfo;
|
|
120
|
+
/** @internal */
|
|
121
|
+
occlusionTexture?: IMaterialOcclusionTextureInfo;
|
|
122
|
+
/** @internal */
|
|
123
|
+
emissiveTexture?: ITextureInfo;
|
|
124
|
+
/** @internal */
|
|
125
|
+
_data?: {
|
|
126
|
+
[babylonDrawMode: number]: {
|
|
127
|
+
babylonMaterial: Material;
|
|
128
|
+
babylonMeshes: AbstractMesh[];
|
|
129
|
+
promise: Promise<void>;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Loader interface with additional members.
|
|
135
|
+
*/
|
|
136
|
+
export interface IMesh extends GLTF2.IMesh, IArrayItem {
|
|
137
|
+
/** @internal */
|
|
138
|
+
primitives: IMeshPrimitive[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Loader interface with additional members.
|
|
142
|
+
*/
|
|
143
|
+
export interface IMeshPrimitive extends GLTF2.IMeshPrimitive, IArrayItem {
|
|
144
|
+
/** @internal */
|
|
145
|
+
_instanceData?: {
|
|
146
|
+
babylonSourceMesh: Mesh;
|
|
147
|
+
promise: Promise<any>;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Loader interface with additional members.
|
|
152
|
+
*/
|
|
153
|
+
export interface INode extends GLTF2.INode, IArrayItem {
|
|
154
|
+
/** @internal */
|
|
155
|
+
parent?: INode;
|
|
156
|
+
/** @internal */
|
|
157
|
+
_babylonTransformNode?: TransformNode;
|
|
158
|
+
/** @internal */
|
|
159
|
+
_babylonTransformNodeForSkin?: TransformNode;
|
|
160
|
+
/** @internal */
|
|
161
|
+
_primitiveBabylonMeshes?: AbstractMesh[];
|
|
162
|
+
/** @internal */
|
|
163
|
+
_numMorphTargets?: number;
|
|
164
|
+
/** @internal */
|
|
165
|
+
_isJoint?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/** @internal */
|
|
168
|
+
export interface _ISamplerData {
|
|
169
|
+
/** @internal */
|
|
170
|
+
noMipMaps: boolean;
|
|
171
|
+
/** @internal */
|
|
172
|
+
samplingMode: number;
|
|
173
|
+
/** @internal */
|
|
174
|
+
wrapU: number;
|
|
175
|
+
/** @internal */
|
|
176
|
+
wrapV: number;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Loader interface with additional members.
|
|
180
|
+
*/
|
|
181
|
+
export interface ISampler extends GLTF2.ISampler, IArrayItem {
|
|
182
|
+
/** @internal */
|
|
183
|
+
_data?: _ISamplerData;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Loader interface with additional members.
|
|
187
|
+
*/
|
|
188
|
+
export interface IScene extends GLTF2.IScene, IArrayItem {
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Loader interface with additional members.
|
|
192
|
+
*/
|
|
193
|
+
export interface ISkin extends GLTF2.ISkin, IArrayItem {
|
|
194
|
+
/** @internal */
|
|
195
|
+
_data?: {
|
|
196
|
+
babylonSkeleton: Skeleton;
|
|
197
|
+
promise: Promise<void>;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Loader interface with additional members.
|
|
202
|
+
*/
|
|
203
|
+
export interface ITexture extends GLTF2.ITexture, IArrayItem {
|
|
204
|
+
/** @internal */
|
|
205
|
+
_textureInfo: ITextureInfo;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Loader interface with additional members.
|
|
209
|
+
*/
|
|
210
|
+
export interface ITextureInfo extends GLTF2.ITextureInfo {
|
|
211
|
+
/** false or undefined if the texture holds color data (true if data are roughness, normal, ...) */
|
|
212
|
+
nonColorData?: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Loader interface with additional members.
|
|
216
|
+
*/
|
|
217
|
+
export interface IGLTF extends GLTF2.IGLTF {
|
|
218
|
+
/** @internal */
|
|
219
|
+
accessors?: IAccessor[];
|
|
220
|
+
/** @internal */
|
|
221
|
+
animations?: IAnimation[];
|
|
222
|
+
/** @internal */
|
|
223
|
+
buffers?: IBuffer[];
|
|
224
|
+
/** @internal */
|
|
225
|
+
bufferViews?: IBufferView[];
|
|
226
|
+
/** @internal */
|
|
227
|
+
cameras?: ICamera[];
|
|
228
|
+
/** @internal */
|
|
229
|
+
images?: IImage[];
|
|
230
|
+
/** @internal */
|
|
231
|
+
materials?: IMaterial[];
|
|
232
|
+
/** @internal */
|
|
233
|
+
meshes?: IMesh[];
|
|
234
|
+
/** @internal */
|
|
235
|
+
nodes?: INode[];
|
|
236
|
+
/** @internal */
|
|
237
|
+
samplers?: ISampler[];
|
|
238
|
+
/** @internal */
|
|
239
|
+
scenes?: IScene[];
|
|
240
|
+
/** @internal */
|
|
241
|
+
skins?: ISkin[];
|
|
242
|
+
/** @internal */
|
|
243
|
+
textures?: ITexture[];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Loader interface with additional members.
|
|
247
|
+
*/
|
|
248
|
+
/** @internal */
|
|
249
|
+
export interface IKHRLightsPunctual_Light extends GLTF2.IKHRLightsPunctual_Light, IArrayItem {
|
|
250
|
+
/** @hidden */
|
|
251
|
+
_babylonLight?: Light;
|
|
252
|
+
}
|
|
253
|
+
/** @internal */
|
|
254
|
+
export interface IEXTLightsIES_Light extends GLTF2.IEXTLightsIES_Light, IArrayItem {
|
|
255
|
+
/** @hidden */
|
|
256
|
+
_babylonLight?: Light;
|
|
257
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport type { Skeleton } from \"core/Bones/skeleton\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Buffer, VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport type { Light } from \"core/Lights/light\";\r\n\r\nimport type * 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 /** @internal */\r\n _data?: Promise<ArrayBufferView>;\r\n\r\n /** @internal */\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/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface _IAnimationSamplerData {\r\n /** @internal */\r\n input: Float32Array;\r\n\r\n /** @internal */\r\n interpolation: GLTF2.AnimationSamplerInterpolation;\r\n\r\n /** @internal */\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 /** @internal */\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 /** @internal */\r\n channels: IAnimationChannel[];\r\n\r\n /** @internal */\r\n samplers: IAnimationSampler[];\r\n\r\n /** @internal */\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 /** @internal */\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 /** @internal */\r\n _data?: Promise<ArrayBufferView>;\r\n\r\n /** @internal */\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 /** @internal */\r\n _babylonCamera?: Camera;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IImage extends GLTF2.IImage, IArrayItem {\r\n /** @internal */\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 /** @internal */\r\n baseColorTexture?: ITextureInfo;\r\n\r\n /** @internal */\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 /** @internal */\r\n pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;\r\n\r\n /** @internal */\r\n normalTexture?: IMaterialNormalTextureInfo;\r\n\r\n /** @internal */\r\n occlusionTexture?: IMaterialOcclusionTextureInfo;\r\n\r\n /** @internal */\r\n emissiveTexture?: ITextureInfo;\r\n\r\n /** @internal */\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 /** @internal */\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 /** @internal */\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 /** @internal */\r\n parent?: INode;\r\n\r\n /** @internal */\r\n _babylonTransformNode?: TransformNode;\r\n\r\n /** @internal */\r\n _babylonTransformNodeForSkin?: TransformNode;\r\n\r\n /** @internal */\r\n _primitiveBabylonMeshes?: AbstractMesh[];\r\n\r\n /** @internal */\r\n _numMorphTargets?: number;\r\n\r\n /** @internal */\r\n _isJoint?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface _ISamplerData {\r\n /** @internal */\r\n noMipMaps: boolean;\r\n\r\n /** @internal */\r\n samplingMode: number;\r\n\r\n /** @internal */\r\n wrapU: number;\r\n\r\n /** @internal */\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 /** @internal */\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 /** @internal */\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 /** @internal */\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 /** @internal */\r\n accessors?: IAccessor[];\r\n\r\n /** @internal */\r\n animations?: IAnimation[];\r\n\r\n /** @internal */\r\n buffers?: IBuffer[];\r\n\r\n /** @internal */\r\n bufferViews?: IBufferView[];\r\n\r\n /** @internal */\r\n cameras?: ICamera[];\r\n\r\n /** @internal */\r\n images?: IImage[];\r\n\r\n /** @internal */\r\n materials?: IMaterial[];\r\n\r\n /** @internal */\r\n meshes?: IMesh[];\r\n\r\n /** @internal */\r\n nodes?: INode[];\r\n\r\n /** @internal */\r\n samplers?: ISampler[];\r\n\r\n /** @internal */\r\n scenes?: IScene[];\r\n\r\n /** @internal */\r\n skins?: ISkin[];\r\n\r\n /** @internal */\r\n textures?: ITexture[];\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface IKHRLightsPunctual_Light extends GLTF2.IKHRLightsPunctual_Light, IArrayItem {\r\n /** @hidden */\r\n _babylonLight?: Light;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface IEXTLightsIES_Light extends GLTF2.IEXTLightsIES_Light, IArrayItem {\r\n /** @hidden */\r\n _babylonLight?: Light;\r\n}\r\n"]}
|