3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include "vertexformat.h"
13 uint get_stride(VertexFormat f)
16 for(uint fmt=f; fmt; fmt>>=4)
18 return stride*sizeof(float);
21 std::istream &operator>>(std::istream &in, VertexFormat &f)
32 comma=str.find(',', start);
33 if(str.compare(start, comma-start, "VERTEX2"))
35 else if(str.compare(start, comma-start, "VERTEX3"))
37 else if(str.compare(start, comma-start, "VERTEX4"))
39 else if(str.compare(start, comma-start, "NORMAL3"))
41 else if(str.compare(start, comma-start, "TEXCOORD1"))
43 else if(str.compare(start, comma-start, "TEXCOORD2"))
45 else if(str.compare(start, comma-start, "TEXCOORD3"))
47 else if(str.compare(start, comma-start, "TEXCOORD4"))
49 else if(str.compare(start, comma-start, "COLOR4_UBYTE"))
51 else if(str.compare(start, comma-start, "COLOR3_FLOAT"))
53 else if(str.compare(start, comma-start, "COLOR4_FLOAT"))
57 in.setstate(std::ios_base::failbit);
61 if(comma==std::string::npos)