@babylonjs/loaders 9.22.2 → 9.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/OBJ/objFileLoader.metadata.d.ts +5 -1
  2. package/OBJ/objFileLoader.metadata.js +4 -1
  3. package/OBJ/objFileLoader.metadata.js.map +1 -1
  4. package/OBJ/objFileLoader.pure.d.ts +12 -3
  5. package/OBJ/objFileLoader.pure.js +30 -2
  6. package/OBJ/objFileLoader.pure.js.map +1 -1
  7. package/OBJ/objLoadingOptions.d.ts +6 -0
  8. package/OBJ/objLoadingOptions.js.map +1 -1
  9. package/SPLAT/gaussianSplattingStream.d.ts +162 -15
  10. package/SPLAT/gaussianSplattingStream.js +523 -96
  11. package/SPLAT/gaussianSplattingStream.js.map +1 -1
  12. package/dynamic.js +16 -6
  13. package/dynamic.js.map +1 -1
  14. package/glTF/1.0/glTFBinaryExtension.d.ts +4 -14
  15. package/glTF/1.0/glTFBinaryExtension.js +6 -62
  16. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  17. package/glTF/1.0/glTFBinaryExtension.pure.d.ts +21 -0
  18. package/glTF/1.0/glTFBinaryExtension.pure.js +76 -0
  19. package/glTF/1.0/glTFBinaryExtension.pure.js.map +1 -0
  20. package/glTF/1.0/glTFLoader.d.ts +3 -142
  21. package/glTF/1.0/glTFLoader.js +7 -1840
  22. package/glTF/1.0/glTFLoader.js.map +1 -1
  23. package/glTF/1.0/glTFLoader.pure.d.ts +149 -0
  24. package/glTF/1.0/glTFLoader.pure.js +1854 -0
  25. package/glTF/1.0/glTFLoader.pure.js.map +1 -0
  26. package/glTF/1.0/glTFLoaderUtils.d.ts +2 -2
  27. package/glTF/1.0/glTFLoaderUtils.js +5 -5
  28. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  29. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +4 -11
  30. package/glTF/1.0/glTFMaterialsCommonExtension.js +6 -128
  31. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  32. package/glTF/1.0/glTFMaterialsCommonExtension.pure.d.ts +18 -0
  33. package/glTF/1.0/glTFMaterialsCommonExtension.pure.js +142 -0
  34. package/glTF/1.0/glTFMaterialsCommonExtension.pure.js.map +1 -0
  35. package/glTF/1.0/pure.d.ts +3 -0
  36. package/glTF/1.0/pure.js +3 -0
  37. package/glTF/1.0/pure.js.map +1 -1
  38. package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +0 -1
  39. package/glTF/2.0/Extensions/KHR_animation_pointer.data.d.ts +1 -1
  40. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js +3 -251
  41. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
  42. package/glTF/2.0/Extensions/KHR_animation_pointer.data.pure.d.ts +5 -0
  43. package/glTF/2.0/Extensions/KHR_animation_pointer.data.pure.js +267 -0
  44. package/glTF/2.0/Extensions/KHR_animation_pointer.data.pure.js.map +1 -0
  45. package/glTF/2.0/Extensions/KHR_animation_pointer.js +2 -1
  46. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
  47. package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +5 -0
  48. package/glTF/2.0/Extensions/KHR_interactivity.pure.js +15 -4
  49. package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
  50. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +5 -0
  51. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +19 -6
  52. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
  53. package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +5 -0
  54. package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +19 -6
  55. package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
  56. package/glTF/2.0/Extensions/KHR_node_visibility.pure.d.ts +5 -0
  57. package/glTF/2.0/Extensions/KHR_node_visibility.pure.js +19 -6
  58. package/glTF/2.0/Extensions/KHR_node_visibility.pure.js.map +1 -1
  59. package/glTF/2.0/Extensions/dynamic.js +59 -42
  60. package/glTF/2.0/Extensions/dynamic.js.map +1 -1
  61. package/glTF/2.0/Extensions/pure.d.ts +1 -0
  62. package/glTF/2.0/Extensions/pure.js +1 -0
  63. package/glTF/2.0/Extensions/pure.js.map +1 -1
  64. package/glTF/2.0/glTFLoader.pure.d.ts +2 -2
  65. package/glTF/2.0/glTFLoader.pure.js +6 -5
  66. package/glTF/2.0/glTFLoader.pure.js.map +1 -1
  67. package/glTF/2.0/glTFLoaderAnimation.d.ts +1 -42
  68. package/glTF/2.0/glTFLoaderAnimation.js +3 -79
  69. package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
  70. package/glTF/2.0/glTFLoaderAnimation.pure.d.ts +47 -0
  71. package/glTF/2.0/glTFLoaderAnimation.pure.js +91 -0
  72. package/glTF/2.0/glTFLoaderAnimation.pure.js.map +1 -0
  73. package/glTF/2.0/pure.d.ts +1 -0
  74. package/glTF/2.0/pure.js +1 -0
  75. package/glTF/2.0/pure.js.map +1 -1
  76. package/glTF/glTFFileLoader.pure.d.ts +8 -4
  77. package/glTF/glTFFileLoader.pure.js +13 -6
  78. package/glTF/glTFFileLoader.pure.js.map +1 -1
  79. package/package.json +3 -4
  80. /package/{bvh → BVH}/license.md +0 -0
