stash
This commit is contained in:
commit
d0a8b12c1a
22 changed files with 1329 additions and 0 deletions
43
Crafter.Math-BasicTypes.cppm
Executable file
43
Crafter.Math-BasicTypes.cppm
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
module;
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdfloat>
|
||||
#include <format>
|
||||
|
||||
export module Crafter.Math:BasicTypes;
|
||||
|
||||
namespace Crafter {
|
||||
export struct Float2 {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
export struct Float3 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
export struct Float4 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
export struct Float4x4 {
|
||||
float c1[4];
|
||||
float c2[4];
|
||||
float c3[4];
|
||||
float c4[4];
|
||||
};
|
||||
}
|
||||
|
||||
template <>
|
||||
struct std::formatter<Crafter::Float4x4> : std::formatter<std::string> {
|
||||
auto format(const Crafter::Float4x4& obj, format_context& ctx) const {
|
||||
return std::formatter<std::string>::format(std::format("{{{}, {}, {}, {}\n{}, {}, {}, {}\n{}, {}, {}, {}\n{}, {}, {}, {}}}",
|
||||
obj.c1[0], obj.c2[0], obj.c3[0], obj.c4[0],
|
||||
obj.c1[1], obj.c2[1], obj.c3[1], obj.c4[1],
|
||||
obj.c1[2], obj.c2[2], obj.c3[2], obj.c4[2],
|
||||
obj.c1[3], obj.c2[3], obj.c3[3], obj.c4[3]
|
||||
), ctx);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue