pattern formula:: wallif function

This commit is contained in:
Zeno Rogue 2019-11-15 13:37:41 +01:00
parent be5dc871b6
commit 388ac890bf
2 changed files with 10 additions and 2 deletions

View File

@ -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);
}

View File

@ -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++;