diff --git a/tools/assimp_view/HUD.png b/tools/assimp_view/HUD.png index be7981977..fe649fc16 100644 Binary files a/tools/assimp_view/HUD.png and b/tools/assimp_view/HUD.png differ diff --git a/tools/assimp_view/HUDMask.png b/tools/assimp_view/HUDMask.png index 9311e464f..98578dc53 100644 Binary files a/tools/assimp_view/HUDMask.png and b/tools/assimp_view/HUDMask.png differ diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index b8c56503b..71bc5c8bb 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -118,7 +118,7 @@ void MakeFileAssociations() D3DCOLOR_ARGB(0xFF,0,0xFF,0)); CLogDisplay::Instance().AddEntry(tmp.data,D3DCOLOR_ARGB(0xFF,0,0xFF,0)); - } +} //------------------------------------------------------------------------------- @@ -128,17 +128,16 @@ void MakeFileAssociations() // Other command line parameters are not handled //------------------------------------------------------------------------------- void HandleCommandLine(char* p_szCommand) - { +{ char* sz = p_szCommand; //bool bQuak = false; if (strlen(sz) < 2)return; - if (*sz == '\"') - { + if (*sz == '\"') { char* sz2 = strrchr(sz,'\"'); if (sz2)*sz2 = 0; - sz++; // skip the starting quote + sz++; // skip the starting quote } strcpy( g_szFileName, sz ); @@ -149,8 +148,7 @@ void HandleCommandLine(char* p_szCommand) // Save the list of previous files to the registry SaveHistory(); - } - +} //------------------------------------------------------------------------------- // Load the light colors from the registry @@ -158,16 +156,11 @@ void HandleCommandLine(char* p_szCommand) void LoadLightColors() { DWORD dwTemp = 4; - RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL, - (BYTE*)&g_avLightColors[0],&dwTemp); - RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL, - (BYTE*)&g_avLightColors[1],&dwTemp); - RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL, - (BYTE*)&g_avLightColors[2],&dwTemp); - return; + RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL, (BYTE*)&g_avLightColors[0],&dwTemp); + RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL, (BYTE*)&g_avLightColors[1],&dwTemp); + RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL, (BYTE*)&g_avLightColors[2],&dwTemp); } - //------------------------------------------------------------------------------- // Save the light colors to the registry //------------------------------------------------------------------------------- @@ -178,7 +171,6 @@ void SaveLightColors() RegSetValueExA(g_hRegistry,"LightColor2",0,REG_DWORD,(const BYTE*)&g_avLightColors[2],4); } - //------------------------------------------------------------------------------- // Save the checker pattern colors to the registry //------------------------------------------------------------------------------- diff --git a/tools/assimp_view/assimp_view.cpp b/tools/assimp_view/assimp_view.cpp index 108f866c4..5980c58c0 100644 --- a/tools/assimp_view/assimp_view.cpp +++ b/tools/assimp_view/assimp_view.cpp @@ -787,9 +787,17 @@ int ShutdownD3D(void) return 1; } +template +inline +void SafeRelease(TComPtr *ptr) { + if (nullptr != g_piPassThroughEffect) { + g_piPassThroughEffect->Release(); + g_piPassThroughEffect = nullptr; + } +} //------------------------------------------------------------------------------- -// Shutdown the D3D devie object and all resources associated with it +// Shutdown the D3D device object and all resources associated with it // NOTE: Assumes that the asset has already been deleted //------------------------------------------------------------------------------- int ShutdownDevice(void) @@ -798,49 +806,20 @@ int ShutdownDevice(void) CBackgroundPainter::Instance().ReleaseNativeResource(); CLogDisplay::Instance().ReleaseNativeResource(); - // release global shaders that have been allocazed - if (NULL != g_piDefaultEffect) - { - g_piDefaultEffect->Release(); - g_piDefaultEffect = NULL; - } - if (NULL != g_piNormalsEffect) - { - g_piNormalsEffect->Release(); - g_piNormalsEffect = NULL; - } - if (NULL != g_piPassThroughEffect) - { - g_piPassThroughEffect->Release(); - g_piPassThroughEffect = NULL; - } - if (NULL != g_piPatternEffect) - { - g_piPatternEffect->Release(); - g_piPatternEffect = NULL; - } - if (NULL != g_pcTexture) - { - g_pcTexture->Release(); - g_pcTexture = NULL; - } - - if( NULL != gDefaultVertexDecl) - { - gDefaultVertexDecl->Release(); - gDefaultVertexDecl = NULL; - } + // release global shaders that have been allocated + SafeRelease(g_piDefaultEffect); + SafeRelease(g_piNormalsEffect); + SafeRelease(g_piPassThroughEffect); + SafeRelease(g_piPatternEffect); + SafeRelease(g_pcTexture); + SafeRelease(gDefaultVertexDecl); // delete the main D3D device object - if (NULL != g_piDevice) - { - g_piDevice->Release(); - g_piDevice = NULL; - } + SafeRelease(g_piDevice); // deleted the one channel image allocated to hold the HUD mask delete[] g_szImageMask; - g_szImageMask = NULL; + g_szImageMask = nullptr; return 1; }