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:
40  static vtkUniformVariables *New();
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 
122  void RemoveAllUniforms();
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 
142  void SendCurrentUniform(int uniformIndex);
143 
145  void Next();
146 
149  void DeepCopy(vtkUniformVariables *other);
150 
153  void Merge(vtkUniformVariables *other);
154 
155 protected:
157  virtual ~vtkUniformVariables();
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
abstract base class for most VTK objects
Definition: vtkObject.h:61
GLSL uniform variables.
void SetUniformft(const char *name, int numberOfComponents, T *value)
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
void SetUniformft(const char *name, T value)
void SetUniformit(const char *name, T value)
void SetUniformi(const char *name, int numberOfComponents, int *value)
void SetUniformf(const char *name, int numberOfComponents, float *value)
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKRENDERINGOPENGL_EXPORT
static vtkObject * New()
void SetUniformit(const char *name, int numberOfComponents, T *value)