@@ -1,42 +1 @@
1
- import { Animation } from "@babylonjs/core/Animations/animation.pure.js";
2
- import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
3
- import { type INode } from "./glTFLoaderInterfaces.js";
4
- import { type IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
5
- /** @internal */
6
- export type GetValueFn = (target: any, source: Float32Array, offset: number, scale: number) => any;
7
- /** @internal */
8
- export declare function getVector3(_target: any, source: Float32Array, offset: number, scale: number): Vector3;
9
- /** @internal */
10
- export declare function getQuaternion(_target: any, source: Float32Array, offset: number, scale: number): Quaternion;
11
- /** @internal */
12
- export declare function getWeights(target: INode, source: Float32Array, offset: number, scale: number): Array<number>;
13
- /** @internal */
14
- export declare abstract class AnimationPropertyInfo {
15
- readonly type: number;
16
- readonly name: string;
17
- readonly getValue: GetValueFn;
18
- readonly getStride: (target: any) => number;
19
- /** @internal */
20
- constructor(type: number, name: string, getValue: GetValueFn, getStride: (target: any) => number);
21
- protected _buildAnimation(name: string, fps: number, keys: any[]): Animation;
22
- /** @internal */
23
- abstract buildAnimations(target: any, name: string, fps: number, keys: any[]): {
24
- babylonAnimatable: IAnimatable;
25
- babylonAnimation: Animation;
26
- }[];
27
- }
28
- /** @internal */
29
- export declare class TransformNodeAnimationPropertyInfo extends AnimationPropertyInfo {
30
- /** @internal */
31
- buildAnimations(target: INode, name: string, fps: number, keys: any[]): {
32
- babylonAnimatable: IAnimatable;
33
- babylonAnimation: Animation;
34
- }[];
35
- }
36
- /** @internal */
37
- export declare class WeightAnimationPropertyInfo extends AnimationPropertyInfo {
38
- buildAnimations(target: INode, name: string, fps: number, keys: any[]): {
39
- babylonAnimatable: IAnimatable;
40
- babylonAnimation: Animation;
41
- }[];
42
- }
1
+ export * from "./glTFLoaderAnimation.pure.js";
@@ -1,80 +1,4 @@
1
- import { Animation } from "@babylonjs/core/Animations/animation.pure.js";
2
- import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.pure.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, true);
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
- })), true);
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)]);
1
+ export * from "./glTFLoaderAnimation.pure.js";
2
+ import { RegisterGLTFLoaderAnimation } from "./glTFLoaderAnimation.pure.js";
3
+ RegisterGLTFLoaderAnimation();
80
4
  //# sourceMappingURL=glTFLoaderAnimation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glTFLoaderAnimation.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderAnimation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAKzE,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,UAAU,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IACxF,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAC3F,OAAO,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC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AAC,kBAAkB,EAAE,CAAC;4BACjC,MAAM,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;4BAC1E,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC;4BACvD,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;4BACnD,iBAAiB,CAAC,IAAI,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC,CAAC;wBACxG,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ;AAED,sBAAsB,CAAC,uBAAuB,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5J,sBAAsB,CAAC,oBAAoB,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzK,sBAAsB,CAAC,iBAAiB,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,qBAAqB,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrJ,sBAAsB,CAAC,mBAAmB,EAAE,CAAC,IAAI,2BAA2B,CAAC,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAiB,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { Animation } from \"core/Animations/animation.pure\";\r\nimport { Quaternion, Vector3 } from \"core/Maths/math.vector.pure\";\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, true);\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 true\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"]}
