VTK  9.0.20210119
vtkShader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
21 #ifndef vtkShader_h
22 #define vtkShader_h
23 
24 #include "vtkObject.h"
25 #include "vtkRenderingOpenGL2Module.h" // for export macro
26 
27 #include <string> // For member variables.
28 #include <vector> // For member variables.
29 
37 class VTKRENDERINGOPENGL2_EXPORT vtkShader : public vtkObject
38 {
39 public:
40  static vtkShader* New();
41  vtkTypeMacro(vtkShader, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45  enum Type
46  {
51  };
52 
54  void SetType(Type type);
55 
57  Type GetType() const { return this->ShaderType; }
58 
60  void SetSource(const std::string& source);
61 
63  std::string GetSource() const { return this->Source; }
64 
66  std::string GetError() const { return this->Error; }
67 
69  int GetHandle() const { return this->Handle; }
70 
74  bool Compile();
75 
80  void Cleanup();
81 
83  {
84  public:
88  bool operator<(const ReplacementSpec& v1) const
89  {
90  if (this->OriginalValue != v1.OriginalValue)
91  {
92  return this->OriginalValue < v1.OriginalValue;
93  }
94  if (this->ShaderType != v1.ShaderType)
95  {
96  return this->ShaderType < v1.ShaderType;
97  }
98  return (this->ReplaceFirst < v1.ReplaceFirst);
99  }
100  bool operator>(const ReplacementSpec& v1) const
101  {
102  if (this->OriginalValue != v1.OriginalValue)
103  {
104  return this->OriginalValue > v1.OriginalValue;
105  }
106  if (this->ShaderType != v1.ShaderType)
107  {
108  return this->ShaderType > v1.ShaderType;
109  }
110  return (this->ReplaceFirst > v1.ReplaceFirst);
111  }
112  };
114  {
115  public:
118  };
119 
120 protected:
121  vtkShader();
122  ~vtkShader() override;
123 
125  int Handle;
126  bool Dirty;
127 
130 
131 private:
132  vtkShader(const vtkShader&) = delete;
133  void operator=(const vtkShader&) = delete;
134 };
135 
136 #endif
vtkShader::ReplacementValue::Replacement
std::string Replacement
Definition: vtkShader.h:116
vtkShader::Fragment
Fragment shader.
Definition: vtkShader.h:48
vtkX3D::type
Definition: vtkX3D.h:522
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkShader::GetError
std::string GetError() const
Get the error message (empty if none) for the shader.
Definition: vtkShader.h:66
vtkShader::Handle
int Handle
Definition: vtkShader.h:125
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkShader::ReplacementSpec::ReplaceFirst
bool ReplaceFirst
Definition: vtkShader.h:87
vtkShader::ReplacementSpec::operator>
bool operator>(const ReplacementSpec &v1) const
Definition: vtkShader.h:100
detail::Type
Type
Definition: TestQtCommon.h:18
vtkShader::Dirty
bool Dirty
Definition: vtkShader.h:126
vtkShader::ReplacementSpec::OriginalValue
std::string OriginalValue
Definition: vtkShader.h:85
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkShader::Type
Type
Available shader types.
Definition: vtkShader.h:45
vtkShader::GetHandle
int GetHandle() const
Get the handle of the shader.
Definition: vtkShader.h:69
vtkShader::ShaderType
Type ShaderType
Definition: vtkShader.h:124
vtkShader
Vertex or Fragment shader, combined into a ShaderProgram.
Definition: vtkShader.h:37
vtkShader::ReplacementValue::ReplaceAll
bool ReplaceAll
Definition: vtkShader.h:117
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkShader::Source
std::string Source
Definition: vtkShader.h:128
vtkShader::ReplacementValue
Definition: vtkShader.h:113
vtkShader::Error
std::string Error
Definition: vtkShader.h:129
vtkShader::ReplacementSpec::ShaderType
vtkShader::Type ShaderType
Definition: vtkShader.h:86
vtkObject.h
vtkShader::GetType
Type GetType() const
Get the shader type, typically Vertex or Fragment.
Definition: vtkShader.h:57
vtkShader::Geometry
Geometry shader.
Definition: vtkShader.h:49
vtkX3D::string
Definition: vtkX3D.h:496
vtkShader::ReplacementSpec::operator<
bool operator<(const ReplacementSpec &v1) const
Definition: vtkShader.h:88
vtkShader::ReplacementSpec
Definition: vtkShader.h:82
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:959
vtkShader::Vertex
Vertex shader.
Definition: vtkShader.h:47
vtkEventDataDevice::Unknown
vtkShader::GetSource
std::string GetSource() const
Get the source for the shader.
Definition: vtkShader.h:63