VTK  9.7.1
vtkShaderProperty.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
21 #ifndef vtkShaderProperty_h
22 #define vtkShaderProperty_h
23 
24 #include "vtkNew.h" // For iVars
25 #include "vtkObject.h"
26 #include "vtkRenderingCoreModule.h" // For export macro
27 #include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkUniforms;
31 
32 class VTKRENDERINGCORE_EXPORT VTK_MARSHALMANUAL vtkShaderProperty : public vtkObject
33 {
34 public:
35  vtkTypeMacro(vtkShaderProperty, vtkObject);
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
41  static vtkShaderProperty* New();
42 
46  void DeepCopy(vtkShaderProperty* p);
47 
58  vtkMTimeType GetShaderMTime();
59 
61 
67  bool HasVertexShaderCode();
68  bool HasFragmentShaderCode();
69  bool HasGeometryShaderCode();
70  bool HasTessControlShaderCode();
71  bool HasTessEvalShaderCode();
72  vtkSetStringMacro(VertexShaderCode);
73  vtkGetStringMacro(VertexShaderCode);
74  vtkSetStringMacro(FragmentShaderCode);
75  vtkGetStringMacro(FragmentShaderCode);
76  vtkSetStringMacro(GeometryShaderCode);
77  vtkGetStringMacro(GeometryShaderCode);
78  vtkSetStringMacro(TessControlShaderCode);
79  vtkGetStringMacro(TessControlShaderCode);
80  vtkSetStringMacro(TessEvaluationShaderCode);
81  vtkGetStringMacro(TessEvaluationShaderCode);
83 
85 
89  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
90  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
91  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
92  vtkGetObjectMacro(TessControlCustomUniforms, vtkUniforms);
93  vtkGetObjectMacro(TessEvaluationCustomUniforms, vtkUniforms);
95 
97 
104  virtual void AddVertexShaderReplacement(const std::string& originalValue,
105  bool replaceFirst, // do this replacement before the default
106  const std::string& replacementValue, bool replaceAll) = 0;
107  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
108  bool replaceFirst, // do this replacement before the default
109  const std::string& replacementValue, bool replaceAll) = 0;
110  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
111  bool replaceFirst, // do this replacement before the default
112  const std::string& replacementValue, bool replaceAll) = 0;
113  virtual void AddTessControlShaderReplacement(const std::string& originalValue,
114  bool replaceFirst, // do this replacement before the default
115  const std::string& replacementValue, bool replaceAll) = 0;
116  virtual void AddTessEvaluationShaderReplacement(const std::string& originalValue,
117  bool replaceFirst, // do this replacement before the default
118  const std::string& replacementValue, bool replaceAll) = 0;
119  virtual int GetNumberOfShaderReplacements() = 0;
120  virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index) = 0;
121  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
122  std::string& replacementValue, bool& replaceAll) = 0;
123  virtual void ClearVertexShaderReplacement(
124  const std::string& originalValue, bool replaceFirst) = 0;
125  virtual void ClearFragmentShaderReplacement(
126  const std::string& originalValue, bool replaceFirst) = 0;
127  virtual void ClearGeometryShaderReplacement(
128  const std::string& originalValue, bool replaceFirst) = 0;
129  virtual void ClearTessControlShaderReplacement(
130  const std::string& originalValue, bool replaceFirst) = 0;
131  virtual void ClearTessEvaluationShaderReplacement(
132  const std::string& originalValue, bool replaceFirst) = 0;
133  virtual void ClearAllVertexShaderReplacements() = 0;
134  virtual void ClearAllFragmentShaderReplacements() = 0;
135  virtual void ClearAllGeometryShaderReplacements() = 0;
136  virtual void ClearAllTessControlShaderReplacements() = 0;
137  virtual void ClearAllTessEvalShaderReplacements() = 0;
138  virtual void ClearAllShaderReplacements() = 0;
140 
141 protected:
143  ~vtkShaderProperty() override;
144 
150 
156 
157 private:
158  vtkShaderProperty(const vtkShaderProperty&) = delete;
159  void operator=(const vtkShaderProperty&) = delete;
160 };
161 
162 VTK_ABI_NAMESPACE_END
163 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
vtkNew< vtkUniforms > TessControlCustomUniforms
int vtkIdType
Definition: vtkType.h:363
#define VTK_MARSHALMANUAL
a simple class to control print indentation
Definition: vtkIndent.h:28
represent GPU shader properties
vtkNew< vtkUniforms > FragmentCustomUniforms
helper class to set custom uniform variables in GPU shaders.
Definition: vtkUniforms.h:32
vtkNew< vtkUniforms > TessEvaluationCustomUniforms
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