Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::VtkShaderRepository Class Reference

Management class for vtkShader XML descriptions. More...

#include <mitkVtkShaderRepository.h>

Inheritance diagram for mitk::VtkShaderRepository:
Collaboration diagram for mitk::VtkShaderRepository:

Classes

class  Shader
 

Public Member Functions

 VtkShaderRepository ()
 
 ~VtkShaderRepository ()
 
ShaderProgram::Pointer CreateShaderProgram () override
 
std::list< IShaderRepository::Shader::PointerGetShaders () const override
 
IShaderRepository::Shader::Pointer GetShader (const std::string &name) const override
 Return the named shader. More...
 
IShaderRepository::Shader::Pointer GetShader (int id) const override
 Return the shader identified by the given id. More...
 
void AddDefaultProperties (mitk::DataNode *node, mitk::BaseRenderer *renderer, bool overwrite) const override
 Adds all parsed shader uniforms to property list of the given DataNode; used by mappers. More...
 
int LoadShader (std::istream &stream, const std::string &name) override
 Applies shader and shader specific variables of the specified DataNode to the VTK object by updating the shader variables of its vtkProperty. More...
 
bool UnloadShader (int id) override
 Unload a previously loaded shader. More...
 
void UpdateShaderProgram (mitk::IShaderRepository::ShaderProgram *shaderProgram, DataNode *node, BaseRenderer *renderer) const override
 Applies shader and shader specific variables of the specified DataNode to the VTK object by updating the shader variables of its vtkProperty. More...
 
- Public Member Functions inherited from mitk::IShaderRepository
virtual ~IShaderRepository ()
 

Protected Member Functions

void LoadShaders ()
 
Shader::Pointer GetShaderImpl (const std::string &name) const
 

Detailed Description

Management class for vtkShader XML descriptions.

Looks for all XML shader files in a given directory and adds default properties for each shader object (shader uniforms) to the specified mitk::DataNode.

Additionally, it provides a utility function for applying properties for shaders in mappers.

Definition at line 39 of file mitkVtkShaderRepository.h.

Constructor & Destructor Documentation

mitk::VtkShaderRepository::VtkShaderRepository ( )

Constructor

Definition at line 48 of file mitkVtkShaderRepository.cpp.

References LoadShaders().

mitk::VtkShaderRepository::~VtkShaderRepository ( )

Destructor

Definition at line 53 of file mitkVtkShaderRepository.cpp.

Member Function Documentation

void mitk::VtkShaderRepository::AddDefaultProperties ( mitk::DataNode node,
mitk::BaseRenderer renderer,
bool  overwrite 
) const
overridevirtual

Adds all parsed shader uniforms to property list of the given DataNode; used by mappers.

Implements mitk::IShaderRepository.

Definition at line 352 of file mitkVtkShaderRepository.cpp.

References mitk::DataNode::AddProperty(), mitk::IntProperty::New(), mitk::FloatProperty::New(), and mitk::ShaderProperty::New().

mitk::IShaderRepository::ShaderProgram::Pointer mitk::VtkShaderRepository::CreateShaderProgram ( )
overridevirtual

Implements mitk::IShaderRepository.

Definition at line 57 of file mitkVtkShaderRepository.cpp.

References mitk::New().

mitk::IShaderRepository::Shader::Pointer mitk::VtkShaderRepository::GetShader ( const std::string &  name) const
overridevirtual

Return the named shader.

Parameters
nameThe shader name.
Returns
A Shader object.

Names might not be unique. Use the shader id to uniquely identify a shader.

Implements mitk::IShaderRepository.

Definition at line 457 of file mitkVtkShaderRepository.cpp.

mitk::IShaderRepository::Shader::Pointer mitk::VtkShaderRepository::GetShader ( int  id) const
overridevirtual

Return the shader identified by the given id.

Parameters
idThe shader id.
Returns
The shader object or null if the id is unknown.

Implements mitk::IShaderRepository.

Definition at line 467 of file mitkVtkShaderRepository.cpp.

mitk::VtkShaderRepository::Shader::Pointer mitk::VtkShaderRepository::GetShaderImpl ( const std::string &  name) const
protected

Definition at line 96 of file mitkVtkShaderRepository.cpp.

std::list< mitk::IShaderRepository::Shader::Pointer > mitk::VtkShaderRepository::GetShaders ( ) const
overridevirtual

Implements mitk::IShaderRepository.

Definition at line 447 of file mitkVtkShaderRepository.cpp.

int mitk::VtkShaderRepository::LoadShader ( std::istream &  stream,
const std::string &  name 
)
overridevirtual

Applies shader and shader specific variables of the specified DataNode to the VTK object by updating the shader variables of its vtkProperty.

Implements mitk::IShaderRepository.

Definition at line 111 of file mitkVtkShaderRepository.cpp.

References mitk::New(), and SR_INFO.

void mitk::VtkShaderRepository::LoadShaders ( )
protected

Definition at line 63 of file mitkVtkShaderRepository.cpp.

References filename, mitk::New(), and SR_INFO.

Referenced by VtkShaderRepository().

bool mitk::VtkShaderRepository::UnloadShader ( int  id)
overridevirtual

Unload a previously loaded shader.

Parameters
idThe unique shader id returned by LoadShader.
Returns
true if the shader id was found and the shader was successfully unloaded, false otherwise.

Implements mitk::IShaderRepository.

Definition at line 122 of file mitkVtkShaderRepository.cpp.

void mitk::VtkShaderRepository::UpdateShaderProgram ( mitk::IShaderRepository::ShaderProgram shaderProgram,
DataNode node,
BaseRenderer renderer 
) const
overridevirtual

The documentation for this class was generated from the following files: