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.
pull/11/head
Albert Wang 2012-11-12 12:33:51 -06:00
parent 6d3cedc0b1
commit 7d4ee98350
1 changed files with 6 additions and 1 deletions

View File

@ -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.");