@babylonjs/serializers 5.0.0-rc.7 → 5.0.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 +1 -1
- package/OBJ/index.js +1 -1
- package/OBJ/objSerializer.d.ts +21 -21
- package/OBJ/objSerializer.js +174 -174
- package/OBJ/objSerializer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -41
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +189 -189
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -24
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +90 -90
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +24 -24
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +20 -20
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +51 -51
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +30 -30
- package/glTF/2.0/Extensions/KHR_texture_transform.js +137 -137
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +5 -5
- package/glTF/2.0/Extensions/index.js +5 -5
- package/glTF/2.0/glTFAnimation.d.ts +206 -205
- package/glTF/2.0/glTFAnimation.js +852 -852
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFData.d.ts +19 -19
- package/glTF/2.0/glTFData.js +52 -52
- package/glTF/2.0/glTFExporter.d.ts +456 -455
- package/glTF/2.0/glTFExporter.js +1975 -1972
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFExporterExtension.d.ts +74 -74
- package/glTF/2.0/glTFExporterExtension.js +3 -3
- package/glTF/2.0/glTFExporterExtension.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +208 -207
- package/glTF/2.0/glTFMaterialExporter.js +1114 -1114
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFSerializer.d.ts +60 -60
- package/glTF/2.0/glTFSerializer.js +62 -62
- package/glTF/2.0/glTFSerializer.js.map +1 -1
- package/glTF/2.0/glTFUtilities.d.ts +99 -97
- package/glTF/2.0/glTFUtilities.js +196 -196
- package/glTF/2.0/glTFUtilities.js.map +1 -1
- package/glTF/2.0/index.d.ts +8 -8
- package/glTF/2.0/index.js +9 -8
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/2.0/shaders/textureTransform.fragment.d.ts +5 -5
- package/glTF/2.0/shaders/textureTransform.fragment.js +8 -8
- package/glTF/glTFFileExporter.d.ts +20 -20
- package/glTF/glTFFileExporter.js +3 -3
- package/glTF/index.d.ts +2 -2
- package/glTF/index.js +3 -2
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF2Serializer.d.ts +2 -2
- package/legacy/legacy-glTF2Serializer.js +44 -43
- package/legacy/legacy-glTF2Serializer.js.map +1 -1
- package/legacy/legacy-objSerializer.d.ts +1 -1
- package/legacy/legacy-objSerializer.js +13 -12
- package/legacy/legacy-objSerializer.js.map +1 -1
- package/legacy/legacy-stlSerializer.d.ts +1 -1
- package/legacy/legacy-stlSerializer.js +13 -12
- package/legacy/legacy-stlSerializer.js.map +1 -1
- package/legacy/legacy.d.ts +4 -4
- package/legacy/legacy.js +6 -5
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
- package/stl/index.d.ts +1 -1
- package/stl/index.js +1 -1
- package/stl/stlSerializer.d.ts +17 -17
- package/stl/stlSerializer.js +107 -107
- package/stl/stlSerializer.js.map +1 -1
|
@@ -1,205 +1,206 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @param
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @param minMaxFrames
|
|
135
|
-
* @param minMaxFrames.
|
|
136
|
-
* @param
|
|
137
|
-
* @param
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
private static
|
|
141
|
-
private static
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
* @param
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
150
|
-
* @param
|
|
151
|
-
* @param
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*
|
|
157
|
-
* @param
|
|
158
|
-
* @param
|
|
159
|
-
* @param
|
|
160
|
-
* @param
|
|
161
|
-
* @param
|
|
162
|
-
* @param
|
|
163
|
-
* @param
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
private static
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
* @param
|
|
171
|
-
* @param
|
|
172
|
-
* @param
|
|
173
|
-
* @param
|
|
174
|
-
* @param
|
|
175
|
-
* @param
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*
|
|
181
|
-
* @param
|
|
182
|
-
* @param
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* @param
|
|
190
|
-
* @param
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
194
|
-
* @param
|
|
195
|
-
* @param
|
|
196
|
-
* @param
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*
|
|
202
|
-
* @
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
1
|
+
import type { IAnimation, INode, IBufferView, IAccessor } from "babylonjs-gltf2interface/.js";
|
|
2
|
+
import { AnimationSamplerInterpolation, AnimationChannelTargetPath, AccessorType } from "babylonjs-gltf2interface/.js";
|
|
3
|
+
import type { Node } from "@babylonjs/core/node.js";
|
|
4
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
5
|
+
import { Animation } from "@babylonjs/core/Animations/animation.js";
|
|
6
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
7
|
+
import type { Scene } from "@babylonjs/core/scene.js";
|
|
8
|
+
import type { _BinaryWriter } from "./glTFExporter";
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
* Interface to store animation data.
|
|
12
|
+
*/
|
|
13
|
+
export interface _IAnimationData {
|
|
14
|
+
/**
|
|
15
|
+
* Keyframe data.
|
|
16
|
+
*/
|
|
17
|
+
inputs: number[];
|
|
18
|
+
/**
|
|
19
|
+
* Value data.
|
|
20
|
+
*/
|
|
21
|
+
outputs: number[][];
|
|
22
|
+
/**
|
|
23
|
+
* Animation interpolation data.
|
|
24
|
+
*/
|
|
25
|
+
samplerInterpolation: AnimationSamplerInterpolation;
|
|
26
|
+
/**
|
|
27
|
+
* Minimum keyframe value.
|
|
28
|
+
*/
|
|
29
|
+
inputsMin: number;
|
|
30
|
+
/**
|
|
31
|
+
* Maximum keyframe value.
|
|
32
|
+
*/
|
|
33
|
+
inputsMax: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
export interface _IAnimationInfo {
|
|
39
|
+
/**
|
|
40
|
+
* The target channel for the animation
|
|
41
|
+
*/
|
|
42
|
+
animationChannelTargetPath: AnimationChannelTargetPath;
|
|
43
|
+
/**
|
|
44
|
+
* The glTF accessor type for the data.
|
|
45
|
+
*/
|
|
46
|
+
dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4 | AccessorType.SCALAR;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies if quaternions should be used.
|
|
49
|
+
*/
|
|
50
|
+
useQuaternion: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
* Utility class for generating glTF animation data from BabylonJS.
|
|
55
|
+
*/
|
|
56
|
+
export declare class _GLTFAnimation {
|
|
57
|
+
/**
|
|
58
|
+
* @ignore
|
|
59
|
+
*
|
|
60
|
+
* Creates glTF channel animation from BabylonJS animation.
|
|
61
|
+
* @param babylonTransformNode - BabylonJS mesh.
|
|
62
|
+
* @param animation - animation.
|
|
63
|
+
* @param animationChannelTargetPath - The target animation channel.
|
|
64
|
+
* @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
|
|
65
|
+
* @param useQuaternion - Specifies if quaternions are used.
|
|
66
|
+
* @returns nullable IAnimationData
|
|
67
|
+
*/
|
|
68
|
+
static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
|
|
69
|
+
private static _DeduceAnimationInfo;
|
|
70
|
+
/**
|
|
71
|
+
* @ignore
|
|
72
|
+
* Create node animations from the transform node animations
|
|
73
|
+
* @param babylonNode
|
|
74
|
+
* @param runtimeGLTFAnimation
|
|
75
|
+
* @param idleGLTFAnimations
|
|
76
|
+
* @param nodeMap
|
|
77
|
+
* @param nodes
|
|
78
|
+
* @param binaryWriter
|
|
79
|
+
* @param bufferViews
|
|
80
|
+
* @param accessors
|
|
81
|
+
* @param convertToRightHandedSystem
|
|
82
|
+
* @param animationSampleRate
|
|
83
|
+
*/
|
|
84
|
+
static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
|
|
85
|
+
[key: number]: number;
|
|
86
|
+
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* @ignore
|
|
89
|
+
* Create individual morph animations from the mesh's morph target animation tracks
|
|
90
|
+
* @param babylonNode
|
|
91
|
+
* @param runtimeGLTFAnimation
|
|
92
|
+
* @param idleGLTFAnimations
|
|
93
|
+
* @param nodeMap
|
|
94
|
+
* @param nodes
|
|
95
|
+
* @param binaryWriter
|
|
96
|
+
* @param bufferViews
|
|
97
|
+
* @param accessors
|
|
98
|
+
* @param convertToRightHandedSystem
|
|
99
|
+
* @param animationSampleRate
|
|
100
|
+
*/
|
|
101
|
+
static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
|
|
102
|
+
[key: number]: number;
|
|
103
|
+
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
|
|
104
|
+
/**
|
|
105
|
+
* @ignore
|
|
106
|
+
* Create node and morph animations from the animation groups
|
|
107
|
+
* @param babylonScene
|
|
108
|
+
* @param glTFAnimations
|
|
109
|
+
* @param nodeMap
|
|
110
|
+
* @param nodes
|
|
111
|
+
* @param binaryWriter
|
|
112
|
+
* @param bufferViews
|
|
113
|
+
* @param accessors
|
|
114
|
+
* @param convertToRightHandedSystemMap
|
|
115
|
+
* @param animationSampleRate
|
|
116
|
+
*/
|
|
117
|
+
static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: {
|
|
118
|
+
[key: number]: number;
|
|
119
|
+
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystemMap: {
|
|
120
|
+
[nodeId: number]: boolean;
|
|
121
|
+
}, animationSampleRate: number): void;
|
|
122
|
+
private static _AddAnimation;
|
|
123
|
+
/**
|
|
124
|
+
* Create a baked animation
|
|
125
|
+
* @param babylonTransformNode BabylonJS mesh
|
|
126
|
+
* @param animation BabylonJS animation corresponding to the BabylonJS mesh
|
|
127
|
+
* @param animationChannelTargetPath animation target channel
|
|
128
|
+
* @param minFrame minimum animation frame
|
|
129
|
+
* @param maxFrame maximum animation frame
|
|
130
|
+
* @param fps frames per second of the animation
|
|
131
|
+
* @param sampleRate
|
|
132
|
+
* @param inputs input key frames of the animation
|
|
133
|
+
* @param outputs output key frame data of the animation
|
|
134
|
+
* @param minMaxFrames
|
|
135
|
+
* @param minMaxFrames.min
|
|
136
|
+
* @param minMaxFrames.max
|
|
137
|
+
* @param convertToRightHandedSystem converts the values to right-handed
|
|
138
|
+
* @param useQuaternion specifies if quaternions should be used
|
|
139
|
+
*/
|
|
140
|
+
private static _CreateBakedAnimation;
|
|
141
|
+
private static _ConvertFactorToVector3OrQuaternion;
|
|
142
|
+
private static _SetInterpolatedValue;
|
|
143
|
+
/**
|
|
144
|
+
* Creates linear animation from the animation key frames
|
|
145
|
+
* @param babylonTransformNode BabylonJS mesh
|
|
146
|
+
* @param animation BabylonJS animation
|
|
147
|
+
* @param animationChannelTargetPath The target animation channel
|
|
148
|
+
* @param frameDelta The difference between the last and first frame of the animation
|
|
149
|
+
* @param inputs Array to store the key frame times
|
|
150
|
+
* @param outputs Array to store the key frame data
|
|
151
|
+
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
152
|
+
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
153
|
+
*/
|
|
154
|
+
private static _CreateLinearOrStepAnimation;
|
|
155
|
+
/**
|
|
156
|
+
* Creates cubic spline animation from the animation key frames
|
|
157
|
+
* @param babylonTransformNode BabylonJS mesh
|
|
158
|
+
* @param animation BabylonJS animation
|
|
159
|
+
* @param animationChannelTargetPath The target animation channel
|
|
160
|
+
* @param frameDelta The difference between the last and first frame of the animation
|
|
161
|
+
* @param inputs Array to store the key frame times
|
|
162
|
+
* @param outputs Array to store the key frame data
|
|
163
|
+
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
164
|
+
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
165
|
+
*/
|
|
166
|
+
private static _CreateCubicSplineAnimation;
|
|
167
|
+
private static _GetBasePositionRotationOrScale;
|
|
168
|
+
/**
|
|
169
|
+
* Adds a key frame value
|
|
170
|
+
* @param keyFrame
|
|
171
|
+
* @param animation
|
|
172
|
+
* @param outputs
|
|
173
|
+
* @param animationChannelTargetPath
|
|
174
|
+
* @param babylonTransformNode
|
|
175
|
+
* @param convertToRightHandedSystem
|
|
176
|
+
* @param useQuaternion
|
|
177
|
+
*/
|
|
178
|
+
private static _AddKeyframeValue;
|
|
179
|
+
/**
|
|
180
|
+
* Determine the interpolation based on the key frames
|
|
181
|
+
* @param keyFrames
|
|
182
|
+
* @param animationChannelTargetPath
|
|
183
|
+
* @param useQuaternion
|
|
184
|
+
*/
|
|
185
|
+
private static _DeduceInterpolation;
|
|
186
|
+
/**
|
|
187
|
+
* Adds an input tangent or output tangent to the output data
|
|
188
|
+
* If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion
|
|
189
|
+
* @param babylonTransformNode
|
|
190
|
+
* @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)
|
|
191
|
+
* @param outputs The animation data by keyframe
|
|
192
|
+
* @param animationChannelTargetPath The target animation channel
|
|
193
|
+
* @param interpolation The interpolation type
|
|
194
|
+
* @param keyFrame The key frame with the animation data
|
|
195
|
+
* @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
|
|
196
|
+
* @param useQuaternion Specifies if quaternions are used
|
|
197
|
+
* @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
|
|
198
|
+
*/
|
|
199
|
+
private static _AddSplineTangent;
|
|
200
|
+
/**
|
|
201
|
+
* Get the minimum and maximum key frames' frame values
|
|
202
|
+
* @param keyFrames animation key frames
|
|
203
|
+
* @returns the minimum and maximum key frame value
|
|
204
|
+
*/
|
|
205
|
+
private static _CalculateMinMaxKeyFrames;
|
|
206
|
+
}
|