1
+ {"version":3,"file":"glTFLoaderAnimation.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderAnimation.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,2BAA2B,EAAE,CAAC","sourcesContent":["export * from \"./glTFLoaderAnimation.pure\";\n\nimport { RegisterGLTFLoaderAnimation } from \"./glTFLoaderAnimation.pure\";\n\nRegisterGLTFLoaderAnimation();\n"]}
@@ -0,0 +1,47 @@
1
+ /** This file must only contain pure code and pure imports */
2
+ import { Animation } from "@babylonjs/core/Animations/animation.pure.js";
3
+ import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
4
+ import { type INode } from "./glTFLoaderInterfaces.js";
5
+ import { type IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
6
+ /** @internal */
7
+ export type GetValueFn = (target: any, source: Float32Array, offset: number, scale: number) => any;
8
+ /** @internal */
9
+ export declare function getVector3(_target: any, source: Float32Array, offset: number, scale: number): Vector3;
10
+ /** @internal */
11
+ export declare function getQuaternion(_target: any, source: Float32Array, offset: number, scale: number): Quaternion;
12
+ /** @internal */
13
+ export declare function getWeights(target: INode, source: Float32Array, offset: number, scale: number): Array<number>;
14
+ /** @internal */
15
+ export declare abstract class AnimationPropertyInfo {
16
+ readonly type: number;
17
+ readonly name: string;
18
+ readonly getValue: GetValueFn;
19
+ readonly getStride: (target: any) => number;
20
+ /** @internal */
21
+ constructor(type: number, name: string, getValue: GetValueFn, getStride: (target: any) => number);
22
+ protected _buildAnimation(name: string, fps: number, keys: any[]): Animation;
23
+ /** @internal */
24
+ abstract buildAnimations(target: any, name: string, fps: number, keys: any[]): {
25
+ babylonAnimatable: IAnimatable;
26
+ babylonAnimation: Animation;
27
+ }[];
28
+ }
29
+ /** @internal */
30
+ export declare class TransformNodeAnimationPropertyInfo extends AnimationPropertyInfo {
31
+ /** @internal */
32
+ buildAnimations(target: INode, name: string, fps: number, keys: any[]): {
33
+ babylonAnimatable: IAnimatable;
34
+ babylonAnimation: Animation;
35
+ }[];
36
+ }
37
+ /** @internal */
38
+ export declare class WeightAnimationPropertyInfo extends AnimationPropertyInfo {
39
+ buildAnimations(target: INode, name: string, fps: number, keys: any[]): {
40
+ babylonAnimatable: IAnimatable;
41
+ babylonAnimation: Animation;
42
+ }[];
43
+ }
44
+ /**
45
+ * Registers the core glTF animation interpolation mappings.
46
+ */
47
+ export declare function RegisterGLTFLoaderAnimation(): void;
@@ -0,0 +1,91 @@
1
+ /** This file must only contain pure code and pure imports */
2
+ import { Animation } from "@babylonjs/core/Animations/animation.pure.js";
3
+ import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
4
+ import { SetInterpolationForKey } from "./Extensions/objectModelMapping.js";
5
+ /** @internal */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export function getVector3(_target, source, offset, scale) {
8
+ return Vector3.FromArray(source, offset).scaleInPlace(scale);
9
+ }
10
+ /** @internal */
11
+ // eslint-disable-next-line @typescript-eslint/naming-convention
12
+ export function getQuaternion(_target, source, offset, scale) {
13
+ return Quaternion.FromArray(source, offset).scaleInPlace(scale);
14
+ }
15
+ /** @internal */
16
+ // eslint-disable-next-line @typescript-eslint/naming-convention
17
+ export function getWeights(target, source, offset, scale) {
18
+ const value = new Array(target._numMorphTargets);
19
+ for (let i = 0; i < value.length; i++) {
20
+ value[i] = source[offset++] * scale;
21
+ }
22
+ return value;
23
+ }
24
+ /** @internal */
25
+ export class AnimationPropertyInfo {
26
+ /** @internal */
27
+ constructor(type, name, getValue, getStride) {
28
+ this.type = type;
29
+ this.name = name;
30
+ this.getValue = getValue;
31
+ this.getStride = getStride;
32
+ }
33
+ _buildAnimation(name, fps, keys) {
34
+ const babylonAnimation = new Animation(name, this.name, fps, this.type);
35
+ babylonAnimation.setKeys(keys, true);
36
+ return babylonAnimation;
37
+ }
38
+ }
39
+ /** @internal */
40
+ export class TransformNodeAnimationPropertyInfo extends AnimationPropertyInfo {
41
+ /** @internal */
42
+ buildAnimations(target, name, fps, keys) {
43
+ const babylonAnimations = [];
44
+ babylonAnimations.push({ babylonAnimatable: target._babylonTransformNode, babylonAnimation: this._buildAnimation(name, fps, keys) });
45
+ return babylonAnimations;
46
+ }
47
+ }
48
+ /** @internal */
49
+ export class WeightAnimationPropertyInfo extends AnimationPropertyInfo {
50
+ buildAnimations(target, name, fps, keys) {
51
+ const babylonAnimations = [];
52
+ if (target._numMorphTargets) {
53
+ for (let targetIndex = 0; targetIndex < target._numMorphTargets; targetIndex++) {
54
+ const babylonAnimation = new Animation(`${name}_${targetIndex}`, this.name, fps, this.type);
55
+ babylonAnimation.setKeys(keys.map((key) => ({
56
+ frame: key.frame,
57
+ inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,
58
+ value: key.value[targetIndex],
59
+ outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,
60
+ interpolation: key.interpolation,
61
+ })), true);
62
+ if (target._primitiveBabylonMeshes) {
63
+ for (const babylonMesh of target._primitiveBabylonMeshes) {
64
+ if (babylonMesh.morphTargetManager) {
65
+ const morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
66
+ const babylonAnimationClone = babylonAnimation.clone();
67
+ morphTarget.animations.push(babylonAnimationClone);
68
+ babylonAnimations.push({ babylonAnimatable: morphTarget, babylonAnimation: babylonAnimationClone });
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ return babylonAnimations;
75
+ }
76
+ }
77
+ let _Registered = false;
78
+ /**
79
+ * Registers the core glTF animation interpolation mappings.
80
+ */
81
+ export function RegisterGLTFLoaderAnimation() {
82
+ if (_Registered) {
83
+ return;
84
+ }
85
+ _Registered = true;
86
+ SetInterpolationForKey("/nodes/{}/translation", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, "position", getVector3, () => 3)]);
87
+ SetInterpolationForKey("/nodes/{}/rotation", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_QUATERNION, "rotationQuaternion", getQuaternion, () => 4)]);
88
+ SetInterpolationForKey("/nodes/{}/scale", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, "scaling", getVector3, () => 3)]);
89
+ SetInterpolationForKey("/nodes/{}/weights", [new WeightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, "influence", getWeights, (target) => target._numMorphTargets)]);
90
+ }
91
+ //# sourceMappingURL=glTFLoaderAnimation.pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glTFLoaderAnimation.pure.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/glTFLoaderAnimation.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAKzE,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,UAAU,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IACxF,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAC3F,OAAO,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,UAAU,CAAC,MAA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C1E,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC;4BACvD,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;4BACnD,iBAAiB,CAAC,IAAI,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC,CAAC;wBACxG,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACvC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,sBAAsB,CAAC,uBAAuB,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5J,sBAAsB,CAAC,oBAAoB,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzK,sBAAsB,CAAC,iBAAiB,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,qBAAqB,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrJ,sBAAsB,CAAC,mBAAmB,EAAE,CAAC,IAAI,2BAA2B,CAAC,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAiB,CAAC,CAAC,CAAC,CAAC;AACjL,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { Animation } from \"core/Animations/animation.pure\";\r\nimport { Quaternion, Vector3 } from \"core/Maths/math.vector.pure\";\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, true);\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 true\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\nlet _Registered = false;\r\n\r\n/**\r\n * Registers the core glTF animation interpolation mappings.\r\n */\r\nexport function RegisterGLTFLoaderAnimation(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n SetInterpolationForKey(\"/nodes/{}/translation\", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, \"position\", getVector3, () => 3)]);\r\n SetInterpolationForKey(\"/nodes/{}/rotation\", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_QUATERNION, \"rotationQuaternion\", getQuaternion, () => 4)]);\r\n SetInterpolationForKey(\"/nodes/{}/scale\", [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, \"scaling\", getVector3, () => 3)]);\r\n SetInterpolationForKey(\"/nodes/{}/weights\", [new WeightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"influence\", getWeights, (target) => target._numMorphTargets!)]);\r\n}\r\n"]}
@@ -3,6 +3,7 @@ export * from "./glTFLoader.pure.js";
3
3
  export * from "./glTFLoaderExtension.js";
