]> git.tdb.fi Git - libs/gl.git/blob - source/windingtest.h
948f190b801ec34122d450f20a9b9b068eb654d1
[libs/gl.git] / source / windingtest.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2011  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef WINDINGTEST_H_
9 #define WINDINGTEST_H_
10
11 #include <msp/strings/lexicalcast.h>
12 #include "bindable.h"
13 #include "gl.h"
14
15 namespace Msp {
16 namespace GL {
17
18 enum FaceWinding
19 {
20         CLOCKWISE = GL_CW,
21         COUNTERCLOCKWISE = GL_CCW
22 };
23
24 void operator>>(const LexicalConverter &, FaceWinding &);
25
26 /**
27 Tests the winding of polygons.  If the order of vertices on screen does not
28 match the winding, the polygon is not rendered.
29 */
30 class WindingTest: public Bindable<WindingTest>
31 {
32 private:
33         bool test;
34         FaceWinding winding;
35
36 public:
37         WindingTest();
38         WindingTest(FaceWinding);
39
40         void bind() const;
41
42         static void unbind();
43
44         static WindingTest &clockwise();
45         static WindingTest &counterclockwise();
46 };
47
48 } // namespace GL
49 } // namespace Msp
50
51 #endif