From 1e885c30936c7df2efda5a00bfdc127ee059dee0 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 4 Jul 2019 18:13:41 +0300 Subject: [PATCH] Create vtkPolyData without MeshActor instance gitlab #8 Change-Id: I3b8d7fa1d56d134a7cbbf4b71cf5543340999fd6 --- .../src/org/simantics/g3d/vtk/shape/MeshActor.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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(); -- 2.47.1