From ff7e296d92001f60c4e5589c9e623b870163af9b Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 3 Aug 2021 23:02:00 -0400 Subject: [PATCH] Transformation matricies were being multiplied backwards --- src/util/render.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/util/render.cpp b/src/util/render.cpp index dce478a..e3d2991 100644 --- a/src/util/render.cpp +++ b/src/util/render.cpp @@ -100,10 +100,10 @@ void Render::pop_matrix() { void Render::translate(Vector2 trans) { switch(m_matrix_mode) { case MODEL: - m_matrix *= translation_matrix(trans); + m_matrix = translation_matrix(trans) * m_matrix; break; case PROJECTION: - m_view_matrix *= translation_matrix(trans); + m_view_matrix = translation_matrix(trans) * m_view_matrix; break; } } @@ -111,10 +111,10 @@ void Render::translate(Vector2 trans) { void Render::rotate(float theta) { switch(m_matrix_mode) { case MODEL: - m_matrix *= rotation_matrix(theta); + m_matrix = rotation_matrix(theta) * m_matrix; break; case PROJECTION: - m_view_matrix *= rotation_matrix(theta); + m_view_matrix = rotation_matrix(theta) * m_view_matrix; break; } } @@ -122,10 +122,10 @@ void Render::rotate(float theta) { void Render::scale(Vector2 scale) { switch(m_matrix_mode) { case MODEL: - m_matrix *= scale_matrix(scale); + m_matrix = scale_matrix(scale) * m_matrix; break; case PROJECTION: - m_view_matrix *= scale_matrix(scale); + m_view_matrix = scale_matrix(scale) * m_view_matrix; } }