VTK  9.7.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 "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 #include <map> // used for ivar
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkOpenGLUniforms;
30 
31 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLShaderProperty : public vtkShaderProperty
32 {
33 public:
34  static vtkOpenGLShaderProperty* New();
36  static vtkOverrideAttribute* CreateOverrideAttributes();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
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  void AddTessControlShaderReplacement(const std::string& originalValue,
55  bool replaceFirst, // do this replacement before the default
56  const std::string& replacementValue, bool replaceAll) override;
57  void AddTessEvaluationShaderReplacement(const std::string& originalValue,
58  bool replaceFirst, // do this replacement before the default
59  const std::string& replacementValue, bool replaceAll) override;
60 
61  int GetNumberOfShaderReplacements() override;
63  void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
64  std::string& replacementValue, bool& replaceAll) override;
65 
66  void ClearVertexShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
67  void ClearFragmentShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
68  void ClearGeometryShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
70  const std::string& originalValue, bool replaceFirst) override;
72  const std::string& originalValue, bool replaceFirst) override;
73  void ClearAllVertexShaderReplacements() override;
74  void ClearAllFragmentShaderReplacements() override;
75  void ClearAllGeometryShaderReplacements() override;
77  void ClearAllTessEvalShaderReplacements() override;
78  void ClearAllShaderReplacements() override;
79 
81 
88  void AddShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
89  const std::string& originalValue,
90  bool replaceFirst, // do this replacement before the default
91  const std::string& replacementValue, bool replaceAll);
92  void ClearShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
93  const std::string& originalValue, bool replaceFirst);
96 
97  typedef std::map<vtkShader::ReplacementSpec, vtkShader::ReplacementValue> ReplacementMap;
104  const ReplacementMap& GetAllShaderReplacements() { return this->UserShaderReplacements; }
105 
106 protected:
108  ~vtkOpenGLShaderProperty() override;
109 
110  ReplacementMap UserShaderReplacements;
111 
112 private:
114  void operator=(const vtkOpenGLShaderProperty&) = delete;
115 };
116 
117 #define vtkOpenGLShaderProperty_OVERRIDE_ATTRIBUTES \
118  vtkOpenGLShaderProperty::CreateOverrideAttributes()
119 VTK_ABI_NAMESPACE_END
120 #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.
Attribute for vtkObjectFactory overrides.
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:38
virtual void ClearTessControlShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void ClearAllTessControlShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
int vtkIdType
Definition: vtkType.h:363
represent GPU shader properties
virtual void AddTessControlShaderReplacement(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.
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()
GetAllShaderReplacements returns all user-specified shader replacements.
represent GPU shader properties
virtual void AddTessEvaluationShaderReplacement(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.
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
#define VTK_NEWINSTANCE
virtual void ClearTessEvaluationShaderReplacement(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
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 ClearAllTessEvalShaderReplacements()=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.
#define VTK_MARSHALAUTO
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.