Skip to content

Commit f79d180

Browse files
committed
Clean Up
- removed unused variables - removed std::format (since GitHub runners don't have gcc-13 yet)
1 parent d4179ba commit f79d180

4 files changed

Lines changed: 28 additions & 17 deletions

File tree

src/Animation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ MMDAnimation::MMDAnimation(ReadBuffer& buffer, std::size_t boneCount)
234234
{
235235
case 0x0000: // keyframe
236236
{
237-
uint16_t timeCode = instruction & 0xFFF;
238237
instructions.emplace_back(new KeyframeInstruction(instruction, buffer));
239238
break;
240239
}

src/CLUTMap.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ void CLUTMap::updateBlocks()
4040

4141
void CLUTMap::applyModel(Model& model)
4242
{
43-
auto texturePage = model.getTexturePage();
44-
auto clutX = model.getClutX();
45-
auto clutY = model.getClutY();
46-
4743
for (auto& mesh : model.meshes)
4844
for (const Face& face : mesh.faces)
4945
{

src/GLTF.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "GLTF.hpp"
77

8-
#include <format>
98
#include <numbers>
109

1110
struct Quaternion
@@ -18,12 +17,12 @@ struct Quaternion
1817
Quaternion() = default;
1918
Quaternion(FVector angles)
2019
{
21-
double c1 = std::cos((angles.x * std::numbers::pi / 180.0f) * 0.5);
22-
double s1 = std::sin((angles.x * std::numbers::pi / 180.0f) * 0.5);
23-
double c2 = std::cos((angles.y * std::numbers::pi / 180.0f) * 0.5);
24-
double s2 = std::sin((angles.y * std::numbers::pi / 180.0f) * 0.5);
25-
double c3 = std::cos((angles.z * std::numbers::pi / 180.0f) * 0.5);
26-
double s3 = std::sin((angles.z * std::numbers::pi / 180.0f) * 0.5);
20+
float c1 = std::cos((angles.x * std::numbers::pi / 180.0f) * 0.5f);
21+
float s1 = std::sin((angles.x * std::numbers::pi / 180.0f) * 0.5f);
22+
float c2 = std::cos((angles.y * std::numbers::pi / 180.0f) * 0.5f);
23+
float s2 = std::sin((angles.y * std::numbers::pi / 180.0f) * 0.5f);
24+
float c3 = std::cos((angles.z * std::numbers::pi / 180.0f) * 0.5f);
25+
float s3 = std::sin((angles.z * std::numbers::pi / 180.0f) * 0.5f);
2726

2827
this->w = c1 * c2 * c3 - s1 * s2 * s3;
2928
this->x = s1 * c2 * c3 + c1 * s2 * s3;
@@ -267,8 +266,13 @@ void GLTFExporter::buildSkeletonScene()
267266

268267
for (auto& mmdNode : mmd.skeleton)
269268
{
269+
// TODO: replace with std::format when GCC13 becomes available on Linux runners
270+
// std::format("node-{}", model.nodes.size())
271+
std::stringstream nodeName;
272+
nodeName << "node-" << model.nodes.size();
273+
270274
tinygltf::Node node;
271-
node.name = std::format("node-{}", model.nodes.size());
275+
node.name = nodeName.str();
272276

273277
if (mmdNode.object != 255)
274278
{
@@ -369,12 +373,15 @@ int32_t GLTFExporter::buildMaterial(MaterialMode mode)
369373

370374
void GLTFExporter::buildAnimations()
371375
{
376+
int i = 0;
372377
for (auto& raw : mmd.anims->anims)
373378
{
374379
Animation data(raw);
375380
tinygltf::Animation anim;
376381
int nodeId = 0;
377382

383+
std::cout << i++ << std::endl;
384+
378385
for (auto a : data.getData())
379386
{
380387
std::vector<float> posTime;

src/main.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "TIM.hpp"
44

55
#include <filesystem>
6-
#include <format>
76
#include <fstream>
87
#include <iostream>
98

@@ -227,19 +226,29 @@ int main(int count, char* args[])
227226

228227
for (Entry& entry : entries)
229228
{
230-
std::filesystem::path modelPath = dataPath / std::format("CHDAT/MMD{}/{}.MMD", id++ / 30, entry.filename);
229+
std::stringstream mmdPath;
230+
mmdPath << "CHDAT/MMD" << (id++ / 30) << "/" << entry.filename << ".MMD";
231+
232+
// TODO: replace with std::format when GCC13 becomes available on Linux runners
233+
// std::format("CHDAT/MMD{}/{}.MMD", id++ / 30, entry.filename)
234+
std::filesystem::path modelPath = dataPath / mmdPath.str();
231235

232236
if (!std::filesystem::exists(modelPath))
233237
{
234-
std::cout << "File " << modelPath << "does not exist, skipping." << std::endl;
238+
std::cout << "File " << modelPath << " does not exist, skipping." << std::endl;
235239
continue;
236240
}
237241

238242
Model model(modelPath, entry.skeleton);
239243
AbstractTIM tim(entry.texture);
240244
GLTFExporter gltf(model, tim);
241245

242-
bool success = gltf.save(std::format("output/{}.gltf", entry.filename));
246+
// TODO: replace with std::format when GCC13 becomes available on Linux runners
247+
// std::format("output/{}.gltf", entry.filename)
248+
std::stringstream outputPath;
249+
outputPath << "output/" << entry.filename << ".gltf";
250+
251+
bool success = gltf.save(outputPath.str());
243252
if (success)
244253
std::cout << "Written " << entry.filename << std::endl;
245254
else

0 commit comments

Comments
 (0)