Merge pull request #6 from MegaMech/arr

Implement Vec3iu to GenericArray Factory
This commit is contained in:
Lywx 2024-09-06 19:55:51 -06:00 committed by Sonic Dreamcaster
commit 299aa71966
2 changed files with 12 additions and 2 deletions

View File

@ -86,6 +86,11 @@ std::shared_ptr<Ship::IResource> ResourceFactoryBinaryGenericArrayV0::ReadResour
std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec3i), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec3iu: {
Vec3iu vec(reader->ReadUInt32(), reader->ReadUInt32(), reader->ReadUInt32());
std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec3iu), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec4f: {
Vec4f vec(reader->ReadFloat(), reader->ReadFloat(), reader->ReadFloat(), reader->ReadFloat());
std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec4f), std::back_inserter(arr->mData));

View File

@ -26,6 +26,11 @@ struct Vec3i {
Vec3i(int32_t x, int32_t y, int32_t z) : x(x), y(y), z(z) {}
};
struct Vec3iu {
uint32_t x, y, z;
Vec3iu(uint32_t x, uint32_t y, uint32_t z) : x(x), y(y), z(z) {}
};
struct Vec4f {
float x, y, z, w;
Vec4f(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
@ -37,7 +42,7 @@ struct Vec4s {
};
enum class ArrayType {
u8, s8, u16, s16, u32, s32, u64, f32, f64, Vec2f, Vec3f, Vec3s, Vec3i, Vec4f, Vec4s,
u8, s8, u16, s16, u32, s32, u64, f32, f64, Vec2f, Vec3f, Vec3s, Vec3i, Vec3iu, Vec4f, Vec4s,
};
class GenericArray : public Ship::Resource<uint8_t> {