This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl
Joshua Leung 440bce242d Keyframe Drawing: Fix 2.7 -> 2.8 regressions
* Outlines of keyframes were too thick and ugly

* Size differences between keyframe types was being swallowed
  by the pixel-fudge factor, leaving colour as the only distinguishing
  factor (bad!)
2017-08-03 01:25:55 +12:00

35 lines
817 B
GLSL

uniform mat4 ModelViewProjectionMatrix;
const float pixel_fudge = sqrt(2.0);
const float outline_width = 1.15 * pixel_fudge;
in vec2 pos;
in float size;
in vec4 color;
in vec4 outlineColor;
out vec4 finalColor;
out vec4 finalOutlineColor;
out vec4 radii;
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
// pass through unchanged
gl_PointSize = size + pixel_fudge; // 0.5 pixel_fudge on either side
finalColor = color;
finalOutlineColor = outlineColor;
// calculate concentric radii in pixels
float radius = 0.5 * gl_PointSize;
// start at the outside and progress toward the center
radii[0] = radius;
radii[1] = radius - pixel_fudge;
radii[2] = radius - outline_width;
radii[3] = radius - outline_width - pixel_fudge;
// convert to PointCoord units
radii /= size;
}