]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Create vtkPolyData without MeshActor instance 06/3006/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 4 Jul 2019 15:13:41 +0000 (18:13 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 4 Jul 2019 15:13:41 +0000 (18:13 +0300)
gitlab #8

Change-Id: I3b8d7fa1d56d134a7cbbf4b71cf5543340999fd6

org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/shape/MeshActor.java

index 0466a02e3d081facd183b23706691a96c8bc6584..b290f861d27fbcf6d7d7610b1ad22a5c491f4aad 100644 (file)
@@ -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();