First
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <compare>
|
||||
|
||||
namespace math
|
||||
{
|
||||
|
||||
template<typename T> struct vec3;
|
||||
template<typename T> struct mat4;
|
||||
template<typename T> struct quat;
|
||||
|
||||
// mat4 layout trans3 layout (4 vec3)
|
||||
// 0 4 8 12 0 3 6 tx
|
||||
// 1 5 9 13 -> 1 4 7 ty
|
||||
// 2 6 10 14 2 5 8 tz
|
||||
// 3 7 11 15
|
||||
// the last row is always constant (0 0 0 1) for the trans
|
||||
|
||||
template<typename T>
|
||||
struct trans3
|
||||
{
|
||||
typedef T value_t;
|
||||
using this_t = trans3<T>;
|
||||
|
||||
constexpr trans3() noexcept = default;
|
||||
constexpr explicit trans3(math::ZUninitialized) noexcept;
|
||||
constexpr trans3(trans3<T> const&) noexcept = default;
|
||||
|
||||
constexpr explicit trans3(vec3<T> const& translation) noexcept;
|
||||
constexpr trans3(vec3<T> const& translation, quat<T> const& rotation_scale) noexcept;
|
||||
constexpr trans3(vec3<T> const& translation, quat<T> const& rotation_scale, vec3<T> const& scale) noexcept;
|
||||
constexpr trans3(vec3<T> const& translation, mat3<T> const& rotation_scale) noexcept;
|
||||
constexpr trans3(vec3<T> const& translation, mat3<T> const& rotation_scale, vec3<T> const& scale) noexcept;
|
||||
|
||||
constexpr trans3<T>& operator=(trans3<T> const&) noexcept = default;
|
||||
|
||||
constexpr trans3<T> operator*(trans3<T> const& other) const noexcept;
|
||||
constexpr trans3<T>& operator*=(trans3<T> const& other) noexcept;
|
||||
|
||||
constexpr trans3<T>& post_scale(vec3<T> const& scale) noexcept;
|
||||
constexpr trans3<T>& post_translate(vec3<T> const& translation) noexcept;
|
||||
|
||||
constexpr vec3<T> const& get_axis_x() const noexcept;
|
||||
constexpr trans3<T>& set_axis_x(vec3<T> const& axis) noexcept;
|
||||
|
||||
constexpr vec3<T> const& get_axis_y() const noexcept;
|
||||
constexpr trans3<T>& set_axis_y(vec3<T> const& axis) noexcept;
|
||||
|
||||
constexpr vec3<T> const& get_axis_z() const noexcept;
|
||||
constexpr trans3<T>& set_axis_z(vec3<T> const& axis) noexcept;
|
||||
|
||||
template<class Policy = standard>
|
||||
constexpr vec3<T> get_scale() const noexcept;
|
||||
constexpr trans3<T>& set_scale(vec3<T> const& scale) noexcept;
|
||||
|
||||
constexpr trans3<T>& set_rotation_scale(quat<T> const& rotation_scale) noexcept;
|
||||
|
||||
constexpr auto operator<=>(const this_t&) const noexcept = default;
|
||||
constexpr bool operator==(const this_t&) const noexcept = default;
|
||||
|
||||
|
||||
|
||||
vec3<T> translation;
|
||||
mat3<T> rotation_scale;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user