mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 14:33:01 +00:00
GUI: new osc renderer, part 8
only update waveform[] when using old code
This commit is contained in:
parent
9ed7364cff
commit
b9a6a83798
2 changed files with 14 additions and 12 deletions
|
@ -293,16 +293,6 @@ void FurnaceGUI::drawOsc() {
|
|||
|
||||
if ((oscWidth-24)>0) {
|
||||
if (settings.oscMono) {
|
||||
for (int i=0; i<oscWidth-24; i++) {
|
||||
float x=(float)i/(float)(oscWidth-24);
|
||||
float y=oscValuesAverage[i+12]*oscZoom;
|
||||
if (!settings.oscEscapesBoundary) {
|
||||
if (y<-0.5f) y=-0.5f;
|
||||
if (y>0.5f) y=0.5f;
|
||||
}
|
||||
waveform[i]=ImLerp(inRect.Min,inRect.Max,ImVec2(x,0.5f-y));
|
||||
}
|
||||
|
||||
if (rend->supportsDrawOsc()) {
|
||||
_do.gui=this;
|
||||
_do.data=&oscValuesAverage[12];
|
||||
|
@ -314,6 +304,16 @@ void FurnaceGUI::drawOsc() {
|
|||
dl->AddCallback(_drawOsc,&_do);
|
||||
dl->AddCallback(ImDrawCallback_ResetRenderState,NULL);
|
||||
} else {
|
||||
for (int i=0; i<oscWidth-24; i++) {
|
||||
float x=(float)i/(float)(oscWidth-24);
|
||||
float y=oscValuesAverage[i+12]*oscZoom;
|
||||
if (!settings.oscEscapesBoundary) {
|
||||
if (y<-0.5f) y=-0.5f;
|
||||
if (y>0.5f) y=0.5f;
|
||||
}
|
||||
waveform[i]=ImLerp(inRect.Min,inRect.Max,ImVec2(x,0.5f-y));
|
||||
}
|
||||
|
||||
if (settings.oscEscapesBoundary) {
|
||||
dl->PushClipRectFullScreen();
|
||||
dl->AddPolyline(waveform,oscWidth-24,color,ImDrawFlags_None,dpiScale);
|
||||
|
|
|
@ -104,12 +104,14 @@ const char* sh_oscRender_srcF=
|
|||
"void main() {\n"
|
||||
" vec2 uv = fur_fragCoord/uResolution;\n"
|
||||
" vec2 tresh = vec2(uLineWidth)/uResolution;\n"
|
||||
" float x1 = uv.x-uAdvance;\n"
|
||||
" float x2 = uv.x;\n"
|
||||
" float x3 = uv.x+uAdvance;\n"
|
||||
" float val1 = texture2D(oscVal,vec2(x2,1.0)).x;\n"
|
||||
" float val2 = texture2D(oscVal,vec2(x2,1.0)).x;\n"
|
||||
" float val3 = texture2D(oscVal,vec2(x3,1.0)).x;\n"
|
||||
" float valmax = max(val2,val3);\n"
|
||||
" float valmin = min(val2,val3);\n"
|
||||
" float valmax = max(max(val1,val2),val3);\n"
|
||||
" float valmin = min(min(val1,val2),val3);\n"
|
||||
" float vald = abs(valmax-valmin);\n"
|
||||
" float alpha = 1.0-abs(uv.y-val2)/max(tresh.y,vald);\n"
|
||||
" if (vald>(1.0/uResolution.y)) {\n"
|
||||
|
|
Loading…
Reference in a new issue