Merge pull request #2484 from aavenel/FindInstancesProcessOptim

Optim FindInstancesProcess
pull/2473/head^2
Kim Kulling 2019-06-04 12:50:16 +02:00 committed by GitHub
commit 4de162fa79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -137,6 +137,11 @@ void FindInstancesProcess::Execute( aiScene* pScene)
aiMesh* inst = pScene->mMeshes[i];
hashes[i] = GetMeshHash(inst);
// Find an appropriate epsilon
// to compare position differences against
float epsilon = ComputePositionEpsilon(inst);
epsilon *= epsilon;
for (int a = i-1; a >= 0; --a) {
if (hashes[i] == hashes[a])
{
@ -154,12 +159,7 @@ void FindInstancesProcess::Execute( aiScene* pScene)
orig->mPrimitiveTypes != inst->mPrimitiveTypes)
continue;
// up to now the meshes are equal. find an appropriate
// epsilon to compare position differences against
float epsilon = ComputePositionEpsilon(inst);
epsilon *= epsilon;
// now compare vertex positions, normals,
// up to now the meshes are equal. Now compare vertex positions, normals,
// tangents and bitangents using this epsilon.
if (orig->HasPositions()) {
if(!CompareArrays(orig->mVertices,inst->mVertices,orig->mNumVertices,epsilon))