shader matrix support

This commit is contained in:
2023-06-03 16:30:23 +02:00
parent e7f9ca2b6c
commit a2d8984199
2 changed files with 6 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#include <string>
#include "Defines.h"
#include "render/GL.h"
#include "misc/Maths.h"
namespace td {
namespace shader {
@@ -27,6 +28,7 @@ protected:
void LoadVector(unsigned int location, const Vec2f& vector) const;
void LoadVector(unsigned int location, const Vec3f& vector) const;
void LoadBoolean(unsigned int location, bool value) const;
void LoadMat4(unsigned int location, const maths::Mat4f& mat) const;
void CleanUp() const;
private:

View File

@@ -67,6 +67,10 @@ void ShaderProgram::LoadBoolean(unsigned int location, bool value) const {
glUniform1i(static_cast<GLint>(location), value);
}
void ShaderProgram::LoadMat4(unsigned int location, const maths::Mat4f& mat) const {
glUniformMatrix4fv(static_cast<GLint>(location), 1, false, reinterpret_cast<const float*>(&mat));
}
void ShaderProgram::CleanUp() const {
Stop();
glDetachShader(m_ProgramID, m_VertexShaderID);