X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ftests.h;h=0d7e2384dcaea1bf3990048d9f396e377b1035a7;hb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;hp=223396fe7f44b6a00e5cd7bca24c30215f610991;hpb=a4ec5410595ddf37bfbc0e85ad87d31a9cbf94f1;p=libs%2Fgl.git diff --git a/source/tests.h b/source/tests.h index 223396fe..0d7e2384 100644 --- a/source/tests.h +++ b/source/tests.h @@ -1,32 +1,74 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_GL_TESTS_H_ #define MSP_GL_TESTS_H_ +#include "bindable.h" #include "gl.h" #include "predicate.h" -#include "types.h" namespace Msp { namespace GL { -enum +/** +Tests incoming fragment alpha values against a reference. If the test fails, +the fragment is discarded. +*/ +class AlphaTest: public Bindable +{ +private: + Predicate pred; + float ref; + +public: + AlphaTest(); + AlphaTest(Predicate, float); + + void bind() const; + + static void unbind(); +}; + + +/** +Tests incoming fragment depth values against the depth buffer. If the test +fails, the fragment is discarded. +*/ +class DepthTest: public Bindable { - SCISSOR_TEST = GL_SCISSOR_TEST, - ALPHA_TEST = GL_ALPHA_TEST, - DEPTH_TEST = GL_DEPTH_TEST +private: + bool write; + Predicate pred; + +public: + DepthTest(); + DepthTest(Predicate, bool = true); + + void bind() const; + + static const DepthTest &lequal(); + static void unbind(); }; -void scissor(int left, int bottom, sizei width, sizei height); -void alpha_func(Predicate func, float ref); +/** +Tests fragment coordinates against a rectangle. Any fragments outside the +rectangle are discarded. +*/ +class ScissorTest: public Bindable +{ +private: + int left; + int bottom; + unsigned width; + unsigned height; + +public: + ScissorTest(); + ScissorTest(int, int, unsigned, unsigned); -void depth_func(Predicate func); + void bind() const; + + static void unbind(); +}; } // namespace GL } // namespace Msp