]> git.tdb.fi Git - libs/gl.git/blob - source/core/windingtest.h
ff5b417d5a0a28ee77ccc502e481e9ff23fd6229
[libs/gl.git] / source / core / windingtest.h
1 #ifndef MSP_GL_WINDINGTEST_H_
2 #define MSP_GL_WINDINGTEST_H_
3
4 #include <msp/strings/lexicalcast.h>
5 #include "bindable.h"
6 #include "gl.h"
7
8 namespace Msp {
9 namespace GL {
10
11 enum FaceWinding
12 {
13         CLOCKWISE = GL_CW,
14         COUNTERCLOCKWISE = GL_CCW
15 };
16
17 void operator>>(const LexicalConverter &, FaceWinding &);
18
19 /**
20 Tests the winding of polygons.  If the order of vertices on screen does not
21 match the winding, the polygon is not rendered.
22 */
23 class WindingTest: public Bindable<WindingTest>
24 {
25 private:
26         FaceWinding winding;
27
28 public:
29         WindingTest();
30         WindingTest(FaceWinding);
31
32         FaceWinding get_winding() const { return winding; }
33
34         void bind() const;
35
36         static void unbind();
37
38         const WindingTest &get_reverse() const;
39
40         static const WindingTest &clockwise();
41         static const WindingTest &counterclockwise();
42 };
43
44 } // namespace GL
45 } // namespace Msp
46
47 #endif