diff --git a/pattern2.cpp b/pattern2.cpp index 48718bce..759ae49b 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1661,9 +1661,10 @@ EX namespace patterns { } case 'f': { color_t res; - for(int i=0; i<3; i++) { + for(int i=0; i<4; i++) { ld v = real(compute_map_function(c, 1+i, color_formula)); - if(v < 0) part(res, i) = 0; + if(i == 3) part(res, i) = (v > 0); + else if(v < 0) part(res, i) = 0; else if(v > 1) part(res, i) = 255; else part(res, i) = int(v * 255 + .5); } diff --git a/util.cpp b/util.cpp index bb1e5127..92938788 100644 --- a/util.cpp +++ b/util.cpp @@ -183,6 +183,13 @@ cld exp_parser::parse(int prio) { cld no = parsepar(); return real(cond) > 0 ? yes : no; } + else if(eat("wallif(")) { + cld val0 = parse(0); + if(next() != ',') {at = -1; return 0; } at++; + cld val1 = parsepar(); + if(real(extra_params["p"]) >= 3.5) return val0; + else return val1; + } else if(eat("rgb(")) { cld val0 = parse(0); if(next() != ',') {at = -1; return 0; } at++;