// ---------------------------------------------
void GeometryPolygonExporter::getPolygonInputAttributes ( COLLADASW::InputList &inputList )
{
    // Generate the polygon set inputs.
    int nextIdx = 1, normalsIdx = -1;
    int offset = 0; // Offset for the input list

    size_t inputCount = mPolygonSources->size();
    for ( size_t p = 0; p < inputCount; ++p )
    {
        const SourceInput param = ( *mPolygonSources ) [p];
        const COLLADASW::SourceBase source = param.getSource();
        const COLLADASW::InputSemantic::Semantics type = param.getType();

        // Check if the vertex is already registered
        bool isVertexSource = SourceInput::containsSourceBase ( mVertexSources, &source );

        // Add the per-face, per-vertex input to the polygons description
        if ( !isVertexSource )
        {
            // Get the generated id of the source for reference
            String sourceId = source.getId();

            // The vertex sources must reference to the vertexes element
            if ( type == COLLADASW::InputSemantic::VERTEX )
            {
                String suffix = getSuffixBySemantic ( type );
                sourceId = mMeshId + suffix;
            }

            if ( type == COLLADASW::InputSemantic::TEXCOORD )
            {
                // For texture coordinate-related inputs: set the 'set' attribute.
                if ( param.getIdx () >= 0 )
                    inputList.push_back ( COLLADASW::Input ( type, COLLADASW::URI ( EMPTY_STRING, sourceId ), offset++, param.getIdx() ) );
                else
                    inputList.push_back ( COLLADASW::Input ( type, COLLADASW::URI ( EMPTY_STRING, sourceId ), offset++ ) );
            }
            else if ( type == COLLADASW::InputSemantic::TANGENT || type == COLLADASW::InputSemantic::BINORMAL || type == COLLADASW::InputSemantic::TEXBINORMAL )
            {
                // Tangents and binormals can use the same index than the normals.
                // Texture binormals can use the index list of texture tangents.
                if ( param.getIdx () >= 0 )
                    inputList.push_back ( COLLADASW::Input ( type, COLLADASW::URI ( EMPTY_STRING, sourceId ), offset-1, param.getIdx() ) );
                else
                    inputList.push_back ( COLLADASW::Input ( type, COLLADASW::URI ( EMPTY_STRING, sourceId ), offset-1 ) );
            }
            else
            {
                if ( param.getIdx () >= 0 )
                    inputList.push_back ( COLLADASW::Input ( type, COLLADASW::URI ( EMPTY_STRING, sourceId ), offset++, param.getIdx () ) );
                else
                    inputList.push_back ( COLLADASW::Input ( type, COLLADASW::URI ( EMPTY_STRING, sourceId ), offset++ ) );
            }
        }
    }
}
std::string GeometryExporter::getIdBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix) {
	return geom_id + getSuffixBySemantic(type) + other_suffix;
}