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
parent
6d3cedc0b1
commit
7d4ee98350
|
@ -2231,7 +2231,12 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
|
||||||
pMesh->mColors[pInput.mIndex].insert( pMesh->mColors[pInput.mIndex].end(),
|
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->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
|
} else
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->error("Collada: too many vertex color sets. Skipping.");
|
DefaultLogger::get()->error("Collada: too many vertex color sets. Skipping.");
|
||||||
|
|
Loading…
Reference in New Issue