Bugfix : Refactored ImproveCacheLocalityProcess::ProcessMesh. ( merged from GitHub, thanks to Riku Palomäki ).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1218 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/head
kimmi 2012-03-20 20:48:26 +00:00
parent 42def11d13
commit 23381d9710
1 changed files with 3 additions and 5 deletions

View File

@ -206,9 +206,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
// create a copy of the piNumTriPtr buffer // create a copy of the piNumTriPtr buffer
unsigned int* const piNumTriPtr = adj.mLiveTriangles; unsigned int* const piNumTriPtr = adj.mLiveTriangles;
const unsigned int* const piNumTriPtrNoModify = new unsigned int[pMesh->mNumVertices]; const std::vector<unsigned int> piNumTriPtrNoModify(piNumTriPtr, piNumTriPtr + pMesh->mNumVertices);
memcpy(const_cast<unsigned int* const> (piNumTriPtrNoModify),piNumTriPtr,
pMesh->mNumVertices * sizeof(unsigned int));
// get the largest number of referenced triangles and allocate the "candidate buffer" // get the largest number of referenced triangles and allocate the "candidate buffer"
unsigned int iMaxRefTris = 0; { unsigned int iMaxRefTris = 0; {
@ -377,6 +375,6 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
delete[] piCachingStamps; delete[] piCachingStamps;
delete[] piIBOutput; delete[] piIBOutput;
delete[] piCandidates; delete[] piCandidates;
delete[] piNumTriPtrNoModify;
return fACMR2; return fACMR2;
} }