I have an openvdb grid and I would like to reset the active state of all voxels that are not background.
Currently I am using an operator and the function openvdb::tools::foreach that iterates over all value nodes. In particular I might want to do it only for elements inside a given bounding box
openvdb::CoordBBox myBoundingBox;
struct Activator {
static inline void op(const openvdb::FloatGrid::ValueAllIter& iter) {
if ( [not background] )
iter->setActiveState(myBoundingBox.isInside(iter->getCoord()));
}
};
// Apply the function to all values.
openvdb::tools::foreach(grid->beginValueAll(), Activator ::op);
1) Is there a better way of setting all these voxels on/off?
2) Moreover it is possible to quickly set to on (or off) all voxels that lay withing the given axis aligned bounding box and are not background?
E.g.. something like
openvdb::tree::setActiveState(const CoordBBox &bbox, bool on)