Compare commits

..

No commits in common. "ecabdfe7d9072d75d71654bfa8ab27ba24d21735" and "65fd6f4b6af661cd663e6fa172abf9250083f8ba" have entirely different histories.

4 changed files with 18 additions and 187562 deletions

View File

@ -20,5 +20,4 @@ target_link_libraries(pfe PRIVATE
VTK::RenderingVolume VTK::RenderingVolume
VTK::CommonDataModel VTK::CommonDataModel
VTK::IOLegacy VTK::IOLegacy
VTK::IOXML VTK::IOXML)
VTK::RenderingVolumeOpenGL2)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,17 +5,15 @@
#include <vtkNew.h> #include <vtkNew.h>
#include <vtkPolyDataMapper.h> #include <vtkPolyDataMapper.h>
#include <vtkProperty.h> #include <vtkProperty.h>
#include <vtkVolumeProperty.h>
#include <vtkRenderWindow.h> #include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h> #include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
#include <vtkVolumeMapper.h> #include <vtkVolumeMapper.h>
#include <vtkVolume.h> #include <vtkVolume.h>
#include <vtkOpenGLProjectedTetrahedraMapper.h> #include <vtkProjectedTetrahedraMapper.h>
#include <vtkUnstructuredGridReader.h> #include <vtkDataSetReader.h>
#include <vtkPolyDataReader.h> #include <vtkPolyDataReader.h>
#include <vtkXMLPolyDataReader.h> #include <vtkXMLPolyDataReader.h>
#include <vtkPiecewiseFunction.h>
#include <array> #include <array>
@ -30,41 +28,33 @@ int main(int argc, char **argv) {
std::array<unsigned char, 4> bkg{{26, 51, 102, 255}}; std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};
colors->SetColor("BkgColor", bkg.data()); colors->SetColor("BkgColor", bkg.data());
// vtkNew<vtkXMLPolyDataReader> reader; vtkNew<vtkXMLPolyDataReader> reader;
vtkNew<vtkUnstructuredGridReader> reader;
reader->SetFileName(argv[1]); reader->SetFileName(argv[1]);
vtkNew<vtkOpenGLProjectedTetrahedraMapper> volumeMapper; // vtkNew<vtkProjectedTetrahedraMapper> volumeMapper;
volumeMapper->SetInputConnection(reader->GetOutputPort()); // volumeMapper->SetInputConnection(reader->GetOutputPort());
// vtkNew<vtkPolyDataMapper> mapper; vtkNew<vtkPolyDataMapper> mapper;
// mapper->SetInputConnection(reader->GetOutputPort()); mapper->SetInputConnection(reader->GetOutputPort());
vtkNew<vtkVolume> volume; // vtkNew<vtkVolume> volume;
volume->SetMapper(volumeMapper); // volume->SetMapper(volumeMapper);
vtkNew<vtkPiecewiseFunction> transferFunction; vtkNew<vtkActor> actor;
transferFunction->AddPoint(-1, 100); actor->SetMapper(mapper);
transferFunction->AddPoint(0, .5);
// transferFunction->AddPoint(1, 1);
volume->GetProperty()->SetScalarOpacity(transferFunction);
volume->GetProperty()->SetColor(transferFunction);
// vtkNew<vtkActor> actor;
// actor->SetMapper(mapper);
// actor->GetProperty()->SetColor( actor->GetProperty()->SetColor(
// colors->GetColor4d("Tomato").GetData()); colors->GetColor4d("Tomato").GetData());
// actor->RotateX(30.0); actor->RotateX(30.0);
// actor->RotateY(-45.0); actor->RotateY(-45.0);
vtkNew<vtkRenderer> renderer; vtkNew<vtkRenderer> renderer;
// renderer->AddActor(actor); renderer->AddActor(actor);
renderer->AddVolume(volume);
renderer->SetBackground(colors->GetColor3d("BkgColor").GetData()); renderer->SetBackground(colors->GetColor3d("BkgColor").GetData());
renderer->ResetCamera(); renderer->ResetCamera();
renderer->GetActiveCamera()->Zoom(1.5); renderer->GetActiveCamera()->Zoom(1.5);
vtkNew<vtkRenderWindow> renderWindow; vtkNew<vtkRenderWindow> renderWindow;
renderWindow->SetSize(300, 300); renderWindow->SetSize(300, 300);
renderWindow->AddRenderer(renderer); renderWindow->AddRenderer(renderer);
renderWindow->SetWindowName("PFE"); renderWindow->SetWindowName("Cylinder");
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor; vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindow->Render(); renderWindow->Render();