From c1e3a33107f225dfe3db524dca5e4d6508b38820 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Tue, 26 Oct 2021 14:47:03 +0200 Subject: [PATCH] Mesh instance is not needed in mesh. --- source/model/meshinstance.js | 8 +------- source/model/model.js | 3 +-- test/tests/modelutils_test.js | 2 +- test/tests/quantities_test.js | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/source/model/meshinstance.js b/source/model/meshinstance.js index bd272cb..768df9b 100644 --- a/source/model/meshinstance.js +++ b/source/model/meshinstance.js @@ -19,19 +19,13 @@ OV.MeshInstanceId = class OV.MeshInstance = class extends OV.Object3D { - constructor (id, node, mesh) + constructor (node, mesh) { super (); - this.id = id; this.node = node; this.mesh = mesh; } - GetId () - { - return this.id; - } - VertexCount () { return this.mesh.VertexCount (); diff --git a/source/model/model.js b/source/model/model.js index 3e7088a..61b6240 100644 --- a/source/model/model.js +++ b/source/model/model.js @@ -121,8 +121,7 @@ OV.Model = class extends OV.ModelObject3D this.root.Enumerate ((node) => { for (let meshIndex of node.GetMeshIndices ()) { let mesh = this.GetMesh (meshIndex); - let instanceId = new OV.MeshInstanceId (node.GetId (), meshIndex); - let meshInstance = new OV.MeshInstance (instanceId, node, mesh); + let meshInstance = new OV.MeshInstance (node, mesh); onMeshInstance (meshInstance); } }); diff --git a/test/tests/modelutils_test.js b/test/tests/modelutils_test.js index e21e130..7330783 100644 --- a/test/tests/modelutils_test.js +++ b/test/tests/modelutils_test.js @@ -91,7 +91,7 @@ describe ('Model Utils', function () { let transformation = new OV.Transformation (new OV.Matrix ().CreateTranslation (2.0, 0.0, 0.0)); let node = new OV.Node (); node.SetTransformation (transformation); - let cubeInstance = new OV.MeshInstance (new OV.MeshInstanceId (-1, -1), node, cube); + let cubeInstance = new OV.MeshInstance (node, cube); let cubeInstanceBounds = OV.GetBoundingBox (cubeInstance); assert (OV.CoordIsEqual3D (cubeInstanceBounds.min, new OV.Coord3D (2.0, 0.0, 0.0))); assert (OV.CoordIsEqual3D (cubeInstanceBounds.max, new OV.Coord3D (3.0, 1.0, 1.0))); diff --git a/test/tests/quantities_test.js b/test/tests/quantities_test.js index 92360ee..e5eeb8a 100644 --- a/test/tests/quantities_test.js +++ b/test/tests/quantities_test.js @@ -92,7 +92,7 @@ describe ('Quantities', function () { const transformation = new OV.Transformation (new OV.Matrix ().CreateScale (2.0, 2.0, 2.0)); let node = new OV.Node (); node.SetTransformation (transformation); - const meshInstance = new OV.MeshInstance (new OV.MeshInstanceId (-1, -1), node, mesh); + const meshInstance = new OV.MeshInstance (node, mesh); assert (OV.IsEqual (OV.CalculateVolume (meshInstance), 8.0)); assert (OV.IsEqual (OV.CalculateSurfaceArea (meshInstance), 24.0)); });