ScreenLockDetector/shaders/background.frag

39 lines
1003 B
GLSL
Raw Normal View History

#version 450
layout(location = 0) in vec4 fragColor;
layout(location = 1) in vec2 fragTexCoord;
layout(location = 2) in vec2 fragPosition;
layout(location = 0) out vec4 outColor;
layout(binding = 0) uniform UniformBufferObject {
float time;
vec2 resolution;
float rotation;
float wavePhase;
} ubo;
void main() {
// Normalize position to 0-1 range
vec2 uv = (fragPosition + 1.0) * 0.5;
// Create dynamic gradient based on time
float t = ubo.time / 360.0;
2025-11-10 21:29:00 +08:00
// Calculate color components matching Qt CustomWidget
float r = 0.392 + 0.196 * sin(t * 6.28318);
float g = 0.588 + 0.196 * sin(t * 6.28318 + 1.047);
float b = 0.784 + 0.216 * sin(t * 6.28318 + 2.094);
vec3 color1 = vec3(r, g, b);
2025-11-10 21:29:00 +08:00
vec3 color2 = vec3(0.118, 0.118, 0.235);
// Linear gradient from top-left to bottom-right
float gradient = uv.x * 0.5 + uv.y * 0.5;
// Mix colors
vec3 finalColor = mix(color1, color2, gradient);
outColor = vec4(finalColor, 1.0);
}