Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkIShaderRepository.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKISHADERREPOSITORY_H
18 #define MITKISHADERREPOSITORY_H
19 
20 #include <itkLightObject.h>
21 
22 #include "mitkCommon.h"
23 #include "mitkServiceInterface.h"
24 
25 #include <list>
26 
27 class vtkActor;
28 class vtkShaderProgram2;
29 
30 namespace mitk
31 {
32  class DataNode;
33  class BaseRenderer;
34 
46  {
47  struct ShaderPrivate;
48 
49  class MITKCORE_EXPORT Shader : public itk::LightObject
50  {
51  public:
52  mitkClassMacroItkParent(Shader, itk::LightObject) itkFactorylessNewMacro(Self)
53 
54  ~Shader();
55 
56  int GetId() const;
57  std::string GetName() const;
58  std::string GetMaterialXml() const;
59 
60  protected:
61  Shader();
62 
63  void SetId(int id);
64  void SetName(const std::string &name);
65  void SetMaterialXml(const std::string &xml);
66 
67  private:
68  // not implemented
69  Shader(const Shader &);
70  Shader &operator=(const Shader &);
71 
72  ShaderPrivate *d;
73  };
74 
75  class MITKCORE_EXPORT ShaderProgram : public itk::LightObject
76  {
77  public:
78  virtual void Activate() = 0;
79  virtual void Deactivate() = 0;
81  };
82 
83  virtual ~IShaderRepository();
84 
85  virtual std::list<Shader::Pointer> GetShaders() const = 0;
86 
95  virtual Shader::Pointer GetShader(const std::string &name) const = 0;
96 
97  virtual ShaderProgram::Pointer CreateShaderProgram() = 0;
98 
104  virtual Shader::Pointer GetShader(int id) const = 0;
105 
109  virtual void AddDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer, bool overwrite) const = 0;
110 
114  virtual void UpdateShaderProgram(mitk::IShaderRepository::ShaderProgram *shaderProgram,
115  mitk::DataNode *node,
116  mitk::BaseRenderer *renderer) const = 0;
117 
122  virtual int LoadShader(std::istream &stream, const std::string &name) = 0;
123 
130  virtual bool UnloadShader(int id) = 0;
131  };
132 }
133 
134 MITK_DECLARE_SERVICE_INTERFACE(mitk::IShaderRepository, "org.mitk.services.IShaderRepository/1.0")
135 
136 #endif // MITKISHADERREPOSITORY_H
#define MITKCORE_EXPORT
Organizes the rendering process.
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Management class for vtkShader XML descriptions.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
static std::string GetName(std::string fileName, std::string suffix)
MITK_DECLARE_SERVICE_INTERFACE(mitk::ISimulationService,"org.mitk.ISimulationService")
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66