]> git.tdb.fi Git - libs/gl.git/blob - source/core/depthtest.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / core / depthtest.h
1 #ifndef MSP_GL_DEPTHTEST_H_
2 #define MSP_GL_DEPTHTEST_H_
3
4 #include <msp/datafile/objectloader.h>
5 #include "predicate.h"
6
7 namespace Msp {
8 namespace GL {
9
10 /**
11 Tests incoming fragment depth values against the depth buffer.  If the test
12 fails, the fragment is discarded.
13 */
14 struct DepthTest
15 {
16         class Loader: public DataFile::ObjectLoader<DepthTest>
17         {
18         public:
19                 Loader(DepthTest &);
20
21         private:
22                 void compare(Predicate);
23         };
24
25         bool enabled = false;
26         Predicate compare = LESS;
27         bool write = true;
28
29         DepthTest() = default;
30         DepthTest(Predicate, bool = true);
31
32         bool operator==(const DepthTest &) const;
33         bool operator!=(const DepthTest &d) const { return !operator==(d); }
34 };
35
36 inline bool DepthTest::operator==(const DepthTest &other) const
37 {
38         return enabled==other.enabled && compare==other.compare && write==other.write;
39 }
40
41 } // namespace GL
42 } // namespace Msp
43
44 #endif