GUI: new osc renderer, part 34

to be continued...
This commit is contained in:
tildearrow 2024-02-24 18:01:15 -05:00
parent e133cc4d28
commit f9ba6809e9
2 changed files with 9 additions and 8 deletions

View file

@ -103,10 +103,10 @@ const char* sh_oscRender_srcF=
"uniform float uLineWidth;\n"
"uniform sampler2D oscVal;\n"
"varying vec2 fur_fragCoord;\n"
"const float oneStep=1.0/2048.0;\n"
"void main() {\n"
" float alpha=0.0;\n"
" float xMax=ceil(fur_fragCoord.x+uLineWidth);\n"
" float oneStep=1.0/2048.0;\n"
" float valmax=-1024.0;\n"
" float valmin=1024.0;\n"
" for (float x=floor(fur_fragCoord.x-uLineWidth); x<=xMax; x+=1.0) {\n"
@ -117,16 +117,17 @@ const char* sh_oscRender_srcF=
" if ((fur_fragCoord.y-uLineWidth)>valmax*uResolution.y) discard;\n"
" if ((fur_fragCoord.y+uLineWidth)<valmin*uResolution.y) discard;\n"
" float slope=abs(valmax-valmin)*uResolution.y;\n"
" float slopeDiv=min(1.0,1.0/ceil(slope));\n"
" float slopeMul=pow(2.0,ceil(log2(ceil(slope))));\n"
" float slopeDiv=min(1.0,1.0/slopeMul);\n"
" float xRight=ceil(fur_fragCoord.x+uLineWidth);\n"
" for (float x=max(0.0,floor(fur_fragCoord.x-uLineWidth)); x<=xRight; x+=slopeDiv) {\n"
" float val0=texture2D(oscVal,vec2(floor(x)*oneStep,1.0)).x*uResolution.y;\n"
" float val1=texture2D(oscVal,vec2(floor(x+1.0)*oneStep,1.0)).x*uResolution.y;\n"
" float val=mix(val0,val1,fract(x));\n"
" float val0=texture2D(oscVal,vec2(floor(x)*oneStep,1.0)).x;\n"
" float val1=texture2D(oscVal,vec2(floor(x+1.0)*oneStep,1.0)).x;\n"
" float val=mix(val0,val1,fract(x))*uResolution.y;\n"
" alpha+=clamp(uLineWidth-distance(vec2(fur_fragCoord.x,fur_fragCoord.y),vec2(x,val)),0.0,1.0);\n"
" }\n"
" if (slope>1.0) {\n"
" gl_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
" gl_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha*(1.0+uResolution.y*pow(slope/uResolution.y,2.0))/(uLineWidth*slopeMul),0.0,1.0));\n"
" } else {\n"
" gl_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
" }\n"
@ -189,7 +190,7 @@ const char* sh_oscRender_srcF=
" alpha+=max(uLineWidth-distance(vec2(fur_fragCoord.x,fur_fragCoord.y),vec2(x,val)),0.0);\n"
" }\n"
" if (slope>1.0) {\n"
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/(uLineWidth*(uLineWidth*2.0+log2(slopeMul))),0.0,1.0));\n"
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha*(1.0+uResolution.y*pow(slope/uResolution.y,2.0))/(uLineWidth*slopeMul),0.0,1.0));\n"
" } else {\n"
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
" }\n"

View file

@ -3827,7 +3827,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.chanOscThreads=conf.getInt("chanOscThreads",0);
settings.renderPoolThreads=conf.getInt("renderPoolThreads",0);
settings.shaderOsc=conf.getInt("shaderOsc",1);
settings.shaderOsc=conf.getInt("shaderOsc",0);
settings.showPool=conf.getInt("showPool",0);
settings.writeInsNames=conf.getInt("writeInsNames",0);
settings.readInsNames=conf.getInt("readInsNames",1);