VTK  9.3.0
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 
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 
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;
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:
97 
99 
100 private:
102  void operator=(const vtkOpenGLShaderProperty&) = delete;
103 };
104 
105 VTK_ABI_NAMESPACE_END
106 #endif
a simple class to control print indentation
Definition: vtkIndent.h:38
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 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 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 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 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.
helper class to set custom uniform variables in GLSL shaders.
represent GPU shader properties
Type
Available shader types.
Definition: vtkShader.h:45
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315