@babylonjs/serializers 8.24.2 → 8.25.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/BVH/bvhSerializer.d.ts +12 -0
- package/BVH/bvhSerializer.js +237 -0
- package/BVH/bvhSerializer.js.map +1 -0
- package/BVH/index.d.ts +1 -0
- package/BVH/index.js +2 -0
- package/BVH/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/legacy/legacy-bvhSerializer.d.ts +1 -0
- package/legacy/legacy-bvhSerializer.js +14 -0
- package/legacy/legacy-bvhSerializer.js.map +1 -0
- package/legacy/legacy.d.ts +1 -0
- package/legacy/legacy.js +1 -0
- package/legacy/legacy.js.map +1 -1
- package/package.json +3 -3
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
|
2
|
+
export declare class BVHExporter {
|
3
|
+
static Export(skeleton: Skeleton, animationNames?: string[], frameRate?: number): string;
|
4
|
+
private static _BuildBoneHierarchy;
|
5
|
+
private static _ExportHierarchy;
|
6
|
+
private static _GetBoneOffset;
|
7
|
+
private static _ExportMotionData;
|
8
|
+
private static _CollectFrameValues;
|
9
|
+
private static _GetPositionAtFrame;
|
10
|
+
private static _GetRotationAtFrame;
|
11
|
+
private static _QuaternionToEuler;
|
12
|
+
}
|
@@ -0,0 +1,237 @@
|
|
1
|
+
import { Vector3, Quaternion, Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
2
|
+
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
3
|
+
import { Epsilon } from "@babylonjs/core/Maths/math.constants.js";
|
4
|
+
export class BVHExporter {
|
5
|
+
static Export(skeleton, animationNames = [], frameRate = 0.03333) {
|
6
|
+
// If no animation names provided, use all available animations
|
7
|
+
let animationsToExport = animationNames;
|
8
|
+
if (!animationNames || animationNames.length === 0) {
|
9
|
+
animationsToExport = skeleton.animations.map((anim) => anim.name);
|
10
|
+
}
|
11
|
+
// Get animation range from the first animation (or create a default one)
|
12
|
+
let animationRange = null;
|
13
|
+
if (animationsToExport.length > 0) {
|
14
|
+
animationRange = skeleton.getAnimationRange(animationsToExport[0]);
|
15
|
+
}
|
16
|
+
if (!animationRange) {
|
17
|
+
// If no animation range found, create a default one or throw error
|
18
|
+
if (skeleton.animations.length > 0) {
|
19
|
+
// Use the first available animation
|
20
|
+
animationRange = skeleton.getAnimationRange(skeleton.animations[0].name);
|
21
|
+
}
|
22
|
+
if (!animationRange) {
|
23
|
+
throw new Error("No animation range found in skeleton");
|
24
|
+
}
|
25
|
+
}
|
26
|
+
// Build bone hierarchy and collect animation data
|
27
|
+
const boneHierarchy = this._BuildBoneHierarchy(skeleton, animationsToExport);
|
28
|
+
const frameCount = animationRange.to - animationRange.from + 1;
|
29
|
+
let exportString = "";
|
30
|
+
exportString += `HIERARCHY\n`;
|
31
|
+
// Export hierarchy recursively
|
32
|
+
exportString += this._ExportHierarchy(boneHierarchy, 0);
|
33
|
+
// Export motion data
|
34
|
+
exportString += `MOTION\n`;
|
35
|
+
exportString += `Frames: ${frameCount}\n`;
|
36
|
+
exportString += `Frame Time: ${frameRate}\n`;
|
37
|
+
exportString += `\n`;
|
38
|
+
// Export frame data
|
39
|
+
exportString += this._ExportMotionData(boneHierarchy, frameCount, animationRange.from, animationsToExport);
|
40
|
+
return exportString;
|
41
|
+
}
|
42
|
+
static _BuildBoneHierarchy(skeleton, animationNames) {
|
43
|
+
const boneMap = new Map();
|
44
|
+
const rootBones = [];
|
45
|
+
// First pass: create bone data objects
|
46
|
+
for (const bone of skeleton.bones) {
|
47
|
+
const boneData = {
|
48
|
+
bone,
|
49
|
+
children: [],
|
50
|
+
hasPositionChannels: false,
|
51
|
+
hasRotationChannels: false,
|
52
|
+
positionKeys: [],
|
53
|
+
rotationKeys: [],
|
54
|
+
};
|
55
|
+
boneMap.set(bone, boneData);
|
56
|
+
}
|
57
|
+
// Second pass: build hierarchy and collect animation data
|
58
|
+
for (const bone of skeleton.bones) {
|
59
|
+
const boneData = boneMap.get(bone);
|
60
|
+
// Check if bone has animations from the specified animation names
|
61
|
+
if (bone.animations.length > 0) {
|
62
|
+
for (const animation of bone.animations) {
|
63
|
+
// Only include animations that are in the specified animation names
|
64
|
+
if (animationNames.includes(animation.name)) {
|
65
|
+
if (animation.targetProperty === "position") {
|
66
|
+
boneData.hasPositionChannels = true;
|
67
|
+
boneData.positionKeys = animation.getKeys();
|
68
|
+
}
|
69
|
+
else if (animation.targetProperty === "rotationQuaternion") {
|
70
|
+
boneData.hasRotationChannels = true;
|
71
|
+
boneData.rotationKeys = animation.getKeys();
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
// Build hierarchy
|
77
|
+
if (bone.getParent()) {
|
78
|
+
const parentData = boneMap.get(bone.getParent());
|
79
|
+
if (parentData) {
|
80
|
+
parentData.children.push(boneData);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
rootBones.push(boneData);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
return rootBones;
|
88
|
+
}
|
89
|
+
static _ExportHierarchy(boneData, indentLevel) {
|
90
|
+
let result = "";
|
91
|
+
// 4 spaces identation for each level
|
92
|
+
const indent = " ".repeat(indentLevel);
|
93
|
+
for (const data of boneData) {
|
94
|
+
const bone = data.bone;
|
95
|
+
// Determine if this is an end site (bone with no children and no animations)
|
96
|
+
if (data.children.length === 0 && !data.hasPositionChannels && !data.hasRotationChannels) {
|
97
|
+
result += `${indent}End Site\n`;
|
98
|
+
result += `${indent}{\n`;
|
99
|
+
const offset = this._GetBoneOffset(bone);
|
100
|
+
result += `${indent} OFFSET ${offset.x.toFixed(6)} ${offset.y.toFixed(6)} ${offset.z.toFixed(6)}\n`;
|
101
|
+
result += `${indent}}\n`;
|
102
|
+
}
|
103
|
+
else {
|
104
|
+
result += `${indent}JOINT ${bone.name}\n`;
|
105
|
+
result += `${indent}{\n`;
|
106
|
+
const offset = this._GetBoneOffset(bone);
|
107
|
+
result += `${indent} OFFSET ${offset.x.toFixed(6)} ${offset.y.toFixed(6)} ${offset.z.toFixed(6)}\n`;
|
108
|
+
// Determine channels
|
109
|
+
const channels = [];
|
110
|
+
if (data.hasPositionChannels) {
|
111
|
+
channels.push("Xposition", "Yposition", "Zposition");
|
112
|
+
}
|
113
|
+
if (data.hasRotationChannels) {
|
114
|
+
// BVH uses ZYX rotation order
|
115
|
+
channels.push("Zrotation", "Xrotation", "Yrotation");
|
116
|
+
}
|
117
|
+
if (channels.length > 0) {
|
118
|
+
result += `${indent} CHANNELS ${channels.length} ${channels.join(" ")}\n`;
|
119
|
+
}
|
120
|
+
result += `${indent}}\n`;
|
121
|
+
}
|
122
|
+
// Export children recursively
|
123
|
+
if (data.children.length > 0) {
|
124
|
+
result += this._ExportHierarchy(data.children, indentLevel + 1);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
return result;
|
128
|
+
}
|
129
|
+
static _GetBoneOffset(bone) {
|
130
|
+
// Get the local offset of the bone from its parent
|
131
|
+
const parent = bone.getParent();
|
132
|
+
if (!parent) {
|
133
|
+
return Vector3.Zero(); // Root bone
|
134
|
+
}
|
135
|
+
// For BVH, we need to get the bone's offset from its parent
|
136
|
+
// This should match the original BVH file's OFFSET values
|
137
|
+
const boneMatrix = bone.getBindMatrix();
|
138
|
+
const parentMatrix = parent.getBindMatrix();
|
139
|
+
// Calculate the relative position
|
140
|
+
const bonePosition = boneMatrix.getTranslation();
|
141
|
+
const parentPosition = parentMatrix.getTranslation();
|
142
|
+
const relativeOffset = bonePosition.subtract(parentPosition);
|
143
|
+
// Return the full 3D offset
|
144
|
+
return relativeOffset;
|
145
|
+
}
|
146
|
+
static _ExportMotionData(boneData, frameCount, startFrame, animationNames) {
|
147
|
+
let result = "";
|
148
|
+
for (let frame = 0; frame < frameCount; frame++) {
|
149
|
+
const frameValues = [];
|
150
|
+
// Collect values for all bones in hierarchy order
|
151
|
+
this._CollectFrameValues(boneData, frame + startFrame, frameValues, animationNames);
|
152
|
+
result += frameValues.map((v) => v.toFixed(6)).join(" ") + "\n";
|
153
|
+
}
|
154
|
+
return result;
|
155
|
+
}
|
156
|
+
static _CollectFrameValues(boneData, frame, values, animationNames) {
|
157
|
+
for (const data of boneData) {
|
158
|
+
// Skip end sites
|
159
|
+
if (data.children.length === 0 && !data.hasPositionChannels && !data.hasRotationChannels) {
|
160
|
+
continue;
|
161
|
+
}
|
162
|
+
// Add position values if available
|
163
|
+
if (data.hasPositionChannels) {
|
164
|
+
const position = this._GetPositionAtFrame(data.positionKeys, frame);
|
165
|
+
values.push(position.x, position.y, position.z);
|
166
|
+
}
|
167
|
+
// Add rotation values if available
|
168
|
+
if (data.hasRotationChannels) {
|
169
|
+
const rotation = this._GetRotationAtFrame(data.rotationKeys, frame);
|
170
|
+
// Convert to Euler angles in ZYX order
|
171
|
+
const euler = this._QuaternionToEuler(rotation);
|
172
|
+
values.push(euler.z, euler.x, euler.y);
|
173
|
+
}
|
174
|
+
// Process children recursively
|
175
|
+
if (data.children.length > 0) {
|
176
|
+
this._CollectFrameValues(data.children, frame, values, animationNames);
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
static _GetPositionAtFrame(keys, frame) {
|
181
|
+
if (keys.length === 0) {
|
182
|
+
return Vector3.Zero();
|
183
|
+
}
|
184
|
+
// Find the appropriate key or interpolate
|
185
|
+
let key1 = keys[0];
|
186
|
+
let key2 = keys[keys.length - 1];
|
187
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
188
|
+
if (keys[i].frame <= frame && keys[i + 1].frame >= frame) {
|
189
|
+
key1 = keys[i];
|
190
|
+
key2 = keys[i + 1];
|
191
|
+
break;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
if (key1.frame === key2.frame) {
|
195
|
+
return key1.value.clone();
|
196
|
+
}
|
197
|
+
const t = (frame - key1.frame) / (key2.frame - key1.frame);
|
198
|
+
return Vector3.Lerp(key1.value, key2.value, t);
|
199
|
+
}
|
200
|
+
static _GetRotationAtFrame(keys, frame) {
|
201
|
+
if (keys.length === 0) {
|
202
|
+
return Quaternion.Identity();
|
203
|
+
}
|
204
|
+
// Find the appropriate key or interpolate
|
205
|
+
let key1 = keys[0];
|
206
|
+
let key2 = keys[keys.length - 1];
|
207
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
208
|
+
if (keys[i].frame <= frame && keys[i + 1].frame >= frame) {
|
209
|
+
key1 = keys[i];
|
210
|
+
key2 = keys[i + 1];
|
211
|
+
break;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
if (key1.frame === key2.frame) {
|
215
|
+
return key1.value.clone();
|
216
|
+
}
|
217
|
+
const t = (frame - key1.frame) / (key2.frame - key1.frame);
|
218
|
+
return Quaternion.Slerp(key1.value, key2.value, t);
|
219
|
+
}
|
220
|
+
static _QuaternionToEuler(quaternion) {
|
221
|
+
// Convert quaternion to Euler angles in ZYX order
|
222
|
+
const matrix = quaternion.toRotationMatrix(new Matrix());
|
223
|
+
let x, y, z;
|
224
|
+
if (Math.abs(matrix.m[6]) < 1 - Epsilon) {
|
225
|
+
x = Math.atan2(-matrix.m[7], matrix.m[8]);
|
226
|
+
y = Math.asin(matrix.m[6]);
|
227
|
+
z = Math.atan2(-matrix.m[3], matrix.m[0]);
|
228
|
+
}
|
229
|
+
else {
|
230
|
+
x = Math.atan2(matrix.m[5], matrix.m[4]);
|
231
|
+
y = Math.asin(matrix.m[6]);
|
232
|
+
z = 0;
|
233
|
+
}
|
234
|
+
return new Vector3(Tools.ToDegrees(x), Tools.ToDegrees(y), Tools.ToDegrees(z));
|
235
|
+
}
|
236
|
+
}
|
237
|
+
//# sourceMappingURL=bvhSerializer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bvhSerializer.js","sourceRoot":"","sources":["../../../../dev/serializers/src/BVH/bvhSerializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,6CAA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"core/Animations\";\nimport { Vector3, Quaternion, Matrix } from \"core/Maths/math.vector\";\nimport { Tools } from \"core/Misc/tools\";\nimport { Epsilon } from \"core/Maths/math.constants\";\n\ninterface IBVHBoneData {\n bone: Bone;\n children: IBVHBoneData[];\n hasPositionChannels: boolean;\n hasRotationChannels: boolean;\n positionKeys: IAnimationKey[];\n rotationKeys: IAnimationKey[];\n}\n\nexport class BVHExporter {\n public static Export(skeleton: Skeleton, animationNames: string[] = [], frameRate: number = 0.03333): string {\n // If no animation names provided, use all available animations\n let animationsToExport = animationNames;\n if (!animationNames || animationNames.length === 0) {\n animationsToExport = skeleton.animations.map((anim) => anim.name);\n }\n\n // Get animation range from the first animation (or create a default one)\n let animationRange = null;\n if (animationsToExport.length > 0) {\n animationRange = skeleton.getAnimationRange(animationsToExport[0]);\n }\n\n if (!animationRange) {\n // If no animation range found, create a default one or throw error\n if (skeleton.animations.length > 0) {\n // Use the first available animation\n animationRange = skeleton.getAnimationRange(skeleton.animations[0].name);\n }\n\n if (!animationRange) {\n throw new Error(\"No animation range found in skeleton\");\n }\n }\n\n // Build bone hierarchy and collect animation data\n const boneHierarchy = this._BuildBoneHierarchy(skeleton, animationsToExport);\n const frameCount = animationRange.to - animationRange.from + 1;\n\n let exportString = \"\";\n exportString += `HIERARCHY\\n`;\n\n // Export hierarchy recursively\n exportString += this._ExportHierarchy(boneHierarchy, 0);\n\n // Export motion data\n exportString += `MOTION\\n`;\n exportString += `Frames: ${frameCount}\\n`;\n exportString += `Frame Time: ${frameRate}\\n`;\n exportString += `\\n`;\n\n // Export frame data\n exportString += this._ExportMotionData(boneHierarchy, frameCount, animationRange.from, animationsToExport);\n\n return exportString;\n }\n\n private static _BuildBoneHierarchy(skeleton: Skeleton, animationNames: string[]): IBVHBoneData[] {\n const boneMap = new Map<Bone, IBVHBoneData>();\n const rootBones: IBVHBoneData[] = [];\n\n // First pass: create bone data objects\n for (const bone of skeleton.bones) {\n const boneData: IBVHBoneData = {\n bone,\n children: [],\n hasPositionChannels: false,\n hasRotationChannels: false,\n positionKeys: [],\n rotationKeys: [],\n };\n boneMap.set(bone, boneData);\n }\n\n // Second pass: build hierarchy and collect animation data\n for (const bone of skeleton.bones) {\n const boneData = boneMap.get(bone)!;\n\n // Check if bone has animations from the specified animation names\n if (bone.animations.length > 0) {\n for (const animation of bone.animations) {\n // Only include animations that are in the specified animation names\n if (animationNames.includes(animation.name)) {\n if (animation.targetProperty === \"position\") {\n boneData.hasPositionChannels = true;\n boneData.positionKeys = animation.getKeys();\n } else if (animation.targetProperty === \"rotationQuaternion\") {\n boneData.hasRotationChannels = true;\n boneData.rotationKeys = animation.getKeys();\n }\n }\n }\n }\n\n // Build hierarchy\n if (bone.getParent()) {\n const parentData = boneMap.get(bone.getParent()!);\n if (parentData) {\n parentData.children.push(boneData);\n }\n } else {\n rootBones.push(boneData);\n }\n }\n\n return rootBones;\n }\n\n private static _ExportHierarchy(boneData: IBVHBoneData[], indentLevel: number): string {\n let result = \"\";\n // 4 spaces identation for each level\n const indent = \" \".repeat(indentLevel);\n\n for (const data of boneData) {\n const bone = data.bone;\n\n // Determine if this is an end site (bone with no children and no animations)\n if (data.children.length === 0 && !data.hasPositionChannels && !data.hasRotationChannels) {\n result += `${indent}End Site\\n`;\n result += `${indent}{\\n`;\n const offset = this._GetBoneOffset(bone);\n result += `${indent} OFFSET ${offset.x.toFixed(6)} ${offset.y.toFixed(6)} ${offset.z.toFixed(6)}\\n`;\n result += `${indent}}\\n`;\n } else {\n result += `${indent}JOINT ${bone.name}\\n`;\n result += `${indent}{\\n`;\n const offset = this._GetBoneOffset(bone);\n result += `${indent} OFFSET ${offset.x.toFixed(6)} ${offset.y.toFixed(6)} ${offset.z.toFixed(6)}\\n`;\n\n // Determine channels\n const channels: string[] = [];\n if (data.hasPositionChannels) {\n channels.push(\"Xposition\", \"Yposition\", \"Zposition\");\n }\n if (data.hasRotationChannels) {\n // BVH uses ZYX rotation order\n channels.push(\"Zrotation\", \"Xrotation\", \"Yrotation\");\n }\n\n if (channels.length > 0) {\n result += `${indent} CHANNELS ${channels.length} ${channels.join(\" \")}\\n`;\n }\n\n result += `${indent}}\\n`;\n }\n\n // Export children recursively\n if (data.children.length > 0) {\n result += this._ExportHierarchy(data.children, indentLevel + 1);\n }\n }\n\n return result;\n }\n\n private static _GetBoneOffset(bone: Bone): Vector3 {\n // Get the local offset of the bone from its parent\n const parent = bone.getParent();\n if (!parent) {\n return Vector3.Zero(); // Root bone\n }\n\n // For BVH, we need to get the bone's offset from its parent\n // This should match the original BVH file's OFFSET values\n const boneMatrix = bone.getBindMatrix();\n const parentMatrix = parent.getBindMatrix();\n\n // Calculate the relative position\n const bonePosition = boneMatrix.getTranslation();\n const parentPosition = parentMatrix.getTranslation();\n const relativeOffset = bonePosition.subtract(parentPosition);\n\n // Return the full 3D offset\n return relativeOffset;\n }\n\n private static _ExportMotionData(boneData: IBVHBoneData[], frameCount: number, startFrame: number, animationNames: string[]): string {\n let result = \"\";\n\n for (let frame = 0; frame < frameCount; frame++) {\n const frameValues: number[] = [];\n\n // Collect values for all bones in hierarchy order\n this._CollectFrameValues(boneData, frame + startFrame, frameValues, animationNames);\n\n result += frameValues.map((v) => v.toFixed(6)).join(\" \") + \"\\n\";\n }\n\n return result;\n }\n\n private static _CollectFrameValues(boneData: IBVHBoneData[], frame: number, values: number[], animationNames: string[]): void {\n for (const data of boneData) {\n // Skip end sites\n if (data.children.length === 0 && !data.hasPositionChannels && !data.hasRotationChannels) {\n continue;\n }\n\n // Add position values if available\n if (data.hasPositionChannels) {\n const position = this._GetPositionAtFrame(data.positionKeys, frame);\n values.push(position.x, position.y, position.z);\n }\n\n // Add rotation values if available\n if (data.hasRotationChannels) {\n const rotation = this._GetRotationAtFrame(data.rotationKeys, frame);\n // Convert to Euler angles in ZYX order\n const euler = this._QuaternionToEuler(rotation);\n values.push(euler.z, euler.x, euler.y);\n }\n\n // Process children recursively\n if (data.children.length > 0) {\n this._CollectFrameValues(data.children, frame, values, animationNames);\n }\n }\n }\n\n private static _GetPositionAtFrame(keys: IAnimationKey[], frame: number): Vector3 {\n if (keys.length === 0) {\n return Vector3.Zero();\n }\n\n // Find the appropriate key or interpolate\n let key1 = keys[0];\n let key2 = keys[keys.length - 1];\n\n for (let i = 0; i < keys.length - 1; i++) {\n if (keys[i].frame <= frame && keys[i + 1].frame >= frame) {\n key1 = keys[i];\n key2 = keys[i + 1];\n break;\n }\n }\n\n if (key1.frame === key2.frame) {\n return key1.value.clone();\n }\n\n const t = (frame - key1.frame) / (key2.frame - key1.frame);\n return Vector3.Lerp(key1.value, key2.value, t);\n }\n\n private static _GetRotationAtFrame(keys: IAnimationKey[], frame: number): Quaternion {\n if (keys.length === 0) {\n return Quaternion.Identity();\n }\n\n // Find the appropriate key or interpolate\n let key1 = keys[0];\n let key2 = keys[keys.length - 1];\n\n for (let i = 0; i < keys.length - 1; i++) {\n if (keys[i].frame <= frame && keys[i + 1].frame >= frame) {\n key1 = keys[i];\n key2 = keys[i + 1];\n break;\n }\n }\n\n if (key1.frame === key2.frame) {\n return key1.value.clone();\n }\n\n const t = (frame - key1.frame) / (key2.frame - key1.frame);\n return Quaternion.Slerp(key1.value, key2.value, t);\n }\n\n private static _QuaternionToEuler(quaternion: Quaternion): Vector3 {\n // Convert quaternion to Euler angles in ZYX order\n const matrix = quaternion.toRotationMatrix(new Matrix());\n\n let x, y, z;\n\n if (Math.abs(matrix.m[6]) < 1 - Epsilon) {\n x = Math.atan2(-matrix.m[7], matrix.m[8]);\n y = Math.asin(matrix.m[6]);\n z = Math.atan2(-matrix.m[3], matrix.m[0]);\n } else {\n x = Math.atan2(matrix.m[5], matrix.m[4]);\n y = Math.asin(matrix.m[6]);\n z = 0;\n }\n\n return new Vector3(Tools.ToDegrees(x), Tools.ToDegrees(y), Tools.ToDegrees(z));\n }\n}\n"]}
|
package/BVH/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./bvhSerializer.js";
|
package/BVH/index.js
ADDED
package/BVH/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/serializers/src/BVH/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./bvhSerializer\";\n"]}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../dev/serializers/src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./OBJ/index\";\r\nexport * from \"./glTF/index\";\r\nexport * from \"./stl/index\";\r\nexport * from \"./USDZ/index\";\r\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../dev/serializers/src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./OBJ/index\";\r\nexport * from \"./glTF/index\";\r\nexport * from \"./stl/index\";\r\nexport * from \"./USDZ/index\";\r\nexport * from \"./BVH/index\";\r\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "../BVH/index.js";
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-restricted-imports */
|
2
|
+
import * as Serializers from "../BVH/index.js";
|
3
|
+
/**
|
4
|
+
* This is the entry point for the UMD module.
|
5
|
+
* The entry point for a future ESM package should be index.ts
|
6
|
+
*/
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
8
|
+
if (typeof globalObject !== "undefined") {
|
9
|
+
for (const serializer in Serializers) {
|
10
|
+
globalObject.BABYLON[serializer] = Serializers[serializer];
|
11
|
+
}
|
12
|
+
}
|
13
|
+
export * from "../BVH/index.js";
|
14
|
+
//# sourceMappingURL=legacy-bvhSerializer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"legacy-bvhSerializer.js","sourceRoot":"","sources":["../../../../lts/serializers/src/legacy/legacy-bvhSerializer.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,KAAK,WAAW,wBAA8B;AAErD;;;GAGG;AACH,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;IACtC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QAC7B,YAAa,CAAC,OAAO,CAAC,UAAU,CAAC,GAAS,WAAY,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;AACL,CAAC;AAED,gCAAsC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport * as Serializers from \"serializers/BVH/index\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\r\nif (typeof globalObject !== \"undefined\") {\r\n for (const serializer in Serializers) {\r\n (<any>globalObject).BABYLON[serializer] = (<any>Serializers)[serializer];\r\n }\r\n}\r\n\r\nexport * from \"serializers/BVH/index\";\r\n"]}
|
package/legacy/legacy.d.ts
CHANGED
package/legacy/legacy.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/* eslint-disable import/export */
|
2
2
|
/* eslint-disable @typescript-eslint/no-restricted-imports */
|
3
3
|
import "../index.js";
|
4
|
+
export * from "./legacy-bvhSerializer.js";
|
4
5
|
export * from "./legacy-glTF2Serializer.js";
|
5
6
|
export * from "./legacy-objSerializer.js";
|
6
7
|
export * from "./legacy-stlSerializer.js";
|
package/legacy/legacy.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../../lts/serializers/src/legacy/legacy.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,6DAA6D;AAC7D,qBAA2B;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC","sourcesContent":["/* eslint-disable import/export */\r\n/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport \"serializers/index\";\r\nexport * from \"./legacy-glTF2Serializer\";\r\nexport * from \"./legacy-objSerializer\";\r\nexport * from \"./legacy-stlSerializer\";\r\nexport * from \"./legacy-usdzSerializer\";\r\n"]}
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../../lts/serializers/src/legacy/legacy.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,6DAA6D;AAC7D,qBAA2B;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC","sourcesContent":["/* eslint-disable import/export */\r\n/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport \"serializers/index\";\r\nexport * from \"./legacy-bvhSerializer\";\r\nexport * from \"./legacy-glTF2Serializer\";\r\nexport * from \"./legacy-objSerializer\";\r\nexport * from \"./legacy-stlSerializer\";\r\nexport * from \"./legacy-usdzSerializer\";\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/serializers",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.25.1",
|
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": "^8.
|
21
|
+
"@babylonjs/core": "^8.25.1",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/serializers": "^1.0.0",
|
24
|
-
"babylonjs-gltf2interface": "^8.
|
24
|
+
"babylonjs-gltf2interface": "^8.25.1"
|
25
25
|
},
|
26
26
|
"peerDependencies": {
|
27
27
|
"@babylonjs/core": "^8.0.0",
|