- else if(str.size()>=9 && !str.compare(0, 8, "TEXCOORD") && str[8]>='1' && str[8]<='4')
- {
- if(str.size()==9)
- a = static_cast<VertexAttribute>(TEXCOORD1+(str[8]-'1'));
- else if(str.size()==11 && str[9]=='_' && str[10]>='0' && str[10]<='7')
- a = static_cast<VertexAttribute>(TEXCOORD1+(str[8]-'1')+(str[10]-'0')*4);
- else
- throw lexical_error(format("conversion of '%s' to VertexAttribute", str));
- }
- else if(str.size()>=9 && !str.compare(0, 6, "ATTRIB") && str[6]>='1' && str[6]<='4' && str[7]=='_')
- {
- unsigned n;
- try
- {
- n = lexical_cast<unsigned>(str.substr(8));
- }
- catch(const lexical_error &)
- {
- throw lexical_error(format("conversion of '%s' to VertexAttribute", str));
- }
- a = static_cast<VertexAttribute>(ATTRIB1+(str[6]-'1')+n*4);
- }
- else
+ else if(!convert_attribute(str, "VERTEX", 2, 4, a, VERTEX2) &&
+ !convert_attribute(str, "GROUP", 1, 4, a, GROUP1) &&
+ !convert_attribute(str, "WEIGHT", 1, 4, a, WEIGHT1) &&
+ !convert_attribute(str, "TEXCOORD", 1, 4, a, TEXCOORD1) &&
+ !convert_attribute(str, "GENERIC", 1, 4, a, GENERIC1))