Optimize toggling visibility of normals, points, edges, outlines.

Before this commit, any visibility toggle would cause a regeneration.
After this commit, toggling visibility of normals and points never
causes a regeneration, and toggling visibility of edges and outlines
only causes a regeneration when they weren't already generated.
This commit is contained in:
whitequark 2016-11-18 15:26:01 +00:00
parent 683ac78ca2
commit 369b0a378c

View File

@ -1081,13 +1081,14 @@ void GraphicsWindow::ToggleBool(bool *v) {
// so not meaningful to show them and hide the shaded.
if(!showShaded) showFaces = false;
// We might need to regenerate the mesh and edge list, since the edges
// wouldn't have been generated if they were previously hidden.
if(showEdges || showOutlines) {
SK.GetGroup(activeGroup)->displayDirty = true;
// If the mesh or edges were previously hidden, they haven't been generated,
// and if we are going to show them, we need to generate them first.
Group *g = SK.GetGroup(SS.GW.activeGroup);
if(*v && (g->displayOutlines.l.n == 0 && (v == &showEdges || v == &showOutlines))) {
SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE);
}
SS.GenerateAll();
SS.GW.persistentDirty = true;
InvalidateGraphics();
SS.ScheduleShowTW();
}