VTK  9.4.20241219
vtkOpenGLUniforms.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
23#ifndef vtkOpenGLUniforms_h
24#define vtkOpenGLUniforms_h
25
26#include "vtkRenderingOpenGL2Module.h" // For export macro
27#include "vtkUniforms.h"
28#include <string> // For member functions
29
30VTK_ABI_NAMESPACE_BEGIN
31class vtkUniformInternals;
33
34class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLUniforms : public vtkUniforms
35{
36public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
44 std::string GetDeclarations();
45
50
57
59 void RemoveUniform(const char* name) override;
60
62 void RemoveAllUniforms() override;
63
65
69 void SetUniform(const char* name, vtkUniforms::TupleType tt, int nbComponents,
70 const std::vector<int>& value) override;
71 void SetUniform(const char* name, vtkUniforms::TupleType tt, int nbComponents,
72 const std::vector<float>& value) override;
73 bool GetUniform(const char* name, std::vector<int>& value) override;
74 bool GetUniform(const char* name, std::vector<float>& value) override;
76
78
79 void SetUniformi(const char* name, int v) override;
80 void SetUniformf(const char* name, float v) override;
81 void SetUniform2i(const char* name, const int v[2]) override;
82 void SetUniform2f(const char* name, const float v[2]) override;
83 void SetUniform3f(const char* name, const float v[3]) override;
84 void SetUniform4f(const char* name, const float v[4]) override;
85 void SetUniformMatrix3x3(const char* name, float* v) override;
86 void SetUniformMatrix4x4(const char* name, float* v) override;
88
90
91 void SetUniform1iv(const char* name, int count, const int* f) override;
92 void SetUniform1fv(const char* name, int count, const float* f) override;
93 void SetUniform2fv(const char* name, int count, const float (*f)[2]) override;
94 void SetUniform3fv(const char* name, int count, const float (*f)[3]) override;
95 void SetUniform4fv(const char* name, int count, const float (*f)[4]) override;
96 void SetUniformMatrix4x4v(const char* name, int count, float* v) override;
98
100
104 void SetUniform3f(const char* name, const double v[3]) override;
105 void SetUniform3uc(const char* name, const unsigned char v[3]) override; // maybe remove
106 void SetUniform4uc(const char* name, const unsigned char v[4]) override; // maybe remove
107 void SetUniformMatrix(const char* name, vtkMatrix3x3* v) override;
108 void SetUniformMatrix(const char* name, vtkMatrix4x4* v) override;
110
112
113 bool GetUniformi(const char* name, int& v) override;
114 bool GetUniformf(const char* name, float& v) override;
115 bool GetUniform2i(const char* name, int v[2]) override;
116 bool GetUniform2f(const char* name, float v[2]) override;
117 bool GetUniform3f(const char* name, float v[3]) override;
118 bool GetUniform4f(const char* name, float v[4]) override;
119 bool GetUniformMatrix3x3(const char* name, float* v) override;
120 bool GetUniformMatrix4x4(const char* name, float* v) override;
122
124
128 bool GetUniform3f(const char* name, double v[3]) override;
129 bool GetUniform3uc(const char* name, unsigned char v[3]) override;
130 bool GetUniform4uc(const char* name, unsigned char v[4]) override;
131 bool GetUniformMatrix(const char* name, vtkMatrix3x3* v) override;
132 bool GetUniformMatrix(const char* name, vtkMatrix4x4* v) override;
134
136
137 bool GetUniform1iv(const char* name, std::vector<int>& f) override;
138 bool GetUniform1fv(const char* name, std::vector<float>& f) override;
139 bool GetUniform2fv(const char* name, std::vector<float>& f) override;
140 bool GetUniform3fv(const char* name, std::vector<float>& f) override;
141 bool GetUniform4fv(const char* name, std::vector<float>& f) override;
142 bool GetUniformMatrix4x4v(const char* name, std::vector<float>& f) override;
144
146 int GetNumberOfUniforms() override;
147
150 const char* GetNthUniformName(vtkIdType uniformIndex) override;
151
153 int GetUniformScalarType(const char* name) override;
154
157 TupleType GetUniformTupleType(const char* name) override;
158
162 int GetUniformNumberOfComponents(const char* name) override;
163
166 int GetUniformNumberOfTuples(const char* name) override;
167
168protected:
171
172private:
173 vtkOpenGLUniforms(const vtkOpenGLUniforms&) = delete;
174 void operator=(const vtkOpenGLUniforms&) = delete;
175
176 vtkUniformInternals* Internals;
177};
178
179VTK_ABI_NAMESPACE_END
180#endif
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3x3 transformation matrices
represent and manipulate 4x4 transformation matrices
helper class to set custom uniform variables in GLSL shaders.
void SetUniform4f(const char *name, const float v[4]) override
Set the name uniform value to v.
void SetUniform2fv(const char *name, int count, const float(*f)[2]) override
Set the name uniform array to f with count elements.
bool GetUniform4uc(const char *name, unsigned char v[4]) override
Get the name uniform to v.
static vtkOpenGLUniforms * New()
bool GetUniformMatrix(const char *name, vtkMatrix4x4 *v) override
Get the name uniform to v.
bool GetUniformf(const char *name, float &v) override
Get the name uniform value.
void SetUniform2f(const char *name, const float v[2]) override
Set the name uniform value to v.
void SetUniform4uc(const char *name, const unsigned char v[4]) override
Set the name uniform to v.
bool GetUniformMatrix3x3(const char *name, float *v) override
Get the name uniform value.
bool GetUniform2f(const char *name, float v[2]) override
Get the name uniform value.
bool GetUniformMatrix4x4v(const char *name, std::vector< float > &f) override
Get the name uniform vector to f with.
bool GetUniform4fv(const char *name, std::vector< float > &f) override
Get the name uniform vector to f with.
bool GetUniform3f(const char *name, float v[3]) override
Get the name uniform value.
bool GetUniform(const char *name, std::vector< int > &value) override
Generic setters and getter.
void SetUniform1fv(const char *name, int count, const float *f) override
Set the name uniform array to f with count elements.
std::string GetDeclarations()
Build a string containing the GLSL declaration of all stored uniform variables.
void SetUniformMatrix4x4(const char *name, float *v) override
Set the name uniform value to v.
bool GetUniformMatrix4x4(const char *name, float *v) override
Get the name uniform value.
bool SetUniforms(vtkShaderProgram *p)
Set all the stored uniform variables values in the shader program p.
int GetUniformNumberOfComponents(const char *name) override
Get the number of components stored in each tuple of uniform name.
void SetUniform(const char *name, vtkUniforms::TupleType tt, int nbComponents, const std::vector< float > &value) override
Generic setters and getter.
bool GetUniformMatrix(const char *name, vtkMatrix3x3 *v) override
Get the name uniform to v.
bool GetUniform3f(const char *name, double v[3]) override
Get the name uniform to v.
void SetUniform2i(const char *name, const int v[2]) override
Set the name uniform value to v.
bool GetUniform3uc(const char *name, unsigned char v[3]) override
Get the name uniform to v.
int GetNumberOfUniforms() override
Get number of all uniforms stored in this class.
bool GetUniform2fv(const char *name, std::vector< float > &f) override
Get the name uniform vector to f with.
void SetUniformf(const char *name, float v) override
Set the name uniform value to v.
bool GetUniform(const char *name, std::vector< float > &value) override
Generic setters and getter.
void SetUniformMatrix4x4v(const char *name, int count, float *v) override
Set the name uniform array to f with count elements.
bool GetUniform1iv(const char *name, std::vector< int > &f) override
Get the name uniform vector to f with.
TupleType GetUniformTupleType(const char *name) override
Get the tuple type stored in uniform name.
void RemoveAllUniforms() override
Remove all uniform variables.
bool GetUniform2i(const char *name, int v[2]) override
Get the name uniform value.
void SetUniform3f(const char *name, const float v[3]) override
Set the name uniform value to v.
void SetUniformi(const char *name, int v) override
Set the name uniform value to v.
void RemoveUniform(const char *name) override
Remove uniform variable named name.
bool GetUniform4f(const char *name, float v[4]) override
Get the name uniform value.
~vtkOpenGLUniforms() override
void SetUniform4fv(const char *name, int count, const float(*f)[4]) override
Set the name uniform array to f with count elements.
int GetUniformScalarType(const char *name) override
Get type of scalars stored in uniform name.
bool GetUniform1fv(const char *name, std::vector< float > &f) override
Get the name uniform vector to f with.
vtkMTimeType GetUniformListMTime() override
Get modified time of the list of uniform variables, which is typically used to check whether the shad...
void SetUniform1iv(const char *name, int count, const int *f) override
Set the name uniform array to f with count elements.
void SetUniform(const char *name, vtkUniforms::TupleType tt, int nbComponents, const std::vector< int > &value) override
Generic setters and getter.
bool GetUniformi(const char *name, int &v) override
Get the name uniform value.
void SetUniformMatrix(const char *name, vtkMatrix4x4 *v) override
Set the name uniform to v.
void SetUniform3fv(const char *name, int count, const float(*f)[3]) override
Set the name uniform array to f with count elements.
bool GetUniform3fv(const char *name, std::vector< float > &f) override
Get the name uniform vector to f with.
int GetUniformNumberOfTuples(const char *name) override
Get length of a uniform name that contains a variable-size vector.
void SetUniform3f(const char *name, const double v[3]) override
Set the name uniform to v.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetUniformMatrix3x3(const char *name, float *v) override
Set the name uniform value to v.
const char * GetNthUniformName(vtkIdType uniformIndex) override
Get number of all uniforms stored in this class.
void SetUniformMatrix(const char *name, vtkMatrix3x3 *v) override
Set the name uniform to v.
void SetUniform3uc(const char *name, const unsigned char v[3]) override
Set the name uniform to v.
The ShaderProgram uses one or more Shader objects.
helper class to set custom uniform variables in GPU shaders.
Definition vtkUniforms.h:33
TupleType
Types of tuples that can be stored : scalar, vector, matrix.
Definition vtkUniforms.h:47
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270