]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/primitivetype.cpp
Rearrange soucre files into subdirectories
[libs/gl.git] / source / core / primitivetype.cpp
diff --git a/source/core/primitivetype.cpp b/source/core/primitivetype.cpp
new file mode 100644 (file)
index 0000000..8137584
--- /dev/null
@@ -0,0 +1,28 @@
+#include <msp/strings/format.h>
+#include "primitivetype.h"
+
+namespace Msp {
+namespace GL {
+
+void operator>>(const LexicalConverter &conv, PrimitiveType &pt)
+{
+       if(conv.get()=="POINTS")
+               pt = POINTS;
+       else if(conv.get()=="LINES")
+               pt = LINES;
+       else if(conv.get()=="LINE_LOOP")
+               pt = LINE_LOOP;
+       else if(conv.get()=="LINE_STRIP")
+               pt = LINE_STRIP;
+       else if(conv.get()=="TRIANGLES")
+               pt = TRIANGLES;
+       else if(conv.get()=="TRIANGLE_STRIP")
+               pt = TRIANGLE_STRIP;
+       else if(conv.get()=="TRIANGLE_FAN")
+               pt = TRIANGLE_FAN;
+       else
+               throw lexical_error(format("conversion of '%s' to PrimitiveType", conv.get()));
+}
+
+} // namespace GL
+} // namespace Msp