diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-06-24 13:00:13 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-06-24 17:07:35 +0300 |
commit | 9fe64948abe991d18c1af3a52d81e87c24d39687 (patch) | |
tree | bc7363b04130a7538eeb21a7e42e04038e1f3314 /extern/mantaflow/preprocessed/grid.cpp | |
parent | 6fec2e4db05f6acdfc2b1b0ba365af143201277c (diff) |
Fluid: Updated Mantaflow source with latest OpenVDB changes
This updated set of Mantaflow files includes the improved OpenVDB file IO. With this update it is finally possible to store multiple grids per file. It is also possible to save particle systems and particle data to OpenVDB files.
Diffstat (limited to 'extern/mantaflow/preprocessed/grid.cpp')
-rw-r--r-- | extern/mantaflow/preprocessed/grid.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/extern/mantaflow/preprocessed/grid.cpp b/extern/mantaflow/preprocessed/grid.cpp index 0ea3afb91f4..76716beb1ac 100644 --- a/extern/mantaflow/preprocessed/grid.cpp +++ b/extern/mantaflow/preprocessed/grid.cpp @@ -122,48 +122,52 @@ template<class T> void Grid<T>::swap(Grid<T> &other) mData = dswap; } -template<class T> void Grid<T>::load(string name) +template<class T> int Grid<T>::load(string name) { if (name.find_last_of('.') == string::npos) errMsg("file '" + name + "' does not have an extension"); string ext = name.substr(name.find_last_of('.')); if (ext == ".raw") - readGridRaw(name, this); + return readGridRaw(name, this); else if (ext == ".uni") - readGridUni(name, this); + return readGridUni(name, this); else if (ext == ".vol") - readGridVol(name, this); + return readGridVol(name, this); else if (ext == ".npz") - readGridNumpy(name, this); -#if OPENVDB == 1 - else if (ext == ".vdb") - readGridVDB(name, this); -#endif // OPENVDB==1 + return readGridNumpy(name, this); + else if (ext == ".vdb") { + std::vector<PbClass *> grids; + grids.push_back(this); + return readObjectsVDB(name, &grids); + } else errMsg("file '" + name + "' filetype not supported"); + return 0; } -template<class T> void Grid<T>::save(string name) +template<class T> int Grid<T>::save(string name) { if (name.find_last_of('.') == string::npos) errMsg("file '" + name + "' does not have an extension"); string ext = name.substr(name.find_last_of('.')); if (ext == ".raw") - writeGridRaw(name, this); + return writeGridRaw(name, this); else if (ext == ".uni") - writeGridUni(name, this); + return writeGridUni(name, this); else if (ext == ".vol") - writeGridVol(name, this); -#if OPENVDB == 1 - else if (ext == ".vdb") - writeGridVDB(name, this); -#endif // OPENVDB==1 + return writeGridVol(name, this); else if (ext == ".npz") - writeGridNumpy(name, this); + return writeGridNumpy(name, this); + else if (ext == ".vdb") { + std::vector<PbClass *> grids; + grids.push_back(this); + return writeObjectsVDB(name, &grids); + } else if (ext == ".txt") - writeGridTxt(name, this); + return writeGridTxt(name, this); else errMsg("file '" + name + "' filetype not supported"); + return 0; } //****************************************************************************** |