Example #1
0
void OctreeElement::deleteChildAtIndex(int childIndex) {
    OctreeElementPointer childAt = getChildAtIndex(childIndex);
    if (childAt) {
        childAt.reset();
        setChildAtIndex(childIndex, NULL);
        _isDirty = true;
        markWithChangedTime();

        // after deleting the child, check to see if we're a leaf
        if (isLeaf()) {
            _voxelNodeLeafCount++;
        }
    }
}
Example #2
0
void OctreeElement::deleteAllChildren() {
    // first delete all the OctreeElement objects...
    for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
        OctreeElementPointer childAt = getChildAtIndex(i);
        if (childAt) {
            childAt.reset();
        }
    }

    if (_childrenExternal) {
        // if the children_t union represents _children.external we need to delete it here
        for (int i = 0; i < NUMBER_OF_CHILDREN; i ++) {
            _externalChildren[i].reset();
        }
    }
}