14 #include <openvdb/openvdb.h> 15 #include <openvdb/tools/MeshToVolume.h> 16 #include <openvdb/tools/ChangeBackground.h> 17 #include <openvdb/tools/LevelSetUtil.h> 18 #include <openvdb/tools/Composite.h> 27 void setGridName(T VDBGridPtr,
const std::string &GridName) { VDBGridPtr->setName(GridName); }
31 void insertMetaDataFloat(T VDBGridPtr,
const std::string &MetaName,
float value) { VDBGridPtr->insertMeta(MetaName, openvdb::FloatMetadata(value));}
35 void insertMetaDataInt(T VDBGridPtr,
const std::string &MetaName, int32_t value) { VDBGridPtr->insertMeta(MetaName, openvdb::Int32Metadata(value));}
39 void insertMetaDataDouble(T VDBGridPtr,
const std::string &MetaName,
double value) {VDBGridPtr->insertMeta(MetaName, openvdb::DoubleMetadata(value)); }
43 void insertMetaDataString(T VDBGridPtr,
const std::string &MetaName,
const std::string &
string) {VDBGridPtr->insertMeta(MetaName, openvdb::StringMetadata(
string)); }
46 template <
typename T,
typename T2>
47 const T2 &
getMetaData(T VDBGridPtr,
const std::string &MetaName) {
return VDBGridPtr->template metaValue<T2>(MetaName); }
51 void setGridToFogVolume(T VDBGridPtr,
bool voxelizeActiveTiles =
true) {openvdb::tools::sdfToFogVolume(*VDBGridPtr);
52 if (voxelizeActiveTiles) VDBGridPtr->treePtr()->voxelizeActiveTiles();}
56 void setGridBackgroundValue(T VDBGridPtr,
float value) { openvdb::tools::changeBackground(VDBGridPtr->tree(), value); }
60 openvdb::FloatGrid::Ptr
getGridNewCopy(T VDBGridPtr) {
return VDBGridPtr->deepCopy(); }
69 inline void unionOfTwoGrids(
const openvdb::FloatGrid::Ptr& gridA,
const openvdb::FloatGrid::Ptr& gridB) { openvdb::tools::csgUnion(*gridA, *gridB); }
71 inline void intersectionOfTwoGrids(
const openvdb::FloatGrid::Ptr& gridA,
const openvdb::FloatGrid::Ptr& gridB) { openvdb::tools::csgIntersection(*gridA, *gridB); }
73 inline void differenceOfTwoGrids(
const openvdb::FloatGrid::Ptr& gridA,
const openvdb::FloatGrid::Ptr& gridB) { openvdb::tools::csgDifference(*gridA, *gridB); }
void insertMetaDataFloat(T VDBGridPtr, const std::string &MetaName, float value)
Adds float metadata to a VDBGrid.
void insertMetaDataInt(T VDBGridPtr, const std::string &MetaName, int32_t value)
Adds integer metadata to a VDBGrid.
void differenceOfTwoGrids(const openvdb::FloatGrid::Ptr &gridA, const openvdb::FloatGrid::Ptr &gridB)
Difference of two VDBGrids.
void insertMetaDataDouble(T VDBGridPtr, const std::string &MetaName, double value)
Adds double metadata to a VDBGrid.
openvdb::FloatGrid::Ptr getGridNewCopy(T VDBGridPtr)
Copies of a VDBGrid.
void unionOfTwoGrids(const openvdb::FloatGrid::Ptr &gridA, const openvdb::FloatGrid::Ptr &gridB)
Union of two VDBGrids.
const T2 & getMetaData(T VDBGridPtr, const std::string &MetaName)
Returns from a VDBGrid the metadata of a MetaName.
void insertMetaDataString(T VDBGridPtr, const std::string &MetaName, const std::string &string)
Adds string metadata to a VDBGrid.
void setGridBackgroundValue(T VDBGridPtr, float value)
Sets the background value of a VDBGrid.
void VDBFileWrite(T VDBGridPtr, const std::string &FileName)
Writes to file a VDBGrid.
void intersectionOfTwoGrids(const openvdb::FloatGrid::Ptr &gridA, const openvdb::FloatGrid::Ptr &gridB)
Intersection of two VDBGrids.
The VDBWriter class provides a write interface for OpenVDB grid.
void setGridToFogVolume(T VDBGridPtr, bool voxelizeActiveTiles=true)
Changes a VDBGrid type to a FogVolume.
void setGridName(T VDBGridPtr, const std::string &GridName)
Adds grid name to a VDBGrid.