Remove o3dv test files without nodes.
This commit is contained in:
parent
94e8f15a24
commit
addc8dfbac
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "cuboid",
|
|
||||||
"parameters" : {
|
|
||||||
"size_x" : 1.0,
|
|
||||||
"size_y" : 1.0,
|
|
||||||
"size_z" : 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "cylinder",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5,
|
|
||||||
"height" : 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "cylinder",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5,
|
|
||||||
"height" : 1.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "cylinder",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.8,
|
|
||||||
"height" : 1.2
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [2.0, 0.0, 0.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "cylinder",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5,
|
|
||||||
"height" : 1.0,
|
|
||||||
"smooth" : false,
|
|
||||||
"segments" : 5
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [2.0, 2.0, 0.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "cylinder",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5,
|
|
||||||
"height" : 1.0,
|
|
||||||
"smooth" : false,
|
|
||||||
"segments" : 10
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [0.0, 2.0, 0.0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
{
|
|
||||||
"materials" : [
|
|
||||||
{
|
|
||||||
"name" : "Material 1",
|
|
||||||
"color" : [200, 0, 0],
|
|
||||||
"metalness" : 1.0,
|
|
||||||
"roughness" : 0.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Material 2",
|
|
||||||
"color" : [0, 200, 0],
|
|
||||||
"metalness" : 1.0,
|
|
||||||
"roughness" : 0.25
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Material 3",
|
|
||||||
"color" : [0, 0, 200],
|
|
||||||
"metalness" : 1.0,
|
|
||||||
"roughness" : 0.5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Material 4",
|
|
||||||
"color" : [200, 200, 0],
|
|
||||||
"metalness" : 1.0,
|
|
||||||
"roughness" : 0.75
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [0.0, 0.0, 0.0]
|
|
||||||
},
|
|
||||||
"material" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [1.5, 0.0, 0.0]
|
|
||||||
},
|
|
||||||
"material" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [3.0, 0.0, 0.0]
|
|
||||||
},
|
|
||||||
"material" : 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [4.5, 0.0, 0.0]
|
|
||||||
},
|
|
||||||
"material" : 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
{
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "platonic",
|
|
||||||
"parameters" : {
|
|
||||||
"solid_type" : "tetrahedron",
|
|
||||||
"radius" : 1.0
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [0.0, 0.0, 0.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "platonic",
|
|
||||||
"parameters" : {
|
|
||||||
"solid_type" : "hexahedron",
|
|
||||||
"radius" : 1.0
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [0.0, 0.0, 3.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "platonic",
|
|
||||||
"parameters" : {
|
|
||||||
"solid_type" : "octahedron",
|
|
||||||
"radius" : 1.0
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [3.0, 0.0, 0.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "platonic",
|
|
||||||
"parameters" : {
|
|
||||||
"solid_type" : "dodecahedron",
|
|
||||||
"radius" : 1.0
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [3.0, 0.0, 3.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "platonic",
|
|
||||||
"parameters" : {
|
|
||||||
"solid_type" : "icosahedron",
|
|
||||||
"radius" : 1.0
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [6.0, 0.0, 1.5]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.8
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [2.0, 0.0, 0.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5,
|
|
||||||
"smooth" : false,
|
|
||||||
"segments" : 5
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [2.0, 2.0, 0.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type" : "sphere",
|
|
||||||
"parameters" : {
|
|
||||||
"radius" : 0.5,
|
|
||||||
"smooth" : false,
|
|
||||||
"segments" : 10
|
|
||||||
},
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [0.0, 2.0, 0.0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"materials" : [
|
|
||||||
{
|
|
||||||
"name" : "Material 1",
|
|
||||||
"color" : [200, 0, 0]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Material 2",
|
|
||||||
"color" : [0, 200, 0]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Material 3",
|
|
||||||
"color" : [0, 0, 200]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Material 4",
|
|
||||||
"color" : [200, 200, 0]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"meshes" : [
|
|
||||||
{
|
|
||||||
"name" : "Cube",
|
|
||||||
"material" : 0,
|
|
||||||
"type" : "cuboid",
|
|
||||||
"parameters" : {
|
|
||||||
"size_x" : 1.0,
|
|
||||||
"size_y" : 1.0,
|
|
||||||
"size_z" : 1.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Cube T",
|
|
||||||
"material" : 1,
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [2.0, 0.0, 0.0]
|
|
||||||
},
|
|
||||||
"type" : "cuboid",
|
|
||||||
"parameters" : {
|
|
||||||
"size_x" : 1.0,
|
|
||||||
"size_y" : 1.0,
|
|
||||||
"size_z" : 1.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Cube TR",
|
|
||||||
"material" : 2,
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [4.0, 0.0, 0.0],
|
|
||||||
"rotation" : [0.0, 0.0, 0.3826834323650898, 0.9238795325112867]
|
|
||||||
},
|
|
||||||
"type" : "cuboid",
|
|
||||||
"parameters" : {
|
|
||||||
"size_x" : 1.0,
|
|
||||||
"size_y" : 1.0,
|
|
||||||
"size_z" : 1.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Cube TRS",
|
|
||||||
"material" : 3,
|
|
||||||
"transformation" : {
|
|
||||||
"translation" : [6.0, 0.0, 0.0],
|
|
||||||
"rotation" : [0.0, 0.0, 0.3826834323650898, 0.9238795325112867],
|
|
||||||
"scale" : [1.5, 2.0, 2.5]
|
|
||||||
},
|
|
||||||
"type" : "cuboid",
|
|
||||||
"parameters" : {
|
|
||||||
"size_x" : 1.0,
|
|
||||||
"size_y" : 1.0,
|
|
||||||
"size_z" : 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"children" : [
|
"children" : [
|
||||||
{
|
{
|
||||||
"name" : "Translated",
|
"name" : "Translated and Rotated",
|
||||||
"transformation" : {
|
"transformation" : {
|
||||||
"translation" : [2.0, 0.0, 0.0]
|
"translation" : [2.0, 0.0, 0.0]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,94 +3,36 @@ var testFiles = require ('../utils/testfiles.js');
|
|||||||
var testUtils = require ('../utils/testutils.js');
|
var testUtils = require ('../utils/testutils.js');
|
||||||
|
|
||||||
describe ('O3dv Importer', function () {
|
describe ('O3dv Importer', function () {
|
||||||
it ('cube.o3dv', function (done) {
|
it ('translateandrotate.o3dv', function (done) {
|
||||||
testFiles.ImportO3dvFile ('cube.o3dv', function (model) {
|
testFiles.ImportO3dvFile ('translateandrotate.o3dv', function (model) {
|
||||||
assert (OV.CheckModel (model));
|
assert (OV.CheckModel (model));
|
||||||
assert.deepStrictEqual (testUtils.ModelToObjectSimple (model), {
|
assert.deepStrictEqual (testUtils.ModelNodesToTree (model), {
|
||||||
name : '',
|
name : '<Root>',
|
||||||
materials : [
|
childNodes : [
|
||||||
{ name : '' }
|
|
||||||
],
|
|
||||||
meshes : [
|
|
||||||
{
|
{
|
||||||
name : '',
|
name : 'Translated',
|
||||||
vertexCount : 8,
|
childNodes : [],
|
||||||
normalCount : 12,
|
meshNames : ['Cube']
|
||||||
uvCount : 0,
|
},
|
||||||
triangleCount : 12,
|
|
||||||
boundingBox : {
|
|
||||||
min : [0, 0, 0],
|
|
||||||
max : [1, 1, 1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
done ();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it ('cylinder.o3dv', function (done) {
|
|
||||||
testFiles.ImportO3dvFile ('cylinder.o3dv', function (model) {
|
|
||||||
assert (OV.CheckModel (model));
|
|
||||||
assert.deepStrictEqual (testUtils.ModelToObjectSimple (model), {
|
|
||||||
name : '',
|
|
||||||
materials : [
|
|
||||||
{ name : '' }
|
|
||||||
],
|
|
||||||
meshes : [
|
|
||||||
{
|
{
|
||||||
name : '',
|
name : 'Rotated',
|
||||||
vertexCount : 50,
|
childNodes : [
|
||||||
normalCount : 196,
|
{
|
||||||
uvCount : 0,
|
name : 'Translated and Rotated',
|
||||||
triangleCount : 96,
|
childNodes : [],
|
||||||
boundingBox : {
|
meshNames : ['Cube']
|
||||||
min : [-0.49605735065723894, -0.4990133642141358, 0],
|
}
|
||||||
max : [0.5, 0.4990133642141358, 1]
|
],
|
||||||
}
|
meshNames : []
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
|
||||||
done ();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it ('sphere.o3dv', function (done) {
|
|
||||||
testFiles.ImportO3dvFile ('sphere.o3dv', function (model) {
|
|
||||||
assert (OV.CheckModel (model));
|
|
||||||
assert.deepStrictEqual (testUtils.ModelToObjectSimple (model), {
|
|
||||||
name : '',
|
|
||||||
materials : [
|
|
||||||
{ name : '' }
|
|
||||||
],
|
],
|
||||||
meshes : [
|
meshNames : ['Cube']
|
||||||
{
|
|
||||||
name : '',
|
|
||||||
vertexCount : 382,
|
|
||||||
normalCount : 2280,
|
|
||||||
uvCount : 0,
|
|
||||||
triangleCount : 760,
|
|
||||||
boundingBox : {
|
|
||||||
min : [-0.5, -0.5, -0.5],
|
|
||||||
max : [0.5, 0.5, 0.5]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
done ();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it ('transformation.o3dv', function (done) {
|
|
||||||
testFiles.ImportO3dvFile ('transformation.o3dv', function (model) {
|
|
||||||
assert (OV.CheckModel (model));
|
|
||||||
assert.deepStrictEqual (testUtils.ModelToObjectSimple (model), {
|
assert.deepStrictEqual (testUtils.ModelToObjectSimple (model), {
|
||||||
name : '',
|
name : '',
|
||||||
materials : [
|
materials : [
|
||||||
{ name : 'Material 1' },
|
{ name : 'Green' }
|
||||||
{ name : 'Material 2' },
|
|
||||||
{ name : 'Material 3' },
|
|
||||||
{ name : 'Material 4' }
|
|
||||||
],
|
],
|
||||||
meshes : [
|
meshes : [
|
||||||
{
|
{
|
||||||
@ -103,42 +45,13 @@ describe ('O3dv Importer', function () {
|
|||||||
min : [0, 0, 0],
|
min : [0, 0, 0],
|
||||||
max : [1, 1, 1]
|
max : [1, 1, 1]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
name : 'Cube T',
|
|
||||||
vertexCount : 8,
|
|
||||||
normalCount : 12,
|
|
||||||
uvCount : 0,
|
|
||||||
triangleCount : 12,
|
|
||||||
boundingBox : {
|
|
||||||
min : [2, 0, 0],
|
|
||||||
max : [3, 1, 1]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name : 'Cube TR',
|
|
||||||
vertexCount : 8,
|
|
||||||
normalCount : 12,
|
|
||||||
uvCount : 0,
|
|
||||||
triangleCount : 12,
|
|
||||||
boundingBox : {
|
|
||||||
min : [3.2928932188134525, 0, 0],
|
|
||||||
max : [4.707106781186548, 1.414213562373095, 1]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name : 'Cube TRS',
|
|
||||||
vertexCount : 8,
|
|
||||||
normalCount : 12,
|
|
||||||
uvCount : 0,
|
|
||||||
triangleCount : 12,
|
|
||||||
boundingBox : {
|
|
||||||
min : [4.585786437626905, 0, 0],
|
|
||||||
max : [7.060660171779821, 2.4748737341529163, 2.5]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
assert.strictEqual (model.MeshInstanceCount (), 3);
|
||||||
|
let boundingBox = OV.GetBoundingBox (model);
|
||||||
|
assert (OV.CoordIsEqual3D (boundingBox.min, new OV.Coord3D (-1.0, 0.0, 0.0)));
|
||||||
|
assert (OV.CoordIsEqual3D (boundingBox.max, new OV.Coord3D (3.0, 3.0, 1.0)));
|
||||||
done ();
|
done ();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -253,33 +253,10 @@ describe ('Color Conversion', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function GetModelTree (model)
|
|
||||||
{
|
|
||||||
function AddNodeToModelTree (model, node, modelTree)
|
|
||||||
{
|
|
||||||
modelTree.name = node.HasParent () ? node.GetName () : '<Root>';
|
|
||||||
modelTree.childNodes = [];
|
|
||||||
for (const childNode of node.GetChildNodes ()) {
|
|
||||||
let childTree = {};
|
|
||||||
AddNodeToModelTree (model, childNode, childTree);
|
|
||||||
modelTree.childNodes.push (childTree);
|
|
||||||
}
|
|
||||||
modelTree.meshNames = [];
|
|
||||||
for (const meshIndex of node.GetMeshIndices ()) {
|
|
||||||
modelTree.meshNames.push (model.GetMesh (meshIndex).GetName ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let modelTree = {};
|
|
||||||
let root = model.GetRootNode ();
|
|
||||||
AddNodeToModelTree (model, root, modelTree);
|
|
||||||
return modelTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe ('Node Hierarchy', function () {
|
describe ('Node Hierarchy', function () {
|
||||||
it ('Enumerate hierarchy', function () {
|
it ('Enumerate hierarchy', function () {
|
||||||
let model = testUtils.GetHierarchicalModelNoFinalization ();
|
let model = testUtils.GetHierarchicalModelNoFinalization ();
|
||||||
let modelTree = GetModelTree (model);
|
let modelTree = testUtils.ModelNodesToTree (model);
|
||||||
assert.deepStrictEqual (modelTree, {
|
assert.deepStrictEqual (modelTree, {
|
||||||
name : '<Root>',
|
name : '<Root>',
|
||||||
childNodes : [
|
childNodes : [
|
||||||
@ -312,7 +289,7 @@ describe ('Node Hierarchy', function () {
|
|||||||
it ('Remove mesh', function () {
|
it ('Remove mesh', function () {
|
||||||
let model = testUtils.GetHierarchicalModelNoFinalization ();
|
let model = testUtils.GetHierarchicalModelNoFinalization ();
|
||||||
model.RemoveMesh (2);
|
model.RemoveMesh (2);
|
||||||
let modelTree = GetModelTree (model);
|
let modelTree = testUtils.ModelNodesToTree (model);
|
||||||
assert.deepStrictEqual (modelTree, {
|
assert.deepStrictEqual (modelTree, {
|
||||||
name : '<Root>',
|
name : '<Root>',
|
||||||
childNodes : [
|
childNodes : [
|
||||||
@ -347,7 +324,7 @@ describe ('Node Hierarchy', function () {
|
|||||||
let mesh = new OV.Mesh ();
|
let mesh = new OV.Mesh ();
|
||||||
mesh.SetName ('Mesh 8');
|
mesh.SetName ('Mesh 8');
|
||||||
model.AddMeshToIndex (mesh, 3);
|
model.AddMeshToIndex (mesh, 3);
|
||||||
let modelTree = GetModelTree (model);
|
let modelTree = testUtils.ModelNodesToTree (model);
|
||||||
assert.deepStrictEqual (modelTree, {
|
assert.deepStrictEqual (modelTree, {
|
||||||
name : '<Root>',
|
name : '<Root>',
|
||||||
childNodes : [
|
childNodes : [
|
||||||
@ -379,7 +356,7 @@ describe ('Node Hierarchy', function () {
|
|||||||
|
|
||||||
it ('Enumerate mesh instances', function () {
|
it ('Enumerate mesh instances', function () {
|
||||||
let model = testUtils.GetTranslatedRotatedCubesModel ();
|
let model = testUtils.GetTranslatedRotatedCubesModel ();
|
||||||
let modelTree = GetModelTree (model);
|
let modelTree = testUtils.ModelNodesToTree (model);
|
||||||
assert.deepStrictEqual (modelTree, {
|
assert.deepStrictEqual (modelTree, {
|
||||||
name : '<Root>',
|
name : '<Root>',
|
||||||
childNodes : [
|
childNodes : [
|
||||||
@ -426,7 +403,7 @@ describe ('Node Hierarchy', function () {
|
|||||||
|
|
||||||
it ('Enumerate transformed mesh instances', function () {
|
it ('Enumerate transformed mesh instances', function () {
|
||||||
let model = testUtils.GetTranslatedRotatedCubesModel ();
|
let model = testUtils.GetTranslatedRotatedCubesModel ();
|
||||||
let modelTree = GetModelTree (model);
|
let modelTree = testUtils.ModelNodesToTree (model);
|
||||||
assert.deepStrictEqual (modelTree, {
|
assert.deepStrictEqual (modelTree, {
|
||||||
name : '<Root>',
|
name : '<Root>',
|
||||||
childNodes : [
|
childNodes : [
|
||||||
|
|||||||
@ -25,6 +25,29 @@ module.exports =
|
|||||||
return arrayBuffer
|
return arrayBuffer
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ModelNodesToTree : function (model)
|
||||||
|
{
|
||||||
|
function AddNodeToModelTree (model, node, modelTree)
|
||||||
|
{
|
||||||
|
modelTree.name = node.HasParent () ? node.GetName () : '<Root>';
|
||||||
|
modelTree.childNodes = [];
|
||||||
|
for (const childNode of node.GetChildNodes ()) {
|
||||||
|
let childTree = {};
|
||||||
|
AddNodeToModelTree (model, childNode, childTree);
|
||||||
|
modelTree.childNodes.push (childTree);
|
||||||
|
}
|
||||||
|
modelTree.meshNames = [];
|
||||||
|
for (const meshIndex of node.GetMeshIndices ()) {
|
||||||
|
modelTree.meshNames.push (model.GetMesh (meshIndex).GetName ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let modelTree = {};
|
||||||
|
let root = model.GetRootNode ();
|
||||||
|
AddNodeToModelTree (model, root, modelTree);
|
||||||
|
return modelTree;
|
||||||
|
},
|
||||||
|
|
||||||
ModelToObject : function (model)
|
ModelToObject : function (model)
|
||||||
{
|
{
|
||||||
var obj = {
|
var obj = {
|
||||||
@ -137,7 +160,7 @@ module.exports =
|
|||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetTwoCubesConnectingInOneVertexModel ()
|
GetTwoCubesConnectingInOneVertexModel : function ()
|
||||||
{
|
{
|
||||||
let model = new OV.Model ();
|
let model = new OV.Model ();
|
||||||
|
|
||||||
@ -152,7 +175,7 @@ module.exports =
|
|||||||
return model;
|
return model;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetTwoCubesConnectingInOneEdgeModel ()
|
GetTwoCubesConnectingInOneEdgeModel : function ()
|
||||||
{
|
{
|
||||||
let model = new OV.Model ();
|
let model = new OV.Model ();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user