Skip to content

Commit

Permalink
remove line start/end elongation
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed May 30, 2024
1 parent c4f7d7b commit 7426948
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion GLMakie/assets/shader/line_segment.geom
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void main(void)
// Set invalid / ignored outputs
f_truncation = vec2(-1e12); // no truncated joint
f_pattern_overwrite = vec4(-1e12, 1.0, 1e12, 1.0); // no joints to overwrite
f_extrusion = vec2(0.5); // no joints needing extrusion
f_extrusion = vec2(0.0); // no joints needing extrusion
f_linepoints = vec4(-1e12);
f_miter_vecs = vec4(-1);

Expand Down
8 changes: 4 additions & 4 deletions GLMakie/assets/shader/lines.geom
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ void main(void)
// isvalid[1] and [2] are used to discern whether a line segment should be
// discarded. This should happen if either vertex is invalid or if one of
// the vertices is a loop target.
// A loop target is an extra vertex placed before/after the shared vertex to
// guide joint generation. Consider for example a closed triangle A B C A.
// A loop target is an extra vertex placed before/after the shared vertex to
// guide joint generation. Consider for example a closed triangle A B C A.
// To cleanly close the loop both A's need to create a joint as if we had
// c A B C A b, but without drawing the c-A and A-b segments. c and b would
// be loop targets, matching C and B in position, but only being valid in
Expand Down Expand Up @@ -417,8 +417,8 @@ void main(void)
// if joint skipped elongate to new length
// if normal joint elongate a lot to let discard/truncation handle joint
f_extrusion = vec2(
!isvalid[0] ? min(AA_RADIUS, halfwidth) : (adjustment[0] == 0.0 ? 1e12 : halfwidth * abs(extrusion[0][0])),
!isvalid[3] ? min(AA_RADIUS, halfwidth) : (adjustment[1] == 0.0 ? 1e12 : halfwidth * abs(extrusion[1][0]))
!isvalid[0] ? 0.0 : (adjustment[0] == 0.0 ? 1e12 : halfwidth * abs(extrusion[0][0])),
!isvalid[3] ? 0.0 : (adjustment[1] == 0.0 ? 1e12 : halfwidth * abs(extrusion[1][0]))
);

// used to compute width sdf
Expand Down
6 changes: 3 additions & 3 deletions WGLMakie/src/Lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,12 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
}
// Used to elongate sdf to include joints
// if start/end elongate slightly so that there is no AA gap in loops
// if start/end no elongation
// if joint skipped elongate to new length
// if normal joint elongate a lot to let shape/truncation handle joint
f_extrusion = vec2(
!isvalid[0] ? min(AA_RADIUS, halfwidth) : (adjustment[0] == 0.0 ? 1e12 : halfwidth * abs(extrusion[0])),
!isvalid[3] ? min(AA_RADIUS, halfwidth) : (adjustment[1] == 0.0 ? 1e12 : halfwidth * abs(extrusion[1]))
!isvalid[0] ? 0.0 : (adjustment[0] == 0.0 ? 1e12 : halfwidth * abs(extrusion[0])),
!isvalid[3] ? 0.0 : (adjustment[1] == 0.0 ? 1e12 : halfwidth * abs(extrusion[1]))
);
// used to compute width sdf
Expand Down
6 changes: 3 additions & 3 deletions WGLMakie/src/wglmakie.bundled.js
Original file line number Diff line number Diff line change
Expand Up @@ -21825,12 +21825,12 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
}

// Used to elongate sdf to include joints
// if start/end elongate slightly so that there is no AA gap in loops
// if start/end no elongation
// if joint skipped elongate to new length
// if normal joint elongate a lot to let shape/truncation handle joint
f_extrusion = vec2(
!isvalid[0] ? min(AA_RADIUS, halfwidth) : (adjustment[0] == 0.0 ? 1e12 : halfwidth * abs(extrusion[0])),
!isvalid[3] ? min(AA_RADIUS, halfwidth) : (adjustment[1] == 0.0 ? 1e12 : halfwidth * abs(extrusion[1]))
!isvalid[0] ? 0.0 : (adjustment[0] == 0.0 ? 1e12 : halfwidth * abs(extrusion[0])),
!isvalid[3] ? 0.0 : (adjustment[1] == 0.0 ? 1e12 : halfwidth * abs(extrusion[1]))
);

// used to compute width sdf
Expand Down

0 comments on commit 7426948

Please sign in to comment.