您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sortAllChildren函数代码示例

51自学网 2021-06-03 08:07:05
  C++
这篇教程C++ sortAllChildren函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sortAllChildren函数的典型用法代码示例。如果您正苦于以下问题:C++ sortAllChildren函数的具体用法?C++ sortAllChildren怎么用?C++ sortAllChildren使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: begin

void RenderTexture::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated){    if (_autoDraw)    {        //Begin will create a render group using new render target        begin();        //clear screen        _clearCommand.init(_globalZOrder);        _clearCommand.func = CC_CALLBACK_0(RenderTexture::onClear, this);        renderer->addCommand(&_clearCommand);        //! make sure all children are drawn        sortAllChildren();        for(const auto &child: _children)        {            if (child != _sprite)                child->visit(renderer, transform, transformUpdated);        }        //End will pop the current render group        end();    }}
开发者ID:253627764,项目名称:WagonWar,代码行数:25,


示例2: processParentFlags

void BatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible || !isVisitableByVisitingCamera())    {        return;    }    uint32_t flags = processParentFlags(parentTransform, parentFlags);    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    Director* director = Director::getInstance();    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    sortAllChildren();    draw(renderer, _modelViewTransform, flags);    // reset for next frame    _orderOfArrival = 0;    director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:fdmjyoshi3,项目名称:cocos2d-x,代码行数:25,


示例3: transform

void BatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    bool dirty = parentTransformUpdated || _transformUpdated;    if(dirty)        _modelViewTransform = transform(parentTransform);    _transformUpdated = false;    // IMPORTANT:    // To ease the migration to v3.0, we still support the kmGL stack,    // but it is deprecated and your code should not rely on it    kmGLPushMatrix();    kmGLLoadMatrix(&_modelViewTransform);    sortAllChildren();    draw(renderer, _modelViewTransform, dirty);    // reset for next frame    _orderOfArrival = 0;    kmGLPopMatrix();}
开发者ID:BellyWong,项目名称:EarthWarrior3D,代码行数:27,


示例4: CC_PROFILER_START_CATEGORY

// override visit// don't call visit on it's childrenvoid SpriteBatchNode::visit(void){    CC_PROFILER_START_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");    // CAREFUL:    // This visit is almost identical to CocosNode#visit    // with the exception that it doesn't call visit on it's children    //    // The alternative is to have a void Sprite#visit, but    // although this is less maintainable, is faster    //    if (! _visible)    {        return;    }    kmGLPushMatrix();    sortAllChildren();    transform();    draw();    kmGLPopMatrix();    setOrderOfArrival(0);    CC_PROFILER_STOP_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");}
开发者ID:6520874,项目名称:pipiGame,代码行数:30,


示例5: transform

void BatchNode::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    bool dirty = parentTransformUpdated || _transformUpdated;    if(dirty)        _modelViewTransform = transform(parentTransform);    _transformUpdated = false;    // IMPORTANT:    // To ease the migration to v3.0, we still support the Matrix stack,    // but it is deprecated and your code should not rely on it    Director* director = Director::getInstance();    CCASSERT(nullptr != director, "Director is null when seting matrix stack");    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    sortAllChildren();    draw(renderer, _modelViewTransform, dirty);    // reset for next frame    _orderOfArrival = 0;    director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:JeeLiu,项目名称:tutorial-puzzle,代码行数:29,


示例6: kmGLPushMatrix

void CCBatchNode::visit(){    m_drawOrder = ++g_drawOrder;    // quick return if not visible. children won't be drawn.    if (!m_bVisible)    {        return;    }    kmGLPushMatrix();    if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->beforeDraw();    }    transform();    sortAllChildren();    draw();    // reset for next frame    m_uOrderOfArrival = 0;    if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->afterDraw(this);    }    kmGLPopMatrix();}
开发者ID:13609594236,项目名称:quick-cocos2d-x,代码行数:30,


示例7: processParentFlags

void BatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    uint32_t flags = processParentFlags(parentTransform, parentFlags);    if (isVisitableByVisitingCamera())    {        // IMPORTANT:        // To ease the migration to v3.0, we still support the Mat4 stack,        // but it is deprecated and your code should not rely on it        Director* director = Director::getInstance();        director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);        director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);                sortAllChildren();        draw(renderer, _modelViewTransform, flags);                // FIX ME: Why need to set _orderOfArrival to 0??        // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920        // setOrderOfArrival(0);                director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    }}
开发者ID:DominicD,项目名称:Hyperdrive,代码行数:29,


示例8: processParentFlags

void CScrollView::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags){	// quick return if not visible	if (!isVisible())	{		return;	}	uint32_t flags = processParentFlags(parentTransform, parentFlags);	// IMPORTANT:	// To ease the migration to v3.0, we still support the Mat4 stack,	// but it is deprecated and your code should not rely on it	Director* director = Director::getInstance();	CCASSERT(nullptr != director, "Director is null when seting matrix stack");	director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);	director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);	this->beforeDraw();	if (!_children.empty())	{		int i=0;		sortAllChildren();		// draw children zOrder < 0		for( ; i < _children.size(); i++ )		{			Node *child = _children.at(i);			if ( child->getLocalZOrder() < 0 )			{				child->visit(renderer, _modelViewTransform, flags);			}			else			{				break;			}		}				// this draw		this->draw(renderer, _modelViewTransform, flags);		// draw children zOrder >= 0		for( ; i < _children.size(); i++ )		{			Node *child = _children.at(i);			child->visit(renderer, _modelViewTransform, flags);		}	}	else	{		this->draw(renderer, _modelViewTransform, flags);	}	this->afterDraw();	director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:110440,项目名称:Tui-x,代码行数:59,


示例9: isVisitableByVisitingCamera

void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    bool visibleByCamera = isVisitableByVisitingCamera();    // quick return if not visible by camera and has no children.    if (!visibleByCamera && _children.empty())    {        return;    }        uint32_t flags = processParentFlags(parentTransform, parentFlags);        //Add 3D flag so all the children will be rendered as 3D object    flags |= FLAGS_RENDER_AS_3D;        //Update Billboard transform    bool dirty = calculateBillboardTransform();    if(dirty)    {        flags |= FLAGS_TRANSFORM_DIRTY;    }        Director* director = Director::getInstance();    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);        int i = 0;        if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for(auto size = _children.size(); i < size; ++i)        {            auto node = _children.at(i);                        if (node && node->getLocalZOrder() < 0)                node->visit(renderer, _modelViewTransform, flags);            else                break;        }        // self draw        if (visibleByCamera)            this->draw(renderer, _modelViewTransform, flags);        for(auto it=_children.cbegin()+i, itCend = _children.cend(); it != itCend; ++it)            (*it)->visit(renderer, _modelViewTransform, flags);    }    else if (visibleByCamera)    {        this->draw(renderer, _modelViewTransform, flags);    }        director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:hugohuang1111,项目名称:Bird,代码行数:59,


示例10: processParentFlags

void BoneNode::visit(cocos2d::Renderer *renderer, const cocos2d::Mat4& parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    uint32_t flags = processParentFlags(parentTransform, parentFlags);    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    _director->pushMatrix(cocos2d::MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    _director->loadMatrix(cocos2d::MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    bool visibleByCamera = isVisitableByVisitingCamera();    bool isdebugdraw = visibleByCamera && _isRackShow && nullptr == _rootSkeleton;    int i = 0;    if (!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for (; i < _children.size(); i++)        {            auto node = _children.at(i);            if (_rootSkeleton != nullptr && _boneSkins.contains(node)) // skip skin when bone is in a skeleton                continue;            if (node && node->getLocalZOrder() < 0)                node->visit(renderer, _modelViewTransform, flags);            else                break;        }        // self draw        if (isdebugdraw)            this->draw(renderer, _modelViewTransform, flags);        for (auto it = _children.cbegin() + i; it != _children.cend(); ++it)        {            auto node = (*it);            if (_rootSkeleton != nullptr && _boneSkins.contains(node)) // skip skin when bone is in a skeleton                continue;            node->visit(renderer, _modelViewTransform, flags);        }    }    else if (isdebugdraw)    {        this->draw(renderer, _modelViewTransform, flags);    }    _director->popMatrix(cocos2d::MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    // FIX ME: Why need to set _orderOfArrival to 0??    // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920    // reset for next frame    // _orderOfArrival = 0;}
开发者ID:DominicD,项目名称:Hyperdrive,代码行数:58,


示例11: CCASSERT

void Node::visit(Renderer* renderer, const Mat4 &parentTransform, bool parentTransformUpdated){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    bool dirty = _transformUpdated || parentTransformUpdated;    if(dirty)        _modelViewTransform = this->transform(parentTransform);    _transformUpdated = false;    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    Director* director = Director::getInstance();    CCASSERT(nullptr != director, "Director is null when seting matrix stack");    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    int i = 0;    if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);            if ( node && node->_localZOrder < 0 )                node->visit(renderer, _modelViewTransform, dirty);            else                break;        }        // self draw        this->draw(renderer, _modelViewTransform, dirty);        for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit(renderer, _modelViewTransform, dirty);    }    else    {        this->draw(renderer, _modelViewTransform, dirty);    }       // reset for next frame    _orderOfArrival = 0;     director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    }
开发者ID:tuyuer,项目名称:actioneditor,代码行数:54,


示例12: kmGLPushMatrix

void CC3DSprite::visit( void ){	m_drawOrder = ++g_drawOrder;	// quick return if not visible. children won't be drawn.	if (!m_bVisible) return;	kmGLPushMatrix();	this->transform();	CCNode* pNode = NULL;	unsigned int i = 0;	if(m_pChildren && m_pChildren->count() > 0)	{		sortAllChildren();		// draw children zOrder < 0		ccArray *arrayData = m_pChildren->data;		for( ; i < arrayData->num; i++ )		{			pNode = (CCNode*) arrayData->arr[i];			if ( pNode && pNode->getZOrder() < 0 )			{				pNode->visit();			}			else			{				break;			}		}		// self draw		this->draw();		for( ; i < arrayData->num; i++ )		{			pNode = (CCNode*) arrayData->arr[i];			if (pNode)			{				pNode->visit();			}		}	}	else	{		this->draw();	}	// reset for next frame	m_uOrderOfArrival = 0;	kmGLPopMatrix();}
开发者ID:ElmerNing,项目名称:Cocos2d-x-ParticleEditor-for-Windows,代码行数:52,


示例13: kmGLPushMatrix

void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentTransformUpdated){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    bool dirty = _transformUpdated || parentTransformUpdated;    if(dirty)        _modelViewTransform = this->transform(parentTransform);    _transformUpdated = false;    // IMPORTANT:    // To ease the migration to v3.0, we still support the kmGL stack,    // but it is deprecated and your code should not rely on it    kmGLPushMatrix();    kmGLLoadMatrix(&_modelViewTransform);    int i = 0;    if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);            if ( node && node->_localZOrder < 0 )                node->visit(renderer, _modelViewTransform, dirty);            else                break;        }        // self draw        this->draw(renderer, _modelViewTransform, dirty);        for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit(renderer, _modelViewTransform, dirty);    }    else    {        this->draw(renderer, _modelViewTransform, dirty);    }    // reset for next frame    _orderOfArrival = 0;     kmGLPopMatrix();}
开发者ID:khanhbui,项目名称:ThreeDots,代码行数:51,


示例14: sortAllChildren

void CCNode::visit(){    // quick return if not visible. children won't be drawn.    if (!m_bVisible)    {        return;    }//    kmGLPushMatrix();    CCNode* pNode = NULL;    unsigned int i = 0;    if(m_Children.size() > 0)    {        sortAllChildren();        // draw children zOrder < 0		for( ; i < m_Children.size(); i++ )        {            pNode = (CCNode*) m_Children[i];            if ( pNode && pNode->m_nZOrder < 0 )             {                pNode->visit();            }            else            {                break;            }        }        // self draw        this->draw();        for( ; i < m_Children.size(); i++ )        {            pNode = (CCNode*) m_Children[i];            if (pNode)            {                pNode->visit();            }        }            }    else    {        this->draw();    }    //kmGLPopMatrix();}
开发者ID:yinjimmy,项目名称:opengles-practice,代码行数:48,


示例15: processParentFlags

void Sprite3D::visit(cocos2d::Renderer *renderer, const cocos2d::Mat4 &parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }        uint32_t flags = processParentFlags(parentTransform, parentFlags);    flags |= FLAGS_RENDER_AS_3D;        //    Director* director = Director::getInstance();    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);        bool visibleByCamera = isVisitableByVisitingCamera();        int i = 0;        if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);                        if (node && node->getLocalZOrder() < 0)                node->visit(renderer, _modelViewTransform, flags);            else                break;        }        // self draw        if (visibleByCamera)            this->draw(renderer, _modelViewTransform, flags);                for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit(renderer, _modelViewTransform, flags);    }    else if (visibleByCamera)    {        this->draw(renderer, _modelViewTransform, flags);    }        director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:HeavenWesker,项目名称:ContraGame,代码行数:47,


示例16: setShaderProgram

void IsometryNode::visit(){    //setPosition(CCPointMake(0, 500));    //CCNode::visit();    //Stats();    if(getShaderProgram() == nullptr)    {        setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));    }        CC_PROFILER_START_CATEGORY(kCCProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");        // CAREFUL:    // This visit is almost identical to CocosNode#visit    // with the exception that it doesn't call visit on it's children    //    // The alternative is to have a void CCSprite#visit, but    // although this is less maintainable, is faster    //    if (! m_bVisible)    {        return;    }        kmGLPushMatrix();        if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->beforeDraw();        transformAncestors();    }        sortAllChildren();    transform();    draw();        if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->afterDraw(this);    }        kmGLPopMatrix();    setOrderOfArrival(0);        CC_PROFILER_STOP_CATEGORY(kCCProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");}
开发者ID:track3r,项目名称:cocos2dx-autoBatchNode,代码行数:47,


示例17: kmGLPushMatrix

void BatchNode::visit(){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    kmGLPushMatrix();    transform();    sortAllChildren();    draw();    // reset for next frame    _orderOfArrival = 0;    kmGLPopMatrix();}
开发者ID:leanlyne,项目名称:ShootColorX,代码行数:18,


示例18: processParentFlags

void Node::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    uint32_t flags = processParentFlags(parentTransform, parentFlags);    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    _director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    _director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    int i = 0;    if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);            if (node && node->_localZOrder < 0)                node->visit(renderer, _modelViewTransform, flags);            else                break;        }        // self draw        this->draw(renderer, _modelViewTransform, flags);        for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit(renderer, _modelViewTransform, flags);    }    else    {        this->draw(renderer, _modelViewTransform, flags);    }    _director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:2youyou2,项目名称:cocos2d-x-lite,代码行数:44,


示例19: sortAllChildren

void Layout::doLayout(){        if (!_doLayoutDirty)    {        return;    }        sortAllChildren();    LayoutManager* executant = this->createLayoutManager();        if (executant)    {        executant->doLayout(this);    }        _doLayoutDirty = false;}
开发者ID:HeavenWesker,项目名称:ContraGame,代码行数:19,


示例20: CC_PROFILER_START_CATEGORY

// override visit// don't call visit on it's children// 是基类CCNode虚函数,是每帧会被调用到的函数。void CCSpriteBatchNode::visit(void){    CC_PROFILER_START_CATEGORY(kCCProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");    // CAREFUL:    // This visit is almost identical to CocosNode#visit    // with the exception that it doesn't call visit on it's children    //    // The alternative is to have a void CCSprite#visit, but    // although this is less maintainable, is faster    //	// 如果不显示,直接返回    if (! m_bVisible)    {        return;    }	//矩阵压栈,保存渲染此结点前的所有OpenGL所需矩阵的值     kmGLPushMatrix();    if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->beforeDraw();        transformAncestors();    }    sortAllChildren();	//矩阵变量    transform();	//基类CCNode虚函数,用于实现当前CCNode的绘制    draw();    if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->afterDraw(this);    }	//矩阵出栈。恢复渲染此结点前的所有OpenGL所需矩阵的值    kmGLPopMatrix();    setOrderOfArrival(0);    CC_PROFILER_STOP_CATEGORY(kCCProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");}
开发者ID:DionysosLai,项目名称:Coco2d-xRes,代码行数:45,


示例21: CC_PROFILER_START_CATEGORY

// override visit// don't call visit on it's childrenvoid SpriteBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){    CC_PROFILER_START_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");    // CAREFUL:    // This visit is almost identical to CocosNode#visit    // with the exception that it doesn't call visit on it's children    //    // The alternative is to have a void Sprite#visit, but    // although this is less maintainable, is faster    //    if (! _visible)    {        return;    }    sortAllChildren();    uint32_t flags = processParentFlags(parentTransform, parentFlags);    if (isVisitableByVisitingCamera())    {        // IMPORTANT:        // To ease the migration to v3.0, we still support the Mat4 stack,        // but it is deprecated and your code should not rely on it        Director* director = Director::getInstance();        director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);        director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);                draw(renderer, _modelViewTransform, flags);                director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);        // FIX ME: Why need to set _orderOfArrival to 0??        // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920        //    setOrderOfArrival(0);                CC_PROFILER_STOP_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");    }}
开发者ID:1414648814,项目名称:AStar-Cocos2dx,代码行数:41,


示例22: CC_PROFILER_START_CATEGORY

// override visit// don't call visit on it's childrenvoid CCSpriteBatchNode::visit(void){    CC_PROFILER_START_CATEGORY(kCCProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");    // CAREFUL:    // This visit is almost identical to CocosNode#visit    // with the exception that it doesn't call visit on it's children    //    // The alternative is to have a void CCSprite#visit, but    // although this is less maintainable, is faster    //    if (! m_bVisible)    {        return;    }    kmGLPushMatrix();    if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->beforeDraw();        transformAncestors();    }    sortAllChildren();    transform();    draw();    if (m_pGrid && m_pGrid->isActive())    {        m_pGrid->afterDraw(this);    }    kmGLPopMatrix();    CC_PROFILER_STOP_CATEGORY(kCCProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");}
开发者ID:Roncon93,项目名称:Dorothy,代码行数:41,


示例23: processParentFlags

void ShaderNode::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags){    if (!_visible)        return;        uint32_t flags = processParentFlags(parentTransform, parentFlags);        _director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    _director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);        bool visibleByCamera = isVisitableByVisitingCamera();    int i = 0;    _rendertTexture->beginWithClear(0, 0, 0, 0);    if (!_children.empty())    {        sortAllChildren();        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);                        if (node && node->getLocalZOrder() < 0)                node->visit(renderer, Mat4::IDENTITY, flags);            else                break;        }                for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit(renderer, Mat4::IDENTITY, flags);    }    _rendertTexture->end();        if (visibleByCamera)    {        this->draw(renderer, _modelViewTransform, flags);    }}
开发者ID:giangchau92,项目名称:Cocos2d-x-Effect,代码行数:36,


示例24: CCASSERT

void NodeGrid::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){    // quick return if not visible. children won't be drawn.    if (!_visible)    {        return;    }    bool dirty = (parentFlags & FLAGS_TRANSFORM_DIRTY) || _transformUpdated;    if(dirty)        _modelViewTransform = this->transform(parentTransform);    _transformUpdated = false;        _groupCommand.init(_globalZOrder);    renderer->addCommand(&_groupCommand);    renderer->pushGroup(_groupCommand.getRenderQueueID());    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    Director* director = Director::getInstance();    CCASSERT(nullptr != director, "Director is null when setting matrix stack");        director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    Director::Projection beforeProjectionType = Director::Projection::DEFAULT;    if(_nodeGrid && _nodeGrid->isActive())    {        beforeProjectionType = Director::getInstance()->getProjection();        _nodeGrid->set2DProjection();    }    _gridBeginCommand.init(_globalZOrder);    _gridBeginCommand.func = CC_CALLBACK_0(NodeGrid::onGridBeginDraw, this);    renderer->addCommand(&_gridBeginCommand);    if(_gridTarget)    {        _gridTarget->visit(renderer, _modelViewTransform, dirty);    }        int i = 0;    bool visibleByCamera = isVisitableByVisitingCamera();    if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);            if ( node && node->getLocalZOrder() < 0 )                node->visit(renderer, _modelViewTransform, dirty);            else                break;        }        // self draw,currently we have nothing to draw on NodeGrid, so there is no need to add render command        if (visibleByCamera)            this->draw(renderer, _modelViewTransform, dirty);        for(auto it=_children.cbegin()+i; it != _children.cend(); ++it) {            (*it)->visit(renderer, _modelViewTransform, dirty);        }    }    else if (visibleByCamera)    {        this->draw(renderer, _modelViewTransform, dirty);    }        // FIX ME: Why need to set _orderOfArrival to 0??    // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920    // setOrderOfArrival(0);        if(_nodeGrid && _nodeGrid->isActive())    {        // restore projection        director->setProjection(beforeProjectionType);    }    _gridEndCommand.init(_globalZOrder);    _gridEndCommand.func = CC_CALLBACK_0(NodeGrid::onGridEndDraw, this);    renderer->addCommand(&_gridEndCommand);    renderer->popGroup();     director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:1414648814,项目名称:AStar-Cocos2dx,代码行数:90,


示例25: processParentFlags

void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags){    if(!_visible)        return;        uint32_t flags = processParentFlags(parentTransform, parentFlags);    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    Director* director = Director::getInstance();    CCASSERT(nullptr != director, "Director is null when seting matrix stack");    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    //Add group command    _groupCommand.init(_globalZOrder);    renderer->addCommand(&_groupCommand);        renderer->pushGroup(_groupCommand.getRenderQueueID());        _beginStencilCommand.init(_globalZOrder, false, 1, _clippingStencil);    renderer->addCommand(&_beginStencilCommand);        _clippingStencil->visit(renderer, _modelViewTransform, flags);        _afterStencilCommand.init(_globalZOrder);    renderer->addCommand(&_afterStencilCommand);        int i = 0;      // used by _children    int j = 0;      // used by _protectedChildren        sortAllChildren();    sortAllProtectedChildren();        //    // draw children and protectedChildren zOrder < 0    //    for( ; i < _children.size(); i++ )    {        auto node = _children.at(i);                if ( node && node->getLocalZOrder() < 0 )            node->visit(renderer, _modelViewTransform, flags);        else            break;    }        for( ; j < _protectedChildren.size(); j++ )    {        auto node = _protectedChildren.at(j);                if ( node && node->getLocalZOrder() < 0 )            node->visit(renderer, _modelViewTransform, flags);        else            break;    }        //    // draw self    //    this->draw(renderer, _modelViewTransform, flags);        //    // draw children and protectedChildren zOrder >= 0    //    for(auto it=_protectedChildren.cbegin()+j; it != _protectedChildren.cend(); ++it)        (*it)->visit(renderer, _modelViewTransform, flags);        for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)        (*it)->visit(renderer, _modelViewTransform, flags);        _endStencilCommand.init(_globalZOrder);    renderer->addCommand(&_endStencilCommand);        renderer->popGroup();        director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:HeavenWesker,项目名称:ContraGame,代码行数:80,


示例26: kmGLPushMatrix

//-------------------------------------------------------------------------// 3D渲染,z-Order依然有效void FKCW_3D_Node::visit(){	// 如果不需要被渲染,则直接return,子类也不再被绘制	if (!m_bVisible)	{		return;	}	kmGLPushMatrix();	if (m_pGrid && m_pGrid->isActive())	{		m_pGrid->beforeDraw();	}	this->transform3D();	FKCW_3D_Node* pNode = NULL;	unsigned int i = 0;	if(m_pChildren && m_pChildren->count() > 0)	{		sortAllChildren();		ccArray *arrayData = m_pChildren->data;		for( ; i < arrayData->num; i++ )		{			pNode = (FKCW_3D_Node*) arrayData->arr[i];			if ( pNode && pNode->getZOrder() < 0 )			{				pNode->visit();			}			else			{				break;			}		}		// 渲染自己		this->draw();		for( ; i < arrayData->num; i++ )		{			pNode = (FKCW_3D_Node*) arrayData->arr[i];			if (pNode)			{				pNode->visit();			}		}	}	else	{		this->draw();	}	// 等待下一帧	m_uOrderOfArrival = 0;	if (m_pGrid && m_pGrid->isActive())	{		m_pGrid->afterDraw(this);	}	kmGLPopMatrix();}
开发者ID:duzhi5368,项目名称:FKCocos2dxWrapper_2.x,代码行数:66,


示例27: begin

void CCRenderTexture::draw(){    if( m_bAutoDraw)    {        begin();		        if (m_uClearFlags)        {            GLfloat oldClearColor[4] = {0.0f};			GLfloat oldDepthClearValue = 0.0f;			GLint oldStencilClearValue = 0;						// backup and set			if (m_uClearFlags & GL_COLOR_BUFFER_BIT)            {				glGetFloatv(GL_COLOR_CLEAR_VALUE, oldClearColor);				glClearColor(m_sClearColor.r, m_sClearColor.g, m_sClearColor.b, m_sClearColor.a);			}						if (m_uClearFlags & GL_DEPTH_BUFFER_BIT)            {				glGetFloatv(GL_DEPTH_CLEAR_VALUE, &oldDepthClearValue);				glClearDepth(m_fDlearDepth);			}						if (m_uClearFlags & GL_STENCIL_BUFFER_BIT)            {				glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &oldStencilClearValue);				glClearStencil(m_nClearStencil);			}						// clear			glClear(m_uClearFlags);						// restore			if (m_uClearFlags & GL_COLOR_BUFFER_BIT)            {				glClearColor(oldClearColor[0], oldClearColor[1], oldClearColor[2], oldClearColor[3]);            }			if (m_uClearFlags & GL_DEPTH_BUFFER_BIT)            {				glClearDepth(oldDepthClearValue);            }			if (m_uClearFlags & GL_STENCIL_BUFFER_BIT)            {				glClearStencil(oldStencilClearValue);            }		}				//! make sure all children are drawn        sortAllChildren();				CCObject *pElement;		CCARRAY_FOREACH(m_pChildren, pElement)        {            CCNode *pChild = (CCNode*)pElement;            if (pChild != m_pSprite)            {                pChild->visit();            }		}                end();	}
开发者ID:342261733,项目名称:cocos2d-x,代码行数:65,


示例28: processParentFlags

void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){    if (!_visible || !hasContent())        return;        uint32_t flags = processParentFlags(parentTransform, parentFlags);    // IMPORTANT:    // To ease the migration to v3.0, we still support the Mat4 stack,    // but it is deprecated and your code should not rely on it    Director* director = Director::getInstance();    CCASSERT(nullptr != director, "Director is null when setting matrix stack");    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);    //Add group command            _groupCommand.init(_globalZOrder);    renderer->addCommand(&_groupCommand);    renderer->pushGroup(_groupCommand.getRenderQueueID());    _beforeVisitCmd.init(_globalZOrder);    _beforeVisitCmd.func = CC_CALLBACK_0(StencilStateManager::onBeforeVisit, _stencilStateManager);    renderer->addCommand(&_beforeVisitCmd);        auto alphaThreshold = this->getAlphaThreshold();    if (alphaThreshold < 1)    {#if CC_CLIPPING_NODE_OPENGLES        // since glAlphaTest do not exists in OES, use a shader that writes        // pixel only if greater than an alpha threshold        GLProgram *program = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);        GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);        // set our alphaThreshold        program->use();        program->setUniformLocationWith1f(alphaValueLocation, alphaThreshold);        // we need to recursively apply this shader to all the nodes in the stencil node        // FIXME: we should have a way to apply shader to all nodes without having to do this        setProgram(_stencil, program);#endif    }    _stencil->visit(renderer, _modelViewTransform, flags);    _afterDrawStencilCmd.init(_globalZOrder);    _afterDrawStencilCmd.func = CC_CALLBACK_0(StencilStateManager::onAfterDrawStencil, _stencilStateManager);    renderer->addCommand(&_afterDrawStencilCmd);    int i = 0;    bool visibleByCamera = isVisitableByVisitingCamera();        if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for(auto size = _children.size(); i < size; ++i)        {            auto node = _children.at(i);                        if ( node && node->getLocalZOrder() < 0 )                node->visit(renderer, _modelViewTransform, flags);            else                break;        }        // self draw        if (visibleByCamera)            this->draw(renderer, _modelViewTransform, flags);        for(auto it=_children.cbegin()+i, itCend = _children.cend(); it != itCend; ++it)            (*it)->visit(renderer, _modelViewTransform, flags);    }    else if (visibleByCamera)    {        this->draw(renderer, _modelViewTransform, flags);    }    _afterVisitCmd.init(_globalZOrder);    _afterVisitCmd.func = CC_CALLBACK_0(StencilStateManager::onAfterVisit, _stencilStateManager);    renderer->addCommand(&_afterVisitCmd);    renderer->popGroup();        director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:85,


示例29: kmGLPushMatrix

void ClippingNode::visit(){    if(!_visible)        return;        kmGLPushMatrix();    transform();    //Add group command        Renderer* renderer = Director::getInstance()->getRenderer();        _groupCommand.init(0,_vertexZ);    renderer->addCommand(&_groupCommand);    renderer->pushGroup(_groupCommand.getRenderQueueID());    _beforeVisitCmd.init(0,_vertexZ);    _beforeVisitCmd.func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this);    renderer->addCommand(&_beforeVisitCmd);    if (_alphaThreshold < 1)    {#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WINDOWS || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)#else        // since glAlphaTest do not exists in OES, use a shader that writes        // pixel only if greater than an alpha threshold        GLProgram *program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);        GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);        // set our alphaThreshold        program->use();        program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);        // we need to recursively apply this shader to all the nodes in the stencil node        // XXX: we should have a way to apply shader to all nodes without having to do this        setProgram(_stencil, program);        #endif    }    _stencil->visit();    _afterDrawStencilCmd.init(0,_vertexZ);    _afterDrawStencilCmd.func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this);    renderer->addCommand(&_afterDrawStencilCmd);    int i = 0;        if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);                        if ( node && node->getZOrder() < 0 )                node->visit();            else                break;        }        // self draw        this->draw();                for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit();    }    else    {        this->draw();    }    _afterVisitCmd.init(0,_vertexZ);    _afterVisitCmd.func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this);    renderer->addCommand(&_afterVisitCmd);    renderer->popGroup();        kmGLPopMatrix();}
开发者ID:leanlyne,项目名称:ShootColorX,代码行数:77,


示例30: transform

void ClippingNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated){    if(!_visible)        return;        bool dirty = parentTransformUpdated || _transformUpdated;    if(dirty)        _modelViewTransform = transform(parentTransform);    _transformUpdated = false;    // IMPORTANT:    // To ease the migration to v3.0, we still support the kmGL stack,    // but it is deprecated and your code should not rely on it    kmGLPushMatrix();    kmGLLoadMatrix(&_modelViewTransform);    //Add group command            _groupCommand.init(_globalZOrder);    renderer->addCommand(&_groupCommand);    renderer->pushGroup(_groupCommand.getRenderQueueID());    _beforeVisitCmd.init(_globalZOrder);    _beforeVisitCmd.func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this);    renderer->addCommand(&_beforeVisitCmd);    if (_alphaThreshold < 1)    {#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WINDOWS || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)#else        // since glAlphaTest do not exists in OES, use a shader that writes        // pixel only if greater than an alpha threshold        GLProgram *program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);        GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);        // set our alphaThreshold        program->use();        program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);        // we need to recursively apply this shader to all the nodes in the stencil node        // XXX: we should have a way to apply shader to all nodes without having to do this        setProgram(_stencil, program);        #endif    }    _stencil->visit(renderer, _modelViewTransform, dirty);    _afterDrawStencilCmd.init(_globalZOrder);    _afterDrawStencilCmd.func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this);    renderer->addCommand(&_afterDrawStencilCmd);    int i = 0;        if(!_children.empty())    {        sortAllChildren();        // draw children zOrder < 0        for( ; i < _children.size(); i++ )        {            auto node = _children.at(i);                        if ( node && node->getLocalZOrder() < 0 )                node->visit(renderer, _modelViewTransform, dirty);            else                break;        }        // self draw        this->draw(renderer, _modelViewTransform, dirty);                for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)            (*it)->visit(renderer, _modelViewTransform, dirty);    }    else    {        this->draw(renderer, _modelViewTransform, dirty);    }    _afterVisitCmd.init(_globalZOrder);    _afterVisitCmd.func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this);    renderer->addCommand(&_afterVisitCmd);    renderer->popGroup();        kmGLPopMatrix();}
开发者ID:253627764,项目名称:WagonWar,代码行数:84,



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


C++ sortList函数代码示例
C++ sort函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。