Esempio n. 1
0
void MeshResourceMarker::reset()
{
  //destroy entity
  if (entity_)
  {
    context_->getSceneManager()->destroyEntity(entity_);
    entity_ = 0;
  }


  // destroy all the materials we've created
  S_MaterialPtr::iterator it;
  for (it = materials_.begin(); it != materials_.end(); it++)
  {
    Ogre::MaterialPtr material = *it;
    if (!material.isNull())
    {
      material->unload();
      Ogre::MaterialManager::getSingleton().remove(material->getName());
    }
  }
  materials_.clear();
  // the actual passes are deleted by the material
  color_tint_passes_.clear();
}
void MeshResourceMarker::reset()
{
  //destroy entity
  if (entity_)
  {
    context_->getSceneManager()->destroyEntity( entity_ );
    entity_ = 0;
  }

  // destroy all the materials we've created
  S_MaterialPtr::iterator it;
  for ( it = materials_.begin(); it!=materials_.end(); it++ )
  {
    Ogre::MaterialPtr material = *it;
    if (!material.isNull())
    {
      for (size_t i = 0; i < material->getNumTechniques(); ++i)
      {
        Ogre::Technique* t = material->getTechnique(i);
        // hack hack hack, really need to do a shader-based way of picking, rather than
        // creating a texture for each object
        if (t->getSchemeName() == "Pick")
        {
          Ogre::TextureManager::getSingleton().remove(t->getPass(0)->getTextureUnitState(0)->getTextureName());
        }
      }

      material->unload();
      Ogre::MaterialManager::getSingleton().remove(material->getName());
    }
  }
  materials_.clear();
}
MeshPersonVisual::~MeshPersonVisual() {
    m_sceneManager->destroyEntity( entity_ );

    // destroy all the materials we've created
    std::set<Ogre::MaterialPtr>::iterator it;
    for ( it = materials_.begin(); it!=materials_.end(); it++ )
    {
        Ogre::MaterialPtr material = *it;
        if (!material.isNull())
        {
          material->unload();
          Ogre::MaterialManager::getSingleton().remove(material->getName());
        }
    }
    materials_.clear();

    m_sceneManager->destroySceneNode(m_childSceneNode->getName());
}