VTK  9.3.20240419
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;
29 
30 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLShaderProperty : public vtkShaderProperty
31 {
32 public:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
40 
45 
46  void AddVertexShaderReplacement(const std::string& originalValue,
47  bool replaceFirst, // do this replacement before the default
48  const std::string& replacementValue, bool replaceAll) override;
49  void AddFragmentShaderReplacement(const std::string& originalValue,
50  bool replaceFirst, // do this replacement before the default
51  const std::string& replacementValue, bool replaceAll) override;
52  void AddGeometryShaderReplacement(const std::string& originalValue,
53  bool replaceFirst, // do this replacement before the default
54  const std::string& replacementValue, bool replaceAll) override;
55  void AddTessControlShaderReplacement(const std::string& originalValue,
56  bool replaceFirst, // do this replacement before the default
57  const std::string& replacementValue, bool replaceAll) override;
59  bool replaceFirst, // do this replacement before the default
60  const std::string& replacementValue, bool replaceAll) override;
61 
65  std::string& replacementValue, bool& replaceAll) override;
66 
67  void ClearVertexShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
68  void ClearFragmentShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
69  void ClearGeometryShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
71  const std::string& originalValue, bool replaceFirst) override;
73  const std::string& originalValue, bool replaceFirst) override;
79  void ClearAllShaderReplacements() override;
80 
82 
89  void AddShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
90  const std::string& originalValue,
91  bool replaceFirst, // do this replacement before the default
92  const std::string& replacementValue, bool replaceAll);
93  void ClearShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
94  const std::string& originalValue, bool replaceFirst);
97 
104  typedef std::map<vtkShader::ReplacementSpec, vtkShader::ReplacementValue> ReplacementMap;
105  const ReplacementMap& GetAllShaderReplacements() { return this->UserShaderReplacements; }
106 
107 protected:
110 
112 
113 private:
115  void operator=(const vtkOpenGLShaderProperty&) = delete;
116 };
117 
118 VTK_ABI_NAMESPACE_END
119 #endif
a simple class to control print indentation
Definition: vtkIndent.h:108
represent GPU shader properties
void ClearVertexShaderReplacement(const std::string &originalValue, bool replaceFirst) override
This function enables you to apply your own substitutions to the shader creation process.
void DeepCopy(vtkOpenGLShaderProperty *p)
Assign one property to another.
void GetNthShaderReplacement(vtkIdType index, std::string &name, bool &replaceFirst, std::string &replacementValue, bool &replaceAll) override
This function enables you to apply your own substitutions to the shader creation process.
void ClearAllTessEvalShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
void ClearShaderReplacement(vtkShader::Type shaderType, const std::string &originalValue, bool replaceFirst)
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.
const ReplacementMap & GetAllShaderReplacements()
void AddShaderReplacement(vtkShader::Type shaderType, const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)
This function enables you to apply your own substitutions to the shader creation process.
void AddVertexShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll) override
This function enables you to apply your own substitutions to the shader creation process.
void ClearAllFragmentShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
void ClearTessEvaluationShaderReplacement(const std::string &originalValue, bool replaceFirst) override
This function enables you to apply your own substitutions to the shader creation process.
void ClearGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst) override
This function enables you to apply your own substitutions to the shader creation process.
void AddFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll) override
This function enables you to apply your own substitutions to the shader creation process.
std::string GetNthShaderReplacementTypeAsString(vtkIdType index) override
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 ClearTessControlShaderReplacement(const std::string &originalValue, bool replaceFirst) override
This function enables you to apply your own substitutions to the shader creation process.
void ClearAllVertexShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst) override
This function enables you to apply your own substitutions to the shader creation process.
void ClearAllShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
void AddGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll) override
This function enables you to apply your own substitutions to the shader creation process.
static vtkOpenGLShaderProperty * New()
Construct object with no shader replacements.
~vtkOpenGLShaderProperty() override
void ClearAllTessControlShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
void ClearAllGeometryShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
int GetNumberOfShaderReplacements() override
This function enables you to apply your own substitutions to the shader creation process.
void ClearAllShaderReplacements(vtkShader::Type shaderType)
This function enables you to apply your own substitutions to the shader creation process.
void AddTessEvaluationShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll) override
This function enables you to apply your own substitutions to the shader creation process.
void AddTessControlShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll) override
This function enables you to apply your own substitutions to the shader creation process.
helper class to set custom uniform variables in GLSL shaders.
represent GPU shader properties
Type
Available shader types.
Definition: vtkShader.h:128
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315
#define VTK_MARSHALAUTO