VTK  9.2.6
vtkOpenGLShaderProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkShaderProperty.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkOpenGLShaderProperty_h
31 #define vtkOpenGLShaderProperty_h
32 
33 #include "vtkRenderingOpenGL2Module.h" // For export macro
34 #include "vtkShader.h" // For methods (shader types)
35 #include "vtkShaderProperty.h"
36 #include <map> // used for ivar
37 
38 class vtkOpenGLUniforms;
39 
40 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLShaderProperty : public vtkShaderProperty
41 {
42 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
49  static vtkOpenGLShaderProperty* New();
50 
55 
56  void AddVertexShaderReplacement(const std::string& originalValue,
57  bool replaceFirst, // do this replacement before the default
58  const std::string& replacementValue, bool replaceAll) override;
59  void AddFragmentShaderReplacement(const std::string& originalValue,
60  bool replaceFirst, // do this replacement before the default
61  const std::string& replacementValue, bool replaceAll) override;
62  void AddGeometryShaderReplacement(const std::string& originalValue,
63  bool replaceFirst, // do this replacement before the default
64  const std::string& replacementValue, bool replaceAll) override;
65 
66  int GetNumberOfShaderReplacements() override;
68  void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
69  std::string& replacementValue, bool& replaceAll) override;
70 
71  void ClearVertexShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
72  void ClearFragmentShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
73  void ClearGeometryShaderReplacement(const std::string& originalValue, bool replaceFirst) override;
74  void ClearAllVertexShaderReplacements() override;
75  void ClearAllFragmentShaderReplacements() override;
76  void ClearAllGeometryShaderReplacements() override;
77  void ClearAllShaderReplacements() override;
78 
80 
87  void AddShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
88  const std::string& originalValue,
89  bool replaceFirst, // do this replacement before the default
90  const std::string& replacementValue, bool replaceAll);
91  void ClearShaderReplacement(vtkShader::Type shaderType, // vertex, fragment, etc
92  const std::string& originalValue, bool replaceFirst);
95 
102  typedef std::map<vtkShader::ReplacementSpec, vtkShader::ReplacementValue> ReplacementMap;
103  const ReplacementMap& GetAllShaderReplacements() { return this->UserShaderReplacements; }
104 
105 protected:
107  ~vtkOpenGLShaderProperty() override;
108 
109  ReplacementMap UserShaderReplacements;
110 
111 private:
113  void operator=(const vtkOpenGLShaderProperty&) = delete;
114 };
115 
116 #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:45
int vtkIdType
Definition: vtkType.h:332
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:39
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.