1
0

write shit

This commit is contained in:
2026-01-09 16:40:30 +08:00
parent 55ed60c643
commit 06bfe69c0e
14 changed files with 424 additions and 46 deletions

View File

@@ -1,10 +1,19 @@
#pragma once
#include <stdexcept>
#include <cinttypes>
#include <array> // Include array for std::array::at
namespace Basalt::Shared::Math {
namespace basalt::shared::math {
using FloatPoint = float;
using Index = std::uint32_t;
struct Triangle {
Index i, j, k;
Index& operator[](size_t index);
const Index& operator[](size_t index) const;
};
struct Vector3 {
FloatPoint x, y, z;
@@ -13,30 +22,37 @@ namespace Basalt::Shared::Math {
const FloatPoint& operator[](size_t index) const;
};
struct Vector4 {
struct Quaternion {
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
//struct Vector4 {
// FloatPoint x, y, z, w;
public:
Vector4& operator[](size_t index);
const Vector4& operator[](size_t index) const;
};
// FloatPoint& operator[](size_t index);
// const FloatPoint& operator[](size_t index) const;
//};
#define NOT_IMPLEMENTED throw std::logic_error("not implemented function");
//struct Matrix4x4 {
//private:
// std::array<Vector4, 4> data; // Use std::array instead of raw array for .at() method
template<typename TNum, typename TVec>
struct Vector3Traits {};
//public:
// Vector4& operator[](size_t index);
// const Vector4& operator[](size_t index) const;
//};
//
//#define NOT_IMPLEMENTED throw std::logic_error("not implemented function");
//
// template<typename TNum, typename TVec>
// struct Vector3Traits {};
//
// template<typename TNum, typename TMat>
// struct Matrix4x4Traits {};
//
//#undef NOT_IMPLEMENTED
template<typename TNum, typename TMat>
struct Matrix4x4Traits {};
#undef NOT_IMPLEMENTED
} // namespace Basalt::Shared::Math
} // namespace basalt::shared::math