From 60d803f49050344f761010ac91750aa5ce67531d Mon Sep 17 00:00:00 2001 From: kimkulling Date: Wed, 9 May 2018 09:51:05 +0200 Subject: [PATCH 01/20] Some minor fixes of typos and formatting issues. --- tools/assimp_view/AnimEvaluator.cpp | 3 +- tools/assimp_view/Display.cpp | 24 ++-- tools/assimp_view/MessageProc.cpp | 31 ++--- tools/assimp_view/assimp_view.cpp | 8 +- tools/assimp_view/assimp_view.rc | 169 ++++++++++++---------------- 5 files changed, 102 insertions(+), 133 deletions(-) diff --git a/tools/assimp_view/AnimEvaluator.cpp b/tools/assimp_view/AnimEvaluator.cpp index 0d6c7c75a..94c581df4 100644 --- a/tools/assimp_view/AnimEvaluator.cpp +++ b/tools/assimp_view/AnimEvaluator.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2015, assimp team +Copyright (c) 2006-2018, assimp team All rights reserved. @@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "assimp_view.h" + #include using namespace AssimpView; diff --git a/tools/assimp_view/Display.cpp b/tools/assimp_view/Display.cpp index 7d986fa9c..207c26fa9 100644 --- a/tools/assimp_view/Display.cpp +++ b/tools/assimp_view/Display.cpp @@ -96,8 +96,9 @@ D3DXVECTOR4 g_aclNormalColors[14] = void GetNodeCount(aiNode* pcNode, unsigned int* piCnt) { *piCnt = *piCnt+1; - for (unsigned int i = 0; i < pcNode->mNumChildren;++i) - GetNodeCount(pcNode->mChildren[i],piCnt); + for (unsigned int i = 0; i < pcNode->mNumChildren; ++i) { + GetNodeCount(pcNode->mChildren[i], piCnt); + } } //------------------------------------------------------------------------------- @@ -1042,16 +1043,23 @@ int CDisplay::OnSetupTextureView(TextureInfo* pcNew) switch (pcNew->eOp) { case aiTextureOp_Add: - szOp = "add";break; + szOp = "add"; + break; case aiTextureOp_Subtract: - szOp = "sub";break; + szOp = "sub"; + break; case aiTextureOp_Divide: - szOp = "div";break; + szOp = "div"; + break; case aiTextureOp_SignedAdd: - szOp = "addsign";break; + szOp = "addsign"; + break; case aiTextureOp_SmoothAdd: - szOp = "addsmooth";break; - default: szOp = "mul"; + szOp = "addsmooth"; + break; + default: + szOp = "mul"; + break; }; SetWindowText(GetDlgItem(g_hDlg,IDC_ELOAD),szOp); diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index 71bc5c8bb..695e8cfd6 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -80,8 +80,7 @@ void SaveHistory(); // File associations are registered in HKCU\Software\Classes. They might // be overwritten by global file associations. //------------------------------------------------------------------------------- -void MakeFileAssociations() - { +void MakeFileAssociations() { char szTemp2[MAX_PATH]; char szTemp[MAX_PATH + 10]; @@ -1399,7 +1398,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, g_hDlg = hwndDlg; - // load the state of the usr interface + // load the state of the user interface InitUI(); // load the file history @@ -1643,11 +1642,6 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, xPos = xPos2 = sPoint.x; yPos = yPos2 = sPoint.y; - /* xPos -= 10; - yPos -= 10; - xPos2 = xPos-3; - yPos2 = yPos-5;*/ - RECT sRect; GetWindowRect(GetDlgItem(g_hDlg,IDC_RT),&sRect); sRect.right -= sRect.left; @@ -1830,7 +1824,6 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, return TRUE; case WM_COMMAND: - HMENU hMenu = GetMenu(g_hDlg); if (ID_VIEWER_QUIT == LOWORD(wParam)) { @@ -2361,7 +2354,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) - { +{ UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); @@ -2371,14 +2364,13 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // load windows common controls library to get XP style InitCommonControls(); - // intiailize the IDirect3D9 interface + // initialize the IDirect3D9 interface g_hInstance = hInstance; - if (0 == InitD3D()) - { + if (0 == InitD3D()) { MessageBox(NULL,"Failed to initialize Direct3D 9", "ASSIMP ModelViewer",MB_OK); return -6; - } + } // create the main dialog HWND hDlg = CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOGMAIN), @@ -2395,12 +2387,11 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, Assimp::DefaultLogger::Debugging | Assimp::DefaultLogger::Info | Assimp::DefaultLogger::Err | Assimp::DefaultLogger::Warn); - if (NULL == hDlg) - { + if (NULL == hDlg) { MessageBox(NULL,"Failed to create dialog from resource", "ASSIMP ModelViewer",MB_OK); return -5; - } + } // display the window g_hDlg = hDlg; @@ -2410,12 +2401,12 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, UpdateWindow( hDlg ); // create the D3D device object - if (0 == CreateDevice(g_sOptions.bMultiSample,false,true)) - { + if (0 == CreateDevice(g_sOptions.bMultiSample,false,true)) { MessageBox(NULL,"Failed to initialize Direct3D 9 (2)", "ASSIMP ModelViewer",MB_OK); return -4; - } + } + CLogDisplay::Instance().AddEntry("[OK] Here we go!"); // create the log window diff --git a/tools/assimp_view/assimp_view.cpp b/tools/assimp_view/assimp_view.cpp index e68b20a00..ac2d1e66d 100644 --- a/tools/assimp_view/assimp_view.cpp +++ b/tools/assimp_view/assimp_view.cpp @@ -143,7 +143,7 @@ float g_fLoadTime = 0.0f; //------------------------------------------------------------------------------- // Entry point for the loader thread -// The laoder thread loads the asset while the progress dialog displays the +// The loader thread loads the asset while the progress dialog displays the // smart progress bar //------------------------------------------------------------------------------- DWORD WINAPI LoadThreadProc(LPVOID lpParameter) @@ -200,9 +200,9 @@ DWORD WINAPI LoadThreadProc(LPVOID lpParameter) // load the current asset // THe path to the asset is specified in the global path variable //------------------------------------------------------------------------------- -int LoadAsset(void) +int LoadAsset() { - // set the world and world rotation matrices to the identuty + // set the world and world rotation matrices to the identity g_mWorldRotate = aiMatrix4x4(); g_mWorld = aiMatrix4x4(); @@ -1130,8 +1130,6 @@ int GetProjectionMatrix (aiMatrix4x4& p_mOut) return 1; } - -//------------------------------------------------------------------------------- //------------------------------------------------------------------------------- aiVector3D GetCameraMatrix (aiMatrix4x4& p_mOut) { diff --git a/tools/assimp_view/assimp_view.rc b/tools/assimp_view/assimp_view.rc index 093b860fc..aca323b09 100644 --- a/tools/assimp_view/assimp_view.rc +++ b/tools/assimp_view/assimp_view.rc @@ -15,13 +15,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// German (Germany) resources +// Deutsch (Deutschland) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 LANGUAGE LANG_GERMAN, SUBLANG_GERMAN #pragma code_page(1252) -#endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // @@ -32,6 +30,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // remains consistent on all systems. IDI_ASSIMP_VIEW ICON "../shared/assimp_tools_icon.ico" + ///////////////////////////////////////////////////////////////////////////// // // Dialog @@ -49,104 +48,63 @@ BEGIN LTEXT "http://assimp.sourceforge.net http://www.zfx.info",IDC_STATIC,31,101,127,22 DEFPUSHBUTTON "Love this library",IDOK,186,110,84,14 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,148,283,1 - CONTROL 130,IDC_STATIC,"Static",SS_BITMAP,0,129,514,20 + CONTROL IDB_BITMAP1,IDC_STATIC,"Static",SS_BITMAP,0,129,514,20 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,10,281,1 END -#define X_GROUP1 7 -#define W_GROUP1 6+160+6 -#define X_GROUP2 X_GROUP1+W_GROUP1+7 -#define W_GROUP2 6+150+8 -#define X_GROUP3 X_GROUP2+W_GROUP2+7 -#define W_GROUP3 6+60+35+8 - -#define W X_GROUP3+W_GROUP3+47 -#define H 450 - -#define Y_PANEL H-12-82-7-7-14-4 -#define Y_GROUPS Y_PANEL+14+7 - -#define TREE_W 143 -#define COMBO_W 100 - -IDD_DIALOGMAIN DIALOGEX 0, 0, W+TREE_W, H -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_DIALOGMAIN DIALOGEX 0, 0, 656, 450 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES | WS_EX_WINDOWEDGE CAPTION "Open Asset Import Library - Model Viewer " MENU IDR_MENU1 FONT 8, "Microsoft Sans Serif", 400, 0, 0x0 BEGIN - - CONTROL "",IDC_RT,"Static",SS_OWNERDRAW,0,0,W,Y_PANEL - CONTROL "",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS|TVS_HASLINES|TVS_SHOWSELALWAYS|WS_BORDER|WS_HSCROLL|WS_TABSTOP, W,0,TREE_W,H - -#define Y Y_PANEL+4 - CONTROL "<<",IDC_BLUBB,"Button",BS_AUTOCHECKBOX|BS_PUSHLIKE|WS_TABSTOP, W-7-35,Y,35,14 - COMBOBOX IDC_COMBO1, W-7-35-4-100,Y,100,14, CBS_DROPDOWN|WS_VSCROLL|WS_TABSTOP - PUSHBUTTON "Play",IDC_PLAY, W-7-35-4-100-35-4,Y,35,14 - CONTROL "",IDC_SLIDERANIM,"msctls_trackbar32",TBS_AUTOTICKS|TBS_BOTH|TBS_NOTICKS|WS_TABSTOP, 0,Y,W-7-35-4-100-35-4,15 - -#undef Y -#define Y Y_GROUPS+12 -#define X X_GROUP1+6 - - GROUPBOX "Display",IDC_STATIC, X_GROUP1,Y_GROUPS,W_GROUP1,12+82+7 - - CONTROL "Multisampling [M]",IDC_TOGGLEMS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y,80,10 - CONTROL "Wireframe [W]",IDC_TOGGLEWIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y+12,80,10 - CONTROL "No materials [D]",IDC_TOGGLEMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y+24,80,10 - CONTROL "Display normals [N]",IDC_TOGGLENORMALS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y+36,80,10 - CONTROL "Low quality [P]",IDC_LOWQUALITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y+48,80,10 - CONTROL "No specular [S]",IDC_NOSPECULAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y+60,80,10 - CONTROL "Show skeleton [K]",IDC_SHOWSKELETON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X,Y+72,80,10 - - CONTROL "AutoRotate [A]",IDC_AUTOROTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X+80,Y,80,10 - CONTROL "Zoom/Rotate [Z]",IDC_ZOOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X+80,Y+12,80,10 - CONTROL "Rotate lights [R]",IDC_LIGHTROTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X+80,Y+24,80,10 - CONTROL "Two lights [L]",IDC_3LIGHTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X+80,Y+36,80,10 - CONTROL "Backface culling [C]",IDC_BFCULL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X+80,Y+48,80,10 - CONTROL "No transparency [T]",IDC_NOAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, X+80,Y+60,80,10 - -#undef X -#define X X_GROUP2+6 - - GROUPBOX "Statistics",IDC_STATIC, X_GROUP2,Y_GROUPS,W_GROUP2,12+36+8+7 - - LTEXT "Vertices:",IDC_NUMVERTS, X,Y,35,8 - LTEXT "Nodes:",IDC_NUMNODES, X,Y+12,35,8 - LTEXT "Shaders:",IDC_NUMSHADERS, X,Y+24,35,8 - LTEXT "Time:",IDC_LOADTIME, X,Y+36,35,8 - - EDITTEXT IDC_EVERT, X+35,Y,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - EDITTEXT IDC_ENODEWND, X+35,Y+12,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - EDITTEXT IDC_ESHADER, X+35,Y+24,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - EDITTEXT IDC_ELOAD, X+35,Y+36,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - - LTEXT "Faces:",IDC_NUMFACES, X+80,Y,35,8 - LTEXT "Materials:",IDC_NUMMATS, X+80,Y+12,35,8 - LTEXT "Meshes:",IDC_NUMMESHES, X+80,Y+24,35,8 - LTEXT "FPS:",IDC_FPS, X+80,Y+36,35,8 - - EDITTEXT IDC_EFACE, X+115,Y,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - EDITTEXT IDC_EMAT, X+115,Y+12,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - EDITTEXT IDC_EMESH, X+115,Y+24,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - EDITTEXT IDC_EFPS, X+115,Y+36,35,8, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | ES_RIGHT - - EDITTEXT IDC_VIEWMATRIX, X,Y+48+7,72,44, ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_VISIBLE - -#undef X -#define X X_GROUP3+6 - - GROUPBOX "Colors",IDC_STATIC, X_GROUP3,Y_GROUPS,W_GROUP3,12+54+14+7 - - LTEXT "Primary:",IDC_STATIC, X,Y+3,48,8 - LTEXT "Secondary:",IDC_STATIC, X,Y+3+18,54,8 - LTEXT "Ambient:",IDC_STATIC, X,Y+3+36,54,8 - - CONTROL "Button1",IDC_LCOLOR1,"Button",BS_OWNERDRAW | WS_TABSTOP, X+60,Y,35,14 - CONTROL "Button1",IDC_LCOLOR2,"Button",BS_OWNERDRAW | WS_TABSTOP, X+60,Y+18,35,14 - CONTROL "Button1",IDC_LCOLOR3,"Button",BS_OWNERDRAW | WS_TABSTOP, X+60,Y+36,35,14 - PUSHBUTTON "Reset",IDC_LRESET, X+60,Y+54,35,14 + CONTROL "",IDC_RT,"Static",SS_OWNERDRAW,0,0,513,324 + CONTROL "",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,513,0,143,450 + CONTROL "<<",IDC_BLUBB,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,471,328,35,14 + COMBOBOX IDC_COMBO1,367,328,100,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Play",IDC_PLAY,328,328,35,14 + CONTROL "",IDC_SLIDERANIM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,0,328,328,15 + GROUPBOX "Display",IDC_STATIC,7,345,172,101 + CONTROL "Multisampling [M]",IDC_TOGGLEMS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,357,80,10 + CONTROL "Wireframe [W]",IDC_TOGGLEWIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,369,80,10 + CONTROL "No materials [D]",IDC_TOGGLEMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,381,80,10 + CONTROL "Display normals [N]",IDC_TOGGLENORMALS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,393,80,10 + CONTROL "Low quality [P]",IDC_LOWQUALITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,405,80,10 + CONTROL "No specular [S]",IDC_NOSPECULAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,417,80,10 + CONTROL "Show skeleton [K]",IDC_SHOWSKELETON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,429,80,10 + CONTROL "AutoRotate [A]",IDC_AUTOROTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,357,80,10 + CONTROL "Zoom/Rotate [Z]",IDC_ZOOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,369,80,10 + CONTROL "Rotate lights [R]",IDC_LIGHTROTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,381,80,10 + CONTROL "Two lights [L]",IDC_3LIGHTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,393,80,10 + CONTROL "Backface culling [C]",IDC_BFCULL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,405,80,10 + CONTROL "No transparency [T]",IDC_NOAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,417,80,10 + GROUPBOX "Statistics",IDC_STATIC,186,345,164,63 + LTEXT "Vertices:",IDC_NUMVERTS,192,357,35,8 + LTEXT "Nodes:",IDC_NUMNODES,192,369,35,8 + LTEXT "Shaders:",IDC_NUMSHADERS,192,381,35,8 + LTEXT "Time:",IDC_LOADTIME,192,393,35,8 + EDITTEXT IDC_EVERT,227,357,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_ENODEWND,227,369,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_ESHADER,227,381,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_ELOAD,227,393,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "Faces:",IDC_NUMFACES,272,357,35,8 + LTEXT "Materials:",IDC_NUMMATS,272,369,35,8 + LTEXT "Meshes:",IDC_NUMMESHES,272,381,35,8 + LTEXT "FPS:",IDC_FPS,272,393,35,8 + EDITTEXT IDC_EFACE,307,357,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_EMAT,307,369,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_EMESH,307,381,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_EFPS,307,393,35,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_VIEWMATRIX,192,412,72,44,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE | NOT WS_BORDER + GROUPBOX "Colors",IDC_STATIC,357,345,109,87 + LTEXT "Primary:",IDC_STATIC,363,360,48,8 + LTEXT "Secondary:",IDC_STATIC,363,378,54,8 + LTEXT "Ambient:",IDC_STATIC,363,396,54,8 + CONTROL "Button1",IDC_LCOLOR1,"Button",BS_OWNERDRAW | WS_TABSTOP,423,357,35,14 + CONTROL "Button1",IDC_LCOLOR2,"Button",BS_OWNERDRAW | WS_TABSTOP,423,375,35,14 + CONTROL "Button1",IDC_LCOLOR3,"Button",BS_OWNERDRAW | WS_TABSTOP,423,393,35,14 + PUSHBUTTON "Reset",IDC_LRESET,423,411,35,14 END IDD_LOADDIALOG DIALOGEX 0, 0, 143, 60 @@ -268,7 +226,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_ABOUTBOX, DIALOG BEGIN @@ -279,7 +237,6 @@ BEGIN IDD_DIALOGMAIN, DIALOG BEGIN RIGHTMARGIN, 623 - BOTTOMMARGIN, 484 END IDD_LOADDIALOG, DIALOG @@ -321,23 +278,34 @@ END // IDB_BITMAP1 BITMAP "banner.bmp" + IDB_BANIM BITMAP "base_anim.bmp" + IDB_BDISPLAY BITMAP "base_display.bmp" + IDB_BINTER BITMAP "base_inter.bmp" + IDB_BRENDERING BITMAP "base_rendering.bmp" + IDB_BSTATS BITMAP "base_stats.bmp" + IDB_BTX BITMAP "tx.bmp" + IDB_BFX BITMAP "fx.bmp" + IDB_BNODE BITMAP "n.bmp" + IDB_BROOT BITMAP "root.bmp" + IDB_BTXI BITMAP "txi.bmp" + ///////////////////////////////////////////////////////////////////////////// // // Menu // -IDR_MENU1 MENU +IDR_MENU1 MENU BEGIN POPUP "Viewer" BEGIN @@ -424,7 +392,7 @@ BEGIN END END -IDR_TXPOPUP MENU +IDR_TXPOPUP MENU BEGIN POPUP "Hey" BEGIN @@ -437,7 +405,7 @@ BEGIN MENUITEM "This is not an easter egg", 0 END -IDR_MATPOPUP MENU +IDR_MATPOPUP MENU BEGIN POPUP "So long" BEGIN @@ -473,14 +441,17 @@ END IDR_TEXT1 TEXT "text1.bin" + ///////////////////////////////////////////////////////////////////////////// // // RCDATA // IDR_HUD RCDATA "HUD.png" + IDR_HUDMASK RCDATA "HUDMask.png" -#endif // German (Germany) resources + +#endif // Deutsch (Deutschland) resources ///////////////////////////////////////////////////////////////////////////// From c08614bbff531e9e3f760595b7f0577a4dca78a0 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 10 May 2018 09:44:31 +0200 Subject: [PATCH 02/20] closes https://github.com/assimp/assimp/issues/919: add missing cast for vs2015. --- code/ColladaLoader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 45dd52710..611e487b0 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -1819,9 +1819,12 @@ void ColladaLoader::ConvertPath (aiString& ss) // Maxon Cinema Collada Export writes "file:///C:\andsoon" with three slashes... // I need to filter it without destroying linux paths starting with "/somewhere" - if( ss.data[0] == '/' && isalpha( ss.data[1]) && ss.data[2] == ':' ) - { - ss.length--; +#if defined( _MSC_VER ) + if( ss.data[0] == '/' && isalpha( (unsigned char) ss.data[1]) && ss.data[2] == ':' ) { +#else + if (ss.data[ 0 ] == '/' && isalpha( ss.data[ 1 ] ) && ss.data[ 2 ] == ':') { +#endif + --ss.length; ::memmove( ss.data, ss.data+1, ss.length); ss.data[ss.length] = 0; } From f7d0e05018cbb94afca918e72150825bae678982 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 10 May 2018 14:21:43 +0200 Subject: [PATCH 03/20] closes https://github.com/assimp/assimp/issues/1952: check for postprocessing parameter before try to parse -f --- tools/assimp_cmd/Export.cpp | 3 +- tools/assimp_cmd/Main.cpp | 75 +++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 41 deletions(-) diff --git a/tools/assimp_cmd/Export.cpp b/tools/assimp_cmd/Export.cpp index 55c017e33..03f896822 100644 --- a/tools/assimp_cmd/Export.cpp +++ b/tools/assimp_cmd/Export.cpp @@ -106,7 +106,8 @@ int Assimp_Export(const char* const* params, unsigned int num) continue; } if (!strncmp( params[i], "-f",2)) { - outf = std::string(params[i]+2); + if ( strncmp( params[ i ], "-fi",3 )) + outf = std::string(params[i]+2); } else if ( !strncmp( params[i], "--format=",9)) { outf = std::string(params[i]+9); diff --git a/tools/assimp_cmd/Main.cpp b/tools/assimp_cmd/Main.cpp index 14d00e1e1..41412b93d 100644 --- a/tools/assimp_cmd/Main.cpp +++ b/tools/assimp_cmd/Main.cpp @@ -261,7 +261,6 @@ void PrintHorBar() printf("-----------------------------------------------------------------\n"); } - // ------------------------------------------------------------------------------ // Import a specific file const aiScene* ImportModel( @@ -390,105 +389,101 @@ int ProcessStandardArguments( for (unsigned int i = 0; i < num;++i) { - if (! strcmp(params[i], "-ptv") || ! strcmp(params[i], "--pretransform-vertices")) { + const char *param = params[ i ]; + printf( "param = %s\n", param ); + if (! strcmp( param, "-ptv") || ! strcmp( param, "--pretransform-vertices")) { fill.ppFlags |= aiProcess_PreTransformVertices; } - else if (! strcmp(params[i], "-gsn") || ! strcmp(params[i], "--gen-smooth-normals")) { + else if (! strcmp( param, "-gsn") || ! strcmp( param, "--gen-smooth-normals")) { fill.ppFlags |= aiProcess_GenSmoothNormals; } - else if (! strcmp(params[i], "-gn") || ! strcmp(params[i], "--gen-normals")) { + else if (! strcmp( param, "-gn") || ! strcmp( param, "--gen-normals")) { fill.ppFlags |= aiProcess_GenNormals; } - else if (! strcmp(params[i], "-jiv") || ! strcmp(params[i], "--join-identical-vertices")) { + else if (! strcmp( param, "-jiv") || ! strcmp( param, "--join-identical-vertices")) { fill.ppFlags |= aiProcess_JoinIdenticalVertices; } - else if (! strcmp(params[i], "-rrm") || ! strcmp(params[i], "--remove-redundant-materials")) { + else if (! strcmp( param, "-rrm") || ! strcmp( param, "--remove-redundant-materials")) { fill.ppFlags |= aiProcess_RemoveRedundantMaterials; } - else if (! strcmp(params[i], "-fd") || ! strcmp(params[i], "--find-degenerates")) { + else if (! strcmp( param, "-fd") || ! strcmp( param, "--find-degenerates")) { fill.ppFlags |= aiProcess_FindDegenerates; } - else if (! strcmp(params[i], "-slm") || ! strcmp(params[i], "--split-large-meshes")) { + else if (! strcmp( param, "-slm") || ! strcmp( param, "--split-large-meshes")) { fill.ppFlags |= aiProcess_SplitLargeMeshes; } - else if (! strcmp(params[i], "-lbw") || ! strcmp(params[i], "--limit-bone-weights")) { + else if (! strcmp( param, "-lbw") || ! strcmp( param, "--limit-bone-weights")) { fill.ppFlags |= aiProcess_LimitBoneWeights; } - else if (! strcmp(params[i], "-vds") || ! strcmp(params[i], "--validate-data-structure")) { + else if (! strcmp( param, "-vds") || ! strcmp( param, "--validate-data-structure")) { fill.ppFlags |= aiProcess_ValidateDataStructure; } - else if (! strcmp(params[i], "-icl") || ! strcmp(params[i], "--improve-cache-locality")) { + else if (! strcmp( param, "-icl") || ! strcmp( param, "--improve-cache-locality")) { fill.ppFlags |= aiProcess_ImproveCacheLocality; } - else if (! strcmp(params[i], "-sbpt") || ! strcmp(params[i], "--sort-by-ptype")) { + else if (! strcmp( param, "-sbpt") || ! strcmp( param, "--sort-by-ptype")) { fill.ppFlags |= aiProcess_SortByPType; } - else if (! strcmp(params[i], "-lh") || ! strcmp(params[i], "--left-handed")) { + else if (! strcmp( param, "-lh") || ! strcmp( param, "--left-handed")) { fill.ppFlags |= aiProcess_ConvertToLeftHanded; } - else if (! strcmp(params[i], "-fuv") || ! strcmp(params[i], "--flip-uv")) { + else if (! strcmp( param, "-fuv") || ! strcmp( param, "--flip-uv")) { fill.ppFlags |= aiProcess_FlipUVs; } - else if (! strcmp(params[i], "-fwo") || ! strcmp(params[i], "--flip-winding-order")) { + else if (! strcmp( param, "-fwo") || ! strcmp( param, "--flip-winding-order")) { fill.ppFlags |= aiProcess_FlipWindingOrder; } - else if (! strcmp(params[i], "-tuv") || ! strcmp(params[i], "--transform-uv-coords")) { + else if (! strcmp( param, "-tuv") || ! strcmp( param, "--transform-uv-coords")) { fill.ppFlags |= aiProcess_TransformUVCoords; } - else if (! strcmp(params[i], "-guv") || ! strcmp(params[i], "--gen-uvcoords")) { + else if (! strcmp( param, "-guv") || ! strcmp( param, "--gen-uvcoords")) { fill.ppFlags |= aiProcess_GenUVCoords; } - else if (! strcmp(params[i], "-fid") || ! strcmp(params[i], "--find-invalid-data")) { + else if (! strcmp( param, "-fid") || ! strcmp( param, "--find-invalid-data")) { fill.ppFlags |= aiProcess_FindInvalidData; } - else if (! strcmp(params[i], "-fixn") || ! strcmp(params[i], "--fix-normals")) { + else if (! strcmp( param, "-fixn") || ! strcmp( param, "--fix-normals")) { fill.ppFlags |= aiProcess_FixInfacingNormals; } - else if (! strcmp(params[i], "-tri") || ! strcmp(params[i], "--triangulate")) { + else if (! strcmp( param, "-tri") || ! strcmp( param, "--triangulate")) { fill.ppFlags |= aiProcess_Triangulate; } - else if (! strcmp(params[i], "-cts") || ! strcmp(params[i], "--calc-tangent-space")) { + else if (! strcmp( param, "-cts") || ! strcmp( param, "--calc-tangent-space")) { fill.ppFlags |= aiProcess_CalcTangentSpace; } - else if (! strcmp(params[i], "-fi") || ! strcmp(params[i], "--find-instances")) { + else if (! strcmp( param, "-fi") || ! strcmp( param, "--find-instances")) { fill.ppFlags |= aiProcess_FindInstances; } - else if (! strcmp(params[i], "-og") || ! strcmp(params[i], "--optimize-graph")) { + else if (! strcmp( param, "-og") || ! strcmp( param, "--optimize-graph")) { fill.ppFlags |= aiProcess_OptimizeGraph; } - else if (! strcmp(params[i], "-om") || ! strcmp(params[i], "--optimize-meshes")) { + else if (! strcmp( param, "-om") || ! strcmp( param, "--optimize-meshes")) { fill.ppFlags |= aiProcess_OptimizeMeshes; } - else if (! strcmp(params[i], "-db") || ! strcmp(params[i], "--debone")) { + else if (! strcmp( param, "-db") || ! strcmp( param, "--debone")) { fill.ppFlags |= aiProcess_Debone; } - else if (! strcmp(params[i], "-sbc") || ! strcmp(params[i], "--split-by-bone-count")) { + else if (! strcmp( param, "-sbc") || ! strcmp( param, "--split-by-bone-count")) { fill.ppFlags |= aiProcess_SplitByBoneCount; } - - - else if (! strncmp(params[i], "-c",2) || ! strncmp(params[i], "--config=",9)) { - + else if (! strncmp( param, "-c",2) || ! strncmp( param, "--config=",9)) { const unsigned int ofs = (params[i][1] == '-' ? 9 : 2); // use default configurations - if (! strncmp(params[i]+ofs,"full",4)) { - fill.ppFlags |= aiProcessPreset_TargetRealtime_MaxQuality; - } - else if (! strncmp(params[i]+ofs,"default",7)) { + if (!strncmp( param + ofs, "full", 4 )) { + fill.ppFlags |= aiProcessPreset_TargetRealtime_MaxQuality; + } else if (!strncmp( param + ofs, "default", 7 )) { fill.ppFlags |= aiProcessPreset_TargetRealtime_Quality; - } - else if (! strncmp(params[i]+ofs,"fast",4)) { + } else if (! strncmp( param +ofs,"fast",4)) { fill.ppFlags |= aiProcessPreset_TargetRealtime_Fast; } - } - else if (! strcmp(params[i], "-l") || ! strcmp(params[i], "--show-log")) { + } else if (! strcmp( param, "-l") || ! strcmp( param, "--show-log")) { fill.showLog = true; } - else if (! strcmp(params[i], "-v") || ! strcmp(params[i], "--verbose")) { + else if (! strcmp( param, "-v") || ! strcmp( param, "--verbose")) { fill.verbose = true; } - else if (! strncmp(params[i], "--log-out=",10) || ! strncmp(params[i], "-lo",3)) { + else if (! strncmp( param, "--log-out=",10) || ! strncmp( param, "-lo",3)) { fill.logFile = std::string(params[i]+(params[i][1] == '-' ? 10 : 3)); if (!fill.logFile.length()) { fill.logFile = "assimp-log.txt"; From 1c9406b2f59d5235f2b69192551f4cae391f4c92 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 08:09:07 +0200 Subject: [PATCH 04/20] add linetest files to gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2a3b68a50..f8dda3e8b 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ tools/assimp_cmd/Makefile # Tests test/results +test/readlinetest* # Python __pycache__ From ef605fecaa4c51f3b59f5d1038a9f7ddd2417967 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 08:09:27 +0200 Subject: [PATCH 05/20] FBX: small optimization to avoind static computation in loop. --- code/FBXBinaryTokenizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/FBXBinaryTokenizer.cpp b/code/FBXBinaryTokenizer.cpp index d6c34de6f..b81a9f945 100644 --- a/code/FBXBinaryTokenizer.cpp +++ b/code/FBXBinaryTokenizer.cpp @@ -448,8 +448,8 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int le /*Result ignored*/ ReadByte(input, cursor, input + length); const uint32_t version = ReadWord(input, cursor, input + length); const bool is64bits = version >= 7500; - while (cursor < input + length) - { + const char *end = input + length; + while (cursor < end ) { if (!ReadScope(output_tokens, input, cursor, input + length, is64bits)) { break; } From f93ee9daced8e77227bdeba50fffd5e596eabe99 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 08:10:26 +0200 Subject: [PATCH 06/20] closes https://github.com/assimp/assimp/issues/1780: check against nullptr before accessing normal data in aiMesh instance. --- code/glTF2Exporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index 5376788b2..9bb99b0b0 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -728,8 +728,10 @@ void glTF2Exporter::ExportMeshes() /******************** Normals ********************/ // Normalize all normals as the validator can emit a warning otherwise - for (auto i = 0u; i < aim->mNumVertices; ++i) { - aim->mNormals[i].Normalize(); + if ( nullptr != aim->mNormals) { + for ( auto i = 0u; i < aim->mNumVertices; ++i ) { + aim->mNormals[ i ].Normalize(); + } } Ref n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT); From 950496c351ff7a438c812b6b4719343d8ea4ccd9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 08:39:22 +0200 Subject: [PATCH 07/20] some minor refactorings. --- code/glTF2Exporter.cpp | 17 ++++++++++------- code/glTF2Exporter.h | 28 ++++++++++++---------------- test/unit/utglTF2ImportExport.cpp | 1 + 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index 9bb99b0b0..d4b3d67de 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -138,28 +138,29 @@ glTF2Exporter::glTF2Exporter(const char* filename, IOSystem* pIOSystem, const ai } } +glTF2Exporter::~glTF2Exporter() { + // empty +} + /* * Copy a 4x4 matrix from struct aiMatrix to typedef mat4. * Also converts from row-major to column-major storage. */ -static void CopyValue(const aiMatrix4x4& v, mat4& o) -{ +static void CopyValue(const aiMatrix4x4& v, mat4& o) { o[ 0] = v.a1; o[ 1] = v.b1; o[ 2] = v.c1; o[ 3] = v.d1; o[ 4] = v.a2; o[ 5] = v.b2; o[ 6] = v.c2; o[ 7] = v.d2; o[ 8] = v.a3; o[ 9] = v.b3; o[10] = v.c3; o[11] = v.d3; o[12] = v.a4; o[13] = v.b4; o[14] = v.c4; o[15] = v.d4; } -static void CopyValue(const aiMatrix4x4& v, aiMatrix4x4& o) -{ +static void CopyValue(const aiMatrix4x4& v, aiMatrix4x4& o) { o.a1 = v.a1; o.a2 = v.a2; o.a3 = v.a3; o.a4 = v.a4; o.b1 = v.b1; o.b2 = v.b2; o.b3 = v.b3; o.b4 = v.b4; o.c1 = v.c1; o.c2 = v.c2; o.c3 = v.c3; o.c4 = v.c4; o.d1 = v.d1; o.d2 = v.d2; o.d3 = v.d3; o.d4 = v.d4; } -static void IdentityMatrix4(mat4& o) -{ +static void IdentityMatrix4(mat4& o) { o[ 0] = 1; o[ 1] = 0; o[ 2] = 0; o[ 3] = 0; o[ 4] = 0; o[ 5] = 1; o[ 6] = 0; o[ 7] = 0; o[ 8] = 0; o[ 9] = 0; o[10] = 1; o[11] = 0; @@ -169,7 +170,9 @@ static void IdentityMatrix4(mat4& o) inline Ref ExportData(Asset& a, std::string& meshName, Ref& buffer, unsigned int count, void* data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, bool isIndices = false) { - if (!count || !data) return Ref(); + if (!count || !data) { + return Ref(); + } unsigned int numCompsIn = AttribType::GetNumComponents(typeIn); unsigned int numCompsOut = AttribType::GetNumComponents(typeOut); diff --git a/code/glTF2Exporter.h b/code/glTF2Exporter.h index ff94be9e9..616a1177c 100644 --- a/code/glTF2Exporter.h +++ b/code/glTF2Exporter.h @@ -87,28 +87,15 @@ namespace Assimp // ------------------------------------------------------------------------------------------------ /** Helper class to export a given scene to an glTF file. */ // ------------------------------------------------------------------------------------------------ - class glTF2Exporter - { + class glTF2Exporter { public: /// Constructor for a specific scene to export glTF2Exporter(const char* filename, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties, bool binary); + ~glTF2Exporter(); - private: - - const char* mFilename; - IOSystem* mIOSystem; - const aiScene* mScene; - const ExportProperties* mProperties; - - std::map mTexturesByPath; - - std::shared_ptr mAsset; - - std::vector mBodyData; - + protected: void WriteBinaryData(IOStream* outfile, std::size_t sceneLength); - void GetTexSampler(const aiMaterial* mat, glTF2::Ref texture, aiTextureType tt, unsigned int slot); void GetMatTexProp(const aiMaterial* mat, unsigned int& prop, const char* propName, aiTextureType tt, unsigned int idx); void GetMatTexProp(const aiMaterial* mat, float& prop, const char* propName, aiTextureType tt, unsigned int idx); @@ -126,6 +113,15 @@ namespace Assimp unsigned int ExportNode(const aiNode* node, glTF2::Ref& parent); void ExportScene(); void ExportAnimations(); + + private: + const char* mFilename; + IOSystem* mIOSystem; + const aiScene* mScene; + const ExportProperties* mProperties + std::map mTexturesByPath; + std::shared_ptr mAsset; + std::vector mBodyData; }; } diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 91b8917a8..58ebe3017 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -89,4 +89,5 @@ TEST_F( utglTF2ImportExport, importBinaryglTF2FromFileTest ) { TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) { EXPECT_TRUE( exporterTest() ); } + #endif // ASSIMP_BUILD_NO_EXPORT From e3548fe85046eda679a064bee81db815a8e45e16 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 08:50:17 +0200 Subject: [PATCH 08/20] Update glTF2Exporter.h Fix typo. --- code/glTF2Exporter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/glTF2Exporter.h b/code/glTF2Exporter.h index 616a1177c..06bc5ad40 100644 --- a/code/glTF2Exporter.h +++ b/code/glTF2Exporter.h @@ -118,7 +118,7 @@ namespace Assimp const char* mFilename; IOSystem* mIOSystem; const aiScene* mScene; - const ExportProperties* mProperties + const ExportProperties* mProperties; std::map mTexturesByPath; std::shared_ptr mAsset; std::vector mBodyData; From a571d013102b62b437b4623dd4fc28a042dc5945 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 12:01:52 +0200 Subject: [PATCH 09/20] Create CONTRIBUTING.md --- CONTRIBUTING.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..6aebbbd01 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +#How to contribute + +If you want to contribute you can follow these setps: +- Fist create your own clone of assimp +- When you want to fix a bug or add a new feature create a branch on your own fork ( just follow https://help.github.com/articles/creating-a-pull-request-from-a-fork/ ) +- Push it to the repo and open a pull request +- A pull request will start our CI-service, which checks if the build works for linux and windows. + It will check for memory leaks, compiler warnings and memory alignment issues. If any of these tests fails: fix it and the tests will be reastarted automatically + - At the end we will perform a code review and merge your branch to the master branch. + + From 2998830d4a555f8aeccec8843152f0e3c217ca00 Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Sun, 13 May 2018 15:33:51 +0200 Subject: [PATCH 10/20] Fix typos on documentation using codespell --- Readme.md | 2 +- doc/dox.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index c78a0c1c8..856371d7e 100644 --- a/Readme.md +++ b/Readme.md @@ -141,7 +141,7 @@ Open Asset Import Library is implemented in C++. The directory structure is: /samples A small number of samples to illustrate possible use cases for Assimp /workspaces Build environments for vc,xcode,... (deprecated, - CMake has superseeded all legacy build options!) + CMake has superseded all legacy build options!) ### Where to get help ### diff --git a/doc/dox.h b/doc/dox.h index bc47e5584..af9eeb609 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -164,7 +164,7 @@ If done correctly you should now be able to compile, link, run and use the appli @section install_own Building the library from scratch First you need to install cmake. Now just get the code from github or download the latest version from the webside. -to buil the library just open a command-prompt / bash, navigate into the repo-folder and run cmake via: +to build the library just open a command-prompt / bash, navigate into the repo-folder and run cmake via: @code cmake CMakeLists.txt @@ -653,7 +653,7 @@ To apply such an animation you need to identify the animation tracks that refer in your mesh. Then for every track:
a) Find the keys that lay right before the current anim time.
b) Optional: interpolate between these and the following keys.
-c) Combine the calculated position, rotation and scaling to a tranformation matrix
+c) Combine the calculated position, rotation and scaling to a transformation matrix
d) Set the affected node's transformation to the calculated matrix.
If you need hints on how to convert to or from quaternions, have a look at the @@ -669,7 +669,7 @@ Such textures are loaded into an aiTexture structure. In previous versions, the path from the query for `AI_MATKEY_TEXTURE(textureType, index)` would be `*` where `` is the index of the texture in aiScene::mTextures. Now this call will -return a file path for embedded textures in FBX files. To test if it is an embdedded texture use +return a file path for embedded textures in FBX files. To test if it is an embedded texture use aiScene::GetEmbeddedTexture. If the returned pointer is not null, it is embedded und can be loaded from the data structure. If it is null, search for a separate file. Other file types still use the old behaviour.
@@ -794,7 +794,7 @@ All material key constants start with 'AI_MATKEY' (it's an ugly macro for histor COLOR_REFLECTIVE aiColor3D black (0,0,0) - Defines the reflective color of the material. This is typically scaled by the amount of incoming light from the direction of mirror reflection. Usually combined with an enviroment lightmap of some kind for real-time applications. + Defines the reflective color of the material. This is typically scaled by the amount of incoming light from the direction of mirror reflection. Usually combined with an environment lightmap of some kind for real-time applications. --- @@ -819,7 +819,7 @@ All material key constants start with 'AI_MATKEY' (it's an ugly macro for histor int false Specifies whether meshes using this material must be rendered without backface culling. 0 for false, !0 for true. - Some importers set this property if they don't know whether the output face oder is right. As long as it is not set, you may safely enable backface culling. + Some importers set this property if they don't know whether the output face order is right. As long as it is not set, you may safely enable backface culling. From 2879e0d6ef21a34180da13dd9f0a66b16d54b095 Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Sun, 13 May 2018 16:35:03 +0200 Subject: [PATCH 11/20] Fix typos on code using codespell --- code/AMFImporter_Macro.hpp | 8 ++++---- code/AMFImporter_Material.cpp | 2 +- code/AMFImporter_Postprocess.cpp | 2 +- code/ASEParser.h | 2 +- code/BlenderDNA.cpp | 2 +- code/BlenderDNA.h | 2 +- code/BlenderTessellator.h | 2 +- code/ColladaExporter.h | 2 +- code/ColladaLoader.cpp | 4 ++-- code/FBXConverter.cpp | 2 +- code/FBXDocument.cpp | 6 +++--- code/FBXExporter.cpp | 22 +++++++++++----------- code/FBXExporter.h | 2 +- code/FBXMaterial.cpp | 2 +- code/FindDegenerates.cpp | 2 +- code/IRRShared.h | 2 +- code/Importer.cpp | 18 +++++++++--------- code/Importer/IFC/IFCUtil.cpp | 2 +- code/JoinVerticesProcess.cpp | 2 +- code/LWSLoader.cpp | 2 +- code/MDLLoader.cpp | 4 ++-- code/MMDImporter.cpp | 2 +- code/NFFLoader.cpp | 4 ++-- code/OpenGEXImporter.cpp | 2 +- code/OptimizeGraph.h | 2 +- code/ProcessHelper.h | 2 +- code/ScenePreprocessor.cpp | 2 +- code/StandardShapes.cpp | 2 +- code/StepExporter.cpp | 2 +- code/TextureTransform.cpp | 2 +- code/Version.cpp | 2 +- code/X3DExporter.hpp | 2 +- code/X3DImporter.hpp | 2 +- code/X3DImporter_Geometry3D.cpp | 8 ++++---- code/X3DImporter_Macro.hpp | 4 ++-- code/X3DImporter_Metadata.cpp | 2 +- code/XFileExporter.cpp | 2 +- code/XGLLoader.cpp | 2 +- code/glTF2Asset.h | 2 +- code/glTFAsset.h | 2 +- code/glTFExporter.cpp | 2 +- 41 files changed, 71 insertions(+), 71 deletions(-) diff --git a/code/AMFImporter_Macro.hpp b/code/AMFImporter_Macro.hpp index afa120028..ea8c17850 100644 --- a/code/AMFImporter_Macro.hpp +++ b/code/AMFImporter_Macro.hpp @@ -71,7 +71,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } /// \def MACRO_ATTRREAD_CHECK_REF -/// Check curent attribute name and if it equal to requested then read value. Result write to output variable by reference. If result was read then +/// Check current attribute name and if it equal to requested then read value. Result write to output variable by reference. If result was read then /// "continue" will called. /// \param [in] pAttrName - attribute name. /// \param [out] pVarName - output variable name. @@ -84,7 +84,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } /// \def MACRO_ATTRREAD_CHECK_RET -/// Check curent attribute name and if it equal to requested then read value. Result write to output variable using return value of \ref pFunction. +/// Check current attribute name and if it equal to requested then read value. Result write to output variable using return value of \ref pFunction. /// If result was read then "continue" will called. /// \param [in] pAttrName - attribute name. /// \param [out] pVarName - output variable name. @@ -130,7 +130,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } while(false) /// \def MACRO_NODECHECK_READCOMP_F -/// Check curent node name and if it equal to requested then read value. Result write to output variable of type "float". +/// Check current node name and if it equal to requested then read value. Result write to output variable of type "float". /// If result was read then "continue" will called. Also check if node data already read then raise exception. /// \param [in] pNodeName - node name. /// \param [in, out] pReadFlag - read flag. @@ -147,7 +147,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } /// \def MACRO_NODECHECK_READCOMP_U32 -/// Check curent node name and if it equal to requested then read value. Result write to output variable of type "uint32_t". +/// Check current node name and if it equal to requested then read value. Result write to output variable of type "uint32_t". /// If result was read then "continue" will called. Also check if node data already read then raise exception. /// \param [in] pNodeName - node name. /// \param [in, out] pReadFlag - read flag. diff --git a/code/AMFImporter_Material.cpp b/code/AMFImporter_Material.cpp index 77f49d39e..2f65ad833 100644 --- a/code/AMFImporter_Material.cpp +++ b/code/AMFImporter_Material.cpp @@ -99,7 +99,7 @@ CAMFImporter_NodeElement* ne; ParseHelper_Node_Exit(); // check that all components was defined if(!(read_flag[0] && read_flag[1] && read_flag[2])) throw DeadlyImportError("Not all color components are defined."); - // check if is absent. Then manualy add "a == 1". + // check if is absent. Then manually add "a == 1". if(!read_flag[3]) als.Color.a = 1; }// if(!mReader->isEmptyElement()) diff --git a/code/AMFImporter_Postprocess.cpp b/code/AMFImporter_Postprocess.cpp index 192544fcb..a6ee8fa2f 100644 --- a/code/AMFImporter_Postprocess.cpp +++ b/code/AMFImporter_Postprocess.cpp @@ -770,7 +770,7 @@ std::list ch_node; // find referenced object if(!Find_ConvertedNode(als.ObjectID, pNodeList, &found_node)) Throw_ID_NotFound(als.ObjectID); - // create node for apllying transformation + // create node for applying transformation t_node = new aiNode; t_node->mParent = con_node; // apply transformation diff --git a/code/ASEParser.h b/code/ASEParser.h index 8715fdfab..70eb3de66 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -427,7 +427,7 @@ public: // ------------------------------------------------------------------- //! Construct a parser from a given input file which is - //! guaranted to be terminated with zero. + //! guaranteed to be terminated with zero. //! @param szFile Input file //! @param fileFormatDefault Assumed file format version. If the //! file format is specified in the file the new value replaces diff --git a/code/BlenderDNA.cpp b/code/BlenderDNA.cpp index afcbb34e3..f84c45601 100644 --- a/code/BlenderDNA.cpp +++ b/code/BlenderDNA.cpp @@ -227,7 +227,7 @@ void DNAParser::Parse () // ------------------------------------------------------------------------------------------------ void DNA :: DumpToFile() { - // we dont't bother using the VFS here for this is only for debugging. + // we don't bother using the VFS here for this is only for debugging. // (and all your bases are belong to us). std::ofstream f("dna.txt"); diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index 4a1e83b64..6a18fe9fa 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -663,7 +663,7 @@ public: /** Check whether a specific item is in the cache. * @param s Data type of the item * @param out Output pointer. Unchanged if the - * cache doens't know the item yet. + * cache doesn't know the item yet. * @param ptr Item address to look for. */ template void get ( const Structure& s, diff --git a/code/BlenderTessellator.h b/code/BlenderTessellator.h index 59d698295..dab3ba8aa 100644 --- a/code/BlenderTessellator.h +++ b/code/BlenderTessellator.h @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define INCLUDED_AI_BLEND_TESSELLATOR_H // Use these to toggle between GLU Tessellate or poly2tri -// Note (acg) keep GLU Tesselate disabled by default - if it is turned on, +// Note (acg) keep GLU Tessellate disabled by default - if it is turned on, // assimp needs to be linked against GLU, which is currently not yet // made configurable in CMake and potentially not wanted by most users // as it requires a Gl environment. diff --git a/code/ColladaExporter.h b/code/ColladaExporter.h index 773039735..d1a307532 100644 --- a/code/ColladaExporter.h +++ b/code/ColladaExporter.h @@ -189,7 +189,7 @@ protected: {} }; - // summarize a material in an convinient way. + // summarize a material in an convenient way. struct Material { std::string name; diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 611e487b0..54178295c 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -956,7 +956,7 @@ void ColladaLoader::StoreSceneMaterials( aiScene* pScene) // Stores all animations void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser) { - // recursivly collect all animations from the collada scene + // recursively collect all animations from the collada scene StoreAnimations( pScene, pParser, &pParser.mAnims, ""); // catch special case: many animations with the same length, each affecting only a single node. @@ -1784,7 +1784,7 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars // TODO: check the possibility of using the flag "AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING" // In FBX files textures are now stored internally by Assimp with their filename included - // Now Assimp can lookup thru the loaded textures after all data is processed + // Now Assimp can lookup through the loaded textures after all data is processed // We need to load all textures before referencing them, as FBX file format order may reference a texture before loading it // This may occur on this case too, it has to be studied // setup texture reference string diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index d6529d119..c50e88390 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -1564,7 +1564,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap& if (textureReady) { // TODO: check the possibility of using the flag "AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING" // In FBX files textures are now stored internally by Assimp with their filename included - // Now Assimp can lookup thru the loaded textures after all data is processed + // Now Assimp can lookup through the loaded textures after all data is processed // We need to load all textures before referencing them, as FBX file format order may reference a texture before loading it // This may occur on this case too, it has to be studied path.data[0] = '*'; diff --git a/code/FBXDocument.cpp b/code/FBXDocument.cpp index 2965a54ff..f53ae4405 100644 --- a/code/FBXDocument.cpp +++ b/code/FBXDocument.cpp @@ -575,11 +575,11 @@ std::vector Document::GetConnectionsSequenced(uint64_t id, bo ai_assert( count != 0 ); ai_assert( count <= MAX_CLASSNAMES); - size_t lenghts[MAX_CLASSNAMES]; + size_t lengths[MAX_CLASSNAMES]; const size_t c = count; for (size_t i = 0; i < c; ++i) { - lenghts[ i ] = strlen(classnames[i]); + lengths[ i ] = strlen(classnames[i]); } std::vector temp; @@ -597,7 +597,7 @@ std::vector Document::GetConnectionsSequenced(uint64_t id, bo for (size_t i = 0; i < c; ++i) { ai_assert(classnames[i]); - if(static_cast(std::distance(key.begin(),key.end())) == lenghts[i] && !strncmp(classnames[i],obtype,lenghts[i])) { + if(static_cast(std::distance(key.begin(),key.end())) == lengths[i] && !strncmp(classnames[i],obtype,lengths[i])) { obtype = NULL; break; } diff --git a/code/FBXExporter.cpp b/code/FBXExporter.cpp index 52c69161a..a942e31bc 100644 --- a/code/FBXExporter.cpp +++ b/code/FBXExporter.cpp @@ -450,7 +450,7 @@ void FBXExporter::WriteDocuments () p.AddP70string("ActiveAnimStackName", ""); // should do this properly? doc.AddChild(p); - // UID for root node in scene heirarchy. + // UID for root node in scene hierarchy. // always set to 0 in the case of a single document. // not sure what happens if more than one document exists, // but that won't matter to us as we're exporting a single scene. @@ -650,7 +650,7 @@ void FBXExporter::WriteDefinitions () } // Model / FbxNode - // <~~ node heirarchy + // <~~ node hierarchy count = int32_t(count_nodes(mScene->mRootNode)) - 1; // (not counting root node) if (count) { n = FBX::Node("ObjectType", "Model"); @@ -1223,7 +1223,7 @@ void FBXExporter::WriteObjects () // it's all about this material aiMaterial* m = mScene->mMaterials[i]; - // these are used to recieve material data + // these are used to receive material data float f; aiColor3D c; // start the node record @@ -1311,7 +1311,7 @@ void FBXExporter::WriteObjects () // Now the legacy system. // For safety let's include it. // thrse values don't exist in the property template, - // and usualy are completely ignored when loading. + // and usually are completely ignored when loading. // One notable exception is the "Opacity" property, // which Blender uses as (1.0 - alpha). c.r = 0.0f; c.g = 0.0f; c.b = 0.0f; @@ -1532,7 +1532,7 @@ void FBXExporter::WriteObjects () // bones. // // output structure: - // subset of node heirarchy that are "skeleton", + // subset of node hierarchy that are "skeleton", // i.e. do not have meshes but only bones. // but.. i'm not sure how anyone could guarantee that... // @@ -1544,7 +1544,7 @@ void FBXExporter::WriteObjects () // // well. we can assume a sane input, i suppose. // - // so input is the bone node heirarchy, + // so input is the bone node hierarchy, // with an extra thing for the transformation of the MESH in BONE space. // // output is a set of bone nodes, @@ -1556,7 +1556,7 @@ void FBXExporter::WriteObjects () // and represents the influence of that bone on the grandparent mesh. // the subdeformer has a list of indices, and weights, // with indices specifying vertex indices, - // and weights specifying the correspoding influence of this bone. + // and weights specifying the corresponding influence of this bone. // it also has Transform and TransformLink elements, // specifying the transform of the MESH in BONE space, // and the transformation of the BONE in WORLD space, @@ -1806,7 +1806,7 @@ void FBXExporter::WriteObjects () // and a correct skeleton would still be output. // transformlink should be the position of the bone in world space. - // if the bone is in the bind pose (or nonexistant), + // if the bone is in the bind pose (or nonexistent), // we can just use the matrix we already calculated if (bone_xform_okay) { sdnode.AddChild("TransformLink", bone_xform); @@ -1945,7 +1945,7 @@ void FBXExporter::WriteObjects () // TODO: cameras, lights - // write nodes (i.e. model heirarchy) + // write nodes (i.e. model hierarchy) // start at root node WriteModelNodes( outstream, mScene->mRootNode, 0, limbnodes @@ -2203,8 +2203,8 @@ void FBXExporter::WriteModelNode( } else { // apply the transformation chain. // these transformation elements are created when importing FBX, - // which has a complex transformation heirarchy for each node. - // as such we can bake the heirarchy back into the node on export. + // which has a complex transformation hierarchy for each node. + // as such we can bake the hierarchy back into the node on export. for (auto &item : transform_chain) { auto elem = transform_types.find(item.first); if (elem == transform_types.end()) { diff --git a/code/FBXExporter.h b/code/FBXExporter.h index 3b9de8acb..c27d1a8ce 100644 --- a/code/FBXExporter.h +++ b/code/FBXExporter.h @@ -90,7 +90,7 @@ namespace Assimp const ExportProperties* mProperties; // currently unused std::shared_ptr outfile; // file to write to - std::vector connections; // conection storage + std::vector connections; // connection storage std::vector mesh_uids; std::vector material_uids; diff --git a/code/FBXMaterial.cpp b/code/FBXMaterial.cpp index 8bb3920de..75b2e3b4b 100644 --- a/code/FBXMaterial.cpp +++ b/code/FBXMaterial.cpp @@ -302,7 +302,7 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std } if(Content) { - //this field is ommited when the embedded texture is already loaded, let's ignore if it's not found + //this field is omitted when the embedded texture is already loaded, let's ignore if it's not found try { const Token& token = GetRequiredToken(*Content, 0); const char* data = token.begin(); diff --git a/code/FindDegenerates.cpp b/code/FindDegenerates.cpp index c0023c9a4..760ab743a 100644 --- a/code/FindDegenerates.cpp +++ b/code/FindDegenerates.cpp @@ -161,7 +161,7 @@ void FindDegeneratesProcess::ExecuteOnMesh( aiMesh* mesh) { // NOTE: we set the removed vertex index to an unique value // to make sure the developer gets notified when his - // application attemps to access this data. + // application attempts to access this data. face.mIndices[ face.mNumIndices ] = 0xdeadbeef; if(first) { diff --git a/code/IRRShared.h b/code/IRRShared.h index 8770d2add..2f6f87405 100644 --- a/code/IRRShared.h +++ b/code/IRRShared.h @@ -91,7 +91,7 @@ protected: // ------------------------------------------------------------------- /** Read a property of the specified type from the current XML element. - * @param out Recives output data + * @param out Receives output data */ void ReadHexProperty (HexProperty& out); void ReadStringProperty (StringProperty& out); diff --git a/code/Importer.cpp b/code/Importer.cpp index 9fbba61c4..139dc6c51 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -997,33 +997,33 @@ bool Importer::SetPropertyInteger(const char* szName, int iValue) // Set a configuration property bool Importer::SetPropertyFloat(const char* szName, ai_real iValue) { - bool exising; + bool existing; ASSIMP_BEGIN_EXCEPTION_REGION(); - exising = SetGenericProperty(pimpl->mFloatProperties, szName,iValue); + existing = SetGenericProperty(pimpl->mFloatProperties, szName,iValue); ASSIMP_END_EXCEPTION_REGION(bool); - return exising; + return existing; } // ------------------------------------------------------------------------------------------------ // Set a configuration property bool Importer::SetPropertyString(const char* szName, const std::string& value) { - bool exising; + bool existing; ASSIMP_BEGIN_EXCEPTION_REGION(); - exising = SetGenericProperty(pimpl->mStringProperties, szName,value); + existing = SetGenericProperty(pimpl->mStringProperties, szName,value); ASSIMP_END_EXCEPTION_REGION(bool); - return exising; + return existing; } // ------------------------------------------------------------------------------------------------ // Set a configuration property bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value) { - bool exising; + bool existing; ASSIMP_BEGIN_EXCEPTION_REGION(); - exising = SetGenericProperty(pimpl->mMatrixProperties, szName,value); + existing = SetGenericProperty(pimpl->mMatrixProperties, szName,value); ASSIMP_END_EXCEPTION_REGION(bool); - return exising; + return existing; } // ------------------------------------------------------------------------------------------------ diff --git a/code/Importer/IFC/IFCUtil.cpp b/code/Importer/IFC/IFCUtil.cpp index 97f621935..06cc4405a 100644 --- a/code/Importer/IFC/IFCUtil.cpp +++ b/code/Importer/IFC/IFCUtil.cpp @@ -317,7 +317,7 @@ void TempMesh::FixupFaceOrientation() IfcVector3 farthestCenter = std::accumulate(mVerts.begin() + faceStartIndices[farthestIndex], mVerts.begin() + faceStartIndices[farthestIndex] + mVertcnt[farthestIndex], IfcVector3(0.0)) / IfcFloat(mVertcnt[farthestIndex]); - // We accapt a bit of negative orientation without reversing. In case of doubt, prefer the orientation given in + // We accept a bit of negative orientation without reversing. In case of doubt, prefer the orientation given in // the file. if( (farthestNormal * (farthestCenter - vavg).Normalize()) < -0.4 ) { diff --git a/code/JoinVerticesProcess.cpp b/code/JoinVerticesProcess.cpp index c21d71f47..7f7bcae41 100644 --- a/code/JoinVerticesProcess.cpp +++ b/code/JoinVerticesProcess.cpp @@ -118,7 +118,7 @@ bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) // Squared because we check against squared length of the vector difference static const float squareEpsilon = epsilon * epsilon; - // Square compare is useful for animeshes vertexes compare + // Square compare is useful for animeshes vertices compare if ((lhs.position - rhs.position).SquareLength() > squareEpsilon) { return false; } diff --git a/code/LWSLoader.cpp b/code/LWSLoader.cpp index 518b893e9..6f8cbe78d 100644 --- a/code/LWSLoader.cpp +++ b/code/LWSLoader.cpp @@ -410,7 +410,7 @@ void LWSImporter::BuildGraph(aiNode* nd, LWS::NodeDesc& src, std::vector unique due to LWs indexing system lit->mName = nd->mName; - // detemine light type and setup additional members + // determine light type and setup additional members if (src.lightType == 2) { /* spot light */ lit->mType = aiLightSource_SPOT; diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index 4c43bc64f..dfe1c1311 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -141,7 +141,7 @@ void MDLImporter::SetupProperties(const Importer* pImp) configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0); } - // AI_CONFIG_IMPORT_MDL_COLORMAP - pallette file + // AI_CONFIG_IMPORT_MDL_COLORMAP - palette file configPalette = pImp->GetPropertyString(AI_CONFIG_IMPORT_MDL_COLORMAP,"colormap.lmp"); } @@ -1496,7 +1496,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( ) groupData.vTextureCoords1.resize(iNumVertices,aiVector3D()); // check whether the triangle data structure is large enough - // to contain a second UV coodinate set + // to contain a second UV coordinate set if (pcHeader->triangle_stc_size >= AI_MDL7_TRIANGLE_STD_SIZE_TWO_UV) { groupData.vTextureCoords2.resize(iNumVertices,aiVector3D()); groupData.bNeed2UV = true; diff --git a/code/MMDImporter.cpp b/code/MMDImporter.cpp index 76ad9115c..3d7f3c794 100644 --- a/code/MMDImporter.cpp +++ b/code/MMDImporter.cpp @@ -217,7 +217,7 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel, pMesh->mNumFaces = indexCount / 3; pMesh->mFaces = new aiFace[pMesh->mNumFaces]; - const int numIndices = 3; // trianglular face + const int numIndices = 3; // triangular face for (unsigned int index = 0; index < pMesh->mNumFaces; index++) { pMesh->mFaces[index].mNumIndices = numIndices; unsigned int *indices = new unsigned int[numIndices]; diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index 2c7eeaa20..1c7283db6 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -271,7 +271,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, ShadingInfo s; // current material info - // degree of tesselation + // degree of tessellation unsigned int iTesselation = 4; // some temporary variables we need to parse the file @@ -988,7 +988,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, ::ai_snprintf(currentMesh.name,128,"cone_%i",cone++); else ::ai_snprintf(currentMesh.name,128,"cylinder_%i",cylinder++); } - // 'tess' - tesselation + // 'tess' - tessellation else if (TokenMatch(sz,"tess",4)) { SkipSpaces(&sz); diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 9966c1f34..2de0aabc0 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -691,7 +691,7 @@ void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene * void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene ) { m_currentMesh = new aiMesh; const size_t meshidx( m_meshCache.size() ); - // ownership is transfered but a reference remains in m_currentMesh + // ownership is transferred but a reference remains in m_currentMesh m_meshCache.emplace_back( m_currentMesh ); Property *prop = node->getProperties(); diff --git a/code/OptimizeGraph.h b/code/OptimizeGraph.h index aa6aa8651..6781ec534 100644 --- a/code/OptimizeGraph.h +++ b/code/OptimizeGraph.h @@ -102,7 +102,7 @@ public: } // ------------------------------------------------------------------- - /** @brief Rmeove a node from the list of locked nodes. + /** @brief Remove a node from the list of locked nodes. * @param name Name to be unlocked */ inline void RemoveLockedNode(std::string& name) diff --git a/code/ProcessHelper.h b/code/ProcessHelper.h index c668b946f..dcf71e853 100644 --- a/code/ProcessHelper.h +++ b/code/ProcessHelper.h @@ -212,7 +212,7 @@ template <> struct MinMaxChooser { // ------------------------------------------------------------------------------- /** @brief Find the min/max values of an array of Ts * @param in Input array - * @param size Numebr of elements to process + * @param size Number of elements to process * @param[out] min minimum value * @param[out] max maximum value */ diff --git a/code/ScenePreprocessor.cpp b/code/ScenePreprocessor.cpp index eff6ecc6e..1228ab2c2 100644 --- a/code/ScenePreprocessor.cpp +++ b/code/ScenePreprocessor.cpp @@ -104,7 +104,7 @@ void ScenePreprocessor::ProcessMesh (aiMesh* mesh) aiVector3D* p = mesh->mTextureCoords[i], *end = p+mesh->mNumVertices; - // Ensure unsued components are zeroed. This will make 1D texture channels work + // Ensure unused components are zeroed. This will make 1D texture channels work // as if they were 2D channels .. just in case an application doesn't handle // this case if (2 == mesh->mNumUVComponents[i]) { diff --git a/code/StandardShapes.cpp b/code/StandardShapes.cpp index a5b368f7f..7d2319401 100644 --- a/code/StandardShapes.cpp +++ b/code/StandardShapes.cpp @@ -377,7 +377,7 @@ void StandardShapes::MakeSphere(unsigned int tess, MakeIcosahedron(positions); // ... and subdivide it until the requested output - // tesselation is reached + // tessellation is reached for (unsigned int i = 0; i& pVertices); diff --git a/code/X3DImporter_Geometry3D.cpp b/code/X3DImporter_Geometry3D.cpp index a366e8062..b6d130098 100644 --- a/code/X3DImporter_Geometry3D.cpp +++ b/code/X3DImporter_Geometry3D.cpp @@ -136,7 +136,7 @@ void X3DImporter::ParseNode_Geometry3D_Cone() } else { - const unsigned int tess = 30;///TODO: IME tesselation factor through ai_property + const unsigned int tess = 30;///TODO: IME tessellation factor through ai_property std::vector tvec;// temp array for vertices. @@ -209,7 +209,7 @@ void X3DImporter::ParseNode_Geometry3D_Cylinder() } else { - const unsigned int tess = 30;///TODO: IME tesselation factor through ai_property + const unsigned int tess = 30;///TODO: IME tessellation factor through ai_property std::vector tside;// temp array for vertices of side. std::vector tcir;// temp array for vertices of circle. @@ -480,7 +480,7 @@ static aiVector3D GeometryHelper_Extrusion_GetNextY(const size_t pSpine_PointIdx tvec = pSpine[1] - pSpine[0]; } else - {// The Y-axis used for the last point it is the vector from spine[n-2] to spine[n-1]. In our case(see above about droping tail) spine[n - 1] is + {// The Y-axis used for the last point it is the vector from spine[n-2] to spine[n-1]. In our case(see above about dropping tail) spine[n - 1] is // the spine[0]. tvec = pSpine[spine_idx_last] - pSpine[spine_idx_last - 1]; } @@ -967,7 +967,7 @@ void X3DImporter::ParseNode_Geometry3D_Sphere() } else { - const unsigned int tess = 3;///TODO: IME tesselation factor through ai_property + const unsigned int tess = 3;///TODO: IME tessellation factor through ai_property std::vector tlist; diff --git a/code/X3DImporter_Macro.hpp b/code/X3DImporter_Macro.hpp index cff521408..d1172798c 100644 --- a/code/X3DImporter_Macro.hpp +++ b/code/X3DImporter_Macro.hpp @@ -76,7 +76,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } /// \def MACRO_ATTRREAD_CHECK_REF -/// Check curent attribute name and if it equal to requested then read value. Result write to output variable by reference. If result was read then +/// Check current attribute name and if it equal to requested then read value. Result write to output variable by reference. If result was read then /// "continue" will called. /// \param [in] pAttrName - attribute name. /// \param [out] pVarName - output variable name. @@ -89,7 +89,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } /// \def MACRO_ATTRREAD_CHECK_RET -/// Check curent attribute name and if it equal to requested then read value. Result write to output variable using return value of \ref pFunction. +/// Check current attribute name and if it equal to requested then read value. Result write to output variable using return value of \ref pFunction. /// If result was read then "continue" will called. /// \param [in] pAttrName - attribute name. /// \param [out] pVarName - output variable name. diff --git a/code/X3DImporter_Metadata.cpp b/code/X3DImporter_Metadata.cpp index 0dc9bcec1..a566f0aa9 100644 --- a/code/X3DImporter_Metadata.cpp +++ b/code/X3DImporter_Metadata.cpp @@ -79,7 +79,7 @@ namespace Assimp if(!mReader->isEmptyElement()) \ ParseNode_Metadata(pNE, pMetaName);/* in that case node element will be added to child elements list of current node. */ \ else \ - NodeElement_Cur->Child.push_back(pNE);/* else - add element to child list manualy */ \ + NodeElement_Cur->Child.push_back(pNE);/* else - add element to child list manually */ \ \ NodeElement_List.push_back(pNE);/* add new element to elements list. */ \ }/* if(!pUSE_Var.empty()) else */ \ diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index b2862c6d9..1510ae6d4 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -132,7 +132,7 @@ void XFileExporter::WriteFile() { // note, that all realnumber values must be comma separated in x files mOutput.setf(std::ios::fixed); - mOutput.precision(16); // precission for double + mOutput.precision(16); // precision for double // entry of writing the file WriteHeader(); diff --git a/code/XGLLoader.cpp b/code/XGLLoader.cpp index a9fd6a5ab..0706ffd55 100644 --- a/code/XGLLoader.cpp +++ b/code/XGLLoader.cpp @@ -498,7 +498,7 @@ aiMatrix4x4 XGLImporter::ReadTrafo() right = forward ^ up; if (std::fabs(up * forward) > 1e-4) { // this is definitely wrong - a degenerate coordinate space ruins everything - // so subtitute identity transform. + // so substitute identity transform. LogError(" and vectors in are skewing, ignoring trafo"); return m; } diff --git a/code/glTF2Asset.h b/code/glTF2Asset.h index 358d6bcb4..dd9b11df5 100644 --- a/code/glTF2Asset.h +++ b/code/glTF2Asset.h @@ -386,7 +386,7 @@ namespace glTF2 }; - //! Base classe for all glTF top-level objects + //! Base class for all glTF top-level objects struct Object { int index; //!< The index of this object within its property container diff --git a/code/glTFAsset.h b/code/glTFAsset.h index 018106309..bc79f72ec 100644 --- a/code/glTFAsset.h +++ b/code/glTFAsset.h @@ -381,7 +381,7 @@ namespace glTF }; - //! Base classe for all glTF top-level objects + //! Base class for all glTF top-level objects struct Object { std::string id; //!< The globally unique ID used to reference this object diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 7dfe5b3ff..29a88af8b 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -703,7 +703,7 @@ void glTFExporter::ExportMeshes() // Coordinates indices comp_o3dgc_ifs.SetNCoordIndex(aim->mNumFaces); comp_o3dgc_ifs.SetCoordIndex((IndicesType* const)&b->GetPointer()[idx_srcdata_ind]); - // Prepare to enconding + // Prepare to encoding comp_o3dgc_params.SetNumFloatAttributes(comp_o3dgc_ifs.GetNumFloatAttributes()); if(mProperties->GetPropertyBool("extensions.Open3DGC.binary", true)) comp_o3dgc_params.SetStreamType(o3dgc::O3DGC_STREAM_TYPE_BINARY); From d8af63519d7feef64a5a01aa71f78cab143cfed3 Mon Sep 17 00:00:00 2001 From: Lieven Dekeyser Date: Tue, 15 May 2018 12:38:50 +0200 Subject: [PATCH 12/20] Create fat binaries for libIrrXML and libzlibstatic too --- port/iOS/build.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 44683f0c7..cf17240ab 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -59,9 +59,9 @@ build_arch() $XCODE_ROOT_DIR/Developer/usr/bin/make clean $XCODE_ROOT_DIR/Developer/usr/bin/make assimp -j 8 -l - echo "[!] Moving built library into: $BUILD_DIR/$1/" + echo "[!] Moving built libraries into: $BUILD_DIR/$1/" - mv ./lib/libassimp.a $BUILD_DIR/$1/ + mv ./lib/*.a $BUILD_DIR/$1/ } echo "[!] $0 - assimp iOS build script" @@ -110,14 +110,27 @@ for ARCH_TARGET in $DEPLOY_ARCHS; do #rm ./lib/libassimp.a done -if [[ "$DEPLOY_FAT" -eq 1 ]]; then - echo '[+] Creating fat binary ...' + +make_fat_binary() +{ + LIB_NAME=$1 + LIPO_ARGS='' for ARCH_TARGET in $DEPLOY_ARCHS; do - LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.a " + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a " done - LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.a" + LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/$LIB_NAME-fat.a" lipo $LIPO_ARGS - echo "[!] Done! The fat binary can be found at $BUILD_DIR" +} + +if [[ "$DEPLOY_FAT" -eq 1 ]]; then + echo '[+] Creating fat binaries ...' + + make_fat_binary 'libassimp' + make_fat_binary 'libIrrXML' + make_fat_binary 'libzlibstatic' + + echo "[!] Done! The fat binaries can be found at $BUILD_DIR" fi + From f4fd5840b143b5e57cbb820e9804386d414b6bf3 Mon Sep 17 00:00:00 2001 From: Andor Goetzendorff Date: Tue, 15 May 2018 15:22:19 +0200 Subject: [PATCH 13/20] Encode filename using file system encoding instead of ASCII --- port/PyAssimp/pyassimp/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index 573ce27b1..8950e54aa 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -312,7 +312,7 @@ def load(filename, file_type) else: # a filename string has been passed - model = _assimp_lib.load(filename.encode("ascii"), processing) + model = _assimp_lib.load(filename.encode(sys.getfilesystemencoding()), processing) if not model: raise AssimpError('Could not import file!') @@ -342,7 +342,7 @@ def export(scene, ''' from ctypes import pointer - exportStatus = _assimp_lib.export(pointer(scene), file_type.encode("ascii"), filename.encode("ascii"), processing) + exportStatus = _assimp_lib.export(pointer(scene), file_type.encode("ascii"), filename.encode(sys.getfilesystemencoding()), processing) if exportStatus != 0: raise AssimpError('Could not export scene!') From 46ed73c768461e3e853ecd35d1d4200d32e69763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B6ber?= Date: Wed, 16 May 2018 11:02:07 +0200 Subject: [PATCH 14/20] Do not throw exception on empty mesh after removal of degenerates Remove mesh instead. This keeps one edge case open: nodes without mesh references. They are kept as it is for now (they may stilol contain transformations and child references). --- code/FindDegenerates.cpp | 56 +++++++++++++++++++++++++++++++++++++--- code/FindDegenerates.h | 3 ++- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/code/FindDegenerates.cpp b/code/FindDegenerates.cpp index c0023c9a4..7bc6186bb 100644 --- a/code/FindDegenerates.cpp +++ b/code/FindDegenerates.cpp @@ -54,6 +54,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace Assimp; +//remove mesh at position 'index' from the scene +static void removeMesh(aiScene* pScene, unsigned const index); +//correct node indices to meshes and remove references to deleted mesh +static void updateSceneGraph(aiNode* pNode, unsigned const index); + // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer FindDegeneratesProcess::FindDegeneratesProcess() @@ -87,11 +92,50 @@ void FindDegeneratesProcess::SetupProperties(const Importer* pImp) { void FindDegeneratesProcess::Execute( aiScene* pScene) { ASSIMP_LOG_DEBUG("FindDegeneratesProcess begin"); for (unsigned int i = 0; i < pScene->mNumMeshes;++i){ - ExecuteOnMesh( pScene->mMeshes[ i ] ); + if (ExecuteOnMesh(pScene->mMeshes[i])) { + removeMesh(pScene, i); + --i; //the current i is removed, do not skip the next one + } } ASSIMP_LOG_DEBUG("FindDegeneratesProcess finished"); } +static void removeMesh(aiScene* pScene, unsigned const index) { + //we start at index and copy the pointers one position forward + //save the mesh pointer to delete it later + auto delete_me = pScene->mMeshes[index]; + for (unsigned i = index; i < pScene->mNumMeshes - 1; ++i) { + pScene->mMeshes[i] = pScene->mMeshes[i+1]; + } + pScene->mMeshes[pScene->mNumMeshes - 1] = nullptr; + --(pScene->mNumMeshes); + delete delete_me; + + //removing a mesh also requires updating all references to it in the scene graph + updateSceneGraph(pScene->mRootNode, index); +} + +static void updateSceneGraph(aiNode* pNode, unsigned const index) { + for (unsigned i = 0; i < pNode->mNumMeshes; ++i) { + if (pNode->mMeshes[i] > index) { + --(pNode->mMeshes[i]); + continue; + } + if (pNode->mMeshes[i] == index) { + for (unsigned j = i; j < pNode->mNumMeshes -1; ++j) { + pNode->mMeshes[j] = pNode->mMeshes[j+1]; + } + --(pNode->mNumMeshes); + --i; + continue; + } + } + //recurse to all children + for (unsigned i = 0; i < pNode->mNumChildren; ++i) { + updateSceneGraph(pNode->mChildren[i], index); + } +} + static ai_real heron( ai_real a, ai_real b, ai_real c ) { ai_real s = (a + b + c) / 2; ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), (ai_real)0.5 ); @@ -125,7 +169,7 @@ static ai_real calculateAreaOfTriangle( const aiFace& face, aiMesh* mesh ) { // ------------------------------------------------------------------------------------------------ // Executes the post processing step on the given imported mesh -void FindDegeneratesProcess::ExecuteOnMesh( aiMesh* mesh) { +bool FindDegeneratesProcess::ExecuteOnMesh( aiMesh* mesh) { mesh->mPrimitiveTypes = 0; std::vector remove_me; @@ -227,19 +271,22 @@ evil_jump_outside: if (&face_src != &face_dest) { // clear source face_src.mNumIndices = 0; - face_src.mIndices = NULL; + face_src.mIndices = nullptr; } } else { // Otherwise delete it if we don't need this face delete[] face_src.mIndices; - face_src.mIndices = NULL; + face_src.mIndices = nullptr; face_src.mNumIndices = 0; } } // Just leave the rest of the array unreferenced, we don't care for now mesh->mNumFaces = n; if (!mesh->mNumFaces) { + //The whole mesh consists of degenerated faces + //signal upward, that this mesh should be deleted. + return true; // WTF!? // OK ... for completeness and because I'm not yet tired, // let's write code that will hopefully never be called @@ -253,4 +300,5 @@ evil_jump_outside: if (deg && !DefaultLogger::isNullLogger()) { ASSIMP_LOG_WARN_F( "Found ", deg, " degenerated primitives"); } + return false; } diff --git a/code/FindDegenerates.h b/code/FindDegenerates.h index 2df94710a..c234c57f5 100644 --- a/code/FindDegenerates.h +++ b/code/FindDegenerates.h @@ -74,7 +74,8 @@ public: // ------------------------------------------------------------------- // Execute step on a given mesh - void ExecuteOnMesh( aiMesh* mesh); + ///@returns true if the current mesh should be deleted, false otherwise + bool ExecuteOnMesh( aiMesh* mesh); // ------------------------------------------------------------------- /// @brief Enable the instant removal of degenerated primitives From 9e80e18b1a331a9b284cd9cbd0f7caeb8d612314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B6ber?= Date: Wed, 16 May 2018 11:10:48 +0200 Subject: [PATCH 15/20] Remove dead code --- code/FindDegenerates.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/code/FindDegenerates.cpp b/code/FindDegenerates.cpp index 7bc6186bb..3917975fd 100644 --- a/code/FindDegenerates.cpp +++ b/code/FindDegenerates.cpp @@ -286,14 +286,8 @@ evil_jump_outside: if (!mesh->mNumFaces) { //The whole mesh consists of degenerated faces //signal upward, that this mesh should be deleted. + ASSIMP_LOG_DEBUG("FindDegeneratesProcess removed a mesh full of degenerated primitives"); return true; - // WTF!? - // OK ... for completeness and because I'm not yet tired, - // let's write code that will hopefully never be called - // (famous last words) - - // OK ... bad idea. - throw DeadlyImportError("Mesh is empty after removal of degenerated primitives ... WTF!?"); } } From 7251c3c51a774c2828f62787e3aa6ad743ca5628 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Wed, 16 May 2018 13:45:25 +0200 Subject: [PATCH 16/20] Fix build with Qt 5.11.0_beta3 (qt5_use_modules is gone) --- tools/assimp_qt_viewer/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/assimp_qt_viewer/CMakeLists.txt b/tools/assimp_qt_viewer/CMakeLists.txt index 42ef0fb34..9f1b68cab 100644 --- a/tools/assimp_qt_viewer/CMakeLists.txt +++ b/tools/assimp_qt_viewer/CMakeLists.txt @@ -3,7 +3,7 @@ project(assimp_qt_viewer) cmake_minimum_required(VERSION 2.6) -find_package(Qt5Widgets REQUIRED) +find_package(Qt5 COMPONENTS Gui Widgets OpenGL REQUIRED) find_package(DevIL REQUIRED) find_package(OpenGL REQUIRED) @@ -25,9 +25,8 @@ qt5_wrap_ui(UISrcs mainwindow.ui) qt5_wrap_cpp(MOCrcs mainwindow.hpp glview.hpp) add_executable(${PROJECT_NAME} ${assimp_qt_viewer_SRCS} ${UISrcs} ${MOCrcs}) -target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${IL_LIBRARIES} ${OPENGL_LIBRARIES} assimp) +target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Widgets Qt5::OpenGL ${IL_LIBRARIES} ${OPENGL_LIBRARIES} assimp) -qt5_use_modules(${PROJECT_NAME} Widgets OpenGL) if(WIN32) # Check if we are on Windows if(MSVC) # Check if we are using the Visual Studio compiler #set_target_properties(TestProject PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") From 5bbf0a8afa5a3cbaa9281e47cc327b0d9560b03f Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Wed, 16 May 2018 13:58:30 +0200 Subject: [PATCH 17/20] Add missing assimp_qt_viewer install target --- tools/assimp_qt_viewer/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/assimp_qt_viewer/CMakeLists.txt b/tools/assimp_qt_viewer/CMakeLists.txt index 9f1b68cab..b41291e3d 100644 --- a/tools/assimp_qt_viewer/CMakeLists.txt +++ b/tools/assimp_qt_viewer/CMakeLists.txt @@ -42,3 +42,5 @@ else() endif() set_property(TARGET ${PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) + +install(TARGETS assimp_qt_viewer DESTINATION "${ASSIMP_BIN_INSTALL_DIR}") From df9faaae41d65e41209ae011beca38e973d5bf2d Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 16 May 2018 19:39:27 +0200 Subject: [PATCH 18/20] Update Readme.md Remove deprecated doc. --- Readme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/Readme.md b/Readme.md index 856371d7e..449efc547 100644 --- a/Readme.md +++ b/Readme.md @@ -140,8 +140,6 @@ Open Asset Import Library is implemented in C++. The directory structure is: /tools Tools (old assimp viewer, command line `assimp`) /samples A small number of samples to illustrate possible use cases for Assimp - /workspaces Build environments for vc,xcode,... (deprecated, - CMake has superseded all legacy build options!) ### Where to get help ### From 224b43a3a9c8993c0ca96b1189ba91d968fe4e5d Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 16 May 2018 21:19:30 +0200 Subject: [PATCH 19/20] Update CHANGES Add 4.1.0 release notes --- CHANGES | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) diff --git a/CHANGES b/CHANGES index d5faab2e0..c0c73b98c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,264 @@ ---------------------------------------------------------------------- CHANGELOG ---------------------------------------------------------------------- +4.1.0 (2017-12): +- FEATURES: + - Export 3MF ( experimental ) + - Import / Export glTF 2 + - Introduce new zib-lib to eb able to export zip-archives +- FIXES/HOUSEKEEPING: + - Added missing include to stdlib.h and remove load library call + - Fix install for builds with MSVC compiler and NMake. + - Update list of supported file formats. + - Add TriLib to the official list of supported ports. + - Re-enabling PACK_STRUCT for MDL files. + - Use std.::unique_ptr + - Update D3MFExporter.h + - Update MD3Loader.cpp, using index + - Fix all warnings on MSVC14 + - Copy assimp dll to unit folder on windows + - Update jvm port supported formats + - Add support for building Mac OS X Framework bundles + - Check for nullptr dereferencing before copying scene data + - Update ValidateDataStructure.h, typo + - Enable data structure validation in cases where it doesn't cause failures + - Remove some dead assignments + - fast_atof: Silence some uninitialized variable warnings + - Check for area test if the face is a triangle. + - Set mNumUVComponents to 0 when deleting texture coordinate sets + - Only scale the root node because this will rescale all children nodes as well. + - Issue 1514: Fix frame pointer arithmetic + - Prevent failing stringstream to crash the export process + - powf -> pow + - add Defines.h to include folder for install. + - Android: + - Fix android build + - Fix assimp for cross compile for android + - Use define for D_FILE_OFFSET_BITS only for not-android systems. + - FBX: + - Fix handling with embedded textures + - FBX 7500 Binary reading + - Remove dead assignment + - Fix export of deleted meshes; Add LazyDict::Remove method + - Log an error instead of letting the fbx-importer crash. ( issue 213 ) + - Replace bad pointer casting with memcpy + - Remove useless const qualifier from return value + - Add explicit instantiation of log_prefix so other FBX source files can see it + - add missing inversion of postrotation matrix for fbx. + - FIReader: Silence uninitialized variable warning + - Update version check in FBX reader to check for version >= 7500 + - Use actual min/max of anim keys when start/stop time is missing +- GLTF1: + - Fix output of glTF 1 version string + - Fix delete / delete[] mismatch in glTFAsset + - Don’t ignore rgba(1,1,1,1) color properties + - glTF2 primitives fixes + - Don’t ignore rgba(1,1,1,1) color properties + - Fix delete / delete[] mismatch in glTFAsset + - Remove KHR_binary_glTF code + - glTF nodes can only hold one mesh. this simply assigns to and check’s a Node’s Mesh + - version in glb header is stored as uint32_t +- GLTF2: + - node name conflict fix + - Fix transform matrices multiplication order + - Preserve node names when importing + - Add support for tangents in import + - Fix typo on gltf2 camera parameters + - Moved byteStride from accessor to bufferView + - Implemented reading binary glTF2 (glb) files + - Fix signed/unsigned warning + - Add postprocess step for scaling + - Fix shininess to roughness conversion + - Prefer “BLEND” over “MASK” as an alphaMode default + - Approximate specularity / glossiness in metallicRoughness materials + - Diffuse color and diffuse texture import and export improvements + - Addressed some mismatched news/deletes caused by the new glTF2 sources. + - Fix delete / delete[] mismatches in glTF2 importer + - use correct name of exporter to gltf2 + - Fix possible infinite loop when exporting to gltf2 + - Fix glTF2::Asset::FindUniqueID() when the input string is >= 256 chars + - Fix glTF2 alphaMode storage and reading + - Fix glTF 2.0 multi-primitive support + - Load gltf .bin files from correct directory + - Add support for importing both glTF and glTF2 files + - ampler improvements; Add new LazyDict method + - Changes to GLTF2 materials + - Remove Light, Technique references + - Start removing materials common, and adding pbrSpecularGlossiness + - Use !ObjectEmpty() vs. MemberCount() > 0 + - Working read, import, export, and write of gltf2 (pbr) material + - Check in gltf2 models to test directory + - Remove un-needed test models + - Start managing and importing gltf2 pbr materials + - Update glTF2 Asset to use indexes + - Duplicate gltfImporter as gltf2Importer; Include glTF2 importer in CMake List + - glTF2: Fix animation export + - use opacity for diffuse alpha + alphaMode +- STL: + - Restore import of multi mesh binary STLs +- Blender: + - Silence warning about uninitialized member +- MDLImporter: + - Don't take address of packed struct member +- assimp_cmd: + - Fix strict-aliasing warnings +- Open3DGC: + - Fix strict-aliasing warnings + - Add assertions to silence static analyzer warnings + - Remove redundant const qualifiers from return types + - Fix some uninitialized variable warnings + - Remove OPEN3DGC and compression references +- unzip: + - Remove dead assignment + - Bail on bad compression method + - Fix possibly uninitialized variables +- clipper: + - Add assertion to silence a static analyzer warning +- OpenDDLExport: + - Reduce scope of a variable + - Remove dead variable + - Remove dead assignment + - Fix another potential memory leak +- X3DImporter: + - Add assertions to silence static analyzer warnings + - Add missing unittest + - Workaround for buggy Android NDK (issue #1361) +- TerragenLoader: + - Remove unused variable +- SIBImporter: + - Add assertions to silence static analyzer warnings +- IFC: + - Remove dead code + - Add explicit instantiation of log_prefix so IFCMaterial.cpp can see it +- PLY: + - Remove dead assignment and reduce scope of a variable + - fix vertex attribute lookup. +- OpenGEX: + - Add assertion to silence a static analyzer warning + - Fix for TextureFile with number in file name + - Return early when element is TextureFile +- NFF: + - Add assertions to silence static analyzer warnings + - Split up some complicated assignments +- Raw: Fix misleading indentation warning + - Reduce scope of a variable +- LWO + - Reduce scope of a variable +- IRRLoader: + - Fix confusing boolean casting +- AssbinExporter: + - Add assertion to silence a static analyzer warning +- ASE: + - Add assertion to silence a static analyzer warning +- AMFImporter: + - Add assertion to silence a static analyzer warning + - Add a block +- OptimizeGraph: + - Fix possible null pointer dereference + - RemoveRedundantMaterials: + - Add assertion to silence a static analyzer warning +- ImproveCacheLocality: + - Add assertion to silence a static analyzer warning +- RemoveRedundantMaterials: + - Set pointer to nullptr after deleting it +- Travis: + - Disable unit tests in scan-build config + - Move slower builds earlier to improve parallelization + - Add static analysis to build + - Remove unused branch rule for travis. + - Add Clang UBSan build configuration + - Treat warnings as errors, without typos this time +- Unittests: + - Add VS-based source groups for the unittests. +- Collada: + - export tag + - Update ColladaExporter.cpp + - Silence uninitialized variable warning + - Add support for line strip primitives +- Obj Wavefront: + - check in exporting against out-of-bounds-access . + - Issue 1351: use correct name for obj-meshname export for groups. + - fix mem-lead: face will be not released in case of an error. + - Anatoscope obj exporter nomtl + - Raise exception when obj file contains invalid face indices + - Added alternative displacement texture token in OBJ MTL material. + - Obj: rename attribute from exporter. + - Fix OBJ discarding all material names if the material library is missing +- Step: + - use correct lookup for utf32 +- MD2: + - Fix MD2 frames containing garbage +- STL + - add missing const. + - Fix memory-alignment bug. + - Fix issue 104: deal with more solids in one STL file. +- CMake + - Fix issue 213: use correct include folder for assimp +- Doxygen + - Fix issue 1513: put irrXML onto exclucde list for doxygen run +- PyAssimp: + - Search for libassimp.so in LD_LIBRARY_PATH if available. + - Fix operator precedence issue in header check + - Split setup.py into multiple lines + - Detect if Anaconda and fixed 3d_viewer for Python 3 + - created a python3 version of the 3dviewer and fixed the / = float in py3 +- Blender: + - Fix invalid access to mesh array when the array is empty. + - Fix short overflow. + - Silence warning about inline function which is declared but not defined +- JAssimp + - Changed license header for IHMC contributions from Apache 2.0 to BSD + - Add Node metadata to the Jassmip Java API + - Added supported for custom IO Systems in Java. Implemented ClassLoader IO System + - Added a link to pure jvm assimp port +- Clang sanitizer: + - Undefined Behavior sanitizer + - Fixed a divide by zero error in IFCBoolean that was latent, but nevertheless a bug +- B3DImporter: + - Replace bad pointer casting with memcpy +- AppVeyor: + - Cleanup and Addition of VS 2017 and running Tests + - Fixed File Size reported as 0 in tests that use temporary files + - x86 isn't a valid VS platform. Win32 it is, then. + - Replaced the worker image name, which doesn't work as generator name, with a manually created generator name. + - Cleaned up appveyor setup, added VS 2017 to the build matrix and attempted to add running of tests. + - Treat warnings as errors on Appveyor + - Disable warning 4351 on MSVC 2013 +- OpenGEXImporter: + - Copy materials to scene + - Store RefInfo in unique_ptr so they get automatically cleaned up + - Fix IOStream leak + - Store ChildInfo in unique_ptr so they get automatically cleaned up + - improve logging to be able to detect error-prone situations. +- AMFImporter: + - Fix memory leak +- UnrealLoader: + - Fix IOStream leak +- Upgrade RapidJSON to get rid of a clang warning +- zlib: + - Update zlib contribution + - Removed unnecessary files from zlib contribution + - Replaced unsigned long for the crc table to z_crc_t, to match what is returned by get-crc_table +- MakeVerboseFormat: + - Fix delete / delete[] mismatches in MakeVerboseFormat +- MaterialSystem: + - Fix out-of-bounds read in MaterialSystem unit test +- SIB: + - Added support for SIB models from Silo 2.5 +- AssbinExporter: + - Fix strict aliasing violation + - Add Write specialization for aiColor3D +- DefaultLogger: + - Whitespace cleanup to fix GCC misleading indentation warning +- MDP: + - Fix encoding issues. + - PreTransformVertices: + - fix name lost in mesh and nodes when load with flag +- C4D: + - Fixes for C4D importer +- Unzip: + - Latest greatest. + 4.0.1 (2017-07-28) - FIXES/HOUSEKEEPING: - fix version test. From a1a17c1dda127adbd571fb063af9309eebaac4bd Mon Sep 17 00:00:00 2001 From: Stanlo Slasinski Date: Fri, 18 May 2018 14:01:25 -0700 Subject: [PATCH 20/20] Read and write the KHR_materials_unlit glTF/2.0 extension. --- code/glTF2Asset.h | 5 +++++ code/glTF2Asset.inl | 4 ++++ code/glTF2AssetWriter.h | 1 + code/glTF2AssetWriter.inl | 10 ++++++++++ code/glTF2Exporter.cpp | 6 ++++++ code/glTF2Importer.cpp | 3 +++ include/assimp/pbrmaterial.h | 1 + 7 files changed, 30 insertions(+) diff --git a/code/glTF2Asset.h b/code/glTF2Asset.h index dd9b11df5..0ce843d09 100644 --- a/code/glTF2Asset.h +++ b/code/glTF2Asset.h @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * glTF Extensions Support: * KHR_materials_pbrSpecularGlossiness full + * KHR_materials_unlit full */ #ifndef GLTF2ASSET_H_INC #define GLTF2ASSET_H_INC @@ -741,6 +742,9 @@ namespace glTF2 //extension: KHR_materials_pbrSpecularGlossiness Nullable pbrSpecularGlossiness; + //extension: KHR_materials_unlit + bool unlit; + Material() { SetDefaults(); } void Read(Value& obj, Asset& r); void SetDefaults(); @@ -1037,6 +1041,7 @@ namespace glTF2 struct Extensions { bool KHR_materials_pbrSpecularGlossiness; + bool KHR_materials_unlit; } extensionsUsed; diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index d96db6d74..acf8cb331 100644 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -860,6 +860,8 @@ inline void Material::Read(Value& material, Asset& r) this->pbrSpecularGlossiness = Nullable(pbrSG); } } + + unlit = nullptr != FindObject(*extensions, "KHR_materials_unlit"); } } @@ -882,6 +884,7 @@ inline void Material::SetDefaults() alphaMode = "OPAQUE"; alphaCutoff = 0.5; doubleSided = false; + unlit = false; } inline void PbrSpecularGlossiness::SetDefaults() @@ -1253,6 +1256,7 @@ inline void Asset::ReadExtensionsUsed(Document& doc) if (exts.find(#EXT) != exts.end()) extensionsUsed.EXT = true; CHECK_EXT(KHR_materials_pbrSpecularGlossiness); + CHECK_EXT(KHR_materials_unlit); #undef CHECK_EXT } diff --git a/code/glTF2AssetWriter.h b/code/glTF2AssetWriter.h index e2b97e8c4..493ca1c0a 100644 --- a/code/glTF2AssetWriter.h +++ b/code/glTF2AssetWriter.h @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * glTF Extensions Support: * KHR_materials_pbrSpecularGlossiness: full + * KHR_materials_unlit: full */ #ifndef GLTF2ASSETWRITER_H_INC #define GLTF2ASSETWRITER_H_INC diff --git a/code/glTF2AssetWriter.inl b/code/glTF2AssetWriter.inl index 6be012676..0579dfdac 100644 --- a/code/glTF2AssetWriter.inl +++ b/code/glTF2AssetWriter.inl @@ -343,6 +343,12 @@ namespace glTF2 { } } + if (m.unlit) { + Value unlit; + unlit.SetObject(); + exts.AddMember("KHR_materials_unlit", unlit, w.mAl); + } + if (!exts.ObjectEmpty()) { obj.AddMember("extensions", exts, w.mAl); } @@ -683,6 +689,10 @@ namespace glTF2 { if (this->mAsset.extensionsUsed.KHR_materials_pbrSpecularGlossiness) { exts.PushBack(StringRef("KHR_materials_pbrSpecularGlossiness"), mAl); } + + if (this->mAsset.extensionsUsed.KHR_materials_unlit) { + exts.PushBack(StringRef("KHR_materials_unlit"), mAl); + } } if (!exts.Empty()) diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index d4b3d67de..9e8dfc822 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -526,6 +526,12 @@ void glTF2Exporter::ExportMaterials() m->pbrSpecularGlossiness = Nullable(pbrSG); } + + bool unlit; + if (mat->Get(AI_MATKEY_GLTF_UNLIT, unlit) == AI_SUCCESS && unlit) { + mAsset->extensionsUsed.KHR_materials_unlit = true; + m->unlit = true; + } } } diff --git a/code/glTF2Importer.cpp b/code/glTF2Importer.cpp index 2bcf8b5de..f478ca487 100644 --- a/code/glTF2Importer.cpp +++ b/code/glTF2Importer.cpp @@ -281,6 +281,9 @@ static aiMaterial* ImportMaterial(std::vector& embeddedTexIdxs, Asset& r, M SetMaterialTextureProperty(embeddedTexIdxs, r, pbrSG.specularGlossinessTexture, aimat, aiTextureType_SPECULAR); } + if (mat.unlit) { + aimat->AddProperty(&mat.unlit, 1, AI_MATKEY_GLTF_UNLIT); + } return aimat; } diff --git a/include/assimp/pbrmaterial.h b/include/assimp/pbrmaterial.h index cd9b5e2bf..723957300 100644 --- a/include/assimp/pbrmaterial.h +++ b/include/assimp/pbrmaterial.h @@ -56,6 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_MATKEY_GLTF_ALPHACUTOFF "$mat.gltf.alphaCutoff", 0, 0 #define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS "$mat.gltf.pbrSpecularGlossiness", 0, 0 #define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR "$mat.gltf.pbrMetallicRoughness.glossinessFactor", 0, 0 +#define AI_MATKEY_GLTF_UNLIT "$mat.gltf.unlit", 0, 0 #define _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE "$tex.file.texCoord" #define _AI_MATKEY_GLTF_MAPPINGNAME_BASE "$tex.mappingname"