GUI: new osc renderer, part 22
or just use highp to-do: rewrite using fixed point math?
This commit is contained in:
parent
cfee9b3810
commit
d046713be4
|
@ -606,7 +606,7 @@ void FurnaceGUI::drawChanOsc() {
|
|||
ImGui::ItemSize(size,style.FramePadding.y);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID("chOscDisplay"))) {
|
||||
if (!e->isRunning()) {
|
||||
if (settings.shaderOsc) {
|
||||
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||
memset(fft->oscTex,0,2048*sizeof(float));
|
||||
} else {
|
||||
for (unsigned short j=0; j<precision; j++) {
|
||||
|
@ -631,7 +631,7 @@ void FurnaceGUI::drawChanOsc() {
|
|||
}
|
||||
if (maxavg>0.0000001) maxavg=0.5/maxavg;
|
||||
|
||||
if (settings.shaderOsc) {
|
||||
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||
for (unsigned short j=0; j<precision && j<2048; j++) {
|
||||
float y;
|
||||
if (j>=precision/2) {
|
||||
|
@ -680,7 +680,7 @@ void FurnaceGUI::drawChanOsc() {
|
|||
}
|
||||
dcOff=(minLevel+maxLevel)*0.5f;
|
||||
|
||||
if (settings.shaderOsc) {
|
||||
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||
for (unsigned short j=0; j<precision; j++) {
|
||||
float y=(float)buf->data[(unsigned short)(fft->needle+(j*displaySize/precision))]/32768.0f;
|
||||
y-=dcOff;
|
||||
|
|
|
@ -583,6 +583,10 @@ void FurnaceGUI::drawMobileControls() {
|
|||
if (ImGui::Button("XYOsc")) {
|
||||
xyOscOpen=!xyOscOpen;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Meter")) {
|
||||
volMeterOpen=!volMeterOpen;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
|
|
@ -4629,6 +4629,7 @@ bool FurnaceGUI::loop() {
|
|||
MEASURE(osc,drawOsc());
|
||||
MEASURE(chanOsc,drawChanOsc());
|
||||
MEASURE(xyOsc,drawXYOsc());
|
||||
MEASURE(volMeter,drawVolMeter());
|
||||
MEASURE(grooves,drawGrooves());
|
||||
MEASURE(regView,drawRegView());
|
||||
} else {
|
||||
|
|
|
@ -307,7 +307,7 @@ void FurnaceGUI::drawOsc() {
|
|||
} else {
|
||||
for (int i=0; i<oscWidth-24; i++) {
|
||||
float x=(float)i/(float)(oscWidth-24);
|
||||
float y=oscValuesAverage[i+12]*oscZoom;
|
||||
float y=oscValuesAverage[i+12];
|
||||
if (!settings.oscEscapesBoundary) {
|
||||
if (y<-0.5f) y=-0.5f;
|
||||
if (y>0.5f) y=0.5f;
|
||||
|
|
|
@ -95,6 +95,7 @@ const char* sh_oscRender_srcV=
|
|||
|
||||
// thank you akumanatt
|
||||
const char* sh_oscRender_srcF=
|
||||
"precision highp float;\n"
|
||||
"uniform vec4 uColor;\n"
|
||||
"uniform vec2 uResolution;\n"
|
||||
"uniform float uLineWidth;\n"
|
||||
|
@ -116,8 +117,7 @@ const char* sh_oscRender_srcF=
|
|||
" float slope=abs(valmax-valmin)*uResolution.y*0.5;\n"
|
||||
" float slopeDiv=min(uAdvance,(uAdvance/slope));\n"
|
||||
" float xRight=uv.x+((uLineWidth)/uResolution.x);\n"
|
||||
" for (float s=0.0; s<max(1,slope); s+=1.0) {\n"
|
||||
" float x=max(0.0,uv.x-(uLineWidth/uResolution.x)+s*slopeDiv);\n"
|
||||
" for (float x=max(0.0,uv.x-(uLineWidth/uResolution.x)); x<=xRight; x+=slopeDiv) {\n"
|
||||
" float val=texture2D(oscVal,vec2(x,1.0)).x*uResolution.y*0.5;\n"
|
||||
" alpha+=clamp(uLineWidth-distance(vec2(fur_fragCoord.x,fur_fragCoord.y),vec2(x*uResolution.x,val)),0.0,1.0);\n"
|
||||
" }\n"
|
||||
|
|
Loading…
Reference in a new issue