]> git.tdb.fi Git - libs/gl.git/blob - source/windingtest.h
Add a flag to RenderPass to render the back faces of a mesh
[libs/gl.git] / source / windingtest.h
1 #ifndef WINDINGTEST_H_
2 #define 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         bool test;
27         FaceWinding winding;
28
29 public:
30         WindingTest();
31         WindingTest(FaceWinding);
32
33         void bind() const;
34
35         static void unbind();
36
37         const WindingTest &get_reverse() const;
38
39         static const WindingTest &clockwise();
40         static const WindingTest &counterclockwise();
41 };
42
43 } // namespace GL
44 } // namespace Msp
45
46 #endif