From 2eaddae6eee3b1054037e6c29ff67020af9233fa Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 26 Feb 2018 13:19:23 +0100 Subject: [PATCH] linewidth cleanup, SVG output should now work for spheres --- polygons.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/polygons.cpp b/polygons.cpp index 69357f94..4bb7b2ad 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -334,7 +334,7 @@ void gldraw(int useV, const transmatrix& V, const vector& v, int ps, i #endif double linewidthat(const hyperpoint& h, double minwidth) { - if(vid.antialias & AA_LINEWIDTH) { + if((vid.antialias & AA_LINEWIDTH) && hyperbolic) { double dz = h[2]; if(dz < 1 || abs(dz-stereo::scrdist) < 1e-6) return vid.linewidth; else { @@ -511,7 +511,7 @@ void drawpolyline(polytodraw& p) { } else poly_flags &=~ POLY_INVERSE; - if(sphereflipped()) { + if(spherespecial) { if(!hiliteclick && !(poly_flags & POLY_INFRONT)) return; } @@ -540,6 +540,7 @@ void drawpolyline(polytodraw& p) { if(pp.tinf && (poly_flags & POLY_INVERSE)) { return; } + glLineWidth(linewidthat(tC0(pp.V), pp.minwidth)); gldraw(3, Id, glcoords, 0, size(glcoords), p.col, pp.outline, poly_flags, pp.tinf); continue; } @@ -629,7 +630,7 @@ void prettyline(hyperpoint h1, hyperpoint h2, int col, int lev) { pp.tab = &prettylinepoints; pp.offset = 0; pp.cnt = size(prettylinepoints); - pp.minwidth = minwidth_global; + pp.minwidth = vid.linewidth; p.col = 0; pp.outline = col; pp.flags = POLY_ISSIDE; @@ -2558,8 +2559,8 @@ namespace svg { if(invisible(col) && invisible(outline)) return; if(polyi < 2) return; - double dfc = 0.8; - if(!pmodel && !euclid) { + double dfc; + if(!pmodel && hyperbolic) { int avgx = 0, avgy = 0; for(int i=0; i(dfc, 1) * minwidth; } + else dfc = .8 * minwidth; startstring(); for(int i=0; i", stylestr(col, outline, vid.radius*dfc/256)); + fprintf(f, "\" %s/>", stylestr(col, outline, (hyperbolic ? vid.radius : vid.scrsize) *dfc/256)); stopstring(); fprintf(f, "\n"); }