From 23381d9710f00c471b3204381510cb71da6da463 Mon Sep 17 00:00:00 2001 From: kimmi Date: Tue, 20 Mar 2012 20:48:26 +0000 Subject: [PATCH] =?UTF-8?q?Bugfix=20:=20Refactored=20ImproveCacheLocalityP?= =?UTF-8?q?rocess::ProcessMesh.=20(=20merged=20from=20GitHub,=20thanks=20t?= =?UTF-8?q?o=20Riku=20Palom=C3=A4ki=20).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1218 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ImproveCacheLocality.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/ImproveCacheLocality.cpp b/code/ImproveCacheLocality.cpp index 9075fd196..bfe77ae2c 100644 --- a/code/ImproveCacheLocality.cpp +++ b/code/ImproveCacheLocality.cpp @@ -206,10 +206,8 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh // create a copy of the piNumTriPtr buffer unsigned int* const piNumTriPtr = adj.mLiveTriangles; - const unsigned int* const piNumTriPtrNoModify = new unsigned int[pMesh->mNumVertices]; - memcpy(const_cast (piNumTriPtrNoModify),piNumTriPtr, - pMesh->mNumVertices * sizeof(unsigned int)); - + const std::vector piNumTriPtrNoModify(piNumTriPtr, piNumTriPtr + pMesh->mNumVertices); + // get the largest number of referenced triangles and allocate the "candidate buffer" unsigned int iMaxRefTris = 0; { const unsigned int* piCur = adj.mLiveTriangles; @@ -377,6 +375,6 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh delete[] piCachingStamps; delete[] piIBOutput; delete[] piCandidates; - delete[] piNumTriPtrNoModify; + return fACMR2; }