From 01d3eb771e649a8613af4a9d90ba159b58ddebd7 Mon Sep 17 00:00:00 2001 From: tobid7 Date: Tue, 15 Sep 2026 07:20:00 +0200 Subject: [PATCH] remove the 3ds ifdefs out of the core mat lib need to find a way to handle mtx stuff in the gfx driver or another way --- include/pd/core/mat.hpp | 23 +---------------------- source/core/mat.cpp | 5 ----- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/include/pd/core/mat.hpp b/include/pd/core/mat.hpp index 0d59df2..b165a01 100755 --- a/include/pd/core/mat.hpp +++ b/include/pd/core/mat.hpp @@ -56,21 +56,9 @@ struct PD_API Mat4 { constexpr float* Ptr() { return m.data(); } constexpr const float* Ptr() const { return m.data(); } - constexpr float& operator()(int row, int col) { -#ifdef __3DS__ - // 3ds is full reverse order iirc - return m[row * 4 + (3 - col)]; -#else - return m[col * 4 + row]; -#endif - } + constexpr float& operator()(int row, int col) { return m[col * 4 + row]; } constexpr float operator()(int row, int col) const { -#ifdef __3DS__ - // 3ds is full reverse order iirc - return m[row * 4 + (3 - col)]; -#else return m[col * 4 + row]; -#endif } constexpr Mat4 operator*(const Mat4& v) const { @@ -122,21 +110,12 @@ struct PD_API Mat4 { constexpr static Mat4 Ortho(float l, float r, float b, float t, float n, float f) { Mat4 ret; -#ifdef __3DS__ // Patch to rotate the Matrix correctly - ret(0, 1) = 2.f / (t - b); - ret(0, 3) = (b + t) / (b - t); - ret(1, 0) = 2.f / (l - r); - ret(1, 3) = (l + r) / (r - l); - ret(2, 2) = 1.f / (n - f); - ret(2, 3) = 0.5f * (n + f) / (n - f) - 0.5f; -#else ret(0, 0) = 2.0f / (r - l); ret(0, 3) = -(r + l) / (r - l); ret(1, 1) = 2.0f / (t - b); ret(1, 3) = -(t + b) / (t - b); ret(2, 2) = -2.0f / (f - n); ret(2, 3) = -(f + n) / (f - n); -#endif ret(3, 3) = 1.f; return ret; } diff --git a/source/core/mat.cpp b/source/core/mat.cpp index c2238b9..22bf028 100644 --- a/source/core/mat.cpp +++ b/source/core/mat.cpp @@ -85,13 +85,8 @@ PD_API Mat4 Mat4::Perspective(float fov, float aspect, float n, float f) { Mat4 ret; ret(0, 0) = 1.f / (aspect * _fov); ret(1, 1) = 1.f / _fov; -#ifdef __3DS__ - ret(2, 3) = f * n / (n - f); - ret(2, 2) = -(-1.f) * n / (n - f); -#else ret(2, 2) = -(f + n) / (f - n); ret(2, 3) = -(2.f * f * n) / (f - n); -#endif ret(3, 2) = -1.f; ret(3, 3) = 0.0f; return ret;