void NavigationMesh::resetPathfinding()
{
    mOpenList.clear();
    for( CellVector::iterator i = mCells.begin(); i != mCells.end(); i++ )
    {
        i->path = -1;   // Not strictly required.
        i->parent = 0;  // Or this either.

        i->isOpen = false;
        i->isClosed = false;
    }

    Ogre::Root *root = Ogre::Root::getSingletonPtr();
    Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
    mgr->destroyManualObject( "debugDrawClassification" );
    mgr->destroyManualObject( "debugDraw" );
}
Esempio n. 2
0
EC_Ruler::~EC_Ruler()
{
    // OgreRendering module might be already deleted. If so, the cloned entity is also already deleted.
    // In this case, just set pointer to 0.
    if (!renderer_.expired())
    {
        Ogre::SceneManager *sceneMgr = renderer_.lock()->GetSceneManager();
        sceneMgr->destroyManualObject(rulerObject);
        if(gridObject)
            sceneMgr->destroyManualObject(gridObject);
    }
    else
    {
        rulerObject = 0;
        gridObject = 0;
        sceneNode_ = 0;
    }
}
Esempio n. 3
0
EC_SelectionBox::~EC_SelectionBox()
{
    if (selectionBox_)
    {
        OgreWorldPtr world = world_.lock();
        if (world)
        {
            Ogre::SceneManager* sceneMgr = world->GetSceneManager();
            sceneMgr->destroyManualObject(selectionBox_);
            selectionBox_ = 0;
        }
    }
}
void NavigationMesh::setShow( bool show )
{
    Ogre::Root *root = Ogre::Root::getSingletonPtr();
    Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
    Ogre::ManualObject* debug;
    Ogre::SceneNode* debugNode;

    mShow = show;

    if( mgr->hasSceneNode( "debugDrawNode2" ) )
    {
        debugNode = mgr->getSceneNode( "debugDrawNode2" );
    }
    else
    {
        debugNode = mgr->getRootSceneNode()->createChildSceneNode( "debugDrawNode2" );
        debugNode->translate( 0, 1, 0 );    // Move up slightly to see lines better.
    }

    if( mgr->hasManualObject( "debugDraw2" ) )
        debug = mgr->getManualObject( "debugDraw2" );
    else
    {
        debug = mgr->createManualObject( "debugDraw2" );
        debugNode->attachObject( debug );
        debug->setQueryFlags( 0 );
        debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
    }

    if( !mShow )
    {
        mgr->destroyManualObject( debug );
        return;
    }

    for( CellVector::iterator i = mCells.begin(); i != mCells.end(); i++ )
    {
        i->debugDrawCell( debug, "debug/yellow", "debug/blue" );
    }

    return;
}