VTK
vtkShaderProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkShaderProperty.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkShaderProperty_h
31 #define vtkShaderProperty_h
32 
33 #include "vtkNew.h" // For iVars
34 #include "vtkObject.h"
35 #include "vtkRenderingCoreModule.h" // For export macro
36 
37 class vtkUniforms;
38 
39 class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
40 {
41 public:
42  vtkTypeMacro(vtkShaderProperty, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  static vtkShaderProperty* New();
49 
53  void DeepCopy(vtkShaderProperty* p);
54 
65  vtkMTimeType GetShaderMTime();
66 
68 
74  bool HasVertexShaderCode();
75  bool HasFragmentShaderCode();
76  bool HasGeometryShaderCode();
77  vtkSetStringMacro(VertexShaderCode);
78  vtkGetStringMacro(VertexShaderCode);
79  vtkSetStringMacro(FragmentShaderCode);
80  vtkGetStringMacro(FragmentShaderCode);
81  vtkSetStringMacro(GeometryShaderCode);
82  vtkGetStringMacro(GeometryShaderCode);
84 
86 
90  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
91  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
92  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
94 
96 
103  virtual void AddVertexShaderReplacement(const std::string& originalValue,
104  bool replaceFirst, // do this replacement before the default
105  const std::string& replacementValue, bool replaceAll) = 0;
106  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
107  bool replaceFirst, // do this replacement before the default
108  const std::string& replacementValue, bool replaceAll) = 0;
109  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
110  bool replaceFirst, // do this replacement before the default
111  const std::string& replacementValue, bool replaceAll) = 0;
112  virtual int GetNumberOfShaderReplacements() = 0;
113  virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index) = 0;
114  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
115  std::string& replacementValue, bool& replaceAll) = 0;
116  virtual void ClearVertexShaderReplacement(
117  const std::string& originalValue, bool replaceFirst) = 0;
118  virtual void ClearFragmentShaderReplacement(
119  const std::string& originalValue, bool replaceFirst) = 0;
120  virtual void ClearGeometryShaderReplacement(
121  const std::string& originalValue, bool replaceFirst) = 0;
122  virtual void ClearAllVertexShaderReplacements() = 0;
123  virtual void ClearAllFragmentShaderReplacements() = 0;
124  virtual void ClearAllGeometryShaderReplacements() = 0;
125  virtual void ClearAllShaderReplacements() = 0;
127 
128 protected:
130  ~vtkShaderProperty() override;
131 
135 
139 
140 private:
141  vtkShaderProperty(const vtkShaderProperty&) = delete;
142  void operator=(const vtkShaderProperty&) = delete;
143 };
144 
145 #endif
vtkShaderProperty::GeometryShaderCode
char * GeometryShaderCode
Definition: vtkShaderProperty.h:134
vtkIdType
int vtkIdType
Definition: vtkType.h:343
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkShaderProperty::VertexShaderCode
char * VertexShaderCode
Definition: vtkShaderProperty.h:132
vtkUniforms
helper class to set custom uniform variables in GPU shaders.
Definition: vtkUniforms.h:42
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkNew< vtkUniforms >
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkShaderProperty::FragmentCustomUniforms
vtkNew< vtkUniforms > FragmentCustomUniforms
Definition: vtkShaderProperty.h:136
vtkX3D::name
Definition: vtkX3D.h:225
vtkObject.h
vtkShaderProperty
represent GPU shader properties
Definition: vtkShaderProperty.h:39
vtkX3D::string
Definition: vtkX3D.h:496
vtkNew.h
vtkShaderProperty::VertexCustomUniforms
vtkNew< vtkUniforms > VertexCustomUniforms
Definition: vtkShaderProperty.h:137
vtkShaderProperty::FragmentShaderCode
char * FragmentShaderCode
Definition: vtkShaderProperty.h:133
vtkX3D::index
Definition: vtkX3D.h:252
vtkShaderProperty::GeometryCustomUniforms
vtkNew< vtkUniforms > GeometryCustomUniforms
Definition: vtkShaderProperty.h:138
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:298