------------------------------------------------------------------------------- Entry point for the loader thread The loader thread loads the asset while the progress dialog displays the smart progress bar -------------------------------------------------------------------------------
| 146 | // smart progress bar |
| 147 | //------------------------------------------------------------------------------- |
| 148 | DWORD WINAPI LoadThreadProc(LPVOID) { |
| 149 | // get current time |
| 150 | double fCur = (double)timeGetTime(); |
| 151 | |
| 152 | aiPropertyStore *props = aiCreatePropertyStore(); |
| 153 | aiSetImportPropertyInteger(props, AI_CONFIG_IMPORT_TER_MAKE_UVS, 1); |
| 154 | aiSetImportPropertyFloat(props, AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE, g_smoothAngle); |
| 155 | aiSetImportPropertyInteger(props, AI_CONFIG_PP_SBP_REMOVE, nopointslines ? aiPrimitiveType_LINE | aiPrimitiveType_POINT : 0); |
| 156 | |
| 157 | aiSetImportPropertyInteger(props, AI_CONFIG_GLOB_MEASURE_TIME, 1); |
| 158 | //aiSetImportPropertyInteger(props,AI_CONFIG_PP_PTV_KEEP_HIERARCHY,1); |
| 159 | |
| 160 | // Call ASSIMPs C-API to load the file |
| 161 | g_pcAsset->pcScene = (aiScene *)aiImportFileExWithProperties(g_szFileName, |
| 162 | ppsteps | /* configurable pp steps */ |
| 163 | aiProcess_GenSmoothNormals | // generate smooth normal vectors if not existing |
| 164 | aiProcess_SplitLargeMeshes | // split large, unrenderable meshes into submeshes |
| 165 | aiProcess_Triangulate | // triangulate polygons with more than 3 edges |
| 166 | aiProcess_ConvertToLeftHanded | // convert everything to D3D left handed space |
| 167 | aiProcess_SortByPType | // make 'clean' meshes which consist of a single typ of primitives |
| 168 | 0, |
| 169 | nullptr, |
| 170 | props); |
| 171 | |
| 172 | aiReleasePropertyStore(props); |
| 173 | |
| 174 | // get the end time of zje operation, calculate delta t |
| 175 | double fEnd = (double)timeGetTime(); |
| 176 | g_fLoadTime = (float)((fEnd - fCur) / 1000); |
| 177 | g_bLoadingFinished = true; |
| 178 | |
| 179 | // check whether the loading process has failed ... |
| 180 | if (nullptr == g_pcAsset->pcScene) { |
| 181 | CLogDisplay::Instance().AddEntry("[ERROR] Unable to load this asset:", |
| 182 | D3DCOLOR_ARGB(0xFF, 0xFF, 0, 0)); |
| 183 | |
| 184 | // print ASSIMPs error string to the log display |
| 185 | CLogDisplay::Instance().AddEntry(aiGetErrorString(), |
| 186 | D3DCOLOR_ARGB(0xFF, 0xFF, 0, 0)); |
| 187 | return 1; |
| 188 | } |
| 189 | |
| 190 | return 0; |
| 191 | } |
| 192 | |
| 193 | //------------------------------------------------------------------------------- |
| 194 | // Load the current asset |
nothing calls this directly
no test coverage detected