diff --git a/Source/Rendering/Materials/imstkTexture.h b/Source/Rendering/Materials/imstkTexture.h index d61989605f291d5afdeafeabc2c98b67b0a655dc..06972e1378b9be85736472ebd9e10f5d399c81c0 100644 --- a/Source/Rendering/Materials/imstkTexture.h +++ b/Source/Rendering/Materials/imstkTexture.h @@ -148,6 +148,20 @@ public: /// void setImageData(std::shared_ptr<ImageData> imgData) { imageTexture = imgData; } + /// + /// \brief Set whether interpolation is used when sampling the texture + /// + void setInterpolation(const bool interpolation) + { + m_interpolation = interpolation; + postModified(); + } + + /// + /// \brief Get whether interpolation is used when sampling the texture + /// + const bool getInterpolation() { return m_interpolation; } + /// /// \brief Get the input image data for the texture, not required (paths to files can be used instead) /// @@ -167,6 +181,9 @@ protected: // Helps sharpen mipmapped textures at more extreme angles bool m_anisotropyEnabled = true; double m_anisotropyFactor = 1.0; + + // Use interpolation when texturing? + bool m_interpolation = true; }; } diff --git a/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp b/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp index db9e5c80363770e272f3ec068cdff984e6067fe9..6826d7cce6e1586159fa6cb3cd29a2392b081e8e 100644 --- a/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp +++ b/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp @@ -83,6 +83,7 @@ VTKTextureDelegate::VTKTextureDelegate(std::shared_ptr<Texture> texture) : m_vtk imgReader->Update(); m_vtkTexture->SetBlendingMode(vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD); m_vtkTexture->SetRepeat(m_texture->getRepeating()); + m_vtkTexture->SetInterpolate(m_texture->getInterpolation()); m_vtkTexture->SetInputConnection(0, imgReader->GetOutputPort()); if (texture->getType() == Texture::Type::Diffuse) @@ -96,6 +97,7 @@ VTKTextureDelegate::VTKTextureDelegate(std::shared_ptr<Texture> texture) : m_vtk // Load by ImageData vtkSmartPointer<vtkImageData> vtkImgData = GeometryUtils::coupleVtkImageData(imstkImgData); m_vtkTexture->SetBlendingMode(vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD); + m_vtkTexture->SetInterpolate(m_texture->getInterpolation()); m_vtkTexture->SetRepeat(m_texture->getRepeating()); m_vtkTexture->SetInputData(vtkImgData);