VTK
vtkUniformVariables.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUniformVariables.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 =========================================================================*/
29 #ifndef vtkUniformVariables_h
30 #define vtkUniformVariables_h
31 
32 #include "vtkRenderingOpenGLModule.h" // For export macro
33 #include "vtkObject.h"
34 
35 class vtkUniformVariablesMap; // internal
36 
38 {
39 public:
42  void PrintSelf(ostream &os, vtkIndent indent);
43 
45 
48  void SetUniformi(const char *name,
49  int numberOfComponents,
50  int *value);
52 
53  //BTX
54  template<typename T>
55  void SetUniformit(const char *name,
56  int numberOfComponents,
57  T *value);
58 
59  template<typename T>
60  void SetUniformit(const char *name, T value)
61  { this->SetUniformit(name, 1, &value); }
62  //ETX
63 
65 
68  void SetUniformf(const char *name,
69  int numberOfComponents,
70  float *value);
72 
73  //BTX
74  template<typename T>
75  void SetUniformft(const char *name,
76  int numberOfComponents,
77  T *value);
78 
79  template<typename T>
80  void SetUniformft(const char *name, T value)
81  { this->SetUniformft(name, 1, &value); }
82  //ETX
83 
85 
90  void SetUniformiv(const char *name,
91  int numberOfComponents,
92  int numberOfElements,
93  int *value);
95 
97 
102  void SetUniformfv(const char *name,
103  int numberOfComponents,
104  int numberOfElements,
105  float *value);
107 
109 
112  void SetUniformMatrix(const char *name,
113  int rows,
114  int columns,
115  float *value);
117 
119  void RemoveUniform(const char *name);
120 
123 
125 
126  void Send(const char *name,
127  int uniformIndex);
129 
131  void Start();
132 
134  bool IsAtEnd();
135 
138  const char *GetCurrentName();
139 
143 
145  void Next();
146 
150 
154 
155 protected:
158 
159 private:
160  vtkUniformVariables(const vtkUniformVariables&); // Not implemented.
161  void operator=(const vtkUniformVariables&); // Not implemented.
162 
163  vtkUniformVariablesMap *Map;
164 };
165 
166 //BTX
167 // ----------------------------------------------------------------------------
168 template<typename T>
170  int numberOfComponents,
171  T *value)
172 {
173  int ivalues[4];
174  for (int i=0; i<numberOfComponents; ++i)
175  {
176  ivalues[i] = static_cast<int>(value[i]);
177  }
178  this->SetUniformi(name, numberOfComponents, ivalues);
179 }
180 
181 // ----------------------------------------------------------------------------
182 template<typename T>
184  int numberOfComponents,
185  T *value)
186 {
187  float fvalues[4];
188  for (int i=0; i<numberOfComponents; ++i)
189  {
190  fvalues[i] = static_cast<float>(value[i]);
191  }
192  this->SetUniformf(name, numberOfComponents, fvalues);
193 }
194 //ETX
195 
196 #endif
vtkUniformVariables::Send
void Send(const char *name, int uniformIndex)
vtkUniformVariables::GetCurrentName
const char * GetCurrentName()
vtkUniformVariables::SetUniformfv
void SetUniformfv(const char *name, int numberOfComponents, int numberOfElements, float *value)
vtkUniformVariables::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkUniformVariables::Merge
void Merge(vtkUniformVariables *other)
vtkRenderingOpenGLModule.h
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkUniformVariables::Start
void Start()
vtkUniformVariables::IsAtEnd
bool IsAtEnd()
vtkUniformVariables::RemoveUniform
void RemoveUniform(const char *name)
vtkUniformVariables::SetUniformit
void SetUniformit(const char *name, int numberOfComponents, T *value)
Definition: vtkUniformVariables.h:169
vtkUniformVariables::SetUniformit
void SetUniformit(const char *name, T value)
Definition: vtkUniformVariables.h:60
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkgl::value
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
vtkUniformVariables::SetUniformf
void SetUniformf(const char *name, int numberOfComponents, float *value)
vtkUniformVariables::DeepCopy
void DeepCopy(vtkUniformVariables *other)
vtkUniformVariables::Next
void Next()
vtkUniformVariables::SetUniformft
void SetUniformft(const char *name, int numberOfComponents, T *value)
Definition: vtkUniformVariables.h:183
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkUniformVariables::SendCurrentUniform
void SendCurrentUniform(int uniformIndex)
vtkUniformVariables::vtkUniformVariables
vtkUniformVariables()
vtkUniformVariables::SetUniformft
void SetUniformft(const char *name, T value)
Definition: vtkUniformVariables.h:80
vtkUniformVariables::SetUniformiv
void SetUniformiv(const char *name, int numberOfComponents, int numberOfElements, int *value)
vtkUniformVariables
GLSL uniform variables.
Definition: vtkUniformVariables.h:38
vtkUniformVariables::SetUniformi
void SetUniformi(const char *name, int numberOfComponents, int *value)
vtkObject.h
vtkUniformVariables::RemoveAllUniforms
void RemoveAllUniforms()
vtkUniformVariables::SetUniformMatrix
void SetUniformMatrix(const char *name, int rows, int columns, float *value)
vtkUniformVariables::New
static vtkUniformVariables * New()
vtkgl::uniformIndex
GLuint uniformIndex
Definition: vtkgl.h:13680
vtkUniformVariables::~vtkUniformVariables
virtual ~vtkUniformVariables()
VTKRENDERINGOPENGL_EXPORT
#define VTKRENDERINGOPENGL_EXPORT
Definition: vtkRenderingOpenGLModule.h:15