1#ifndef LIBSBX_MATH_MATRIX4X4_HPP_
2#define LIBSBX_MATH_MATRIX4X4_HPP_
13#include <fmt/format.h>
15#include <libsbx/math/concepts.hpp>
16#include <libsbx/math/vector3.hpp>
17#include <libsbx/math/vector4.hpp>
18#include <libsbx/math/matrix.hpp>
19#include <libsbx/math/angle.hpp>
28 template<scalar Other>
31 inline static constexpr auto x_axis = std::size_t{0u};
32 inline static constexpr auto y_axis = std::size_t{1u};
33 inline static constexpr auto z_axis = std::size_t{2u};
34 inline static constexpr auto w_axis = std::size_t{3u};
38 using value_type = base_type::value_type;
39 using reference = base_type::reference;
40 using const_reference = base_type::const_reference;
41 using size_type = base_type::size_type;
44 inline static constexpr basic_matrix4x4 identity{base_type::identity()};
48 using base_type::base_type;
52 template<scalar Other>
60 template<scalar Other>
62 Other x0, Other x1, Other x2, Other x3,
63 Other y0, Other y1, Other y2, Other y3,
64 Other z0, Other z1, Other z2, Other z3,
65 Other w0, Other w1, Other w2, Other w3
78 [[nodiscard]]
constexpr static auto orthographic(
const value_type left,
const value_type right,
const value_type bottom,
const value_type top)
noexcept ->
basic_matrix4x4;
80 [[nodiscard]]
constexpr static auto orthographic(
const value_type left,
const value_type right,
const value_type bottom,
const value_type top,
const value_type near,
const value_type far)
noexcept ->
basic_matrix4x4;
90 constexpr auto operator[](size_type index)
const noexcept ->
const column_type&;
92 constexpr auto operator[](size_type index)
noexcept ->
column_type&;
96template<scalar Lhs, scalar Rhs>
99template<scalar Lhs, scalar Rhs>
102template<scalar Lhs, scalar Rhs>
105template<scalar Lhs, scalar Rhs>
108template<scalar Lhs, scalar Rhs>
111template<scalar Lhs, scalar Rhs>
122template<sbx::math::scalar Type>
123struct fmt::formatter<sbx::math::basic_matrix4x4<Type>> {
125 template<
typename ParseContext>
126 constexpr auto parse(ParseContext& context) ->
decltype(context.begin()) {
127 return context.begin();
130 template<
typename FormatContext>
132 if constexpr (sbx::math::is_floating_point_v<Type>) {
133 return fmt::format_to(context.out(),
134 "\n{:.2f}, {:.2f}, {:.2f}, {:.2f}\n{:.2f}, {:.2f}, {:.2f}, {:.2f}\n{:.2f}, {:.2f}, {:.2f}, {:.2f}\n{:.2f}, {:.2f}, {:.2f}, {:.2f}",
135 matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
136 matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
137 matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
138 matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]
141 return fmt::format_to(context.out(),
142 "\n{}, {}, {}, {}\n{}, {}, {}, {}\n{}, {}, {}, {}\n{}, {}, {}, {}",
143 matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
144 matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
145 matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
146 matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]
153#include <libsbx/math/matrix4x4.ipp>
Definition: angle.hpp:251
Definition: matrix4x4.hpp:24
Definition: matrix.hpp:13
Definition: vector3.hpp:22
Definition: vector4.hpp:22