2 #include <msp/strings/format.h>
4 #include "stenciltest.h"
11 StencilTest::Loader::Loader(StencilTest &st):
12 ObjectLoader<StencilTest>(st)
14 add("compare", &Loader::compare);
15 add("actions", &Loader::actions);
16 add("reference", &StencilTest::reference);
19 void StencilTest::Loader::compare(Predicate c)
25 void StencilTest::Loader::actions(StencilOp sf, StencilOp df, StencilOp dp)
27 obj.stencil_fail_op = sf;
28 obj.depth_fail_op = df;
29 obj.depth_pass_op = dp;
33 void operator>>(const LexicalConverter &conv, StencilOp &op)
35 const string &str = conv.get();
38 else if(str=="SET_ZERO")
40 else if(str=="REPLACE")
46 else if(str=="INVERT")
48 else if(str=="INCR_WRAP")
50 else if(str=="DECR_WRAP")
53 throw lexical_error(format("conversion of '%s' to StencilOp", str));
56 void operator<<(LexicalConverter &conv, StencilOp op)
60 case KEEP: conv.result("KEEP"); break;
61 case SET_ZERO: conv.result("SET_ZERO"); break;
62 case REPLACE: conv.result("REPLACE"); break;
63 case INCR: conv.result("INCR"); break;
64 case DECR: conv.result("DECR"); break;
65 case INVERT: conv.result("INVERT"); break;
66 case INCR_WRAP: conv.result("INCR_WRAP"); break;
67 case DECR_WRAP: conv.result("DECR_WRAP"); break;
68 default: conv.result(format("StencilOp(%#x)", static_cast<int>(op)));