@babylonjs/serializers 5.0.0-rc.10 → 5.0.0-rc.13
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/KHR_lights_punctual.js +2 -2
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
- package/glTF/2.0/Extensions/index.js +5 -5
- package/glTF/2.0/glTFAnimation.js +1 -1
- package/glTF/2.0/glTFExporter.js +34 -31
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.js +1 -1
- package/glTF/2.0/glTFSerializer.js +1 -1
- package/glTF/2.0/index.js +8 -8
- package/glTF/index.js +2 -2
- package/index.js +3 -3
- package/legacy/legacy-glTF2Serializer.js +7 -7
- package/legacy/legacy-objSerializer.js +2 -2
- package/legacy/legacy-stlSerializer.js +2 -2
- package/legacy/legacy.js +4 -4
- package/license.md +71 -0
- package/package.json +25 -6
- package/stl/index.js +1 -1
|
@@ -3,9 +3,9 @@ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
|
3
3
|
import { Light } from "@babylonjs/core/Lights/light.js";
|
|
4
4
|
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
|
5
5
|
import { ShadowLight } from "@babylonjs/core/Lights/shadowLight.js";
|
|
6
|
-
import { _Exporter } from "../glTFExporter";
|
|
6
|
+
import { _Exporter } from "../glTFExporter.js";
|
|
7
7
|
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
|
8
|
-
import { _GLTFUtilities } from "../glTFUtilities";
|
|
8
|
+
import { _GLTFUtilities } from "../glTFUtilities.js";
|
|
9
9
|
var NAME = "KHR_lights_punctual";
|
|
10
10
|
/**
|
|
11
11
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual/README.md)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _Exporter } from "../glTFExporter";
|
|
1
|
+
import { _Exporter } from "../glTFExporter.js";
|
|
2
2
|
import { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial.js";
|
|
3
3
|
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
4
4
|
var NAME = "KHR_materials_clearcoat";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _Exporter } from "../glTFExporter";
|
|
1
|
+
import { _Exporter } from "../glTFExporter.js";
|
|
2
2
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
3
3
|
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
|
4
4
|
var NAME = "KHR_materials_unlit";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
2
2
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
3
|
-
import { _Exporter } from "../glTFExporter";
|
|
3
|
+
import { _Exporter } from "../glTFExporter.js";
|
|
4
4
|
var NAME = "KHR_texture_transform";
|
|
5
|
-
import "../shaders/textureTransform.fragment";
|
|
5
|
+
import "../shaders/textureTransform.fragment.js";
|
|
6
6
|
/**
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./KHR_texture_transform";
|
|
2
|
-
export * from "./KHR_lights_punctual";
|
|
3
|
-
export * from "./KHR_materials_clearcoat";
|
|
4
|
-
export * from "./KHR_materials_sheen";
|
|
5
|
-
export * from "./KHR_materials_unlit";
|
|
1
|
+
export * from "./KHR_texture_transform.js";
|
|
2
|
+
export * from "./KHR_lights_punctual.js";
|
|
3
|
+
export * from "./KHR_materials_clearcoat.js";
|
|
4
|
+
export * from "./KHR_materials_sheen.js";
|
|
5
|
+
export * from "./KHR_materials_unlit.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,7 +4,7 @@ import { Animation } from "@babylonjs/core/Animations/animation.js";
|
|
|
4
4
|
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
5
5
|
import { MorphTarget } from "@babylonjs/core/Morph/morphTarget.js";
|
|
6
6
|
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
7
|
-
import { _GLTFUtilities } from "./glTFUtilities";
|
|
7
|
+
import { _GLTFUtilities } from "./glTFUtilities.js";
|
|
8
8
|
import { AnimationKeyInterpolation } from "@babylonjs/core/Animations/animationKey.js";
|
|
9
9
|
/**
|
|
10
10
|
* @hidden
|
package/glTF/2.0/glTFExporter.js
CHANGED
|
@@ -9,10 +9,11 @@ import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
|
9
9
|
import { LinesMesh } from "@babylonjs/core/Meshes/linesMesh.js";
|
|
10
10
|
import { InstancedMesh } from "@babylonjs/core/Meshes/instancedMesh.js";
|
|
11
11
|
import { Material } from "@babylonjs/core/Materials/material.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { Engine } from "@babylonjs/core/Engines/engine.js";
|
|
13
|
+
import { _GLTFMaterialExporter } from "./glTFMaterialExporter.js";
|
|
14
|
+
import { _GLTFUtilities } from "./glTFUtilities.js";
|
|
15
|
+
import { GLTFData } from "./glTFData.js";
|
|
16
|
+
import { _GLTFAnimation } from "./glTFAnimation.js";
|
|
16
17
|
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
|
17
18
|
import { EngineStore } from "@babylonjs/core/Engines/engineStore.js";
|
|
18
19
|
import { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial.js";
|
|
@@ -33,7 +34,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
33
34
|
this._includeCoordinateSystemConversionNodes = false;
|
|
34
35
|
this._extensions = {};
|
|
35
36
|
this._glTF = {
|
|
36
|
-
asset: { generator: "
|
|
37
|
+
asset: { generator: "Babylon.js v".concat(Engine.Version), version: "2.0" },
|
|
37
38
|
};
|
|
38
39
|
babylonScene = babylonScene || EngineStore.LastCreatedScene;
|
|
39
40
|
if (!babylonScene) {
|
|
@@ -1464,34 +1465,36 @@ var _Exporter = /** @class */ (function () {
|
|
|
1464
1465
|
}
|
|
1465
1466
|
});
|
|
1466
1467
|
// Export babylon cameras to glTFCamera
|
|
1467
|
-
var
|
|
1468
|
+
var cameraMap = new Map();
|
|
1468
1469
|
babylonScene.cameras.forEach(function (camera) {
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
if (camera.name) {
|
|
1473
|
-
glTFCamera.name = camera.name;
|
|
1474
|
-
}
|
|
1475
|
-
if (glTFCamera.type === "perspective" /* PERSPECTIVE */) {
|
|
1476
|
-
glTFCamera.perspective = {
|
|
1477
|
-
aspectRatio: camera.getEngine().getAspectRatio(camera),
|
|
1478
|
-
yfov: camera._cache.fovMode === Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera._cache.aspectRatio,
|
|
1479
|
-
znear: camera.minZ,
|
|
1480
|
-
zfar: camera.maxZ,
|
|
1481
|
-
};
|
|
1482
|
-
}
|
|
1483
|
-
else if (glTFCamera.type === "orthographic" /* ORTHOGRAPHIC */) {
|
|
1484
|
-
var halfWidth = camera.orthoLeft && camera.orthoRight ? 0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;
|
|
1485
|
-
var halfHeight = camera.orthoBottom && camera.orthoTop ? 0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;
|
|
1486
|
-
glTFCamera.orthographic = {
|
|
1487
|
-
xmag: halfWidth,
|
|
1488
|
-
ymag: halfHeight,
|
|
1489
|
-
znear: camera.minZ,
|
|
1490
|
-
zfar: camera.maxZ,
|
|
1470
|
+
if (!_this._options.shouldExportNode || _this._options.shouldExportNode(camera)) {
|
|
1471
|
+
var glTFCamera = {
|
|
1472
|
+
type: camera.mode === Camera.PERSPECTIVE_CAMERA ? "perspective" /* PERSPECTIVE */ : "orthographic" /* ORTHOGRAPHIC */,
|
|
1491
1473
|
};
|
|
1474
|
+
if (camera.name) {
|
|
1475
|
+
glTFCamera.name = camera.name;
|
|
1476
|
+
}
|
|
1477
|
+
if (glTFCamera.type === "perspective" /* PERSPECTIVE */) {
|
|
1478
|
+
glTFCamera.perspective = {
|
|
1479
|
+
aspectRatio: camera.getEngine().getAspectRatio(camera),
|
|
1480
|
+
yfov: camera.fovMode === Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera.getEngine().getAspectRatio(camera),
|
|
1481
|
+
znear: camera.minZ,
|
|
1482
|
+
zfar: camera.maxZ,
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
else if (glTFCamera.type === "orthographic" /* ORTHOGRAPHIC */) {
|
|
1486
|
+
var halfWidth = camera.orthoLeft && camera.orthoRight ? 0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;
|
|
1487
|
+
var halfHeight = camera.orthoBottom && camera.orthoTop ? 0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;
|
|
1488
|
+
glTFCamera.orthographic = {
|
|
1489
|
+
xmag: halfWidth,
|
|
1490
|
+
ymag: halfHeight,
|
|
1491
|
+
znear: camera.minZ,
|
|
1492
|
+
zfar: camera.maxZ,
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
cameraMap.set(camera, _this._cameras.length);
|
|
1496
|
+
_this._cameras.push(glTFCamera);
|
|
1492
1497
|
}
|
|
1493
|
-
cameraHash.set(camera, _this._cameras.length);
|
|
1494
|
-
_this._cameras.push(glTFCamera);
|
|
1495
1498
|
});
|
|
1496
1499
|
var _a = this._getExportNodes(nodes), exportNodes = _a[0], exportMaterials = _a[1];
|
|
1497
1500
|
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* PNG */, true).then(function () {
|
|
@@ -1517,7 +1520,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
1517
1520
|
}
|
|
1518
1521
|
}
|
|
1519
1522
|
if (babylonNode instanceof Camera) {
|
|
1520
|
-
glTFNode.camera =
|
|
1523
|
+
glTFNode.camera = cameraMap.get(babylonNode);
|
|
1521
1524
|
}
|
|
1522
1525
|
if (!babylonNode.parent || rootNodesToLeftHanded.indexOf(babylonNode.parent) !== -1) {
|
|
1523
1526
|
if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
|