@babylonjs/serializers 5.45.2 → 5.46.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/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +8 -8
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +5 -5
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/glTFAnimation.js +43 -43
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFData.js +2 -2
- package/glTF/2.0/glTFData.js.map +1 -1
- package/glTF/2.0/glTFExporter.js +78 -78
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.js +36 -36
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFUtilities.js +7 -7
- package/package.json +3 -3
package/glTF/2.0/glTFExporter.js
CHANGED
@@ -23,46 +23,6 @@ const convertHandednessMatrix = Matrix.Compose(new Vector3(-1, 1, 1), Quaternion
|
|
23
23
|
* @internal
|
24
24
|
*/
|
25
25
|
export class _Exporter {
|
26
|
-
/**
|
27
|
-
* Creates a glTF Exporter instance, which can accept optional exporter options
|
28
|
-
* @param babylonScene Babylon scene object
|
29
|
-
* @param options Options to modify the behavior of the exporter
|
30
|
-
*/
|
31
|
-
constructor(babylonScene, options) {
|
32
|
-
/*
|
33
|
-
* Specifies if root Babylon empty nodes that act as a coordinate space transform should be included in export
|
34
|
-
*/
|
35
|
-
this._includeCoordinateSystemConversionNodes = false;
|
36
|
-
this._extensions = {};
|
37
|
-
this._glTF = {
|
38
|
-
asset: { generator: `Babylon.js v${Engine.Version}`, version: "2.0" },
|
39
|
-
};
|
40
|
-
babylonScene = babylonScene || EngineStore.LastCreatedScene;
|
41
|
-
if (!babylonScene) {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
this._babylonScene = babylonScene;
|
45
|
-
this._bufferViews = [];
|
46
|
-
this._accessors = [];
|
47
|
-
this._meshes = [];
|
48
|
-
this._scenes = [];
|
49
|
-
this._cameras = [];
|
50
|
-
this._nodes = [];
|
51
|
-
this._images = [];
|
52
|
-
this._materials = [];
|
53
|
-
this._materialMap = [];
|
54
|
-
this._textures = [];
|
55
|
-
this._samplers = [];
|
56
|
-
this._skins = [];
|
57
|
-
this._animations = [];
|
58
|
-
this._imageData = {};
|
59
|
-
this._orderedImageData = [];
|
60
|
-
this._options = options || {};
|
61
|
-
this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
|
62
|
-
this._includeCoordinateSystemConversionNodes = options && options.includeCoordinateSystemConversionNodes ? true : false;
|
63
|
-
this._glTFMaterialExporter = new _GLTFMaterialExporter(this);
|
64
|
-
this._loadExtensions();
|
65
|
-
}
|
66
26
|
_applyExtension(node, extensions, index, actionAsync) {
|
67
27
|
if (index >= extensions.length) {
|
68
28
|
return Promise.resolve(node);
|
@@ -153,6 +113,46 @@ export class _Exporter {
|
|
153
113
|
this._extensions[name] = extension;
|
154
114
|
}
|
155
115
|
}
|
116
|
+
/**
|
117
|
+
* Creates a glTF Exporter instance, which can accept optional exporter options
|
118
|
+
* @param babylonScene Babylon scene object
|
119
|
+
* @param options Options to modify the behavior of the exporter
|
120
|
+
*/
|
121
|
+
constructor(babylonScene, options) {
|
122
|
+
/*
|
123
|
+
* Specifies if root Babylon empty nodes that act as a coordinate space transform should be included in export
|
124
|
+
*/
|
125
|
+
this._includeCoordinateSystemConversionNodes = false;
|
126
|
+
this._extensions = {};
|
127
|
+
this._glTF = {
|
128
|
+
asset: { generator: `Babylon.js v${Engine.Version}`, version: "2.0" },
|
129
|
+
};
|
130
|
+
babylonScene = babylonScene || EngineStore.LastCreatedScene;
|
131
|
+
if (!babylonScene) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
this._babylonScene = babylonScene;
|
135
|
+
this._bufferViews = [];
|
136
|
+
this._accessors = [];
|
137
|
+
this._meshes = [];
|
138
|
+
this._scenes = [];
|
139
|
+
this._cameras = [];
|
140
|
+
this._nodes = [];
|
141
|
+
this._images = [];
|
142
|
+
this._materials = [];
|
143
|
+
this._materialMap = [];
|
144
|
+
this._textures = [];
|
145
|
+
this._samplers = [];
|
146
|
+
this._skins = [];
|
147
|
+
this._animations = [];
|
148
|
+
this._imageData = {};
|
149
|
+
this._orderedImageData = [];
|
150
|
+
this._options = options || {};
|
151
|
+
this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
|
152
|
+
this._includeCoordinateSystemConversionNodes = options && options.includeCoordinateSystemConversionNodes ? true : false;
|
153
|
+
this._glTFMaterialExporter = new _GLTFMaterialExporter(this);
|
154
|
+
this._loadExtensions();
|
155
|
+
}
|
156
156
|
dispose() {
|
157
157
|
for (const extensionKey in this._extensions) {
|
158
158
|
const extension = this._extensions[extensionKey];
|
@@ -598,19 +598,19 @@ export class _Exporter {
|
|
598
598
|
}
|
599
599
|
let writeBinaryFunc;
|
600
600
|
switch (attributeComponentKind) {
|
601
|
-
case 5121 /* UNSIGNED_BYTE */: {
|
601
|
+
case 5121 /* AccessorComponentType.UNSIGNED_BYTE */: {
|
602
602
|
writeBinaryFunc = binaryWriter.setUInt8.bind(binaryWriter);
|
603
603
|
break;
|
604
604
|
}
|
605
|
-
case 5123 /* UNSIGNED_SHORT */: {
|
605
|
+
case 5123 /* AccessorComponentType.UNSIGNED_SHORT */: {
|
606
606
|
writeBinaryFunc = binaryWriter.setUInt16.bind(binaryWriter);
|
607
607
|
break;
|
608
608
|
}
|
609
|
-
case 5125 /* UNSIGNED_INT */: {
|
609
|
+
case 5125 /* AccessorComponentType.UNSIGNED_INT */: {
|
610
610
|
writeBinaryFunc = binaryWriter.setUInt32.bind(binaryWriter);
|
611
611
|
break;
|
612
612
|
}
|
613
|
-
case 5126 /* FLOAT */: {
|
613
|
+
case 5126 /* AccessorComponentType.FLOAT */: {
|
614
614
|
writeBinaryFunc = binaryWriter.setFloat32.bind(binaryWriter);
|
615
615
|
break;
|
616
616
|
}
|
@@ -699,19 +699,19 @@ export class _Exporter {
|
|
699
699
|
}
|
700
700
|
let writeBinaryFunc;
|
701
701
|
switch (attributeComponentKind) {
|
702
|
-
case 5121 /* UNSIGNED_BYTE */: {
|
702
|
+
case 5121 /* AccessorComponentType.UNSIGNED_BYTE */: {
|
703
703
|
writeBinaryFunc = binaryWriter.setUInt8.bind(binaryWriter);
|
704
704
|
break;
|
705
705
|
}
|
706
|
-
case 5123 /* UNSIGNED_SHORT */: {
|
706
|
+
case 5123 /* AccessorComponentType.UNSIGNED_SHORT */: {
|
707
707
|
writeBinaryFunc = binaryWriter.setUInt16.bind(binaryWriter);
|
708
708
|
break;
|
709
709
|
}
|
710
|
-
case 5125 /* UNSIGNED_INT */: {
|
710
|
+
case 5125 /* AccessorComponentType.UNSIGNED_INT */: {
|
711
711
|
writeBinaryFunc = binaryWriter.setUInt32.bind(binaryWriter);
|
712
712
|
break;
|
713
713
|
}
|
714
|
-
case 5126 /* FLOAT */: {
|
714
|
+
case 5126 /* AccessorComponentType.FLOAT */: {
|
715
715
|
writeBinaryFunc = binaryWriter.setFloat32.bind(binaryWriter);
|
716
716
|
break;
|
717
717
|
}
|
@@ -1056,10 +1056,10 @@ export class _Exporter {
|
|
1056
1056
|
const bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, babylonMorphTarget.name + "_NORMAL");
|
1057
1057
|
this._bufferViews.push(bufferView);
|
1058
1058
|
const bufferViewIndex = this._bufferViews.length - 1;
|
1059
|
-
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "NORMAL", "VEC3" /* VEC3 */, 5126 /* FLOAT */, count, 0, null, null);
|
1059
|
+
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "NORMAL", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
1060
1060
|
this._accessors.push(accessor);
|
1061
1061
|
target.NORMAL = this._accessors.length - 1;
|
1062
|
-
this.writeMorphTargetAttributeData(VertexBuffer.NormalKind, 5126 /* FLOAT */, babylonSubMesh, babylonMorphTarget, vertexNormals, morphNormals, byteStride / 4, binaryWriter, convertToRightHandedSystem);
|
1062
|
+
this.writeMorphTargetAttributeData(VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, babylonMorphTarget, vertexNormals, morphNormals, byteStride / 4, binaryWriter, convertToRightHandedSystem);
|
1063
1063
|
}
|
1064
1064
|
if (babylonMorphTarget.hasPositions) {
|
1065
1065
|
const vertexPositions = babylonSubMesh.getMesh().getVerticesData(VertexBuffer.PositionKind);
|
@@ -1071,10 +1071,10 @@ export class _Exporter {
|
|
1071
1071
|
this._bufferViews.push(bufferView);
|
1072
1072
|
const bufferViewIndex = this._bufferViews.length - 1;
|
1073
1073
|
const minMax = { min: new Vector3(Infinity, Infinity, Infinity), max: new Vector3(-Infinity, -Infinity, -Infinity) };
|
1074
|
-
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "POSITION", "VEC3" /* VEC3 */, 5126 /* FLOAT */, count, 0, null, null);
|
1074
|
+
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "POSITION", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
1075
1075
|
this._accessors.push(accessor);
|
1076
1076
|
target.POSITION = this._accessors.length - 1;
|
1077
|
-
this.writeMorphTargetAttributeData(VertexBuffer.PositionKind, 5126 /* FLOAT */, babylonSubMesh, babylonMorphTarget, vertexPositions, morphPositions, byteStride / 4, binaryWriter, convertToRightHandedSystem, minMax);
|
1077
|
+
this.writeMorphTargetAttributeData(VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, babylonMorphTarget, vertexPositions, morphPositions, byteStride / 4, binaryWriter, convertToRightHandedSystem, minMax);
|
1078
1078
|
accessor.min = minMax.min.asArray();
|
1079
1079
|
accessor.max = minMax.max.asArray();
|
1080
1080
|
}
|
@@ -1087,10 +1087,10 @@ export class _Exporter {
|
|
1087
1087
|
const bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, babylonMorphTarget.name + "_NORMAL");
|
1088
1088
|
this._bufferViews.push(bufferView);
|
1089
1089
|
const bufferViewIndex = this._bufferViews.length - 1;
|
1090
|
-
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "TANGENT", "VEC3" /* VEC3 */, 5126 /* FLOAT */, count, 0, null, null);
|
1090
|
+
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "TANGENT", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
1091
1091
|
this._accessors.push(accessor);
|
1092
1092
|
target.TANGENT = this._accessors.length - 1;
|
1093
|
-
this.writeMorphTargetAttributeData(VertexBuffer.TangentKind, 5126 /* FLOAT */, babylonSubMesh, babylonMorphTarget, vertexTangents, morphTangents, byteStride / 4, binaryWriter, convertToRightHandedSystem);
|
1093
|
+
this.writeMorphTargetAttributeData(VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, babylonMorphTarget, vertexTangents, morphTangents, byteStride / 4, binaryWriter, convertToRightHandedSystem);
|
1094
1094
|
}
|
1095
1095
|
meshPrimitive.targets.push(target);
|
1096
1096
|
}
|
@@ -1117,31 +1117,31 @@ export class _Exporter {
|
|
1117
1117
|
break;
|
1118
1118
|
}
|
1119
1119
|
case Material.TriangleStripDrawMode: {
|
1120
|
-
meshPrimitive.mode = 5 /* TRIANGLE_STRIP */;
|
1120
|
+
meshPrimitive.mode = 5 /* MeshPrimitiveMode.TRIANGLE_STRIP */;
|
1121
1121
|
break;
|
1122
1122
|
}
|
1123
1123
|
case Material.TriangleFanDrawMode: {
|
1124
|
-
meshPrimitive.mode = 6 /* TRIANGLE_FAN */;
|
1124
|
+
meshPrimitive.mode = 6 /* MeshPrimitiveMode.TRIANGLE_FAN */;
|
1125
1125
|
break;
|
1126
1126
|
}
|
1127
1127
|
case Material.PointListDrawMode: {
|
1128
|
-
meshPrimitive.mode = 0 /* POINTS */;
|
1128
|
+
meshPrimitive.mode = 0 /* MeshPrimitiveMode.POINTS */;
|
1129
1129
|
break;
|
1130
1130
|
}
|
1131
1131
|
case Material.PointFillMode: {
|
1132
|
-
meshPrimitive.mode = 0 /* POINTS */;
|
1132
|
+
meshPrimitive.mode = 0 /* MeshPrimitiveMode.POINTS */;
|
1133
1133
|
break;
|
1134
1134
|
}
|
1135
1135
|
case Material.LineLoopDrawMode: {
|
1136
|
-
meshPrimitive.mode = 2 /* LINE_LOOP */;
|
1136
|
+
meshPrimitive.mode = 2 /* MeshPrimitiveMode.LINE_LOOP */;
|
1137
1137
|
break;
|
1138
1138
|
}
|
1139
1139
|
case Material.LineListDrawMode: {
|
1140
|
-
meshPrimitive.mode = 1 /* LINES */;
|
1140
|
+
meshPrimitive.mode = 1 /* MeshPrimitiveMode.LINES */;
|
1141
1141
|
break;
|
1142
1142
|
}
|
1143
1143
|
case Material.LineStripDrawMode: {
|
1144
|
-
meshPrimitive.mode = 3 /* LINE_STRIP */;
|
1144
|
+
meshPrimitive.mode = 3 /* MeshPrimitiveMode.LINE_STRIP */;
|
1145
1145
|
break;
|
1146
1146
|
}
|
1147
1147
|
}
|
@@ -1219,16 +1219,16 @@ export class _Exporter {
|
|
1219
1219
|
bufferMesh = babylonTransformNode.sourceMesh;
|
1220
1220
|
}
|
1221
1221
|
const attributeData = [
|
1222
|
-
{ kind: VertexBuffer.PositionKind, accessorType: "VEC3" /* VEC3 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 12 },
|
1223
|
-
{ kind: VertexBuffer.NormalKind, accessorType: "VEC3" /* VEC3 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 12 },
|
1224
|
-
{ kind: VertexBuffer.ColorKind, accessorType: "VEC4" /* VEC4 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 16 },
|
1225
|
-
{ kind: VertexBuffer.TangentKind, accessorType: "VEC4" /* VEC4 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 16 },
|
1226
|
-
{ kind: VertexBuffer.UVKind, accessorType: "VEC2" /* VEC2 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 8 },
|
1227
|
-
{ kind: VertexBuffer.UV2Kind, accessorType: "VEC2" /* VEC2 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 8 },
|
1228
|
-
{ kind: VertexBuffer.MatricesIndicesKind, accessorType: "VEC4" /* VEC4 */, accessorComponentType: 5123 /* UNSIGNED_SHORT */, byteStride: 8 },
|
1229
|
-
{ kind: VertexBuffer.MatricesIndicesExtraKind, accessorType: "VEC4" /* VEC4 */, accessorComponentType: 5123 /* UNSIGNED_SHORT */, byteStride: 8 },
|
1230
|
-
{ kind: VertexBuffer.MatricesWeightsKind, accessorType: "VEC4" /* VEC4 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 16 },
|
1231
|
-
{ kind: VertexBuffer.MatricesWeightsExtraKind, accessorType: "VEC4" /* VEC4 */, accessorComponentType: 5126 /* FLOAT */, byteStride: 16 },
|
1222
|
+
{ kind: VertexBuffer.PositionKind, accessorType: "VEC3" /* AccessorType.VEC3 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 12 },
|
1223
|
+
{ kind: VertexBuffer.NormalKind, accessorType: "VEC3" /* AccessorType.VEC3 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 12 },
|
1224
|
+
{ kind: VertexBuffer.ColorKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
1225
|
+
{ kind: VertexBuffer.TangentKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
1226
|
+
{ kind: VertexBuffer.UVKind, accessorType: "VEC2" /* AccessorType.VEC2 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 8 },
|
1227
|
+
{ kind: VertexBuffer.UV2Kind, accessorType: "VEC2" /* AccessorType.VEC2 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 8 },
|
1228
|
+
{ kind: VertexBuffer.MatricesIndicesKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5123 /* AccessorComponentType.UNSIGNED_SHORT */, byteStride: 8 },
|
1229
|
+
{ kind: VertexBuffer.MatricesIndicesExtraKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5123 /* AccessorComponentType.UNSIGNED_SHORT */, byteStride: 8 },
|
1230
|
+
{ kind: VertexBuffer.MatricesWeightsKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
1231
|
+
{ kind: VertexBuffer.MatricesWeightsExtraKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
1232
1232
|
];
|
1233
1233
|
if (bufferMesh) {
|
1234
1234
|
let indexBufferViewIndex = null;
|
@@ -1245,7 +1245,7 @@ export class _Exporter {
|
|
1245
1245
|
? vertexBuffer.getSize() * VertexBuffer.GetTypeByteLength(attribute.accessorComponentType)
|
1246
1246
|
: VertexBuffer.DeduceStride(attributeKind) * 4;
|
1247
1247
|
if (attribute.byteStride === 12) {
|
1248
|
-
attribute.accessorType = "VEC3" /* VEC3 */;
|
1248
|
+
attribute.accessorType = "VEC3" /* AccessorType.VEC3 */;
|
1249
1249
|
}
|
1250
1250
|
this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride, convertToRightHandedSystem);
|
1251
1251
|
attribute.bufferViewIndex = this._bufferViews.length - 1;
|
@@ -1325,7 +1325,7 @@ export class _Exporter {
|
|
1325
1325
|
}
|
1326
1326
|
if (indexBufferViewIndex) {
|
1327
1327
|
// Create accessor
|
1328
|
-
const accessor = _GLTFUtilities._CreateAccessor(indexBufferViewIndex, "indices - " + babylonTransformNode.name, "SCALAR" /* SCALAR */, 5125 /* UNSIGNED_INT */, submesh.indexCount, submesh.indexStart * 4, null, null);
|
1328
|
+
const accessor = _GLTFUtilities._CreateAccessor(indexBufferViewIndex, "indices - " + babylonTransformNode.name, "SCALAR" /* AccessorType.SCALAR */, 5125 /* AccessorComponentType.UNSIGNED_INT */, submesh.indexCount, submesh.indexStart * 4, null, null);
|
1329
1329
|
this._accessors.push(accessor);
|
1330
1330
|
meshPrimitive.indices = this._accessors.length - 1;
|
1331
1331
|
}
|
@@ -1453,12 +1453,12 @@ export class _Exporter {
|
|
1453
1453
|
babylonScene.cameras.forEach((camera) => {
|
1454
1454
|
if (!this._options.shouldExportNode || this._options.shouldExportNode(camera)) {
|
1455
1455
|
const glTFCamera = {
|
1456
|
-
type: camera.mode === Camera.PERSPECTIVE_CAMERA ? "perspective" /* PERSPECTIVE */ : "orthographic" /* ORTHOGRAPHIC */,
|
1456
|
+
type: camera.mode === Camera.PERSPECTIVE_CAMERA ? "perspective" /* CameraType.PERSPECTIVE */ : "orthographic" /* CameraType.ORTHOGRAPHIC */,
|
1457
1457
|
};
|
1458
1458
|
if (camera.name) {
|
1459
1459
|
glTFCamera.name = camera.name;
|
1460
1460
|
}
|
1461
|
-
if (glTFCamera.type === "perspective" /* PERSPECTIVE */) {
|
1461
|
+
if (glTFCamera.type === "perspective" /* CameraType.PERSPECTIVE */) {
|
1462
1462
|
glTFCamera.perspective = {
|
1463
1463
|
aspectRatio: camera.getEngine().getAspectRatio(camera),
|
1464
1464
|
yfov: camera.fovMode === Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera.getEngine().getAspectRatio(camera),
|
@@ -1466,7 +1466,7 @@ export class _Exporter {
|
|
1466
1466
|
zfar: camera.maxZ,
|
1467
1467
|
};
|
1468
1468
|
}
|
1469
|
-
else if (glTFCamera.type === "orthographic" /* ORTHOGRAPHIC */) {
|
1469
|
+
else if (glTFCamera.type === "orthographic" /* CameraType.ORTHOGRAPHIC */) {
|
1470
1470
|
const halfWidth = camera.orthoLeft && camera.orthoRight ? 0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;
|
1471
1471
|
const halfHeight = camera.orthoBottom && camera.orthoTop ? 0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;
|
1472
1472
|
glTFCamera.orthographic = {
|
@@ -1481,7 +1481,7 @@ export class _Exporter {
|
|
1481
1481
|
}
|
1482
1482
|
});
|
1483
1483
|
const [exportNodes, exportMaterials] = this._getExportNodes(nodes);
|
1484
|
-
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* PNG */, true).then(() => {
|
1484
|
+
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* ImageMimeType.PNG */, true).then(() => {
|
1485
1485
|
return this._createNodeMapAndAnimationsAsync(babylonScene, exportNodes, binaryWriter).then((nodeMap) => {
|
1486
1486
|
return this._createSkinsAsync(babylonScene, nodeMap, binaryWriter).then((skinMap) => {
|
1487
1487
|
this._nodeMap = nodeMap;
|
@@ -1736,7 +1736,7 @@ export class _Exporter {
|
|
1736
1736
|
const bufferView = _GLTFUtilities._CreateBufferView(0, bufferViewOffset, byteLength, undefined, "InverseBindMatrices" + " - " + skeleton.name);
|
1737
1737
|
this._bufferViews.push(bufferView);
|
1738
1738
|
const bufferViewIndex = this._bufferViews.length - 1;
|
1739
|
-
const bindMatrixAccessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, "InverseBindMatrices" + " - " + skeleton.name, "MAT4" /* MAT4 */, 5126 /* FLOAT */, inverseBindMatrices.length, null, null, null);
|
1739
|
+
const bindMatrixAccessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, "InverseBindMatrices" + " - " + skeleton.name, "MAT4" /* AccessorType.MAT4 */, 5126 /* AccessorComponentType.FLOAT */, inverseBindMatrices.length, null, null, null);
|
1740
1740
|
const inverseBindAccessorIndex = this._accessors.push(bindMatrixAccessor) - 1;
|
1741
1741
|
skin.inverseBindMatrices = inverseBindAccessorIndex;
|
1742
1742
|
this._skins.push(skin);
|