mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
precise_width for nicer long lines
This commit is contained in:
parent
ddc3666fb4
commit
a37457ead9
16
config.cpp
16
config.cpp
@ -296,6 +296,7 @@ EX void initConfig() {
|
||||
addsaver(vid.usingGL, "usingGL", true);
|
||||
addsaver(vid.antialias, "antialias", AA_NOGL | AA_FONT | (ISWEB ? AA_MULTI : AA_LINES) | AA_LINEWIDTH | AA_VERSION);
|
||||
addsaver(vid.linewidth, "linewidth", 1);
|
||||
addsaver(precise_width, "precisewidth", .5);
|
||||
addsaver(linepatterns::width, "pattern-linewidth", 1);
|
||||
addsaver(vid.scale, "scale", 1);
|
||||
addsaver(vid.xposition, "xposition", 0);
|
||||
@ -1115,7 +1116,20 @@ EX void showGraphConfig() {
|
||||
dialog::editNumber(vid.linewidth, 0, 10, 0.1, 1, XLAT("line width"), "");
|
||||
dialog::extra_options = [] () {
|
||||
dialog::addBoolItem("finer lines at the boundary", vid.antialias & AA_LINEWIDTH, 'O');
|
||||
dialog::add_action([] () { vid.antialias ^= AA_LINEWIDTH; });
|
||||
dialog::add_action([] () {
|
||||
vid.antialias ^= AA_LINEWIDTH;
|
||||
});
|
||||
|
||||
if(vid.antialias & AA_LINEWIDTH) {
|
||||
dialog::addSelItem("variable width", fts(precise_width), 'M');
|
||||
dialog::add_action([] () {
|
||||
popScreen();
|
||||
dialog::editNumber(precise_width, 0, 2, 0.1, 0.5,
|
||||
XLAT("variable width"), XLAT("lines longer than this value will be split into shorter lines, with width computed separately for each of them.")
|
||||
);
|
||||
});
|
||||
}
|
||||
else dialog::addBreak(100);
|
||||
|
||||
dialog::addBoolItem("standard graphics", neon_mode == 0, 'A');
|
||||
dialog::add_action([] { neon_mode = 0; });
|
||||
|
13
graph.cpp
13
graph.cpp
@ -3588,9 +3588,18 @@ bool celldrawer::cell_clipped() {
|
||||
return false;
|
||||
}
|
||||
|
||||
EX ld precise_width = .5;
|
||||
|
||||
EX void gridline(const transmatrix& V1, const hyperpoint h1, const transmatrix& V2, const hyperpoint h2, color_t col, int prec) {
|
||||
ld d = hdist(h1, h2);
|
||||
while(d > .5 && d < 100) d /= 2, prec++;
|
||||
ld d = hdist(V1*h1, V2*h2);
|
||||
println(hlog, "d = ", d);
|
||||
while(d > precise_width && d < 100) {
|
||||
if(!eqmatrix(V1, V2, 1e-6)) { gridline(V1, h1, V1, inverse(V1) * V2 * h2, col, prec); return; }
|
||||
hyperpoint h = midz(h1, h2);
|
||||
gridline(V1, h1, V1, h, col, prec);
|
||||
gridline(V1, h, V1, h2, col, prec);
|
||||
return;
|
||||
}
|
||||
#if MAXMDIM >= 4
|
||||
if(WDIM == 2 && GDIM == 3) {
|
||||
ld eps = cgi.human_height/100;
|
||||
|
Loading…
Reference in New Issue
Block a user