From 532c6dafaf83dcf826562bae228e058607055b1c Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 12 Feb 2020 19:42:50 +0100 Subject: [PATCH] Math/Math: translate/scale functions should not accept vectors, but rather individual parameters. This is "low level" functions. Used by other math classes/functions. --- include/Spectre/Math/Math.h | 4 ++-- source/Math/Math.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/Spectre/Math/Math.h b/include/Spectre/Math/Math.h index c888b36..d8aebe4 100644 --- a/include/Spectre/Math/Math.h +++ b/include/Spectre/Math/Math.h @@ -36,10 +36,10 @@ namespace sp { namespace math Matrix4f rotation(float theta); // Create a 2D translation matrix. - Matrix4f translate(const Vector2f& v); + Matrix4f translate(float x, float y); // Create a 2D scale matrix. - Matrix4f scale(const Vector2f& f); + Matrix4f scale(float x, float y); // Get translation part of a matrix. Vector3f getTranslate(const Matrix4f matrix); diff --git a/source/Math/Math.cpp b/source/Math/Math.cpp index 2cfdf76..120b7bc 100644 --- a/source/Math/Math.cpp +++ b/source/Math/Math.cpp @@ -60,21 +60,21 @@ namespace sp { namespace math 0.0f, 0.0f, 0.0f, 1.0f); } - Matrix4f translate(const Vector2f& v) { + + Matrix4f translate(float x, float y) { return Matrix4f( - 1.0f, 0.0f, 0.0f, v.x, - 0.0f, 1.0f, 0.0f, v.y, + 1.0f, 0.0f, 0.0f, x, + 0.0f, 1.0f, 0.0f, y, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); - } - Matrix4f scale(const Vector2f& f) { + Matrix4f scale(float x, float y) { return Matrix4f( - f.x , 0.0f, 0.0f, 0.0f, - 0.0f, f.y , 0.0f, 0.0f, + x , 0.0f, 0.0f, 0.0f, + 0.0f, y , 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); }