Files
Pixelplanet--Pixel-VR-Player/shaders/thumb.frag
T
Pixelplanet 237c288c78 feat(ui): glassmorphic shaders, visible thumb priority, header up nav & visual controls
- Added top-to-bottom luminance gradient and specular border catchlight in ui.frag
- Added vignette scrims in thumb.frag for format badge and duration readability
- Implemented visible card high-priority thumbnail extraction via std::deque
- Added Top-Bottom (Over-Under) 3D thumbnail aspect cropping
- Added dedicated header [ ^ Up ] button for instant parent folder navigation
- Formatted segmented breadcrumbs and added right-edge vertical scrollbar
- Added physical folder tab visual cues to directory cards
- Implemented graphical toggle switches and color swatches in Settings view
- Added spatial micro-haptic ticks on laser pointer hover transitions
2026-10-25 09:45:10 +01:00

40 lines
1.3 KiB
GLSL

#version 450
layout(binding = 0) uniform sampler2D thumbTex;
layout(push_constant) uniform Push {
mat4 mvp;
vec4 color;
vec4 rect; // x, y (bottom-left), w, h in panel-local units
vec4 uv; // u0, v0, u1, v1
} pc;
layout(location = 0) in vec2 vUV;
layout(location = 0) out vec4 outColor;
void main() {
vec4 col = texture(thumbTex, vUV);
// Exact metric rounded rectangle SDF matching panel styling with screen-space AA
vec2 p = abs(vUV - 0.5) * pc.rect.zw;
vec2 b = 0.5 * pc.rect.zw - vec2(0.018);
vec2 q = max(p - b, 0.0);
float dist = length(q) - 0.018;
vec2 dpx = dFdx(p);
vec2 dpy = dFdy(p);
float pixSize = 0.70710678 * sqrt(dot(dpx, dpx) + dot(dpy, dpy));
float aa = max(pixSize * 1.4, 0.001);
float alpha = 1.0 - smoothstep(-aa, aa, dist);
if (alpha <= 0.002) {
discard;
}
// Thumbnail pixels are sRGB; convert to linear for the VK_FORMAT_*_SRGB framebuffer
vec3 linRgb = pow(max(col.rgb, vec3(0.0)), vec3(2.2));
// Top scrim (for format badges) and bottom scrim (for duration / title pills)
float topScrim = mix(0.68, 1.0, smoothstep(0.0, 0.26, vUV.y));
float botScrim = mix(0.58, 1.0, smoothstep(1.0, 0.70, vUV.y));
linRgb *= (topScrim * botScrim);
outColor = vec4(linRgb * pc.color.rgb, col.a * pc.color.a * alpha);
}