diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-06-02 22:08:05 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-06-02 22:08:05 +0300 |
commit | c15e913df87af34b381922b2a6951e9bc2baef6c (patch) | |
tree | eb170876f4d90322eae3cdf5c41541a3121ea939 /source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl | |
parent | 7f47f187c18626456a31e2f8d6fd1ee8b9bfd011 (diff) |
Cleanup: DRW: Added overlay_ prefix to all *.glsl files in overlay/shaders
This is needed to avoid potential naming collision with other engines
Diffstat (limited to 'source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl')
-rw-r--r-- | source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl new file mode 100644 index 00000000000..5027525b9b3 --- /dev/null +++ b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl @@ -0,0 +1,47 @@ + +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) + +#define pointSize mpathPointSettings.x +#define frameCurrent mpathPointSettings.y +#define cacheStart mpathPointSettings.z +#define stepSize mpathPointSettings.w + +void main() +{ + gl_Position = ViewProjectionMatrix * vec4(pos, 1.0); + gl_PointSize = float(pointSize + 2); + + int frame = gl_VertexID + cacheStart; + bool use_custom_color = customColor.x >= 0.0; + finalColor = (use_custom_color) ? vec4(customColor, 1.0) : vec4(1.0); + + /* Bias to reduce z fighting with the path */ + gl_Position.z -= 1e-4; + + if (gl_VertexID % stepSize == 0) { + gl_PointSize = float(pointSize) + 4; + } + + if (showKeyFrames) { + if ((flag & MOTIONPATH_VERT_KEY) != 0) { + gl_PointSize = float(pointSize + 5); + finalColor = colorVertexSelect; + /* Bias more to get these on top of regular points */ + gl_Position.z -= 1e-4; + } + /* Draw big green dot where the current frame is. + * NOTE: this is only done when keyframes are shown, since this adds similar types of clutter + */ + if (frame == frameCurrent) { + gl_PointSize = float(pointSize + 8); + finalColor = colorCurrentFrame; + /* Bias more to get these on top of keyframes */ + gl_Position.z -= 1e-4; + } + } + + gl_PointSize *= sizePixel; + + view_clipping_distances(pos); +} |