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>
227 ValueT&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
228 ValueT&
getValue()
const {
return this->parent().getValue(this->pos()); }
233 this->parent().setValueOnly(pos, value);
238 this->parent().setValueOnly(this->pos(), value);
242 template<
typename ModifyOp>
245 template<
typename ModifyOp>
246 void modifyValue(
const ModifyOp&
op)
const { this->parent().modifyValue(this->pos(), op); }
250 template<
typename MaskIterT,
typename NodeT,
typename TagT>
252 public SparseIteratorBase<MaskIterT, ChildIter<MaskIterT, NodeT, TagT>, NodeT, ValueType>
259 template<
typename NodeT,
typename ValueT,
typename TagT>
261 MaskDenseIterator, DenseIter<NodeT, ValueT, TagT>, NodeT, void, ValueT>
271 value = this->parent().getValue(pos);
282 this->parent().setValueOnly(pos, value);
357 void readTopology(std::istream& is,
bool fromHalf =
false);
361 void writeTopology(std::ostream& os,
bool toHalf =
false)
const;
366 void readBuffers(std::istream& is,
bool fromHalf =
false);
371 void readBuffers(std::istream& is,
const CoordBBox& bbox,
bool fromHalf =
false);
375 void writeBuffers(std::ostream& os,
bool toHalf =
false)
const;
377 size_t streamingSize(
bool toHalf =
false)
const;
383 const ValueType& getValue(
const Coord& xyz)
const;
390 bool probeValue(
const Coord& xyz,
ValueType& val)
const;
400 void setActiveState(
const Coord& xyz,
bool on);
405 void setValueOnly(
const Coord& xyz,
const ValueType& val);
410 void setValueOff(
const Coord& xyz) { mValueMask.setOff(LeafNode::coordToOffset(xyz)); }
415 void setValueOff(
const Coord& xyz,
const ValueType& val);
420 void setValueOn(
const Coord& xyz) { mValueMask.setOn(LeafNode::coordToOffset(xyz)); }
425 this->setValueOn(LeafNode::coordToOffset(xyz), val);
431 mBuffer.setValue(offset, val);
432 mValueMask.setOn(offset);
437 template<
typename ModifyOp>
440 mBuffer.loadValues();
441 if (!mBuffer.empty()) {
445 mValueMask.setOn(offset);
451 template<
typename ModifyOp>
454 this->modifyValue(this->coordToOffset(xyz), op);
458 template<
typename ModifyOp>
461 mBuffer.loadValues();
462 if (!mBuffer.empty()) {
463 const Index offset = this->coordToOffset(xyz);
464 bool state = mValueMask.isOn(offset);
468 mValueMask.set(offset, state);
493 void fill(
const CoordBBox& bbox,
const ValueType&,
bool active =
true);
497 this->fill(bbox, value, active);
503 void fill(
const ValueType& value,
bool active);
516 template<
typename DenseT>
517 void copyToDense(
const CoordBBox& bbox, DenseT& dense)
const;
535 template<
typename DenseT>
536 void copyFromDense(
const CoordBBox& bbox,
const DenseT& dense,
541 template<
typename AccessorT>
544 return this->getValue(xyz);
549 template<
typename AccessorT>
554 template<
typename AccessorT>
557 this->setValueOn(xyz, val);
563 template<
typename AccessorT>
566 this->setValueOnly(xyz, val);
572 template<
typename ModifyOp,
typename AccessorT>
575 this->modifyValue(xyz, op);
580 template<
typename ModifyOp,
typename AccessorT>
583 this->modifyValueAndActiveState(xyz, op);
588 template<
typename AccessorT>
591 this->setValueOff(xyz, value);
597 template<
typename AccessorT>
600 this->setActiveState(xyz, on);
606 template<
typename AccessorT>
609 return this->probeValue(xyz, val);
615 template<
typename AccessorT>
618 const Index offset = this->coordToOffset(xyz);
619 state = mValueMask.isOn(offset);
621 return mBuffer[offset];
626 template<
typename AccessorT>
647 template<MergePolicy Policy>
void merge(
const ValueType& tileValue,
bool tileActive);
648 template<MergePolicy Policy>
657 template<
typename OtherType>
671 template<
typename OtherType>
685 template<
typename OtherType>
688 template<
typename CombineOp>
690 template<
typename CombineOp>
693 template<
typename CombineOp,
typename OtherType >
694 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
695 template<
typename CombineOp,
typename OtherNodeT >
696 void combine2(
const ValueType&,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
697 template<
typename CombineOp,
typename OtherNodeT >
698 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
704 template<
typename AccessorT>
706 template<
typename NodeT>
708 template<
typename NodeT>
710 template<
typename NodeT>
712 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
718 template<
typename AccessorT>
719 void addTileAndCache(
Index,
const Coord&,
const ValueType&,
bool, AccessorT&);
724 template<
typename AccessorT>
726 template<
typename NodeT,
typename AccessorT>
730 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
731 return reinterpret_cast<NodeT*
>(
this);
735 template<
typename AccessorT>
741 template<
typename AccessorT>
743 template<
typename AccessorT>
746 template<
typename NodeT,
typename AccessorT>
750 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
751 return reinterpret_cast<const NodeT*
>(
this);
765 bool isConstant(
ValueType& firstValue,
bool& state,
766 const ValueType& tolerance = zeroVal<ValueType>())
const;
780 bool& state,
const ValueType& tolerance = zeroVal<ValueType>())
const;
858 friend class ::TestLeaf;
859 template<
typename>
friend class ::TestLeafIO;
896 inline void skipCompressedValues(
bool seekable, std::istream&,
bool fromHalf);
919 template<Index Dim1,
typename NodeT2>
922 template<Index Dim1,
typename T2>
930 template<
typename T, Index Log2Dim>
939 template<
typename T, Index Log2Dim>
944 mOrigin(xyz & (~(
DIM - 1)))
949 template<
typename T, Index Log2Dim>
954 mOrigin(xyz & (~(
DIM - 1)))
959 template<
typename T, Index Log2Dim>
962 : mBuffer(other.mBuffer)
964 , mOrigin(other.mOrigin)
965 , mTransientData(other.mTransientData)
971 template<
typename T, Index Log2Dim>
972 template<
typename OtherValueType>
976 , mOrigin(other.mOrigin)
977 , mTransientData(other.mTransientData)
981 static inline ValueType convertValue(
const OtherValueType& val) {
return ValueType(val); }
985 mBuffer[i] = Local::convertValue(other.mBuffer[i]);
990 template<
typename T, Index Log2Dim>
991 template<
typename OtherValueType>
995 : mBuffer(background)
997 , mOrigin(other.mOrigin)
998 , mTransientData(other.mTransientData)
1003 template<
typename T, Index Log2Dim>
1004 template<
typename OtherValueType>
1009 , mOrigin(other.mOrigin)
1010 , mTransientData(other.mTransientData)
1013 mBuffer[i] = (mValueMask.
isOn(i) ? onValue : offValue);
1018 template<
typename T, Index Log2Dim>
1025 template<
typename T, Index Log2Dim>
1029 std::ostringstream ostr;
1030 ostr <<
"LeafNode @" << mOrigin <<
": " << mBuffer;
1038 template<
typename T, Index Log2Dim>
1043 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
1044 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
1045 + (xyz[2] & (
DIM-1u));
1048 template<
typename T, Index Log2Dim>
1054 xyz.setX(n >> 2*Log2Dim);
1055 n &= ((1<<2*Log2Dim)-1);
1056 xyz.setY(n >> Log2Dim);
1057 xyz.setZ(n & ((1<<Log2Dim)-1));
1062 template<
typename T, Index Log2Dim>
1073 template<
typename ValueT, Index Log2Dim>
1074 inline const ValueT&
1080 template<
typename ValueT, Index Log2Dim>
1081 inline const ValueT&
1085 return mBuffer[offset];
1089 template<
typename T, Index Log2Dim>
1096 template<
typename T, Index Log2Dim>
1101 val = mBuffer[offset];
1102 return mValueMask.
isOn(offset);
1106 template<
typename T, Index Log2Dim>
1113 template<
typename T, Index Log2Dim>
1119 mValueMask.
setOff(offset);
1123 template<
typename T, Index Log2Dim>
1131 template<
typename T, Index Log2Dim>
1138 template<
typename T, Index Log2Dim>
1149 template<
typename T, Index Log2Dim>
1154 if (!clipBBox.hasOverlap(nodeBBox)) {
1156 this->
fill(background,
false);
1157 }
else if (clipBBox.isInside(nodeBBox)) {
1167 nodeBBox.intersect(clipBBox);
1169 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1170 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1171 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1172 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1189 template<
typename T, Index Log2Dim>
1196 clippedBBox.intersect(bbox);
1197 if (!clippedBBox)
return;
1199 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1200 const Index offsetX = (x & (
DIM-1u)) << 2*Log2Dim;
1201 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1202 const Index offsetXY = offsetX + ((y & (
DIM-1u)) << Log2Dim);
1203 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1204 const Index offset = offsetXY + (z & (
DIM-1u));
1205 mBuffer[offset] = value;
1206 mValueMask.
set(offset, active);
1212 template<
typename T, Index Log2Dim>
1216 mBuffer.
fill(value);
1219 template<
typename T, Index Log2Dim>
1223 mBuffer.
fill(value);
1224 mValueMask.
set(active);
1231 template<
typename T, Index Log2Dim>
1232 template<
typename DenseT>
1236 mBuffer.loadValues();
1238 using DenseValueType =
typename DenseT::ValueType;
1240 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1241 const Coord&
min = dense.bbox().min();
1242 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1243 const T* s0 = &mBuffer[bbox.min()[2] & (
DIM-1u)];
1244 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1245 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1246 const T* s1 = s0 + ((x & (
DIM-1u)) << 2*Log2Dim);
1247 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1248 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1249 const T* s2 = s1 + ((y & (
DIM-1u)) << Log2Dim);
1250 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1251 *t2 = DenseValueType(*s2++);
1258 template<
typename T, Index Log2Dim>
1259 template<
typename DenseT>
1266 using DenseValueType =
typename DenseT::ValueType;
1268 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1269 const Coord&
min = dense.bbox().min();
1271 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1272 const Int32 n0 = bbox.min()[2] & (
DIM-1u);
1273 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0]+1; x < ex; ++x) {
1274 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1276 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1]+1; y < ey; ++y) {
1277 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1279 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1282 mBuffer[n2] = background;
1284 mValueMask.
setOn(n2);
1296 template<
typename T, Index Log2Dim>
1300 mValueMask.
load(is);
1304 template<
typename T, Index Log2Dim>
1308 mValueMask.
save(os);
1316 template<
typename T, Index Log2Dim>
1322 io::readCompressedValues<ValueType, NodeMaskType>(
1323 is,
nullptr,
SIZE, mValueMask, fromHalf);
1332 template<
typename T, Index Log2Dim>
1336 this->
readBuffers(is, CoordBBox::inf(), fromHalf);
1340 template<
typename T, Index Log2Dim>
1345 const bool seekable = meta && meta->seekable();
1347 #ifdef OPENVDB_USE_DELAYED_LOADING 1348 std::streamoff maskpos = is.tellg();
1353 mValueMask.
seek(is);
1356 mValueMask.
load(is);
1359 int8_t numBuffers = 1;
1362 is.read(reinterpret_cast<char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1365 is.read(reinterpret_cast<char*>(&numBuffers),
sizeof(int8_t));
1369 if (!clipBBox.hasOverlap(nodeBBox)) {
1373 mBuffer.setOutOfCore(
false);
1375 #ifdef OPENVDB_USE_DELAYED_LOADING 1380 io::MappedFile::Ptr mappedFile = io::getMappedFilePtr(is);
1381 const bool delayLoad = ((mappedFile.get() !=
nullptr) && clipBBox.isInside(nodeBBox));
1384 mBuffer.setOutOfCore(
true);
1385 mBuffer.mFileInfo =
new typename Buffer::FileInfo;
1386 mBuffer.mFileInfo->meta = meta;
1387 mBuffer.mFileInfo->bufpos = is.tellg();
1388 mBuffer.mFileInfo->mapping = mappedFile;
1391 mBuffer.mFileInfo->maskpos = maskpos;
1398 mBuffer.setOutOfCore(
false);
1401 T background = zeroVal<T>();
1403 background = *
static_cast<const T*
>(bgPtr);
1405 this->
clip(clipBBox, background);
1406 #ifdef OPENVDB_USE_DELAYED_LOADING 1411 if (numBuffers > 1) {
1416 for (
int i = 1; i < numBuffers; ++i) {
1420 io::readData<T>(is, temp.mData,
SIZE, zipped);
1426 if (meta) meta->setLeaf(meta->leaf() + 1);
1430 template<
typename T, Index Log2Dim>
1435 mValueMask.
save(os);
1437 mBuffer.loadValues();
1447 template<
typename T, Index Log2Dim>
1451 return mOrigin == other.mOrigin &&
1453 mBuffer == other.mBuffer;
1457 template<
typename T, Index Log2Dim>
1463 return sizeof(*this) + mBuffer.
memUsage() -
sizeof(mBuffer);
1467 template<
typename T, Index Log2Dim>
1477 template<
typename T, Index Log2Dim>
1482 if (bbox.isInside(this_bbox))
return;
1486 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
1487 this_bbox.translate(this->
origin());
1489 bbox.expand(this_bbox);
1494 template<
typename T, Index Log2Dim>
1495 template<
typename OtherType, Index OtherLog2Dim>
1500 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
1503 template<
typename T, Index Log2Dim>
1509 if (!mValueMask.
isConstant(state))
return false;
1510 firstValue = mBuffer[0];
1517 template<
typename T, Index Log2Dim>
1524 if (!mValueMask.
isConstant(state))
return false;
1525 minValue = maxValue = mBuffer[0];
1527 const T& v = mBuffer[i];
1529 if ((maxValue - v) > tolerance)
return false;
1531 }
else if (v > maxValue) {
1532 if ((v - minValue) > tolerance)
return false;
1539 template<
typename T, Index Log2Dim>
1543 std::unique_ptr<T[]> data(
nullptr);
1544 if (tmp ==
nullptr) {
1548 if (tmp != mBuffer.
data()) {
1549 const T* src = mBuffer.
data();
1550 for (T* dst = tmp; dst-tmp <
NUM_VALUES;) *dst++ = *src++;
1552 static const size_t midpoint = (
NUM_VALUES - 1) >> 1;
1553 std::nth_element(tmp, tmp + midpoint, tmp +
NUM_VALUES);
1554 return tmp[midpoint];
1557 template<
typename T, Index Log2Dim>
1565 }
else if (count == 0) {
1568 std::unique_ptr<T[]> data(
nullptr);
1569 if (tmp ==
nullptr) {
1570 data.reset(
new T[count]);
1573 for (
auto iter=this->
cbeginValueOn(); iter; ++iter) *tmp++ = *iter;
1574 T *begin = tmp - count;
1575 const size_t midpoint = (count - 1) >> 1;
1576 std::nth_element(begin, begin + midpoint, tmp);
1577 value = begin[midpoint];
1581 template<
typename T, Index Log2Dim>
1589 }
else if (count == 0) {
1592 std::unique_ptr<T[]> data(
nullptr);
1593 if (tmp ==
nullptr) {
1594 data.reset(
new T[count]);
1597 for (
auto iter=this->
cbeginValueOff(); iter; ++iter) *tmp++ = *iter;
1598 T *begin = tmp - count;
1599 const size_t midpoint = (count - 1) >> 1;
1600 std::nth_element(begin, begin + midpoint, tmp);
1601 value = begin[midpoint];
1608 template<
typename T, Index Log2Dim>
1615 template<
typename T, Index Log2Dim>
1624 template<
typename T, Index Log2Dim>
1625 template<
typename AccessorT>
1628 const ValueType& val,
bool active, AccessorT&)
1630 this->
addTile(level, xyz, val, active);
1637 template<
typename T, Index Log2Dim>
1647 for (iter = this->mValueMask.
beginOff(); iter; ++iter) {
1650 inactiveValue = newBackground;
1658 template<
typename T, Index Log2Dim>
1659 template<MergePolicy Policy>
1668 for (; iter; ++iter) {
1670 if (mValueMask.
isOff(n)) {
1671 mBuffer[n] = other.mBuffer[n];
1672 mValueMask.
setOn(n);
1678 template<
typename T, Index Log2Dim>
1679 template<MergePolicy Policy>
1684 this->
template merge<Policy>(other);
1687 template<
typename T, Index Log2Dim>
1688 template<MergePolicy Policy>
1696 if (!tileActive)
return;
1699 const Index n = iter.pos();
1700 mBuffer[n] = tileValue;
1701 mValueMask.
setOn(n);
1707 template<
typename T, Index Log2Dim>
1708 template<
typename OtherType>
1715 template<
typename T, Index Log2Dim>
1716 template<
typename OtherType>
1724 template<
typename T, Index Log2Dim>
1725 template<
typename OtherType>
1733 template<
typename T, Index Log2Dim>
1740 mBuffer[i] = -mBuffer[i];
1748 template<
typename T, Index Log2Dim>
1749 template<
typename CombineOp>
1758 .setAIsActive(mValueMask.
isOn(i))
1759 .setBRef(other.mBuffer[i])
1761 .setResultRef(mBuffer[i]));
1767 template<
typename T, Index Log2Dim>
1768 template<
typename CombineOp>
1775 args.
setBRef(value).setBIsActive(valueIsActive);
1778 .setAIsActive(mValueMask.
isOn(i))
1779 .setResultRef(mBuffer[i]));
1788 template<
typename T, Index Log2Dim>
1789 template<
typename CombineOp,
typename OtherType>
1792 bool valueIsActive, CombineOp& op)
1797 args.
setBRef(value).setBIsActive(valueIsActive);
1801 .setResultRef(mBuffer[i]));
1807 template<
typename T, Index Log2Dim>
1808 template<
typename CombineOp,
typename OtherNodeT>
1811 bool valueIsActive, CombineOp& op)
1816 args.
setARef(value).setAIsActive(valueIsActive);
1819 .setBIsActive(other.valueMask().isOn(i))
1820 .setResultRef(mBuffer[i]));
1826 template<
typename T, Index Log2Dim>
1827 template<
typename CombineOp,
typename OtherNodeT>
1838 .setBRef(b1.mBuffer[i])
1839 .setBIsActive(b1.valueMask().isOn(i))
1840 .setResultRef(mBuffer[i]));
1849 template<
typename T, Index Log2Dim>
1850 inline std::ostream&
1851 operator<<(std::ostream& os, const typename LeafNode<T, Log2Dim>::Buffer& buf)
1853 for (
Index32 i = 0, N = buf.size(); i < N; ++i) os << buf.mData[i] <<
", ";
1871 #endif // OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED void seek(std::istream &is) const
Definition: NodeMasks.h:570
ValueAllIter endValueAll()
Definition: LeafNode.h:318
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition: Math.h:443
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:855
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:38
const LeafNode * probeLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNode.h:745
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:550
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:555
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1541
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:1334
Definition: LeafNode.h:213
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNode.h:725
ChildAllIter endChildAll()
Definition: LeafNode.h:340
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNode.h:269
static Index dim()
Return the number of voxels in each coordinate dimension.
Definition: LeafNode.h:120
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNode.h:712
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:300
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:459
bool isValueMaskOn() const
Definition: LeafNode.h:881
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:568
ValueOnCIter endValueOn() const
Definition: LeafNode.h:311
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1449
Index32 pos() const
Definition: NodeMasks.h:200
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:29
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:1234
LeafNode()
Default constructor.
Definition: LeafNode.h:932
void setItem(Index pos, const ValueT &value) const
Definition: LeafNode.h:231
ValueOnCIter beginValueOn() const
Definition: LeafNode.h:301
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1298
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNode.h:644
ValueIter()
Definition: LeafNode.h:224
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNode.h:705
Definition: LeafNode.h:23
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:438
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNode.h:744
Buffer & buffer()
Definition: LeafNode.h:349
uint64_t Index64
Definition: Types.h:53
bool resultIsActive() const
Definition: Types.h:632
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
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:1718
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:410
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:304
void setValueMaskOn(Index n)
Definition: LeafNode.h:893
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:1125
ValueOffCIter cendValueOff() const
Definition: LeafNode.h:313
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNode.h:581
ValueOffCIter cbeginValueOff() const
Definition: LeafNode.h:303
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNode.h:155
Index memUsageIfLoaded() const
Definition: LeafBuffer.h:337
static const Index DIM
Definition: LeafNode.h:51
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1751
ValueT & getValue() const
Definition: LeafNode.h:228
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:428
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1075
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:420
Definition: NodeMasks.h:270
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNode.h:742
void setValueMask(const NodeMaskType &mask)
Definition: LeafNode.h:887
bool isChildMaskOff() const
Definition: LeafNode.h:890
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:1261
Definition: NodeMasks.h:239
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNode.h:727
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1050
typename NodeMaskType::OnIterator MaskOnIterator
Definition: LeafNode.h:207
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition: LeafNode.h:1639
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
ValueOnCIter cendValueOn() const
Definition: LeafNode.h:310
void setValueOffUnsafe(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNode.h:853
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:847
bool isValueMaskOff(Index n) const
Definition: LeafNode.h:882
static const Index SIZE
Definition: LeafNode.h:54
void modifyValue(const ModifyOp &op) const
Definition: LeafNode.h:246
Index memUsage() const
Return the memory footprint of this buffer in bytes.
Definition: LeafBuffer.h:320
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNode.h:723
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNode.h:703
typename NodeMaskType::OffIterator MaskOffIterator
Definition: LeafNode.h:208
Definition: Compression.h:55
int32_t Int32
Definition: Types.h:56
const ValueType & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:542
static Index64 leafCount()
Return the leaf count for this node, which is one.
Definition: LeafNode.h:132
ValueOffIter beginValueOff()
Definition: LeafNode.h:305
Index32 Index
Definition: Types.h:54
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:176
Definition: LeafNode.h:213
void setValueOnUnsafe(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNode.h:849
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNode.h:475
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:616
Index32 transientData() const
Return the transient data value.
Definition: LeafNode.h:190
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:495
ValueOffIter endValueOff()
Definition: LeafNode.h:315
ValueOffCIter endValueOff() const
Definition: LeafNode.h:314
bool getValueUnsafe(Index offset, ValueType &value) const
Return true if the voxel at the given offset is active and set value.
Definition: LeafNode.h:843
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNode.h:473
void merge(const LeafNode &)
Definition: LeafNode.h:1661
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition: LeafNode.h:128
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1610
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:589
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1040
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1459
Definition: LeafNode.h:213
bool isChildMaskOff(Index) const
Definition: LeafNode.h:889
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:462
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:474
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1479
ChildAllCIter cbeginChildAll() const
Definition: LeafNode.h:328
static const Index LOG2DIM
Definition: LeafNode.h:49
ChildOnCIter endChildOn() const
Definition: LeafNode.h:333
ChildOnIter endChildOn()
Definition: LeafNode.h:334
T negative(const T &val)
Return the unary negation of the given value.
Definition: Math.h:128
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:204
Definition: LeafNode.h:212
ChildIter()
Definition: LeafNode.h:254
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:573
void setValueMask(Index n, bool on)
Definition: LeafNode.h:892
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNode.h:736
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:452
static Index64 offTileCount()
Definition: LeafNode.h:149
ChildOffCIter beginChildOff() const
Definition: LeafNode.h:326
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:623
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:1133
Definition: Compression.h:293
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1432
Definition: NodeMasks.h:208
ValueType ValueType
Definition: Iterator.h:117
Index64 onVoxelCount() const
Return the number of voxels marked On.
Definition: LeafNode.h:143
void readCompressedValues(std::istream &is, ValueT *destBuf, Index destCount, const MaskT &valueMask, bool fromHalf)
Definition: Compression.h:466
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:621
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:1727
ChildOffIter beginChildOff()
Definition: LeafNode.h:327
ChildOffCIter cendChildOff() const
Definition: LeafNode.h:335
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
const Buffer & buffer() const
Definition: LeafNode.h:348
#define OPENVDB_ASSERT(X)
Definition: Assert.h:41
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:1497
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition: LeafNode.h:130
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNode.h:899
ValueOnIter beginValueOn()
Definition: LeafNode.h:302
T BuildType
Definition: LeafNode.h:41
Leaf nodes have no children, so their child iterators have no get/set accessors.
Definition: LeafNode.h:251
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1306
static const Index NUM_VALUES
Definition: LeafNode.h:52
void skipCompressedValues(bool seekable, std::istream &, bool fromHalf)
Definition: LeafNode.h:1318
ChildOffCIter endChildOff() const
Definition: LeafNode.h:336
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:487
ChildOnCIter cbeginChildOn() const
Definition: LeafNode.h:322
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:347
ChildOnCIter beginChildOn() const
Definition: LeafNode.h:323
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNode.h:412
void negate()
Definition: LeafNode.h:1735
void setValue(Index i, const ValueType &)
Set the i'th value of this buffer to the specified value.
Definition: LeafBuffer.h:233
Definition: Exceptions.h:13
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNode.h:264
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1559
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:443
Definition: LeafNode.h:260
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNode.h:711
static Index64 onTileCount()
Definition: LeafNode.h:148
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNode.h:122
Definition: LeafNode.h:216
static Index log2dim()
Return log2 of the dimension of this LeafNode, e.g. 3 if dimensions are 8^3.
Definition: LeafNode.h:118
bool isValueMaskOn(Index n) const
Definition: LeafNode.h:880
bool isValueMaskOff() const
Definition: LeafNode.h:883
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:402
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1027
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:502
static Index getValueLevel(const Coord &)
Return the level (i.e., 0) at which leaf node values reside.
Definition: LeafNode.h:397
SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a LeafNod...
Definition: LeafNode.h:65
bool isConstant(bool &isOn) const
Definition: NodeMasks.h:526
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:424
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:478
ValueT & getItem(Index pos) const
Definition: LeafNode.h:227
void setValue(const ValueT &value) const
Definition: LeafNode.h:236
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1627
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNode.h:151
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition: LeafNode.h:702
ValueAllCIter cbeginValueAll() const
Definition: LeafNode.h:306
bool isValueOff(Index offset) const
Return true if the voxel at the given offset is inactive.
Definition: LeafNode.h:484
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNode.h:225
Index64 memUsageIfLoaded() const
Definition: LeafNode.h:1469
ChildAllIter beginChildAll()
Definition: LeafNode.h:330
ChildAllCIter endChildAll() const
Definition: LeafNode.h:339
DenseIter(const MaskDenseIterator &iter, NodeT *parent)
Definition: LeafNode.h:267
ChildAllCIter cendChildAll() const
Definition: LeafNode.h:338
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1091
OnIterator beginOn() const
Definition: NodeMasks.h:352
OffIterator beginOff() const
Definition: NodeMasks.h:354
static Index32 childCount()
Return the child count for this node, which is zero.
Definition: LeafNode.h:140
OPENVDB_API SharedPtr< StreamMetadata > getStreamMetadataPtr(std::ios_base &)
Return a shared pointer to an object that stores metadata (file format, compression scheme...
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:884
ValueAllCIter beginValueAll() const
Definition: LeafNode.h:307
uint32_t Index32
Definition: Types.h:52
Index64 offVoxelCount() const
Return the number of voxels marked Off.
Definition: LeafNode.h:145
Definition: LeafNode.h:212
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:1064
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:564
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...
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1505
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNode.h:747
ValueAllCIter cendValueAll() const
Definition: LeafNode.h:316
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:450
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNode.h:124
void unsetItem(Index pos, const ValueT &value) const
Definition: LeafNode.h:280
SharedPtr< LeafNode > Ptr
Definition: LeafNode.h:46
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:1710
ChildOffIter endChildOff()
Definition: LeafNode.h:337
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1151
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
const ValueType & getLastValue() const
Return a const reference to the last value in the buffer.
Definition: LeafNode.h:634
Definition: version.h.in:262
ChildOffCIter cbeginChildOff() const
Definition: LeafNode.h:325
static Index64 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition: LeafNode.h:138
bool allocate()
Allocate memory for this buffer if it has not already been allocated.
Definition: LeafBuffer.h:83
bool isDense() const
Return true if this node contains only active voxels.
Definition: LeafNode.h:153
const NodeMaskType & valueMask() const
Definition: LeafNode.h:886
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:430
ValueOnIter endValueOn()
Definition: LeafNode.h:312
ValueConverter<T>::Type is the type of a LeafNode having the same dimensions as this node but a diffe...
Definition: LeafNode.h:60
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNode.h:255
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNode.h:707
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:177
DenseIter()
Definition: LeafNode.h:266
const ValueType * data() const
Return a const pointer to the array of voxel values.
Definition: LeafBuffer.h:347
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition: LeafNode.h:126
const ValueType & getValueUnsafe(Index offset) const
Return the value of the voxel at the given offset.
Definition: LeafNode.h:841
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
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:845
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNode.h:627
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNode.h:422
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:683
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNode.h:713
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1583
ChildOnIter beginChildOn()
Definition: LeafNode.h:324
ValueAllIter beginValueAll()
Definition: LeafNode.h:308
T ValueType
Definition: LeafNode.h:42
LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNode.h:734
~LeafNode()
Destructor.
Definition: LeafNode.h:1020
void load(std::istream &is)
Definition: NodeMasks.h:569
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
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:607
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:598
const ValueType & getFirstValue() const
Return a const reference to the first value in the buffer.
Definition: LeafNode.h:632
ValueAllCIter endValueAll() const
Definition: LeafNode.h:317
void save(std::ostream &os) const
Definition: NodeMasks.h:565
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:457
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1791
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNode.h:709
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition: AttributeTransferUtil.h:141
bool isChildMaskOn(Index) const
Definition: LeafNode.h:888
Definition: LeafNode.h:212
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNode.h:243
ChildOnCIter cendChildOn() const
Definition: LeafNode.h:332
Definition: PointDataGrid.h:171
Index64 offLeafVoxelCount() const
Definition: LeafNode.h:147
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNode.h:832
bool isValueOff(const Coord &xyz) const
Return true if the voxel at the given coordinates is inactive.
Definition: LeafNode.h:482
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:178
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:851
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNode.h:740
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.
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:275
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:1191
void writeCompressedValues(std::ostream &os, ValueT *srcBuf, Index srcCount, const MaskT &valueMask, const MaskT &childMask, bool toHalf)
Definition: Compression.h:646
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:508
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNode.h:157
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:114
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:329
void setValueMaskOff(Index n)
Definition: LeafNode.h:894
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:689
NodeMaskType & getValueMask()
Definition: LeafNode.h:885
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNode.h:480