Several visual tweaks to node links to make them overall fit in better with the look of the node editor: - Change the link thickness with the zoom level to a certain degree. - Remove the fuzziness of the node link and its shadow/outline. - The link outline color can now be made transparent. - Add circles at the end of dragged links when connecting to sockets. - Improve the banding of the color interpolation along the link. - Adjust the spacing of dashes along straight node links. Reviewed By: Pablo Vazquez, Hans Goudey Differential Revision: http://developer.blender.org/D15036
31 lines
967 B
GLSL
31 lines
967 B
GLSL
|
|
#define DASH_WIDTH 10.0
|
|
#define ANTIALIAS 1.0
|
|
#define MINIMUM_ALPHA 0.5
|
|
|
|
void main()
|
|
{
|
|
fragColor = finalColor;
|
|
|
|
if ((isMainLine != 0) && (dashFactor < 1.0)) {
|
|
float distance_along_line = lineLength * lineU;
|
|
float normalized_distance = fract(distance_along_line / DASH_WIDTH);
|
|
|
|
/* Checking if `normalized_distance <= dashFactor` is already enough for a basic
|
|
* dash, however we want to handle a nice antialias. */
|
|
|
|
float dash_center = DASH_WIDTH * dashFactor * 0.5;
|
|
float normalized_distance_triangle =
|
|
1.0 - abs((fract((distance_along_line - dash_center) / DASH_WIDTH)) * 2.0 - 1.0);
|
|
float t = ANTIALIAS / DASH_WIDTH;
|
|
float slope = 1.0 / (2.0 * t);
|
|
|
|
float unclamped_alpha = 1.0 - slope * (normalized_distance_triangle - dashFactor + t);
|
|
float alpha = max(dashAlpha, min(unclamped_alpha, 1.0));
|
|
|
|
fragColor.a *= alpha;
|
|
}
|
|
|
|
fragColor.a *= smoothstep(lineThickness, lineThickness - 0.6, abs(colorGradient));
|
|
}
|