VTK
vtkOpenGLUniforms.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 =========================================================================*/
23 #ifndef vtkOpenGLUniforms_h
24 #define vtkOpenGLUniforms_h
25 
26 #include "vtkObject.h"
27 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
28 
29 #include <string> // For member functions
30 
31 class vtkUniformInternals;
32 class vtkMatrix3x3;
33 class vtkMatrix4x4;
34 class vtkShaderProgram;
35 
36 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkOpenGLUniforms : public vtkObject
37 {
38 public:
39  static vtkOpenGLUniforms *New();
40  vtkTypeMacro(vtkOpenGLUniforms, vtkObject);
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
43  std::string GetDeclarations();
44  bool SetUniforms( vtkShaderProgram * p );
45  vtkMTimeType GetUniformListMTime();
46 
48  void AddUniformi (const char *name, int defaultValue);
49  void AddUniformf(const char *name, float defaultValue);
50  void AddUniform2i(const char *name, const int defaultValue[2]);
51  void AddUniform2f(const char *name, const float defaultValue[2]);
52  void AddUniform3f(const char *name, const float defaultValue[3]);
53  void AddUniform3f(const char *name, const double defaultValue[3]);
54  void AddUniform4f(const char *name, const float defaultValue[4]);
55  void AddUniform3uc(const char *name, const unsigned char defaultValue[3]); // maybe remove
56  void AddUniform4uc(const char *name, const unsigned char defaultValue[4]); // maybe remove
57  void AddUniformMatrix(const char *name, vtkMatrix3x3 *defaultValue);
58  void AddUniformMatrix(const char *name, vtkMatrix4x4 *defaultValue);
59  void AddUniformMatrix3x3(const char *name, float *defaultValue);
60  void AddUniformMatrix4x4(const char *name, float *defaultValue);
61 
63  void AddUniform1iv(const char *name, const int count, const int *f);
64  void AddUniform1fv (const char *name, const int count, const float *f);
65  void AddUniform2fv (const char *name, const int count, const float(*f)[2]);
66  void AddUniform3fv (const char *name, const int count, const float(*f)[3]);
67  void AddUniform4fv (const char *name, const int count, const float(*f)[4]);
68  void AddUniformMatrix4x4v (const char *name, const int count, float *v);
69 
71  void RemoveUniform(const char *name);
72 
74  void RemoveAllUniforms();
75 
77  void SetUniformi(const char *name, int v);
78  void SetUniformf(const char *name, float v);
79  void SetUniform2i(const char *name, const int v[2]);
80  void SetUniform2f(const char *name, const float v[2]);
81  void SetUniform3f(const char *name, const float v[3]);
82  void SetUniform3f(const char *name, const double v[3]);
83  void SetUniform4f(const char *name, const float v[4]);
84  void SetUniform3uc(const char *name, const unsigned char v[3]); // maybe remove
85  void SetUniform4uc(const char *name, const unsigned char v[4]); // maybe remove
86  void SetUniformMatrix(const char *name, vtkMatrix3x3 *v);
87  void SetUniformMatrix(const char *name, vtkMatrix4x4 *v);
88  void SetUniformMatrix3x3(const char *name, float *v);
89  void SetUniformMatrix4x4(const char *name, float *v);
90 
92  void SetUniform1iv(const char *name, const int count, const int *f);
93  void SetUniform1fv(const char *name, const int count, const float *f);
94  void SetUniform2fv(const char *name, const int count, const float (*f)[2]);
95  void SetUniform3fv(const char *name, const int count, const float (*f)[3]);
96  void SetUniform4fv(const char *name, const int count, const float (*f)[4]);
97  void SetUniformMatrix4x4v(const char *name, const int count, float *v);
98 
99 protected:
101  ~vtkOpenGLUniforms() override;
102 
103 private:
104  vtkOpenGLUniforms(const vtkOpenGLUniforms&) = delete;
105  void operator=(const vtkOpenGLUniforms&) = delete;
106 
107  vtkUniformInternals * Internals;
108 };
109 
110 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
a simple class to control print indentation
Definition: vtkIndent.h:39
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:36
The ShaderProgram uses one or more Shader objects.