Skip to content

Commit

Permalink
Add RootNode::deleteChildOrTile()
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Bailey <[email protected]>
  • Loading branch information
danrbailey committed Oct 26, 2024
1 parent 937e5fa commit a984443
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions openvdb/openvdb/tree/RootNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ class RootNode
template<typename AccessorT>
void addTileAndCache(Index level, const Coord& xyz, const ValueType&, bool state, AccessorT&);

/// @brief Delete any child or tile containing voxel (x, y, z) at the root level.
/// Do nothing if no child or tile was found.
/// @return @c true if child or tile was deleted
bool deleteChildOrTile(const Coord& xyz);

/// @brief Return a pointer to the leaf node that contains voxel (x, y, z).
/// If no such node exists, create one that preserves the values and
/// active states of all voxels.
Expand Down Expand Up @@ -2700,6 +2705,15 @@ RootNode<ChildT>::addTileAndCache(Index level, const Coord& xyz, const ValueType
}


template<typename ChildT>
inline bool
RootNode<ChildT>::deleteChildOrTile(const Coord& xyz)
{
Coord key = this->coordToKey(xyz);
return mTable.erase(key) == size_t(1);
}


////////////////////////////////////////


Expand Down

0 comments on commit a984443

Please sign in to comment.