4
4
  export * from "./glTFLoaderExtensionRegistry.js";
5
5
  export * from "./glTFLoaderInterfaces.js";
6
+ export * from "./glTFLoaderAnimation.pure.js";
6
7
  export * from "./openpbrMaterialLoadingAdapter.js";
7
8
  export * from "./pbrMaterialLoadingAdapter.js";
8
9
  export * from "./Extensions/pure.js";
package/glTF/2.0/pure.js CHANGED
@@ -4,6 +4,7 @@ export * from "./glTFLoader.pure.js";
4
4
  export * from "./glTFLoaderExtension.js";
5
5
  export * from "./glTFLoaderExtensionRegistry.js";
6
6
  export * from "./glTFLoaderInterfaces.js";
7
+ export * from "./glTFLoaderAnimation.pure.js";
7
8
  export * from "./openpbrMaterialLoadingAdapter.js";
8
9
  export * from "./pbrMaterialLoadingAdapter.js";
9
10
  export * from "./Extensions/pure.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./glTFLoader.pure\";\nexport * from \"./glTFLoaderExtension\";\nexport * from \"./glTFLoaderExtensionRegistry\";\nexport * from \"./glTFLoaderInterfaces\";\nexport * from \"./openpbrMaterialLoadingAdapter\";\nexport * from \"./pbrMaterialLoadingAdapter\";\nexport * from \"./Extensions/pure\";\n"]}
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./glTFLoader.pure\";\nexport * from \"./glTFLoaderExtension\";\nexport * from \"./glTFLoaderExtensionRegistry\";\nexport * from \"./glTFLoaderInterfaces\";\nexport * from \"./glTFLoaderAnimation.pure\";\nexport * from \"./openpbrMaterialLoadingAdapter\";\nexport * from \"./pbrMaterialLoadingAdapter\";\nexport * from \"./Extensions/pure\";\n"]}
@@ -289,11 +289,13 @@ declare abstract class GLTFLoaderOptions extends GLTFLoaderBaseOptions {
289
289
  */
290
290
  abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
291
291
  /**
292
- * Function called before loading a url referenced by the asset.
293
- * @param url url referenced by the asset
294
- * @returns Async url to load
292
+ * Function called before loading a URL referenced by the asset.
293
+ * Setting this function allows parent-relative asset URIs and makes the callback responsible for URI safety.
294
+ * @param url The URL referenced by the asset
295
+ * @param rootUrl The root URL of the asset, if available
296
+ * @returns A promise that resolves to the URL to load
295
297
  */
296
- preprocessUrlAsync: (url: string) => Promise<string>;
298
+ preprocessUrlAsync: (url: string, rootUrl?: string) => Promise<string>;
297
299
  }
