sead
Loading...
Searching...
No Matches
aglShaderLocation.h
Go to the documentation of this file.
1#pragma once
2
3#include <gfx/seadColor.h>
4#include <math/seadMatrix.h>
5#include <prim/seadNamable.h>
6
7namespace agl {
8
10{
11public:
13 : mVS(-1)
14 , mFS(-1)
15 , mGS(-1)
16 {
17 }
18
19 bool isValid() const
20 {
21 return getVertexLocation() != -1 ||
22 getFragmentLocation() != -1 ||
23 getGeometryLocation() != -1;
24 }
25
26 s32 getVertexLocation() const { return mVS; }
27 s32 getFragmentLocation() const { return mFS; }
28 s32 getGeometryLocation() const { return mGS; }
29
30protected:
34};
35static_assert(sizeof(ShaderLocation) == 6, "agl::ShaderLocation size mismatch");
36
37class ShaderProgram;
38
40{
41public:
43 : sead::INamable("Undefined")
44 {
45 }
46
47 explicit UniformLocation(const sead::SafeString& name)
48 : sead::INamable(name)
49 {
50 }
51
52 UniformLocation(const sead::SafeString& name, const ShaderProgram& program)
53 : sead::INamable(name)
54 {
55 search(program);
56 }
57
59 {
61 ShaderLocation::operator=(static_cast<const ShaderLocation&>(rhs));
62 return *this;
63 }
64
65 void search(const ShaderProgram& program);
66
67public:
68 void setBool(bool value) const;
69
70 void setInt(s32 value) const;
71 void setUInt(u32 value) const;
72 void setFloat(f32 value) const;
73
74 void setIVec2(const sead::Vector2i& value) const;
75 void setUVec2(const sead::Vector2u& value) const;
76 void setVec2(const sead::Vector2f& value) const;
77
78 void setIVec3(const sead::Vector3i& value) const;
79 void setUVec3(const sead::Vector3u& value) const;
80 void setVec3(const sead::Vector3f& value) const;
81
82 void setIVec4(const sead::Vector4i& value) const;
83 void setUVec4(const sead::Vector4u& value) const;
84 void setVec4(const sead::Vector4f& value) const;
85
86 void setVec4(const sead::Color4f& value) const;
87
88 void setVec4Array(const sead::Matrix34f& value) const; // vec4[3]
89 void setVec4Array(const sead::Matrix44f& value) const; // vec4[4]
90
91 void setMtx43(const f32* value) const;
92 void setMtx44(const f32* value) const;
93};
94static_assert(sizeof(UniformLocation) == 0x10, "agl::UniformLocation size mismatch");
95
97{
98public:
100 : sead::INamable("Undefined")
101 {
102 }
103
104 explicit UniformBlockLocation(const sead::SafeString& name)
105 : sead::INamable(name)
106 {
107 }
108
109 UniformBlockLocation(const sead::SafeString& name, const ShaderProgram& program)
110 : sead::INamable(name)
111 {
112 search(program);
113 }
114
116 {
118 ShaderLocation::operator=(static_cast<const ShaderLocation&>(rhs));
119 return *this;
120 }
121
122 void search(const ShaderProgram& program);
123};
124static_assert(sizeof(UniformBlockLocation) == 0x10, "agl::UniformBlockLocation size mismatch");
125
127{
128public:
130 : sead::INamable("Undefined")
131 {
132 }
133
134 explicit SamplerLocation(const sead::SafeString& name)
135 : sead::INamable(name)
136 {
137 }
138
139 SamplerLocation(const sead::SafeString& name, const ShaderProgram& program)
140 : sead::INamable(name)
141 {
142 search(program);
143 }
144
146 {
148 ShaderLocation::operator=(static_cast<const ShaderLocation&>(rhs));
149 return *this;
150 }
151
152 void search(const ShaderProgram& program);
153};
154static_assert(sizeof(SamplerLocation) == 0x10, "agl::SamplerLocation size mismatch");
155
157{
158public:
160 : sead::INamable("Undefined")
161 , mVS() // Nintendo mistakingly didn't set this to -1
162 {
163 }
164
165 explicit AttributeLocation(const sead::SafeString& name)
166 : sead::INamable(name)
167 , mVS() // I don't actually know if this is set here
168 {
169 }
170
171 AttributeLocation(const sead::SafeString& name, const ShaderProgram& program)
172 : sead::INamable(name)
173 //, mVS() // Set by search()
174 {
175 search(program);
176 }
177
178 bool isValid() const
179 {
180 return getVertexLocation() != -1;
181 }
182
183 s32 getVertexLocation() const { return mVS; }
184
185 void search(const ShaderProgram& program);
186
187private:
189};
190static_assert(sizeof(AttributeLocation) == 0xC, "agl::AttributeLocation size mismatch");
191
192}
193
194#ifdef __cplusplus
195
196#include <common/aglShaderLocation.hpp>
197
198#endif // __cplusplus
Definition aglShaderLocation.h:157
s16 mVS
Definition aglShaderLocation.h:188
AttributeLocation(const sead::SafeString &name)
Definition aglShaderLocation.h:165
s32 getVertexLocation() const
Definition aglShaderLocation.h:183
AttributeLocation(const sead::SafeString &name, const ShaderProgram &program)
Definition aglShaderLocation.h:171
void search(const ShaderProgram &program)
Definition aglShaderLocation.cpp:92
AttributeLocation()
Definition aglShaderLocation.h:159
bool isValid() const
Definition aglShaderLocation.h:178
Definition aglShaderLocation.h:127
SamplerLocation(const sead::SafeString &name, const ShaderProgram &program)
Definition aglShaderLocation.h:139
void search(const ShaderProgram &program)
Definition aglShaderLocation.cpp:61
SamplerLocation(const sead::SafeString &name)
Definition aglShaderLocation.h:134
SamplerLocation & operator=(const SamplerLocation &rhs)
Definition aglShaderLocation.h:145
SamplerLocation()
Definition aglShaderLocation.h:129
Definition aglShaderLocation.h:10
s32 getGeometryLocation() const
Definition aglShaderLocation.h:28
bool isValid() const
Definition aglShaderLocation.h:19
s16 mFS
Definition aglShaderLocation.h:32
s16 mVS
Definition aglShaderLocation.h:31
s16 mGS
Definition aglShaderLocation.h:33
ShaderLocation()
Definition aglShaderLocation.h:12
s32 getVertexLocation() const
Definition aglShaderLocation.h:26
s32 getFragmentLocation() const
Definition aglShaderLocation.h:27
Definition aglShaderProgram.h:16
Definition aglShaderLocation.h:97
UniformBlockLocation & operator=(const UniformBlockLocation &rhs)
Definition aglShaderLocation.h:115
UniformBlockLocation()
Definition aglShaderLocation.h:99
UniformBlockLocation(const sead::SafeString &name, const ShaderProgram &program)
Definition aglShaderLocation.h:109
void search(const ShaderProgram &program)
Definition aglShaderLocation.cpp:30
UniformBlockLocation(const sead::SafeString &name)
Definition aglShaderLocation.h:104
Definition aglShaderLocation.h:40
UniformLocation(const sead::SafeString &name, const ShaderProgram &program)
Definition aglShaderLocation.h:52
void setVec3(const sead::Vector3f &value) const
Definition aglShaderLocation.hpp:79
void setMtx43(const f32 *value) const
Definition aglShaderLocation.hpp:121
void setMtx44(const f32 *value) const
Definition aglShaderLocation.hpp:127
void setUInt(u32 value) const
Definition aglShaderLocation.hpp:37
void setUVec4(const sead::Vector4u &value) const
Definition aglShaderLocation.hpp:91
void setInt(s32 value) const
Definition aglShaderLocation.hpp:31
void setIVec4(const sead::Vector4i &value) const
Definition aglShaderLocation.hpp:85
void setIVec2(const sead::Vector2i &value) const
Definition aglShaderLocation.hpp:49
void search(const ShaderProgram &program)
Definition aglShaderLocation.cpp:6
UniformLocation(const sead::SafeString &name)
Definition aglShaderLocation.h:47
void setIVec3(const sead::Vector3i &value) const
Definition aglShaderLocation.hpp:67
void setUVec3(const sead::Vector3u &value) const
Definition aglShaderLocation.hpp:73
void setFloat(f32 value) const
Definition aglShaderLocation.hpp:43
void setUVec2(const sead::Vector2u &value) const
Definition aglShaderLocation.hpp:55
void setVec4(const sead::Color4f &value) const
Definition aglShaderLocation.hpp:103
void setVec2(const sead::Vector2f &value) const
Definition aglShaderLocation.hpp:61
void setBool(bool value) const
Definition aglShaderLocation.hpp:25
UniformLocation & operator=(const UniformLocation &rhs)
Definition aglShaderLocation.h:58
UniformLocation()
Definition aglShaderLocation.h:42
void setVec4(const sead::Vector4f &value) const
Definition aglShaderLocation.hpp:97
void setVec4Array(const sead::Matrix34f &value) const
Definition aglShaderLocation.hpp:109
Definition seadNamable.h:9
void setName(const SafeString &name)
Definition seadNamable.h:21
INamable(const SafeString &name)
Definition seadNamable.h:16
const SafeString & getName() const
Definition seadNamable.h:26
Definition aglDisplayList.cpp:5
Definition seadAssert.h:44
Vector2< f32 > Vector2f
Definition seadVector.h:238
Vector2< u32 > Vector2u
Definition seadVector.h:242
Vector3< s32 > Vector3i
Definition seadVector.h:235
Vector2< s32 > Vector2i
Definition seadVector.h:234
Vector4< u32 > Vector4u
Definition seadVector.h:244
Vector3< u32 > Vector3u
Definition seadVector.h:243
Matrix44< f32 > Matrix44f
Definition seadMatrix.h:343
SafeStringBase< char > SafeString
Definition seadSafeString.h:409
Vector3< f32 > Vector3f
Definition seadVector.h:239
Vector4< f32 > Vector4f
Definition seadVector.h:240
Matrix34< f32 > Matrix34f
Definition seadMatrix.h:342
Vector4< s32 > Vector4i
Definition seadVector.h:236
Definition seadColor.h:9