@babylonjs/loaders 9.22.2 → 9.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OBJ/objFileLoader.metadata.d.ts +5 -1
- package/OBJ/objFileLoader.metadata.js +4 -1
- package/OBJ/objFileLoader.metadata.js.map +1 -1
- package/OBJ/objFileLoader.pure.d.ts +12 -3
- package/OBJ/objFileLoader.pure.js +30 -2
- package/OBJ/objFileLoader.pure.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +6 -0
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/SPLAT/gaussianSplattingStream.d.ts +162 -15
- package/SPLAT/gaussianSplattingStream.js +523 -96
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/dynamic.js +16 -6
- package/dynamic.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +15 -4
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +19 -6
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +19 -6
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.d.ts +5 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js +19 -6
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js.map +1 -1
- package/glTF/2.0/Extensions/dynamic.js +54 -41
- package/glTF/2.0/Extensions/dynamic.js.map +1 -1
- package/glTF/2.0/glTFLoader.pure.d.ts +1 -1
- package/glTF/2.0/glTFLoader.pure.js +4 -3
- package/glTF/2.0/glTFLoader.pure.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.d.ts +1 -42
- package/glTF/2.0/glTFLoaderAnimation.js +3 -79
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.pure.d.ts +47 -0
- package/glTF/2.0/glTFLoaderAnimation.pure.js +91 -0
- package/glTF/2.0/glTFLoaderAnimation.pure.js.map +1 -0
- package/glTF/2.0/pure.d.ts +1 -0
- package/glTF/2.0/pure.js +1 -0
- package/glTF/2.0/pure.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
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,
|
|
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,MAAa,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IACzF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAS,MAAM,CAAC,gBAAiB,CAAC,CAAC;IAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;IACxC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,gBAAgB;AAChB,MAAM,OAAgB,qBAAqB;IACvC,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,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"]}
|
package/glTF/2.0/pure.d.ts
CHANGED
|
@@ -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";
|
package/glTF/2.0/pure.js.map
CHANGED
|
@@ -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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/loaders",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.23.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babylonjs/core": "9.
|
|
21
|
+
"@babylonjs/core": "9.23.0",
|
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
|
23
23
|
"@dev/loaders": "^1.0.0",
|
|
24
|
-
"babylonjs-gltf2interface": "9.
|
|
24
|
+
"babylonjs-gltf2interface": "9.23.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@babylonjs/core": "^9.0.0",
|