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);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID("chOscDisplay"))) {
|
||||
if (!e->isRunning()) {
|
||||
if (newOscCode) {
|
||||
if (settings.shaderOsc) {
|
||||
memset(fft->oscTex,0,2048*sizeof(float));
|
||||
} else {
|
||||
for (unsigned short j=0; j<precision; j++) {
|
||||
|
|
@ -617,7 +617,7 @@ void FurnaceGUI::drawChanOsc() {
|
|||
}
|
||||
if (maxavg>0.0000001) maxavg=0.5/maxavg;
|
||||
|
||||
if (newOscCode) {
|
||||
if (settings.shaderOsc) {
|
||||
for (unsigned short j=0; j<precision && j<2048; j++) {
|
||||
float y;
|
||||
if (j>=precision/2) {
|
||||
|
|
@ -666,7 +666,7 @@ void FurnaceGUI::drawChanOsc() {
|
|||
}
|
||||
dcOff=(minLevel+maxLevel)*0.5f;
|
||||
|
||||
if (newOscCode) {
|
||||
if (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;
|
||||
|
|
@ -699,7 +699,7 @@ void FurnaceGUI::drawChanOsc() {
|
|||
color=chanOscGrad.get(xVal,1.0f-yVal);
|
||||
}
|
||||
|
||||
if (rend->supportsDrawOsc() && newOscCode) {
|
||||
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||
fft->drawOp.gui=this;
|
||||
fft->drawOp.data=fft->oscTex;
|
||||
fft->drawOp.len=precision;
|
||||
|
|
|
|||
|
|
@ -7298,7 +7298,6 @@ FurnaceGUI::FurnaceGUI():
|
|||
safeMode(false),
|
||||
midiWakeUp(true),
|
||||
makeDrumkitMode(false),
|
||||
newOscCode(true),
|
||||
audioEngineChanged(false),
|
||||
settingsChanged(false),
|
||||
debugFFT(false),
|
||||
|
|
|
|||
|
|
@ -1507,7 +1507,6 @@ class FurnaceGUI {
|
|||
bool safeMode;
|
||||
bool midiWakeUp;
|
||||
bool makeDrumkitMode;
|
||||
bool newOscCode;
|
||||
bool audioEngineChanged, settingsChanged, debugFFT;
|
||||
bool willExport[DIV_MAX_CHIPS];
|
||||
int vgmExportVersion;
|
||||
|
|
@ -1776,6 +1775,7 @@ class FurnaceGUI {
|
|||
int selectAssetOnLoad;
|
||||
int basicColors;
|
||||
int playbackTime;
|
||||
int shaderOsc;
|
||||
unsigned int maxUndoSteps;
|
||||
String mainFontPath;
|
||||
String headFontPath;
|
||||
|
|
@ -1976,6 +1976,7 @@ class FurnaceGUI {
|
|||
selectAssetOnLoad(1),
|
||||
basicColors(1),
|
||||
playbackTime(1),
|
||||
shaderOsc(1),
|
||||
maxUndoSteps(100),
|
||||
mainFontPath(""),
|
||||
headFontPath(""),
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ void FurnaceGUI::drawOsc() {
|
|||
|
||||
if ((oscWidth-24)>0) {
|
||||
if (settings.oscMono) {
|
||||
if (rend->supportsDrawOsc() && newOscCode) {
|
||||
if (rend->supportsDrawOsc() && settings.shaderOsc) {
|
||||
_do.gui=this;
|
||||
_do.data=&oscValuesAverage[12];
|
||||
_do.len=oscWidth-24;
|
||||
|
|
|
|||
|
|
@ -178,14 +178,14 @@ const char* sh_oscRender_srcF=
|
|||
" if (val<valmin) valmin=val;\n"
|
||||
" }\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"
|
||||
" 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"
|
||||
" alpha+=clamp(uLineWidth-distance(vec2(fur_fragCoord.x,fur_fragCoord.y),vec2(x*uResolution.x,val)),0.0,1.0);\n"
|
||||
" }\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"
|
||||
" fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n"
|
||||
" }\n"
|
||||
|
|
|
|||
|
|
@ -465,6 +465,22 @@ void FurnaceGUI::drawSettings() {
|
|||
}
|
||||
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
|
||||
CONFIG_SUBSECTION("File");
|
||||
|
||||
|
|
@ -3805,6 +3821,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.showPool=conf.getInt("showPool",0);
|
||||
settings.writeInsNames=conf.getInt("writeInsNames",0);
|
||||
settings.readInsNames=conf.getInt("readInsNames",1);
|
||||
|
|
@ -4245,6 +4262,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
clampSetting(settings.selectAssetOnLoad,0,1);
|
||||
clampSetting(settings.basicColors,0,1);
|
||||
clampSetting(settings.playbackTime,0,1);
|
||||
clampSetting(settings.shaderOsc,0,1);
|
||||
|
||||
if (settings.exportLoops<0.0) settings.exportLoops=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("renderPoolThreads",settings.renderPoolThreads);
|
||||
conf.set("shaderOsc",settings.shaderOsc);
|
||||
conf.set("showPool",settings.showPool);
|
||||
conf.set("writeInsNames",settings.writeInsNames);
|
||||
conf.set("readInsNames",settings.readInsNames);
|
||||
|
|
|
|||
Loading…
Reference in a new issue