perfect linewidth option (sometimes does not work correctly -- need to check)

This commit is contained in:
Zeno Rogue 2020-07-03 15:35:22 +02:00
parent ad65ac4aa4
commit 02ebc8a96a
2 changed files with 9 additions and 1 deletions

View File

@ -306,6 +306,7 @@ EX void initConfig() {
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(perfect_linewidth, "perfect_linewidth", 1);
addsaver(linepatterns::width, "pattern-linewidth", 1);
addsaver(fat_edges, "fat-edges");
addsaver(pconf.scale, "scale", 1);
@ -1156,6 +1157,11 @@ EX void showGraphConfig() {
vid.antialias ^= AA_LINEWIDTH;
});
dialog::addBoolItem("perfect width", perfect_linewidth == 2, 'P');
if(perfect_linewidth == 1)
dialog::lastItem().value = XLAT("shots only");
dialog::add_action([] { perfect_linewidth = (1 + perfect_linewidth) % 3; });
if(vid.antialias & AA_LINEWIDTH) {
dialog::addSelItem("variable width", fts(precise_width), 'M');
dialog::add_action([] () {

View File

@ -719,6 +719,8 @@ EX ld scale_at(const transmatrix& T) {
return sqrt(hypot_d(2, h2-h1) * hypot_d(2, h3-h1) / .0001);
}
EX int perfect_linewidth = 1;
EX ld linewidthat(const hyperpoint& h) {
if(!(vid.antialias & AA_LINEWIDTH)) return 1;
else if(hyperbolic && pmodel == mdDisk && pconf.alpha == 1 && !ISWEB) {
@ -731,7 +733,7 @@ EX ld linewidthat(const hyperpoint& h) {
return dfc;
}
}
else if(svg::in || inHighQual) {
else if(perfect_linewidth >= (inHighQual ? 1 : 2)) {
hyperpoint h0 = h / zlevel(h);
transmatrix T = rgpushxto0(h0);
return scale_at(T);