2 #include <msp/strings/format.h>
3 #include "stenciltest.h"
10 StencilTest::Loader::Loader(StencilTest &st):
11 ObjectLoader<StencilTest>(st)
13 add("compare", &Loader::compare);
14 add("actions", &Loader::actions);
15 add("reference", &StencilTest::reference);
18 void StencilTest::Loader::compare(Predicate c)
24 void StencilTest::Loader::actions(StencilOp sf, StencilOp df, StencilOp dp)
26 obj.stencil_fail_op = sf;
27 obj.depth_fail_op = df;
28 obj.depth_pass_op = dp;
32 void operator>>(const LexicalConverter &conv, StencilOp &op)
34 const string &str = conv.get();
37 else if(str=="SET_ZERO")
39 else if(str=="REPLACE")
41 else if(str=="INCR_CLAMP")
43 else if(str=="DECR_CLAMP")
45 else if(str=="INVERT")
47 else if(str=="INCR_WRAP")
49 else if(str=="DECR_WRAP")
52 throw lexical_error(format("conversion of '%s' to StencilOp", str));
55 void operator<<(LexicalConverter &conv, StencilOp op)
59 case KEEP: conv.result("KEEP"); break;
60 case SET_ZERO: conv.result("SET_ZERO"); break;
61 case REPLACE: conv.result("REPLACE"); break;
62 case INCR_CLAMP: conv.result("INCR_CLAMP"); break;
63 case DECR_CLAMP: conv.result("DECR_CLAMP"); break;
64 case INVERT: conv.result("INVERT"); break;
65 case INCR_WRAP: conv.result("INCR_WRAP"); break;
66 case DECR_WRAP: conv.result("DECR_WRAP"); break;
67 default: conv.result(format("StencilOp(%#x)", static_cast<int>(op)));