diff --git a/src/FBX2glTF.cpp b/src/FBX2glTF.cpp index e65c310..7c8948d 100644 --- a/src/FBX2glTF.cpp +++ b/src/FBX2glTF.cpp @@ -292,14 +292,24 @@ int main(int argc, char* argv[]) { // the path of the actual .glb or .gltf file std::string modelPath; + const auto& suffix = FileUtils::GetFileSuffix(outputPath); + + // Assume binary output if extension is glb + if (suffix.has_value() && suffix.value() == "glb") { + gltfOptions.outputBinary = true; + } + if (gltfOptions.outputBinary) { - const auto& suffix = FileUtils::GetFileSuffix(outputPath); // add .glb to output path, unless it already ends in exactly that if (suffix.has_value() && suffix.value() == "glb") { modelPath = outputPath; } else { modelPath = outputPath + ".glb"; } + // if the extension is gltf set the output folder to the parent directory + } else if (suffix.has_value() && suffix.value() == "gltf") { + outputFolder = FileUtils::getFolder(outputPath) + "/"; + modelPath = outputPath; } else { // in gltf mode, we create a folder and write into that outputFolder = fmt::format("{}_out/", outputPath.c_str());