optimizing chunk mesh

This commit is contained in:
2025-05-20 16:15:23 +02:00
parent 84e5e437d0
commit 6fea3147ee
9 changed files with 199 additions and 125 deletions

View File

@@ -16,6 +16,10 @@ namespace Scop
[[nodiscard]] inline constexpr std::string GetCameraType() override { return "FirstPerson3D"; }
[[nodiscard]] const Vec3f& GetPosition() const noexcept override { return m_position; }
[[nodiscard]] const Vec3f& GetUp() const noexcept { return m_up; }
[[nodiscard]] const Vec3f& GetLeft() const noexcept { return m_left; }
[[nodiscard]] const Vec3f& GetTarget() const noexcept { return m_target; }
[[nodiscard]] const Vec3f& GetDirection() const noexcept { return m_direction; }
~FirstPerson3D() = default;

View File

@@ -27,6 +27,8 @@ namespace Scop
T r21, T r22, T r23, T r24,
T r31, T r32, T r33, T r34,
T r41, T r42, T r43, T r44);
constexpr Mat4(const T& col_1, const T& col_2, const T& col_3, const T& col_4);
constexpr Mat4(const Vec4<T>& col_1, const Vec4<T>& col_2, const Vec4<T>& col_3, const Vec4<T>& col_4);
constexpr Mat4(const T matrix[16]);
constexpr Mat4(const Mat4&) = default;
constexpr Mat4(Mat4&&) = default;

View File

@@ -33,6 +33,22 @@ namespace Scop
matrix[12], matrix[13], matrix[14], matrix[15])
{}
template<typename T>
constexpr Mat4<T>::Mat4(const T& col_1, const T& col_2, const T& col_3, const T& col_4) :
m11(col_1), m12(col_2), m13(col_3), m14(col_4),
m21(col_1), m22(col_2), m23(col_3), m24(col_4),
m31(col_1), m32(col_2), m33(col_3), m34(col_4),
m41(col_1), m42(col_2), m43(col_3), m44(col_4)
{}
template<typename T>
constexpr Mat4<T>::Mat4(const Vec4<T>& col_1, const Vec4<T>& col_2, const Vec4<T>& col_3, const Vec4<T>& col_4) :
m11(col_1.x), m12(col_2.x), m13(col_3.x), m14(col_4.x),
m21(col_1.y), m22(col_2.y), m23(col_3.y), m24(col_4.y),
m31(col_1.z), m32(col_2.z), m33(col_3.z), m34(col_4.z),
m41(col_1.w), m42(col_2.w), m43(col_3.w), m44(col_4.w)
{}
template<typename T>
constexpr Mat4<T>& Mat4<T>::ApplyRotation(const Quat<T>& rotation)
{