diff options
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl b/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl new file mode 100644 index 00000000000..ebda79558c7 --- /dev/null +++ b/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl @@ -0,0 +1,38 @@ + +#if __VERSION__ == 120 + varying vec4 radii; + varying vec4 finalColor; + varying vec4 finalOutlineColor; + #define fragColor gl_FragColor +#else + in vec4 radii; + in vec4 finalColor; + in vec4 finalOutlineColor; + out vec4 fragColor; +#endif + +void main() { + vec2 quad = abs(gl_PointCoord - vec2(0.5)); + float dist = quad.x + quad.y; + +// transparent outside of point +// --- 0 --- +// smooth transition +// --- 1 --- +// pure outline color +// --- 2 --- +// smooth transition +// --- 3 --- +// pure point color +// ... +// dist = 0 at center of point + + float mid_stroke = 0.5 * (radii[1] + radii[2]); + + vec4 backgroundColor = vec4(finalOutlineColor.rgb, 0.0); + + if (dist > mid_stroke) + fragColor = mix(finalOutlineColor, backgroundColor, smoothstep(radii[1], radii[0], dist)); + else + fragColor = mix(finalColor, finalOutlineColor, smoothstep(radii[3], radii[2], dist)); +} |