4#ifndef OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED 
    5#define OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED 
   28template<Index Log2Dim>
 
   29class LeafNode<
bool, Log2Dim>
 
   32    using LeafNodeType = LeafNode<bool, Log2Dim>;
 
   33    using BuildType = 
bool;
 
   34    using ValueType = 
bool;
 
   35    using Buffer = LeafBuffer<ValueType, Log2Dim>;
 
   36    using NodeMaskType = util::NodeMask<Log2Dim>;
 
   37    using Ptr = SharedPtr<LeafNodeType>;
 
   40    static const Index LOG2DIM    = Log2Dim;    
 
   41    static const Index TOTAL      = Log2Dim;    
 
   42    static const Index DIM        = 1 << TOTAL; 
 
   43    static const Index NUM_VALUES = 1 << 3 * Log2Dim;
 
   44    static const Index NUM_VOXELS = NUM_VALUES; 
 
   45    static const Index SIZE       = NUM_VALUES;
 
   46    static const Index LEVEL      = 0;          
 
   50    template<
typename ValueType>
 
   55    template<
typename OtherNodeType>
 
   68    explicit LeafNode(
const Coord& xyz, 
bool value = 
false, 
bool active = 
false);
 
   74    LeafNode(
const LeafNode&);
 
   77    LeafNode& operator=(
const LeafNode&) = 
default;
 
   80    template<
typename OtherValueType>
 
   81    explicit LeafNode(
const LeafNode<OtherValueType, Log2Dim>& other);
 
   96    template<
