diff options
| author | petrie911 <69443847+petrie911@users.noreply.github.com> | 2024-03-16 17:02:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-16 16:02:50 -0600 |
| commit | 8465919ab7aba6cfde7d25ad1731673e5da01642 (patch) | |
| tree | e906ebdd9c86d0697aedabd4ccb8445127a18af5 | |
| parent | 3330d5bd39bd4e0da8c8530290aba59fda849c17 (diff) | |
Forgot to clean up the commented out code (#45)
| -rw-r--r-- | src/Companion.cpp | 1 | ||||
| -rw-r--r-- | src/factories/sf64/SkeletonFactory.cpp | 12 | ||||
| -rw-r--r-- | src/factories/sf64/TriangleFactory.cpp | 69 | ||||
| -rw-r--r-- | src/factories/sf64/TriangleFactory.h | 2 |
4 files changed, 2 insertions, 82 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp index 4f87364..7784fe7 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -137,6 +137,7 @@ void Companion::ParseEnums(std::string& header) { enumIndex++; this->gEnums[enumName][enumIndex] = line; } + } } diff --git a/src/factories/sf64/SkeletonFactory.cpp b/src/factories/sf64/SkeletonFactory.cpp index da4e638..fdcae26 100644 --- a/src/factories/sf64/SkeletonFactory.cpp +++ b/src/factories/sf64/SkeletonFactory.cpp @@ -8,6 +8,7 @@ #define NUM(x, w) std::dec << std::setfill(' ') << std::setw(w) << x // #define NUM_JOINT(x) std::dec << std::setfill(' ') << std::setw(5) << x #define FLOAT(x, w, p) std::dec << std::setfill(' ') << std::setw(w) << std::fixed << std::setprecision(p) << x + SF64::LimbData::LimbData(uint32_t addr, uint32_t dList, Vec3f trans, Vec3s rot, uint32_t sibling, uint32_t child, int index): mAddr(addr), mDList(dList), mTrans(trans), mRot(rot), mSibling(sibling), mChild(child), mIndex(index) { } @@ -23,16 +24,6 @@ void SF64::SkeletonHeaderExporter::Export(std::ostream &write, std::shared_ptr<I write << "extern Limb* " << symbol << "[];\n"; } -int GetPrecision(float f) { - int prec = 0; - - while(f != (int)f && prec < 8 ){ - f *= 10; - prec++; - } - return prec; -} - void SF64::SkeletonCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { const auto symbol = GetSafeNode(node, "symbol", entryName); const auto offset = GetSafeNode<uint32_t>(node, "offset"); @@ -74,7 +65,6 @@ void SF64::SkeletonCodeExporter::Export(std::ostream &write, std::shared_ptr<IPa write << "0x" << std::uppercase << std::hex << limb.mDList << ", "; } } - // auto p = std::max(std::max(GetPrecision(limb.mTrans.x), GetPrecision(limb.mTrans.y)), GetPrecision(limb.mTrans.z)); write << FLOAT(limb.mTrans, 0, limb.mTrans.precision()) << ", "; write << std::dec << limb.mRot << ", "; write << ((limb.mSibling != 0) ? "&" : "") << limbDict[limb.mSibling] << ", "; diff --git a/src/factories/sf64/TriangleFactory.cpp b/src/factories/sf64/TriangleFactory.cpp index ea098e5..0d933b2 100644 --- a/src/factories/sf64/TriangleFactory.cpp +++ b/src/factories/sf64/TriangleFactory.cpp @@ -11,10 +11,6 @@ #define FORMAT_FLOAT(x, w, p) std::dec << std::setfill(' ') << std::fixed << std::setprecision(p) << std::setw(w) << x #define STRIP_SEGMENT(offset) (IS_SEGMENTED(offset) ? SEGMENT_OFFSET(offset) : (offset)) -// SF64::TriangleData::TriangleData(std::vector<Vec3s> tris, std::vector<std::vector<Vec3f>> meshes): mTris(tris), mMeshes(meshes) { - -// } - SF64::TriangleData::TriangleData(std::vector<Vec3s> tris, std::vector<YAML::Node> meshNodes): mTris(tris), mMeshNodes(meshNodes) { } @@ -62,48 +58,6 @@ void SF64::TriangleCodeExporter::Export(std::ostream &write, std::shared_ptr<IPa } write << "\n"; - - - // auto meshOffset = offset + triData->mTris.size() * sizeof(Vec3s); - - // for(int j = 0; j < triData->mMeshes.size(); j++) { - // std::string indexTag = ""; - // std::ostringstream offsetStr; - // std::string meshSymbol; - // if(triData->mMeshes.size() != 1) { - // indexTag = std::to_string(j) + "_"; - // } - // offsetStr << std::uppercase << std::hex << STRIP_SEGMENT(meshOffset); - // if(!node["mesh_symbol"]) { - // meshSymbol = symbol + "_mesh_" + indexTag + offsetStr.str(); - // } else { - // meshSymbol = GetSafeNode<std::string>(node, "mesh_symbol"); - // if(!ReplaceOffset(meshSymbol, meshOffset)) { - // meshSymbol += indexTag; - // } - // } - - // if (Companion::Instance->IsDebug()) { - // write << "// 0x" << std::uppercase << std::hex << off << "\n"; - // } - - // write << "Vec3f " << meshSymbol << "[] = {"; - // i = 0; - // for(Vec3f vtx : triData->mMeshes[j]) { - // if((i++ % 4) == 0) { - // write << "\n" << fourSpaceTab; - // } - // write << NUM(vtx, 5) << ", "; - // } - - // write << "\n};\n"; - // off += triData->mMeshes[j].size() * sizeof(Vec3f); - // if (Companion::Instance->IsDebug()) { - // write << "// Mesh vertex count: " << triData->mMeshes[j].size() << "\n"; - // write << "// 0x" << std::uppercase << std::hex << off << "\n"; - // } - // write << "\n"; - // } } void SF64::TriangleBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { @@ -151,7 +105,6 @@ std::optional<std::shared_ptr<IParsedData>> SF64::TriangleFactory::parse(std::ve offsetSeg << std::uppercase << std::hex << meshOffset; off = offsetSeg.str(); meshSymbol = std::regex_replace(meshSymbol, std::regex(R"(OFFSET)"), offsetSeg.str()); - // std::replace(meshSymbol.begin(), meshSymbol.end(), replaceOff, off); } meshNode["symbol"] = meshSymbol; } @@ -164,27 +117,5 @@ std::optional<std::shared_ptr<IParsedData>> SF64::TriangleFactory::parse(std::ve meshOffset += meshSize * sizeof(Vec3f); } - - - - // YAML::Node meshNode; - // meshNode["offset"] = meshOffset; - // auto [__, meshSegment] = Decompressor::AutoDecode(meshNode, buffer, meshSize * meshCount * sizeof(Vec3f)); - // LUS::BinaryReader meshReader(meshSegment.data, meshSegment.size); - // meshReader.SetEndianness(LUS::Endianness::Big); - // std::vector<std::vector<Vec3f>> meshes; - - // for(int j = 0; j < meshCount; j++) { - // std::vector<Vec3f> mesh; - // Vec3f vtx; - // for(int i = 0; i < meshSize; i++) { - // vtx.x = meshReader.ReadFloat(); - // vtx.y = meshReader.ReadFloat(); - // vtx.z = meshReader.ReadFloat(); - // mesh.push_back(vtx); - // } - // meshes.push_back(mesh); - // } - return std::make_shared<SF64::TriangleData>(tris, meshNodes); } diff --git a/src/factories/sf64/TriangleFactory.h b/src/factories/sf64/TriangleFactory.h index 2ed0c5c..5be4f3e 100644 --- a/src/factories/sf64/TriangleFactory.h +++ b/src/factories/sf64/TriangleFactory.h @@ -8,10 +8,8 @@ namespace SF64 { class TriangleData : public IParsedData { public: std::vector<Vec3s> mTris; - // std::vector<std::vector<Vec3f>> mMeshes; std::vector<YAML::Node> mMeshNodes; - // TriangleData(std::vector<Vec3s> tris, std::vector<std::vector<Vec3f>> meshes); TriangleData(std::vector<Vec3s> tris, std::vector<YAML::Node> meshNodes); }; |
