Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
vtkXMLShader.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 /*=========================================================================
18 
19  Program: Visualization Toolkit
20  Module: vtkXMLShader.h
21 
22  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  All rights reserved.
24  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
25 
26  This software is distributed WITHOUT ANY WARRANTY; without even
27  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
28  PURPOSE. See the above copyright notice for more information.
29 
30 =========================================================================*/
31 // .NAME vtkXMLShader - encapsulates a Shader XML description.
32 // .SECTION Description
33 // vtkXMLShader encapsulates the XML description for a Shader.
34 // It provides convenient access to various attributes/properties
35 // of a shader.
36 // .SECTION Thanks
37 // Shader support in VTK includes key contributions by Gary Templet at
38 // Sandia National Labs.
39 
40 #ifndef __vtkXMLShader_h
41 #define __vtkXMLShader_h
42 
43 #include "vtkObject.h"
44 #include "vtkRenderingCoreModule.h" // For export macro
45 
46 class vtkXMLDataElement;
47 
48 class vtkXMLShader : public vtkObject
49 {
50 public:
51  static vtkXMLShader *New();
52  vtkTypeMacro(vtkXMLShader, vtkObject);
53  void PrintSelf(ostream &os, vtkIndent indent) override;
54 
55  // Description:
56  // Get/Set the XML root element that describes this shader.
57  vtkGetObjectMacro(RootElement, vtkXMLDataElement);
58  void SetRootElement(vtkXMLDataElement *);
59 
60  // Description:
61  // Returns the type of the shader as defined in the XML description.
62  int GetScope();
63 
64  // Description:
65  // Returns the style of the shader as optionaly defined in the XML
66  // description. If not present, default style is 1. "style=2" means it is
67  // a shader without a main(). In style 2, the "main" function for the vertex
68  // shader part is void propFuncVS(void), the main function for the fragment
69  // shader part is void propFuncFS(). This is useful when combining a shader
70  // at the actor level and a shader defines at the renderer level, like
71  // the depth peeling pass.
72  // \post valid_result: result==1 || result==2
73  int GetStyle();
74 
75  // Description:
76  // Get the name of the Shader.
77  const char *GetName();
78 
79  // Description:
80  // Get the entry point to the shader code as defined in the XML.
81  const char *GetEntry();
82 
83  // Description:
84  // Get the shader code.
85  const char *GetCode();
86 
87  // Description:
88  // Returns an null terminate array of the pointers to space sepatared Args
89  // defined in the XML description.
90  const char **GetArgs();
91 
92  // Description:
93  // Searches the file in the VTK_MATERIALS_DIRS.
94  // Note that this allocates new memory for the string.
95  // The caller must delete it.
96  static char *LocateFile(const char *filename);
97 
98  // BTX
99 
101  {
107  };
108 
109  // ETX
110 protected:
111  vtkXMLShader();
112  ~vtkXMLShader();
113 
114  char *Code; // cache for the code.
115  vtkSetStringMacro(Code);
116 
117  vtkXMLDataElement *RootElement;
118  vtkXMLDataElement *SourceLibraryElement;
119  void SetSourceLibraryElement(vtkXMLDataElement *);
120 
121  char **Args;
122  void CleanupArgs();
123 
124 private:
125  vtkXMLShader(const vtkXMLShader &); // Not implemented.
126  void operator=(const vtkXMLShader &); // Not implemented.
127 };
128 
129 #endif
vtkTypeMacro(vtkXMLShader, vtkObject)
void SetSourceLibraryElement(vtkXMLDataElement *)
const char * GetEntry()
void SetRootElement(vtkXMLDataElement *)
vtkGetObjectMacro(RootElement, vtkXMLDataElement)
static vtkXMLShader * New()
vtkXMLDataElement * RootElement
Definition: vtkXMLShader.h:117
void PrintSelf(ostream &os, vtkIndent indent) override
const char * GetCode()
vtkXMLDataElement * SourceLibraryElement
Definition: vtkXMLShader.h:118
char ** Args
Definition: vtkXMLShader.h:121
const char * GetName()
vtkSetStringMacro(Code)
void CleanupArgs()
static const std::string filename
const char ** GetArgs()
static char * LocateFile(const char *filename)