Skip to content

Commit

Permalink
Optimize toggling visibility of normals, points, edges, outlines.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
whitequark committed Nov 18, 2016
1 parent 683ac78 commit 369b0a3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/graphicswin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 369b0a3

Please sign in to comment.