void Model::Clear() { m_VertexBuffer.Destroy(); m_IndexBuffer.Destroy(); m_VertexBufferDepth.Destroy(); m_IndexBufferDepth.Destroy(); delete [] m_pMesh; m_pMesh = nullptr; m_Header.meshCount = 0; delete [] m_pMaterial; m_pMaterial = nullptr; m_Header.materialCount = 0; delete [] m_pVertexData; delete [] m_pIndexData; delete [] m_pVertexDataDepth; delete [] m_pIndexDataDepth; m_pVertexData = nullptr; m_Header.vertexDataByteSize = 0; m_pIndexData = nullptr; m_Header.indexDataByteSize = 0; m_pVertexDataDepth = nullptr; m_Header.vertexDataByteSizeDepth = 0; m_pIndexDataDepth = nullptr; ReleaseTextures(); m_Header.boundingBox.min = Vector3(0.0f); m_Header.boundingBox.max = Vector3(0.0f); }
~CAlfRasterizedTextMesh() { ResetLines(ETrue); iLines.Close(); ReleaseTextures(ETrue); iObsoleteTextures.Close(); delete iBuf; }
void ColorModel::Shutdown() { ReleaseTextures(); ReleaseModel(); return; }
void ModelClass::Shutdown() { //release the model texture ReleaseTextures(); //release the vertex and index buffers ShutdownBuffers(); //release model data ReleaseModel(); }
//----------------------------------------------------------------------------- // Name: Cleanup() // Desc: Releases all previously initialized objects //----------------------------------------------------------------------------- void Cleanup() { ReleaseTextures(); ReleaseCUDA(); { // destroy the D3D device g_pD3DDevice->Release(); g_pD3D->Release(); } }
void BumpModelClass::Shutdown() { // Release the model textures. ReleaseTextures(); // Release the vertex and index buffers. ShutdownBuffers(); // Release the model data. ReleaseModel(); return; }
void SkyPlane::Shutdown() { // Release the sky plane textures. ReleaseTextures(); // Release the vertex and index buffer that were used for rendering the sky plane. ShutdownBuffers(); // Release the sky plane array. ShutdownSkyPlane(); return; }
void TerrainClass::Shutdown() { // Release the textures. ReleaseTextures(); // Release the vertex and index buffer. ShutdownBuffers(); // Release the terrain model. ReleaseTerrainModel(); // Release the height map data. ShutdownHeightMap(); return; }
TextureConverterDialog::~TextureConverterDialog() { SafeRelease(zoomSlider); SafeRelease(formatDialog); SafeRelease(dstZoomPreview); SafeRelease(srcZoomPreview); SafeRelease(dstPreview); SafeRelease(srcPreview); ReleaseTextures(); SafeRelease(workingScene); SafeRelease(convertButton); SafeRelease(closeButtonTop); SafeRelease(textureList); }
void TextureConverterDialog::OnCancel(BaseObject * owner, void * userData, void * callerData) { if(srcZoomPreview->GetParent()) { RemoveControl(srcZoomPreview); } if(dstZoomPreview->GetParent()) { RemoveControl(dstZoomPreview); } SafeRelease(workingScene); ReleaseTextures(); if(GetParent()) { GetParent()->RemoveControl(this); } }
CDirect2DRM::~CDirect2DRM() { TRACE("CDirect2DRM::~CDirect2DRM()\n"); // It is possible for there to be textures left on the texture list (and therefore // images left on the ticked list) when we quit if textures are added to the list // after the thread calling ReleaseTextures() exits. ReleaseTextures(); MMASSERT(m_listTextures.GetCount() == 0); MMASSERT(m_listTicked.GetCount() == 0); MMRELEASE(m_pDD); if (m_pImageCache) { m_pImageCache->Reset(); m_pImageCache->Release(); } MMRELEASE(m_pDefFont); DeleteCriticalSection(&m_CSTickedList); }
void TextureConverterDialog::OnFormatSelected(int32 newFormat, bool generateMimpaps) { Texture *t = GetTextureForIndex(selectedItem); String newName = PVRConverter::Instance()->ConvertPngToPvr(GetSrcTexturePath(t->relativePathname), newFormat, generateMimpaps); RestoreTextures(t, newName); selectedTextureName = GetWorkingTexturePath(newName); selectedTextureName = FileSystem::ReplaceExtension(selectedTextureName, ""); selectedTextureName = NormalizePath(selectedTextureName); ReleaseTextures(); EnumerateTextures(); selectedItem = -1; Set<Texture *>::iterator it = textures.begin(); Set<Texture *>::iterator endIt = textures.end(); for(int32 i = 0; it != endIt; ++it, ++i) { Texture *t = (*it); String textureName = GetWorkingTexturePath(t->relativePathname); textureName = FileSystem::ReplaceExtension(textureName, ""); textureName = NormalizePath(textureName); if(textureName == selectedTextureName) { selectedItem = i; break; } } textureList->Refresh(); textureList->ScrollToElement(selectedItem); SetupTexturePreview(); }
//----------------------------------------------------------------------------- // Name: Cleanup() // Desc: Clean up and exit //----------------------------------------------------------------------------- void Cleanup(int iExitCode) { // Cleanup allocated objects shrLog("\nStarting Cleanup...\n\n"); if(ckKernel_tex2d)clReleaseKernel(ckKernel_tex2d); if(ckKernel_texcube)clReleaseKernel(ckKernel_texcube); if(ckKernel_texvolume)clReleaseKernel(ckKernel_texvolume); if(cpProgram_tex2d)clReleaseProgram(cpProgram_tex2d); if(cpProgram_texcube)clReleaseProgram(cpProgram_texcube); if(cpProgram_texvolume)clReleaseProgram(cpProgram_texvolume); if(cqCommandQueue)clReleaseCommandQueue(cqCommandQueue); if(cxGPUContext)clReleaseContext(cxGPUContext); // release the D3D resources we created ReleaseTextures(); if (g_pD3DDevice != NULL) g_pD3DDevice->Release(); if (g_pD3D != NULL) g_pD3D->Release(); //... TODO: add more cleanup // finalize logs and leave shrQAFinishExit2(bQATest, *pArgc, (const char **)pArgv, (iExitCode == EXIT_SUCCESS) ? QA_PASSED : QA_FAILED); }
CDynamicTexture::~CDynamicTexture() { ReleaseTextures(); }
//----------------------------------------------------------------------------- //! Draw the final result on the screen //----------------------------------------------------------------------------- HRESULT DrawScene() { HRESULT hr = S_OK; if (g_bDeviceLost) { if ( FAILED(hr = DeviceLostHandler()) ) { shrLog("DeviceLostHandler FAILED returned %08x\n", hr); return hr; } } if (!g_bDeviceLost) { // // we will use this index and vertex data throughout // unsigned int IB[6] = { 0,1,2, 0,2,3, }; struct VertexStruct { float position[3]; float texture[3]; }; // // initialize the scene // D3DVIEWPORT9 viewport_window = {0, 0, 672, 192, 0, 1}; g_pD3DDevice->SetViewport(&viewport_window); g_pD3DDevice->BeginScene(); g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0); g_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); g_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE); g_pD3DDevice->SetFVF(D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_TEXCOORDSIZE3(0)); // // draw the 2d texture // VertexStruct VB[4] = { { {-1,-1,0,}, {0,0,0,}, }, { { 1,-1,0,}, {1,0,0,}, }, { { 1, 1,0,}, {1,1,0,}, }, { {-1, 1,0,}, {0,1,0,}, }, }; D3DVIEWPORT9 viewport = {32, 32, 256, 256, 0, 1}; g_pD3DDevice->SetViewport(&viewport); g_pD3DDevice->SetTexture(0,g_texture_2d.pTexture); g_pD3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, 4, 2, IB, D3DFMT_INDEX32, VB, sizeof(VertexStruct) ); // // draw the Z-positive side of the cube texture // VertexStruct VB_Zpos[4] = { { {-1,-1,0,}, {-1,-1, 0.5f,}, }, { { 1,-1,0,}, { 1,-1, 0.5f,}, }, { { 1, 1,0,}, { 1, 1, 0.5f,}, }, { {-1, 1,0,}, {-1, 1, 0.5f,}, }, }; viewport.Y += viewport.Height + 32; g_pD3DDevice->SetViewport(&viewport); g_pD3DDevice->SetTexture(0,g_texture_cube.pTexture); g_pD3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, 4, 2, IB, D3DFMT_INDEX32, VB_Zpos, sizeof(VertexStruct) ); // // draw the Z-negative side of the cube texture // VertexStruct VB_Zneg[4] = { { {-1,-1,0,}, { 1,-1,-0.5f,}, }, { { 1,-1,0,}, {-1,-1,-0.5f,}, }, { { 1, 1,0,}, {-1, 1,-0.5f,}, }, { {-1, 1,0,}, { 1, 1,-0.5f,}, }, }; viewport.X += viewport.Width + 32; g_pD3DDevice->SetViewport(&viewport); g_pD3DDevice->SetTexture(0,g_texture_cube.pTexture); g_pD3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, 4, 2, IB, D3DFMT_INDEX32, VB_Zneg, sizeof(VertexStruct) ); // // draw a slice the volume texture // VertexStruct VB_Zslice[4] = { { {-1,-1,0,}, {0,0,0,}, }, { { 1,-1,0,}, {1,0,0,}, }, { { 1, 1,0,}, {1,1,1,}, }, { {-1, 1,0,}, {0,1,1,}, }, }; viewport.Y -= viewport.Height + 32; g_pD3DDevice->SetViewport(&viewport); g_pD3DDevice->SetTexture(0,g_texture_vol.pTexture); g_pD3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, 4, 2, IB, D3DFMT_INDEX32, VB_Zslice, sizeof(VertexStruct) ); // // end the scene // g_pD3DDevice->EndScene(); hr = g_pD3DDevice->Present(NULL, NULL, NULL, NULL); if (hr == D3DERR_DEVICELOST) { shrLog("DrawScene Present = %08x detected D3D DeviceLost\n", hr); g_bDeviceLost = true; ReleaseTextures(); Cleanup(1); } } return hr; }
// // Preview::~Preview // Preview::~Preview() { ReleaseTextures(); teams.DisposeAll(); }
void CTextureManager::Shutdown() { FreeStandardRenderTargets(); // These checks added because it's possible for shutdown to be called before the material system is // fully initialized. if ( m_pWhiteTexture ) { m_pWhiteTexture->DecrementReferenceCount(); m_pWhiteTexture = NULL; } if ( m_pBlackTexture ) { m_pBlackTexture->DecrementReferenceCount(); m_pBlackTexture = NULL; } if ( m_pGreyTexture ) { m_pGreyTexture->DecrementReferenceCount(); m_pGreyTexture = NULL; } if ( m_pGreyAlphaZeroTexture ) { m_pGreyAlphaZeroTexture->DecrementReferenceCount(); m_pGreyAlphaZeroTexture = NULL; } if ( m_pNormalizationCubemap ) { m_pNormalizationCubemap->DecrementReferenceCount(); m_pNormalizationCubemap = NULL; } if ( m_pSignedNormalizationCubemap ) { m_pSignedNormalizationCubemap->DecrementReferenceCount(); m_pSignedNormalizationCubemap = NULL; } if ( m_pShadowNoise2D ) { m_pShadowNoise2D->DecrementReferenceCount(); m_pShadowNoise2D = NULL; } if ( m_pIdentityLightWarp ) { m_pIdentityLightWarp->DecrementReferenceCount(); m_pIdentityLightWarp = NULL; } if ( m_pErrorTexture ) { m_pErrorTexture->DecrementReferenceCount(); m_pErrorTexture = NULL; } ReleaseTextures(); if ( m_pErrorRegen ) { m_pErrorRegen->Release(); m_pErrorRegen = NULL; } for ( int i = m_TextureList.First(); i != m_TextureList.InvalidIndex(); i = m_TextureList.Next( i ) ) { ITextureInternal::Destroy( m_TextureList[i] ); } m_TextureList.RemoveAll(); for( int i = m_TextureAliases.First(); i != m_TextureAliases.InvalidIndex(); i = m_TextureAliases.Next( i ) ) { delete []m_TextureAliases[i]; } m_TextureAliases.RemoveAll(); m_TextureExcludes.RemoveAll(); }