VTK  9.1.0
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 =========================================================================*/
119 #ifndef vtkShaderProperty_h
120 #define vtkShaderProperty_h
121 
122 #include "vtkNew.h" // For iVars
123 #include "vtkObject.h"
124 #include "vtkRenderingCoreModule.h" // For export macro
125 
126 class vtkUniforms;
127 
128 class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
129 {
130 public:
131  vtkTypeMacro(vtkShaderProperty, vtkObject);
132  void PrintSelf(ostream& os, vtkIndent indent) override;
133 
138 
143 
155 
157 
166  vtkSetStringMacro(VertexShaderCode);
167  vtkGetStringMacro(VertexShaderCode);
168  vtkSetStringMacro(FragmentShaderCode);
169  vtkGetStringMacro(FragmentShaderCode);
170  vtkSetStringMacro(GeometryShaderCode);
171  vtkGetStringMacro(GeometryShaderCode);
173 
175 
179  vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
180  vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
181  vtkGetObjectMacro(GeometryCustomUniforms, vtkUniforms);
183 
185 
192  virtual void AddVertexShaderReplacement(const std::string& originalValue,
193  bool replaceFirst, // do this replacement before the default
194  const std::string& replacementValue, bool replaceAll) = 0;
195  virtual void AddFragmentShaderReplacement(const std::string& originalValue,
196  bool replaceFirst, // do this replacement before the default
197  const std::string& replacementValue, bool replaceAll) = 0;
198  virtual void AddGeometryShaderReplacement(const std::string& originalValue,
199  bool replaceFirst, // do this replacement before the default
200  const std::string& replacementValue, bool replaceAll) = 0;
201  virtual int GetNumberOfShaderReplacements() = 0;
203  virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
204  std::string& replacementValue, bool& replaceAll) = 0;
206  const std::string& originalValue, bool replaceFirst) = 0;
208  const std::string& originalValue, bool replaceFirst) = 0;
210  const std::string& originalValue, bool replaceFirst) = 0;
214  virtual void ClearAllShaderReplacements() = 0;
216 
217 protected:
219  ~vtkShaderProperty() override;
220 
224 
228 
229 private:
230  vtkShaderProperty(const vtkShaderProperty&) = delete;
231  void operator=(const vtkShaderProperty&) = delete;
232 };
233 
234 #endif
vtkShaderProperty::GeometryShaderCode
char * GeometryShaderCode
Definition: vtkShaderProperty.h:223
vtkShaderProperty::GetNthShaderReplacement
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.
vtkShaderProperty::AddFragmentShaderReplacement
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.
vtkShaderProperty::GetShaderMTime
vtkMTimeType GetShaderMTime()
GetShaderMTime returns the last time a modification was made that affected the code of the shader (ei...
vtkShaderProperty::GetNumberOfShaderReplacements
virtual int GetNumberOfShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
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:332
vtkShaderProperty::~vtkShaderProperty
~vtkShaderProperty() override
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkShaderProperty::ClearGeometryShaderReplacement
virtual void ClearGeometryShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkShaderProperty::AddGeometryShaderReplacement
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.
vtkShaderProperty::VertexShaderCode
char * VertexShaderCode
Definition: vtkShaderProperty.h:221
vtkUniforms
helper class to set custom uniform variables in GPU shaders.
Definition: vtkUniforms.h:43
vtkShaderProperty::vtkShaderProperty
vtkShaderProperty()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkShaderProperty::GetNthShaderReplacementTypeAsString
virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkShaderProperty::ClearVertexShaderReplacement
virtual void ClearVertexShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkNew< vtkUniforms >
vtkShaderProperty::HasGeometryShaderCode
bool HasGeometryShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
vtkShaderProperty::DeepCopy
void DeepCopy(vtkShaderProperty *p)
Assign one property to another.
vtkShaderProperty::FragmentCustomUniforms
vtkNew< vtkUniforms > FragmentCustomUniforms
Definition: vtkShaderProperty.h:225
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkObject.h
vtkShaderProperty
represent GPU shader properties
Definition: vtkShaderProperty.h:129
vtkShaderProperty::ClearFragmentShaderReplacement
virtual void ClearFragmentShaderReplacement(const std::string &originalValue, bool replaceFirst)=0
This function enables you to apply your own substitutions to the shader creation process.
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkShaderProperty::ClearAllShaderReplacements
virtual void ClearAllShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
vtkNew.h
vtkShaderProperty::VertexCustomUniforms
vtkNew< vtkUniforms > VertexCustomUniforms
Definition: vtkShaderProperty.h:226
vtkShaderProperty::ClearAllGeometryShaderReplacements
virtual void ClearAllGeometryShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
vtkShaderProperty::ClearAllVertexShaderReplacements
virtual void ClearAllVertexShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
vtkShaderProperty::ClearAllFragmentShaderReplacements
virtual void ClearAllFragmentShaderReplacements()=0
This function enables you to apply your own substitutions to the shader creation process.
vtkShaderProperty::FragmentShaderCode
char * FragmentShaderCode
Definition: vtkShaderProperty.h:222
vtkShaderProperty::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkShaderProperty::GeometryCustomUniforms
vtkNew< vtkUniforms > GeometryCustomUniforms
Definition: vtkShaderProperty.h:227
vtkShaderProperty::New
static vtkShaderProperty * New()
Construct object with no shader replacements.
vtkShaderProperty::HasFragmentShaderCode
bool HasFragmentShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
vtkShaderProperty::HasVertexShaderCode
bool HasVertexShaderCode()
Allow the program to set the shader codes used directly instead of using the built in templates.