X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftests.h;h=f7d729504a37f34b477a635675197f4166c29791;hp=0fa05b46562abc36c5bce18d68ab88d732adea52;hb=d901696935a6bf9fdad6ac8abe65ffab79bd297d;hpb=0f1c018d65658ae564881649443fde3f7d2182a8 diff --git a/source/tests.h b/source/tests.h index 0fa05b46..f7d72950 100644 --- a/source/tests.h +++ b/source/tests.h @@ -1,32 +1,54 @@ -/* $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 +#include "bindable.h" +#include "gl.h" #include "predicate.h" -#include "types.h" namespace Msp { namespace GL { -enum +/** +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 bind() const; -void depth_func(Predicate func); + static void unbind(); +}; } // namespace GL } // namespace Msp