Allow displaying outlines without any other edges.

As usual, what's displayed is what's exported.
pull/36/head
whitequark 2016-08-14 00:55:27 +00:00
parent 4c30c09792
commit f998293760
4 changed files with 27 additions and 20 deletions

View File

@ -8,15 +8,18 @@ New export/import features:
* Three.js: allow configuring projection for exported model, and initially
use the current viewport projection.
New rendering features:
* The "Show/hide hidden lines" button is now a tri-state button that allows
showing all lines (on top of shaded mesh), stippling occluded lines
or not drawing them at all.
* The "Show/hide outlines" button is now independent from "Show/hide edges".
Other new features:
* New command for measuring total length of selected entities,
"Analyze → Measure Perimeter".
* New link to match the on-screen size of the sketch with its actual size,
"view → set to full scale".
* When zooming to fit, constraints are also considered.
* The "Show/hide hidden lines" button is now a tri-state button that allows
showing all lines (on top of shaded mesh), stippling occluded lines
or not drawing them at all.
2.2
---

View File

@ -203,10 +203,12 @@ void SolveSpaceUI::ExportViewOrWireframeTo(const std::string &filename, bool exp
}
}
if(SS.GW.showEdges) {
if(SS.GW.showEdges || SS.GW.showOutlines) {
Group *g = SK.GetGroup(SS.GW.activeGroup);
g->GenerateDisplayItems();
g->displayOutlines.ListTaggedInto(&edges, Style::SOLID_EDGE);
if(SS.GW.showEdges) {
g->displayOutlines.ListTaggedInto(&edges, Style::SOLID_EDGE);
}
}
if(SS.GW.showConstraints) {
@ -388,7 +390,7 @@ void SolveSpaceUI::ExportLinesAndMesh(SEdgeList *sel, SBezierList *sbl, SMesh *s
// Generate the edges where a curved surface turns from front-facing
// to back-facing.
if(SS.GW.showEdges) {
if(SS.GW.showEdges || SS.GW.showOutlines) {
root->MakeCertainEdgesInto(sel, EdgeKind::TURNING,
/*coplanarIsInter=*/false, NULL, NULL,
GW.showOutlines ? Style::OUTLINE : Style::SOLID_EDGE);

View File

@ -1076,7 +1076,9 @@ void GraphicsWindow::ToggleBool(bool *v) {
// 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) (SK.GetGroup(activeGroup))->displayDirty = true;
if(showEdges || showOutlines) {
SK.GetGroup(activeGroup)->displayDirty = true;
}
SS.GenerateAll();
InvalidateGraphics();

View File

@ -378,7 +378,7 @@ void Group::GenerateDisplayItems() {
displayMesh.MakeFromCopyOf(&(pg->displayMesh));
displayOutlines.Clear();
if(SS.GW.showEdges) {
if(SS.GW.showEdges || SS.GW.showOutlines) {
displayOutlines.MakeFromCopyOf(&pg->displayOutlines);
}
} else {
@ -398,7 +398,7 @@ void Group::GenerateDisplayItems() {
displayOutlines.Clear();
if(SS.GW.showEdges) {
if(SS.GW.showEdges || SS.GW.showOutlines) {
if(runningMesh.l.n > 0) {
// Triangle mesh only; no shell or emphasized edges.
runningMesh.MakeOutlinesInto(&displayOutlines, EdgeKind::EMPHASIZED);
@ -528,17 +528,6 @@ void Group::Draw(Canvas *canvas) {
DrawMesh(DrawMeshAs::DEFAULT, canvas);
if(SS.GW.showEdges) {
if(SS.GW.showOutlines) {
Canvas::Stroke strokeOutline = {};
strokeOutline.zIndex = 1;
strokeOutline.color = Style::Color(Style::OUTLINE);
strokeOutline.width = Style::Width(Style::OUTLINE);
Canvas::hStroke hcsOutline = canvas->GetStroke(strokeOutline);
canvas->DrawOutlines(displayOutlines, hcsOutline,
Canvas::DrawOutlinesAs::CONTOUR_ONLY);
}
Canvas::Stroke strokeEdge = {};
strokeEdge.zIndex = 1;
strokeEdge.color = Style::Color(Style::SOLID_EDGE);
@ -562,6 +551,17 @@ void Group::Draw(Canvas *canvas) {
Canvas::DrawOutlinesAs::EMPHASIZED_AND_CONTOUR);
}
}
if(SS.GW.showOutlines) {
Canvas::Stroke strokeOutline = {};
strokeOutline.zIndex = 1;
strokeOutline.color = Style::Color(Style::OUTLINE);
strokeOutline.width = Style::Width(Style::OUTLINE);
Canvas::hStroke hcsOutline = canvas->GetStroke(strokeOutline);
canvas->DrawOutlines(displayOutlines, hcsOutline,
Canvas::DrawOutlinesAs::CONTOUR_ONLY);
}
}
void Group::DrawPolyError(Canvas *canvas) {