]> git.tdb.fi Git - libs/gl.git/blob - source/primitivetype.cpp
0872f7760ae549b4ea7bdcc11779d7f27595e48b
[libs/gl.git] / source / primitivetype.cpp
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "primitivetype.h"
9
10 namespace Msp {
11 namespace GL {
12
13 std::istream &operator>>(std::istream &in, PrimitiveType &pt)
14 {
15         std::string str;
16         in>>str;
17
18         if(str=="POINTS")
19                 pt = POINTS;
20         else if(str=="LINES")
21                 pt = LINES;
22         else if(str=="LINE_LOOP")
23                 pt = LINE_LOOP;
24         else if(str=="LINE_STRIP")
25                 pt = LINE_STRIP;
26         else if(str=="TRIANGLES")
27                 pt = TRIANGLES;
28         else if(str=="TRIANGLE_STRIP")
29                 pt = TRIANGLE_STRIP;
30         else if(str=="TRIANGLE_FAN")
31                 pt = TRIANGLE_FAN;
32         else if(str=="QUADS")
33                 pt = QUADS;
34         else if(str=="QUAD_STRIP")
35                 pt = QUAD_STRIP;
36         else if(str=="POLYGON")
37                 pt = POLYGON;
38         else
39                 in.setstate(std::ios_base::failbit);
40
41         return in;
42 }
43
44 } // namespace GL
45 } // namespace Msp