Merge branch 'npr' - READ
this is the New Pattern Renderer (at some point in time I called it Blast Patterning). it uses ImDrawList to draw the pattern instead of a table with Selectable()s. it offers reduced CPU overhead and less ID exhaustion. it has been tested and should be mostly identical to the previous pattern renderer, but there may be a couple bugs I haven't found yet. if you find any, please report them. the new renderer will be enabled at start-up with a 50% chance and you may toggle it with the NPR button next to Help. thank you!
This commit is contained in:
commit
db12b7ee5c
7 changed files with 2172 additions and 9 deletions
|
|
@ -993,6 +993,7 @@ src/gui/memory.cpp
|
|||
src/gui/mixer.cpp
|
||||
src/gui/midiMap.cpp
|
||||
src/gui/multiInsSetup.cpp
|
||||
src/gui/newPattern.cpp
|
||||
src/gui/newSong.cpp
|
||||
src/gui/orders.cpp
|
||||
src/gui/osc.cpp
|
||||
|
|
|
|||
|
|
@ -476,6 +476,8 @@ void FurnaceGUI::drawMobileControls() {
|
|||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::Checkbox("New Pattern",&newPatternRenderer);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
switch (mobScene) {
|
||||
|
|
|
|||
|
|
@ -3794,11 +3794,13 @@ void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) {
|
|||
if (y>patWindowPos.y+patWindowSize.y-2.0f*dpiScale) {
|
||||
addScroll(1);
|
||||
}
|
||||
if (x<patWindowPos.x+(mobileUI?40.0f:4.0f)*dpiScale) {
|
||||
addScrollX(-1);
|
||||
}
|
||||
if (x>patWindowPos.x+patWindowSize.x-(mobileUI?40.0f:4.0f)*dpiScale) {
|
||||
addScrollX(1);
|
||||
if (!selectingFull) {
|
||||
if (x<patWindowPos.x+(mobileUI?40.0f:4.0f)*dpiScale) {
|
||||
addScrollX(-1);
|
||||
}
|
||||
if (x>patWindowPos.x+patWindowSize.x-(mobileUI?40.0f:4.0f)*dpiScale) {
|
||||
addScrollX(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (macroDragActive || macroLoopDragActive || waveDragActive || sampleDragActive || orderScrollLocked) {
|
||||
|
|
@ -4931,6 +4933,13 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
pushToggleColors(newPatternRenderer);
|
||||
if (ImGui::SmallButton("NPR")) {
|
||||
newPatternRenderer=!newPatternRenderer;
|
||||
}
|
||||
ImGui::SetItemTooltip(_("New Pattern Renderer"));
|
||||
popToggleColors();
|
||||
ImGui::SameLine();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PLAYBACK_STAT]);
|
||||
if (e->isPlaying() && settings.playbackTime) {
|
||||
TimeMicros totalTime=e->getCurTime();
|
||||
|
|
@ -5174,6 +5183,7 @@ bool FurnaceGUI::loop() {
|
|||
if (!selectingFull) cursor=selEnd;
|
||||
finishSelection();
|
||||
if (!mobileUI) {
|
||||
// TODO: don't demand if selectingFull?
|
||||
demandScrollX=true;
|
||||
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y && cursor.order==selStart.order &&
|
||||
cursor.xCoarse==selEnd.xCoarse && cursor.xFine==selEnd.xFine && cursor.y==selEnd.y && cursor.order==selEnd.order) {
|
||||
|
|
@ -6788,6 +6798,13 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
break;
|
||||
case GUI_WARN_NPR:
|
||||
if (ImGui::Button(_("Got it"))) {
|
||||
tutorial.nprFieldTrial=true;
|
||||
commitTutorial();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
break;
|
||||
case GUI_WARN_GENERIC:
|
||||
if (ImGui::Button(_("OK"))) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
|
@ -7659,6 +7676,9 @@ bool FurnaceGUI::loop() {
|
|||
bool FurnaceGUI::init() {
|
||||
logI("initializing GUI.");
|
||||
|
||||
// new pattern renderer "field" trial.
|
||||
newPatternRenderer=(rand()&1);
|
||||
|
||||
newFilePicker=new FurnaceFilePicker;
|
||||
newFilePicker->setConfigPrefix("fp_");
|
||||
|
||||
|
|
@ -7668,6 +7688,10 @@ bool FurnaceGUI::init() {
|
|||
syncSettings();
|
||||
syncTutorial();
|
||||
|
||||
if (!tutorial.nprFieldTrial && newPatternRenderer) {
|
||||
showWarning(_("welcome to the New Pattern Renderer!\nit should be lighter on your CPU.\n\nif you find an issue, you can go back to the old pattern renderer by clicking the NPR button (next to Help).\nmake sure to report it!\n\nthank you!"),GUI_WARN_NPR);
|
||||
}
|
||||
|
||||
recentFile.clear();
|
||||
for (int i=0; i<settings.maxRecentFile; i++) {
|
||||
String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
|
||||
|
|
@ -8765,6 +8789,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
replacePendingSample(false),
|
||||
displayExportingROM(false),
|
||||
displayExportingCS(false),
|
||||
newPatternRenderer(false),
|
||||
quitNoSave(false),
|
||||
changeCoarse(false),
|
||||
orderLock(false),
|
||||
|
|
|
|||
|
|
@ -687,6 +687,7 @@ enum FurnaceGUIWarnings {
|
|||
GUI_WARN_CV,
|
||||
GUI_WARN_RESET_CONFIG,
|
||||
GUI_WARN_IMPORT,
|
||||
GUI_WARN_NPR,
|
||||
GUI_WARN_GENERIC
|
||||
};
|
||||
|
||||
|
|
@ -1747,6 +1748,7 @@ class FurnaceGUI {
|
|||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
|
||||
bool displayPendingSamples, replacePendingSample;
|
||||
bool displayExportingROM, displayExportingCS;
|
||||
bool newPatternRenderer;
|
||||
bool quitNoSave;
|
||||
bool changeCoarse;
|
||||
bool orderLock;
|
||||
|
|
@ -2371,6 +2373,7 @@ class FurnaceGUI {
|
|||
bool introPlayed;
|
||||
bool protoWelcome;
|
||||
bool importedMOD, importedS3M, importedXM, importedIT;
|
||||
bool nprFieldTrial;
|
||||
double popupTimer;
|
||||
Tutorial():
|
||||
#ifdef SUPPORT_XP
|
||||
|
|
@ -2383,6 +2386,7 @@ class FurnaceGUI {
|
|||
importedS3M(false),
|
||||
importedXM(false),
|
||||
importedIT(false),
|
||||
nprFieldTrial(false),
|
||||
popupTimer(10.0f) {
|
||||
}
|
||||
} tutorial;
|
||||
|
|
@ -3015,6 +3019,7 @@ class FurnaceGUI {
|
|||
|
||||
float calcBPM(const DivGroovePattern& speeds, float hz, int vN, int vD);
|
||||
|
||||
ImVec2 mapSelPoint(const SelectionPoint& s, float lineHeight);
|
||||
void patternRow(int i, bool isPlaying, float lineHeight, int chans, int ord, const DivPattern** patCache, bool inhibitSel);
|
||||
|
||||
void drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float availableWidth, int index);
|
||||
|
|
@ -3058,6 +3063,7 @@ class FurnaceGUI {
|
|||
void drawGrooves();
|
||||
void drawOrders();
|
||||
void drawPattern();
|
||||
void drawPatternNew();
|
||||
void drawInsList(bool asChild=false);
|
||||
void drawInsEdit();
|
||||
void drawInsSID3(DivInstrument* ins);
|
||||
|
|
|
|||
2122
src/gui/newPattern.cpp
Normal file
2122
src/gui/newPattern.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -40,11 +40,11 @@ struct DelayedLabel {
|
|||
label(l) {}
|
||||
};
|
||||
|
||||
inline float randRange(float min, float max) {
|
||||
static inline float randRange(float min, float max) {
|
||||
return min+((float)rand()/(float)RAND_MAX)*(max-min);
|
||||
}
|
||||
|
||||
void _pushPartBlend(const ImDrawList* drawList, const ImDrawCmd* cmd) {
|
||||
static void _pushPartBlend(const ImDrawList* drawList, const ImDrawCmd* cmd) {
|
||||
if (cmd!=NULL) {
|
||||
if (cmd->UserCallbackData!=NULL) {
|
||||
((FurnaceGUI*)cmd->UserCallbackData)->pushPartBlend();
|
||||
|
|
@ -52,7 +52,7 @@ void _pushPartBlend(const ImDrawList* drawList, const ImDrawCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void _popPartBlend(const ImDrawList* drawList, const ImDrawCmd* cmd) {
|
||||
static void _popPartBlend(const ImDrawList* drawList, const ImDrawCmd* cmd) {
|
||||
if (cmd!=NULL) {
|
||||
if (cmd->UserCallbackData!=NULL) {
|
||||
((FurnaceGUI*)cmd->UserCallbackData)->popPartBlend();
|
||||
|
|
@ -419,6 +419,11 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
}
|
||||
|
||||
void FurnaceGUI::drawPattern() {
|
||||
if (newPatternRenderer) {
|
||||
drawPatternNew();
|
||||
return;
|
||||
}
|
||||
|
||||
//int delta0=SDL_GetPerformanceCounter();
|
||||
if (nextWindow==GUI_WINDOW_PATTERN) {
|
||||
patternOpen=true;
|
||||
|
|
@ -807,7 +812,7 @@ void FurnaceGUI::drawPattern() {
|
|||
ImGui::ItemSize(size,ImGui::GetStyle().FramePadding.y);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID(chanID))) {
|
||||
bool hovered=ImGui::ItemHoverable(rect,ImGui::GetID(chanID),0);
|
||||
ImU32 col=(hovered || (mobileUI && ImGui::IsMouseDown(ImGuiMouseButton_Left)))?ImGui::GetColorU32(ImGuiCol_HeaderHovered):ImGui::GetColorU32(ImGuiCol_Header);
|
||||
ImU32 col=hovered?ImGui::GetColorU32(ImGuiCol_HeaderHovered):ImGui::GetColorU32(ImGuiCol_Header);
|
||||
dl->AddRectFilled(rect.Min,rect.Max,col);
|
||||
dl->AddTextNoHashHide(ImVec2(minLabelArea.x,rect.Min.y),ImGui::GetColorU32(channelTextColor(i)),chanID);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -692,6 +692,7 @@ void FurnaceGUI::syncTutorial() {
|
|||
tutorial.importedS3M=e->getConfBool("tutImportedS3M",false);
|
||||
tutorial.importedXM=e->getConfBool("tutImportedXM",false);
|
||||
tutorial.importedIT=e->getConfBool("tutImportedIT",false);
|
||||
tutorial.nprFieldTrial=e->getConfBool("tutNPRFieldTrial",false);
|
||||
}
|
||||
|
||||
void FurnaceGUI::commitTutorial() {
|
||||
|
|
@ -701,6 +702,7 @@ void FurnaceGUI::commitTutorial() {
|
|||
e->setConf("tutImportedS3M",tutorial.importedS3M);
|
||||
e->setConf("tutImportedXM",tutorial.importedXM);
|
||||
e->setConf("tutImportedIT",tutorial.importedIT);
|
||||
e->setConf("tutNPRFieldTrial",tutorial.nprFieldTrial);
|
||||
}
|
||||
|
||||
void FurnaceGUI::initRandomDemoSong() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue