Explorar o código

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
kimmi %!s(int64=13) %!d(string=hai) anos
pai
achega
23381d9710
Modificáronse 1 ficheiros con 3 adicións e 5 borrados
  1. 3 5
      code/ImproveCacheLocality.cpp

+ 3 - 5
code/ImproveCacheLocality.cpp

@@ -206,10 +206,8 @@ 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];
-	memcpy(const_cast<unsigned int* const> (piNumTriPtrNoModify),piNumTriPtr,
-		pMesh->mNumVertices * sizeof(unsigned int));
-
+	const std::vector<unsigned int> piNumTriPtrNoModify(piNumTriPtr, piNumTriPtr + pMesh->mNumVertices);
+	
 	// 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; {
 		const unsigned int* piCur = adj.mLiveTriangles;
 		const unsigned int* piCur = adj.mLiveTriangles;
@@ -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;
 }
 }