Fix glTF export transformations.
This commit is contained in:
parent
dabb20b6b1
commit
b661ddcfb5
@ -2,7 +2,6 @@ import { BinaryWriter } from '../io/binarywriter.js';
|
|||||||
import { Utf8StringToArrayBuffer } from '../io/bufferutils.js';
|
import { Utf8StringToArrayBuffer } from '../io/bufferutils.js';
|
||||||
import { FileFormat, GetFileExtension, GetFileName } from '../io/fileutils.js';
|
import { FileFormat, GetFileExtension, GetFileName } from '../io/fileutils.js';
|
||||||
import { MeshInstanceId } from '../model/meshinstance.js';
|
import { MeshInstanceId } from '../model/meshinstance.js';
|
||||||
import { NodeType } from '../model/node.js';
|
|
||||||
import { RGBColor, SRGBToLinear } from '../model/color.js';
|
import { RGBColor, SRGBToLinear } from '../model/color.js';
|
||||||
import { MaterialType } from '../model/material.js';
|
import { MaterialType } from '../model/material.js';
|
||||||
import { ConvertMeshToMeshBuffer } from '../model/meshbuffer.js';
|
import { ConvertMeshToMeshBuffer } from '../model/meshbuffer.js';
|
||||||
@ -276,28 +275,23 @@ export class ExporterGltf extends ExporterBase
|
|||||||
|
|
||||||
function AddNode (model, jsonParent, jsonNodes, node)
|
function AddNode (model, jsonParent, jsonNodes, node)
|
||||||
{
|
{
|
||||||
let nodeType = node.GetType ();
|
let nodeJson = {};
|
||||||
if (nodeType === NodeType.GroupNode) {
|
let nodeName = node.GetName ();
|
||||||
let nodeJson = {};
|
if (nodeName.length > 0) {
|
||||||
let nodeName = node.GetName ();
|
nodeJson.name = node.GetName ();
|
||||||
if (nodeName.length > 0) {
|
}
|
||||||
nodeJson.name = node.GetName ();
|
let transformation = node.GetTransformation ();
|
||||||
}
|
if (!transformation.IsIdentity ()) {
|
||||||
let transformation = node.GetTransformation ();
|
nodeJson.matrix = node.GetTransformation ().GetMatrix ().Get ();
|
||||||
if (!transformation.IsIdentity ()) {
|
}
|
||||||
nodeJson.matrix = node.GetTransformation ().GetMatrix ().Get ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (node.ChildNodeCount () > 0 || node.MeshIndexCount () > 0) {
|
||||||
nodeJson.children = [];
|
nodeJson.children = [];
|
||||||
AddChildNodes (model, nodeJson.children, jsonNodes, node);
|
AddChildNodes (model, nodeJson.children, jsonNodes, node);
|
||||||
if (nodeJson.children.length > 0) {
|
if (nodeJson.children.length > 0) {
|
||||||
jsonNodes.push (nodeJson);
|
jsonNodes.push (nodeJson);
|
||||||
jsonParent.push (jsonNodes.length - 1);
|
jsonParent.push (jsonNodes.length - 1);
|
||||||
}
|
}
|
||||||
} else if (nodeType === NodeType.MeshNode) {
|
|
||||||
for (let meshIndex of node.GetMeshIndices ()) {
|
|
||||||
AddMeshNode (model, jsonParent, jsonNodes, node, meshIndex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user