7 #include "imstkVTKVolumeRenderDelegate.h" 8 #include "imstkVolumeRenderMaterial.h" 9 #include "imstkVisualModel.h" 11 #include <vtkGPUVolumeRayCastMapper.h> 12 #include <vtkVolume.h> 13 #include <vtkVolumeProperty.h> 22 if (material !=
nullptr)
24 if (vtkSmartPointer<vtkVolumeMapper> volumeMapper = vtkVolumeMapper::SafeDownCast(m_mapper))
26 if (vtkSmartPointer<vtkGPUVolumeRayCastMapper> volumeRayCastMapper = vtkGPUVolumeRayCastMapper::SafeDownCast(volumeMapper))
28 volumeRayCastMapper->SetAutoAdjustSampleDistances(material->getUseAutoSample());
29 volumeRayCastMapper->SetSampleDistance(material->getSampleDistance());
32 switch (material->getBlendMode())
34 case RenderMaterial::BlendMode::Alpha:
35 volumeMapper->SetBlendMode(vtkVolumeMapper::COMPOSITE_BLEND);
37 case RenderMaterial::BlendMode::Additive:
38 volumeMapper->SetBlendMode(vtkVolumeMapper::ADDITIVE_BLEND);
40 case RenderMaterial::BlendMode::MaximumIntensity:
41 volumeMapper->SetBlendMode(vtkVolumeMapper::MAXIMUM_INTENSITY_BLEND);
43 case RenderMaterial::BlendMode::MinimumIntensity:
44 volumeMapper->SetBlendMode(vtkVolumeMapper::MINIMUM_INTENSITY_BLEND);
47 volumeMapper->SetBlendMode(vtkVolumeMapper::COMPOSITE_BLEND);
52 if (vtkSmartPointer<vtkVolume> volume = vtkVolume::SafeDownCast(m_actor))
54 volume->SetProperty(material->getVolumeProperty());
std::shared_ptr< VisualModel > m_visualModel
imstk visual model (contains data (geometry) and render specification (render material)) ...
void updateRenderProperties() override
Updates the actor and mapper properties from the currently set VisualModel.