typename ValueType>
 
   98    LeafNode(const LeafNode<ValueType, Log2Dim>& other, 
TopologyCopy);
 
  105    LeafNode(const 
Coord& xyz,
 
  106        const NodeMaskType& mask,
 
  112    template<typename ValueType>
 
  113    LeafNode(const LeafNode<ValueType, Log2Dim>& other, 
bool offValue, 
bool onValue, 
TopologyCopy);
 
  114    template<typename ValueType>
 
  115    LeafNode(const LeafNode<ValueType, Log2Dim>& other, 
bool background, 
TopologyCopy);
 
  125    static 
Index log2dim() { 
return Log2Dim; }
 
  127    static Index dim() { 
return DIM; }
 
  128    static Index size() { 
return SIZE; }
 
  129    static Index numValues() { 
return SIZE; }
 
  130    static Index getLevel() { 
return LEVEL; }
 
  131    static void getNodeLog2Dims(std::vector<Index>& dims) { dims.push_back(Log2Dim); }
 
  132    static Index getChildDim() { 
return 1; }
 
  134    static Index64 leafCount() { 
return 1; }
 
  136    void nodeCount(std::vector<Index64> &)
 const {}
 
  138    void nodeCount(std::vector<Index32> &)
 const {}
 
  139    static Index64 nonLeafCount() { 
return 0; }
 
  142    Index64 onVoxelCount()
 const { 
return mValueMask.countOn(); }
 
  144    Index64 offVoxelCount()
 const { 
return mValueMask.countOff(); }
 
  145    Index64 onLeafVoxelCount()
 const { 
return onVoxelCount(); }
 
  146    Index64 offLeafVoxelCount()
 const { 
return offVoxelCount(); }
 
  147    static Index64 onTileCount()  { 
return 0; }
 
  148    static Index64 offTileCount() { 
return 0; }
 
  151    bool isEmpty()
 const { 
return mValueMask.isOff(); }
 
  153    bool isDense()
 const { 
return mValueMask.isOn(); }
 
  157    bool isAllocated()
 const { 
return true; }
 
  170    void evalActiveBoundingBox(CoordBBox& bbox, 
bool visitVoxels = 
true) 
const;
 
  174    CoordBBox getNodeBoundingBox()
 const { 
return CoordBBox::createCube(mOrigin, DIM); }
 
  177    void setOrigin(
const Coord& origin) { mOrigin = origin; }
 
  180    const Coord& origin()
 const { 
return mOrigin; }
 
  181    void getOrigin(Coord& origin)
 const { origin = mOrigin; }
 
  182    void getOrigin(Int32& x, Int32& y, Int32& z)
 const { mOrigin.asXYZ(x, y, z); }
 
  186    static Index coordToOffset(
const Coord& xyz);
 
  189    static Coord offsetToLocalCoord(Index n);
 
  191    Coord offsetToGlobalCoord(Index n) 
const;
 
  194    Index32 transientData()
 const { 
return mTransientData; }
 
  196    void setTransientData(Index32 transientData) { mTransientData = transientData; }
 
  199    std::string str() 
const;
 
  203    template<
typename OtherType, Index OtherLog2Dim>
 
  204    bool hasSameTopology(
const LeafNode<OtherType, OtherLog2Dim>* other) 
const;
 
  215    void swap(Buffer& other) { mBuffer.swap(other); }
 
  216    const Buffer& buffer()
 const { 
return mBuffer; }
 
  217    Buffer& buffer() { 
return mBuffer; }
 
  223    void readTopology(std::istream&, 
bool fromHalf = 
false);
 
  225    void writeTopology(std::ostream&, 
bool toHalf = 
false) 
const;
 
  228    void readBuffers(std::istream&, 
bool fromHalf = 
false);
 
  229    void readBuffers(std::istream& is, 
const CoordBBox&, 
bool fromHalf = 
false);
 
  231    void writeBuffers(std::ostream&, 
bool toHalf = 
false) 
const;
 
  237    const bool& getValue(
const Coord& xyz) 
const;
 
  239    const bool& getValue(Index offset) 
const;
 
  244    bool probeValue(
const Coord& xyz, 
bool& val) 
const;
 
  248    bool probeValue(Index offset, 
bool& val) 
const;
 
  251    static Index getValueLevel(
const Coord&) { 
return LEVEL; }
 
  254    void setActiveState(
const Coord& xyz, 
bool on);
 
  256    void setActiveState(Index offset, 
bool on) { 
OPENVDB_ASSERT(offset<SIZE); mValueMask.set(offset, on); }
 
  259    void setValueOnly(
const Coord& xyz, 
bool val);
 
  261    void setValueOnly(Index offset, 
bool val) { 
OPENVDB_ASSERT(offset<SIZE); mBuffer.setValue(offset,val); }
 
  264    void setValueOff(
const Coord& xyz) { mValueMask.setOff(this->coordToOffset(xyz)); }
 
  266    void setValueOff(Index offset) { 
OPENVDB_ASSERT(offset < SIZE); mValueMask.setOff(offset); }
 
  269    void setValueOff(
const Coord& xyz, 
bool val);
 
  271    void setValueOff(Index offset, 
bool val);
 
  274    void setValueOn(
const Coord& xyz) { mValueMask.setOn(this->coordToOffset(xyz)); }
 
  276    void setValueOn(Index offset) { 
OPENVDB_ASSERT(offset < SIZE); mValueMask.setOn(offset); }
 
  279    void setValueOn(
const Coord& xyz, 
bool val);
 
  281    void setValue(
const Coord& xyz, 
bool val) { this->setValueOn(xyz, val); }
 
  283    void setValueOn(Index offset, 
bool val);
 
  287    template<
typename ModifyOp>
 
  288    void modifyValue(Index offset, 
const ModifyOp& op);
 
  291    template<
typename ModifyOp>
 
  292    void modifyValue(
const Coord& xyz, 
const ModifyOp& op);
 
  295    template<
typename ModifyOp>
 
  296    void modifyValueAndActiveState(
const Coord& xyz, 
const ModifyOp& op);
 
  299    void setValuesOn() { mValueMask.setOn(); }
 
  301    void setValuesOff() { mValueMask.setOff(); }
 
  304    bool isValueOn(
const Coord& xyz)
 const { 
return this->isValueOn(this->coordToOffset(xyz)); }
 
  306    bool isValueOn(Index offset)
 const { 
OPENVDB_ASSERT(offset < SIZE); 
return mValueMask.isOn(offset); }
 
  308    bool isValueOff(
const Coord& xyz)
 const { 
return this->isValueOff(this->coordToOffset(xyz)); }
 
  310    bool isValueOff(Index offset)
 const { 
OPENVDB_ASSERT(offset < SIZE); 
return mValueMask.isOff(offset); }
 
  313    static bool hasActiveTiles() { 
return false; }
 
  316    void clip(
const CoordBBox&, 
bool background);
 
  319    void fill(
const CoordBBox& bbox, 
bool value, 
bool active = 
true);
 
  321    void denseFill(
const CoordBBox& bbox, 
bool val, 
bool on = 
true) { this->fill(bbox, val, on); }
 
  324    void fill(
const bool& value);
 
  326    void fill(
const bool& value, 
bool active);
 
  339    template<
typename DenseT>
 
  340    void copyToDense(
const CoordBBox& bbox, DenseT& dense) 
const;
 
  358    template<
typename DenseT>
 
  359    void copyFromDense(
const CoordBBox& bbox, 
const DenseT& dense, 
bool background, 
bool tolerance);
 
  363    template<
typename AccessorT>
 
  364    const bool& getValueAndCache(
const Coord& xyz, AccessorT&)
 const {
return this->getValue(xyz);}
 
  368    template<
typename AccessorT>
 
  369    bool isValueOnAndCache(
const Coord& xyz, AccessorT&)
 const { 
return this->isValueOn(xyz); }
 
  373    template<
typename AccessorT>
 
  374    void setValueAndCache(
const Coord& xyz, 
bool val, AccessorT&) { this->setValueOn(xyz, val); }
 
  379    template<
typename AccessorT>
 
  380    void setValueOnlyAndCache(
const Coord& xyz, 
bool val, AccessorT&) {this->setValueOnly(xyz,val);}
 
  384    template<
typename AccessorT>
 
  385    void setValueOffAndCache(
const Coord& xyz, 
bool value, AccessorT&)
 
  387        this->setValueOff(xyz, value);
 
  393    template<
typename ModifyOp, 
typename AccessorT>
 
  394    void modifyValueAndCache(
const Coord& xyz, 
const ModifyOp& op, AccessorT&)
 
  396        this->modifyValue(xyz, op);
 
  401    template<
typename ModifyOp, 
typename AccessorT>
 
  402    void modifyValueAndActiveStateAndCache(
const Coord& xyz, 
const ModifyOp& op, AccessorT&)
 
  404        this->modifyValueAndActiveState(xyz, op);
 
  410    template<
typename AccessorT>
 
  411    void setActiveStateAndCache(
const Coord& xyz, 
bool on, AccessorT&)
 
  413        this->setActiveState(xyz, on);
 
  419    template<
typename AccessorT>
 
  420    bool probeValueAndCache(
const Coord& xyz, 
bool& val, AccessorT&)
 const 
  422        return this->probeValue(xyz, val);
 
  427    template<
typename AccessorT>
 
  428    static Index getValueLevelAndCache(
const Coord&, AccessorT&) { 
return LEVEL; }
 
  433    const bool& getFirstValue()
 const { 
if (mValueMask.isOn(0)) 
return Buffer::sOn; 
else return Buffer::sOff; }
 
  437    const bool& getLastValue()
 const { 
if (mValueMask.isOn(SIZE-1)) 
return Buffer::sOn; 
else return Buffer::sOff; }
 
  442    bool isConstant(
bool& constValue, 
bool& state, 
bool tolerance = 0) 
const;
 
  449    bool medianAll() 
const;
 
  457    Index medianOn(ValueType &value) 
const;
 
  465    Index medianOff(ValueType &value) 
const;
 
  468    bool isInactive()
 const { 
return mValueMask.isOff(); }
 
  477    const bool& getValueUnsafe(Index offset)
 const { 
return this->getValue(offset); }
 
  479    bool getValueUnsafe(Index offset, 
bool& value)
 const { 
return this->probeValue(offset, value); }
 
  481    void setActiveStateUnsafe(Index offset, 
bool on) { this->setActiveState(offset, on); }
 
  483    void setValueOnlyUnsafe(Index offset, 
const bool& value) { 
return this->setValueOnly(offset, value); }
 
  485    void setValueOnUnsafe(Index offset) { this->setValueOn(offset); }
 
  487    void setValueOnUnsafe(Index offset, 
const bool& value) { this->setValueOn(offset, value); }
 
  489    void setValueOffUnsafe(Index offset) { this->setValueOff(offset); }
 
  491    void setValueOffUnsafe(Index offset, 
const bool& value) { this->setValueOff(offset, value); }
 
  493    void resetBackground(
bool oldBackground, 
bool newBackground);
 
  495    void negate() { mBuffer.mData.toggle(); }
 
  497    template<MergePolicy Policy>
 
  498    void merge(
const LeafNode& other, 
bool bg = 
false, 
bool otherBG = 
false);
 
  499    template<MergePolicy Policy> 
void merge(
bool tileValue, 
bool tileActive);
 
  503    void voxelizeActiveTiles(
bool = 
true) {}
 
  511    template<
typename OtherType>
 
  512    void topologyUnion(
const LeafNode<OtherType, Log2Dim>& other, 
const bool preserveTiles = 
false);
 
  525    template<
typename OtherType>
 
  526    void topologyIntersection(
const LeafNode<OtherType, Log2Dim>& other, 
const bool&);
 
  539    template<
typename OtherType>
 
  540    void topologyDifference(
const LeafNode<OtherType, Log2Dim>& other, 
const bool&);
 
  542    template<
typename CombineOp>
 
  543    void combine(
const LeafNode& other, CombineOp& op);
 
  544    template<
typename CombineOp>
 
  545    void combine(
bool, 
bool valueIsActive, CombineOp& op);
 
  547    template<
typename CombineOp, 
typename OtherType >
 
  548    void combine2(
const LeafNode& other, 
const OtherType&, 
bool valueIsActive, CombineOp&);
 
  549    template<
typename CombineOp, 
typename OtherNodeT >
 
  550    void combine2(
bool, 
const OtherNodeT& other, 
bool valueIsActive, CombineOp&);
 
  551    template<
typename CombineOp, 
typename OtherNodeT >
 
  552    void combine2(
const LeafNode& b0, 
const OtherNodeT& b1, CombineOp&);
 
  556    void prune(
const ValueType&  = zeroVal<ValueType>()) {}
 
  557    void addLeaf(LeafNode*) {}
 
  558    template<
typename AccessorT>
 
  559    void addLeafAndCache(LeafNode*, AccessorT&) {}
 
  560    template<
typename NodeT>
 
  561    NodeT* stealNode(
const Coord&, 
const ValueType&, 
bool) { 
return nullptr; }
 
  562    template<
typename NodeT>
 
  563    NodeT* probeNode(
const Coord&) { 
return nullptr; }
 
  564    template<
typename NodeT>
 
  565    const NodeT* probeConstNode(
const Coord&)
 const { 
return nullptr; }
 
  566    template<
typename ArrayT> 
void getNodes(ArrayT&)
 const {}
 
  567    template<
typename ArrayT> 
void stealNodes(ArrayT&, 
const ValueType&, 
bool) {}
 
  570    void addTile(Index level, 
const Coord&, 
bool val, 
bool active);
 
  571    void addTile(Index offset, 
bool val, 
bool active);
 
  572    template<
typename AccessorT>
 
  573    void addTileAndCache(Index level, 
const Coord&, 
bool val, 
bool active, AccessorT&);
 
  577    LeafNode* touchLeaf(
const Coord&) { 
return this; }
 
  578    template<
typename AccessorT>
 
  579    LeafNode* touchLeafAndCache(
const Coord&, AccessorT&) { 
return this; }
 
  580    LeafNode* probeLeaf(
const Coord&) { 
return this; }
 
  581    template<
typename AccessorT>
 
  582    LeafNode* probeLeafAndCache(
const Coord&, AccessorT&) { 
return this; }
 
  583    template<
typename NodeT, 
typename AccessorT>
 
  584    NodeT* probeNodeAndCache(
const Coord&, AccessorT&)
 
  587        if (!(std::is_same<NodeT, LeafNode>::value)) 
return nullptr;
 
  588        return reinterpret_cast<NodeT*
>(
this);
 
  594    const LeafNode* probeLeaf(
const Coord&)
 const { 
return this; }
 
  595    template<
typename AccessorT>
 
  596    const LeafNode* probeLeafAndCache(
const Coord&, AccessorT&)
 const { 
return this; }
 
  597    const LeafNode* probeConstLeaf(
const Coord&)
 const { 
return this; }
 
  598    template<
typename AccessorT>
 
  599    const LeafNode* probeConstLeafAndCache(
const Coord&, AccessorT&)
 const { 
return this; }
 
  600    template<
typename NodeT, 
typename AccessorT>
 
  601    const NodeT* probeConstNodeAndCache(
const Coord&, AccessorT&)
 const 
  604        if (!(std::is_same<NodeT, LeafNode>::value)) 
return nullptr;
 
  605        return reinterpret_cast<const NodeT*
>(
this);
 
  614    using MaskOnIter = 
typename NodeMaskType::OnIterator;
 
  615    using MaskOffIter = 
typename NodeMaskType::OffIterator;
 
  616    using MaskDenseIter = 
typename NodeMaskType::DenseIterator;
 
  618    template<
typename MaskIterT, 
typename NodeT, 
typename ValueT>
 
  622        public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
 
  638        template<
typename ModifyOp>
 
  641        template<
typename ModifyOp>
 
 
  646    template<
typename MaskIterT, 
typename NodeT>
 
  655    template<
typename NodeT, 
typename ValueT>
 
  657        MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
 
 
  680    using ValueOnIter = ValueIter<MaskOnIter, LeafNode, const bool>;
 
  681    using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
 
  682    using ValueOffIter = ValueIter<MaskOffIter, LeafNode, const bool>;
 
  683    using ValueOffCIter = ValueIter<MaskOffIter, const LeafNode, const bool>;
 
  684    using ValueAllIter = ValueIter<MaskDenseIter, LeafNode, const bool>;
 
  685    using ValueAllCIter = ValueIter<MaskDenseIter, const LeafNode, const bool>;
 
  686    using ChildOnIter = ChildIter<MaskOnIter, LeafNode>;
 
  687    using ChildOnCIter = ChildIter<MaskOnIter, const LeafNode>;
 
  688    using ChildOffIter = ChildIter<MaskOffIter, LeafNode>;
 
  689    using ChildOffCIter = ChildIter<MaskOffIter, const LeafNode>;
 
  690    using ChildAllIter = DenseIter<LeafNode, bool>;
 
  691    using ChildAllCIter = DenseIter<const LeafNode, const bool>;
 
  693    ValueOnCIter  cbeginValueOn()
 const { 
return ValueOnCIter(mValueMask.beginOn(), 
this); }
 
  694    ValueOnCIter   beginValueOn()
 const { 
return ValueOnCIter(mValueMask.beginOn(), 
this); }
 
  695    ValueOnIter    beginValueOn() { 
return ValueOnIter(mValueMask.beginOn(), 
this); }
 
  696    ValueOffCIter cbeginValueOff()
 const { 
return ValueOffCIter(mValueMask.beginOff(), 
this); }
 
  697    ValueOffCIter  beginValueOff()
 const { 
return ValueOffCIter(mValueMask.beginOff(), 
this); }
 
  698    ValueOffIter   beginValueOff() { 
return ValueOffIter(mValueMask.beginOff(), 
this); }
 
  699    ValueAllCIter cbeginValueAll()
 const { 
return ValueAllCIter(mValueMask.beginDense(), 
this); }
 
  700    ValueAllCIter  beginValueAll()
 const { 
return ValueAllCIter(mValueMask.beginDense(), 
this); }
 
  701    ValueAllIter   beginValueAll() { 
return ValueAllIter(mValueMask.beginDense(), 
this); }
 
  703    ValueOnCIter  cendValueOn()
 const { 
return ValueOnCIter(mValueMask.endOn(), 
this); }
 
  704    ValueOnCIter   endValueOn()
 const { 
return ValueOnCIter(mValueMask.endOn(), 
this); }
 
  705    ValueOnIter    endValueOn() { 
return ValueOnIter(mValueMask.endOn(), 
this); }
 
  706    ValueOffCIter cendValueOff()
 const { 
return ValueOffCIter(mValueMask.endOff(), 
this); }
 
  707    ValueOffCIter  endValueOff()
 const { 
return ValueOffCIter(mValueMask.endOff(), 
this); }
 
  708    ValueOffIter   endValueOff() { 
return ValueOffIter(mValueMask.endOff(), 
this); }
 
  709    ValueAllCIter cendValueAll()
 const { 
return ValueAllCIter(mValueMask.endDense(), 
this); }
 
  710    ValueAllCIter  endValueAll()
 const { 
return ValueAllCIter(mValueMask.endDense(), 
this); }
 
  711    ValueAllIter   endValueAll() { 
return ValueAllIter(mValueMask.endDense(), 
this); }
 
  715    ChildOnCIter  cbeginChildOn()
 const { 
return ChildOnCIter(mValueMask.endOn(), 
this); }
 
  716    ChildOnCIter   beginChildOn()
 const { 
return ChildOnCIter(mValueMask.endOn(), 
this); }
 
  717    ChildOnIter    beginChildOn() { 
return ChildOnIter(mValueMask.endOn(), 
this); }
 
  718    ChildOffCIter cbeginChildOff()
 const { 
return ChildOffCIter(mValueMask.endOff(), 
this); }
 
  719    ChildOffCIter  beginChildOff()
 const { 
return ChildOffCIter(mValueMask.endOff(), 
this); }
 
  720    ChildOffIter   beginChildOff() { 
return ChildOffIter(mValueMask.endOff(), 
this); }
 
  721    ChildAllCIter cbeginChildAll()
 const { 
return ChildAllCIter(mValueMask.beginDense(), 
this); }
 
  722    ChildAllCIter  beginChildAll()
 const { 
return ChildAllCIter(mValueMask.beginDense(), 
this); }
 
  723    ChildAllIter   beginChildAll() { 
return ChildAllIter(mValueMask.beginDense(), 
this); }
 
  725    ChildOnCIter  cendChildOn()
 const { 
return ChildOnCIter(mValueMask.endOn(), 
this); }
 
  726    ChildOnCIter   endChildOn()
 const { 
return ChildOnCIter(mValueMask.endOn(), 
this); }
 
  727    ChildOnIter    endChildOn() { 
return ChildOnIter(mValueMask.endOn(), 
this); }
 
  728    ChildOffCIter cendChildOff()
 const { 
return ChildOffCIter(mValueMask.endOff(), 
this); }
 
  729    ChildOffCIter  endChildOff()
 const { 
return ChildOffCIter(mValueMask.endOff(), 
this); }
 
  730    ChildOffIter   endChildOff() { 
return ChildOffIter(mValueMask.endOff(), 
this); }
 
  731    ChildAllCIter cendChildAll()
 const { 
return ChildAllCIter(mValueMask.endDense(), 
this); }
 
  732    ChildAllCIter  endChildAll()
 const { 
return ChildAllCIter(mValueMask.endDense(), 
this); }
 
  733    ChildAllIter   endChildAll() { 
return ChildAllIter(mValueMask.endDense(), 
this); }
 
  738    bool isValueMaskOn(Index n)
 const { 
return mValueMask.isOn(n); }
 
  739    bool isValueMaskOn()
 const { 
return mValueMask.isOn(); }
 
  740    bool isValueMaskOff(Index n)
 const { 
return mValueMask.isOff(n); }
 
  741    bool isValueMaskOff()
 const { 
return mValueMask.isOff(); }
 
  742    const NodeMaskType& getValueMask()
 const { 
return mValueMask; }
 
  743    const NodeMaskType& valueMask()
 const { 
return mValueMask; }
 
  744    NodeMaskType& getValueMask() { 
return mValueMask; }
 
  745    void setValueMask(
const NodeMaskType& mask) { mValueMask = mask; }
 
  746    bool isChildMaskOn(Index)
 const { 
return false; } 
 
  747    bool isChildMaskOff(Index)
 const { 
return true; }
 
  748    bool isChildMaskOff()
 const { 
return true; }
 
  750    void setValueMask(Index n, 
bool on) { mValueMask.set(n, on); }
 
  751    void setValueMaskOn(Index n)  { mValueMask.setOn(n); }
 
  752    void setValueMaskOff(Index n) { mValueMask.setOff(n); }
 
  755    static void evalNodeOrigin(Coord& xyz) { xyz &= ~(DIM - 1); }
 
  758    NodeMaskType mValueMask;
 
  769    template<
typename, Index> 
friend class LeafNode;
 
  771    friend struct ValueIter<MaskOnIter, LeafNode, 
bool>;
 
  772    friend struct ValueIter<MaskOffIter, LeafNode, 
bool>;
 
  773    friend struct ValueIter<MaskDenseIter, LeafNode, 
bool>;
 
  774    friend struct ValueIter<MaskOnIter, const LeafNode, 
bool>;
 
  775    friend struct ValueIter<MaskOffIter, const LeafNode, 
bool>;
 
  776    friend struct ValueIter<MaskDenseIter, const LeafNode, 
bool>;
 
  781    friend class IteratorBase<MaskOnIter, LeafNode>;
 
  782    friend class IteratorBase<MaskOffIter, LeafNode>;
 
  783    friend class IteratorBase<MaskDenseIter, LeafNode>;
 
  792template<Index Log2Dim>
 
  794LeafNode<bool, Log2Dim>::LeafNode()
 
  800template<Index Log2Dim>
 
  805    , mOrigin(xyz & (~(
DIM - 1)))
 
 
  810template<Index Log2Dim>
 
  815    , mOrigin(xyz & (~(
DIM - 1)))
 
 
  823template<Index Log2Dim>
 
  826    : mValueMask(other.valueMask())
 
  827    , mBuffer(other.mBuffer)
 
  828    , mOrigin(other.mOrigin)
 
  829    , mTransientData(other.mTransientData)
 
  835template<Index Log2Dim>
 
  836template<
typename ValueT>
 
  841    , mTransientData(other.mTransientData)
 
  845        static inline bool convertValue(
const ValueT& val) { 
return bool(val); }
 
  849         mBuffer.setValue(i, Local::convertValue(other.mBuffer[i]));
 
 
  854template<Index Log2Dim>
 
  855template<
typename ValueT>
 
  860    , mBuffer(background)
 
  862    , mTransientData(other.mTransientData)
 
 
  867template<Index Log2Dim>
 
  868template<
typename ValueT>
 
  874    , mTransientData(other.mTransientData)
 
 
  878template<Index Log2Dim>
 
  886    , mOrigin(xyz & (~(
DIM - 1)))
 
  887    , mTransientData(trans)
 
 
  891template<Index Log2Dim>
 
  892template<
typename ValueT>
 
  899    , mTransientData(other.mTransientData)
 
  902        if (mValueMask.isOn(i)) {
 
  903            mBuffer.setValue(i, onValue);
 
 
  909template<Index Log2Dim>
 
  919template<Index Log2Dim>
 
  924    return sizeof(*this);
 
  928template<Index Log2Dim>
 
  933    return sizeof(*this);
 
  937template<Index Log2Dim>
 
  941    CoordBBox this_bbox = this->getNodeBoundingBox();
 
  942    if (bbox.isInside(this_bbox)) 
return;
 
  943    if (ValueOnCIter iter = this->cbeginValueOn()) {
 
  946            for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
 
  947            this_bbox.translate(this->origin());
 
  949        bbox.expand(this_bbox);
 
  954template<Index Log2Dim>
 
  955template<
typename OtherType, Index OtherLog2Dim>
 
  960    return (Log2Dim == OtherLog2Dim && mValueMask == other->getValueMask());
 
  964template<Index Log2Dim>
 
  968    std::ostringstream ostr;
 
  969    ostr << 
"LeafNode @" << mOrigin << 
": ";
 
  970    for (
Index32 n = 0; n < SIZE; ++n) ostr << (mValueMask.isOn(n) ? 
'#' : 
'.');
 
  978template<Index Log2Dim>
 
  982    OPENVDB_ASSERT((xyz[0] & (DIM-1u)) < DIM && (xyz[1] & (DIM-1u)) < DIM && (xyz[2] & (DIM-1u)) < DIM);
 
  983    return ((xyz[0] & (DIM-1u)) << 2*Log2Dim)
 
  984         + ((xyz[1] & (DIM-1u)) << Log2Dim)
 
  985         +  (xyz[2] & (DIM-1u));
 
  989template<Index Log2Dim>
 
  995    xyz.setX(n >> 2*Log2Dim);
 
  996    n &= ((1 << 2*Log2Dim) - 1);
 
  997    xyz.setY(n >> Log2Dim);
 
  998    xyz.setZ(n & ((1 << Log2Dim) - 1));
 
 1003template<Index Log2Dim>
 
 1007    return (this->offsetToLocalCoord(n) + this->origin());
 
 1014template<Index Log2Dim>
 
 1018    mValueMask.load(is);
 
 1022template<Index Log2Dim>
 
 1026    mValueMask.save(os);
 
 1030template<Index Log2Dim>
 
 1037    this->readBuffers(is, fromHalf);
 
 1040    bool background = 
false;
 
 1042        background = *
static_cast<const bool*
>(bgPtr);
 
 1044    this->
clip(clipBBox, background);
 
 1048template<Index Log2Dim>
 
 1053    mValueMask.load(is);
 
 1059        mBuffer.mData.load(is);
 
 1064        int8_t numBuffers = 0;
 
 1065        is.read(
reinterpret_cast<char*
>(&numBuffers), 
sizeof(int8_t));
 
 1069        std::unique_ptr<bool[]> buf{
new bool[SIZE]};
 
 1073        mBuffer.mData.setOff();
 
 1074        for (
Index i = 0; i < SIZE; ++i) {
 
 1075            if (buf[i]) mBuffer.mData.setOn(i);
 
 1078        if (numBuffers > 1) {
 
 1081            for (
int i = 1; i < numBuffers; ++i) {
 
 1089template<Index Log2Dim>
 
 1094    mValueMask.save(os);
 
 1096    os.write(
reinterpret_cast<const char*
>(&mOrigin), 
sizeof(
Coord::ValueType) * 3);
 
 1098    mBuffer.mData.save(os);
 
 1105template<Index Log2Dim>
 
 1109    return mOrigin == other.mOrigin &&
 
 1110           mValueMask == other.valueMask() &&
 
 1111           mBuffer == other.mBuffer;
 
 1115template<Index Log2Dim>
 
 1126template<Index Log2Dim>
 
 1130    if (!mValueMask.isConstant(state)) 
return false;
 
 1133    if (!tolerance && !(mBuffer.mData.isOn() || mBuffer.mData.isOff())) 
return false;
 
 1135    constValue = mBuffer.mData.isOn();
 
 1141template<Index Log2Dim>
 
 1145    const Index countTrue = mBuffer.mData.countOn();
 
 1146    return countTrue > (NUM_VALUES >> 1);
 
 1149template<Index Log2Dim>
 
 1153    const NodeMaskType tmp = mBuffer.mData & mValueMask;
 
 1154    const Index countTrueOn = tmp.countOn(), 
countOn = mValueMask.countOn();
 
 1155    state = countTrueOn > (NUM_VALUES >> 1);
 
 1159template<Index Log2Dim>
 
 1163    const NodeMaskType tmp = mBuffer.mData & (!mValueMask);
 
 1164    const Index countTrueOff = tmp.countOn(), countOff = mValueMask.countOff();
 
 1165    state = countTrueOff > (NUM_VALUES >> 1);
 
 1172template<Index Log2Dim>
 
 1176    this->addTile(this->coordToOffset(xyz), val, active);
 
 1179template<Index Log2Dim>
 
 1184    this->setValueOnly(offset, val);
 
 1185    this->setActiveState(offset, active);
 
 1188template<Index Log2Dim>
 
 1189template<
typename AccessorT>
 
 1192    bool val, 
bool active, AccessorT&)
 
 1194    this->
addTile(level, xyz, val, active);
 
 
 1201template<Index Log2Dim>
 
 1206    if (mBuffer.mData.isOn(this->coordToOffset(xyz))) 
return Buffer::sOn; 
else return Buffer::sOff;
 
 1210template<Index Log2Dim>
 
 1216    if (mBuffer.mData.isOn(offset)) 
return Buffer::sOn; 
else return Buffer::sOff;
 
 1220template<Index Log2Dim>
 
 1224    return this->probeValue(this->coordToOffset(xyz), val);
 
 1227template<Index Log2Dim>
 
 1232    val = mBuffer.mData.isOn(offset);
 
 1233    return mValueMask.isOn(offset);
 
 1236template<Index Log2Dim>
 
 1240    this->setValueOn(this->coordToOffset(xyz), val);
 
 1244template<Index Log2Dim>
 
 1249    mValueMask.setOn(offset);
 
 1250    mBuffer.mData.set(offset, val);
 
 1254template<Index Log2Dim>
 
 1258    this->setValueOnly(this->coordToOffset(xyz), val);
 
 1262template<Index Log2Dim>
 
 1266    mValueMask.set(this->coordToOffset(xyz), on);
 
 1270template<Index Log2Dim>
 
 1274    this->setValueOff(this->coordToOffset(xyz), val);
 
 1278template<Index Log2Dim>
 
 1283    mValueMask.setOff(offset);
 
 1284    mBuffer.mData.set(offset, val);
 
 1288template<Index Log2Dim>
 
 1289template<
typename ModifyOp>
 
 1293    bool val = mBuffer.mData.isOn(offset);
 
 1295    mBuffer.mData.set(offset, val);
 
 1296    mValueMask.setOn(offset);
 
 1300template<Index Log2Dim>
 
 1301template<
typename ModifyOp>
 
 1305    this->modifyValue(this->coordToOffset(xyz), op);
 
 1309template<Index Log2Dim>
 
 1310template<
typename ModifyOp>
 
 1314    const Index offset = this->coordToOffset(xyz);
 
 1315    bool val = mBuffer.mData.isOn(offset), state = mValueMask.isOn(offset);
 
 1317    mBuffer.mData.set(offset, val);
 
 1318    mValueMask.set(offset, state);
 
 1325template<Index Log2Dim>
 
 1329    if (newBackground != oldBackground) {
 
 1331        NodeMaskType bgMask = !(mBuffer.mData | mValueMask);
 
 1333        mBuffer.mData = (mBuffer.mData & mValueMask) | bgMask;
 
 1341template<Index Log2Dim>
 
 1342template<MergePolicy Policy>
 
 1350        if (mValueMask.isOff(n)) {
 
 1351            mBuffer.mData.set(n, other.mBuffer.mData.isOn(n));
 
 1352            mValueMask.setOn(n);
 
 
 1358template<Index Log2Dim>
 
 1359template<MergePolicy Policy>
 
 1365    if (!tileActive) 
return;
 
 1367    if (tileValue) mBuffer.mData |= !mValueMask; 
 
 1368    else mBuffer.mData &= mValueMask;            
 
 
 1377template<Index Log2Dim>
 
 1378template<
typename OtherType>
 
 1382    mValueMask |= other.valueMask();
 
 1386template<Index Log2Dim>
 
 1387template<
typename OtherType>
 
 1392    mValueMask &= other.valueMask();
 
 
 1396template<Index Log2Dim>
 
 1397template<
typename OtherType>
 
 1402    mValueMask &= !other.valueMask();
 
 
 1409template<Index Log2Dim>
 
 1413    CoordBBox nodeBBox = this->getNodeBoundingBox();
 
 1416        this->fill(nodeBBox, background, 
false);
 
 1417    } 
else if (clipBBox.
isInside(nodeBBox)) {
 
 1429    int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
 
 1430    for (x = nodeBBox.
min().
x(); x <= nodeBBox.
max().
x(); ++x) {
 
 1431        for (y = nodeBBox.
min().
y(); y <= nodeBBox.
max().
y(); ++y) {
 
 1432            for (z = nodeBBox.
min().
z(); z <= nodeBBox.
max().
z(); ++z) {
 
 1433                mask.setOn(
static_cast<Index32>(this->coordToOffset(xyz)));
 
 1440    for (MaskOffIter maskIter = mask.beginOff(); maskIter; ++maskIter) {
 
 1441        this->setValueOff(maskIter.pos(), background);
 
 1449template<Index Log2Dim>
 
 1453    auto clippedBBox = this->getNodeBoundingBox();
 
 1454    clippedBBox.intersect(bbox);
 
 1455    if (!clippedBBox) 
return;
 
 1457    for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
 
 1458        const Index offsetX = (x & (DIM-1u))<<2*Log2Dim;
 
 1459        for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
 
 1460            const Index offsetXY = offsetX + ((y & (DIM-1u))<<  Log2Dim);
 
 1461            for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
 
 1462                const Index offset = offsetXY + (z & (DIM-1u));
 
 1463                mValueMask.set(offset, active);
 
 1464                mBuffer.mData.set(offset, value);
 
 1470template<Index Log2Dim>
 
 1474    mBuffer.fill(value);
 
 1477template<Index Log2Dim>
 
 1481    mBuffer.fill(value);
 
 1482    mValueMask.set(active);
 
 1489template<Index Log2Dim>
 
 1490template<
typename DenseT>
 
 1494    using DenseValueType = 
typename DenseT::ValueType;
 
 1496    const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
 
 1497    const Coord& 
min = dense.bbox().min();
 
 1498    DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]); 
 
 1499    const Int32 n0 = bbox.min()[2] & (DIM-1u);
 
 1500    for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
 
 1501        DenseValueType* t1 = t0 + xStride * (x - 
min[0]);
 
 1502        const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM);
 
 1503        for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
 
 1504            DenseValueType* t2 = t1 + yStride * (y - 
min[1]);
 
 1505            Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM);
 
 1506            for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
 
 1507                *t2 = DenseValueType(mBuffer.mData.isOn(n2++));
 
 1514template<Index Log2Dim>
 
 1515template<
typename DenseT>
 
 1518                                       bool background, 
bool tolerance)
 
 1520    using DenseValueType = 
typename DenseT::ValueType;
 
 1522        inline static bool toBool(
const DenseValueType& v) { 
return !
math::isZero(v); }
 
 1525    const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
 
 1526    const Coord& min = dense.bbox().min();
 
 1527    const DenseValueType* s0 = dense.data() + zStride * (bbox.
min()[2] - min[2]); 
 
 1529    for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
 
 1530        const DenseValueType* s1 = s0 + xStride * (x - min[0]);
 
 1532        for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
 
 1533            const DenseValueType* s2 = s1 + yStride * (y - min[1]);
 
 1535            for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
 
 1537                if (tolerance || (background == Local::toBool(*s2))) {
 
 1538                    mValueMask.setOff(n2);
 
 1539                    mBuffer.mData.set(n2, background);
 
 1541                    mValueMask.setOn(n2);
 
 1542                    mBuffer.mData.set(n2, Local::toBool(*s2));
 
 
 1553template<Index Log2Dim>
 
 1554template<
typename CombineOp>
 
 1559    for (
Index i = 0; i < SIZE; ++i) {
 
 1560        bool result = 
false, aVal = mBuffer.mData.isOn(i), bVal = other.mBuffer.mData.isOn(i);
 
 1567        mBuffer.mData.set(i, result);
 
 1572template<Index Log2Dim>
 
 1573template<
typename CombineOp>
 
 1580        bool result = 
false, aVal = mBuffer.mData.isOn(i);
 
 1585        mBuffer.mData.set(i, result);
 
 
 1593template<Index Log2Dim>
 
 1594template<
typename CombineOp, 
typename OtherType>
 
 1597    bool valueIsActive, CombineOp& op)
 
 1601    for (
Index i = 0; i < SIZE; ++i) {
 
 1602        bool result = 
false, aVal = other.mBuffer.mData.isOn(i);
 
 1607        mBuffer.mData.set(i, result);
 
 1612template<Index Log2Dim>
 
 1613template<
typename CombineOp, 
typename OtherNodeT>
 
 1616    bool valueIsActive, CombineOp& op)
 
 1621        bool result = 
false, bVal = other.mBuffer.mData.isOn(i);
 
 1626        mBuffer.mData.set(i, result);
 
 
 1631template<Index Log2Dim>
 
 1632template<
typename CombineOp, 
typename OtherNodeT>
 
 1637    for (
Index i = 0; i < SIZE; ++i) {
 
 1639        mValueMask.set(i, b0.valueMask().isOn(i) || b1.valueMask().isOn(i));
 
 1641        bool result = 
false, b0Val = b0.mBuffer.mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
 
 1648        mBuffer.mData.set(i, result);
 
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition Types.h:569
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition Types.h:621
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition Types.h:637
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition Types.h:625
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition Types.h:623
bool resultIsActive() const
Definition Types.h:632
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition Types.h:635
Int32 ValueType
Definition Coord.h:33
Tag dispatch class that distinguishes constructors during file input.
Definition Types.h:689
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:683
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:252
const Coord & min() const
Definition Coord.h:324
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition Coord.h:415
const Coord & max() const
Definition Coord.h:325
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition Coord.h:403
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition Coord.h:447
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
Int32 y() const
Definition Coord.h:132
Int32 x() const
Definition Coord.h:131
Int32 z() const
Definition Coord.h:133
Index pos() const
Definition Iterator.h:60
LeafNode & parent() const
Definition Iterator.h:50
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition LeafNode.h:39
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition LeafNode.h:1050
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition LeafNode.h:1306
util::NodeMask< Log2Dim > NodeMaskType
Definition LeafNode.h:45
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
bool operator!=(const LeafNode &other) const
Definition LeafNode.h:204
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
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
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,...
Definition LeafNode.h:1727
LeafBuffer< ValueType, Log2Dim > Buffer
Definition LeafNode.h:43
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition LeafNode.h:1583
~LeafNode()
Destructor.
Definition LeafNode.h:1020
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition LeafNode.h:1298
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition LeafNode.h:1559
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition LeafNode.h:1610
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition LeafNode.h:1639
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition LeafNode.h:1541
const Coord & origin() const
Definition LeafNode.h:176
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition LeafNode.h:459
LeafNode(const Coord &xyz, bool value, bool active)
Definition LeafNodeBool.h:802
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,...
Definition LeafNode.h:1718
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
static const Index DIM
Definition LeafNode.h:51
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
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
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition LeafNode.h:1040
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition LeafNode.h:410
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
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition LeafNode.h:1432
void combine(const LeafNode &other, CombineOp &op)
Definition LeafNode.h:1751
Index64 memUsageIfLoaded() const
Definition LeafNode.h:1469
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition LeafNode.h:1791
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
const NodeMaskType & valueMask() const
Definition LeafNode.h:886
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition LeafNode.h:1334
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition LeafNode.h:1505
friend class LeafNode
Definition LeafNode.h:863
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition LeafNode.h:1064
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition LeafNode.h:1075
static const Index LOG2DIM
Definition LeafNode.h:49
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition LeafNode.h:1449
static const Index SIZE
Definition LeafNode.h:54
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition LeafNode.h:1479
void merge(const LeafNode &)
Definition LeafNode.h:1661
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition LeafNode.h:420
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition LeafNode.h:1627
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
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition LeafNode.h:1459
std::string str() const
Return a string representation of this node.
Definition LeafNode.h:1027
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:1091
OnMaskIterator< NodeMask > OnIterator
Definition NodeMasks.h:348
uint32_t countOn(uint64_t v)
Definition Util.h:622
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
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...
void readData(std::istream &is, T *data, Index count, uint32_t compression, DelayedLoadMetadata *metadata=nullptr, size_t metadataOffset=size_t(0))
Read data from a stream.
Definition Compression.h:248
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition Vec3.h:474
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition Math.h:337
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition Vec3.h:482
Definition TreeIterator.h:30
Index32 Index
Definition Types.h:54
@ OPENVDB_FILE_VERSION_BOOL_LEAF_OPTIMIZATION
Definition version.h.in:256
uint32_t Index32
Definition Types.h:52
int32_t Int32
Definition Types.h:56
uint64_t Index64
Definition Types.h:53
@ MERGE_NODES
Definition Types.h:508
@ MERGE_ACTIVE_STATES_AND_NODES
Definition Types.h:509
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition AttributeTransferUtil.h:141
Definition Exceptions.h:13
static pnanovdb_uint32_t allocate(pnanovdb_uint32_t *poffset, pnanovdb_uint32_t size, pnanovdb_uint32_t alignment)
Definition pnanovdb_validate_strides.h:20
typename std::remove_const< ValueT >::type NonConstValueType
Definition Iterator.h:184
DenseIteratorBase()
Definition Iterator.h:188
typename BaseT::NonConstValueType NonConstValueT
Definition LeafNode.h:264
DenseIteratorBase< MaskDenseIterator, DenseIter, LeafNode, void, bool > BaseT
Definition LeafNode.h:263
SparseIteratorBase< MaskOnIter, ValueIter, LeafNode, const bool > BaseT
Definition LeafNode.h:222
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNodeBool.h:651
ChildIter()
Definition LeafNodeBool.h:650
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition LeafNodeBool.h:665
DenseIter()
Definition LeafNodeBool.h:662
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition LeafNodeBool.h:663
typename BaseT::NonConstValueType NonConstValueT
Definition LeafNodeBool.h:660
DenseIteratorBase< MaskDenseIter, DenseIter, NodeT, void, ValueT > BaseT
Definition LeafNodeBool.h:659
void unsetItem(Index pos, const ValueT &val) const
Definition LeafNodeBool.h:676
SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a LeafNod...
Definition LeafNodeBool.h:56
static const bool value
Definition LeafNodeBool.h:57
ValueConverter<T>::Type is the type of a LeafNode having the same dimensions as this node but a diffe...
Definition LeafNodeBool.h:51
LeafNode< ValueType, Log2Dim > Type
Definition LeafNodeBool.h:51
void setItem(Index pos, bool value) const
Definition LeafNodeBool.h:633
void modifyValue(const ModifyOp &op) const
Definition LeafNodeBool.h:642
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNodeBool.h:627
const bool & getValue() const
Definition LeafNodeBool.h:630
const bool & getItem(Index pos) const
Definition LeafNodeBool.h:629
ValueIter()
Definition LeafNodeBool.h:626
void setValue(bool value) const
Definition LeafNodeBool.h:635
void modifyItem(Index n, const ModifyOp &op) const
Definition LeafNodeBool.h:639
SparseIteratorBase< MaskIterT, ValueIter, NodeT, ValueT > BaseT
Definition LeafNodeBool.h:624
static const bool value
Definition LeafNode.h:920
SparseIteratorBase()
Definition Iterator.h:122
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218