فهرست منبع

fix typo, use a macro to avoid magic numbers.

sunjc 2 سال پیش
والد
کامیت
fb146b7d39
1فایلهای تغییر یافته به همراه7 افزوده شده و 5 حذف شده
  1. 7 5
      code/PostProcessing/JoinVerticesProcess.cpp

+ 7 - 5
code/PostProcessing/JoinVerticesProcess.cpp

@@ -251,6 +251,8 @@ private:
     unsigned mNumUVChannels;
     unsigned mNumUVChannels;
     unsigned mNumColorChannels;
     unsigned mNumColorChannels;
 };
 };
+
+#define JOINED_VERTICES_MARK 0x80000000u
 // now start the JoinVerticesProcess
 // now start the JoinVerticesProcess
 int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
 int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
     static_assert( AI_MAX_NUMBER_OF_COLOR_SETS    == 8, "AI_MAX_NUMBER_OF_COLOR_SETS    == 8");
     static_assert( AI_MAX_NUMBER_OF_COLOR_SETS    == 8, "AI_MAX_NUMBER_OF_COLOR_SETS    == 8");
@@ -357,8 +359,8 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
             }
             }
         } else{
         } else{
             // if the vertex is already there just find the replace index that is appropriate to it
             // if the vertex is already there just find the replace index that is appropriate to it
-			// mark it with '0x80000000'
-            replaceIndex[a] = it->second | 0x80000000;
+			// mark it with JOINED_VERTICES_MARK
+            replaceIndex[a] = it->second | JOINED_VERTICES_MARK;
         }
         }
     }
     }
 
 
@@ -387,7 +389,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
     for( unsigned int a = 0; a < pMesh->mNumFaces; a++) {
     for( unsigned int a = 0; a < pMesh->mNumFaces; a++) {
         aiFace& face = pMesh->mFaces[a];
         aiFace& face = pMesh->mFaces[a];
         for( unsigned int b = 0; b < face.mNumIndices; b++) {
         for( unsigned int b = 0; b < face.mNumIndices; b++) {
-            face.mIndices[b] = replaceIndex[face.mIndices[b]] & ~0x80000000;
+            face.mIndices[b] = replaceIndex[face.mIndices[b]] & ~JOINED_VERTICES_MARK;
         }
         }
     }
     }
 
 
@@ -401,8 +403,8 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
             for ( unsigned int b = 0; b < bone->mNumWeights; b++ ) {
             for ( unsigned int b = 0; b < bone->mNumWeights; b++ ) {
                 const aiVertexWeight& ow = bone->mWeights[ b ];
                 const aiVertexWeight& ow = bone->mWeights[ b ];
                 // if the vertex is a unique one, translate it
                 // if the vertex is a unique one, translate it
-				// filter out joined vertices by mrak.
-                if ( !( replaceIndex[ ow.mVertexId ] & 0x80000000 ) ) {
+				// filter out joined vertices by JOINED_VERTICES_MARK.
+                if ( !( replaceIndex[ ow.mVertexId ] & JOINED_VERTICES_MARK ) ) {
                     aiVertexWeight nw;
                     aiVertexWeight nw;
                     nw.mVertexId = replaceIndex[ ow.mVertexId ];
                     nw.mVertexId = replaceIndex[ ow.mVertexId ];
                     nw.mWeight = ow.mWeight;
                     nw.mWeight = ow.mWeight;