4 #ifndef OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED 5 #define OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED 18 #include <type_traits> 30 template<Index,
typename>
struct SameLeafConfig;
37 template<
typename T, Index Log2Dim>
52 NUM_VALUES = 1 << 3 * Log2Dim,
53 NUM_VOXELS = NUM_VALUES,
59 template<
typename OtherValueType>
64 template<
typename OtherNodeType>
77 explicit LeafNode(
const Coord& coords,
78 const ValueType& value = zeroVal<ValueType>(),
88 const ValueType& value = zeroVal<ValueType>(),
98 template<
typename OtherValueType>
102 template<
typename OtherValueType>
107 template<
typename OtherValueType>
151 bool isEmpty()
const {
return mValueMask.isOff(); }
153 bool isDense()
const {
return mValueMask.isOn(); }
155 bool isAllocated()
const {
return !mBuffer.isOutOfCore() && !mBuffer.empty(); }
166 void evalActiveBoundingBox(CoordBBox& bbox,
bool visitVoxels =
true)
const;
173 void setOrigin(
const Coord& origin) { mOrigin = origin; }
176 const Coord&
origin()
const {
return mOrigin; }
177 void getOrigin(Coord& origin)
const { origin = mOrigin; }
182 static Index coordToOffset(
const Coord& xyz);
185 static Coord offsetToLocalCoord(
Index n);
187 Coord offsetToGlobalCoord(
Index n)
const;
195 std::string str()
const;
199 template<
typename OtherType, Index OtherLog2Dim>
215 template<
typename MaskIterT,
typename NodeT,
typename ValueT,
typename TagT>
220 MaskIterT, ValueIter<MaskIterT, NodeT, ValueT, TagT>, NodeT, ValueT>
222 using ValueType = std::conditional_t<std::is_const_v<NodeT>, ValueT,
223 std::remove_const_t<ValueT>>;
228 :
BaseT(iter, parent)
232 , mData([&]() {
OPENVDB_ASSERT(parent);
return parent->buffer().data(); }()) {}
235 ValueT&
getValue()
const {
return this->getItem(this->pos()); }
240 if constexpr (std::is_const_v<NodeT>) {
241 static_assert(!std::is_const_v<NodeT>,
242 "ValueIter::setItem cannot be called on const iterators");
251 void setValue(
const ValueT& value)
const { this->setItem(this->pos(), value); }
254 template<
typename ModifyOp>
257 if constexpr (std::is_const_v<NodeT>) {
258 static_assert(!std::is_const_v<NodeT>,
259 "ValueIter::modifyItem cannot be called on const iterators");
265 this->parent().setValueOn(n);
269 template<
typename ModifyOp>
272 this->modifyItem(this->pos(), op);
279 template<
typename MaskIterT,
typename NodeT,
typename TagT>
281 public SparseIteratorBase<MaskIterT, ChildIter<MaskIterT, NodeT, TagT>, NodeT, ValueType>
288 template<
typename NodeT,
typename ValueT,
typename TagT>
290 MaskDenseIterator, DenseIter<NodeT, ValueT, TagT>, NodeT, void, ValueT>
300 value = this->parent().getValue(pos);
311 this->parent().setValueOnly(pos, value);
386 void readTopology(std::istream& is,
bool fromHalf =
false);
390 void writeTopology(std::ostream& os,
bool toHalf =
false)
const;
395 void readBuffers(std::istream& is,
bool fromHalf =
false);
400 void readBuffers(std::istream& is,
const CoordBBox& bbox,
bool fromHalf =
false);
404 void writeBuffers(std::ostream& os,
bool toHalf =
false)
const;
406 size_t streamingSize(
bool toHalf =
false)
const;
412 const ValueType& getValue(
const Coord& xyz)
const;
419 bool probeValue(
const Coord& xyz,
ValueType& val)
const;
429 void setActiveState(
const Coord& xyz,
bool on);
434 void setValueOnly(
const Coord& xyz,
const ValueType& val);
439 void setValueOff(
const Coord& xyz) { mValueMask.setOff(LeafNode::coordToOffset(xyz)); }
444 void setValueOff(
const Coord& xyz,
const ValueType& val);
449 void setValueOn(
const Coord& xyz) { mValueMask.setOn(LeafNode::coordToOffset(xyz)); }
454 this->setValueOn(LeafNode::coordToOffset(xyz), val);
460 mBuffer.setValue(offset, val);
461 mValueMask.setOn(offset);
466 template<
typename ModifyOp>
469 mBuffer.loadValues();
470 if (!mBuffer.empty()) {
474 mValueMask.setOn(offset);
480 template<
typename ModifyOp>
483 this->modifyValue(this->coordToOffset(xyz), op);
487 template<
typename ModifyOp>
490 mBuffer.loadValues();
491 if (!mBuffer.empty()) {
492 const Index offset = this->coordToOffset(xyz);
493 bool state = mValueMask.isOn(offset);
497 mValueMask.set(offset, state);
522 void fill(
const CoordBBox& bbox,
const ValueType&,
bool active =
true);
526 this->fill(bbox, value, active);
532 void fill(
const ValueType& value,
bool active);
545 template<
typename DenseT>
546 void copyToDense(
const CoordBBox& bbox, DenseT& dense)
const;
564 template<
typename DenseT>
565 void copyFromDense(
const CoordBBox& bbox,
const DenseT& dense,
570 template<
typename AccessorT>
573 return this->getValue(xyz);
578 template<
typename AccessorT>
583 template<
typename AccessorT>
586 this->setValueOn(xyz, val);
592 template<
typename AccessorT>
595 this->setValueOnly(xyz, val);
601 template<
typename ModifyOp,
typename AccessorT>
604 this->modifyValue(xyz, op);
609 template<
typename ModifyOp,
typename AccessorT>
612 this->modifyValueAndActiveState(xyz, op);
617 template<
typename AccessorT>
620 this->setValueOff(xyz, value);
626 template<
typename AccessorT>
629 this->setActiveState(xyz, on);
635 template<
typename AccessorT>
638 return this->probeValue(xyz, val);
644 template<
typename AccessorT>
647 const Index offset = this->coordToOffset(xyz);
648 state = mValueMask.isOn(offset);
650 return mBuffer[offset];
655 template<
typename AccessorT>
676 template<MergePolicy Policy>
void merge(
const ValueType& tileValue,
bool tileActive);
677 template<MergePolicy Policy>
686 template<
typename OtherType>
700 template<
typename OtherType>
714 template<
typename OtherType>
717 template<
typename CombineOp>
719 template<
typename CombineOp>
722 template<
typename CombineOp,
typename OtherType >
723 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
724 template<
typename CombineOp,
typename OtherNodeT >
725 void combine2(
const ValueType&,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
726 template<
typename CombineOp,
typename OtherNodeT >
727 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
733 template<
typename AccessorT>
735 template<
typename NodeT>
737 template<
typename NodeT>
739 template<
typename NodeT>
741 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
747 template<
typename AccessorT>
748 void addTileAndCache(
Index,
const Coord&,
const ValueType&,
bool, AccessorT&);
753 template<
typename AccessorT>
755 template<
typename NodeT,
typename AccessorT>
759 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
760 return reinterpret_cast<NodeT*
>(
this);
764 template<
typename AccessorT>
770 template<
typename AccessorT>
772 template<
typename AccessorT>
775 template<
typename NodeT,
typename AccessorT>
779 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
780 return reinterpret_cast<const NodeT*
>(
this);
794 bool isConstant(
ValueType& firstValue,
bool& state,
795 const ValueType& tolerance = zeroVal<ValueType>())
const;
809 bool& state,
const ValueType& tolerance = zeroVal<ValueType>())
const;
887 friend class ::TestLeaf;
888 template<
typename>
friend class ::TestLeafIO;
925 inline void skipCompressedValues(
bool seekable, std::istream&,
bool fromHalf);
948 template<Index Dim1,
typename NodeT2>
951 template<Index Dim1,
typename T2>
959 template<
typename T, Index Log2Dim>
968 template<
typename T, Index Log2Dim>
973 mOrigin(xyz & (~(
DIM - 1)))
978 template<
typename T, Index Log2Dim>
983 mOrigin(xyz & (~(
DIM - 1)))
988 template<
typename T, Index Log2Dim>
991 : mBuffer(other.mBuffer)
993 , mOrigin(other.mOrigin)
994 , mTransientData(other.mTransientData)
1000 template<
typename T, Index Log2Dim>
1001 template<
typename OtherValueType>
1005 , mOrigin(other.mOrigin)
1006 , mTransientData(other.mTransientData)
1010 static inline ValueType convertValue(
const OtherValueType& val) {
return ValueType(val); }
1014 mBuffer[i] = Local::convertValue(other.mBuffer[i]);
1019 template<
typename T, Index Log2Dim>
1020 template<
typename OtherValueType>
1024 : mBuffer(background)
1026 , mOrigin(other.mOrigin)
1027 , mTransientData(other.mTransientData)
1032 template<
typename T, Index Log2Dim>
1033 template<
typename OtherValueType>
1038 , mOrigin(other.mOrigin)
1039 , mTransientData(other.mTransientData)
1042 mBuffer[i] = (mValueMask.
isOn(i) ? onValue : offValue);
1047 template<
typename T, Index Log2Dim>
1054 template<
typename T, Index Log2Dim>
1058 std::ostringstream ostr;
1059 ostr <<
"LeafNode @" << mOrigin <<
": " << mBuffer;
1067 template<
typename T, Index Log2Dim>
1072 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
1073 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
1074 + (xyz[2] & (
DIM-1u));
1077 template<
typename T, Index Log2Dim>
1083 xyz.setX(n >> 2*Log2Dim);
1084 n &= ((1<<2*Log2Dim)-1);
1085 xyz.setY(n >> Log2Dim);
1086 xyz.setZ(n & ((1<<Log2Dim)-1));
1091 template<
typename T, Index Log2Dim>
1102 template<
typename ValueT, Index Log2Dim>
1103 inline const ValueT&
1109 template<
typename ValueT, Index Log2Dim>
1110 inline const ValueT&
1114 return mBuffer[offset];
1118 template<
typename T, Index Log2Dim>
1125 template<
typename T, Index Log2Dim>
1130 val = mBuffer[offset];
1131 return mValueMask.
isOn(offset);
1135 template<
typename T, Index Log2Dim>
1142 template<
typename T, Index Log2Dim>
1148 mValueMask.
setOff(offset);
1152 template<
typename T, Index Log2Dim>
1160 template<
typename T, Index Log2Dim>
1167 template<
typename T, Index Log2Dim>
1178 template<
typename T, Index Log2Dim>
1183 if (!clipBBox.hasOverlap(nodeBBox)) {
1185 this->
fill(background,
false);
1186 }
else if (clipBBox.isInside(nodeBBox)) {
1196 nodeBBox.intersect(clipBBox);
1198 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1199 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1200 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1201 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1218 template<
typename T, Index Log2Dim>
1225 clippedBBox.intersect(bbox);
1226 if (!clippedBBox)
return;
1228 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1229 const Index offsetX = (x & (
DIM-1u)) << 2*Log2Dim;
1230 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1231 const Index offsetXY = offsetX + ((y & (
DIM-1u)) << Log2Dim);
1232 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1233 const Index offset = offsetXY + (z & (
DIM-1u));
1234 mBuffer[offset] = value;
1235 mValueMask.
set(offset, active);
1241 template<
typename T, Index Log2Dim>
1245 mBuffer.
fill(value);
1248 template<
typename T, Index Log2Dim>
1252 mBuffer.
fill(value);
1253 mValueMask.
set(active);
1260 template<
typename T, Index Log2Dim>
1261 template<
typename DenseT>
1265 mBuffer.loadValues();
1267 using DenseValueType =
typename DenseT::ValueType;
1269 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1270 const Coord&
min = dense.bbox().min();
1271 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1272 const T* s0 = &mBuffer[bbox.min()[2] & (
DIM-1u)];
1273 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1274 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1275 const T* s1 = s0 + ((x & (
DIM-1u)) << 2*Log2Dim);
1276 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1277 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1278 const T* s2 = s1 + ((y & (
DIM-1u)) << Log2Dim);
1279 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1280 *t2 = DenseValueType(*s2++);
1287 template<
typename T, Index Log2Dim>
1288 template<
typename DenseT>
1295 using DenseValueType =
typename DenseT::ValueType;
1297 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1298 const Coord&
min = dense.bbox().min();
1300 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1301 const Int32 n0 = bbox.min()[2] & (
DIM-1u);
1302 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0]+1; x < ex; ++x) {
1303 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1305 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1]+1; y < ey; ++y) {
1306 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1308 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1311 mBuffer[n2] = background;
1313 mValueMask.
setOn(n2);
1325 template<
typename T, Index Log2Dim>
1329 mValueMask.
load(is);
1333 template<
typename T, Index Log2Dim>
1337 mValueMask.
save(os);
1345 template<
typename T, Index Log2Dim>
1351 io::readCompressedValues<ValueType, NodeMaskType>(
1352 is,
nullptr,
SIZE, mValueMask, fromHalf);
1361 template<
typename T, Index Log2Dim>
1365 this->
readBuffers(is, CoordBBox::inf(), fromHalf);
1369 template<
typename T, Index Log2Dim>
1374 const bool seekable = meta && meta->seekable();
1376 #ifdef OPENVDB_USE_DELAYED_LOADING 1377 std::streamoff maskpos = is.tellg();
1382 mValueMask.
seek(is);
1385 mValueMask.
load(is);
1388 int8_t numBuffers = 1;
1391 is.read(reinterpret_cast<char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1394 is.read(reinterpret_cast<char*>(&numBuffers),
sizeof(int8_t));
1398 if (!clipBBox.hasOverlap(nodeBBox)) {
1402 mBuffer.setOutOfCore(
false);
1404 #ifdef OPENVDB_USE_DELAYED_LOADING 1409 io::MappedFile::Ptr mappedFile = io::getMappedFilePtr(is);
1410 const bool delayLoad = ((mappedFile.get() !=
nullptr) && clipBBox.isInside(nodeBBox));
1413 mBuffer.setOutOfCore(
true);
1414 mBuffer.mFileInfo =
new typename Buffer::FileInfo;
1415 mBuffer.mFileInfo->meta = meta;
1416 mBuffer.mFileInfo->bufpos = is.tellg();
1417 mBuffer.mFileInfo->mapping = mappedFile;
1420 mBuffer.mFileInfo->maskpos = maskpos;
1427 mBuffer.setOutOfCore(
false);
1430 T background = zeroVal<T>();
1432 background = *
static_cast<const T*
>(bgPtr);
1434 this->
clip(clipBBox, background);
1435 #ifdef OPENVDB_USE_DELAYED_LOADING 1440 if (numBuffers > 1) {
1445 for (
int i = 1; i < numBuffers; ++i) {
1449 io::readData<T>(is, temp.mData,
SIZE, zipped);
1455 if (meta) meta->setLeaf(meta->leaf() + 1);
1459 template<
typename T, Index Log2Dim>
1464 mValueMask.
save(os);
1466 mBuffer.loadValues();
1476 template<
typename T, Index Log2Dim>
1480 return mOrigin == other.mOrigin &&
1482 mBuffer == other.mBuffer;
1486 template<
typename T, Index Log2Dim>
1492 return sizeof(*this) + mBuffer.
memUsage() -
sizeof(mBuffer);
1496 template<
typename T, Index Log2Dim>
1506 template<
typename T, Index Log2Dim>
1511 if (bbox.isInside(this_bbox))
return;
1515 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
1516 this_bbox.translate(this->
origin());
1518 bbox.expand(this_bbox);
1523 template<
typename T, Index Log2Dim>
1524 template<
typename OtherType, Index OtherLog2Dim>
1529 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
1532 template<
typename T, Index Log2Dim>
1538 if (!mValueMask.
isConstant(state))
return false;
1539 firstValue = mBuffer[0];
1546 template<
typename T, Index Log2Dim>
1553 if (!mValueMask.
isConstant(state))
return false;
1554 minValue = maxValue = mBuffer[0];
1556 const T& v = mBuffer[i];
1558 if ((maxValue - v) > tolerance)
return false;
1560 }
else if (v > maxValue) {
1561 if ((v - minValue) > tolerance)
return false;
1568 template<
typename T, Index Log2Dim>
1572 std::unique_ptr<T[]> data(
nullptr);
1573 if (tmp ==
nullptr) {
1577 if (tmp != mBuffer.
data()) {
1578 const T* src = mBuffer.
data();
1579 for (T* dst = tmp; dst-tmp <
NUM_VALUES;) *dst++ = *src++;
1581 static const size_t midpoint = (
NUM_VALUES - 1) >> 1;
1582 std::nth_element(tmp, tmp + midpoint, tmp +
NUM_VALUES);
1583 return tmp[midpoint];
1586 template<
typename T, Index Log2Dim>
1594 }
else if (count == 0) {
1597 std::unique_ptr<T[]> data(
nullptr);
1598 if (tmp ==
nullptr) {
1599 data.reset(
new T[count]);
1602 for (
auto iter=this->
cbeginValueOn(); iter; ++iter) *tmp++ = *iter;
1603 T *begin = tmp - count;
1604 const size_t midpoint = (count - 1) >> 1;
1605 std::nth_element(begin, begin + midpoint, tmp);
1606 value = begin[midpoint];
1610 template<
typename T, Index Log2Dim>
1618 }
else if (count == 0) {
1621 std::unique_ptr<T[]> data(
nullptr);
1622 if (tmp ==
nullptr) {
1623 data.reset(
new T[count]);
1626 for (
auto iter=this->
cbeginValueOff(); iter; ++iter) *tmp++ = *iter;
1627 T *begin = tmp - count;
1628 const size_t midpoint = (count - 1) >> 1;
1629 std::nth_element(begin, begin + midpoint, tmp);
1630 value = begin[midpoint];
1637 template<
typename T, Index Log2Dim>
1644 template<
typename T, Index Log2Dim>
1653 template<
typename T, Index Log2Dim>
1654 template<
typename AccessorT>
1657 const ValueType& val,
bool active, AccessorT&)
1659 this->
addTile(level, xyz, val, active);
1666 template<
typename T, Index Log2Dim>
1676 for (iter = this->mValueMask.
beginOff(); iter; ++iter) {
1679 inactiveValue = newBackground;
1687 template<
typename T, Index Log2Dim>
1688 template<MergePolicy Policy>
1697 for (; iter; ++iter) {
1699 if (mValueMask.
isOff(n)) {
1700 mBuffer[n] = other.mBuffer[n];
1701 mValueMask.
setOn(n);
1707 template<
typename T, Index Log2Dim>
1708 template<MergePolicy Policy>
1713 this->
template merge<Policy>(other);
1716 template<
typename T, Index Log2Dim>
1717 template<MergePolicy Policy>
1725 if (!tileActive)
return;
1728 const Index n = iter.pos();
1729 mBuffer[n] = tileValue;
1730 mValueMask.
setOn(n);
1736 template<
typename T, Index Log2Dim>
1737 template<
typename OtherType>
1744 template<
typename T, Index Log2Dim>
1745 template<
typename OtherType>
1753 template<
typename T, Index Log2Dim>
1754 template<
typename OtherType>
1762 template<
typename T, Index Log2Dim>
1769 mBuffer[i] = -mBuffer[i];
1777 template<
typename T, Index Log2Dim>
1778 template<
typename CombineOp>
1787 .setAIsActive(mValueMask.
isOn(i))
1788 .setBRef(other.mBuffer[i])
1790 .setResultRef(mBuffer[i]));
1796 template<
typename T, Index Log2Dim>
1797 template<
typename CombineOp>
1804 args.
setBRef(value).setBIsActive(valueIsActive);
1807 .setAIsActive(mValueMask.
isOn(i))
1808 .setResultRef(mBuffer[i]));
1817 template<
typename T, Index Log2Dim>
1818 template<
typename CombineOp,
typename OtherType>
1821 bool valueIsActive, CombineOp& op)
1826 args.
setBRef(value).setBIsActive(valueIsActive);
1830 .setResultRef(mBuffer[i]));
1836 template<
typename T, Index Log2Dim>
1837 template<
typename CombineOp,
typename OtherNodeT>
1840 bool valueIsActive, CombineOp& op)
1845 args.
setARef(value).setAIsActive(valueIsActive);
1848 .setBIsActive(other.valueMask().isOn(i))
1849 .setResultRef(mBuffer[i]));
1855 template<
typename T, Index Log2Dim>
1856 template<
typename CombineOp,
typename OtherNodeT>
1867 .setBRef(b1.mBuffer[i])
1868 .setBIsActive(b1.valueMask().isOn(i))
1869 .setResultRef(mBuffer[i]));
1878 template<
typename T, Index Log2Dim>
1879 inline std::ostream&
1880 operator<<(std::ostream& os, const typename LeafNode<T, Log2Dim>::Buffer& buf)
1882 for (
Index32 i = 0, N = buf.size(); i < N; ++i) os << buf.mData[i] <<
", ";
1900 #endif // OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNode.h:771
void unsetItem(Index pos, const ValueT &value) const
Definition: LeafNode.h:309
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:38
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:29
void setValueMask(const NodeMaskType &mask)
Definition: LeafNode.h:916
bool isChildMaskOff() const
Definition: LeafNode.h:919
Definition: LeafNode.h:213
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition: LeafNode.h:1668
bool isDense() const
Return true if this node contains only active voxels.
Definition: LeafNode.h:153
const NodeMaskType & valueMask() const
Definition: LeafNode.h:915
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:177
bool isValueMaskOff(Index n) const
Definition: LeafNode.h:911
Definition: version.h.in:262
int32_t Int32
Definition: Types.h:56
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNode.h:732
bool isApproxEqual(const Type &a, const Type &b, const Type &tolerance)
Return true if a is equal to b to within the given tolerance.
Definition: Math.h:406
const ValueType & getValueUnsafe(Index offset) const
Return the value of the voxel at the given offset.
Definition: LeafNode.h:870
void setActiveStateUnsafe(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value. ...
Definition: LeafNode.h:874
Index32 pos() const
Definition: NodeMasks.h:200
const ValueType & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:571
void load(std::istream &is)
Definition: NodeMasks.h:569
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNode.h:504
uint64_t Index64
Definition: Types.h:53
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:474
ValueAllIter beginValueAll()
Definition: LeafNode.h:337
T ValueType
Definition: LeafNode.h:42
OPENVDB_API uint32_t getDataCompression(std::ios_base &)
Return a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK, etc.) specifying whether and how input data is compressed or output data should be compressed.
const ValueType & getValue(const Coord &xyz, bool &state, int &level, AccessorT &) const
Return the value of the voxel at the given coordinates and return its active state and level (i...
Definition: LeafNode.h:645
ValueT & getItem(Index pos) const
Definition: LeafNode.h:234
void setValue(const ValueT &value) const
Definition: LeafNode.h:251
~LeafNode()
Destructor.
Definition: LeafNode.h:1049
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNode.h:298
Definition: LeafNode.h:23
void seek(std::istream &is) const
Definition: NodeMasks.h:570
bool probeValueAndCache(const Coord &xyz, ValueType &val, AccessorT &) const
Return true if the voxel at the given coordinates is active and return the voxel value in val...
Definition: LeafNode.h:636
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &)
Set the active state of the voxel at the given coordinates without changing its value.
Definition: LeafNode.h:627
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNode.h:227
const ValueType & getFirstValue() const
Return a const reference to the first value in the buffer.
Definition: LeafNode.h:661
ValueOffIter endValueOff()
Definition: LeafNode.h:344
ValueAllCIter endValueAll() const
Definition: LeafNode.h:346
ValueOffCIter endValueOff() const
Definition: LeafNode.h:343
bool getValueUnsafe(Index offset, ValueType &value) const
Return true if the voxel at the given offset is active and set value.
Definition: LeafNode.h:872
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNode.h:502
void merge(const LeafNode &)
Definition: LeafNode.h:1690
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition: LeafNode.h:128
bool isChildMaskOn(Index) const
Definition: LeafNode.h:917
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1639
Index64 onLeafVoxelCount() const
Definition: LeafNode.h:146
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:178
void setValueOffAndCache(const Coord &xyz, const ValueType &value, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as inactive.
Definition: LeafNode.h:618
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1488
bool isValueOff(const Coord &xyz) const
Return true if the voxel at the given coordinates is inactive.
Definition: LeafNode.h:511
bool isChildMaskOff(Index) const
Definition: LeafNode.h:918
Definition: LeafNode.h:212
void setValueOnUnsafe(Index offset, const ValueType &value)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNode.h:880
ChildAllCIter cbeginChildAll() const
Definition: LeafNode.h:357
static const Index LOG2DIM
Definition: LeafNode.h:49
ChildOnCIter endChildOn() const
Definition: LeafNode.h:362
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:1220
SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a LeafNod...
Definition: LeafNode.h:65
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNode.h:157
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:114
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...
Index memUsageIfLoaded() const
Definition: LeafBuffer.h:337
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
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: LeafNode.h:602
void setValueMask(Index n, bool on)
Definition: LeafNode.h:921
void modifyValue(const Coord &xyz, const ModifyOp &op)
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active...
Definition: LeafNode.h:481
ValueType ValueType
Definition: Iterator.h:117
ChildOffCIter beginChildOff() const
Definition: LeafNode.h:355
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:1162
ValueAllIter endValueAll()
Definition: LeafNode.h:347
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
const LeafNode * probeLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNode.h:774
Index64 onVoxelCount() const
Return the number of voxels marked On.
Definition: LeafNode.h:143
ChildOffIter beginChildOff()
Definition: LeafNode.h:356
ChildOffCIter cendChildOff() const
Definition: LeafNode.h:364
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:579
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:639
void setValueAndCache(const Coord &xyz, const ValueType &val, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as active.
Definition: LeafNode.h:584
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1570
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNode.h:754
Index32 Index
Definition: Types.h:54
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNode.h:928
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNode.h:741
Definition: NodeMasks.h:239
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:329
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:488
T negative(const T &val)
Return the unary negation of the given value.
Definition: Math.h:128
bool isValueMaskOn() const
Definition: LeafNode.h:910
ValueOnIter beginValueOn()
Definition: LeafNode.h:331
Index memUsage() const
Return the memory footprint of this buffer in bytes.
Definition: LeafBuffer.h:320
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1478
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:694
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition: Math.h:443
LeafNode()
Default constructor.
Definition: LeafNode.h:961
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1335
Definition: LeafNode.h:213
ValueOnCIter beginValueOn() const
Definition: LeafNode.h:330
static const Index NUM_VALUES
Definition: LeafNode.h:52
void skipCompressedValues(bool seekable, std::istream &, bool fromHalf)
Definition: LeafNode.h:1347
void setTransientData(Index32 transientData)
Set the transient data value.
Definition: LeafNode.h:192
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNode.h:516
std::conditional_t< std::is_const_v< NodeT >, ValueT, std::remove_const_t< ValueT >> ValueType
Definition: LeafNode.h:223
ChildOnCIter cbeginChildOn() const
Definition: LeafNode.h:351
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1327
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNode.h:673
void swap(Buffer &other)
Exchange this node's data buffer with the given data buffer without changing the active states of the...
Definition: LeafNode.h:376
OnIterator beginOn() const
Definition: NodeMasks.h:352
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNode.h:734
ChildOnCIter beginChildOn() const
Definition: LeafNode.h:352
void negate()
Definition: LeafNode.h:1764
Buffer & buffer()
Definition: LeafNode.h:378
ValueConverter<T>::Type is the type of a LeafNode having the same dimensions as this node but a diffe...
Definition: LeafNode.h:60
OffIterator beginOff() const
Definition: NodeMasks.h:354
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:462
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNode.h:122
ValueOffCIter cendValueOff() const
Definition: LeafNode.h:342
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNode.h:610
bool isValueMaskOn(Index n) const
Definition: LeafNode.h:909
ValueOffCIter cbeginValueOff() const
Definition: LeafNode.h:332
Definition: LeafNode.h:212
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1056
static const Index DIM
Definition: LeafNode.h:51
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:508
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1780
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:449
void setValueOn(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNode.h:453
Definition: Compression.h:293
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1656
Definition: NodeMasks.h:208
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNode.h:151
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:1290
ValueAllCIter cbeginValueAll() const
Definition: LeafNode.h:335
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNode.h:756
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1079
Index64 memUsageIfLoaded() const
Definition: LeafNode.h:1498
typename NodeMaskType::OnIterator MaskOnIterator
Definition: LeafNode.h:207
ChildAllIter beginChildAll()
Definition: LeafNode.h:359
ValueOnCIter cendValueOn() const
Definition: LeafNode.h:339
#define OPENVDB_ASSERT(X)
Definition: Assert.h:41
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNode.h:255
ChildIter()
Definition: LeafNode.h:283
void setValueOffUnsafe(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNode.h:882
void setValueOnlyUnsafe(Index offset, const ValueType &value)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition: LeafNode.h:876
static const Index SIZE
Definition: LeafNode.h:54
uint32_t Index32
Definition: Types.h:52
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:443
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNode.h:752
Index64 offVoxelCount() const
Return the number of voxels marked Off.
Definition: LeafNode.h:145
typename NodeMaskType::OffIterator MaskOffIterator
Definition: LeafNode.h:208
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNode.h:173
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1093
static Index64 leafCount()
Return the leaf count for this node, which is one.
Definition: LeafNode.h:132
ValueOffIter beginValueOff()
Definition: LeafNode.h:334
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:176
void setValueOnUnsafe(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNode.h:878
void writeCompressedValues(std::ostream &os, ValueT *srcBuf, Index srcCount, const MaskT &valueMask, const MaskT &childMask, bool toHalf)
Definition: Compression.h:646
void setValueOnlyAndCache(const Coord &xyz, const ValueType &val, AccessorT &)
Change the value of the voxel at the given coordinates but preserve its state.
Definition: LeafNode.h:593
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1534
Index32 transientData() const
Return the transient data value.
Definition: LeafNode.h:190
void setItem(Index pos, const ValueT &value) const
Definition: LeafNode.h:238
Definition: LeafNode.h:213
ValueAllCIter cendValueAll() const
Definition: LeafNode.h:345
typename NodeMaskType::DenseIterator MaskDenseIterator
Definition: LeafNode.h:209
void denseFill(const CoordBBox &bbox, const ValueType &value, bool active=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition: LeafNode.h:524
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:1739
Definition: Exceptions.h:13
ChildOffIter endChildOff()
Definition: LeafNode.h:366
void setValue(Index i, const ValueType &)
Set the i'th value of this buffer to the specified value.
Definition: LeafBuffer.h:233
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNode.h:293
ChildOffCIter cbeginChildOff() const
Definition: LeafNode.h:354
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1069
static Index64 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition: LeafNode.h:138
DenseIter()
Definition: LeafNode.h:295
OPENVDB_API SharedPtr< StreamMetadata > getStreamMetadataPtr(std::ios_base &)
Return a shared pointer to an object that stores metadata (file format, compression scheme...
void setValueOn(Index offset, const ValueType &val)
Set the value of the voxel at the given offset and mark the voxel as active.
Definition: LeafNode.h:459
ValueOnIter endValueOn()
Definition: LeafNode.h:341
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:692
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1508
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNode.h:736
ChildOnIter endChildOn()
Definition: LeafNode.h:363
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:204
Definition: LeafNode.h:216
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition: LeafNode.h:126
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:760
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNode.h:765
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNode.h:656
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNode.h:451
static Index64 offTileCount()
Definition: LeafNode.h:149
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1461
ValueIter()
Definition: LeafNode.h:226
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNode.h:742
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1612
void save(std::ostream &os) const
Definition: NodeMasks.h:565
ChildOnIter beginChildOn()
Definition: LeafNode.h:353
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNode.h:284
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:1756
LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNode.h:763
const Buffer & buffer() const
Definition: LeafNode.h:377
void readCompressedValues(std::istream &is, ValueT *destBuf, Index destCount, const MaskT &valueMask, bool fromHalf)
Definition: Compression.h:466
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:1526
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition: LeafNode.h:130
Leaf nodes have no children, so their child iterators have no get/set accessors.
Definition: LeafNode.h:280
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:178
T BuildType
Definition: LeafNode.h:41
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1820
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNode.h:738
ChildOnCIter cendChildOn() const
Definition: LeafNode.h:361
Index64 offLeafVoxelCount() const
Definition: LeafNode.h:147
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNode.h:861
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:457
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNode.h:769
bool isConstant(bool &isOn) const
Definition: NodeMasks.h:526
ChildOffCIter endChildOff() const
Definition: LeafNode.h:365
ValueT & getValue() const
Definition: LeafNode.h:235
Definition: LeafNode.h:289
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNode.h:441
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:358
void setValueMaskOff(Index n)
Definition: LeafNode.h:923
NodeMaskType & getValueMask()
Definition: LeafNode.h:914
DenseIter(const MaskDenseIterator &iter, NodeT *parent)
Definition: LeafNode.h:296
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNode.h:509
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1588
void setValueOffUnsafe(Index offset, const ValueType &value)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNode.h:884
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNode.h:740
static Index64 onTileCount()
Definition: LeafNode.h:148
void nodeCount(std::vector< Index64 > &) const
no-op
Definition: LeafNode.h:134
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1363
void modifyValue(const ModifyOp &op) const
Definition: LeafNode.h:270
ChildAllIter endChildAll()
Definition: LeafNode.h:369
bool allocate()
Allocate memory for this buffer if it has not already been allocated.
Definition: LeafBuffer.h:83
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:502
static Index log2dim()
Return log2 of the dimension of this LeafNode, e.g. 3 if dimensions are 8^3.
Definition: LeafNode.h:118
static Index dim()
Return the number of voxels in each coordinate dimension.
Definition: LeafNode.h:120
bool isValueMaskOff() const
Definition: LeafNode.h:912
void setActiveState(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value. ...
Definition: LeafNode.h:431
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:450
ValueOnCIter endValueOn() const
Definition: LeafNode.h:340
const ValueType * data() const
Return a const pointer to the array of voxel values.
Definition: LeafBuffer.h:347
static Index getValueLevel(const Coord &)
Return the level (i.e., 0) at which leaf node values reside.
Definition: LeafNode.h:426
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:1263
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:507
Definition: NodeMasks.h:270
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition: LeafNode.h:731
bool isValueOff(Index offset) const
Return true if the voxel at the given offset is inactive.
Definition: LeafNode.h:513
ChildAllCIter endChildAll() const
Definition: LeafNode.h:368
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
ChildAllCIter cendChildAll() const
Definition: LeafNode.h:367
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:467
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:754
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1120
static Index32 childCount()
Return the child count for this node, which is zero.
Definition: LeafNode.h:140
Definition: LeafNode.h:212
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNode.h:773
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:913
ValueAllCIter beginValueAll() const
Definition: LeafNode.h:336
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition: AttributeTransferUtil.h:141
Definition: PointDataGrid.h:171
Definition: Compression.h:55
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:1747
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:439
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNode.h:170
ValueOffCIter beginValueOff() const
Definition: LeafNode.h:333
void setValueMaskOn(Index n)
Definition: LeafNode.h:922
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:275
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:1154
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNode.h:776
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNode.h:155
bool resultIsActive() const
Definition: Types.h:703
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNode.h:124
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218
SharedPtr< LeafNode > Ptr
Definition: LeafNode.h:46
void setValue(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNode.h:457
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1104
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1180
const ValueType & getLastValue() const
Return a const reference to the last value in the buffer.
Definition: LeafNode.h:663