Skip to content

Commit

Permalink
reduce line start/end extrusion
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Feb 10, 2024
1 parent 1ce17d4 commit b572844
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
4 changes: 2 additions & 2 deletions GLMakie/assets/shader/lines.geom
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,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] ? AA_RADIUS : (adjustment[0] == 0.0 ? 1e12 : abs(extrusion[0][0])),
!isvalid[3] ? AA_RADIUS : (adjustment[1] == 0.0 ? 1e12 : abs(extrusion[1][0]))
!isvalid[0] ? min(AA_RADIUS, halfwidth) : (adjustment[0] == 0.0 ? 1e12 : abs(extrusion[0][0])),
!isvalid[3] ? min(AA_RADIUS, halfwidth) : (adjustment[1] == 0.0 ? 1e12 : abs(extrusion[1][0]))
);

// used to compute width sdf
Expand Down
16 changes: 2 additions & 14 deletions WGLMakie/src/Lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
// if joint skipped elongate to new length
// if joint elongate a lot to let discard/truncation handle joint
f_extrusion = vec2(
!isvalid[0] ? AA_RADIUS : (adjustment[0] == 0.0 ? 1e12 : abs(extrusion[0][0])),
!isvalid[3] ? AA_RADIUS : (adjustment[1] == 0.0 ? 1e12 : abs(extrusion[1][0]))
!isvalid[0] ? min(AA_RADIUS, halfwidth) : (adjustment[0] == 0.0 ? 1e12 : abs(extrusion[0][0])),
!isvalid[3] ? min(AA_RADIUS, halfwidth) : (adjustment[1] == 0.0 ? 1e12 : abs(extrusion[1][0]))
);
// used to compute width sdf
Expand Down Expand Up @@ -606,19 +606,7 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
vec3(position.y * (halfwidth + AA_THICKNESS) * n1, 0);
}
// Vertex position (padded for joint & anti-aliasing)
// float v_offset, n_offset;
// if (adjustment[int(is_end)] == 0.0) {
// v_offset = position.x * (0.5 * segment_length + abs(extrusion[int(is_end)]) + AA_THICKNESS);
// } else {
// v_offset = position.x * 0.5 * segment_length + adjustment[int(is_end)] * (
// max(abs(extrusion[int(is_end)]), halfwidth) +
// AA_THICKNESS
// );
// }
// n_offset = (halfwidth + AA_THICKNESS) * position.y;
vec3 point = vec3[2](p1, p2)[x] + offset;
// SDF's
Expand Down
16 changes: 2 additions & 14 deletions WGLMakie/src/wglmakie.bundled.js
Original file line number Diff line number Diff line change
Expand Up @@ -21842,8 +21842,8 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
// if joint skipped elongate to new length
// if joint elongate a lot to let discard/truncation handle joint
f_extrusion = vec2(
!isvalid[0] ? AA_RADIUS : (adjustment[0] == 0.0 ? 1e12 : abs(extrusion[0][0])),
!isvalid[3] ? AA_RADIUS : (adjustment[1] == 0.0 ? 1e12 : abs(extrusion[1][0]))
!isvalid[0] ? min(AA_RADIUS, halfwidth) : (adjustment[0] == 0.0 ? 1e12 : abs(extrusion[0][0])),
!isvalid[3] ? min(AA_RADIUS, halfwidth) : (adjustment[1] == 0.0 ? 1e12 : abs(extrusion[1][0]))
);

// used to compute width sdf
Expand Down Expand Up @@ -21884,19 +21884,7 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
vec3(position.y * (halfwidth + AA_THICKNESS) * n1, 0);
}


// Vertex position (padded for joint & anti-aliasing)
// float v_offset, n_offset;
// if (adjustment[int(is_end)] == 0.0) {
// v_offset = position.x * (0.5 * segment_length + abs(extrusion[int(is_end)]) + AA_THICKNESS);
// } else {
// v_offset = position.x * 0.5 * segment_length + adjustment[int(is_end)] * (
// max(abs(extrusion[int(is_end)]), halfwidth) +
// AA_THICKNESS
// );
// }
// n_offset = (halfwidth + AA_THICKNESS) * position.y;

vec3 point = vec3[2](p1, p2)[x] + offset;

// SDF's
Expand Down

0 comments on commit b572844

Please sign in to comment.