本文整理汇总了C++中OctreeElementPointer::isParentOf方法的典型用法代码示例。如果您正苦于以下问题:C++ OctreeElementPointer::isParentOf方法的具体用法?C++ OctreeElementPointer::isParentOf怎么用?C++ OctreeElementPointer::isParentOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OctreeElementPointer
的用法示例。
在下文中一共展示了OctreeElementPointer::isParentOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postRecursion
bool UpdateEntityOperator::postRecursion(OctreeElementPointer element) {
// Post-recursion is the unwinding process. For this operation, while we
// unwind we want to mark the path as being dirty if we changed it below.
// We might have two paths, one for the old entity and one for the new entity.
bool keepSearching = !_foundOld || !_foundNew;
bool subtreeContainsOld = subTreeContainsOldEntity(element);
bool subtreeContainsNew = subTreeContainsNewEntity(element);
// As we unwind, if we're in either of these two paths, we mark our element
// as dirty.
if ((_foundOld && subtreeContainsOld) ||
(_foundNew && subtreeContainsNew)) {
element->markWithChangedTime();
}
// It's not OK to prune if we have the potential of deleting the original containig element.
// because if we prune the containing element then new might end up reallocating the same memory later
// and that will confuse our logic.
//
// it's ok to prune if:
// 1) we're not removing the old
// 2) we are removing the old, but this subtree doesn't contain the old
// 3) we are removing the old, this subtree contains the old, but this element isn't a direct parent of _containingElement
if (!_removeOld || !subtreeContainsOld || !element->isParentOf(_containingElement)) {
EntityTreeElementPointer entityTreeElement = std::static_pointer_cast<EntityTreeElement>(element);
entityTreeElement->pruneChildren(); // take this opportunity to prune any empty leaves
}
return keepSearching; // if we haven't yet found it, keep looking
}