Add self-feedback system and water shader
Features: - Self-feedback rendering system for shaders with feedback loops - Automatic FBO/texture management for feedback - Metadata parser detects iChannel feedback configuration - Adaptive render loop (with/without feedback) - Water shader from Shadertoy (adapted and working) - Fixed variable initialization issues in shader code Technical details: - FBO creation/destruction on shader switch - Texture binding to iChannel0-3 based on metadata - Auto-resize feedback buffers on window resize - Cleanup on exit and shader switch Files: - src/main.cpp: Feedback system implementation - shaders/water.glsl: Water shader with fixes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Name: Water
|
||||
// Author: diatribes
|
||||
// Author: diatribes (FabriceNeyret2)
|
||||
#version 330 core
|
||||
precision highp float;
|
||||
|
||||
@@ -14,18 +14,22 @@ uniform float iTime;
|
||||
thanks!! :D
|
||||
|
||||
If it doesn't display correctly, change line 17 "r/r" to "vec3(1)"
|
||||
|
||||
*/
|
||||
|
||||
void mainImage( out vec4 o, vec2 u ) {
|
||||
float s=.002,i,n;
|
||||
float s=.002, i=0., n; // FIXED: Initialize i=0
|
||||
vec3 r = vec3(iResolution.xy, iResolution.x/iResolution.y);
|
||||
vec3 p = vec3(0);
|
||||
u = (u-r.xy/2.)/r.y-.3;
|
||||
for(o *= i; i++ < 32. && s > .001;o += vec4(5,2,1,0)/max(length(u-.1), 0.001))
|
||||
for (p += vec3(u*s,s),s = 1. + p.y,
|
||||
n =.01; n < 1.;n+=n)
|
||||
|
||||
o = vec4(0); // FIXED: Initialize output to black
|
||||
|
||||
for(; i < 32. && s > .001; i++) {
|
||||
o += vec4(5,2,1,0)/max(length(u-.1), 0.001);
|
||||
for (p += vec3(u*s,s), s = 1. + p.y, n =.01; n < 1.; n+=n) {
|
||||
s += abs(dot(sin(p.z+iTime+p / n), vec3(1))) * n*.1;
|
||||
}
|
||||
}
|
||||
o = tanh(o/5e2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user