VTK  9.3.0
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
30#ifndef vtkShaderProperty_h
31#define vtkShaderProperty_h
32
33#include "vtkNew.h" // For iVars
34#include "vtkObject.h"
35#include "vtkRenderingCoreModule.h" // For export macro
36
37VTK_ABI_NAMESPACE_BEGIN
38class vtkUniforms;
39
40class VTKRENDERINGCORE_EXPORT vtkShaderProperty : public vtkObject
41{
42public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
50
55
67
69
78 vtkSetStringMacro(VertexShaderCode);
79 vtkGetStringMacro(VertexShaderCode);
80 vtkSetStringMacro(FragmentShaderCode);
81 vtkGetStringMacro(FragmentShaderCode);
82 vtkSetStringMacro(GeometryShaderCode);
83 vtkGetStringMacro(GeometryShaderCode);
85
87
91 vtkGetObjectMacro(FragmentCustomUniforms, vtkUniforms);
92 vtkGetObjectMacro(VertexCustomUniforms, vtkUniforms);
93 vtkGetObjectMacro(GeometryCustomUniforms, 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;
114 virtual std::string GetNthShaderReplacementTypeAsString(vtkIdType index) = 0;
115 virtual void GetNthShaderReplacement(vtkIdType index, std::string& name, bool& replaceFirst,
116 std::string& replacementValue, bool& replaceAll) = 0;
118 const std::string& originalValue, bool replaceFirst) = 0;
120 const std::string& originalValue, bool replaceFirst) = 0;
122 const std::string& originalValue, bool replaceFirst) = 0;
126 virtual void ClearAllShaderReplacements() = 0;
128
129protected:
132
136
140
141private:
142 vtkShaderProperty(const vtkShaderProperty&) = delete;
143 void operator=(const vtkShaderProperty&) = delete;
144};
145
146VTK_ABI_NAMESPACE_END
147#endif
a simple class to control print indentation
Definition vtkIndent.h:38
Allocate and hold a VTK object.
Definition vtkNew.h:60
abstract base class for most VTK objects
Definition vtkObject.h:58
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.
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
static vtkShaderProperty * New()
Construct object with no shader replacements.
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:33
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270