]> git.tdb.fi Git - libs/gl.git/blob - source/core/windingtest.h
Guard against hitting the end of the array in get_gl_type
[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         void bind() const;
33
34         static void unbind();
35
36         const WindingTest &get_reverse() const;
37
38         static const WindingTest &clockwise();
39         static const WindingTest &counterclockwise();
40 };
41
42 } // namespace GL
43 } // namespace Msp
44
45 #endif