add cell-span grid with resize handles, 3d water surface effect, and shader preset system with double-click popup menu

This commit is contained in:
Eric Smith 2026-05-20 16:18:33 -04:00
parent 7cfbf72ca5
commit 9cbb54cc39
3 changed files with 721 additions and 252 deletions

View file

@ -128,15 +128,31 @@ void fragment() {
// tiny sparkle
effect_rgb += 0.03 * vec3(sin(t * 3.0), cos(t * 2.0), noise_val * 0.1);
// --- 3D water surface ---
float d_surf = UV.y - fill_line; // positive = below surface
float d_abs = abs(d_surf);
// subsurface light scatter — brightest just below surface, fades with depth
float subsurface = exp(-d_surf * 25.0) * step(0.0, d_surf);
effect_rgb *= 1.0 + subsurface * 0.25;
// --- composite ---
vec3 col = bg_color.rgb;
col = mix(col, effect_rgb, liquid);
// surface foam line (wider glow + bright core)
float foam_glow = smoothstep(fill_line - 0.02, fill_line, UV.y) - smoothstep(fill_line, fill_line + 0.004, UV.y);
col += foam_glow * vec3(0.5, 0.65, 0.9) * 0.6 * liquid;
float foam_core = smoothstep(fill_line - 0.006, fill_line, UV.y) - smoothstep(fill_line, fill_line + 0.001, UV.y);
col += foam_core * vec3(0.7, 0.85, 1.0) * liquid;
// foam glow — smooth double-sided falloff (gaussian-like)
float foam_glow = exp(-d_abs * 70.0);
float foam_core = exp(-d_abs * 350.0);
vec3 foam_tint = vec3(0.6, 0.75, 0.95);
col += foam_glow * foam_tint * 0.5;
col += foam_core * vec3(0.75, 0.9, 1.0) * 0.6;
// wave-slope highlight — brightens at wave crests facing the viewer
float wave_slope = (cos(UV.x * wf + TIME * 5.0) * wf
+ cos(UV.x * wf * 1.7 + TIME * 7.0 + 1.3) * wf * 1.7 * 0.5
+ cos(UV.x * wf * 0.6 + TIME * 2.5 + 2.9) * wf * 0.6 * 0.3) * edge_damp / 1.8 * wave_amp;
float slope_highlight = max(0.0, wave_slope) * exp(-d_abs * 200.0);
col += slope_highlight * vec3(0.6, 0.8, 1.0) * 0.4;
// border
col = mix(col, border_color.rgb, outer - inner);