moved Mat4 definition

This commit is contained in:
2023-06-03 19:40:50 +02:00
parent f2fcc348d7
commit 0365902971
9 changed files with 44 additions and 43 deletions

View File

@@ -98,7 +98,7 @@ void Renderer::Prepare() {
}
void Renderer::Resize(int width, int height) {
maths::Mat4f projectionMatrix = maths::Perspective(80.0f / 180.0f * M_PI, static_cast<float>(width) / height, 0.1f, 160.0f);
Mat4f projectionMatrix = maths::Perspective(80.0f / 180.0f * M_PI, static_cast<float>(width) / height, 0.1f, 160.0f);
m_WorldShader->Start();
m_WorldShader->SetProjectionMatrix(projectionMatrix);
m_EntityShader->Start();
@@ -121,7 +121,7 @@ void Renderer::SetCamMovement(const Vec2f& mov) {
void Renderer::SetCamPos(const Vec2f& newPos) {
m_CamPos = newPos;
maths::Mat4f viewMatrix = maths::Look({m_CamPos.x, 50, m_CamPos.y}, {0, -1, -0.0001}, {0, 1, 0});
Mat4f viewMatrix = maths::Look({m_CamPos.x, 50, m_CamPos.y}, {0, -1, -0.0001}, {0, 1, 0});
m_WorldShader->Start();
m_WorldShader->SetViewMatrix(viewMatrix);
m_EntityShader->Start();

View File

@@ -104,11 +104,11 @@ void EntityShader::SetColorEffect(const Vec3f& color) {
LoadVector(m_LocationColorEffect, color);
}
void EntityShader::SetProjectionMatrix(const maths::Mat4f& proj) const {
void EntityShader::SetProjectionMatrix(const Mat4f& proj) const {
LoadMat4(m_LocationProjectionMatrix, proj);
}
void EntityShader::SetViewMatrix(const maths::Mat4f& view) const {
void EntityShader::SetViewMatrix(const Mat4f& view) const {
LoadMat4(m_LocationViewMatrix, view);
}

View File

@@ -67,7 +67,7 @@ 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 {
void ShaderProgram::LoadMat4(unsigned int location, const Mat4f& mat) const {
glUniformMatrix4fv(static_cast<GLint>(location), 1, false, reinterpret_cast<const float*>(&mat));
}

View File

@@ -92,11 +92,11 @@ void WorldShader::GetAllUniformLocation() {
m_LocationView = static_cast<unsigned int>(GetUniformLocation("viewMatrix"));
}
void WorldShader::SetProjectionMatrix(const maths::Mat4f& proj) const {
void WorldShader::SetProjectionMatrix(const Mat4f& proj) const {
LoadMat4(m_LocationProjection, proj);
}
void WorldShader::SetViewMatrix(const maths::Mat4f& view) const {
void WorldShader::SetViewMatrix(const Mat4f& view) const {
LoadMat4(m_LocationView, view);
}