VTK Textured Map Plane + Image Data
Ref: https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapPlane
Ref: https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapImageData
...
vtkImageCanvasSource2D *imageSource; vtkNEW(imageSource);
imageSource->SetScalarTypeToUnsignedChar();
imageSource->SetExtent(0, 10, 0, 10, 0, 0);
imageSource->SetNumberOfScalarComponents(3);
imageSource->SetDrawColor(127, 255, 100);
imageSource->FillBox(0, 10, 0, 10);
imageSource->SetDrawColor(20, 20, 20);
imageSource->DrawSegment(0, 0, 9, 9);
imageSource->DrawSegment(9, 0, 0, 9);
imageSource->Update();
texture->SetInput(imageSource->GetOutput());
// Create a plane
vtkPlaneSource *plane; vtkNEW(plane);
plane->SetCenter(0.0, 0.0, 0.0);
plane->SetNormal(0.0, 0.0, -1.0);
vtkPolyDataMapper *planeMapper; vtkNEW(planeMapper);
plane->GetOutput()->GetPointData()->SetTCoords(textureCoordinates);
planeMapper->SetInput(plane->GetOutput());
vtkActor *texturedPlane; vtkNEW(texturedPlane);
texturedPlane->SetMapper(planeMapper);
texturedPlane->SetTexture(texture);
m_Renderer->AddActor(texturedPlane);
Ref: https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapImageData
...
vtkImageCanvasSource2D *imageSource; vtkNEW(imageSource);
imageSource->SetScalarTypeToUnsignedChar();
imageSource->SetExtent(0, 10, 0, 10, 0, 0);
imageSource->SetNumberOfScalarComponents(3);
imageSource->SetDrawColor(127, 255, 100);
imageSource->FillBox(0, 10, 0, 10);
imageSource->SetDrawColor(20, 20, 20);
imageSource->DrawSegment(0, 0, 9, 9);
imageSource->DrawSegment(9, 0, 0, 9);
imageSource->Update();
texture->SetInput(imageSource->GetOutput());
// Create a plane
vtkPlaneSource *plane; vtkNEW(plane);
plane->SetCenter(0.0, 0.0, 0.0);
plane->SetNormal(0.0, 0.0, -1.0);
vtkPolyDataMapper *planeMapper; vtkNEW(planeMapper);
plane->GetOutput()->GetPointData()->SetTCoords(textureCoordinates);
planeMapper->SetInput(plane->GetOutput());
vtkActor *texturedPlane; vtkNEW(texturedPlane);
texturedPlane->SetMapper(planeMapper);
texturedPlane->SetTexture(texture);
m_Renderer->AddActor(texturedPlane);
Commenti
Posta un commento