mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-29 13:07:40 +00:00
pattern formula:: wallif function
This commit is contained in:
@@ -1661,9 +1661,10 @@ EX namespace patterns {
|
|||||||
}
|
}
|
||||||
case 'f': {
|
case 'f': {
|
||||||
color_t res;
|
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));
|
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 if(v > 1) part(res, i) = 255;
|
||||||
else part(res, i) = int(v * 255 + .5);
|
else part(res, i) = int(v * 255 + .5);
|
||||||
}
|
}
|
||||||
|
|||||||
7
util.cpp
7
util.cpp
@@ -183,6 +183,13 @@ cld exp_parser::parse(int prio) {
|
|||||||
cld no = parsepar();
|
cld no = parsepar();
|
||||||
return real(cond) > 0 ? yes : no;
|
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(")) {
|
else if(eat("rgb(")) {
|
||||||
cld val0 = parse(0);
|
cld val0 = parse(0);
|
||||||
if(next() != ',') {at = -1; return 0; } at++;
|
if(next() != ',') {at = -1; return 0; } at++;
|
||||||
|
|||||||
Reference in New Issue
Block a user