From 7300f895bb8c1e7f1c5a96866d466126ee861281 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 20 Sep 2024 17:13:09 -0400 Subject: [PATCH] logging --- CMakeLists.txt | 2 +- include/blt/math/log_util.h | 8 ++++---- include/blt/math/matrix.h | 12 ++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 984ed5e..1ccc5a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.20.14) +set(BLT_VERSION 0.20.15) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/math/log_util.h b/include/blt/math/log_util.h index 76be9cd..fb2510c 100644 --- a/include/blt/math/log_util.h +++ b/include/blt/math/log_util.h @@ -16,8 +16,8 @@ namespace blt { - template - static inline Writer& operator<<(Writer& log, const blt::vec& vec) + template + static inline std::basic_ostream& operator<<(std::basic_ostream& log, const blt::vec& vec) { std::string type_string; const auto tstr = blt::type_string(); @@ -45,8 +45,8 @@ namespace blt return log; } - template - inline Writer& operator<<(Writer& out, const mat4x4& v) + template + inline std::basic_ostream& operator<<(std::basic_ostream& out, const mat4x4& v) { out << "Mat4x4("; out << "{" << v.m00() << ", " << v.m01() << ", " << v.m02() << ", " << v.m03() << "},"; diff --git a/include/blt/math/matrix.h b/include/blt/math/matrix.h index 5a3200a..bdd51bc 100644 --- a/include/blt/math/matrix.h +++ b/include/blt/math/matrix.h @@ -175,6 +175,18 @@ namespace blt return data[column][row] = value; }; + /** + * Takes a value stored across a row, taking one from each column in the specified row + * @param row the row to extract from. defaults to the first row + */ + constexpr inline vec vec_from_column_row(blt::u32 row = 0) + { + vec ret; + for (blt::u32 j = 0; j < columns; j++) + ret[j] = data[j][row]; + return ret; + } + /** * Assign to this matrix from the row information in each column of a matrix * Where columns can be assigned directly from each-other, row stored data must be assigned this way