1
0

refactor shared

This commit is contained in:
2026-01-08 19:23:19 +08:00
parent 07cc58fb36
commit 64368b7837
23 changed files with 400 additions and 234 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <stdexcept>
#include <array> // Include array for std::array::at
namespace Basalt::Shared::Math {
@@ -7,19 +8,26 @@ namespace Basalt::Shared::Math {
struct Vector3 {
FloatPoint x, y, z;
};
struct Vector4 {
FloatPoint x, y, z, w;
};
struct Matrix4x4 {
Vector4 data[4];
FloatPoint& operator[](size_t index);
const FloatPoint& operator[](size_t index) const;
};
//template<typename TEle, size_t VCnt>
// requires(std::integral<TEle> || std::floating_point<TEle>)
//struct Vector {
// TEle factor[VCnt];
//};
struct Vector4 {
FloatPoint x, y, z, w;
FloatPoint& operator[](size_t index);
const FloatPoint& operator[](size_t index) const;
};
struct Matrix4x4 {
private:
std::array<Vector4, 4> data; // Use std::array instead of raw array for .at() method
public:
Vector4& operator[](size_t index);
const Vector4& operator[](size_t index) const;
};
#define NOT_IMPLEMENTED throw std::logic_error("not implemented function");
@@ -31,4 +39,4 @@ namespace Basalt::Shared::Math {
#undef NOT_IMPLEMENTED
} // namespace Basalt::Shared::Math
} // namespace Basalt::Shared::Math