VTK  9.3.1
vtkOpenGLShaderProperty.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
18 #ifndef vtkOpenGLShaderProperty_h
19 #define vtkOpenGLShaderProperty_h
20 
21 #include "vtkRenderingOpenGL2Module.h" // For export macro
22 #include "vtkShader.h" // For methods (shader types)
23 #include "vtkShaderProperty.h"
24 #include <map> // used for ivar
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkOpenGLUniforms;
28 
29 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLShaderProperty : public vtkShaderProperty
30 {
31 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
38  static vtkOpenGLShaderProperty* New();
39 
44 
45  void AddVertexShaderReplacement(const std::string& originalValue,
46  bool replaceFirst, // do this replacement before the default
47  const std::string& replacementValue, bool replaceAll) override;
48  void AddFragmentShaderReplacement(const std::string& originalValue,
49  bool replaceFirst, // do this replacement before the default
50  const std::string& replacementValue, bool replaceAll) override;
51  void AddGeometryShaderReplacement(const std::string& originalValue,
52  bool replaceFirst, // do this replacement before the default
53  const std::string& replacementValue, bool replaceAll) override;
54 
55  int GetNumberOfShaderReplacements() override;
57  void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
58  std::string& replacementValue, bool& replaceAll) override;
59 
60  void ClearVertexShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
61  void ClearFragmentShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
62  void ClearGeometryShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
63  void ClearAllVertexShaderReplacements() override;
64  void ClearAllFragmentShaderReplacements() override;
65  void ClearAllGeometryShaderReplacements() override;
66  void ClearAllShaderReplacements() override;
67 
69 
76  void AddShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
77  const std::string& originalValue,
78  bool replaceFirst, // do this replacement before the default
79  const std::string& replacementValue, bool replaceAll);
80  void ClearShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
81  const std::string& originalValue, bool replaceFirst);
84 
91  typedef std::map<vtkShader::ReplacementSpec, vtkShader::ReplacementValue> ReplacementMap;
92  const ReplacementMap& GetAllShaderReplacements() { return this->UserShaderReplacements; }
93 
94 protected:
96  ~vtkOpenGLShaderProperty() override;
97 
98  ReplacementMap UserShaderReplacements;
99 
100 private:
102  void operator=(const vtkOpenGLShaderProperty&) = delete;
103 };
104 
105 VTK_ABI_NAMESPACE_END
106 #endif
helper class to set custom uniform variables in GLSL shaders.
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 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 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.
static vtkShaderProperty * New()
Construct object with no shader replacements.
virtual int GetNumberOfShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
Type
Available shader types.
Definition: vtkShader.h:35
int vtkIdType
Definition: vtkType.h:315
represent GPU shader properties
virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index)=0
This function enables you to apply your own substitutions to the shader creation process.
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 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.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ClearVertexShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
const ReplacementMap & GetAllShaderReplacements()
represent GPU shader properties
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
std::map< vtkShader::ReplacementSpec, vtkShader::ReplacementValue > ReplacementMap
GetAllShaderReplacements returns all user-specified shader replacements.
void DeepCopy(vtkShaderProperty *p)
Assign one property to another.
virtual void ClearAllShaderReplacements()=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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.