OpenVDB
9.0.1
|
Value accessor with one level of node caching. More...
#include <openvdb/tree/ValueAccessor.h>
Inherits ValueAccessorBase< _TreeType, IsSafe >.
Public Types | |
using | TreeType = _TreeType |
using | ValueType = typename TreeType::ValueType |
using | RootNodeT = typename TreeType::RootNodeType |
using | LeafNodeT = typename TreeType::LeafNodeType |
using | BaseT = ValueAccessorBase< TreeType, IsSafe > |
using | InvTreeT = typename RootNodeT::NodeChainType |
using | NodeT0 = typename InvTreeT::template Get< L0 > |
Public Member Functions | |
ValueAccessor1 (TreeType &tree) | |
Constructor from a tree. More... | |
ValueAccessor1 (const ValueAccessor1 &other) | |
Copy constructor. More... | |
ValueAccessor1 & | operator= (const ValueAccessor1 &other) |
Assignment operator. More... | |
~ValueAccessor1 () override=default | |
Virtual destructor. More... | |
bool | isCached (const Coord &xyz) const |
const ValueType & | getValue (const Coord &xyz) const |
Return the value of the voxel at the given coordinates. More... | |
bool | isValueOn (const Coord &xyz) const |
Return the active state of the voxel at the given coordinates. More... | |
bool | probeValue (const Coord &xyz, ValueType &value) const |
Return the active state of the voxel as well as its value. More... | |
int | getValueDepth (const Coord &xyz) const |
bool | isVoxel (const Coord &xyz) const |
void | setValueOnly (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinate but preserves its active state. More... | |
void | setValueOff (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates and mark the voxel as inactive. More... | |
template<typename ModifyOp > | |
void | modifyValue (const Coord &xyz, const ModifyOp &op) |
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. More... | |
template<typename ModifyOp > | |
void | modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op) |
Apply a functor to the voxel at the given coordinates. More... | |
void | setActiveState (const Coord &xyz, bool on=true) |
Set the active state of the voxel at the given coordinates but don't change its value. More... | |
void | setValueOn (const Coord &xyz) |
Mark the voxel at the given coordinates as active but don't change its value. More... | |
void | setValueOff (const Coord &xyz) |
Mark the voxel at the given coordinates as inactive but don't change its value. More... | |
template<typename NodeT > | |
NodeT * | getNode () |
Return the cached node of type NodeType. [Mainly for internal use]. More... | |
template<typename NodeT > | |
void | insertNode (const Coord &xyz, NodeT &node) |
template<typename NodeT > | |
void | eraseNode () |
void | addLeaf (LeafNodeT *leaf) |
Add the specified leaf to this tree, possibly creating a child branch in the process. If the leaf node already exists, replace it. More... | |
void | addTile (Index level, const Coord &xyz, const ValueType &value, bool state) |
Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process. More... | |
LeafNodeT * | touchLeaf (const Coord &xyz) |
template<typename NodeT > | |
NodeT * | probeNode (const Coord &xyz) |
LeafNodeT * | probeLeaf (const Coord &xyz) |
template<typename NodeT > | |
const NodeT * | probeConstNode (const Coord &xyz) const |
const LeafNodeT * | probeConstLeaf (const Coord &xyz) const |
const LeafNodeT * | probeLeaf (const Coord &xyz) const |
void | clear () override |
Remove all the cached nodes and invalidate the corresponding hash-keys. More... | |
_TreeType * | getTree () const |
Return a pointer to the tree associated with this accessor. More... | |
_TreeType & | tree () const |
Return a reference to the tree associated with this accessor. More... | |
void | setValue (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates and mark the voxel as active. More... | |
void | setValueOn (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates and mark the voxel as active. More... | |
Static Public Member Functions | |
static Index | numCacheLevels () |
Return the number of cache levels employed by this ValueAccessor. More... | |
static bool | isSafe () |
Return true if this accessor is safe, i.e. registered by the tree from which it is constructed. Un-registered accessors can in rare cases be faster because it avoids the (small) overhead of registration, but they are unsafe if the tree is modified. So unless you're an expert it is highly recommended to set IsSafe = true (which is the default). More... | |
Static Public Attributes | |
static const bool | IsConstTree |
Protected Attributes | |
_TreeType * | mTree |
Friends | |
template<typename > | |
class | RootNode |
template<typename , Index > | |
class | InternalNode |
template<typename , Index > | |
class | LeafNode |
template<typename > | |
class | Tree |
Value accessor with one level of node caching.
The node cache level is specified by L0 with the default value 0 (defined in the forward declaration) corresponding to a LeafNode.
using BaseT = ValueAccessorBase<TreeType, IsSafe> |
using InvTreeT = typename RootNodeT::NodeChainType |
using LeafNodeT = typename TreeType::LeafNodeType |
using NodeT0 = typename InvTreeT::template Get<L0> |
using RootNodeT = typename TreeType::RootNodeType |
using TreeType = _TreeType |
using ValueType = typename TreeType::ValueType |
|
inline |
Constructor from a tree.
|
inline |
Copy constructor.
|
overridedefault |
Virtual destructor.
|
inline |
Add the specified leaf to this tree, possibly creating a child branch in the process. If the leaf node already exists, replace it.
Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process.
|
inlineoverridevirtual |
Remove all the cached nodes and invalidate the corresponding hash-keys.
Implements ValueAccessorBase< _TreeType, IsSafe >.
|
inline |
If a node of the given type exists in the cache, remove it, so that isCached(xyz) returns false
for any voxel (x, y, z) contained in that node. [Mainly for internal use]
|
inline |
Return the cached node of type NodeType. [Mainly for internal use].
|
inlineinherited |
Return a pointer to the tree associated with this accessor.
The pointer will be null only if the tree from which this accessor was constructed was subsequently deleted (which generally leaves the accessor in an unsafe state).
|
inline |
Return the value of the voxel at the given coordinates.
|
inline |
Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides, or -1 if (x, y, z) isn't explicitly represented in the tree (i.e., if it is implicitly a background voxel).
|
inline |
Cache the given node, which should lie along the path from the root node to the node containing voxel (x, y, z). [Mainly for internal use]
|
inline |
Return true
if any of the nodes along the path to the given voxel have been cached.
|
inlinestaticinherited |
Return true if this accessor is safe, i.e. registered by the tree from which it is constructed. Un-registered accessors can in rare cases be faster because it avoids the (small) overhead of registration, but they are unsafe if the tree is modified. So unless you're an expert it is highly recommended to set IsSafe = true (which is the default).
|
inline |
Return the active state of the voxel at the given coordinates.
|
inline |
Return true
if the value of voxel (x, y, z) resides at the leaf level of the tree, i.e., if it is not a tile value.
|
inline |
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.
See Tree::modifyValue() for details.
|
inline |
Apply a functor to the voxel at the given coordinates.
See Tree::modifyValueAndActiveState() for details.
|
inlinestatic |
Return the number of cache levels employed by this ValueAccessor.
|
inline |
Assignment operator.
|
inline |
|
inline |
nullptr
.
|
inline |
|
inline |
|
inline |
nullptr
.
|
inline |
Return the active state of the voxel as well as its value.
|
inline |
Set the active state of the voxel at the given coordinates but don't change its value.
|
inline |
Set the value of the voxel at the given coordinates and mark the voxel as active.
|
inline |
Set the value of the voxel at the given coordinates and mark the voxel as inactive.
|
inline |
Mark the voxel at the given coordinates as inactive but don't change its value.
|
inline |
Set the value of the voxel at the given coordinates and mark the voxel as active.
|
inline |
Mark the voxel at the given coordinates as active but don't change its value.
|
inline |
Set the value of the voxel at the given coordinate but preserves its active state.
|
inline |
Use this method to preallocate a static tree topology over which to safely perform multithreaded processing.
|
inlineinherited |
Return a reference to the tree associated with this accessor.
|
friend |
|
friend |
|
friend |
|
friend |
|
staticinherited |
|
protectedinherited |