1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

rv:: sunflower:: new options for colors, overlay, and yshift

This commit is contained in:
Zeno Rogue 2022-03-27 09:10:15 +02:00
parent 998af473ca
commit d92f7f6765

View File

@ -33,6 +33,8 @@ ld qty = 100;
ld density = 1, zdensity; ld density = 1, zdensity;
ld range; ld range;
ld yshift;
ld distance_per_rug; ld distance_per_rug;
bool adjust_rug; bool adjust_rug;
@ -48,8 +50,10 @@ ld qfrac;
bool outward = false; bool outward = false;
ld step_angle = M_PI * (3 - sqrt(5));
hyperpoint p(int i) { hyperpoint p(int i) {
ld step = M_PI * (3 - sqrt(5)); ld step = step_angle;
return spin((outward ? i : i-iqty) * step) * xpush(sphere ? (acos(1 - (i+.5+qfrac) * density)) : euclid ? sqrt((i+.5+qfrac) * density) : acosh(1 + (i+.5+qfrac) * density)) * C0; return spin((outward ? i : i-iqty) * step) * xpush(sphere ? (acos(1 - (i+.5+qfrac) * density)) : euclid ? sqrt((i+.5+qfrac) * density) : acosh(1 + (i+.5+qfrac) * density)) * C0;
} }
@ -57,6 +61,12 @@ vector<int> inext, inext2;
vector<int> fibs = {1, 2}; vector<int> fibs = {1, 2};
color_t sunflower1 = 0xC04000FF;
color_t sunflower2 = 0xFFD500FF;
color_t sunflower3 = 0x000000FF;
bool overlay = false;
bool sunflower_cell(cell *c, shiftmatrix V) { bool sunflower_cell(cell *c, shiftmatrix V) {
density = zdensity / 100; density = zdensity / 100;
@ -120,25 +130,26 @@ bool sunflower_cell(cell *c, shiftmatrix V) {
inext2[i] = bj; inext2[i] = bj;
} }
for(int i=0; i<iqty; i++) { if(sunflower1 || sunflower2 || sunflower3) for(int i=0; i<iqty; i++) {
if(inext[inext[i]] == inext2[i] || inext2[inext[i]] == inext2[i] || inext[inext2[i]] == inext[i] || inext2[inext2[i]] == inext[i]) { if(inext[inext[i]] == inext2[i] || inext2[inext[i]] == inext2[i] || inext[inext2[i]] == inext[i] || inext2[inext2[i]] == inext[i]) {
curvepoint(ps[i]); curvepoint(ps[i]);
curvepoint(ps[inext[i]]);
curvepoint(ps[inext2[i]]); curvepoint(ps[inext2[i]]);
curvepoint(ps[inext[i]]);
// queuecurve(0xFFFFFFFF, 0x00C000FF, PPR::LINE); // queuecurve(0xFFFFFFFF, 0x00C000FF, PPR::LINE);
queuecurve(V, 0x000000FF, 0xC04000FF, PPR::LINE); queuecurve(V * ypush(yshift), sunflower3, sunflower1, PPR::LINE);
} }
else { else {
curvepoint(ps[i]); curvepoint(ps[i]);
curvepoint(ps[inext[i]]); curvepoint(ps[inext[i]]);
curvepoint(ps[inext[i] + inext2[i] - i]); curvepoint(ps[inext[i] + inext2[i] - i]);
curvepoint(ps[inext2[i]]); curvepoint(ps[inext2[i]]);
queuecurve(V,0x000000FF, 0xFFD500FF, PPR::LINE); queuecurve(V * ypush(yshift), sunflower3, sunflower2, PPR::LINE);
} }
if(nodes) queuepolyat(V * rgpushxto0(ps[i]), cgi.shSnowball, 0xFF, PPR::SUPERLINE); if(nodes) queuepolyat(V * ypush(yshift) * rgpushxto0(ps[i]), cgi.shSnowball, 0xFF, PPR::SUPERLINE);
} }
} }
return true;
return !overlay;
} }
void insert_param() { void insert_param() {
@ -146,6 +157,7 @@ void insert_param() {
param_f(qty, "sunq"); param_f(qty, "sunq");
param_f(range, "sunr"); param_f(range, "sunr");
param_f(distance_per_rug, "sunf"); param_f(distance_per_rug, "sunf");
param_f(yshift, "sunyshift");
} }
void show(); void show();
@ -196,6 +208,16 @@ int readArgs() {
adjust_rug = true; adjust_rug = true;
shift_arg_formula(distance_per_rug); shift_arg_formula(distance_per_rug);
} }
else if(argis("-sunflower-colors")) {
PHASEFROM(2);
shift(); sunflower1 = argcolor(32);
shift(); sunflower2 = argcolor(32);
shift(); sunflower3 = argcolor(32);
}
else if(argis("-sunflower-overlay")) {
PHASEFROM(2);
shift(); overlay = argi();
}
else return 1; else return 1;
return 0; return 0;
} }