Sorry for the poor example. Here is a fixed comment example section.
Here is an example usage scenario :
Say you have positions & indices, and want textures, normals, and tangents.
NVMeshMender aMender;
MVMeshMender::VAVector inputAtts; // this is what you have
MVMeshMender::VAVector outputAtts; // this is what you want
MVMeshMender::VertexAttribute att; // this is my working attribute
att.Name_ = “position”;
for ( int p = 0; p < number_of_vertices; ++p )
{
att.floatVector_.push_back( myPositions[ p ].x );
att.floatVector_.push_back( myPositions[ p ].y );
att.floatVector_.push_back( myPositions[ p ].z );
}
inputAtts.push_back( att );
att.floatVector.clear();
att.Name_ = “indices”;
for ( int i = 0; i < number_of_indices; ++i )
{
att.intVector_.push_back( myIndices[ i ] );
}
inputAtts.push_back( att );
att.intVector.clear();
att.Name_ = “indices”;
outputAtts.push_back( att );
att.Name_ = “tex0”;
outputAtts.push_back( att );
att.Name_ = “normal”;
outputAtts.push_back( att );
att.Name_ = “tangent”;
outputAtts.push_back( att );
// All inputs except for indices are assumed to be sets of 3 floats
// “indices” are assumed to be unsigned ints
// “tex0” is used for the tangent space calculation
// “tex0” is the only coordinate set generated, and the texture matrix applies only to it
// All unknown attribute types, including “tex1”, “tex2”, “random_attribute”, “weights”, “bones”, etc.
// are simply passed through. They will be duplicated as needed just like positions, normals, etc.
bool bSuccess = aMender.Munge( inputAtts, // these are my positions & indices
outputAtts, // these are the outputs I requested, plus extra stuff generated on my behalf
3.141592654f / 2.5f, // tangent space smooth angle
NULL, // no Texture matrix applied to my tex0 coords
FixTangents, // fix degenerate bases & texture mirroring
FixCylindricalTexGen // handle cylidrically mapped textures via vertex duplication
WeightNormalsByFaceSize // weight vertex normals by the triangle’s size
);
if ( !bSuccess ) return false;