VTK  9.0.1
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 
49 
54 
66 
68 
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;
114  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
115  std::string& replacementValue, bool& replaceAll) = 0;
117  const std::string& originalValue, bool replaceFirst) = 0;
119  const std::string& originalValue, bool replaceFirst) = 0;
121  const std::string& originalValue, bool replaceFirst) = 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
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:54
represent GPU shader properties
bool HasFragmentShaderCode()
void DeepCopy(vtkShaderProperty *p)
Assign one property to another.
virtual int GetNumberOfShaderReplacements()=0
~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
virtual void ClearAllGeometryShaderReplacements()=0
virtual void ClearAllFragmentShaderReplacements()=0
virtual void ClearAllVertexShaderReplacements()=0
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()
virtual void AddGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
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
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
vtkNew< vtkUniforms > FragmentCustomUniforms
virtual void GetNthShaderReplacement(vtkIdType index, std::string &name, bool &replaceFirst, std::string &replacementValue, bool &replaceAll)=0
virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index)=0
virtual void AddFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
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
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:338
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293