当前位置: 首页>>代码示例>>C++>>正文


C++ EntityTreeElement::isLeaf方法代码示例

本文整理汇总了C++中EntityTreeElement::isLeaf方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityTreeElement::isLeaf方法的具体用法?C++ EntityTreeElement::isLeaf怎么用?C++ EntityTreeElement::isLeaf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntityTreeElement的用法示例。


在下文中一共展示了EntityTreeElement::isLeaf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: elementEncodeComplete

void EntityTreeElement::elementEncodeComplete(EncodeBitstreamParams& params, OctreeElementBag* bag) const {
    const bool wantDebug = false;
    
    if (wantDebug) {
        qDebug() << "EntityTreeElement::elementEncodeComplete() element:" << getAACube();
    }

    OctreeElementExtraEncodeData* extraEncodeData = params.extraEncodeData;
    assert(extraEncodeData); // EntityTrees always require extra encode data on their encoding passes
    assert(extraEncodeData->contains(this));

    EntityTreeElementExtraEncodeData* thisExtraEncodeData
                = static_cast<EntityTreeElementExtraEncodeData*>(extraEncodeData->value(this));

    // Note: this will be called when OUR element has finished running through encodeTreeBitstreamRecursion()
    // which means, it's possible that our parent element hasn't finished encoding OUR data... so
    // in this case, our children may be complete, and we should clean up their encode data...
    // but not necessarily cleanup our own encode data...
    //
    // If we're really complete here's what must be true...
    //    1) out own data must be complete
    //    2) the data for all our immediate children must be complete.
    // However, the following might also be the case...
    //    1) it's ok for our child trees to not yet be fully encoded/complete... 
    //       SO LONG AS... the our child's node is in the bag ready for encoding

    bool someChildTreeNotComplete = false;
    for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
        EntityTreeElement* childElement = getChildAtIndex(i);
        if (childElement) {

            // why would this ever fail???
            // If we've encoding this element before... but we're coming back a second time in an attempt to
            // encoud our parent... this might happen.
            if (extraEncodeData->contains(childElement)) {
                EntityTreeElementExtraEncodeData* childExtraEncodeData 
                                = static_cast<EntityTreeElementExtraEncodeData*>(extraEncodeData->value(childElement));
                                
                if (wantDebug) {
                    qDebug() << "checking child: " << childElement->getAACube();
                    qDebug() << "    childElement->isLeaf():" << childElement->isLeaf();
                    qDebug() << "    childExtraEncodeData->elementCompleted:" << childExtraEncodeData->elementCompleted;
                    qDebug() << "    childExtraEncodeData->subtreeCompleted:" << childExtraEncodeData->subtreeCompleted;
                }
                
                if (childElement->isLeaf() && childExtraEncodeData->elementCompleted) {
                    if (wantDebug) {
                        qDebug() << "    CHILD IS LEAF -- AND CHILD ELEMENT DATA COMPLETED!!!";
                    }
                    childExtraEncodeData->subtreeCompleted = true;
                }

                if (!childExtraEncodeData->elementCompleted || !childExtraEncodeData->subtreeCompleted) {
                    someChildTreeNotComplete = true;
                }
            }
        }
    }

    if (wantDebug) {
        qDebug() << "for this element: " << getAACube();
        qDebug() << "    WAS elementCompleted:" << thisExtraEncodeData->elementCompleted;
        qDebug() << "    WAS subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted;
    }
    
    thisExtraEncodeData->subtreeCompleted = !someChildTreeNotComplete;

    if (wantDebug) {
        qDebug() << "    NOW elementCompleted:" << thisExtraEncodeData->elementCompleted;
        qDebug() << "    NOW subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted;
    
        if (thisExtraEncodeData->subtreeCompleted) {
            qDebug() << "    YEAH!!!!! >>>>>>>>>>>>>> NOW subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted;
        }
    }
}
开发者ID:RyanDowne,项目名称:hifi,代码行数:76,代码来源:EntityTreeElement.cpp


注:本文中的EntityTreeElement::isLeaf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。