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


C++ PODVector::Pop方法代码示例

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


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

示例1: BuildTreeToEffector

// ----------------------------------------------------------------------------
bool IKSolver::BuildTreeToEffector(IKEffector* effector)
{
    /*
     * NOTE: This function makes the assumption that the node the effector is
     * attached to is -- without a doubt -- in our subtree (by using
     * ComponentIsInOurSubtree() first). If this is not the case, the program
     * will abort.
     */

    /*
     * we need to build tree up to the node where this effector was added. Do
     * this by following the chain of parent nodes until we hit a node that
     * exists in the solver's subtree. Then iterate backwards again and add each
     * missing node to the solver's tree.
     */
    const Node* iterNode = effector->GetNode();
    ik_node_t* ikNode;
    PODVector<const Node*> missingNodes;
    while ((ikNode = ik_node_find_child(solver_->tree, iterNode->GetID())) == nullptr)
    {
        missingNodes.Push(iterNode);
        iterNode = iterNode->GetParent();

        // Assert the assumptions made (described in the beginning of this function)
        assert(iterNode != nullptr);
        assert (iterNode->HasComponent<IKSolver>() == false || iterNode == node_);
    }

    while (missingNodes.Size() > 0)
    {
        iterNode = missingNodes.Back();
        missingNodes.Pop();

        ik_node_t* ikChildNode = CreateIKNodeFromUrhoNode(iterNode);
        ik_node_add_child(ikNode, ikChildNode);

        ikNode = ikChildNode;
    }

    return true;
}
开发者ID:1vanK,项目名称:Urho3D,代码行数:42,代码来源:IKSolver.cpp

示例2: BuildTreeToEffector

// ----------------------------------------------------------------------------
void IKSolver::BuildTreeToEffector(const Node* node)
{
    // Check if the component that was added is an IK effector. If not, then it
    // does not concern us.
    IKEffector* effector = static_cast<IKEffector*>(node->GetComponent<IKEffector>());
    if (effector == NULL || effector->GetType() != IKEffector::GetTypeStatic())
        return;

    // May need to build tree up to the node where this effector was added. Do
    // this by following the chain of parent nodes until we hit a node that
    // exists in the solver's tree. Then iterate backwards again and add each
    // missing node to the solver's tree.
    PODVector<const Node*> missingNodes;
    const Node* iterNode = node;
    ik_node_t* ikNode = ik_node_find_child(solver_->tree, node->GetID());
    while (ikNode == NULL)
    {
        missingNodes.Push(iterNode);
        iterNode = iterNode->GetParent();
        ikNode = ik_node_find_child(solver_->tree, iterNode->GetID());
    }
    while (missingNodes.Size() > 0)
    {
        iterNode = missingNodes.Back();
        missingNodes.Pop();
        ik_node_t* ikChildNode = CreateIKNode(iterNode);
        ik_node_add_child(ikNode, ikChildNode);
        ikNode = ikChildNode;
    }

    // The tip of the tree is the effector. The solver library has ownership of
    // the effector object, but our IKEffector object also needs to know about
    // it.
    ik_effector_t* ikEffector = ik_effector_create();
    ik_node_attach_effector(ikNode, ikEffector); // ownership of effector
    effector->SetIKEffector(ikEffector);           // "weak" reference to effector
    effector->SetIKSolver(this);
    effectorList_.Push(effector);

    MarkSolverTreeDirty();
}
开发者ID:gogoprog,项目名称:Urho3D,代码行数:42,代码来源:IKSolver.cpp


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