]> git.tdb.fi Git - libs/gl.git/blob - source/tests.h
Drop Id tags and copyright notices from files
[libs/gl.git] / source / tests.h
1 #ifndef MSP_GL_TESTS_H_
2 #define MSP_GL_TESTS_H_
3
4 #include "bindable.h"
5 #include "gl.h"
6 #include "predicate.h"
7
8 namespace Msp {
9 namespace GL {
10
11 /**
12 Tests incoming fragment alpha values against a reference.  If the test fails,
13 the fragment is discarded.
14 */
15 class AlphaTest: public Bindable<AlphaTest>
16 {
17 private:
18         Predicate pred;
19         float ref;
20
21 public:
22         AlphaTest();
23         AlphaTest(Predicate, float);
24
25         void bind() const;
26
27         static void unbind();
28 };
29
30
31 /**
32 Tests incoming fragment depth values against the depth buffer.  If the test
33 fails, the fragment is discarded.
34 */
35 class DepthTest: public Bindable<DepthTest>
36 {
37 private:
38         bool write;
39         Predicate pred;
40
41 public:
42         DepthTest();
43         DepthTest(Predicate, bool = true);
44
45         void bind() const;
46
47         static const DepthTest &lequal();
48         static void unbind();
49 };
50
51
52 /**
53 Tests fragment coordinates against a rectangle.  Any fragments outside the
54 rectangle are discarded.
55 */
56 class ScissorTest: public Bindable<ScissorTest>
57 {
58 private:
59         int left;
60         int bottom;
61         unsigned width;
62         unsigned height;
63
64 public:
65         ScissorTest();
66         ScissorTest(int, int, unsigned, unsigned);
67
68         void bind() const;
69
70         static void unbind();
71 };
72
73 } // namespace GL
74 } // namespace Msp
75
76 #endif