示例#1
0
void OctreeScene::AddSceneNode(SceneNode * node)
{
    const Aabb & bound = node->GetWorldAabb();

    // check in this scene
    Scene * scene = node->_GetScene();
    if (scene == this)
        return;
    else if (scene)
        scene->RemoveSceneNode(node);

    // if not in root, force in root.
    if (!Math::AABBInside(m_root->GetBound(), bound))
    {
        m_root->AddNode(node);
    }
    else
    {
        OctreeNode * ocnode = _InsideNode(m_root, 0, bound);
        ocnode->AddNode(node);
    }
}