Skip to content

Commit 0ca6760

Browse files
committed
placeholder for imgToMpeg
Signed-off-by: Ken Museth <ken.museth@gmail.com>
1 parent 8588a6f commit 0ca6760

File tree

1 file changed

+29
-0
lines changed
  • openvdb_cmd/vdb_tool/include

1 file changed

+29
-0
lines changed

openvdb_cmd/vdb_tool/include/Tool.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@
9797
#include <unistd.h>
9898
#endif
9999

100+
//#define VDB_TOOL_USE_IMG_TO_MPEG
101+
102+
#ifdef VDB_TOOL_USE_IMG_TO_MPEG
103+
#include <cstdlib>
104+
#endif
105+
100106
namespace openvdb {
101107
OPENVDB_USE_VERSION_NAMESPACE
102108
namespace OPENVDB_VERSION_NAME {
@@ -206,6 +212,21 @@ class Tool
206212
/// @brief Converts all quads into triangles
207213
void quadsToTriangles();
208214

215+
#ifdef VDB_TOOL_USE_IMG_TO_MPEG
216+
/// @brief Convert multiple image files to a mpeg movie file
217+
void imgToMpeg() {
218+
std::string cmd("ffmpeg -loglevel error -framerate 30 -i slice_%03d.ppm dragon_30fps_v2.mp4"), logFile("log.txt");
219+
cmd += " > " + logFile + " 2>&1";
220+
const int code = std::system(cmd.c_str());
221+
if (code != 0) {
222+
std::stringstream ss;
223+
ss << "\nFatal error in Tool::imgToMpeg: " << code << "\n\"" << cmd << "\"\n" << std::ifstream(logFile).rdbuf();
224+
throw std::runtime_error(ss.str());
225+
}
226+
std::system(("rm " + logFile).c_str());
227+
}
228+
#endif
229+
209230
/// @brief construct a LoD sequences of VDB trees with powers of two refinements
210231
void multires();
211232

@@ -441,6 +462,14 @@ void Tool::init()
441462
{"keep", "", "1|0|true|false", "toggle wether the input geometry is preserved or deleted after the conversion"}},
442463
[&](){mParser.setDefaults();}, [&](){this->quadsToTriangles();});
443464

465+
#ifdef VDB_TOOL_USE_IMG_TO_MPEG
466+
mParser.addAction(
467+
{"img2mpeg"}, "Convert all quads in mesh to triangles, assuming they are both planar and convex",
468+
{{"geo", "0", "0", "age (i.e. stack index) of the geometry to be processed. Defaults to 0, i.e. most recently inserted geometry."},
469+
{"keep", "", "1|0|true|false", "toggle wether the input geometry is preserved or deleted after the conversion"}},
470+
[&](){mParser.setDefaults();}, [&](){this->imgToMpeg();});
471+
#endif
472+
444473
mParser.addAction(
445474
{"mesh2ls", "mesh2sdf"}, "Convert a watertight polygon surface into a narrow-band level set, i.e. a narrow-band signed distance to a polygon mesh",
446475
{{"dim", "", "256", "largest dimension in voxel units of the mesh bbox (defaults to 256). If \"vdb\" or \"voxel\" is defined then \"dim\" is ignored"},

0 commit comments

Comments
 (0)