fix: generate json in non-binary glTF path
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 38s

This commit is contained in:
茂之钳
2026-07-24 09:10:01 +00:00
parent 687bbaba35
commit 0dbbb4ac4f
2 changed files with 17 additions and 7 deletions
+16 -7
View File
@@ -248,18 +248,27 @@ bool write_gltf(const std::string& filepath, const mesh::HalfedgeMesh& mesh,
return true; return true;
} else { } else {
// ── glTF JSON + separate .bin ── // ── glTF JSON + separate .bin ──
std::ofstream file(filepath); // Determine bin filename from output path
if (!file) return false;
file << json;
// Write separate bin
std::string dot = "."; std::string dot = ".";
size_t dot_pos = filepath.rfind(dot); size_t dot_pos = filepath.rfind(dot);
std::string binpath; std::string binpath;
if (dot_pos != std::string::npos) std::string bin_basename;
if (dot_pos != std::string::npos) {
binpath = filepath.substr(0, dot_pos) + ".bin"; binpath = filepath.substr(0, dot_pos) + ".bin";
else // Extract just the filename
size_t slash_pos = binpath.rfind('/');
bin_basename = (slash_pos != std::string::npos)
? binpath.substr(slash_pos + 1) : binpath;
} else {
binpath = filepath + ".bin"; binpath = filepath + ".bin";
bin_basename = binpath;
}
std::string json = generate_json(mesh, options, layout, bin_basename);
std::ofstream file(filepath);
if (!file) return false;
file << json;
std::ofstream bin(binpath, std::ios::binary); std::ofstream bin(binpath, std::ios::binary);
if (!bin) return false; if (!bin) return false;
+1
View File
@@ -3,6 +3,7 @@
#include <cstdio> #include <cstdio>
#include "vde/foundation/io_gltf.h" #include "vde/foundation/io_gltf.h"
#include "vde/brep/modeling.h" #include "vde/brep/modeling.h"
#include "vde/brep/modeling.h"
using namespace vde::foundation; using namespace vde::foundation;
using namespace vde::mesh; using namespace vde::mesh;