VTK  9.2.20221001
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 =========================================================================*/
122 #ifndef vtkShaderProperty_h
123 #define vtkShaderProperty_h
124 
125 #include "vtkNew.h" // For iVars
126 #include "vtkObject.h"
127 #include "vtkRenderingCoreModule.h" // For export macro
128 
129 VTK_ABI_NAMESPACE_BEGIN
130 class vtkUniforms;
131 
132 class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
133 {
134 public:
135  vtkTypeMacro(vtkShaderProperty, vtkObject);
136  void PrintSelf(ostream& os, vtkIndent indent) override;
137 
142 
147 
159 
161 
170  vtkSetStringMacro(VertexShaderCode);
171  vtkGetStringMacro(VertexShaderCode);
172  vtkSetStringMacro(FragmentShaderCode);
173  vtkGetStringMacro(FragmentShaderCode);
174  vtkSetStringMacro(GeometryShaderCode);
175  vtkGetStringMacro(GeometryShaderCode);
177 
179 
183  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
184  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
185  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
187 
189 
196  virtual void AddVertexShaderReplacement(const std::string& originalValue,
197  bool replaceFirst, // do this replacement before the default
198  const std::string& replacementValue, bool replaceAll) = 0;
199  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
200  bool replaceFirst, // do this replacement before the default
201  const std::string& replacementValue, bool replaceAll) = 0;
202  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
203  bool replaceFirst, // do this replacement before the default
204  const std::string& replacementValue, bool replaceAll) = 0;
205  virtual int GetNumberOfShaderReplacements() = 0;
207  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
208  std::string& replacementValue, bool& replaceAll) = 0;
210  const std::string& originalValue, bool replaceFirst) = 0;
212  const std::string& originalValue, bool replaceFirst) = 0;
214  const std::string& originalValue, bool replaceFirst) = 0;
218  virtual void ClearAllShaderReplacements() = 0;
220 
221 protected:
223  ~vtkShaderProperty() override;
224 
228 
232 
233 private:
234  vtkShaderProperty(const vtkShaderProperty&) = delete;
235  void operator=(const vtkShaderProperty&) = delete;
236 };
237 
238 VTK_ABI_NAMESPACE_END
239 #endif
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
represent GPU shader properties
bool HasFragmentShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
void DeepCopy(vtkShaderProperty *p)
Assign one property to another.
virtual int GetNumberOfShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
~vtkShaderProperty() override
vtkMTimeType GetShaderMTime()
GetShaderMTime returns the last time a modification was made that affected the code of the shader (ei...
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 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 ClearAllVertexShaderReplacements()=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.
bool HasGeometryShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
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.
vtkNew< vtkUniforms > GeometryCustomUniforms
bool HasVertexShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
static vtkShaderProperty * New()
Construct object with no shader replacements.
virtual void ClearAllShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkNew< vtkUniforms > FragmentCustomUniforms
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 std::string GetNthShaderReplacementTypeAsString(vtkIdType index)=0
This function enables you to apply your own substitutions to the shader creation process.
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.
vtkNew< vtkUniforms > VertexCustomUniforms
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ClearVertexShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
helper class to set custom uniform variables in GPU shaders.
Definition: vtkUniforms.h:44
@ name
Definition: vtkX3D.h:231
@ index
Definition: vtkX3D.h:258
@ string
Definition: vtkX3D.h:502
int vtkIdType
Definition: vtkType.h:326
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:281