Fix #137958: Overlay: Lines are too thick
Caused by b8f591c348.
The copy pasted code was not the same everywere.
Invert the result only for the grid shader as it
used to be.
This commit is contained in:
@@ -400,6 +400,7 @@ BLI_STATIC_ASSERT_ALIGN(BoneStickData, 16)
|
||||
*/
|
||||
#define M_1_SQRTPI 0.5641895835477563f /* `1/sqrt(pi)`. */
|
||||
#define DISC_RADIUS (M_1_SQRTPI * 1.05f)
|
||||
#define LINE_SMOOTH_START (0.5f + DISC_RADIUS)
|
||||
#define LINE_SMOOTH_END (0.5f - DISC_RADIUS)
|
||||
#define LINE_SMOOTH_START (0.5f - DISC_RADIUS)
|
||||
#define LINE_SMOOTH_END (0.5f + DISC_RADIUS)
|
||||
/* Returns 0 before LINE_SMOOTH_START and 1 after LINE_SMOOTH_END. */
|
||||
#define LINE_STEP(dist) smoothstep(LINE_SMOOTH_START, LINE_SMOOTH_END, dist)
|
||||
|
||||
@@ -26,7 +26,7 @@ float get_grid(float2 co, float2 fwidthCos, float2 grid_scale)
|
||||
grid_domain /= fwidthCos;
|
||||
/* Collapse waves. */
|
||||
float line_dist = min(grid_domain.x, grid_domain.y);
|
||||
return LINE_STEP(line_dist - grid_buf.line_size);
|
||||
return 1.0 - LINE_STEP(line_dist - grid_buf.line_size);
|
||||
}
|
||||
|
||||
float3 get_axes(float3 co, float3 fwidthCos, float line_size)
|
||||
@@ -35,7 +35,7 @@ float3 get_axes(float3 co, float3 fwidthCos, float line_size)
|
||||
/* Modulate by the absolute rate of change of the coordinates
|
||||
* (make line have the same width under perspective). */
|
||||
axes_domain /= fwidthCos;
|
||||
return LINE_STEP(axes_domain - (line_size + grid_buf.line_size));
|
||||
return 1.0 - LINE_STEP(axes_domain - (line_size + grid_buf.line_size));
|
||||
}
|
||||
|
||||
#define linearstep(p0, p1, v) (clamp(((v) - (p0)) / abs((p1) - (p0)), 0.0f, 1.0f))
|
||||
|
||||
Reference in New Issue
Block a user