diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-08-17 18:31:57 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-08-17 18:31:57 -0600 |
| commit | 243125d6d500deea4ea862ea9678cf795b54b499 (patch) | |
| tree | 965721fe40af043ae157e2aed08a499754498899 /src | |
| parent | 1f3bdf8a4e91800f8fa077d6d46c6eafea8c99de (diff) | |
Fixed light export
Diffstat (limited to 'src')
| -rw-r--r-- | src/factories/LightsFactory.cpp | 40 | ||||
| -rw-r--r-- | src/factories/sm64/AnimationFactory.cpp | 2 |
2 files changed, 2 insertions, 40 deletions
diff --git a/src/factories/LightsFactory.cpp b/src/factories/LightsFactory.cpp index d6aa580..cb5d9b5 100644 --- a/src/factories/LightsFactory.cpp +++ b/src/factories/LightsFactory.cpp @@ -106,18 +106,8 @@ ExportResult LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IPa ExportResult LightsBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { auto light = std::static_pointer_cast<LightsData>(raw)->mLights; auto writer = LUS::BinaryWriter(); - auto size = sizeof(light.l) / sizeof(LightRaw); - WriteHeader(writer, Torch::ResourceType::Lights, 0); - - writer.Write(reinterpret_cast<char*>(light.a.l.col), 3); - - writer.Write(static_cast<uint32_t>(size)); - - for(size_t i = 0; i < size; i++) { - writer.Write(reinterpret_cast<char*>(light.l[i].l.col), 3); - writer.Write(reinterpret_cast<char*>(light.l[i].l.dir), 3); - } + writer.Write(reinterpret_cast<char*>(&light), sizeof(Lights1Raw)); writer.Finish(write); writer.Close(); return std::nullopt; @@ -127,33 +117,7 @@ std::optional<std::shared_ptr<IParsedData>> LightsFactory::parse(std::vector<uin auto decoded = Decompressor::AutoDecode(node, buffer); auto [_, segment] = Decompressor::AutoDecode(node, buffer); LUS::BinaryReader reader(segment.data, sizeof(Lights1Raw)); - - reader.SetEndianness(Torch::Endianness::Big); Lights1Raw lights; - // Directional light - - // Ambient - auto r = reader.ReadUByte(); - auto g = reader.ReadUByte(); - auto b = reader.ReadUByte(); - //auto nil = reader.ReadInt32(); - reader.Seek(5, LUS::SeekOffsetType::Current); - - // Diffuse copy - auto r2 = reader.ReadUByte(); - auto g2 = reader.ReadUByte(); - auto b2 = reader.ReadUByte(); - - reader.Seek(5, LUS::SeekOffsetType::Current); - - // Direction - auto x = reader.ReadInt8(); - auto y = reader.ReadInt8(); - auto z = reader.ReadInt8(); - - // TODO: This is a hack, but it works for now. - // The struct has several copies/padding. The zeros skip those for gdSPDefLights1. - lights = {r, g, b, 0, r, g, b, 0, r2, g2, b2, 0, r2, g2, b2, 0, x, y, z}; - + reader.Read((char*) &lights, sizeof(Lights1Raw)); return std::make_shared<LightsData>(lights); } diff --git a/src/factories/sm64/AnimationFactory.cpp b/src/factories/sm64/AnimationFactory.cpp index 3d9edf6..4b6b5e4 100644 --- a/src/factories/sm64/AnimationFactory.cpp +++ b/src/factories/sm64/AnimationFactory.cpp @@ -77,7 +77,6 @@ std::optional<std::shared_ptr<IParsedData>> SM64::AnimationFactory::parse(std::v std::vector<uint16_t> indicesData; for (size_t i = 0; i < indexLength; i++) { indicesData.push_back(indices.ReadUInt16()); - SPDLOG_INFO("Index: {}", indicesData.back()); } LUS::BinaryReader values = LUS::BinaryReader(mainData + valuesAddr, valuesSize); @@ -85,7 +84,6 @@ std::optional<std::shared_ptr<IParsedData>> SM64::AnimationFactory::parse(std::v std::vector<int16_t> valuesData; for (size_t i = 0; i < valuesSize / sizeof(int16_t); i++) { valuesData.push_back(values.ReadInt16()); - SPDLOG_INFO("Value: {}", valuesData.back()); } return std::make_shared<AnimationData>(flags, animYTransDivisor, startFrame, loopStart, loopEnd, unusedBoneCount, length, indicesData, valuesData); |
