-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathuniform.hpp
More file actions
107 lines (102 loc) · 3.47 KB
/
uniform.hpp
File metadata and controls
107 lines (102 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#pragma once
#include <fea/config.hpp>
#include <cstdint>
#include <string>
#include <glm/glm.hpp>
#include <fea/rendering/opengl.hpp>
namespace fea
{
enum UniformType{NO_TYPE, FLOAT, VEC2, VEC3, VEC4, MAT2X2, MAT4X4, TEXTURE};
struct FEA_API Uniform
{
Uniform();
Uniform(const std::string& name, UniformType t, const float val);
Uniform(const std::string& name, UniformType t, const glm::vec2& val);
Uniform(const std::string& name, UniformType t, const glm::vec3& val);
Uniform(const std::string& name, UniformType t, const glm::vec4& val);
Uniform(const std::string& name, UniformType t, const glm::mat2x2& val);
Uniform(const std::string& name, UniformType t, const glm::mat4x4& val);
Uniform(const std::string& name, UniformType t, const GLuint val);
Uniform(const Uniform& other);
std::string mName;
UniformType mType;
bool operator==(const Uniform& other) const;
union
{
float mFloatVal; ///<Hold a float value
float mVec2Val[2]; ///<Hold a vec2 value
float mVec3Val[3]; ///<Hold a vec3 value
float mVec4Val[4]; ///<Hold a vec4 value
float mMat2x2Val[4]; ///<Hold a mat2x2 value
float mMat4x4Val[16]; ///<Hold a mat4x4 value
GLuint mTextureVal; ///<Hold a texture
};
};
/** @addtogroup Render2D
*@{
* @class Uniform
* @enum UniformType
*@}
***
* @class Uniform
* @brief Defines a uniform variable.
***
* @enum UniformType
* @brief Type of the uniform.
***
* @fn Uniform::Uniform()
* @brief Construct a null uniform.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, float val)
* @brief Construct a float uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, glm::vec2 val)
* @brief Construct a vec2 uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, glm::vec3 val)
* @brief Construct a vec3 uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, glm::vec4 val)
* @brief Construct a vec4 uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, glm::mat2x2 val)
* @brief Construct a mat2x2 uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, glm::mat4x4 val)
* @brief Construct a mat4x4 uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const std::string& name, UniformType t, GLuint val)
* @brief Construct a texture uniform.
* @param name Name.
* @param t Type.
* @param val Value.
***
* @fn Uniform::Uniform(const Uniform& other)
* @brief Construct a uniform from another uniform.
* @param other Uniform to copy.
***
* @var Uniform::mName
* @brief name of the uniform.
***
* @var Uniform::mType
* @brief Type of the uniform.
***/
}