VTK  9.2.6
vtkShaderProperty.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 =========================================================================*/
33 #ifndef vtkShaderProperty_h
34 #define vtkShaderProperty_h
35 
36 #include "vtkNew.h" // For iVars
37 #include "vtkObject.h"
38 #include "vtkRenderingCoreModule.h" // For export macro
39 
40 class vtkUniforms;
41 
42 class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
43 {
44 public:
45  vtkTypeMacro(vtkShaderProperty, vtkObject);
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  static vtkShaderProperty* New();
52 
56  void DeepCopy(vtkShaderProperty* p);
57 
68  vtkMTimeType GetShaderMTime();
69 
71 
77  bool HasVertexShaderCode();
78  bool HasFragmentShaderCode();
79  bool HasGeometryShaderCode();
80  vtkSetStringMacro(VertexShaderCode);
81  vtkGetStringMacro(VertexShaderCode);
82  vtkSetStringMacro(FragmentShaderCode);
83  vtkGetStringMacro(FragmentShaderCode);
84  vtkSetStringMacro(GeometryShaderCode);
85  vtkGetStringMacro(GeometryShaderCode);
87 
89 
93  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
94  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
95  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
97 
99 
106  virtual void AddVertexShaderReplacement(const std::string& originalValue,
107  bool replaceFirst, // do this replacement before the default
108  const std::string& replacementValue, bool replaceAll) = 0;
109  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
110  bool replaceFirst, // do this replacement before the default
111  const std::string& replacementValue, bool replaceAll) = 0;
112  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
113  bool replaceFirst, // do this replacement before the default
114  const std::string& replacementValue, bool replaceAll) = 0;
115  virtual int GetNumberOfShaderReplacements() = 0;
116  virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index) = 0;
117  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
118  std::string& replacementValue, bool& replaceAll) = 0;
119  virtual void ClearVertexShaderReplacement(
120  const std::string& originalValue, bool replaceFirst) = 0;
121  virtual void ClearFragmentShaderReplacement(
122  const std::string& originalValue, bool replaceFirst) = 0;
123  virtual void ClearGeometryShaderReplacement(
124  const std::string& originalValue, bool replaceFirst) = 0;
125  virtual void ClearAllVertexShaderReplacements() = 0;
126  virtual void ClearAllFragmentShaderReplacements() = 0;
127  virtual void ClearAllGeometryShaderReplacements() = 0;
128  virtual void ClearAllShaderReplacements() = 0;
130 
131 protected:
133  ~vtkShaderProperty() override;
134 
138 
142 
143 private:
144  vtkShaderProperty(const vtkShaderProperty&) = delete;
145  void operator=(const vtkShaderProperty&) = delete;
146 };
147 
148 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
int vtkIdType
Definition: vtkType.h:332
a simple class to control print indentation
Definition: vtkIndent.h:39
represent GPU shader properties
vtkNew< vtkUniforms > FragmentCustomUniforms
helper class to set custom uniform variables in GPU shaders.
Definition: vtkUniforms.h:42
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkNew< vtkUniforms > VertexCustomUniforms
vtkNew< vtkUniforms > GeometryCustomUniforms