From: Marko Luukkainen Date: Thu, 4 Jul 2019 15:13:41 +0000 (+0300) Subject: Create vtkPolyData without MeshActor instance X-Git-Tag: v1.43.0~257 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F3006%2F1;p=simantics%2F3d.git Create vtkPolyData without MeshActor instance gitlab #8 Change-Id: I3b8d7fa1d56d134a7cbbf4b71cf5543340999fd6 --- diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/shape/MeshActor.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/shape/MeshActor.java index 0466a02e..b290f861 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/shape/MeshActor.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/shape/MeshActor.java @@ -29,10 +29,7 @@ import vtk.vtkUnsignedCharArray; public class MeshActor extends vtkActor { - public void setMesh(Mesh mesh) { - - vtkPolyDataMapper mapper = new vtkPolyDataMapper(); - + public static vtkPolyData createPolyData(Mesh mesh) { vtkPolyData polyData = new vtkPolyData(); polyData.Allocate(mesh.getIndices().size()/3, mesh.getIndices().size()/3); @@ -70,7 +67,14 @@ public class MeshActor extends vtkActor { colors.Delete(); } - + return polyData; + } + + public void setMesh(Mesh mesh) { + + vtkPolyDataMapper mapper = new vtkPolyDataMapper(); + vtkPolyData polyData = createPolyData(mesh); + boolean computeNormals = true; if (computeNormals) { vtkPolyDataNormals normals = new vtkPolyDataNormals();