shader matrix support
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
#include "render/GL.h"
|
#include "render/GL.h"
|
||||||
|
#include "misc/Maths.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace shader {
|
namespace shader {
|
||||||
@@ -27,6 +28,7 @@ protected:
|
|||||||
void LoadVector(unsigned int location, const Vec2f& vector) const;
|
void LoadVector(unsigned int location, const Vec2f& vector) const;
|
||||||
void LoadVector(unsigned int location, const Vec3f& vector) const;
|
void LoadVector(unsigned int location, const Vec3f& vector) const;
|
||||||
void LoadBoolean(unsigned int location, bool value) const;
|
void LoadBoolean(unsigned int location, bool value) const;
|
||||||
|
void LoadMat4(unsigned int location, const maths::Mat4f& mat) const;
|
||||||
void CleanUp() const;
|
void CleanUp() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ void ShaderProgram::LoadBoolean(unsigned int location, bool value) const {
|
|||||||
glUniform1i(static_cast<GLint>(location), value);
|
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 {
|
void ShaderProgram::CleanUp() const {
|
||||||
Stop();
|
Stop();
|
||||||
glDetachShader(m_ProgramID, m_VertexShaderID);
|
glDetachShader(m_ProgramID, m_VertexShaderID);
|
||||||
|
|||||||
Reference in New Issue
Block a user