VTK  9.0.20201128
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 
110 
111 private:
113  void operator=(const vtkOpenGLShaderProperty&) = delete;
114 };
115 
116 #endif
vtkOpenGLShaderProperty
represent GPU shader properties
Definition: vtkOpenGLShaderProperty.h:40
vtkShaderProperty::GetNthShaderReplacement
virtual void GetNthShaderReplacement(vtkIdType index, std::string &name, bool &replaceFirst, std::string &replacementValue, bool &replaceAll)=0
vtkShaderProperty::AddFragmentShaderReplacement
virtual void AddFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
vtkShaderProperty::GetNumberOfShaderReplacements
virtual int GetNumberOfShaderReplacements()=0
vtkShader.h
vtkOpenGLUniforms
helper class to set custom uniform variables in GLSL shaders.
Definition: vtkOpenGLUniforms.h:41
vtkShaderProperty::AddVertexShaderReplacement
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.
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkShaderProperty::ClearGeometryShaderReplacement
virtual void ClearGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
vtkShaderProperty::AddGeometryShaderReplacement
virtual void AddGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst, const std::string &replacementValue, bool replaceAll)=0
vtkOpenGLShaderProperty::UserShaderReplacements
ReplacementMap UserShaderReplacements
Definition: vtkOpenGLShaderProperty.h:109
vtkOpenGLShaderProperty::GetAllShaderReplacements
const ReplacementMap & GetAllShaderReplacements()
Definition: vtkOpenGLShaderProperty.h:103
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkShader::Type
Type
Available shader types.
Definition: vtkShader.h:45
vtkShaderProperty::GetNthShaderReplacementTypeAsString
virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index)=0
vtkShaderProperty::ClearVertexShaderReplacement
virtual void ClearVertexShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
vtkOpenGLShaderProperty::ReplacementMap
std::map< vtkShader::ReplacementSpec, vtkShader::ReplacementValue > ReplacementMap
GetAllShaderReplacements returns all user-specified shader replacements.
Definition: vtkOpenGLShaderProperty.h:102
vtkShaderProperty::DeepCopy
void DeepCopy(vtkShaderProperty *p)
Assign one property to another.
vtkX3D::name
Definition: vtkX3D.h:225
vtkShaderProperty
represent GPU shader properties
Definition: vtkShaderProperty.h:39
vtkShaderProperty::ClearFragmentShaderReplacement
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
vtkX3D::string
Definition: vtkX3D.h:496
vtkShaderProperty.h
vtkShaderProperty::ClearAllShaderReplacements
virtual void ClearAllShaderReplacements()=0
vtkShaderProperty::ClearAllGeometryShaderReplacements
virtual void ClearAllGeometryShaderReplacements()=0
vtkShaderProperty::ClearAllVertexShaderReplacements
virtual void ClearAllVertexShaderReplacements()=0
vtkShaderProperty::ClearAllFragmentShaderReplacements
virtual void ClearAllFragmentShaderReplacements()=0
vtkShaderProperty::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::index
Definition: vtkX3D.h:252
vtkShaderProperty::New
static vtkShaderProperty * New()
Construct object with no shader replacements.