summaryrefslogtreecommitdiff
path: root/src/factories/GenericArrayFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/factories/GenericArrayFactory.cpp')
-rw-r--r--src/factories/GenericArrayFactory.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/factories/GenericArrayFactory.cpp b/src/factories/GenericArrayFactory.cpp
index 81144f5..a8b502a 100644
--- a/src/factories/GenericArrayFactory.cpp
+++ b/src/factories/GenericArrayFactory.cpp
@@ -24,6 +24,7 @@ std::unordered_map<std::string, ArrayType> arrayTypeMap = {
{ "Vec3f", ArrayType::Vec3f },
{ "Vec3s", ArrayType::Vec3s },
{ "Vec3i", ArrayType::Vec3i },
+ { "Vec3iu", ArrayType::Vec3iu },
{ "Vec4f", ArrayType::Vec4f },
{ "Vec4s", ArrayType::Vec4s },
};
@@ -42,6 +43,7 @@ std::unordered_map<ArrayType, size_t> typeSizeMap = {
{ ArrayType::Vec3f, 12 },
{ ArrayType::Vec3s, 6 },
{ ArrayType::Vec3i, 12 },
+ { ArrayType::Vec3iu, 12 },
{ ArrayType::Vec4f, 16 },
{ ArrayType::Vec4s, 8 },
};
@@ -60,6 +62,7 @@ std::unordered_map<ArrayType, size_t> structCountMap = {
{ ArrayType::Vec3f, 3 },
{ ArrayType::Vec3s, 3 },
{ ArrayType::Vec3i, 3 },
+ { ArrayType::Vec3iu, 3 },
{ ArrayType::Vec4f, 4 },
{ ArrayType::Vec4s, 4 },
};
@@ -140,6 +143,10 @@ GenericArray::GenericArray(std::vector<ArrayDatum> data) : mData(std::move(data)
mMaxWidth = std::max(mMaxWidth, (uint32_t)std::get<Vec3i>(datum).width());
break;
}
+ case ArrayType::Vec3iu: {
+ mMaxWidth = std::max(mMaxWidth, (uint32_t)std::get<Vec3iu>(datum).width());
+ break;
+ }
case ArrayType::Vec4f: {
mMaxWidth = std::max(mMaxWidth,(uint32_t)std::get<Vec4f>(datum).width());
mMaxPrec = std::max(mMaxPrec, (uint32_t)std::get<Vec4f>(datum).precision());
@@ -230,6 +237,9 @@ ExportResult ArrayCodeExporter::Export(std::ostream &write, std::shared_ptr<IPar
case ArrayType::Vec3i:
write << FORMAT_INT(std::get<Vec3i>(datum), array->mMaxWidth) << ", ";
break;
+ case ArrayType::Vec3iu:
+ write << FORMAT_INT(std::get<Vec3iu>(datum), array->mMaxWidth) << ", ";
+ break;
case ArrayType::Vec4f:
write << FORMAT_FLOAT(std::get<Vec4f>(datum), array->mMaxWidth, array->mMaxPrec) << ", ";
break;
@@ -372,12 +382,13 @@ std::optional<std::shared_ptr<IParsedData>> GenericArrayFactory::parse(std::vect
for (int i = 0; i < count; i++) {
switch (arrayType) {
case ArrayType::u8: {
- auto x = reader.ReadUByte();
+ uint8_t x = reader.ReadUByte();
data.emplace_back(x);
+ SPDLOG_INFO("HERE");
break;
}
case ArrayType::s8: {
- auto x = reader.ReadInt8();
+ int8_t x = reader.ReadInt8();
data.emplace_back(x);
break;
}
@@ -447,6 +458,14 @@ std::optional<std::shared_ptr<IParsedData>> GenericArrayFactory::parse(std::vect
data.emplace_back(Vec3i(vx, vy, vz));
break;
}
+ case ArrayType::Vec3iu: {
+ auto vx = reader.ReadUInt32();
+ auto vy = reader.ReadUInt32();
+ auto vz = reader.ReadUInt32();
+
+ data.emplace_back(Vec3iu(vx, vy, vz));
+ break;
+ }
case ArrayType::Vec4f: {
auto vx = reader.ReadFloat();
auto vy = reader.ReadFloat();