#include "stdafx.h" #include #include "model/Model3d.h" #include "utilities/Globals.h" #include "utilities/Logs.h" #include "rendering/renderer.h" int export_e3d_standalone(std::string in, std::string out, int flags, bool dynamic) { Global.iConvertModels = flags; Global.iWriteLogEnabled = 2; Global.ParserLogIncludes = true; // the log goes to the standard output only, where the conversion scripts read the included files from, so it is // written from the start. without the log service nothing logged here would come out at all OpenLogFiles(); std::jthread logservice(LogService); GfxRenderer = gfx_renderer_factory::get_instance()->create("null"); TModel3d model; model.LoadFromTextFile(in, dynamic); model.Init(); auto result{0}; if (model.GetSMRoot() == nullptr) { ErrorLog("Bad model: failed to load 3d model \"" + in + "\""); result = 1; } else { model.SaveToBinFile(out); } // the process ends without destructors, so the log service writes out what's left before it goes StopLogService(); logservice.join(); return result; }