summaryrefslogtreecommitdiffhomepage
path: root/MagicEx/src/mag2obj.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MagicEx/src/mag2obj.cpp')
-rw-r--r--MagicEx/src/mag2obj.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/MagicEx/src/mag2obj.cpp b/MagicEx/src/mag2obj.cpp
new file mode 100644
index 0000000..a8ba386
--- /dev/null
+++ b/MagicEx/src/mag2obj.cpp
@@ -0,0 +1,27 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+*/
+
+#include <memory>
+
+#include <Solid.h>
+
+#include <MagicLoad.h>
+#include <ModelFileMAG.h>
+#include <ModelFileOBJ.h>
+
+
+int
+main(int argc, char* argv[])
+{
+ if (argc < 2)
+ return 1;
+ std::string pathname {argv[1]};
+ auto solid = std::make_unique<Solid>();
+ if (!ImportInto<ModelFileMAG>(pathname.c_str(), solid.get()))
+ return 1;
+ ModelFileOBJ exporter {(pathname + ".obj").c_str()};
+ exporter.Save(solid->GetModel());
+}