//-------------------------------------------------------------------------------------- // Release D3D11 resources created in OnD3D11CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D11DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D11DestroyDevice(); g_D3DSettingsDlg.OnD3D11DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); SAFE_DELETE( g_pTxtHelper ); SAFE_DELETE( g_pTxtHelper1 ); g_SceneMesh.Destroy(); g_Poles.Destroy(); SAFE_RELEASE( g_pSceneVS ); SAFE_RELEASE( g_pScenePS ); SAFE_RELEASE( g_pSM_VS ); SAFE_RELEASE( g_pcbConstants ); SAFE_RELEASE( g_pRSMDepthStencilTexture ); SAFE_RELEASE( g_pDepthStencilTextureDSV ); SAFE_RELEASE( g_pDepthTextureSRV ); SAFE_RELEASE( g_pSceneVertexLayout ); SAFE_RELEASE( g_pBlendStateNoBlend ); SAFE_RELEASE( g_pBlendStateColorWritesOff ); SAFE_RELEASE( g_pSamplePoint ); SAFE_RELEASE( g_pSamplePointCmp ); SAFE_RELEASE( g_pSampleLinear ); }
//-------------------------------------------------------------------------------------- // Release D3D9 resources created in the OnD3D9CreateDevice callback //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D10DestroyDevice(); g_SettingsDlg.OnD3D10DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); g_Terrain.OnDestroyDevice(); g_BallMesh.Destroy(); g_SkyMesh.Destroy(); SAFE_RELEASE( g_pFont10 ); SAFE_RELEASE( g_pSprite10 ); SAFE_DELETE( g_pTxtHelper ); SAFE_RELEASE( g_pEffect10 ); SAFE_RELEASE( g_pBasicDecl10 ); SAFE_RELEASE( g_pBallDecl10 ); SAFE_RELEASE( g_pGrassDecl10 ); SAFE_RELEASE( g_pHeightTexRV ); SAFE_RELEASE( g_pNormalTexRV ); SAFE_RELEASE( g_pGrassTexRV ); SAFE_RELEASE( g_pDirtTexRV ); SAFE_RELEASE( g_pGroundGrassTexRV ); SAFE_RELEASE( g_pMaskTexRV ); SAFE_RELEASE( g_pShadeNormalTexRV ); SAFE_RELEASE( g_pStreamDataVB10 ); SAFE_RELEASE( g_pGrassDataVB10 ); }
//-------------------------------------------------------------------------------------- // Release D3D11 resources created in OnD3D11CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D11DestroyDevice(void* /*pUserContext*/) { g_MeshPowerPlant.Destroy(); g_MeshTestScene.Destroy(); DestroyD3DComponents(); }
//-------------------------------------------------------------------------------------- // Release D3D11 resources created in OnD3D11CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D11DestroyDevice( void* pUserContext ) { UNREFERENCED_PARAMETER(pUserContext); g_MeshPowerPlant.Destroy(); g_TeapotMesh.Destroy(); DestroyD3DComponents(); }
//-------------------------------------------------------------------------------------- // Release D3D10 resources created in OnD3D10CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D10DestroyDevice(); g_D3DSettingsDlg.OnD3D10DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); SAFE_RELEASE( g_pFont ); SAFE_RELEASE( g_pSprite ); SAFE_DELETE( g_pTxtHelper ); SAFE_RELEASE( g_pVertexLayout ); SAFE_RELEASE( g_pEffect ); g_Mesh.Destroy(); }
//-------------------------------------------------------------------------------------- // Release D3D9 resources created in the OnD3D9ResetDevice callback //-------------------------------------------------------------------------------------- void CALLBACK OnD3D9LostDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D9LostDevice(); g_SettingsDlg.OnD3D9LostDevice(); DXUTGetGlobalResourceCache().OnLostDevice(); if( g_pFont9 ) g_pFont9->OnLostDevice(); if( g_pEffect9 ) g_pEffect9->OnLostDevice(); SAFE_RELEASE( g_pSprite9 ); SAFE_DELETE( g_pTxtHelper ); g_Mesh.Destroy(); SAFE_RELEASE( g_pTexture9 ); }
//-------------------------------------------------------------------------------------- // Release D3D10 resources created in OnD3D10CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D10DestroyDevice(); g_D3DSettingsDlg.OnD3D10DestroyDevice(); CDXUTDirectionWidget::StaticOnD3D10DestroyDevice(); SAFE_RELEASE( g_pFont10 ); SAFE_RELEASE( g_pSprite10 ); SAFE_RELEASE( g_pEffect10 ); SAFE_RELEASE( g_pVertexLayout ); g_Mesh.Destroy(); SAFE_RELEASE( g_pMeshTexRV ); }
//-------------------------------------------------------------------------------------- // Release D3D10 resources created in OnD3D10CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D10DestroyDevice(); g_D3DSettingsDlg.OnD3D10DestroyDevice(); CDXUTDirectionWidget::StaticOnD3D10DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); SAFE_RELEASE( g_pEffect ); SAFE_RELEASE( g_pFont10 ); SAFE_RELEASE( g_pSprite10 ); SAFE_DELETE( g_pTxtHelper ); SAFE_RELEASE( g_pStaticVertexLayout ); SAFE_RELEASE( g_pSkinnedVertexLayout ); g_SceneMesh.Destroy(); g_FanMesh.Destroy(); for( UINT iMesh = 0; iMesh < g_NumLinkedMeshes; iMesh++ ) g_pLinkedMeshes[iMesh].Destroy(); SAFE_DELETE_ARRAY( g_pLinkedMeshes ); g_AnimMesh.Destroy(); }
//-------------------------------------------------------------------------------------- // Release D3D11 resources created in OnD3D11CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D11DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D11DestroyDevice(); g_D3DSettingsDlg.OnD3D11DestroyDevice(); CDXUTDirectionWidget::StaticOnD3D11DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); SAFE_DELETE( g_pTxtHelper ); g_Mesh11.Destroy(); SAFE_RELEASE( g_pEffect ); SAFE_RELEASE( g_pVertexLayout11 ); SAFE_RELEASE( g_pVertexBuffer ); SAFE_RELEASE( g_pIndexBuffer ); SAFE_RELEASE( g_pEnvironmentMapSRV ); }
//-------------------------------------------------------------------------------------- // Release D3D11 resources created in OnD3D11CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D11DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D11DestroyDevice(); g_D3DSettingsDlg.OnD3D11DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); SAFE_DELETE( g_pTxtHelper ); g_Mesh11.Destroy(); SAFE_RELEASE(g_pGeometryShader); SAFE_RELEASE( g_pVertexLayout11 ); SAFE_RELEASE( g_pVertexBuffer ); SAFE_RELEASE( g_pVertexShader ); SAFE_RELEASE( g_pPixelShader ); SAFE_RELEASE( g_pSamLinear ); SAFE_RELEASE( g_pcbVSPerObject ); SAFE_RELEASE( g_pcbPSPerObject ); SAFE_RELEASE( g_pcbPSPerFrame ); SAFE_RELEASE( g_pRasterizerState ); SAFE_RELEASE( g_pRasterizerStateWF ); for( int flagIndex = 0; flagIndex < numFlags; ++flagIndex ) { cloths[flagIndex].destroy(); } my_capsule.destroy(); // Shouldn't need to delete this as it's just a soft body and will be deleted later by the collision object cleanup. //for( int flagIndex = 0; flagIndex < m_flags.size(); ++flagIndex ) //{ //delete m_flags[flagIndex]; //} //cleanup in the reverse order of creation/initialization if( g_defaultSolver ) delete g_defaultSolver; if( g_cpuSolver ) delete g_cpuSolver; if( g_dx11Solver ) delete g_dx11Solver; if( g_dx11SIMDSolver ) delete g_dx11SIMDSolver; if( g_softBodyOutput ) delete g_softBodyOutput; for(int i=0; i< m_collisionShapes.size(); i++) delete m_collisionShapes[i]; //remove the rigidbodies from the dynamics world and delete them int i; for (i=m_dynamicsWorld->getNumCollisionObjects()-1; i>=0 ;i--) { btCollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[i]; btRigidBody* body = btRigidBody::upcast(obj); if (body && body->getMotionState()) { delete body->getMotionState(); } m_dynamicsWorld->removeCollisionObject( obj ); delete obj; } delete m_dynamicsWorld; delete m_solver; delete m_broadphase; delete m_dispatcher; delete m_collisionConfiguration; }