VTK  9.2.6
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 =========================================================================*/
42 #ifndef vtkShaderProperty_h
43 #define vtkShaderProperty_h
44 
45 #include "vtkNew.h" // For iVars
46 #include "vtkObject.h"
47 #include "vtkRenderingCoreModule.h" // For export macro
48 
49 class vtkUniforms;
50 
51 class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
52 {
53 public:
54  vtkTypeMacro(vtkShaderProperty, vtkObject);
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
61 
66 
78 
80 
89  vtkSetStringMacro(VertexShaderCode);
90  vtkGetStringMacro(VertexShaderCode);
91  vtkSetStringMacro(FragmentShaderCode);
92  vtkGetStringMacro(FragmentShaderCode);
93  vtkSetStringMacro(GeometryShaderCode);
94  vtkGetStringMacro(GeometryShaderCode);
96 
98 
102  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
103  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
104  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
106 
108 
115  virtual void AddVertexShaderReplacement(const std::string& originalValue,
116  bool replaceFirst, // do this replacement before the default
117  const std::string& replacementValue, bool replaceAll) = 0;
118  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
119  bool replaceFirst, // do this replacement before the default
120  const std::string& replacementValue, bool replaceAll) = 0;
121  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
122  bool replaceFirst, // do this replacement before the default
123  const std::string& replacementValue, bool replaceAll) = 0;
124  virtual int GetNumberOfShaderReplacements() = 0;
126  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
127  std::string& replacementValue, bool& replaceAll) = 0;
129  const std::string& originalValue, bool replaceFirst) = 0;
131  const std::string& originalValue, bool replaceFirst) = 0;
133  const std::string& originalValue, bool replaceFirst) = 0;
137  virtual void ClearAllShaderReplacements() = 0;
139 
140 protected:
142  ~vtkShaderProperty() override;
143 
147 
151 
152 private:
153  vtkShaderProperty(const vtkShaderProperty&) = delete;
154  void operator=(const vtkShaderProperty&) = delete;
155 };
156 
157 #endif
a simple class to control print indentation
Definition: vtkIndent.h:49
abstract base class for most VTK objects
Definition: vtkObject.h:72
represent GPU shader properties
bool HasFragmentShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
void DeepCopy(vtkShaderProperty *p)
Assign one property to another.
virtual int GetNumberOfShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
~vtkShaderProperty() override
vtkMTimeType GetShaderMTime()
GetShaderMTime returns the last time a modification was made that affected the code of the shader (ei...
virtual void ClearGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void ClearAllGeometryShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void ClearAllFragmentShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void ClearAllVertexShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void AddVertexShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
This function enables you to apply your own substitutions to the shader creation process.
bool HasGeometryShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
virtual void AddGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkNew< vtkUniforms > GeometryCustomUniforms
bool HasVertexShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
static vtkShaderProperty * New()
Construct object with no shader replacements.
virtual void ClearAllShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkNew< vtkUniforms > FragmentCustomUniforms
virtual void GetNthShaderReplacement(vtkIdType index, std::string &name, bool &replaceFirst, std::string &replacementValue, bool &replaceAll)=0
This function enables you to apply your own substitutions to the shader creation process.
virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index)=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void AddFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkNew< vtkUniforms > VertexCustomUniforms
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ClearVertexShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
helper class to set custom uniform variables in GPU shaders.
Definition: vtkUniforms.h:43
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287