X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fstenciltest.h;fp=source%2Fcore%2Fstenciltest.h;h=cdc613886e4e3adc9002d99f787340e093e50e12;hb=2b2676392aff2eb6b38c3e463cc67f4d67a4ef8b;hp=0000000000000000000000000000000000000000;hpb=669e9bfc18d2f5e28a9c715e1a69b7637a2d9c8b;p=libs%2Fgl.git diff --git a/source/core/stenciltest.h b/source/core/stenciltest.h new file mode 100644 index 00000000..cdc61388 --- /dev/null +++ b/source/core/stenciltest.h @@ -0,0 +1,58 @@ +#ifndef MSP_GL_STENCILTEST_H_ +#define MSP_GL_STENCILTEST_H_ + +#include +#include +#include "predicate.h" + +namespace Msp { +namespace GL { + +enum StencilOp +{ + KEEP, + SET_ZERO, + REPLACE, + INCR, + DECR, + INVERT, + INCR_WRAP, + DECR_WRAP +}; + +/** +Tests values in the stencil buffer against a reference. If the test fails, the +incoming fragment is discarded. The stencil buffer may be modified according +to results of the stencil test and the depth test. +*/ +struct StencilTest +{ + class Loader: public DataFile::ObjectLoader + { + public: + Loader(StencilTest &); + + private: + void compare(Predicate); + void actions(StencilOp, StencilOp, StencilOp); + }; + + bool enabled; + Predicate compare; + StencilOp stencil_fail_op; + StencilOp depth_fail_op; + StencilOp depth_pass_op; + unsigned reference; + + StencilTest(); +}; + +GLenum get_gl_stencil_op(StencilOp); + +void operator>>(const LexicalConverter &, StencilOp &); +void operator<<(LexicalConverter &, StencilOp); + +} // namespace GL +} // namespace Msp + +#endif