]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/windingtest.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / core / windingtest.h
diff --git a/source/core/windingtest.h b/source/core/windingtest.h
new file mode 100644 (file)
index 0000000..ffc5255
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef MSP_GL_WINDINGTEST_H_
+#define MSP_GL_WINDINGTEST_H_
+
+#include <msp/strings/lexicalcast.h>
+#include "bindable.h"
+#include "gl.h"
+
+namespace Msp {
+namespace GL {
+
+enum FaceWinding
+{
+       CLOCKWISE = GL_CW,
+       COUNTERCLOCKWISE = GL_CCW
+};
+
+void operator>>(const LexicalConverter &, FaceWinding &);
+
+/**
+Tests the winding of polygons.  If the order of vertices on screen does not
+match the winding, the polygon is not rendered.
+*/
+class WindingTest: public Bindable<WindingTest>
+{
+private:
+       FaceWinding winding;
+
+public:
+       WindingTest();
+       WindingTest(FaceWinding);
+
+       void bind() const;
+
+       static void unbind();
+
+       const WindingTest &get_reverse() const;
+
+       static const WindingTest &clockwise();
+       static const WindingTest &counterclockwise();
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif