VTK  9.3.0
vtkShaderProperty.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
21 #ifndef vtkShaderProperty_h
22 #define vtkShaderProperty_h
23 
24 #include "vtkNew.h" // For iVars
25 #include "vtkObject.h"
26 #include "vtkRenderingCoreModule.h" // For export macro
27 
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkUniforms;
30 
31 class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
32 {
33 public:
34  vtkTypeMacro(vtkShaderProperty, vtkObject);
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
41 
46 
58 
60 
69  vtkSetStringMacro(VertexShaderCode);
70  vtkGetStringMacro(VertexShaderCode);
71  vtkSetStringMacro(FragmentShaderCode);
72  vtkGetStringMacro(FragmentShaderCode);
73  vtkSetStringMacro(GeometryShaderCode);
74  vtkGetStringMacro(GeometryShaderCode);
76 
78 
82  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
83  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
84  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
86 
88 
95  virtual void AddVertexShaderReplacement(const std::string& originalValue,
96  bool replaceFirst, // do this replacement before the default
97  const std::string& replacementValue, bool replaceAll) = 0;
98  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
99  bool replaceFirst, // do this replacement before the default
100  const std::string& replacementValue, bool replaceAll) = 0;
101  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
102  bool replaceFirst, // do this replacement before the default
103  const std::string& replacementValue, bool replaceAll) = 0;
104  virtual int GetNumberOfShaderReplacements() = 0;
106  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
107  std::string& replacementValue, bool& replaceAll) = 0;
109  const std::string& originalValue, bool replaceFirst) = 0;
111  const std::string& originalValue, bool replaceFirst) = 0;
113  const std::string& originalValue, bool replaceFirst) = 0;
117  virtual void ClearAllShaderReplacements() = 0;
119 
120 protected:
122  ~vtkShaderProperty() override;
123 
127 
131 
132 private:
133  vtkShaderProperty(const vtkShaderProperty&) = delete;
134  void operator=(const vtkShaderProperty&) = delete;
135 };
136 
137 VTK_ABI_NAMESPACE_END
138 #endif
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
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:33
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270