8 #ifndef OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED
9 #define OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED
14 #include <type_traits>
28 template<
typename Gr
idType>
29 typename GridType::template ValueConverter<bool>::Type::Ptr
37 namespace mask_internal {
38 template<
typename Gr
idType>
42 using BoolGridPtrType =
typename BoolGridType::Ptr;
45 template<
typename Gr
idType>
47 typename mask_internal::Traits<GridType>::BoolGridPtrType>
::type
48 doLevelSetInteriorMask(
const GridType& grid,
const double isovalue)
51 using MaskGridPtrT =
typename mask_internal::Traits<GridType>::BoolGridPtrType;
57 return MaskGridPtrT{};
61 template<
typename Gr
idType>
63 typename mask_internal::Traits<GridType>::BoolGridPtrType>
::type
64 doLevelSetInteriorMask(
const GridType&,
const double )
66 using MaskGridPtrT =
typename mask_internal::Traits<GridType>::BoolGridPtrType;
67 return MaskGridPtrT{};
70 template<
typename Gr
idType>
71 inline typename std::enable_if<mask_internal::Traits<GridType>::isBool,
72 typename mask_internal::Traits<GridType>::BoolGridPtrType>
::type
73 doInteriorMask(
const GridType& grid,
const double )
76 return grid.deepCopy();
79 template<
typename Gr
idType>
80 inline typename std::enable_if<!(mask_internal::Traits<GridType>::isBool),
81 typename mask_internal::Traits<GridType>::BoolGridPtrType>::
type
82 doInteriorMask(
const GridType& grid,
const double isovalue)
84 using MaskGridT =
typename mask_internal::Traits<GridType>::BoolGridType;
87 if (
auto maskGridPtr = doLevelSetInteriorMask(grid, isovalue)) {
92 auto maskGridPtr = MaskGridT::create(
false);
93 maskGridPtr->setTransform(grid.transform().copy());
94 maskGridPtr->topologyUnion(grid);
103 template<
typename Gr
idType>
104 typename GridType::template ValueConverter<bool>::Type::Ptr
107 return mask_internal::doInteriorMask(grid, isovalue);
116 #ifdef OPENVDB_USE_EXPLICIT_INSTANTIATION
118 #ifdef OPENVDB_INSTANTIATE_MASK
122 #define _FUNCTION(TreeT) \
123 Grid<TreeT>::ValueConverter<bool>::Type::Ptr interiorMask(const Grid<TreeT>&, const double)
127 #endif // OPENVDB_USE_EXPLICIT_INSTANTIATION
134 #endif // OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED
GridType
List of types that are currently supported by NanoVDB.
GLsizei const GLfloat * value
#define OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_VOLUME_TREE_INSTANTIATE(Function)
Miscellaneous utility methods that operate primarily or exclusively on level set grids.
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.