Esempio n. 1
0
void OgreRecast::removeDrawnNavmesh(unsigned int tileRef)
{
    Ogre::String name = "RecastMOWalk_"+Ogre::StringConverter::toString(tileRef);
    Ogre::LogManager::getSingletonPtr()->logMessage("Removing tile: "+name);
    Ogre::String entName = "";

    if(OgreRecast::STATIC_GEOM_DEBUG) {
        m_pSceneMgr->destroyManualObject(name);
        entName = "ent_"+name;
        name = "mesh_"+name;
        m_pSceneMgr->destroyMovableObject(entName, "Entity");
        Ogre::MeshManager::getSingletonPtr()->remove(name);

        name = "RecastMONeighbour_"+Ogre::StringConverter::toString(tileRef);
        m_pSceneMgr->destroyManualObject(name);
        entName = "ent_"+name;
        name = "mesh_"+name;
        m_pSceneMgr->destroyMovableObject(entName, "Entity");
        Ogre::MeshManager::getSingletonPtr()->remove(name);

        name = "RecastMOBoundary_"+Ogre::StringConverter::toString(tileRef);
        m_pSceneMgr->destroyManualObject(name);
        entName = "ent_"+name;
        name = "mesh_"+name;
        m_pSceneMgr->destroyMovableObject(entName, "Entity");
        Ogre::MeshManager::getSingletonPtr()->remove(name);

        // Set dirty flag to trigger rebuild next update
        m_rebuildSg = true;

    } else {
        try {
            Ogre::MovableObject *o = m_pRecastSN->getAttachedObject(name);
            o->detachFromParent();
            m_pSceneMgr->destroyManualObject(name);

            name = "RecastMONeighbour_"+Ogre::StringConverter::toString(tileRef);
            o = m_pRecastSN->getAttachedObject(name);
            o->detachFromParent();
            m_pSceneMgr->destroyManualObject(name);

            name = "RecastMOBoundary_"+Ogre::StringConverter::toString(tileRef);
            o = m_pRecastSN->getAttachedObject(name);
            o->detachFromParent();
            m_pSceneMgr->destroyManualObject(name);
        } catch (Ogre::Exception e) {
            // This is possible if the tile contained no polygons (hence it was not drawn)
        }
    }
}
Esempio n. 2
0
///void detachFromParent(void);
void movableobject_detach_from_parent(MovableObjectHandle handle)
{
    Ogre::MovableObject* obj = static_cast<Ogre::MovableObject*>(handle);
    obj->detachFromParent();
}