4 #ifndef OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED 5 #define OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED 7 #include <openvdb/version.h> 17 #include <type_traits> 29 template<Index Log2Dim>
41 static const Index LOG2DIM = Log2Dim;
42 static const Index TOTAL = Log2Dim;
43 static const Index DIM = 1 << TOTAL;
44 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
45 static const Index NUM_VOXELS = NUM_VALUES;
46 static const Index SIZE = NUM_VALUES;
51 template<
typename OtherValueType>
56 template<
typename OtherNodeType>
57 struct SameConfiguration {
68 explicit LeafNode(
const Coord& xyz,
bool value =
false,
bool dummy =
false);
77 template<
typename OtherValueType>
81 template<
typename ValueType>
87 template<
typename ValueType>
89 template<
typename ValueType>
130 bool isEmpty()
const {
return mBuffer.mData.isOff(); }
132 bool isDense()
const {
return mBuffer.mData.isOn(); }
149 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
156 void setOrigin(
const Coord& origin) { mOrigin = origin; }
159 const Coord&
origin()
const {
return mOrigin; }
160 void getOrigin(Coord& origin)
const { origin = mOrigin; }
165 static Index coordToOffset(
const Coord& xyz);
168 static Coord offsetToLocalCoord(
Index n);
170 Coord offsetToGlobalCoord(
Index n)
const;
172 #if OPENVDB_ABI_VERSION_NUMBER >= 9 180 std::string str()
const;
184 template<
typename OtherType, Index OtherLog2Dim>
204 void readTopology(std::istream&,
bool fromHalf =
false);
206 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
209 void readBuffers(std::istream&,
bool fromHalf =
false);
210 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
212 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
218 const bool& getValue(
const Coord& xyz)
const;
220 const bool& getValue(
Index offset)
const;
225 bool probeValue(
const Coord& xyz,
bool& val)
const;
231 void setActiveState(
const Coord& xyz,
bool on);
236 void setValueOnly(
const Coord& xyz,
bool val);
238 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
241 void setValueOff(
const Coord& xyz) { mBuffer.mData.setOff(this->coordToOffset(xyz)); }
246 void setValueOff(
const Coord& xyz,
bool val);
248 void setValueOff(
Index offset,
bool val);
251 void setValueOn(
const Coord& xyz) { mBuffer.mData.setOn(this->coordToOffset(xyz)); }
256 void setValueOn(
const Coord& xyz,
bool val);
258 void setValue(
const Coord& xyz,
bool val) { this->setValueOn(xyz, val); }
260 void setValueOn(
Index offset,
bool val);
264 template<
typename ModifyOp>
265 void modifyValue(
Index offset,
const ModifyOp& op);
268 template<
typename ModifyOp>
269 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
272 template<
typename ModifyOp>
273 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
281 bool isValueOn(
const Coord& xyz)
const {
return mBuffer.mData.isOn(this->coordToOffset(xyz)); }
283 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mBuffer.mData.isOn(offset); }
297 void fill(
const bool& value,
bool dummy =
false);
310 template<
typename DenseT>
329 template<
typename DenseT>
334 template<
typename AccessorT>
335 const bool&
getValueAndCache(
const Coord& xyz, AccessorT&)
const {
return this->getValue(xyz);}
339 template<
typename AccessorT>
344 template<
typename AccessorT>
345 void setValueAndCache(
const Coord& xyz,
bool val, AccessorT&) { this->setValueOn(xyz, val); }
350 template<
typename AccessorT>
355 template<
typename AccessorT>
358 this->setValueOff(xyz, value);
364 template<
typename ModifyOp,
typename AccessorT>
367 this->modifyValue(xyz, op);
372 template<
typename ModifyOp,
typename AccessorT>
375 this->modifyValueAndActiveState(xyz, op);
381 template<
typename AccessorT>
384 this->setActiveState(xyz, on);
390 template<
typename AccessorT>
393 return this->probeValue(xyz, val);
398 template<
typename AccessorT>
404 const bool&
getFirstValue()
const {
if (mBuffer.mData.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
408 const bool&
getLastValue()
const {
if (mBuffer.mData.isOn(SIZE-1))
return Buffer::sOn;
else return Buffer::sOff; }
413 bool isConstant(
bool& constValue,
bool& state,
bool tolerance = 0)
const;
420 bool medianAll()
const;
449 void negate() { mBuffer.mData.toggle(); }
451 template<MergePolicy Policy>
452 void merge(
const LeafNode& other,
bool bg =
false,
bool otherBG =
false);
453 template<MergePolicy Policy>
void merge(
bool tileValue,
bool tileActive=
false);
465 template<
typename OtherType>
479 template<
typename OtherType>
493 template<
typename OtherType>
496 template<
typename CombineOp>
498 template<
typename CombineOp>
499 void combine(
bool,
bool valueIsActive, CombineOp& op);
501 template<
typename CombineOp,
typename OtherType >
502 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
503 template<
typename CombineOp,
typename OtherNodeT >
504 void combine2(
bool,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
505 template<
typename CombineOp,
typename OtherNodeT >
506 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
512 template<
typename BBoxOp>
void visitActiveBBox(BBoxOp&)
const;
514 template<
typename VisitorOp>
void visit(VisitorOp&);
515 template<
typename VisitorOp>
void visit(VisitorOp&)
const;
517 template<
typename OtherLeafNodeType,
typename VisitorOp>
518 void visit2Node(OtherLeafNodeType& other, VisitorOp&);
519 template<
typename OtherLeafNodeType,
typename VisitorOp>
520 void visit2Node(OtherLeafNodeType& other, VisitorOp&)
const;
521 template<
typename IterT,
typename VisitorOp>
522 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false);
523 template<
typename IterT,
typename VisitorOp>
524 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false)
const;
530 template<
typename AccessorT>
532 template<
typename NodeT>
534 template<
typename NodeT>
536 template<
typename NodeT>
538 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
542 void addTile(
Index level,
const Coord&,
bool val,
bool active);
543 void addTile(
Index offset,
bool val,
bool active);
544 template<
typename AccessorT>
545 void addTileAndCache(
Index level,
const Coord&,
bool val,
bool active, AccessorT&);
550 template<
typename AccessorT>
553 template<
typename AccessorT>
555 template<
typename NodeT,
typename AccessorT>
560 return reinterpret_cast<NodeT*
>(
this);
567 template<
typename AccessorT>
570 template<
typename AccessorT>
572 template<
typename NodeT,
typename AccessorT>
577 return reinterpret_cast<const NodeT*
>(
this);
590 template<
typename MaskIterT,
typename NodeT,
typename ValueT>
594 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
601 const bool&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
602 const bool&
getValue()
const {
return this->getItem(this->pos()); }
605 void setItem(
Index pos,
bool value)
const { this->parent().setValueOnly(pos, value); }
607 void setValue(
bool value)
const { this->setItem(this->pos(), value); }
610 template<
typename ModifyOp>
611 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
613 template<
typename ModifyOp>
614 void modifyValue(
const ModifyOp& op)
const { this->modifyItem(this->pos(), op); }
618 template<
typename MaskIterT,
typename NodeT>
624 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
627 template<
typename NodeT,
typename ValueT>
629 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
639 value = this->parent().getValue(pos);
648 void unsetItem(
Index pos,
const ValueT& val)
const {this->parent().setValueOnly(pos, val);}
653 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
729 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
730 static inline void doVisit(NodeT&, VisitorOp&);
732 template<
typename NodeT,
typename OtherNodeT,
typename VisitorOp,
733 typename ChildAllIterT,
typename OtherChildAllIterT>
734 static inline void doVisit2Node(NodeT&
self, OtherNodeT& other, VisitorOp&);
736 template<
typename NodeT,
typename VisitorOp,
737 typename ChildAllIterT,
typename OtherChildAllIterT>
738 static inline void doVisit2(NodeT&
self, OtherChildAllIterT&, VisitorOp&,
bool otherIsLHS);
744 #if OPENVDB_ABI_VERSION_NUMBER >= 9 777 template<Index Log2Dim>
784 template<Index Log2Dim>
787 : mBuffer(value || active)
788 , mOrigin(xyz & (~(DIM - 1)))
793 template<Index Log2Dim>
796 : mBuffer(value || active)
797 , mOrigin(xyz & (~(DIM - 1)))
802 template<Index Log2Dim>
805 : mBuffer(other.mBuffer)
806 , mOrigin(other.mOrigin)
807 #if OPENVDB_ABI_VERSION_NUMBER >= 9
808 , mTransientData(other.mTransientData)
815 template<Index Log2Dim>
816 template<
typename ValueT>
821 #if OPENVDB_ABI_VERSION_NUMBER >= 9
822 , mTransientData(other.mTransientData)
828 template<Index Log2Dim>
829 template<
typename ValueT>
835 #if OPENVDB_ABI_VERSION_NUMBER >= 9
836 , mTransientData(other.mTransientData)
842 template<Index Log2Dim>
843 template<
typename ValueT>
848 #if OPENVDB_ABI_VERSION_NUMBER >= 9
849 , mTransientData(other.mTransientData)
855 template<Index Log2Dim>
856 template<
typename ValueT>
862 #if OPENVDB_ABI_VERSION_NUMBER >= 9
863 , mTransientData(other.mTransientData)
866 if (offValue==
true) {
867 if (onValue==
false) {
868 mBuffer.
mData.toggle();
870 mBuffer.
mData.setOn();
876 template<Index Log2Dim>
886 template<Index Log2Dim>
891 return sizeof(*this);
895 template<Index Log2Dim>
900 return sizeof(*this);
904 template<Index Log2Dim>
909 if (bbox.isInside(this_bbox))
return;
913 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
914 this_bbox.translate(this->
origin());
916 bbox.expand(this_bbox);
921 template<Index Log2Dim>
922 template<
typename OtherType, Index OtherLog2Dim>
931 template<Index Log2Dim>
935 std::ostringstream ostr;
936 ostr <<
"LeafNode @" << mOrigin <<
": ";
937 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mBuffer.
mData.isOn(n) ?
'#' :
'.');
945 template<Index Log2Dim>
949 assert ((xyz[0] & (DIM-1u)) < DIM && (xyz[1] & (DIM-1u)) < DIM && (xyz[2] & (DIM-1u)) < DIM);
950 return ((xyz[0] & (DIM-1u)) << 2*Log2Dim)
951 + ((xyz[1] & (DIM-1u)) << Log2Dim)
952 + (xyz[2] & (DIM-1u));
956 template<Index Log2Dim>
960 assert(n < (1 << 3*Log2Dim));
962 xyz.setX(n >> 2*Log2Dim);
963 n &= ((1 << 2*Log2Dim) - 1);
964 xyz.setY(n >> Log2Dim);
965 xyz.setZ(n & ((1 << Log2Dim) - 1));
970 template<Index Log2Dim>
981 template<Index Log2Dim>
985 mBuffer.
mData.load(is);
989 template<Index Log2Dim>
993 mBuffer.
mData.save(os);
997 template<Index Log2Dim>
1007 bool background =
false;
1009 background = *
static_cast<const bool*
>(bgPtr);
1011 this->
clip(clipBBox, background);
1015 template<Index Log2Dim>
1020 mBuffer.
mData.load(is);
1022 is.read(reinterpret_cast<char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1026 template<Index Log2Dim>
1031 mBuffer.
mData.save(os);
1033 os.write(reinterpret_cast<const char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1040 template<Index Log2Dim>
1044 return mOrigin == other.mOrigin && mBuffer == other.mBuffer;
1048 template<Index Log2Dim>
1059 template<Index Log2Dim>
1063 if (!mBuffer.
mData.isConstant(state))
return false;
1072 template<Index Log2Dim>
1076 const Index countTrue = mBuffer.
mData.countOn();
1077 return countTrue > (NUM_VALUES >> 1);
1080 template<Index Log2Dim>
1084 const Index countTrueOn = mBuffer.
mData.countOn();
1089 template<Index Log2Dim>
1093 const Index countFalseOff = mBuffer.
mData.countOff();
1095 return countFalseOff;
1102 template<Index Log2Dim>
1109 template<Index Log2Dim>
1113 assert(offset < SIZE);
1118 template<Index Log2Dim>
1119 template<
typename AccessorT>
1122 bool val,
bool active, AccessorT&)
1124 this->
addTile(level, xyz, val, active);
1131 template<Index Log2Dim>
1136 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1140 template<Index Log2Dim>
1144 assert(offset < SIZE);
1146 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1150 template<Index Log2Dim>
1155 val = mBuffer.
mData.isOn(offset);
1160 template<Index Log2Dim>
1168 template<Index Log2Dim>
1172 assert(offset < SIZE);
1173 mBuffer.
mData.set(offset, val);
1177 template<Index Log2Dim>
1185 template<Index Log2Dim>
1193 template<Index Log2Dim>
1201 template<Index Log2Dim>
1205 assert(offset < SIZE);
1206 mBuffer.
mData.set(offset, val);
1210 template<Index Log2Dim>
1211 template<
typename ModifyOp>
1215 bool val = mBuffer.
mData.isOn(offset);
1217 mBuffer.
mData.set(offset, val);
1221 template<Index Log2Dim>
1222 template<
typename ModifyOp>
1230 template<Index Log2Dim>
1231 template<
typename ModifyOp>
1236 bool val = mBuffer.
mData.isOn(offset), state = val;
1238 mBuffer.
mData.set(offset, val);
1245 template<Index Log2Dim>
1246 template<MergePolicy Policy>
1256 template<Index Log2Dim>
1257 template<MergePolicy Policy>
1263 if (tileValue) mBuffer.
mData.setOn();
1271 template<Index Log2Dim>
1272 template<
typename OtherType>
1280 template<Index Log2Dim>
1281 template<
typename OtherType>
1290 template<Index Log2Dim>
1291 template<
typename OtherType>
1303 template<Index Log2Dim>
1308 if (!clipBBox.hasOverlap(nodeBBox)) {
1310 this->
fill(nodeBBox, background,
false);
1311 }
else if (clipBBox.isInside(nodeBBox)) {
1321 nodeBBox.intersect(clipBBox);
1323 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1324 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1325 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1326 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1343 template<Index Log2Dim>
1348 clippedBBox.intersect(bbox);
1349 if (!clippedBBox)
return;
1351 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1352 const Index offsetX = (x & (DIM-1u))<<2*Log2Dim;
1353 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1354 const Index offsetXY = offsetX + ((y & (DIM-1u))<< Log2Dim);
1355 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1356 const Index offset = offsetXY + (z & (DIM-1u));
1357 mBuffer.
mData.set(offset, value);
1363 template<Index Log2Dim>
1367 mBuffer.
fill(value);
1374 template<Index Log2Dim>
1375 template<
typename DenseT>
1379 using DenseValueType =
typename DenseT::ValueType;
1381 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1382 const Coord&
min = dense.bbox().min();
1383 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1384 const Int32 n0 = bbox.min()[2] & (DIM-1u);
1385 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1386 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1388 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1389 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1391 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1392 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1399 template<Index Log2Dim>
1400 template<
typename DenseT>
1403 bool background,
bool tolerance)
1405 using DenseValueType =
typename DenseT::ValueType;
1407 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1410 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1411 const Coord&
min = dense.bbox().min();
1412 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1413 const Int32 n0 = bbox.min()[2] & (DIM-1u);
1414 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1415 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1417 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1418 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1420 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1422 if (tolerance || (background == Local::toBool(*s2))) {
1423 mBuffer.mData.set(n2, background);
1425 mBuffer.mData.set(n2, Local::toBool(*s2));
1436 template<Index Log2Dim>
1437 template<
typename CombineOp>
1443 bool result =
false, aVal = mBuffer.mData.isOn(i), bVal = other.mBuffer.
mData.isOn(i);
1448 .setResultRef(result));
1449 mBuffer.mData.set(i, result);
1454 template<Index Log2Dim>
1455 template<
typename CombineOp>
1460 args.
setBRef(value).setBIsActive(valueIsActive);
1462 bool result =
false, aVal = mBuffer.mData.isOn(i);
1465 .setResultRef(result));
1466 mBuffer.mData.set(i, result);
1474 template<Index Log2Dim>
1475 template<
typename CombineOp,
typename OtherType>
1478 bool valueIsActive, CombineOp& op)
1481 args.
setBRef(value).setBIsActive(valueIsActive);
1483 bool result =
false, aVal = other.mBuffer.
mData.isOn(i);
1486 .setResultRef(result));
1487 mBuffer.mData.set(i, result);
1492 template<Index Log2Dim>
1493 template<
typename CombineOp,
typename OtherNodeT>
1496 bool valueIsActive, CombineOp& op)
1499 args.
setARef(value).setAIsActive(valueIsActive);
1501 bool result =
false, bVal = other.mBuffer.mData.isOn(i);
1504 .setResultRef(result));
1505 mBuffer.mData.set(i, result);
1510 template<Index Log2Dim>
1511 template<
typename CombineOp,
typename OtherNodeT>
1517 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1519 .setAIsActive(b0Val)
1521 .setBIsActive(b1Val)
1522 .setResultRef(result));
1523 mBuffer.mData.set(i, result);
1530 template<Index Log2Dim>
1531 template<
typename BBoxOp>
1535 if (op.template descent<LEVEL>()) {
1537 op.template operator()<LEVEL>(CoordBBox::createCube(i.getCoord(), 1));
1545 template<Index Log2Dim>
1546 template<
typename VisitorOp>
1550 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1554 template<Index Log2Dim>
1555 template<
typename VisitorOp>
1559 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1563 template<Index Log2Dim>
1564 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1568 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1577 template<Index Log2Dim>
1578 template<
typename OtherLeafNodeType,
typename VisitorOp>
1583 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1587 template<Index Log2Dim>
1588 template<
typename OtherLeafNodeType,
typename VisitorOp>
1593 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1597 template<Index Log2Dim>
1600 typename OtherNodeT,
1602 typename ChildAllIterT,
1603 typename OtherChildAllIterT>
1608 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1609 "can't visit nodes of different sizes simultaneously");
1610 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1611 "can't visit nodes at different tree levels simultaneously");
1613 ChildAllIterT iter =
self.beginChildAll();
1614 OtherChildAllIterT otherIter = other.beginChildAll();
1616 for ( ; iter && otherIter; ++iter, ++otherIter) {
1617 op(iter, otherIter);
1625 template<Index Log2Dim>
1626 template<
typename IterT,
typename VisitorOp>
1630 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1634 template<Index Log2Dim>
1635 template<
typename IterT,
typename VisitorOp>
1639 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1643 template<Index Log2Dim>
1647 typename ChildAllIterT,
1648 typename OtherChildAllIterT>
1651 VisitorOp& op,
bool otherIsLHS)
1653 if (!otherIter)
return;
1656 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1657 op(otherIter, iter);
1660 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1661 op(iter, otherIter);
1670 #endif // OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:159
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
Buffer mBuffer
Bitmask representing the values AND state of voxels.
Definition: LeafNodeMask.h:741
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:571
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeMask.h:655
ValueAllCIter cendValueAll() const
Definition: LeafNodeMask.h:681
static Index32 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition: LeafNodeMask.h:118
const bool & getItem(Index pos) const
Definition: LeafNodeMask.h:601
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:419
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeMask.h:399
Buffer & buffer()
Definition: LeafNodeMask.h:198
ChildT * child
Definition: GridBuilder.h:1286
ChildOffCIter cendChildOff() const
Definition: LeafNodeMask.h:700
void modifyValue(Index offset, const ModifyOp &op)
Apply a functor to the value of the voxel at the given offset and mark the voxel as active...
Definition: LeafNode.h:437
ValueOnCIter cendValueOn() const
Definition: LeafNodeMask.h:675
Index32 Index
Definition: Types.h:54
void setValue(bool value) const
Definition: LeafNodeMask.h:607
bool ValueType
Definition: LeafNodeMask.h:35
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeMask.h:657
void setValueAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as active.
Definition: LeafNodeMask.h:345
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:173
void setValueMask(Index n, bool on)
Definition: LeafNodeMask.h:722
ValueOnIter beginValueOn()
Definition: LeafNodeMask.h:667
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeMask.h:652
static Index32 leafCount()
Return the leaf count for this node, which is one.
Definition: LeafNodeMask.h:114
bool isChildMaskOff(Index) const
Definition: LeafNodeMask.h:719
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:569
ChildAllCIter cendChildAll() const
Definition: LeafNodeMask.h:703
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:337
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeMask.h:241
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeMask.h:276
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:568
void topologyIntersection(const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
Intersect this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if both of the original voxels were active.
Definition: LeafNode.h:1723
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeMask.h:611
const Buffer & buffer() const
Definition: LeafNodeMask.h:197
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1039
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:37
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNode.h:167
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:535
void negate()
Invert the bits of the voxels, i.e. states and values.
Definition: LeafNodeMask.h:449
void setValue(const Coord &xyz, bool val)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNodeMask.h:258
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition: LeafNodeMask.h:112
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:584
ValueAllCIter endValueAll() const
Definition: LeafNodeMask.h:682
OPENVDB_API const void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeMask.h:662
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1796
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNodeMask.h:106
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeMask.h:38
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition: LeafNodeMask.h:108
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeMask.h:637
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1904
ValueOffIter beginValueOff()
Definition: LeafNodeMask.h:670
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeMask.h:693
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeMask.h:286
ChildAllCIter endChildAll() const
Definition: LeafNodeMask.h:704
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeMask.h:654
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1438
Definition: NodeMasks.h:239
const NodeMaskType & valueMask() const
Definition: LeafNodeMask.h:715
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:531
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeMask.h:614
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1485
bool isChildMaskOff() const
Definition: LeafNodeMask.h:720
Index64 memUsageIfLoaded() const
Definition: LeafNode.h:1475
void setTransientData(Index32 transientData)
Set the transient data value.
Definition: LeafNodeMask.h:176
ChildOnCIter cendChildOn() const
Definition: LeafNodeMask.h:697
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1756
void setValueOnly(Index offset, bool val)
Set the value of the voxel at the given offset but don't change its active state. ...
Definition: LeafNodeMask.h:238
void modifyValueAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active...
Definition: LeafNodeMask.h:365
ChildOnIter beginChildOn()
Definition: LeafNodeMask.h:689
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1616
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeMask.h:281
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:529
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeMask.h:658
void resetBackground(bool, bool)
no-op since for this template specialization voxel values and states are indistinguishable.
Definition: LeafNodeMask.h:446
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeMask.h:687
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:477
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:556
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeMask.h:717
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:161
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeMask.h:132
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeMask.h:586
const bool & getValue() const
Definition: LeafNodeMask.h:602
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1857
~LeafNode()
Destructor.
Definition: LeafNode.h:1032
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeMask.h:123
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeMask.h:663
ValueOnIter endValueOn()
Definition: LeafNodeMask.h:677
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &)
Set the active state of the voxel at the given coordinates without changing its value.
Definition: LeafNodeMask.h:382
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1511
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:528
int32_t Int32
Definition: Types.h:56
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:226
static Index64 offTileCount()
Definition: LeafNodeMask.h:127
void nodeCount(std::vector< Index32 > &) const
no-op
Definition: LeafNodeMask.h:116
bool probeValueAndCache(const Coord &xyz, bool &val, AccessorT &) const
Return true if the voxel at the given coordinates is active and return the voxel value in val...
Definition: LeafNodeMask.h:391
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:650
static Index64 onTileCount()
Definition: LeafNodeMask.h:126
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeMask.h:228
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:551
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeMask.h:404
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:573
BBox< Coord > CoordBBox
Definition: NanoVDB.h:1658
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1633
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:156
void visit(VisitorOp &)
Definition: LeafNode.h:1872
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1318
ValueAllIter endValueAll()
Definition: LeafNodeMask.h:683
ValueAllIter beginValueAll()
Definition: LeafNodeMask.h:673
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeMask.h:661
uint32_t Index32
Definition: Types.h:52
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:160
LeafNode specialization for values of type ValueMask that encodes both the active states and the bool...
Definition: LeafNodeMask.h:30
ValueIter()
Definition: LeafNodeMask.h:598
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeMask.h:253
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1952
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:529
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1455
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeMask.h:635
ValueOnCIter beginValueOn() const
Definition: LeafNodeMask.h:666
bool isValueMaskOff() const
Definition: LeafNodeMask.h:713
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1076
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:537
ValueOffCIter cendValueOff() const
Definition: LeafNodeMask.h:678
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:296
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeMask.h:549
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeMask.h:690
ChildOnIter endChildOn()
Definition: LeafNodeMask.h:699
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeMask.h:648
bool isChildMaskOn(Index) const
Definition: LeafNodeMask.h:718
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeMask.h:442
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNodeMask.h:153
const NodeMaskType & valueMask() const
Definition: LeafNode.h:877
static const Index SIZE
Definition: LeafNode.h:53
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:328
Definition: Exceptions.h:13
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeMask.h:283
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:458
ChildOffIter endChildOff()
Definition: LeafNodeMask.h:702
void fill(const CoordBBox &bbox, const ValueType &, bool active=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition: LeafNode.h:1203
bool isValueMaskOn() const
Definition: LeafNodeMask.h:711
const NodeMaskType & getValueMask() const
Definition: LeafNodeMask.h:714
ChildOffCIter endChildOff() const
Definition: LeafNodeMask.h:701
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeMask.h:599
ValueT value
Definition: GridBuilder.h:1287
OffIterator beginOff() const
Definition: NodeMasks.h:354
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeMask.h:278
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeMask.h:140
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeMask.h:668
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1547
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:533
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeMask.h:102
ChildOnCIter beginChildOn() const
Definition: LeafNodeMask.h:688
void merge(const LeafNode &)
Definition: LeafNode.h:1666
bool isValueMaskOff(Index n) const
Definition: LeafNodeMask.h:712
Definition: NodeMasks.h:270
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1310
void copyFromDense(const CoordBBox &bbox, const DenseT &dense, const ValueType &background, const ValueType &tolerance)
Copy from a dense grid into this node the values of the voxels that lie within a given bounding box...
Definition: LeafNode.h:1273
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeMask.h:130
DenseIter()
Definition: LeafNodeMask.h:634
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeMask.h:656
ChildAllCIter beginChildAll() const
Definition: LeafNodeMask.h:694
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeMask.h:659
NodeMaskType & getValueMask()
Definition: LeafNodeMask.h:716
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeMask.h:632
void topologyDifference(const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
Difference this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this LeafNode and inactive in the other LeafNode.
Definition: LeafNode.h:1732
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1890
ChildOffCIter beginChildOff() const
Definition: LeafNodeMask.h:691
void setActiveState(const Coord &xyz, bool on)
Set the active state of the voxel at the given coordinates but don't change its value.
Definition: LeafNode.h:1137
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1163
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeMask.h:653
bool hasSameTopology(const LeafNode< OtherType, OtherLog2Dim > *other) const
Return true if the given node (which may have a different ValueType than this node) has the same acti...
Definition: LeafNode.h:1503
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:178
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:582
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeMask.h:340
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeMask.h:457
ValueType * mData
Definition: LeafBuffer.h:126
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1103
void setItem(Index pos, bool value) const
Definition: LeafNodeMask.h:605
void setValueOffAndCache(const Coord &xyz, bool value, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as inactive.
Definition: LeafNodeMask.h:356
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeMask.h:660
void denseFill(const CoordBBox &bbox, bool value, bool=false)
Set all voxels within an axis-aligned box to the specified value.
Definition: LeafNodeMask.h:294
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1465
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1346
ValueOnCIter cbeginValueOn() const
Definition: LeafNodeMask.h:665
ChildIter()
Definition: LeafNodeMask.h:622
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNodeMask.h:104
ValueOffIter endValueOff()
Definition: LeafNodeMask.h:680
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1929
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:114
LeafNode()
Default constructor.
Definition: LeafNode.h:936
void swap(Buffer &other)
Exchange this node's data buffer with the given data buffer without changing the active states of the...
Definition: LeafNodeMask.h:196
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeMask.h:243
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeMask.h:121
void topologyUnion(const LeafNode< OtherType, Log2Dim > &other, const bool preserveTiles=false)
Union this node's set of active values with the active values of the other node, whose ValueType may ...
Definition: LeafNode.h:1715
Index32 transientData() const
Return the transient data value.
Definition: LeafNodeMask.h:174
void setValueOnly(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition: LeafNode.h:1145
void setValueMaskOn(Index n)
Definition: LeafNodeMask.h:723
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:554
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeMask.h:588
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1565
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeMask.h:251
ChildOffIter beginChildOff()
Definition: LeafNodeMask.h:692
void setValueOnlyAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates but preserve its state.
Definition: LeafNodeMask.h:351
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeMask.h:743
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
ChildOnCIter endChildOn() const
Definition: LeafNodeMask.h:698
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeMask.h:671
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1589
LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeMask.h:552
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1052
void copyToDense(const CoordBBox &bbox, DenseT &dense) const
Copy into a dense grid the values of the voxels that lie within a given bounding box.
Definition: LeafNode.h:1246
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:538
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeMask.h:587
ChildAllIter beginChildAll()
Definition: LeafNodeMask.h:695
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeMask.h:623
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeMask.h:335
ValueAllCIter beginValueAll() const
Definition: LeafNodeMask.h:672
void setValueMaskOff(Index n)
Definition: LeafNodeMask.h:724
Definition: NodeMasks.h:208
Definition: PointDataGrid.h:170
ValueOffCIter endValueOff() const
Definition: LeafNodeMask.h:679
ValueOnCIter endValueOn() const
Definition: LeafNodeMask.h:676
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:539
void setActiveState(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value. ...
Definition: LeafNodeMask.h:233
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:297
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeMask.h:373
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNodeMask.h:136
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeMask.h:727
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:875
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeMask.h:408
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1976
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:203
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:644
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeMask.h:100
bool isValueMaskOn(Index n) const
Definition: LeafNodeMask.h:710
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition: AttributeTransferUtil.h:141
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:409
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition: LeafNodeMask.h:110
Index64 offLeafVoxelCount() const
Definition: LeafNodeMask.h:125
uint64_t Index64
Definition: Types.h:53
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:29
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:485
ValueOffCIter beginValueOff() const
Definition: LeafNodeMask.h:669
static const Index LOG2DIM
Definition: LeafNode.h:48
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:299
Index64 onLeafVoxelCount() const
Definition: LeafNodeMask.h:124
const LeafNode * probeLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:566
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1087
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202
ChildAllIter endChildAll()
Definition: LeafNodeMask.h:705
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1062