From a70ef5c1d1cef841e1bb6f3b4ba09734487441e3 Mon Sep 17 00:00:00 2001 From: Michael Sundqvist Date: Fri, 29 Mar 2019 13:50:26 +0200 Subject: [PATCH] Add preserveUnusedSemantics option. --- GLTF/include/GLTFOptions.h | 1 + src/main.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/GLTF/include/GLTFOptions.h b/GLTF/include/GLTFOptions.h index 312e25458..1d9d28a7a 100644 --- a/GLTF/include/GLTFOptions.h +++ b/GLTF/include/GLTFOptions.h @@ -16,6 +16,7 @@ namespace GLTF { bool doubleSided = false; bool glsl = false; bool specularGlossiness = false; + bool preserveUnusedSemantics = false; std::string version = "2.0"; std::vector metallicRoughnessTexturePaths; // For Draco compression extension. diff --git a/src/main.cpp b/src/main.cpp index 5f3d28c44..ea5600d24 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,6 +76,11 @@ int main(int argc, const char **argv) { ->alias("version") ->description("glTF version to output (e.g. '1.0', '2.0')"); + parser->define("p", &options->preserveUnusedSemantics) + ->alias("preserveUnusedSemantics") + ->defaults(false) + ->description("should unused semantics be preserved. When this value is true, all mesh data is left intact even if it's not used."); + parser->define("metallicRoughnessTextures", &options->metallicRoughnessTexturePaths) ->description("paths to images to use as the PBR metallicRoughness textures"); @@ -192,7 +197,10 @@ int main(int argc, const char **argv) { asset->mergeAnimations(writer->getAnimationGroups()); asset->removeUnusedNodes(options); - asset->removeUnusedSemantics(); + + if (!options->preserveUnusedSemantics) { + asset->removeUnusedSemantics(); + } if (options->dracoCompression) { asset->removeUncompressedBufferViews();