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)
21 std::istream &operator>>(std::istream &in, VertexFormat &f)
31 unsigned underscore=str.find('_', start);
32 if(!str.compare(start, underscore-start, "VERTEX2"))
34 else if(!str.compare(start, underscore-start, "VERTEX3"))
36 else if(!str.compare(start, underscore-start, "VERTEX4"))
38 else if(!str.compare(start, underscore-start, "NORMAL3"))
40 else if(!str.compare(start, underscore-start, "TEXCOORD1"))
42 else if(!str.compare(start, underscore-start, "TEXCOORD2"))
44 else if(!str.compare(start, underscore-start, "TEXCOORD3"))
46 else if(!str.compare(start, underscore-start, "TEXCOORD4"))
48 else if(!str.compare(start, underscore-start, "COLOR4UB"))
50 else if(!str.compare(start, underscore-start, "COLOR3F"))
52 else if(!str.compare(start, underscore-start, "COLOR4F"))
56 in.setstate(std::ios_base::failbit);
60 if(underscore==std::string::npos)