X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fwindingtest.h;fp=source%2Fcore%2Fwindingtest.h;h=ffc52556bfaa5e9b6df35c5345e1afb212fdacab;hb=7aaec9a70b8d7733429bec043f8e33e02956f266;hp=0000000000000000000000000000000000000000;hpb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;p=libs%2Fgl.git diff --git a/source/core/windingtest.h b/source/core/windingtest.h new file mode 100644 index 00000000..ffc52556 --- /dev/null +++ b/source/core/windingtest.h @@ -0,0 +1,45 @@ +#ifndef MSP_GL_WINDINGTEST_H_ +#define MSP_GL_WINDINGTEST_H_ + +#include +#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 +{ +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