From: Kim Kulling Date: Tue, 20 Sep 2016 17:48:03 +0000 (+0200) Subject: ModelDiffer: use Equal-method to compare vectors. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce2532e93bef8e951babe9736986a7921b89092a;p=platform%2Fupstream%2Fassimp.git ModelDiffer: use Equal-method to compare vectors. --- diff --git a/include/assimp/vector3.h b/include/assimp/vector3.h index e3a3179..891beb2 100644 --- a/include/assimp/vector3.h +++ b/include/assimp/vector3.h @@ -98,7 +98,6 @@ public: operator aiVector3t () const; public: - /** @brief Set the components of a vector * @param pX X component * @param pY Y component @@ -109,7 +108,6 @@ public: * @return Square length */ TReal SquareLength() const; - /** @brief Get the length of the vector * @return length */ TReal Length() const; diff --git a/test/unit/ModelDiffer.cpp b/test/unit/ModelDiffer.cpp index 9f12b38..e3e5573 100644 --- a/test/unit/ModelDiffer.cpp +++ b/test/unit/ModelDiffer.cpp @@ -54,7 +54,7 @@ ModelDiffer::~ModelDiffer() { // empty } -bool ModelDiffer::isEqual( aiScene *expected, aiScene *toCompare ) { +bool ModelDiffer::isEqual( const aiScene *expected, const aiScene *toCompare ) { if ( expected == toCompare ) { return true; } @@ -172,7 +172,7 @@ bool ModelDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) { for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) { aiVector3D &expVert( expected->mVertices[ i ] ); aiVector3D &toCompVert( toCompare->mVertices[ i ] ); - if ( expVert != toCompVert ) { + if ( expVert.Equal( toCompVert ) ) { std::stringstream stream; stream << "Vertex not equal ( expected: " << dumpVector3( expVert ) << ", found: " << dumpVector3( toCompVert ) << "\n"; addDiff( stream.str() ); @@ -193,7 +193,7 @@ bool ModelDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) { for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) { aiVector3D &expNormal( expected->mNormals[ i ] ); aiVector3D &toCompNormal( toCompare->mNormals[ i ] ); - if ( expNormal != toCompNormal ) { + if ( expNormal.Equal( toCompNormal ) ) { std::stringstream stream; stream << "Normal not equal ( expected: " << dumpVector3( expNormal ) << ", found: " << dumpVector3( toCompNormal ) << "\n"; addDiff( stream.str() ); @@ -236,7 +236,7 @@ bool ModelDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) { for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) { aiVector3D &expTexCoord( expected->mTextureCoords[ a ][ i ] ); aiVector3D &toCompTexCoord( toCompare->mTextureCoords[ a ][ i ] ); - if ( expTexCoord != toCompTexCoord ) { + if ( expTexCoord.Equal( toCompTexCoord ) ) { std::stringstream stream; stream << "Texture coords not equal ( expected: " << dumpVector3( expTexCoord ) << ", found: " << dumpVector3( toCompTexCoord ) << "\n"; addDiff( stream.str() ); @@ -257,7 +257,7 @@ bool ModelDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) { for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) { aiVector3D &expTangents( expected->mTangents[ i ] ); aiVector3D &toCompTangents( toCompare->mTangents[ i ] ); - if ( expTangents != toCompTangents ) { + if ( expTangents.Equal( toCompTangents ) ) { std::stringstream stream; stream << "Tangents not equal ( expected: " << dumpVector3( expTangents ) << ", found: " << dumpVector3( toCompTangents ) << "\n"; addDiff( stream.str() ); @@ -266,7 +266,7 @@ bool ModelDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) { aiVector3D &expBiTangents( expected->mBitangents[ i ] ); aiVector3D &toCompBiTangents( toCompare->mBitangents[ i ] ); - if ( expBiTangents != toCompBiTangents ) { + if ( expBiTangents.Equal( toCompBiTangents ) ) { std::stringstream stream; stream << "Tangents not equal ( expected: " << dumpVector3( expBiTangents ) << ", found: " << dumpVector3( toCompBiTangents ) << " )\n"; addDiff( stream.str() ); @@ -336,5 +336,4 @@ bool ModelDiffer::compareMaterial( aiMaterial *expected, aiMaterial *toCompare ) // todo! return true; - } diff --git a/test/unit/ModelDiffer.h b/test/unit/ModelDiffer.h index ed2e14e..fac5def 100644 --- a/test/unit/ModelDiffer.h +++ b/test/unit/ModelDiffer.h @@ -54,7 +54,7 @@ class ModelDiffer { public: ModelDiffer(); ~ModelDiffer(); - bool isEqual( aiScene *expected, aiScene *toCompare ); + bool isEqual( const aiScene *expected, const aiScene *toCompare ); void showReport(); void reset();