Skip to content
Snippets Groups Projects
Commit c8ec8a3c authored by NickMilef's avatar NickMilef
Browse files

Merged fix for normals bug and texture coordinate bug

parent 6d7cda54
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,7 @@ SurfaceMeshRenderDelegate::SurfaceMeshRenderDelegate(std::shared_ptr<SurfaceMesh
double tuple[2] = {tcoord[0], tcoord[1]};
vtkTCoords->InsertNextTuple(tuple);
}
polydata->GetPointData()->AddArray(vtkTCoords);
polydata->GetPointData()->SetTCoords(vtkTCoords);
// Read texture image
auto imgReader = readerFactory->CreateImageReader2(tFileName.c_str());
......@@ -106,6 +106,18 @@ SurfaceMeshRenderDelegate::SurfaceMeshRenderDelegate(std::shared_ptr<SurfaceMesh
unit++;
}
// Update normals
auto normals = surfaceMesh->getPointDataArray("Normals");
auto vtkNormals = vtkSmartPointer<vtkFloatArray>::New();
vtkNormals->SetNumberOfComponents(3);
vtkNormals->SetName("Normals");
for (auto const normal : normals)
{
double triple[3] = { normal[0], normal[1], normal[2] };
vtkNormals->InsertNextTuple(triple);
}
polydata->GetPointData()->SetNormals(vtkNormals);
// Actor
m_actor->SetMapper(mapper);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment