summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLywx <kiritodev01@gmail.com>2024-09-06 19:55:51 -0600
committerSonic Dreamcaster <alejandro.asenjo88@gmail.com>2024-09-17 20:30:07 -0300
commit299aa719668d40044f6d101cafdd0bdb5bf05e83 (patch)
tree00caf9532c53b2390ee7dd7205962fd0aa3f275e
parent7f2aa148cc78bd6dd9abe2c710c293c0c4140b6f (diff)
parent376054ed330a4a56278495626c35ab383e55be6f (diff)
Merge pull request #6 from MegaMech/arr
Implement Vec3iu to GenericArray Factory
-rw-r--r--src/port/resource/importers/GenericArrayFactory.cpp5
-rw-r--r--src/port/resource/type/GenericArray.h9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/port/resource/importers/GenericArrayFactory.cpp b/src/port/resource/importers/GenericArrayFactory.cpp
index 27abc55f..7fd6e50c 100644
--- a/src/port/resource/importers/GenericArrayFactory.cpp
+++ b/src/port/resource/importers/GenericArrayFactory.cpp
@@ -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));
diff --git a/src/port/resource/type/GenericArray.h b/src/port/resource/type/GenericArray.h
index 7043faf5..d28d9b68 100644
--- a/src/port/resource/type/GenericArray.h
+++ b/src/port/resource/type/GenericArray.h
@@ -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> {
@@ -52,4 +57,4 @@ class GenericArray : public Ship::Resource<uint8_t> {
std::vector<uint8_t> mData;
size_t mSize;
};
-} \ No newline at end of file
+}