2 #include <msp/strings/format.h>
4 #include "stenciltest.h"
11 StencilTest::StencilTest():
14 stencil_fail_op(KEEP),
21 StencilTest::Loader::Loader(StencilTest &st):
22 ObjectLoader<StencilTest>(st)
24 add("compare", &Loader::compare);
25 add("actions", &Loader::actions);
26 add("reference", &StencilTest::reference);
29 void StencilTest::Loader::compare(Predicate c)
35 void StencilTest::Loader::actions(StencilOp sf, StencilOp df, StencilOp dp)
37 obj.stencil_fail_op = sf;
38 obj.depth_fail_op = df;
39 obj.depth_pass_op = dp;
43 void operator>>(const LexicalConverter &conv, StencilOp &op)
45 const string &str = conv.get();
48 else if(str=="SET_ZERO")
50 else if(str=="REPLACE")
56 else if(str=="INVERT")
58 else if(str=="INCR_WRAP")
60 else if(str=="DECR_WRAP")
63 throw lexical_error(format("conversion of '%s' to StencilOp", str));
66 void operator<<(LexicalConverter &conv, StencilOp op)
70 case KEEP: conv.result("KEEP"); break;
71 case SET_ZERO: conv.result("SET_ZERO"); break;
72 case REPLACE: conv.result("REPLACE"); break;
73 case INCR: conv.result("INCR"); break;
74 case DECR: conv.result("DECR"); break;
75 case INVERT: conv.result("INVERT"); break;
76 case INCR_WRAP: conv.result("INCR_WRAP"); break;
77 case DECR_WRAP: conv.result("DECR_WRAP"); break;
78 default: conv.result(format("StencilOp(%#x)", static_cast<int>(op)));