4 #ifndef OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED 5 #define OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED 16 #include <type_traits> 27 template<Index Log2Dim>
39 static const Index LOG2DIM = Log2Dim;
40 static const Index TOTAL = Log2Dim;
41 static const Index DIM = 1 << TOTAL;
42 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
43 static const Index NUM_VOXELS = NUM_VALUES;
44 static const Index SIZE = NUM_VALUES;
49 template<
typename ValueType>
54 template<
typename OtherNodeType>
55 struct SameConfiguration {
67 explicit LeafNode(
const Coord& xyz,
bool value =
false,
bool active =
false);
79 template<
typename OtherValueType>
83 template<
typename ValueType>
89 template<
typename ValueType>
91 template<
typename ValueType>
126 bool isEmpty()
const {
return mValueMask.isOff(); }
128 bool isDense()
const {
return mValueMask.isOn(); }
144 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
151 void setOrigin(
const Coord& origin) { mOrigin = origin; }
154 const Coord&
origin()
const {
return mOrigin; }
155 void getOrigin(Coord& origin)
const { origin = mOrigin; }
160 static Index coordToOffset(
const Coord& xyz);
163 static Coord offsetToLocalCoord(
Index n);
165 Coord offsetToGlobalCoord(
Index n)
const;
167 #if OPENVDB_ABI_VERSION_NUMBER >= 9 175 std::string str()
const;
179 template<
typename OtherType, Index OtherLog2Dim>
199 void readTopology(std::istream&,
bool fromHalf =
false);
201 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
204 void readBuffers(std::istream&,
bool fromHalf =
false);
205 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
207 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
213 const bool& getValue(
const Coord& xyz)
const;
215 const bool& getValue(
Index offset)
const;
220 bool probeValue(
const Coord& xyz,
bool& val)
const;
226 void setActiveState(
const Coord& xyz,
bool on);
231 void setValueOnly(
const Coord& xyz,
bool val);
233 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
236 void setValueOff(
const Coord& xyz) { mValueMask.setOff(this->coordToOffset(xyz)); }
241 void setValueOff(
const Coord& xyz,
bool val);
243 void setValueOff(
Index offset,
bool val);
246 void setValueOn(
const Coord& xyz) { mValueMask.setOn(this->coordToOffset(xyz)); }
251 void setValueOn(
const Coord& xyz,
bool val);
253 void setValue(
const Coord& xyz,
bool val) { this->setValueOn(xyz, val); }
255 void setValueOn(
Index offset,
bool val);
259 template<
typename ModifyOp>
260 void modifyValue(
Index offset,
const ModifyOp& op);
263 template<
typename ModifyOp>
264 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
267 template<
typename ModifyOp>
268 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
276 bool isValueOn(
const Coord& xyz)
const {
return mValueMask.isOn(this->coordToOffset(xyz)); }
278 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mValueMask.isOn(offset); }
292 void fill(
const bool& value);
294 void fill(
const bool& value,
bool active);
307 template<
typename DenseT>
326 template<
typename DenseT>
331 template<
typename AccessorT>
332 const bool&
getValueAndCache(
const Coord& xyz, AccessorT&)
const {
return this->getValue(xyz);}
336 template<
typename AccessorT>
341 template<
typename AccessorT>
342 void setValueAndCache(
const Coord& xyz,
bool val, AccessorT&) { this->setValueOn(xyz, val); }
347 template<
typename AccessorT>
352 template<
typename AccessorT>
355 this->setValueOff(xyz, value);
361 template<
typename ModifyOp,
typename AccessorT>
364 this->modifyValue(xyz, op);
369 template<
typename ModifyOp,
typename AccessorT>
372 this->modifyValueAndActiveState(xyz, op);
378 template<
typename AccessorT>
381 this->setActiveState(xyz, on);
387 template<
typename AccessorT>
390 return this->probeValue(xyz, val);
395 template<
typename AccessorT>
401 const bool&
getFirstValue()
const {
if (mValueMask.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
405 const bool&
getLastValue()
const {
if (mValueMask.isOn(SIZE-1))
return Buffer::sOn;
else return Buffer::sOff; }
410 bool isConstant(
bool& constValue,
bool& state,
bool tolerance = 0)
const;
417 bool medianAll()
const;
438 void resetBackground(
bool oldBackground,
bool newBackground);
440 void negate() { mBuffer.mData.toggle(); }
442 template<MergePolicy Policy>
443 void merge(
const LeafNode& other,
bool bg =
false,
bool otherBG =
false);
444 template<MergePolicy Policy>
void merge(
bool tileValue,
bool tileActive);
456 template<
typename OtherType>
470 template<
typename OtherType>
484 template<
typename OtherType>
487 template<
typename CombineOp>
489 template<
typename CombineOp>
490 void combine(
bool,
bool valueIsActive, CombineOp& op);
492 template<
typename CombineOp,
typename OtherType >
493 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
494 template<
typename CombineOp,
typename OtherNodeT >
495 void combine2(
bool,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
496 template<
typename CombineOp,
typename OtherNodeT >
497 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
503 template<
typename BBoxOp>
void visitActiveBBox(BBoxOp&)
const;
505 template<
typename VisitorOp>
void visit(VisitorOp&);
506 template<
typename VisitorOp>
void visit(VisitorOp&)
const;
508 template<
typename OtherLeafNodeType,
typename VisitorOp>
509 void visit2Node(OtherLeafNodeType& other, VisitorOp&);
510 template<
typename OtherLeafNodeType,
typename VisitorOp>
511 void visit2Node(OtherLeafNodeType& other, VisitorOp&)
const;
512 template<
typename IterT,
typename VisitorOp>
513 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false);
514 template<
typename IterT,
typename VisitorOp>
515 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false)
const;
521 template<
typename AccessorT>
523 template<
typename NodeT>
525 template<
typename NodeT>
527 template<
typename NodeT>
529 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
533 void addTile(
Index level,
const Coord&,
bool val,
bool active);
534 void addTile(
Index offset,
bool val,
bool active);
535 template<
typename AccessorT>
536 void addTileAndCache(
Index level,
const Coord&,
bool val,
bool active, AccessorT&);
541 template<
typename AccessorT>
544 template<
typename AccessorT>
546 template<
typename NodeT,
typename AccessorT>
551 return reinterpret_cast<NodeT*
>(
this);
558 template<
typename AccessorT>
561 template<
typename AccessorT>
563 template<
typename NodeT,
typename AccessorT>
568 return reinterpret_cast<const NodeT*
>(
this);
581 template<
typename MaskIterT,
typename NodeT,
typename ValueT>
585 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
592 const bool&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
593 const bool&
getValue()
const {
return this->getItem(this->pos()); }
596 void setItem(
Index pos,
bool value)
const { this->parent().setValueOnly(pos, value); }
598 void setValue(
bool value)
const { this->setItem(this->pos(), value); }
601 template<
typename ModifyOp>
602 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
604 template<
typename ModifyOp>
605 void modifyValue(
const ModifyOp& op)
const { this->modifyItem(this->pos(), op); }
609 template<
typename MaskIterT,
typename NodeT>
615 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
618 template<
typename NodeT,
typename ValueT>
620 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
630 value = this->parent().getValue(pos);
639 void unsetItem(
Index pos,
const ValueT& val)
const {this->parent().setValueOnly(pos, val);}
644 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
720 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
721 static inline void doVisit(NodeT&, VisitorOp&);
723 template<
typename NodeT,
typename OtherNodeT,
typename VisitorOp,
724 typename ChildAllIterT,
typename OtherChildAllIterT>
725 static inline void doVisit2Node(NodeT&
self, OtherNodeT& other, VisitorOp&);
727 template<
typename NodeT,
typename VisitorOp,
728 typename ChildAllIterT,
typename OtherChildAllIterT>
729 static inline void doVisit2(NodeT&
self, OtherChildAllIterT&, VisitorOp&,
bool otherIsLHS);
738 #if OPENVDB_ABI_VERSION_NUMBER >= 9 769 template<Index Log2Dim>
777 template<Index Log2Dim>
782 , mOrigin(xyz & (~(DIM - 1)))
787 template<Index Log2Dim>
792 , mOrigin(xyz & (~(DIM - 1)))
800 template<Index Log2Dim>
804 , mBuffer(other.mBuffer)
805 , mOrigin(other.mOrigin)
806 #if OPENVDB_ABI_VERSION_NUMBER >= 9
807 , mTransientData(other.mTransientData)
814 template<Index Log2Dim>
815 template<
typename ValueT>
820 #if OPENVDB_ABI_VERSION_NUMBER >= 9
821 , mTransientData(other.mTransientData)
826 static inline bool convertValue(
const ValueT& val) {
return bool(val); }
830 mBuffer.setValue(i, Local::convertValue(other.mBuffer[i]));
835 template<Index Log2Dim>
836 template<
typename ValueT>
841 , mBuffer(background)
843 #if OPENVDB_ABI_VERSION_NUMBER >= 9
844 , mTransientData(other.mTransientData)
850 template<Index Log2Dim>
851 template<
typename ValueT>
857 #if OPENVDB_ABI_VERSION_NUMBER >= 9
858 , mTransientData(other.mTransientData)
864 template<Index Log2Dim>
865 template<
typename ValueT>
872 #if OPENVDB_ABI_VERSION_NUMBER >= 9
873 , mTransientData(other.mTransientData)
876 if (offValue) {
if (!onValue) mBuffer.
mData.toggle();
else mBuffer.
mData.setOn(); }
880 template<Index Log2Dim>
890 template<Index Log2Dim>
895 return sizeof(*this);
899 template<Index Log2Dim>
904 if (bbox.isInside(this_bbox))
return;
908 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
909 this_bbox.translate(this->
origin());
911 bbox.expand(this_bbox);
916 template<Index Log2Dim>
917 template<
typename OtherType, Index OtherLog2Dim>
922 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
926 template<Index Log2Dim>
930 std::ostringstream ostr;
931 ostr <<
"LeafNode @" << mOrigin <<
": ";
932 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mValueMask.
isOn(n) ?
'#' :
'.');
940 template<Index Log2Dim>
944 assert ((xyz[0] & (DIM-1u)) < DIM && (xyz[1] & (DIM-1u)) < DIM && (xyz[2] & (DIM-1u)) < DIM);
945 return ((xyz[0] & (DIM-1u)) << 2*Log2Dim)
946 + ((xyz[1] & (DIM-1u)) << Log2Dim)
947 + (xyz[2] & (DIM-1u));
951 template<Index Log2Dim>
955 assert(n < (1 << 3*Log2Dim));
957 xyz.setX(n >> 2*Log2Dim);
958 n &= ((1 << 2*Log2Dim) - 1);
959 xyz.setY(n >> Log2Dim);
960 xyz.setZ(n & ((1 << Log2Dim) - 1));
965 template<Index Log2Dim>
976 template<Index Log2Dim>
984 template<Index Log2Dim>
992 template<Index Log2Dim>
1002 bool background =
false;
1004 background = *
static_cast<const bool*
>(bgPtr);
1006 this->
clip(clipBBox, background);
1010 template<Index Log2Dim>
1015 mValueMask.
load(is);
1017 is.read(reinterpret_cast<char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1021 mBuffer.
mData.load(is);
1026 int8_t numBuffers = 0;
1027 is.read(reinterpret_cast<char*>(&numBuffers),
sizeof(int8_t));
1031 std::unique_ptr<bool[]> buf{
new bool[
SIZE]};
1032 io::readData<bool>(is, buf.get(),
SIZE,
true);
1035 mBuffer.
mData.setOff();
1037 if (buf[i]) mBuffer.
mData.setOn(i);
1040 if (numBuffers > 1) {
1043 for (
int i = 1; i < numBuffers; ++i) {
1044 io::readData<bool>(is, buf.get(),
SIZE,
true);
1051 template<Index Log2Dim>
1056 mValueMask.
save(os);
1058 os.write(reinterpret_cast<const char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1060 mBuffer.
mData.save(os);
1067 template<Index Log2Dim>
1071 return mOrigin == other.mOrigin &&
1073 mBuffer == other.mBuffer;
1077 template<Index Log2Dim>
1088 template<Index Log2Dim>
1092 if (!mValueMask.
isConstant(state))
return false;
1095 if (!tolerance && !(mBuffer.
mData.isOn() || mBuffer.
mData.isOff()))
return false;
1097 constValue = mBuffer.
mData.isOn();
1103 template<Index Log2Dim>
1107 const Index countTrue = mBuffer.
mData.countOn();
1108 return countTrue > (NUM_VALUES >> 1);
1111 template<Index Log2Dim>
1117 state = countTrueOn > (NUM_VALUES >> 1);
1121 template<Index Log2Dim>
1127 state = countTrueOff > (NUM_VALUES >> 1);
1134 template<Index Log2Dim>
1141 template<Index Log2Dim>
1145 assert(offset < SIZE);
1150 template<Index Log2Dim>
1151 template<
typename AccessorT>
1154 bool val,
bool active, AccessorT&)
1156 this->
addTile(level, xyz, val, active);
1163 template<Index Log2Dim>
1168 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1172 template<Index Log2Dim>
1176 assert(offset < SIZE);
1178 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1182 template<Index Log2Dim>
1187 val = mBuffer.
mData.isOn(offset);
1188 return mValueMask.
isOn(offset);
1192 template<Index Log2Dim>
1200 template<Index Log2Dim>
1204 assert(offset < SIZE);
1205 mValueMask.
setOn(offset);
1206 mBuffer.
mData.set(offset, val);
1210 template<Index Log2Dim>
1218 template<Index Log2Dim>
1226 template<Index Log2Dim>
1234 template<Index Log2Dim>
1238 assert(offset < SIZE);
1239 mValueMask.
setOff(offset);
1240 mBuffer.
mData.set(offset, val);
1244 template<Index Log2Dim>
1245 template<
typename ModifyOp>
1249 bool val = mBuffer.
mData.isOn(offset);
1251 mBuffer.
mData.set(offset, val);
1252 mValueMask.
setOn(offset);
1256 template<Index Log2Dim>
1257 template<
typename ModifyOp>
1265 template<Index Log2Dim>
1266 template<
typename ModifyOp>
1271 bool val = mBuffer.
mData.isOn(offset), state = mValueMask.
isOn(offset);
1273 mBuffer.
mData.set(offset, val);
1274 mValueMask.
set(offset, state);
1281 template<Index Log2Dim>
1285 if (newBackground != oldBackground) {
1289 mBuffer.
mData = (mBuffer.
mData & mValueMask) | bgMask;
1297 template<Index Log2Dim>
1298 template<MergePolicy Policy>
1305 const Index n = iter.pos();
1306 if (mValueMask.
isOff(n)) {
1307 mBuffer.
mData.set(n, other.mBuffer.
mData.isOn(n));
1308 mValueMask.
setOn(n);
1314 template<Index Log2Dim>
1315 template<MergePolicy Policy>
1321 if (!tileActive)
return;
1323 if (tileValue) mBuffer.
mData |= !mValueMask;
1324 else mBuffer.
mData &= mValueMask;
1333 template<Index Log2Dim>
1334 template<
typename OtherType>
1342 template<Index Log2Dim>
1343 template<
typename OtherType>
1352 template<Index Log2Dim>
1353 template<
typename OtherType>
1365 template<Index Log2Dim>
1370 if (!clipBBox.hasOverlap(nodeBBox)) {
1372 this->
fill(nodeBBox, background,
false);
1373 }
else if (clipBBox.isInside(nodeBBox)) {
1383 nodeBBox.intersect(clipBBox);
1385 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1386 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1387 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1388 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1405 template<Index Log2Dim>
1410 clippedBBox.intersect(bbox);
1411 if (!clippedBBox)
return;
1413 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1414 const Index offsetX = (x & (DIM-1u))<<2*Log2Dim;
1415 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1416 const Index offsetXY = offsetX + ((y & (DIM-1u))<< Log2Dim);
1417 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1418 const Index offset = offsetXY + (z & (DIM-1u));
1419 mValueMask.
set(offset, active);
1420 mBuffer.
mData.set(offset, value);
1426 template<Index Log2Dim>
1430 mBuffer.
fill(value);
1433 template<Index Log2Dim>
1437 mBuffer.
fill(value);
1438 mValueMask.
set(active);
1445 template<Index Log2Dim>
1446 template<
typename DenseT>
1450 using DenseValueType =
typename DenseT::ValueType;
1452 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1453 const Coord&
min = dense.bbox().min();
1454 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1455 const Int32 n0 = bbox.min()[2] & (DIM-1u);
1456 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1457 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1459 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1460 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1462 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1463 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1470 template<Index Log2Dim>
1471 template<
typename DenseT>
1474 bool background,
bool tolerance)
1476 using DenseValueType =
typename DenseT::ValueType;
1478 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1481 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1482 const Coord&
min = dense.bbox().min();
1483 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1484 const Int32 n0 = bbox.min()[2] & (DIM-1u);
1485 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1486 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1488 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1489 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1491 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1493 if (tolerance || (background == Local::toBool(*s2))) {
1494 mValueMask.setOff(n2);
1495 mBuffer.mData.set(n2, background);
1497 mValueMask.setOn(n2);
1498 mBuffer.mData.set(n2, Local::toBool(*s2));
1509 template<Index Log2Dim>
1510 template<
typename CombineOp>
1516 bool result =
false, aVal = mBuffer.mData.isOn(i), bVal = other.mBuffer.
mData.isOn(i);
1518 .setAIsActive(mValueMask.isOn(i))
1521 .setResultRef(result));
1523 mBuffer.mData.set(i, result);
1528 template<Index Log2Dim>
1529 template<
typename CombineOp>
1534 args.
setBRef(value).setBIsActive(valueIsActive);
1536 bool result =
false, aVal = mBuffer.mData.isOn(i);
1538 .setAIsActive(mValueMask.isOn(i))
1539 .setResultRef(result));
1541 mBuffer.mData.set(i, result);
1549 template<Index Log2Dim>
1550 template<
typename CombineOp,
typename OtherType>
1553 bool valueIsActive, CombineOp& op)
1556 args.
setBRef(value).setBIsActive(valueIsActive);
1558 bool result =
false, aVal = other.mBuffer.
mData.isOn(i);
1561 .setResultRef(result));
1563 mBuffer.mData.set(i, result);
1568 template<Index Log2Dim>
1569 template<
typename CombineOp,
typename OtherNodeT>
1572 bool valueIsActive, CombineOp& op)
1575 args.
setARef(value).setAIsActive(valueIsActive);
1577 bool result =
false, bVal = other.mBuffer.mData.isOn(i);
1579 .setBIsActive(other.valueMask().isOn(i))
1580 .setResultRef(result));
1582 mBuffer.mData.set(i, result);
1587 template<Index Log2Dim>
1588 template<
typename CombineOp,
typename OtherNodeT>
1595 mValueMask.set(i, b0.
valueMask().
isOn(i) || b1.valueMask().isOn(i));
1597 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1601 .setBIsActive(b1.valueMask().isOn(i))
1602 .setResultRef(result));
1604 mBuffer.mData.set(i, result);
1611 template<Index Log2Dim>
1612 template<
typename BBoxOp>
1616 if (op.template descent<LEVEL>()) {
1618 op.template operator()<LEVEL>(CoordBBox::createCube(i.getCoord(), 1));
1626 template<Index Log2Dim>
1627 template<
typename VisitorOp>
1631 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1635 template<Index Log2Dim>
1636 template<
typename VisitorOp>
1640 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1644 template<Index Log2Dim>
1645 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1649 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1658 template<Index Log2Dim>
1659 template<
typename OtherLeafNodeType,
typename VisitorOp>
1664 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1668 template<Index Log2Dim>
1669 template<
typename OtherLeafNodeType,
typename VisitorOp>
1674 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1678 template<Index Log2Dim>
1681 typename OtherNodeT,
1683 typename ChildAllIterT,
1684 typename OtherChildAllIterT>
1689 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1690 "can't visit nodes of different sizes simultaneously");
1691 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1692 "can't visit nodes at different tree levels simultaneously");
1694 ChildAllIterT iter =
self.beginChildAll();
1695 OtherChildAllIterT otherIter = other.beginChildAll();
1697 for ( ; iter && otherIter; ++iter, ++otherIter) {
1698 op(iter, otherIter);
1706 template<Index Log2Dim>
1707 template<
typename IterT,
typename VisitorOp>
1711 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1715 template<Index Log2Dim>
1716 template<
typename IterT,
typename VisitorOp>
1720 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1724 template<Index Log2Dim>
1728 typename ChildAllIterT,
1729 typename OtherChildAllIterT>
1732 VisitorOp& op,
bool otherIsLHS)
1734 if (!otherIter)
return;
1737 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1738 op(otherIter, iter);
1741 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1742 op(iter, otherIter);
1751 #endif // OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeBool.h:543
bool ValueType
Definition: LeafNodeBool.h:33
ChildOnCIter cendChildOn() const
Definition: LeafNodeBool.h:688
DenseIter()
Definition: LeafNodeBool.h:625
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:1144
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:1136
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:1245
ValueOnIter endValueOn()
Definition: LeafNodeBool.h:668
ChildT * child
Definition: GridBuilder.h:1286
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:584
ValueOffIter beginValueOff()
Definition: LeafNodeBool.h:661
void denseFill(const CoordBBox &bbox, bool val, bool on=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition: LeafNodeBool.h:289
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:29
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeBool.h:579
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeBool.h:647
Definition: NodeMasks.h:270
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeBool.h:662
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeBool.h:652
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeBool.h:681
static const Index LOG2DIM
Definition: LeafNode.h:48
static Index64 offTileCount()
Definition: LeafNodeBool.h:123
ChildOffCIter cendChildOff() const
Definition: LeafNodeBool.h:691
bool BuildType
Definition: LeafNodeBool.h:32
const LeafNode * probeLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:557
Index32 transientData() const
Return the transient data value.
Definition: LeafNodeBool.h:169
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeBool.h:246
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1437
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeBool.h:278
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
void setValue(const Coord &xyz, bool val)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNodeBool.h:253
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:37
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:564
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:502
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeBool.h:639
Buffer mBuffer
Bitmask representing the values of voxels.
Definition: LeafNodeBool.h:735
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1941
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1578
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:178
ValueOnCIter beginValueOn() const
Definition: LeafNodeBool.h:657
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeBool.h:718
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeBool.h:653
Buffer & buffer()
Definition: LeafNodeBool.h:193
ValueOnIter beginValueOn()
Definition: LeafNodeBool.h:658
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeBool.h:628
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:408
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeBool.h:651
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeBool.h:684
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeBool.h:223
const bool & getValue() const
Definition: LeafNodeBool.h:593
void setActiveState(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value. ...
Definition: LeafNodeBool.h:228
void swap(Buffer &other)
Exchange this node's data buffer with the given data buffer without changing the active states of the...
Definition: LeafNodeBool.h:191
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeBool.h:654
Definition: version.h.in:240
void setValueMaskOff(Index n)
Definition: LeafNodeBool.h:715
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1086
static const Index SIZE
Definition: LeafNode.h:53
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeBool.h:126
Definition: NodeMasks.h:239
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1965
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeBool.h:370
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:530
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...
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeBool.h:119
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:436
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeBool.h:626
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1454
void setItem(Index pos, bool value) const
Definition: LeafNodeBool.h:596
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:614
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1536
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:560
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:508
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeBool.h:273
void setTransientData(Index32 transientData)
Set the transient data value.
Definition: LeafNodeBool.h:171
ValueOnCIter cbeginValueOn() const
Definition: LeafNodeBool.h:656
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeBool.h:547
void setValueMaskOn(Index n)
Definition: LeafNodeBool.h:714
const NodeMaskType & valueMask() const
Definition: LeafNodeBool.h:706
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1309
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:1272
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeBool.h:605
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:156
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeBool.h:236
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeBool.h:332
ValueOnCIter cendValueOn() const
Definition: LeafNodeBool.h:666
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:457
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeBool.h:646
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeBool.h:542
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:443
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:1712
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:457
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:644
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:519
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:1721
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:225
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNode.h:166
ValueIter()
Definition: LeafNodeBool.h:589
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1879
ChildOnCIter endChildOn() const
Definition: LeafNodeBool.h:689
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeBool.h:650
ChildOnIter endChildOn()
Definition: LeafNodeBool.h:690
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeBool.h:102
ValueAllIter beginValueAll()
Definition: LeafNodeBool.h:664
OffIterator beginOff() const
Definition: NodeMasks.h:354
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1038
BBox< Coord > CoordBBox
Definition: NanoVDB.h:1658
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:529
ChildOffIter beginChildOff()
Definition: LeafNodeBool.h:683
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1785
ChildAllCIter cendChildAll() const
Definition: LeafNodeBool.h:694
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeBool.h:644
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: LeafNodeBool.h:362
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:582
LeafNode()
Default constructor.
Definition: LeafNode.h:935
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:529
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:462
const NodeMaskType & valueMask() const
Definition: LeafNode.h:876
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1605
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1554
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeBool.h:659
void load(std::istream &is)
Definition: NodeMasks.h:569
ChildOnCIter beginChildOn() const
Definition: LeafNodeBool.h:679
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:1202
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:524
static Index getLevel()
Definition: LeafNodeBool.h:107
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeBool.h:36
bool isChildMaskOff() const
Definition: LeafNodeBool.h:711
bool isChildMaskOff(Index) const
Definition: LeafNodeBool.h:710
void save(std::ostream &os) const
Definition: NodeMasks.h:565
void setValueOnly(Index offset, bool val)
Set the value of the voxel at the given offset but don't change its active state. ...
Definition: LeafNodeBool.h:233
Index64 onLeafVoxelCount() const
Definition: LeafNodeBool.h:120
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1893
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeBool.h:136
ChildAllIter endChildAll()
Definition: LeafNodeBool.h:696
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:296
ChildOffCIter beginChildOff() const
Definition: LeafNodeBool.h:682
uint64_t Index64
Definition: Types.h:53
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeBool.h:577
ChildIter()
Definition: LeafNodeBool.h:613
Definition: Exceptions.h:13
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1846
void setValue(bool value) const
Definition: LeafNodeBool.h:598
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:562
NodeMaskType & getValueMask()
Definition: LeafNodeBool.h:707
static Index size()
Definition: LeafNodeBool.h:105
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1500
ValueT value
Definition: GridBuilder.h:1287
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:155
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeBool.h:281
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeBool.h:104
void visit(VisitorOp &)
Definition: LeafNode.h:1861
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1162
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:276
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:1492
bool isConstant(bool &isOn) const
Definition: NodeMasks.h:526
const NodeMaskType & getValueMask() const
Definition: LeafNodeBool.h:705
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1102
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition: LeafNode.h:1634
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1051
void setValueOffAndCache(const Coord &xyz, bool value, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as inactive.
Definition: LeafNodeBool.h:353
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:337
Index32 Index
Definition: Types.h:54
ValueAllCIter endValueAll() const
Definition: LeafNodeBool.h:673
ValueOffCIter endValueOff() const
Definition: LeafNodeBool.h:670
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:526
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:450
static Index32 leafCount()
Definition: LeafNodeBool.h:111
LeafNode specialization for values of type bool that stores both the active states and the values of ...
Definition: LeafNodeBool.h:28
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1061
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeBool.h:448
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1918
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:202
ChildOffCIter endChildOff() const
Definition: LeafNodeBool.h:692
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeBool.h:578
void nodeCount(std::vector< Index32 > &) const
no-op
Definition: LeafNodeBool.h:113
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeBool.h:678
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1075
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeBool.h:128
static Index32 nonLeafCount()
Definition: LeafNodeBool.h:114
ValueOnCIter endValueOn() const
Definition: LeafNodeBool.h:667
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1622
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:151
ValueType * mData
Definition: LeafBuffer.h:125
bool isValueMaskOff() const
Definition: LeafNodeBool.h:704
static Index64 onTileCount()
Definition: LeafNodeBool.h:122
ValueOffCIter cendValueOff() const
Definition: LeafNodeBool.h:669
static void getNodeLog2Dims(std::vector< Index > &dims)
Definition: LeafNodeBool.h:108
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1317
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeBool.h:271
Index64 offLeafVoxelCount() const
Definition: LeafNodeBool.h:121
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeBool.h:117
ChildAllCIter endChildAll() const
Definition: LeafNodeBool.h:695
ValueAllCIter beginValueAll() const
Definition: LeafNodeBool.h:663
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:295
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:559
int32_t Int32
Definition: Types.h:56
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeBool.h:708
ChildOffIter endChildOff()
Definition: LeafNodeBool.h:693
ValueAllCIter cendValueAll() const
Definition: LeafNodeBool.h:672
bool isValueMaskOn(Index n) const
Definition: LeafNodeBool.h:701
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeBool.h:602
void setValueAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as active.
Definition: LeafNodeBool.h:342
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeBool.h:396
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:874
OnIterator beginOn() const
Definition: NodeMasks.h:352
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeBool.h:401
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:327
void setValueMask(Index n, bool on)
Definition: LeafNodeBool.h:713
void setValueOnlyAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates but preserve its state.
Definition: LeafNodeBool.h:348
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:154
void merge(const LeafNode &)
Definition: LeafNode.h:1655
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeBool.h:405
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
bool isValueMaskOff(Index n) const
Definition: LeafNodeBool.h:703
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:650
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeBool.h:645
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeBool.h:737
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeBool.h:436
Definition: NodeMasks.h:208
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1345
Definition: PointDataGrid.h:170
ValueOffIter endValueOff()
Definition: LeafNodeBool.h:671
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:522
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:590
uint32_t Index32
Definition: Types.h:52
bool isChildMaskOn(Index) const
Definition: LeafNodeBool.h:709
ChildAllCIter beginChildAll() const
Definition: LeafNodeBool.h:685
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:338
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:298
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &)
Set the active state of the voxel at the given coordinates without changing its value.
Definition: LeafNodeBool.h:379
void negate()
Definition: LeafNodeBool.h:440
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeBool.h:643
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1474
const bool & getItem(Index pos) const
Definition: LeafNodeBool.h:592
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
ValueAllIter endValueAll()
Definition: LeafNodeBool.h:674
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:520
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNodeBool.h:132
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:477
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeBool.h:649
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:485
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeBool.h:545
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1745
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:418
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNodeBool.h:148
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeBool.h:248
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition: AttributeTransferUtil.h:141
static Index numValues()
Definition: LeafNodeBool.h:106
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:528
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeBool.h:623
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1464
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeBool.h:540
bool isValueMaskOn() const
Definition: LeafNodeBool.h:702
ChildAllIter beginChildAll()
Definition: LeafNodeBool.h:686
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeBool.h:238
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:114
bool resultIsActive() const
Definition: Types.h:593
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:172
ValueOffCIter beginValueOff() const
Definition: LeafNodeBool.h:660
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:1704
static Index getChildDim()
Definition: LeafNodeBool.h:109
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202
ChildOnIter beginChildOn()
Definition: LeafNodeBool.h:680
NodeMaskType mValueMask
Bitmask that determines which voxels are active.
Definition: LeafNodeBool.h:733
~LeafNode()
Destructor.
Definition: LeafNode.h:1031
const Buffer & buffer() const
Definition: LeafNodeBool.h:192
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: LeafNodeBool.h:388
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeBool.h:648