Пример #1
0
//------------------------------------------------------------------------
// Destructor of the class.
//------------------------------------------------------------------------
etVegetationRenderable::~etVegetationRenderable(void)
{
    FlyResourceManager* pResMgr = etCoreManager::Instance().GetResourceManager();

    if( m_pParent->GetVegetationType() == VGT_POLYGON )
    {
        SAFE_DELETE( m_pVB );
        SAFE_DELETE( m_pIB );

        pResMgr->DeleteMaterial( m_pMaterial );
    }
}
Пример #2
0
//------------------------------------------------------------------------
// Reinitialize the vegetation object. (Only for Mesh type)
//------------------------------------------------------------------------
HRESULT etVegetationObject::Reinitialize(void)
{
    // Get the pointer to the resourceManager.
    FlyResourceManager* pResMgr = etCoreManager::Instance().GetResourceManager();

    // Destroy the old renderables.
    RenderableList::iterator obj;
    for( obj=m_Renderables.begin();obj!=m_Renderables.end();obj++ )
        SAFE_DELETE( *obj );
    m_Renderables.clear();

    // Destroy the render materials.
    MaterialList::iterator mat;
    for( mat=m_Materials.begin();mat!=m_Materials.end();mat++ )
        pResMgr->DeleteMaterial( *mat );
    m_Materials.clear();

    // Update the dirty state.
    m_nDirtyState = m_pMesh->GetDirtyState();

    return BuildMeshRenderable();
}
Пример #3
0
//------------------------------------------------------------------------
// 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() );
    }
}
Пример #4
0
//------------------------------------------------------------------------
// 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++;
}
Пример #5
0
//------------------------------------------------------------------------
// Destructor of the class.
//------------------------------------------------------------------------
etTileRenderable::~etTileRenderable(void)
{
    FlyResourceManager* pResMgr = etCoreManager::Instance().GetResourceManager();
    pResMgr->DeleteMaterial( m_pMaterial );
}