1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-03 23:14:07 +00:00

rogueviz:: improved line quality

This commit is contained in:
Zeno Rogue 2021-09-30 11:42:02 +02:00
parent 89696a8e2c
commit af00aaac2d

View File

@ -459,21 +459,22 @@ void storevertex(vector<glvertex>& tab, const hyperpoint& h) {
tab.push_back(glhr::pointtogl(h)); tab.push_back(glhr::pointtogl(h));
} }
double linequality = .1; double min_line_step = .1;
double min_line_splits = 0;
void storelineto(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) { void storelineto(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2, int s) {
if(intval(h1, h2) < linequality) if(intval(h1, h2) < min_line_step && s >= min_line_splits)
storevertex(tab, h2); storevertex(tab, h2);
else { else {
hyperpoint h3 = mid(h1, h2); hyperpoint h3 = mid(h1, h2);
storelineto(tab, h1, h3); storelineto(tab, h1, h3, s+1);
storelineto(tab, h3, h2); storelineto(tab, h3, h2, s+1);
} }
} }
void storeline(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) { void storeline(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) {
storevertex(tab, h1); storevertex(tab, h1);
storelineto(tab, h1, h2); storelineto(tab, h1, h2, 0);
} }
color_t darken_a(color_t c) { color_t darken_a(color_t c) {
@ -1029,7 +1030,7 @@ int readArgs() {
patterns::whichShape = '8'; patterns::whichShape = '8';
} }
else if(argis("-lq")) { else if(argis("-lq")) {
shift_arg_formula(linequality); shift_arg_formula(min_line_step);
} }
else if(argis("-nolegend")) { else if(argis("-nolegend")) {
legend.clear(); legend.clear();