mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-22 12:35:11 +00:00
GUI: new osc renderer, part 6
port shader to OpenGL 3.0
This commit is contained in:
parent
e6a5e102fe
commit
c606ec8f3f
1 changed files with 14 additions and 12 deletions
|
@ -151,24 +151,26 @@ const char* sh_oscRender_srcF=
|
|||
"uniform vec4 uColor;\n"
|
||||
"uniform vec2 uResolution;\n"
|
||||
"uniform float uLineWidth;\n"
|
||||
"uniform sampler1D oscVal;\n"
|
||||
"uniform float uAdvance;\n"
|
||||
"uniform sampler2D oscVal;\n"
|
||||
"in vec2 fur_fragCoord;\n"
|
||||
"out vec4 fur_FragColor;\n"
|
||||
"void main() {\n"
|
||||
" vec2 uv = fur_fragCoord/uResolution.xy;\n"
|
||||
" vec2 tresh = vec2(uLineWidth)/uResolution.xy;\n"
|
||||
" float xoff = tresh.x/2.0;\n"
|
||||
" float x1 = uv.x-xoff;\n"
|
||||
" vec2 uv = fur_fragCoord/uResolution;\n"
|
||||
" vec2 tresh = vec2(uLineWidth)/uResolution;\n"
|
||||
" float x2 = uv.x;\n"
|
||||
" float x3 = uv.x+xoff;\n"
|
||||
" float val1 = texture(oscVal,vec2(x1,1.0)).x;\n"
|
||||
" float val2 = texture(oscVal,vec2(x2,1.0)).x;\n"
|
||||
" float val3 = texture(oscVal,vec2(x3,1.0)).x;\n"
|
||||
" float valmax = max(max(val1,val2),val3);\n"
|
||||
" float valmin = min(min(val1,val2),val3);\n"
|
||||
" float x3 = uv.x+uAdvance;\n"
|
||||
" float val2 = texture(oscVal,x2).x;\n"
|
||||
" float val3 = texture(oscVal,x3).x;\n"
|
||||
" float valmax = max(val2,val3);\n"
|
||||
" float valmin = min(val2,val3);\n"
|
||||
" float vald = abs(valmax-valmin);\n"
|
||||
" float alpha = 1.0-abs(uv.y-val2)/max(tresh.y,vald);\n"
|
||||
" fur_FragColor = vec4(uColor.xyz,uColor.w*alpha);\n"
|
||||
" if (vald>(1.0/uResolution.y)) {\n"
|
||||
" fur_FragColor = vec4(1.0,0.0,0.0,uColor.w*alpha);\n"
|
||||
" } else {\n"
|
||||
" fur_FragColor = vec4(uColor.xyz,uColor.w*alpha);\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue