X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwindingtest.h;fp=source%2Fwindingtest.h;h=948f190b801ec34122d450f20a9b9b068eb654d1;hb=635d00bc1a9ba43ef1224681a14d0710a098cf87;hp=0000000000000000000000000000000000000000;hpb=0e8ffd3b59e9b5c52c66c22c9ae4f9d3544aa6bf;p=libs%2Fgl.git diff --git a/source/windingtest.h b/source/windingtest.h new file mode 100644 index 00000000..948f190b --- /dev/null +++ b/source/windingtest.h @@ -0,0 +1,51 @@ +/* $Id$ + +This file is part of libmspgl +Copyright © 2011 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#ifndef WINDINGTEST_H_ +#define 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: + bool test; + FaceWinding winding; + +public: + WindingTest(); + WindingTest(FaceWinding); + + void bind() const; + + static void unbind(); + + static WindingTest &clockwise(); + static WindingTest &counterclockwise(); +}; + +} // namespace GL +} // namespace Msp + +#endif