VTK  9.1.0
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 
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 
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;
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:
108 
110 
111 private:
113  void operator=(const vtkOpenGLShaderProperty&) = delete;
114 };
115 
116 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
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:46
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332