Merge pull request #185 from adrianbroher/master

Fix various errors and warnings that prevented build assimp_view as linux to win32 cross compile.
pull/189/head
Kim Kulling 2013-11-20 06:49:41 -08:00
commit 896d1b3f7e
17 changed files with 56 additions and 61 deletions

View File

@ -18,7 +18,7 @@ set(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_M
set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev) set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names") set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW )
add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it.... add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it....
# hide all not-exported symbols # hide all not-exported symbols
add_definitions( -fvisibility=hidden -Wall ) add_definitions( -fvisibility=hidden -Wall )

View File

@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory.h> #include <memory.h>
#include <math.h> #include <math.h>
#include <stddef.h> #include <stddef.h>
#include <string.h>
#include <limits.h> #include <limits.h>
// Our compile configuration // Our compile configuration

View File

@ -22,8 +22,6 @@ INCLUDE_DIRECTORIES(
LINK_DIRECTORIES( LINK_DIRECTORIES(
${Assimp_BINARY_DIR} ${Assimp_BINARY_DIR}
${Assimp_BINARY_DIR}/lib/ ${Assimp_BINARY_DIR}/lib/
${Assimp_SOURCE_DIR}/samples/glut/
${Assimp_SOURCE_DIR}/samples/DevIL/lib/
) )
ADD_EXECUTABLE( assimp_simpletexturedogl WIN32 ADD_EXECUTABLE( assimp_simpletexturedogl WIN32

View File

@ -17,9 +17,9 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <gl\GL.h> #include <GL/gl.h>
#include <gl\GLU.h> #include <GL/glu.h>
#include <IL\il.h> #include <IL/il.h>
#include <fstream> #include <fstream>
@ -30,8 +30,8 @@
// assimp include files. These three are usually needed. // assimp include files. These three are usually needed.
#include "assimp/Importer.hpp" //OO version Header! #include "assimp/Importer.hpp" //OO version Header!
#include "assimp/PostProcess.h" #include "assimp/postprocess.h"
#include "assimp/Scene.h" #include "assimp/scene.h"
#include "assimp/DefaultLogger.hpp" #include "assimp/DefaultLogger.hpp"
#include "assimp/LogStream.hpp" #include "assimp/LogStream.hpp"
@ -177,7 +177,6 @@ int LoadGLTextures(const aiScene* scene)
/* Before calling ilInit() version should be checked. */ /* Before calling ilInit() version should be checked. */
if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION) if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION)
{ {
ILint test = ilGetInteger(IL_VERSION_NUM);
/// wrong DevIL version /// /// wrong DevIL version ///
std::string err_msg = "Wrong DevIL version. Old devil.dll in system32/SysWow64?"; std::string err_msg = "Wrong DevIL version. Old devil.dll in system32/SysWow64?";
char* cErr_msg = (char *) err_msg.c_str(); char* cErr_msg = (char *) err_msg.c_str();

View File

@ -139,19 +139,20 @@ class AssetHelper
: :
piVB (NULL), piVB (NULL),
piIB (NULL), piIB (NULL),
piEffect (NULL),
piVBNormals (NULL), piVBNormals (NULL),
piEffect (NULL),
bSharedFX (false),
piDiffuseTexture (NULL), piDiffuseTexture (NULL),
piSpecularTexture (NULL), piSpecularTexture (NULL),
piAmbientTexture (NULL), piAmbientTexture (NULL),
piNormalTexture (NULL),
piEmissiveTexture (NULL), piEmissiveTexture (NULL),
piNormalTexture (NULL),
piOpacityTexture (NULL), piOpacityTexture (NULL),
piShininessTexture (NULL), piShininessTexture (NULL),
piLightmapTexture (NULL), piLightmapTexture (NULL),
pvOriginalNormals (NULL), twosided (false),
bSharedFX(false), pvOriginalNormals (NULL)
twosided (false){} {}
~MeshHelper () ~MeshHelper ()
{ {

View File

@ -47,10 +47,10 @@ class CBackgroundPainter
{ {
CBackgroundPainter() CBackgroundPainter()
: :
pcTexture(NULL),
clrColor(D3DCOLOR_ARGB(0xFF,100,100,100)), clrColor(D3DCOLOR_ARGB(0xFF,100,100,100)),
eMode(SIMPLE_COLOR), pcTexture(NULL),
piSkyBoxEffect(NULL) piSkyBoxEffect(NULL),
eMode(SIMPLE_COLOR)
{} {}
public: public:

View File

@ -43,8 +43,11 @@ ADD_EXECUTABLE( assimp_viewer WIN32
SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX})
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) IF ( MSVC )
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
ENDIF ( MSVC )
# #
@ -54,7 +57,7 @@ ADD_CUSTOM_COMMAND(TARGET assimp_viewer
MAIN_DEPENDENCY assimp) MAIN_DEPENDENCY assimp)
# Link the executable to the assimp + dx libs. # Link the executable to the assimp + dx libs.
TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib Winmm.lib ) TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib winmm.lib )
INSTALL( TARGETS assimp_viewer INSTALL( TARGETS assimp_viewer
DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev

View File

@ -55,8 +55,8 @@ class Camera
: :
vPos(0.0f,0.0f,-10.0f), vPos(0.0f,0.0f,-10.0f),
vLookAt(0.0f,0.0f,1.0f),
vUp(0.0f,1.0f,0.0f), vUp(0.0f,1.0f,0.0f),
vLookAt(0.0f,0.0f,1.0f),
vRight(0.0f,1.0f,0.0f) vRight(0.0f,1.0f,0.0f)
{ {

View File

@ -287,10 +287,6 @@ int CDisplay::ReplaceCurrentTexture(const char* szPath)
TreeView_SetItem(GetDlgItem(g_hDlg,IDC_TREE1), TreeView_SetItem(GetDlgItem(g_hDlg,IDC_TREE1),
m_pcCurrentTexture->hTreeItem); m_pcCurrentTexture->hTreeItem);
// change this in the old aiMaterial structure, too
aiMaterial* pcMat = (aiMaterial*)
g_pcAsset->pcScene->mMaterials[m_pcCurrentTexture->iMatIndex];
// update all meshes referencing this material // update all meshes referencing this material
for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i)
{ {
@ -1187,7 +1183,7 @@ int CDisplay::HandleTreeViewPopup(WPARAM wParam,LPARAM lParam)
{ {
// get the current selected material // get the current selected material
std::vector<Info> apclrOut; std::vector<Info> apclrOut;
const char* szMatKey; const char* szMatKey = "";
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
@ -1255,7 +1251,7 @@ int CDisplay::HandleTreeViewPopup(WPARAM wParam,LPARAM lParam)
clr.lpCustColors = g_aclCustomColors; clr.lpCustColors = g_aclCustomColors;
clr.lpfnHook = NULL; clr.lpfnHook = NULL;
clr.lpTemplateName = NULL; clr.lpTemplateName = NULL;
clr.lCustData = NULL; clr.lCustData = 0;
ChooseColor(&clr); ChooseColor(&clr);

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "stdafx.h" #include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include "RICHEDIT.H" #include "richedit.h"
namespace AssimpView { namespace AssimpView {
@ -53,7 +53,7 @@ namespace AssimpView {
INT_PTR CALLBACK HelpDialogProc(HWND hwndDlg,UINT uMsg, INT_PTR CALLBACK HelpDialogProc(HWND hwndDlg,UINT uMsg,
WPARAM wParam,LPARAM lParam) WPARAM wParam,LPARAM lParam)
{ {
lParam; (void)lParam;
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -70,7 +70,6 @@ INT_PTR CALLBACK HelpDialogProc(HWND hwndDlg,UINT uMsg,
SendDlgItemMessage(hwndDlg,IDC_RICHEDIT21, SendDlgItemMessage(hwndDlg,IDC_RICHEDIT21,
EM_SETTEXTEX,(WPARAM)&sInfo,( LPARAM) pData); EM_SETTEXTEX,(WPARAM)&sInfo,( LPARAM) pData);
UnlockResource(hg);
FreeResource(hg); FreeResource(hg);
return TRUE; return TRUE;
} }

View File

@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "stdafx.h" #include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include "RichEdit.h" #include "richedit.h"
namespace AssimpView { namespace AssimpView {
@ -70,7 +70,7 @@ static const char* AI_VIEW_RTF_LOG_HEADER =
INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg, INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
WPARAM wParam,LPARAM lParam) WPARAM wParam,LPARAM lParam)
{ {
lParam; (void)lParam;
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:

View File

@ -299,7 +299,7 @@ int CMaterialManager::FindValidPath(aiString* p_szString)
if( !q ) q=strrchr( tmp2,'\\' ); if( !q ) q=strrchr( tmp2,'\\' );
if( q ){ if( q ){
strcpy( q+1,p+1 ); strcpy( q+1,p+1 );
if(pFile=fopen( tmp2,"r" ) ){ if((pFile=fopen( tmp2,"r" ))){
fclose( pFile ); fclose( pFile );
strcpy(p_szString->data,tmp2); strcpy(p_szString->data,tmp2);
p_szString->length = strlen(tmp2); p_szString->length = strlen(tmp2);

View File

@ -61,7 +61,7 @@ int CMeshRenderer::DrawUnsorted(unsigned int iIndex)
g_piDevice->SetIndices(g_pcAsset->apcMeshes[iIndex]->piIB); g_piDevice->SetIndices(g_pcAsset->apcMeshes[iIndex]->piIB);
D3DPRIMITIVETYPE type; D3DPRIMITIVETYPE type = D3DPT_POINTLIST;
switch (g_pcAsset->pcScene->mMeshes[iIndex]->mPrimitiveTypes) { switch (g_pcAsset->pcScene->mMeshes[iIndex]->mPrimitiveTypes) {
case aiPrimitiveType_POINT: case aiPrimitiveType_POINT:
type = D3DPT_POINTLIST;break; type = D3DPT_POINTLIST;break;

View File

@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "stdafx.h" #include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include <Windowsx.h> #include <windowsx.h>
namespace AssimpView { namespace AssimpView {
@ -95,16 +95,16 @@ void MakeFileAssociations()
ai_assert(sz[0] == '*'); ai_assert(sz[0] == '*');
sprintf(buf,"Software\\Classes\\%s",sz+1); sprintf(buf,"Software\\Classes\\%s",sz+1);
RegCreateKeyEx(HKEY_CURRENT_USER,buf,NULL,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL); RegCreateKeyEx(HKEY_CURRENT_USER,buf,0,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL);
RegSetValueEx(g_hRegistry,"",0,REG_SZ,(const BYTE*)"ASSIMPVIEW_CLASS",(DWORD)strlen("ASSIMPVIEW_CLASS")+1); RegSetValueEx(g_hRegistry,"",0,REG_SZ,(const BYTE*)"ASSIMPVIEW_CLASS",(DWORD)strlen("ASSIMPVIEW_CLASS")+1);
RegCloseKey(g_hRegistry); RegCloseKey(g_hRegistry);
} }
while (sz = strtok(NULL,";")); while ((sz = strtok(NULL,";")));
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS",NULL,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL); RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS",0,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL);
RegCloseKey(g_hRegistry); RegCloseKey(g_hRegistry);
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS\\shell\\open\\command",NULL,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL); RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS\\shell\\open\\command",0,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL);
RegSetValueEx(g_hRegistry,"",0,REG_SZ,(const BYTE*)szTemp,(DWORD)strlen(szTemp)+1); RegSetValueEx(g_hRegistry,"",0,REG_SZ,(const BYTE*)szTemp,(DWORD)strlen(szTemp)+1);
RegCloseKey(g_hRegistry); RegCloseKey(g_hRegistry);
@ -522,7 +522,7 @@ void DisplayColorDialog(D3DCOLOR* pclrResult)
clr.lpCustColors = g_aclCustomColors; clr.lpCustColors = g_aclCustomColors;
clr.lpfnHook = NULL; clr.lpfnHook = NULL;
clr.lpTemplateName = NULL; clr.lpTemplateName = NULL;
clr.lCustData = NULL; clr.lCustData = 0;
ChooseColor(&clr); ChooseColor(&clr);
@ -549,7 +549,7 @@ void DisplayColorDialog(D3DXVECTOR4* pclrResult)
clr.lpCustColors = g_aclCustomColors; clr.lpCustColors = g_aclCustomColors;
clr.lpfnHook = NULL; clr.lpfnHook = NULL;
clr.lpTemplateName = NULL; clr.lpTemplateName = NULL;
clr.lCustData = NULL; clr.lCustData = 0;
ChooseColor(&clr); ChooseColor(&clr);
@ -1120,7 +1120,7 @@ void InitUI()
// store the key in a global variable for later use // store the key in a global variable for later use
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\ASSIMP\\Viewer", RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\ASSIMP\\Viewer",
NULL,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL); 0,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL);
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LastUIState",NULL,NULL, if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LastUIState",NULL,NULL,
(BYTE*)&dwValue,&dwTemp)) (BYTE*)&dwValue,&dwTemp))
@ -2411,7 +2411,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
}; };
DWORD dwTemp = MAX_PATH; DWORD dwTemp = MAX_PATH;
RegCreateKeyEx(HKEY_CURRENT_USER, RegCreateKeyEx(HKEY_CURRENT_USER,
"Software\\ASSIMP\\Viewer",NULL,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL); "Software\\ASSIMP\\Viewer",0,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL);
if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,"LastSkyBoxSrc",NULL,NULL, if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,"LastSkyBoxSrc",NULL,NULL,
(BYTE*)szFileName,&dwTemp) && '\0' != szFileName[0]) (BYTE*)szFileName,&dwTemp) && '\0' != szFileName[0])
{ {

View File

@ -60,16 +60,16 @@ class RenderOptions
bSuperSample (false), bSuperSample (false),
bRenderMats (true), bRenderMats (true),
bRenderNormals (false), bRenderNormals (false),
eDrawMode (NORMAL),
b3Lights (false), b3Lights (false),
bLightRotate (false), bLightRotate (false),
bRotate (true), bRotate (true),
bLowQuality (false), bLowQuality (false),
bNoSpecular (false), bNoSpecular (false),
bStereoView (false), bStereoView (false),
bNoAlphaBlending(false),
eDrawMode (NORMAL),
bCulling (false), bCulling (false),
bSkeleton (false), bSkeleton (false)
bNoAlphaBlending(false)
{} {}

View File

@ -106,7 +106,7 @@ aiVector3D g_vRotateSpeed = aiVector3D(0.5f,0.5f,0.5f);
aiVector3D g_avLightDirs[1] = aiVector3D g_avLightDirs[1] =
{ aiVector3D(-0.5f,0.6f,0.2f) }; { aiVector3D(-0.5f,0.6f,0.2f) };
extern D3DCOLOR g_avLightColors[3] = D3DCOLOR g_avLightColors[3] =
{ {
D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0xFF), D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0xFF),
D3DCOLOR_ARGB(0xFF,0xFF,0x00,0x00), D3DCOLOR_ARGB(0xFF,0xFF,0x00,0x00),
@ -872,12 +872,10 @@ int CreateHUDTexture()
g_pcTexture = NULL; g_pcTexture = NULL;
g_szImageMask = NULL; g_szImageMask = NULL;
UnlockResource(hg);
FreeResource(hg); FreeResource(hg);
return 0; return 0;
} }
UnlockResource(hg);
FreeResource(hg); FreeResource(hg);
D3DSURFACE_DESC sDesc; D3DSURFACE_DESC sDesc;
@ -909,12 +907,10 @@ int CreateHUDTexture()
D3DCOLOR_ARGB(0xFF,0xFF,0,0)); D3DCOLOR_ARGB(0xFF,0xFF,0,0));
g_szImageMask = NULL; g_szImageMask = NULL;
UnlockResource(hg);
FreeResource(hg); FreeResource(hg);
return 0; return 0;
} }
UnlockResource(hg);
FreeResource(hg); FreeResource(hg);
// lock the texture and copy it to get a pointer // lock the texture and copy it to get a pointer

View File

@ -44,14 +44,14 @@
#include <d3d9.h> #include <d3d9.h>
#include <d3dx9.h> #include <d3dx9.h>
#include <D3DX9Mesh.h> #include <d3dx9mesh.h>
// ShellExecute() // ShellExecute()
#include <shellapi.h> #include <shellapi.h>
#include <commctrl.h> #include <commctrl.h>
// GetOpenFileName() // GetOpenFileName()
#include <Commdlg.h> #include <commdlg.h>
#include <algorithm> #include <algorithm>
#include <mmsystem.h> #include <mmsystem.h>
@ -60,13 +60,15 @@
#include <list> #include <list>
#include <vector> #include <vector>
#if defined _MSC_VER
// Windows CommonControls 6.0 Manifest Extensions // Windows CommonControls 6.0 Manifest Extensions
#if defined _M_IX86 # if defined _M_IX86
# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64 # elif defined _M_IA64
# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64 # elif defined _M_X64
# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else # else
# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
# endif
#endif #endif