| 48 | } |
| 49 | |
| 50 | int PartioViewer::run(int argc, char **argv) |
| 51 | { |
| 52 | m_argc = argc; |
| 53 | m_argv = argv; |
| 54 | |
| 55 | Utilities::logger.addSink(shared_ptr<Utilities::ConsoleSink>(new Utilities::ConsoleSink(Utilities::LogLevel::INFO))); |
| 56 | |
| 57 | LOG_INFO << "Git refspec: " << GIT_REFSPEC; |
| 58 | LOG_INFO << "Git SHA1: " << GIT_SHA1; |
| 59 | LOG_INFO << "Git status: " << GIT_LOCAL_STATUS; |
| 60 | |
| 61 | m_exePath = FileSystem::getProgramPath(); |
| 62 | m_gui = new PartioViewer_GUI_imgui(this); |
| 63 | |
| 64 | try |
| 65 | { |
| 66 | cxxopts::Options options(argv[0], "PartioViewer - Visualize partio data."); |
| 67 | options |
| 68 | .positional_help("[partio file]") |
| 69 | .show_positional_help(); |
| 70 | |
| 71 | options.add_options() |
| 72 | ("h,help", "Print help") |
| 73 | ("renderSequence", "Render a sequence from startFrame to endFrame as jpeg.") |
| 74 | ("renderVideo", "Render a sequence from startFrame to endFrame as video." |
| 75 | "This function requires ffmpeg which must be in the PATH or the ffmpegPath parameter must be set.") |
| 76 | ("noOverwrite", "Do not overwrite existing frames when using --renderSequence option." |
| 77 | "Existing frames are not loaded at all which accelerates the image sequence generation.") |
| 78 | ("o,outdir", "Output directory for images", cxxopts::value<std::string>()) |
| 79 | ("rbData", "Rigid body data to visualize (bin file)", cxxopts::value<std::string>()) |
| 80 | ("ffmpegPath", "Path of the ffmpeg excutable.", cxxopts::value<std::string>()) |
| 81 | ("width", "Width of the image in pixels.", cxxopts::value<int>()->default_value("1024")) |
| 82 | ("height", "Height of the image in pixels.", cxxopts::value<int>()->default_value("768")) |
| 83 | ("fps", "Frame rate of video.", cxxopts::value<int>()->default_value("25")) |
| 84 | ("r,radius", "Particle radius", cxxopts::value<Real>()->default_value("0.025")) |
| 85 | ("s,startFrame", "Start frame (only used if value is >= 0)", cxxopts::value<int>()->default_value("-1")) |
| 86 | ("e,endFrame", "End frame (only used if value is >= 0)", cxxopts::value<int>()->default_value("-1")) |
| 87 | ("colorField", "Name of field that is used as default for the color.", cxxopts::value<std::string>()->default_value("velocity")) |
| 88 | ("colorMapType", "Default color map (0=None, 1=Jet, 2=Plasma, 3=CoolWarm, 4=BlueWhiteRed, 5=Seismic)", cxxopts::value<unsigned int>()->default_value("1")) |
| 89 | ("renderMinValue", "Default min value of field.", cxxopts::value<float>()->default_value("0.0")) |
| 90 | ("renderMaxValue", "Default max value of field.", cxxopts::value<float>()->default_value("10.0")) |
| 91 | ; |
| 92 | |
| 93 | m_gui->addOptions(options); |
| 94 | |
| 95 | options.add_options("invisible") |
| 96 | ("partio-file", "Partio file", cxxopts::value<std::vector<std::string>>()); |
| 97 | |
| 98 | options.parse_positional({ "partio-file" }); |
| 99 | auto result = options.parse(argc, argv); |
| 100 | |
| 101 | if (result.count("help")) |
| 102 | { |
| 103 | LOG_INFO << options.help({ "", "Group" }); |
| 104 | exit(0); |
| 105 | } |
| 106 | |
| 107 | if (result.count("partio-file")) |
no test coverage detected