298
300
  /**
299
301
  * File loader for loading glTF files into a scene.
@@ -308,6 +310,8 @@ export declare class GLTFFileLoader extends GLTFLoaderOptions implements IDispos
308
310
  * @param options The options for the loader
309
311
  */
310
312
  constructor(options?: Partial<Readonly<GLTFLoaderOptions>>);
313
+ /** @internal */
314
+ get _isPreprocessUrlAsyncSet(): boolean;
311
315
  /**
312
316
  * Raised when the asset has been parsed
313
317
  */
@@ -80,6 +80,7 @@ export var GLTFLoaderState;
80
80
  */
81
81
  GLTFLoaderState[GLTFLoaderState["COMPLETE"] = 2] = "COMPLETE";
82
82
  })(GLTFLoaderState || (GLTFLoaderState = {}));
83
+ const DefaultPreprocessUrlAsync = (url) => Promise.resolve(url);
83
84
  /**
84
85
  * This class contains all the concrete (not abstract) glTF options, excluding callbacks.
85
86
  * The purpose of this class is to make it easy to provide a way to mutate the default
@@ -215,11 +216,13 @@ class GLTFLoaderOptions extends GLTFLoaderBaseOptions {
215
216
  */
216
217
  this.extensionOptions = {};
217
218
  /**
218
- * Function called before loading a url referenced by the asset.
219
- * @param url url referenced by the asset
220
- * @returns Async url to load
219
+ * Function called before loading a URL referenced by the asset.
220
+ * Setting this function allows parent-relative asset URIs and makes the callback responsible for URI safety.
221
+ * @param url The URL referenced by the asset
222
+ * @param rootUrl The root URL of the asset, if available
223
+ * @returns A promise that resolves to the URL to load
221
224
  */
