From 443c5aefca26cf0d0b2df8050aae6ce72f8f075d Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog Date: Sun, 15 Feb 2026 11:07:23 -0600 Subject: shaders: Delete incomplete demos --- shaders/polygon.glsl | 59 ---------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 shaders/polygon.glsl (limited to 'shaders/polygon.glsl') diff --git a/shaders/polygon.glsl b/shaders/polygon.glsl deleted file mode 100644 index a213f13..0000000 --- a/shaders/polygon.glsl +++ /dev/null @@ -1,59 +0,0 @@ -#version 330 core - -// -------------------------------------------------------------------------------- -// Regular polygon shader -// -// ref: https://thndl.com/square-shaped-shaders.html -// ref: https://thebookofshaders.com/07/ -// -// SPDX-License-Identifier: 0BSD -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Uniforms -// -------------------------------------------------------------------------------- -uniform float u_time; -uniform vec2 u_res; -uniform int u_n; -uniform vec4 u_bg; -uniform vec4 u_fg; - -// -------------------------------------------------------------------------------- -// Vertex outputs -// -------------------------------------------------------------------------------- -in vec2 v_p; -in vec2 v_t; - -// -------------------------------------------------------------------------------- -// Fragment outputs -// -------------------------------------------------------------------------------- -out vec4 f_c; - -// -------------------------------------------------------------------------------- -// Entry point -// -------------------------------------------------------------------------------- - -#define PI 3.14159265359 - -void main() -{ - // Centered with square aspect ratio - vec2 st = gl_FragCoord.xy / u_res.xy; - float aspect = u_res.x / u_res.y; - if (aspect > 1.0f) { st.x = (st.x - 0.5f) * aspect + 0.5f; } - else { st.y = (st.y - 0.5f) / aspect + 0.5f; } - - // Remap [0, 1] to [-1, 1] - st = st * 2.0f - 1.0f; - - // Angle of pixel from center + rotation - float a = atan(st.y, st.x) + u_time * 0.2f; - - // Angle of each sector from center - float r = (PI * 2.0f) / float(u_n); - - // Polar polygon edge test. cos(theta) = dot product. - float d = cos(floor(0.5f + a / r) * r - a) * length(st); - - f_c = vec4(vec3(mix(u_bg, u_fg, 1.0f - step(0.5f, d))), 1.0f); -} -- cgit v1.2.3