Fixing some whitespace issues in ColladaParser

pull/11/head
Albert Wang 2012-11-12 12:39:11 -06:00
parent 7d4ee98350
commit 0ea6ec4e84
1 changed files with 41 additions and 41 deletions

View File

@ -2173,79 +2173,79 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
DefaultLogger::get()->error("Collada: just one vertex position stream supported"); DefaultLogger::get()->error("Collada: just one vertex position stream supported");
break; break;
case IT_Normal: case IT_Normal:
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mNormals.size() < pMesh->mPositions.size()-1) if( pMesh->mNormals.size() < pMesh->mPositions.size()-1)
pMesh->mNormals.insert( pMesh->mNormals.end(), pMesh->mPositions.size() - pMesh->mNormals.size() - 1, aiVector3D( 0, 1, 0)); pMesh->mNormals.insert( pMesh->mNormals.end(), pMesh->mPositions.size() - pMesh->mNormals.size() - 1, aiVector3D( 0, 1, 0));
// ignore all normal streams except 0 - there can be only one normal // ignore all normal streams except 0 - there can be only one normal
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mNormals.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mNormals.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex normal stream supported"); DefaultLogger::get()->error("Collada: just one vertex normal stream supported");
break; break;
case IT_Tangent: case IT_Tangent:
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mTangents.size() < pMesh->mPositions.size()-1) if( pMesh->mTangents.size() < pMesh->mPositions.size()-1)
pMesh->mTangents.insert( pMesh->mTangents.end(), pMesh->mPositions.size() - pMesh->mTangents.size() - 1, aiVector3D( 1, 0, 0)); pMesh->mTangents.insert( pMesh->mTangents.end(), pMesh->mPositions.size() - pMesh->mTangents.size() - 1, aiVector3D( 1, 0, 0));
// ignore all tangent streams except 0 - there can be only one tangent // ignore all tangent streams except 0 - there can be only one tangent
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mTangents.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mTangents.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex tangent stream supported"); DefaultLogger::get()->error("Collada: just one vertex tangent stream supported");
break; break;
case IT_Bitangent: case IT_Bitangent:
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mBitangents.size() < pMesh->mPositions.size()-1) if( pMesh->mBitangents.size() < pMesh->mPositions.size()-1)
pMesh->mBitangents.insert( pMesh->mBitangents.end(), pMesh->mPositions.size() - pMesh->mBitangents.size() - 1, aiVector3D( 0, 0, 1)); pMesh->mBitangents.insert( pMesh->mBitangents.end(), pMesh->mPositions.size() - pMesh->mBitangents.size() - 1, aiVector3D( 0, 0, 1));
// ignore all bitangent streams except 0 - there can be only one bitangent // ignore all bitangent streams except 0 - there can be only one bitangent
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mBitangents.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mBitangents.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex bitangent stream supported"); DefaultLogger::get()->error("Collada: just one vertex bitangent stream supported");
break; break;
case IT_Texcoord: case IT_Texcoord:
// up to 4 texture coord sets are fine, ignore the others // up to 4 texture coord sets are fine, ignore the others
if( pInput.mIndex < AI_MAX_NUMBER_OF_TEXTURECOORDS) if( pInput.mIndex < AI_MAX_NUMBER_OF_TEXTURECOORDS)
{ {
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mTexCoords[pInput.mIndex].size() < pMesh->mPositions.size()-1) if( pMesh->mTexCoords[pInput.mIndex].size() < pMesh->mPositions.size()-1)
pMesh->mTexCoords[pInput.mIndex].insert( pMesh->mTexCoords[pInput.mIndex].end(), pMesh->mTexCoords[pInput.mIndex].insert( pMesh->mTexCoords[pInput.mIndex].end(),
pMesh->mPositions.size() - pMesh->mTexCoords[pInput.mIndex].size() - 1, aiVector3D( 0, 0, 0)); pMesh->mPositions.size() - pMesh->mTexCoords[pInput.mIndex].size() - 1, aiVector3D( 0, 0, 0));
pMesh->mTexCoords[pInput.mIndex].push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mTexCoords[pInput.mIndex].push_back( aiVector3D( obj[0], obj[1], obj[2]));
if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) /* hack ... consider cleaner solution */ if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) /* hack ... consider cleaner solution */
pMesh->mNumUVComponents[pInput.mIndex]=3; pMesh->mNumUVComponents[pInput.mIndex]=3;
} else } else
{ {
DefaultLogger::get()->error("Collada: too many texture coordinate sets. Skipping."); DefaultLogger::get()->error("Collada: too many texture coordinate sets. Skipping.");
} }
break; break;
case IT_Color: case IT_Color:
// up to 4 color sets are fine, ignore the others // up to 4 color sets are fine, ignore the others
if( pInput.mIndex < AI_MAX_NUMBER_OF_COLOR_SETS) if( pInput.mIndex < AI_MAX_NUMBER_OF_COLOR_SETS)
{ {
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mColors[pInput.mIndex].size() < pMesh->mPositions.size()-1) if( pMesh->mColors[pInput.mIndex].size() < pMesh->mPositions.size()-1)
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));
aiColor4D result(0, 0, 0, 1); aiColor4D result(0, 0, 0, 1);
for (size_t i = 0; i < pInput.mResolved->mSize; ++i) for (size_t i = 0; i < pInput.mResolved->mSize; ++i)
{ {
result[i] = obj[pInput.mResolved->mSubOffset[i]]; result[i] = obj[pInput.mResolved->mSubOffset[i]];
} }
pMesh->mColors[pInput.mIndex].push_back(result); 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.");
} }
break; break;
default: default:
// IT_Invalid and IT_Vertex // IT_Invalid and IT_Vertex
ai_assert(false && "shouldn't ever get here"); ai_assert(false && "shouldn't ever get here");
} }
} }