forked from archibate/mallocvis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvdb_example.cpp
More file actions
27 lines (22 loc) · 803 Bytes
/
vdb_example.cpp
File metadata and controls
27 lines (22 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <openvdb/openvdb.h>
#include <openvdb/tools/LevelSetSphere.h>
using namespace std::chrono_literals;
int main() {
putenv("MALLOCVIS=layout:address;show_text:0");
openvdb::initialize();
// create sdf square
openvdb::FloatGrid::Ptr grid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(1.0f, openvdb::Vec3f(0,0,0), 0.1f);
for (int i = 0; i < 40; ++i) {
std::this_thread::sleep_for(1ms);
grid = grid->deepCopy();
grid = grid->deepCopy();
grid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(1.0f, openvdb::Vec3f(0,0,0), 0.1f);
}
// save grid to file
openvdb::io::File file("/tmp/sphere.vdb");
openvdb::GridPtrVec grids;
grids.push_back(grid);
file.write(grids);
file.close();
return 0;
}