|
@@ -610,9 +610,8 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
var lightPosition = babylonLight.position.clone();
|
|
var lightPosition = babylonLight.position.clone();
|
|
- var convertToRightHandedSystem = _this._exporter._convertToRightHandedSystemMap[babylonNode.uniqueId];
|
|
|
|
if (!lightPosition.equals(babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Zero())) {
|
|
if (!lightPosition.equals(babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Zero())) {
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (_this._exporter._convertToRightHandedSystem) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__["_GLTFUtilities"]._GetRightHandedPositionVector3FromRef(lightPosition);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__["_GLTFUtilities"]._GetRightHandedPositionVector3FromRef(lightPosition);
|
|
}
|
|
}
|
|
node.translation = lightPosition.asArray();
|
|
node.translation = lightPosition.asArray();
|
|
@@ -623,7 +622,7 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
var pitch = -Math.atan2(localAxis.y, len);
|
|
var pitch = -Math.atan2(localAxis.y, len);
|
|
var lightRotationQuaternion = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].RotationYawPitchRoll(yaw, pitch, 0);
|
|
var lightRotationQuaternion = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].RotationYawPitchRoll(yaw, pitch, 0);
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (_this._exporter._convertToRightHandedSystem) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(lightRotationQuaternion);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(lightRotationQuaternion);
|
|
}
|
|
}
|
|
if (!lightRotationQuaternion.equals(babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].Identity())) {
|
|
if (!lightRotationQuaternion.equals(babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].Identity())) {
|
|
@@ -1107,7 +1106,6 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
* @param bufferViews
|
|
* @param bufferViews
|
|
* @param accessors
|
|
* @param accessors
|
|
* @param convertToRightHandedSystem
|
|
* @param convertToRightHandedSystem
|
|
- * @param animationSampleRate
|
|
|
|
*/
|
|
*/
|
|
_GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate) {
|
|
_GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate) {
|
|
var glTFAnimation;
|
|
var glTFAnimation;
|
|
@@ -1141,10 +1139,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
* @param binaryWriter
|
|
* @param binaryWriter
|
|
* @param bufferViews
|
|
* @param bufferViews
|
|
* @param accessors
|
|
* @param accessors
|
|
- * @param convertToRightHandedSystemMap
|
|
|
|
- * @param animationSampleRate
|
|
|
|
|
|
+ * @param convertToRightHandedSystem
|
|
*/
|
|
*/
|
|
- _GLTFAnimation._CreateNodeAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystemMap, animationSampleRate) {
|
|
|
|
|
|
+ _GLTFAnimation._CreateNodeAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate) {
|
|
var glTFAnimation;
|
|
var glTFAnimation;
|
|
if (babylonScene.animationGroups) {
|
|
if (babylonScene.animationGroups) {
|
|
var animationGroups = babylonScene.animationGroups;
|
|
var animationGroups = babylonScene.animationGroups;
|
|
@@ -1163,7 +1160,6 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
var animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);
|
|
var animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);
|
|
if (animationInfo) {
|
|
if (animationInfo) {
|
|
var babylonTransformNode = target instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["TransformNode"] ? target : target[0];
|
|
var babylonTransformNode = target instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["TransformNode"] ? target : target[0];
|
|
- var convertToRightHandedSystem = convertToRightHandedSystemMap[babylonTransformNode.uniqueId];
|
|
|
|
_GLTFAnimation.AddAnimation("" + animation.name, glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
|
|
_GLTFAnimation.AddAnimation("" + animation.name, glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1773,6 +1769,7 @@ var _Exporter = /** @class */ (function () {
|
|
this._samplers = [];
|
|
this._samplers = [];
|
|
this._animations = [];
|
|
this._animations = [];
|
|
this._imageData = {};
|
|
this._imageData = {};
|
|
|
|
+ this._convertToRightHandedSystem = !this._babylonScene.useRightHandedSystem;
|
|
this._options = options || {};
|
|
this._options = options || {};
|
|
this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
|
|
this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
|
|
this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__["_GLTFMaterialExporter"](this);
|
|
this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__["_GLTFMaterialExporter"](this);
|
|
@@ -1965,21 +1962,20 @@ var _Exporter = /** @class */ (function () {
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param binaryWriter The binary data for the glTF file
|
|
* @param binaryWriter The binary data for the glTF file
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
- if (convertToRightHandedSystem && sideOrientation === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].ClockWiseSideOrientation) {
|
|
|
|
|
|
+ _Exporter.prototype.reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
|
|
+ if (this._convertToRightHandedSystem && sideOrientation === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].ClockWiseSideOrientation) {
|
|
switch (primitiveMode) {
|
|
switch (primitiveMode) {
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].TriangleFillMode: {
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].TriangleFillMode: {
|
|
- this.reorderTriangleFillMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.reorderTriangleFillMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].TriangleStripDrawMode: {
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].TriangleStripDrawMode: {
|
|
- this.reorderTriangleStripDrawMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.reorderTriangleStripDrawMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].TriangleFanDrawMode: {
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].TriangleFanDrawMode: {
|
|
- this.reorderTriangleFanMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.reorderTriangleFanMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1995,9 +1991,8 @@ var _Exporter = /** @class */ (function () {
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param binaryWriter The binary data for the glTF file
|
|
* @param binaryWriter The binary data for the glTF file
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.reorderTriangleFillMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.reorderTriangleFillMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
var vertexBuffer = this.getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
var vertexBuffer = this.getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
if (vertexBuffer) {
|
|
if (vertexBuffer) {
|
|
var stride = vertexBuffer.byteStride / babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].GetTypeByteLength(vertexBuffer.type);
|
|
var stride = vertexBuffer.byteStride / babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].GetTypeByteLength(vertexBuffer.type);
|
|
@@ -2058,7 +2053,7 @@ var _Exporter = /** @class */ (function () {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -2075,9 +2070,8 @@ var _Exporter = /** @class */ (function () {
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param binaryWriter The binary data for the glTF file
|
|
* @param binaryWriter The binary data for the glTF file
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.reorderTriangleStripDrawMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.reorderTriangleStripDrawMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
var vertexBuffer = this.getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
var vertexBuffer = this.getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
if (vertexBuffer) {
|
|
if (vertexBuffer) {
|
|
var stride = vertexBuffer.byteStride / babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].GetTypeByteLength(vertexBuffer.type);
|
|
var stride = vertexBuffer.byteStride / babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].GetTypeByteLength(vertexBuffer.type);
|
|
@@ -2117,7 +2111,7 @@ var _Exporter = /** @class */ (function () {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, meshAttributeArray, binaryWriter);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleStripDrawMode: Vertex buffer kind " + vertexBufferKind + " not present!");
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleStripDrawMode: Vertex buffer kind " + vertexBufferKind + " not present!");
|
|
@@ -2133,9 +2127,8 @@ var _Exporter = /** @class */ (function () {
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param byteOffset The offset to the binary data
|
|
* @param binaryWriter The binary data for the glTF file
|
|
* @param binaryWriter The binary data for the glTF file
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.reorderTriangleFanMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.reorderTriangleFanMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
var vertexBuffer = this.getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
var vertexBuffer = this.getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
if (vertexBuffer) {
|
|
if (vertexBuffer) {
|
|
var stride = vertexBuffer.byteStride / babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].GetTypeByteLength(vertexBuffer.type);
|
|
var stride = vertexBuffer.byteStride / babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].GetTypeByteLength(vertexBuffer.type);
|
|
@@ -2177,7 +2170,7 @@ var _Exporter = /** @class */ (function () {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFanMode: Vertex buffer kind " + vertexBufferKind + " not present!");
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFanMode: Vertex buffer kind " + vertexBufferKind + " not present!");
|
|
@@ -2190,12 +2183,11 @@ var _Exporter = /** @class */ (function () {
|
|
* @param vertexAttributeKind The vertex attribute type
|
|
* @param vertexAttributeKind The vertex attribute type
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param meshAttributeArray The vertex attribute data
|
|
* @param binaryWriter The writer containing the binary data
|
|
* @param binaryWriter The writer containing the binary data
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind, meshAttributeArray, binaryWriter) {
|
|
for (var _i = 0, vertices_1 = vertices; _i < vertices_1.length; _i++) {
|
|
for (var _i = 0, vertices_1 = vertices; _i < vertices_1.length; _i++) {
|
|
var vertex = vertices_1[_i];
|
|
var vertex = vertices_1[_i];
|
|
- if (convertToRightHandedSystem && !(vertexAttributeKind === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].ColorKind) && !(vertex instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector2"])) {
|
|
|
|
|
|
+ if (this._convertToRightHandedSystem && !(vertexAttributeKind === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].ColorKind) && !(vertex instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector2"])) {
|
|
if (vertex instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"]) {
|
|
if (vertex instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"]) {
|
|
if (vertexAttributeKind === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].NormalKind) {
|
|
if (vertexAttributeKind === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].NormalKind) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedNormalVector3FromRef(vertex);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedNormalVector3FromRef(vertex);
|
|
@@ -2231,9 +2223,8 @@ var _Exporter = /** @class */ (function () {
|
|
* @param meshAttributeArray Array containing the attribute data
|
|
* @param meshAttributeArray Array containing the attribute data
|
|
* @param binaryWriter The buffer to write the binary data to
|
|
* @param binaryWriter The buffer to write the binary data to
|
|
* @param indices Used to specify the order of the vertex data
|
|
* @param indices Used to specify the order of the vertex data
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.writeAttributeData = function (vertexBufferKind, meshAttributeArray, byteStride, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.writeAttributeData = function (vertexBufferKind, meshAttributeArray, byteStride, binaryWriter) {
|
|
var stride = byteStride / 4;
|
|
var stride = byteStride / 4;
|
|
var vertexAttributes = [];
|
|
var vertexAttributes = [];
|
|
var index;
|
|
var index;
|
|
@@ -2242,7 +2233,7 @@ var _Exporter = /** @class */ (function () {
|
|
for (var k = 0, length_2 = meshAttributeArray.length / stride; k < length_2; ++k) {
|
|
for (var k = 0, length_2 = meshAttributeArray.length / stride; k < length_2; ++k) {
|
|
index = k * stride;
|
|
index = k * stride;
|
|
var vertexData = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"].FromArray(meshAttributeArray, index);
|
|
var vertexData = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"].FromArray(meshAttributeArray, index);
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (this._convertToRightHandedSystem) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedPositionVector3FromRef(vertexData);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedPositionVector3FromRef(vertexData);
|
|
}
|
|
}
|
|
vertexAttributes.push(vertexData.asArray());
|
|
vertexAttributes.push(vertexData.asArray());
|
|
@@ -2253,7 +2244,7 @@ var _Exporter = /** @class */ (function () {
|
|
for (var k = 0, length_3 = meshAttributeArray.length / stride; k < length_3; ++k) {
|
|
for (var k = 0, length_3 = meshAttributeArray.length / stride; k < length_3; ++k) {
|
|
index = k * stride;
|
|
index = k * stride;
|
|
var vertexData = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"].FromArray(meshAttributeArray, index);
|
|
var vertexData = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"].FromArray(meshAttributeArray, index);
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (this._convertToRightHandedSystem) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedNormalVector3FromRef(vertexData);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedNormalVector3FromRef(vertexData);
|
|
}
|
|
}
|
|
vertexData.normalize();
|
|
vertexData.normalize();
|
|
@@ -2265,7 +2256,7 @@ var _Exporter = /** @class */ (function () {
|
|
for (var k = 0, length_4 = meshAttributeArray.length / stride; k < length_4; ++k) {
|
|
for (var k = 0, length_4 = meshAttributeArray.length / stride; k < length_4; ++k) {
|
|
index = k * stride;
|
|
index = k * stride;
|
|
var vertexData = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector4"].FromArray(meshAttributeArray, index);
|
|
var vertexData = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector4"].FromArray(meshAttributeArray, index);
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (this._convertToRightHandedSystem) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedVector4FromRef(vertexData);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedVector4FromRef(vertexData);
|
|
}
|
|
}
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._NormalizeTangentFromRef(vertexData);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._NormalizeTangentFromRef(vertexData);
|
|
@@ -2285,7 +2276,7 @@ var _Exporter = /** @class */ (function () {
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind: {
|
|
case babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind: {
|
|
for (var k = 0, length_6 = meshAttributeArray.length / stride; k < length_6; ++k) {
|
|
for (var k = 0, length_6 = meshAttributeArray.length / stride; k < length_6; ++k) {
|
|
index = k * stride;
|
|
index = k * stride;
|
|
- vertexAttributes.push(convertToRightHandedSystem ? [meshAttributeArray[index], meshAttributeArray[index + 1]] : [meshAttributeArray[index], meshAttributeArray[index + 1]]);
|
|
|
|
|
|
+ vertexAttributes.push(this._convertToRightHandedSystem ? [meshAttributeArray[index], meshAttributeArray[index + 1]] : [meshAttributeArray[index], meshAttributeArray[index + 1]]);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -2514,14 +2505,13 @@ var _Exporter = /** @class */ (function () {
|
|
* Sets the TRS for each node
|
|
* Sets the TRS for each node
|
|
* @param node glTF Node for storing the transformation data
|
|
* @param node glTF Node for storing the transformation data
|
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.setNodeTransformation = function (node, babylonTransformNode, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.setNodeTransformation = function (node, babylonTransformNode) {
|
|
if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {
|
|
if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Pivot points are not supported in the glTF serializer");
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Pivot points are not supported in the glTF serializer");
|
|
}
|
|
}
|
|
if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {
|
|
if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {
|
|
- node.translation = convertToRightHandedSystem ? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedPositionVector3(babylonTransformNode.position).asArray() : babylonTransformNode.position.asArray();
|
|
|
|
|
|
+ node.translation = this._convertToRightHandedSystem ? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedPositionVector3(babylonTransformNode.position).asArray() : babylonTransformNode.position.asArray();
|
|
}
|
|
}
|
|
if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {
|
|
if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {
|
|
node.scale = babylonTransformNode.scaling.asArray();
|
|
node.scale = babylonTransformNode.scaling.asArray();
|
|
@@ -2531,7 +2521,7 @@ var _Exporter = /** @class */ (function () {
|
|
rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
|
|
rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
|
|
}
|
|
}
|
|
if (!(rotationQuaternion.x === 0 && rotationQuaternion.y === 0 && rotationQuaternion.z === 0 && rotationQuaternion.w === 1)) {
|
|
if (!(rotationQuaternion.x === 0 && rotationQuaternion.y === 0 && rotationQuaternion.z === 0 && rotationQuaternion.w === 1)) {
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (this._convertToRightHandedSystem) {
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
}
|
|
}
|
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
@@ -2551,9 +2541,8 @@ var _Exporter = /** @class */ (function () {
|
|
* @param kind Indicates the type of vertices data
|
|
* @param kind Indicates the type of vertices data
|
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.createBufferViewKind = function (kind, babylonTransformNode, binaryWriter, byteStride, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.createBufferViewKind = function (kind, babylonTransformNode, binaryWriter, byteStride) {
|
|
var bufferMesh = babylonTransformNode instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Mesh"] ?
|
|
var bufferMesh = babylonTransformNode instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Mesh"] ?
|
|
babylonTransformNode : babylonTransformNode instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["InstancedMesh"] ?
|
|
babylonTransformNode : babylonTransformNode instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["InstancedMesh"] ?
|
|
babylonTransformNode.sourceMesh : null;
|
|
babylonTransformNode.sourceMesh : null;
|
|
@@ -2563,7 +2552,7 @@ var _Exporter = /** @class */ (function () {
|
|
var byteLength = vertexData.length * 4;
|
|
var byteLength = vertexData.length * 4;
|
|
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + " - " + bufferMesh.name);
|
|
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + " - " + bufferMesh.name);
|
|
this._bufferViews.push(bufferView);
|
|
this._bufferViews.push(bufferView);
|
|
- this.writeAttributeData(kind, vertexData, byteStride, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.writeAttributeData(kind, vertexData, byteStride, binaryWriter);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -2659,9 +2648,8 @@ var _Exporter = /** @class */ (function () {
|
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
* @param binaryWriter Buffer to write the attribute data to
|
|
* @param binaryWriter Buffer to write the attribute data to
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter) {
|
|
var promises = [];
|
|
var promises = [];
|
|
var bufferMesh = null;
|
|
var bufferMesh = null;
|
|
var bufferView;
|
|
var bufferView;
|
|
@@ -2694,7 +2682,7 @@ var _Exporter = /** @class */ (function () {
|
|
if (attribute.byteStride === 12) {
|
|
if (attribute.byteStride === 12) {
|
|
attribute.accessorType = "VEC3" /* VEC3 */;
|
|
attribute.accessorType = "VEC3" /* VEC3 */;
|
|
}
|
|
}
|
|
- this.createBufferViewKind(attributeKind, babylonTransformNode, binaryWriter, attribute.byteStride, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.createBufferViewKind(attributeKind, babylonTransformNode, binaryWriter, attribute.byteStride);
|
|
attribute.bufferViewIndex = this._bufferViews.length - 1;
|
|
attribute.bufferViewIndex = this._bufferViews.length - 1;
|
|
vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;
|
|
vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;
|
|
}
|
|
}
|
|
@@ -2762,7 +2750,7 @@ var _Exporter = /** @class */ (function () {
|
|
if (bufferViewIndex != undefined) { // check to see if bufferviewindex has a numeric value assigned.
|
|
if (bufferViewIndex != undefined) { // check to see if bufferviewindex has a numeric value assigned.
|
|
minMax = { min: null, max: null };
|
|
minMax = { min: null, max: null };
|
|
if (attributeKind == babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind) {
|
|
if (attributeKind == babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind) {
|
|
- minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride, convertToRightHandedSystem);
|
|
|
|
|
|
+ minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride, this._convertToRightHandedSystem);
|
|
}
|
|
}
|
|
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, 5126 /* FLOAT */, vertexData.length / stride, 0, minMax.min, minMax.max);
|
|
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, 5126 /* FLOAT */, vertexData.length / stride, 0, minMax.min, minMax.max);
|
|
this._accessors.push(accessor);
|
|
this._accessors.push(accessor);
|
|
@@ -2780,7 +2768,7 @@ var _Exporter = /** @class */ (function () {
|
|
if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
|
|
if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
|
|
var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
|
|
var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
|
|
// Only reverse the winding if we have a clockwise winding
|
|
// Only reverse the winding if we have a clockwise winding
|
|
- if (convertToRightHandedSystem && sideOrientation === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].ClockWiseSideOrientation) {
|
|
|
|
|
|
+ if (sideOrientation === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Material"].ClockWiseSideOrientation) {
|
|
var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
|
|
var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
|
|
if (byteOffset == null) {
|
|
if (byteOffset == null) {
|
|
byteOffset = 0;
|
|
byteOffset = 0;
|
|
@@ -2801,7 +2789,7 @@ var _Exporter = /** @class */ (function () {
|
|
if (!byteOffset_1) {
|
|
if (!byteOffset_1) {
|
|
byteOffset_1 = 0;
|
|
byteOffset_1 = 0;
|
|
}
|
|
}
|
|
- this.reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, sideOrientation, attribute.kind, vertexData, byteOffset_1, binaryWriter, convertToRightHandedSystem);
|
|
|
|
|
|
+ this.reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, sideOrientation, attribute.kind, vertexData, byteOffset_1, binaryWriter);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2821,32 +2809,6 @@ var _Exporter = /** @class */ (function () {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Check if the node is used to convert its descendants from right-handed to left-handed
|
|
|
|
- * @param node The node to check
|
|
|
|
- * @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
|
|
|
|
- */
|
|
|
|
- _Exporter.prototype.isNodeConvertingToLeftHanded = function (node) {
|
|
|
|
- if (node instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["TransformNode"]) {
|
|
|
|
- // Transform
|
|
|
|
- var matrix = node.getWorldMatrix();
|
|
|
|
- var matrixToLeftHanded = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Compose(new babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"](-1, 1, 1), babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Quaternion"].Identity(), babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Vector3"].Zero());
|
|
|
|
- var matrixProduct = matrix.multiply(matrixToLeftHanded);
|
|
|
|
- var matrixIdentity = babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Matrix"].IdentityReadOnly;
|
|
|
|
- for (var i = 0; i < 16; i++) {
|
|
|
|
- if (Math.abs(matrixProduct.m[i] - matrixIdentity.m[i]) > babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Epsilon"]) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // Geometry
|
|
|
|
- if ((node instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Mesh"] && node.geometry !== null) ||
|
|
|
|
- (node instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["InstancedMesh"] && node.sourceMesh.geometry !== null)) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
* Creates a glTF scene based on the array of meshes
|
|
* Creates a glTF scene based on the array of meshes
|
|
* Returns the the total byte offset
|
|
* Returns the the total byte offset
|
|
* @param babylonScene Babylon scene to get the mesh data from
|
|
* @param babylonScene Babylon scene to get the mesh data from
|
|
@@ -2859,32 +2821,6 @@ var _Exporter = /** @class */ (function () {
|
|
var glTFNode;
|
|
var glTFNode;
|
|
var directDescendents;
|
|
var directDescendents;
|
|
var nodes = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArrays"])(babylonScene.transformNodes, babylonScene.meshes, babylonScene.lights);
|
|
var nodes = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArrays"])(babylonScene.transformNodes, babylonScene.meshes, babylonScene.lights);
|
|
- var rootNodesToLeftHanded = [];
|
|
|
|
- this._convertToRightHandedSystemMap = {};
|
|
|
|
- // Set default values for all nodes
|
|
|
|
- babylonScene.rootNodes.forEach(function (rootNode) {
|
|
|
|
- _this._convertToRightHandedSystemMap[rootNode.uniqueId] = !babylonScene.useRightHandedSystem;
|
|
|
|
- rootNode.getDescendants(false).forEach(function (descendant) {
|
|
|
|
- _this._convertToRightHandedSystemMap[descendant.uniqueId] = !babylonScene.useRightHandedSystem;
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- if (!babylonScene.useRightHandedSystem) {
|
|
|
|
- // Check if root nodes converting to left-handed are present
|
|
|
|
- babylonScene.rootNodes.forEach(function (rootNode) {
|
|
|
|
- if (_this.isNodeConvertingToLeftHanded(rootNode)) {
|
|
|
|
- rootNodesToLeftHanded.push(rootNode);
|
|
|
|
- // Exclude the node from list of nodes to export
|
|
|
|
- var indexRootNode = nodes.indexOf(rootNode);
|
|
|
|
- if (indexRootNode !== -1) { // should always be true
|
|
|
|
- nodes.splice(indexRootNode, 1);
|
|
|
|
- }
|
|
|
|
- // Cancel conversion to right handed system
|
|
|
|
- rootNode.getDescendants(false).forEach(function (descendant) {
|
|
|
|
- _this._convertToRightHandedSystemMap[descendant.uniqueId] = false;
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(babylonScene.materials, "image/png" /* PNG */, true).then(function () {
|
|
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(babylonScene.materials, "image/png" /* PNG */, true).then(function () {
|
|
return _this.createNodeMapAndAnimationsAsync(babylonScene, nodes, binaryWriter).then(function (nodeMap) {
|
|
return _this.createNodeMapAndAnimationsAsync(babylonScene, nodes, binaryWriter).then(function (nodeMap) {
|
|
_this._nodeMap = nodeMap;
|
|
_this._nodeMap = nodeMap;
|
|
@@ -2906,13 +2842,12 @@ var _Exporter = /** @class */ (function () {
|
|
glTFNode.extras = babylonNode.metadata.gltf.extras;
|
|
glTFNode.extras = babylonNode.metadata.gltf.extras;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (!babylonNode.parent || rootNodesToLeftHanded.indexOf(babylonNode.parent) !== -1) {
|
|
|
|
|
|
+ if (!babylonNode.parent) {
|
|
if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
|
|
if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Log("Omitting " + babylonNode.name + " from scene.");
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Log("Omitting " + babylonNode.name + " from scene.");
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
|
|
|
|
- if (convertToRightHandedSystem) {
|
|
|
|
|
|
+ if (_this._convertToRightHandedSystem) {
|
|
if (glTFNode.translation) {
|
|
if (glTFNode.translation) {
|
|
glTFNode.translation[2] *= -1;
|
|
glTFNode.translation[2] *= -1;
|
|
glTFNode.translation[0] *= -1;
|
|
glTFNode.translation[0] *= -1;
|
|
@@ -2964,8 +2899,7 @@ var _Exporter = /** @class */ (function () {
|
|
var _loop_1 = function (babylonNode) {
|
|
var _loop_1 = function (babylonNode) {
|
|
if (!this_1._options.shouldExportNode || this_1._options.shouldExportNode(babylonNode)) {
|
|
if (!this_1._options.shouldExportNode || this_1._options.shouldExportNode(babylonNode)) {
|
|
promiseChain = promiseChain.then(function () {
|
|
promiseChain = promiseChain.then(function () {
|
|
- var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
|
|
|
|
- return _this.createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem).then(function (node) {
|
|
|
|
|
|
+ return _this.createNodeAsync(babylonNode, binaryWriter).then(function (node) {
|
|
var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode);
|
|
var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode);
|
|
if (promise == null) {
|
|
if (promise == null) {
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node " + babylonNode.name);
|
|
babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node " + babylonNode.name);
|
|
@@ -2980,7 +2914,7 @@ var _Exporter = /** @class */ (function () {
|
|
nodeIndex = _this._nodes.length - 1;
|
|
nodeIndex = _this._nodes.length - 1;
|
|
nodeMap[babylonNode.uniqueId] = nodeIndex;
|
|
nodeMap[babylonNode.uniqueId] = nodeIndex;
|
|
if (!babylonScene.animationGroups.length && babylonNode.animations.length) {
|
|
if (!babylonScene.animationGroups.length && babylonNode.animations.length) {
|
|
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate);
|
|
|
|
|
|
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._convertToRightHandedSystem, _this._animationSampleRate);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -3006,7 +2940,7 @@ var _Exporter = /** @class */ (function () {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if (babylonScene.animationGroups.length) {
|
|
if (babylonScene.animationGroups.length) {
|
|
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateNodeAnimationFromAnimationGroups(babylonScene, _this._animations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._convertToRightHandedSystemMap, _this._animationSampleRate);
|
|
|
|
|
|
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateNodeAnimationFromAnimationGroups(babylonScene, _this._animations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._convertToRightHandedSystem, _this._animationSampleRate);
|
|
}
|
|
}
|
|
return nodeMap;
|
|
return nodeMap;
|
|
});
|
|
});
|
|
@@ -3015,10 +2949,9 @@ var _Exporter = /** @class */ (function () {
|
|
* Creates a glTF node from a Babylon mesh
|
|
* Creates a glTF node from a Babylon mesh
|
|
* @param babylonMesh Source Babylon mesh
|
|
* @param babylonMesh Source Babylon mesh
|
|
* @param binaryWriter Buffer for storing geometry data
|
|
* @param binaryWriter Buffer for storing geometry data
|
|
- * @param convertToRightHandedSystem Converts the values to right-handed
|
|
|
|
* @returns glTF node
|
|
* @returns glTF node
|
|
*/
|
|
*/
|
|
- _Exporter.prototype.createNodeAsync = function (babylonNode, binaryWriter, convertToRightHandedSystem) {
|
|
|
|
|
|
+ _Exporter.prototype.createNodeAsync = function (babylonNode, binaryWriter) {
|
|
var _this = this;
|
|
var _this = this;
|
|
return Promise.resolve().then(function () {
|
|
return Promise.resolve().then(function () {
|
|
// create node to hold translation/rotation/scale and the mesh
|
|
// create node to hold translation/rotation/scale and the mesh
|
|
@@ -3030,8 +2963,8 @@ var _Exporter = /** @class */ (function () {
|
|
}
|
|
}
|
|
if (babylonNode instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["TransformNode"]) {
|
|
if (babylonNode instanceof babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_1__["TransformNode"]) {
|
|
// Set transformation
|
|
// Set transformation
|
|
- _this.setNodeTransformation(node, babylonNode, convertToRightHandedSystem);
|
|
|
|
- return _this.setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter, convertToRightHandedSystem).then(function () {
|
|
|
|
|
|
+ _this.setNodeTransformation(node, babylonNode);
|
|
|
|
+ return _this.setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter).then(function () {
|
|
if (mesh.primitives.length) {
|
|
if (mesh.primitives.length) {
|
|
_this._meshes.push(mesh);
|
|
_this._meshes.push(mesh);
|
|
node.mesh = _this._meshes.length - 1;
|
|
node.mesh = _this._meshes.length - 1;
|