فهرست منبع

Adjusting the Collada Color Parser

The collada parser parses the RGB descriptor out of the
xml file, but does not use this information when constructing
the actual mColors array.

If you export a collada file with RGB colors, and then import it,
it used to create color values in the form RGBR, taking the
R component from the next color tuple instead of filling in
sensible defaults for the alpha channel.

This patch uses the information to fill each color.
Albert Wang 13 سال پیش
والد
کامیت
7d4ee98350
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      code/ColladaParser.cpp

+ 6 - 1
code/ColladaParser.cpp

@@ -2231,7 +2231,12 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
           pMesh->mColors[pInput.mIndex].insert( pMesh->mColors[pInput.mIndex].end(), 
             pMesh->mPositions.size() - pMesh->mColors[pInput.mIndex].size() - 1, aiColor4D( 0, 0, 0, 1));
 
-				pMesh->mColors[pInput.mIndex].push_back( aiColor4D( obj[0], obj[1], obj[2], obj[3])); 
+		aiColor4D result(0, 0, 0, 1);
+		for (size_t i = 0; i < pInput.mResolved->mSize; ++i)
+		{
+			result[i] = obj[pInput.mResolved->mSubOffset[i]];
+		}
+				pMesh->mColors[pInput.mIndex].push_back(result); 
       } else 
       {
 				DefaultLogger::get()->error("Collada: too many vertex color sets. Skipping.");