//------------------------------------------------------------------------ // Destructor of the class. //------------------------------------------------------------------------ etDetailLayer::~etDetailLayer(void) { SAFE_DELETE_ARRAY( m_pTempData ); // Get the resourceManager. FlyResourceManager* pResMgr = FlyKernel::Instance().GetResourceManager(); if( m_pTexture ) pResMgr->DeleteTexture( m_pTexture ); }
//------------------------------------------------------------------------ // Destroy the detail layer, clean the memory. //------------------------------------------------------------------------ void etDetailLayer::DestroyLayer(void) { SAFE_DELETE_ARRAY( m_pTempData ); // Get the resourceManager. FlyResourceManager* pResMgr = FlyKernel::Instance().GetResourceManager(); if( m_pTexture ) pResMgr->DeleteTexture( m_pTexture ); m_nMapSize = 0; m_pTexture = NULL; }
//------------------------------------------------------------------------ // Destroy the animation, clean all the memory. //------------------------------------------------------------------------ void FlyAnimation::Destroy(void) { FlyTexture* pTexture; // Get the resource manager. FlyResourceManager* pResMgr = FlyKernel::Instance().GetResourceManager(); // Clear all the anim node. for( size_t i=0;i<m_AnimGroup.size();i++ ) SAFE_DELETE_ARRAY( m_AnimGroup[i].pJoints ); m_AnimGroup.clear(); // Clear the materials. for( size_t i=0;i<m_RMaterials.size();i++ ) { pTexture = m_RMaterials[i]->GetTexture( 0,0 ); if( pTexture ) pResMgr->DeleteTexture( pTexture ); pTexture = m_RMaterials[i]->GetTexture( 0,1 ); if( pTexture ) pResMgr->DeleteTexture( pTexture ); pResMgr->DeleteMaterial( m_RMaterials[i] ); } m_RMaterials.clear(); // Clear the geometry datas. SAFE_DELETE_ARRAY( m_pVertices ); SAFE_DELETE_ARRAY( m_pVertices_Orig ); SAFE_DELETE_ARRAY( m_pFaces ); SAFE_DELETE_ARRAY( m_pMeshes ); SAFE_DELETE_ARRAY( m_pMaterials ); memset( &m_sHeader,0,sizeof(sModelHeader) ); memset( &m_BBox,0,sizeof(sModelHeader) ); // Update the dirty state. m_nDirtyState++; }
//------------------------------------------------------------------------ // Destructor of the class. //------------------------------------------------------------------------ etVegetationObject::~etVegetationObject(void) { RenderableList::iterator itr; for( itr=m_Renderables.begin();itr!=m_Renderables.end();itr++ ) SAFE_DELETE( *itr ); // Get the pointer to the resourceManager. FlyResourceManager* pResMgr = etCoreManager::Instance().GetResourceManager(); // Get the pointer to the meshManager. FlyMeshManager* pMeshMgr = FlyKernel::Instance().GetMeshManager(); if( m_Type == VGT_POLYGON ) pResMgr->DeleteTexture( m_pTexture ); else { MaterialList::iterator mat; for( mat=m_Materials.begin();mat!=m_Materials.end();mat++ ) pResMgr->DeleteMaterial( *mat ); pMeshMgr->DecResourceRef( m_pMesh->GetName() ); } }