222
- this.preprocessUrlAsync = (url) => Promise.resolve(url);
225
+ this.preprocessUrlAsync = DefaultPreprocessUrlAsync;
223
226
  }
224
227
  // eslint-disable-next-line babylonjs/available
225
228
  copyFrom(options) {
@@ -353,6 +356,10 @@ export class GLTFFileLoader extends GLTFLoaderOptions {
353
356
  this._endPerformanceCounter = this._endPerformanceCounterDisabled;
354
357
  this.copyFrom(Object.assign({ ...GLTFLoaderDefaultOptions }, options));
355
358
  }
359
+ /** @internal */
360
+ get _isPreprocessUrlAsyncSet() {
361
+ return this.preprocessUrlAsync !== DefaultPreprocessUrlAsync;
362
+ }
356
363
  /**
357
364
  * Raised when the asset has been parsed
358
365
  */
@@ -519,7 +526,7 @@ export class GLTFFileLoader extends GLTFLoaderOptions {
519
526
  }
520
527
  this._requests.length = 0;
521
528
  delete this._progressCallback;
522
- this.preprocessUrlAsync = (url) => Promise.resolve(url);
529
+ this.preprocessUrlAsync = DefaultPreprocessUrlAsync;
523
530
  this.onMeshLoadedObservable.clear();
524
531
  this.onSkinLoadedObservable.clear();
525
532
  this.onTextureLoadedObservable.clear();
@@ -776,7 +783,7 @@ export class GLTFFileLoader extends GLTFLoaderOptions {
776
783
  }
777
784
  this._startPerformanceCounter("Validate JSON");
778
785
  GLTFValidation.ValidateAsync(data, rootUrl, fileName, (uri) => {
779
- return this.preprocessUrlAsync(rootUrl + uri).then((url) => {
786
+ return this.preprocessUrlAsync(rootUrl + uri, rootUrl).then((url) => {
780
787
  return scene._loadFileAsync(url, undefined, true, true).then((data) => {
781
788
  return new Uint8Array(data, 0, data.byteLength);
782
789
  });