GUI: new osc renderer, part 19
now with a setting
This commit is contained in:
parent
c9b1305b61
commit
894b1f5a3c
|
|
@ -592,7 +592,7 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
ImGui::ItemSize(size,style.FramePadding.y);
|
ImGui::ItemSize(size,style.FramePadding.y);
|
||||||
if (ImGui::ItemAdd(rect,ImGui::GetID("chOscDisplay"))) {
|
if (ImGui::ItemAdd(rect,ImGui::GetID("chOscDisplay"))) {
|
||||||
if (!e->isRunning()) {
|
if (!e->isRunning()) {
|
||||||
if (newOscCode) {
|
if (settings.shaderOsc) {
|
||||||
memset(fft->oscTex,0,2048*sizeof(float));
|
memset(fft->oscTex,0,2048*sizeof(float));
|
||||||
} else {
|
} else {
|
||||||
for (unsigned short j=0; j<precision; j++) {
|
for (unsigned short j=0; j<precision; j++) {
|
||||||
|
|
@ -617,7 +617,7 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
}
|
}
|
||||||
if (maxavg>0.0000001) maxavg=0.5/maxavg;
|
if (maxavg>0.0000001) maxavg=0.5/maxavg;
|
||||||
|
|
||||||
if (newOscCode) {
|
if (settings.shaderOsc) {
|
||||||
for (unsigned short j=0; j<precision && j<2048; j++) {
|
for (unsigned short j=0; j<precision && j<2048; j++) {
|
||||||
float y;
|
float y;
|
||||||
if (j>=precision/2) {
|
if (j>=precision/2) {
|
||||||
|
|
@ -666,7 +666,7 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
}
|
}
|
||||||
dcOff=(minLevel+maxLevel)*0.5f;
|
dcOff=(minLevel+maxLevel)*0.5f;
|
||||||
|
|
||||||
if (newOscCode) {
|
if (settings.shaderOsc) {
|
||||||
for (unsigned short j=0; j<precision; j++) {
|
for (unsigned short j=0; j<precision; j++) {
|
||||||
float y=(float)buf->data[(unsigned short)(fft->needle+(j*displaySize/precision))]/32768.0f;
|
float y=(float)buf->data[(unsigned short)(fft->needle+(j*displaySize/precision))]/32768.0f;
|
||||||
y-=dcOff;
|
y-=dcOff;
|
||||||
|
|
@ -699,7 +699,7 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
color=chanOscGrad.get(xVal,1.0f-yVal);
|
color=chanOscGrad.get(xVal,1.0f-yVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rend->supportsDrawOsc() && newOscCode) {
|
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||||
fft->drawOp.gui=this;
|
fft->drawOp.gui=this;
|
||||||
fft->drawOp.data=fft->oscTex;
|
fft->drawOp.data=fft->oscTex;
|
||||||
fft->drawOp.len=precision;
|
fft->drawOp.len=precision;
|
||||||
|
|
|
||||||
|
|
@ -7298,7 +7298,6 @@ FurnaceGUI::FurnaceGUI():
|
||||||
safeMode(false),
|
safeMode(false),
|
||||||
midiWakeUp(true),
|
midiWakeUp(true),
|
||||||
makeDrumkitMode(false),
|
makeDrumkitMode(false),
|
||||||
newOscCode(true),
|
|
||||||
audioEngineChanged(false),
|
audioEngineChanged(false),
|
||||||
settingsChanged(false),
|
settingsChanged(false),
|
||||||
debugFFT(false),
|
debugFFT(false),
|
||||||
|
|
|
||||||
|
|
@ -1507,7 +1507,6 @@ class FurnaceGUI {
|
||||||
bool safeMode;
|
bool safeMode;
|
||||||
bool midiWakeUp;
|
bool midiWakeUp;
|
||||||
bool makeDrumkitMode;
|
bool makeDrumkitMode;
|
||||||
bool newOscCode;
|
|
||||||
bool audioEngineChanged, settingsChanged, debugFFT;
|
bool audioEngineChanged, settingsChanged, debugFFT;
|
||||||
bool willExport[DIV_MAX_CHIPS];
|
bool willExport[DIV_MAX_CHIPS];
|
||||||
int vgmExportVersion;
|
int vgmExportVersion;
|
||||||
|
|
@ -1776,6 +1775,7 @@ class FurnaceGUI {
|
||||||
int selectAssetOnLoad;
|
int selectAssetOnLoad;
|
||||||
int basicColors;
|
int basicColors;
|
||||||
int playbackTime;
|
int playbackTime;
|
||||||
|
int shaderOsc;
|
||||||
unsigned int maxUndoSteps;
|
unsigned int maxUndoSteps;
|
||||||
String mainFontPath;
|
String mainFontPath;
|
||||||
String headFontPath;
|
String headFontPath;
|
||||||
|
|
@ -1976,6 +1976,7 @@ class FurnaceGUI {
|
||||||
selectAssetOnLoad(1),
|
selectAssetOnLoad(1),
|
||||||
basicColors(1),
|
basicColors(1),
|
||||||
playbackTime(1),
|
playbackTime(1),
|
||||||
|
shaderOsc(1),
|
||||||
maxUndoSteps(100),
|
maxUndoSteps(100),
|
||||||
mainFontPath(""),
|
mainFontPath(""),
|
||||||
headFontPath(""),
|
headFontPath(""),
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ void FurnaceGUI::drawOsc() {
|
||||||
|
|
||||||
if ((oscWidth-24)>0) {
|
if ((oscWidth-24)>0) {
|
||||||
if (settings.oscMono) {
|
if (settings.oscMono) {
|
||||||
if (rend->supportsDrawOsc() && newOscCode) {
|
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||||
_do.gui=this;
|
_do.gui=this;
|
||||||
_do.data=&oscValuesAverage[12];
|
_do.data=&oscValuesAverage[12];
|
||||||
_do.len=oscWidth-24;
|
_do.len=oscWidth-24;
|
||||||
|
|
|
||||||
|
|
@ -178,14 +178,14 @@ const char* sh_oscRender_srcF=
|
||||||
" if (val<valmin) valmin=val;\n"
|
" if (val<valmin) valmin=val;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" float slope=abs(valmax-valmin)*uResolution.y*0.5;\n"
|
" float slope=abs(valmax-valmin)*uResolution.y*0.5;\n"
|
||||||
" float slopeDiv=min(uAdvance,2.0*(uAdvance/slope));\n"
|
" float slopeDiv=min(uAdvance,(uAdvance/slope));\n"
|
||||||
" float xRight=uv.x+((uLineWidth)/uResolution.x);\n"
|
" float xRight=uv.x+((uLineWidth)/uResolution.x);\n"
|
||||||
" for (float x=max(0.0,uv.x-(uLineWidth/uResolution.x)); x<=xRight; x+=slopeDiv) {\n"
|
" for (float x=max(0.0,uv.x-(uLineWidth/uResolution.x)); x<=xRight; x+=slopeDiv) {\n"
|
||||||
" float val=texture(oscVal,x).x*uResolution.y*0.5;\n"
|
" float val=texture(oscVal,x).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"
|
" alpha+=clamp(uLineWidth-distance(vec2(fur_fragCoord.x,fur_fragCoord.y),vec2(x*uResolution.x,val)),0.0,1.0);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" if (slope>1.0) {\n"
|
" if (slope>1.0) {\n"
|
||||||
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
|
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/(uLineWidth+sqrt(slope*0.125)),0.0,1.0));\n"
|
||||||
" } else {\n"
|
" } else {\n"
|
||||||
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
|
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
|
|
|
||||||
|
|
@ -465,6 +465,22 @@ void FurnaceGUI::drawSettings() {
|
||||||
}
|
}
|
||||||
popWarningColor();
|
popWarningColor();
|
||||||
|
|
||||||
|
ImGui::Text("Oscilloscope rendering engine:");
|
||||||
|
ImGui::Indent();
|
||||||
|
if (ImGui::RadioButton("ImGui line plot",settings.shaderOsc==0)) {
|
||||||
|
settings.shaderOsc=0;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("render using Dear ImGui's built-in line drawing functions.");
|
||||||
|
}
|
||||||
|
if (ImGui::RadioButton("GLSL/HLSL (if available)",settings.shaderOsc==1)) {
|
||||||
|
settings.shaderOsc=1;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("render using shaders that run on the graphics card.\nonly available in OpenGL render backend.");
|
||||||
|
}
|
||||||
|
ImGui::Unindent();
|
||||||
|
|
||||||
// SUBSECTION FILE
|
// SUBSECTION FILE
|
||||||
CONFIG_SUBSECTION("File");
|
CONFIG_SUBSECTION("File");
|
||||||
|
|
||||||
|
|
@ -3805,6 +3821,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
||||||
|
|
||||||
settings.chanOscThreads=conf.getInt("chanOscThreads",0);
|
settings.chanOscThreads=conf.getInt("chanOscThreads",0);
|
||||||
settings.renderPoolThreads=conf.getInt("renderPoolThreads",0);
|
settings.renderPoolThreads=conf.getInt("renderPoolThreads",0);
|
||||||
|
settings.shaderOsc=conf.getInt("shaderOsc",1);
|
||||||
settings.showPool=conf.getInt("showPool",0);
|
settings.showPool=conf.getInt("showPool",0);
|
||||||
settings.writeInsNames=conf.getInt("writeInsNames",0);
|
settings.writeInsNames=conf.getInt("writeInsNames",0);
|
||||||
settings.readInsNames=conf.getInt("readInsNames",1);
|
settings.readInsNames=conf.getInt("readInsNames",1);
|
||||||
|
|
@ -4245,6 +4262,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
||||||
clampSetting(settings.selectAssetOnLoad,0,1);
|
clampSetting(settings.selectAssetOnLoad,0,1);
|
||||||
clampSetting(settings.basicColors,0,1);
|
clampSetting(settings.basicColors,0,1);
|
||||||
clampSetting(settings.playbackTime,0,1);
|
clampSetting(settings.playbackTime,0,1);
|
||||||
|
clampSetting(settings.shaderOsc,0,1);
|
||||||
|
|
||||||
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
||||||
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
||||||
|
|
@ -4270,6 +4288,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
||||||
|
|
||||||
conf.set("chanOscThreads",settings.chanOscThreads);
|
conf.set("chanOscThreads",settings.chanOscThreads);
|
||||||
conf.set("renderPoolThreads",settings.renderPoolThreads);
|
conf.set("renderPoolThreads",settings.renderPoolThreads);
|
||||||
|
conf.set("shaderOsc",settings.shaderOsc);
|
||||||
conf.set("showPool",settings.showPool);
|
conf.set("showPool",settings.showPool);
|
||||||
conf.set("writeInsNames",settings.writeInsNames);
|
conf.set("writeInsNames",settings.writeInsNames);
|
||||||
conf.set("readInsNames",settings.readInsNames);
|
conf.set("readInsNames",settings.readInsNames);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue