A better fix to the display mesh issue; instead of drawing the

previous group, copy the previous group's mesh into ours, and draw
ours. This makes other stuff that uses that mesh (like the export
and analysis code) work properly.

[git-p4: depot-paths = "//depot/solvespace/": change = 2050]
This commit is contained in:
Jonathan Westhues 2009-10-07 23:55:09 -08:00
parent 3da0f6e135
commit ce37b1cf72
3 changed files with 50 additions and 39 deletions

View File

@ -227,14 +227,9 @@ void GraphicsWindow::HitTestMakeSelection(Point2d mp) {
// Faces, from the triangle mesh; these are lowest priority
if(s.constraint.v == 0 && s.entity.v == 0 && showShaded && showFaces) {
SMesh *m;
Group *g = SK.GetGroup(activeGroup),
*pg = g->RunningMeshGroup();
if(pg && g->thisMesh.IsEmpty() && g->thisShell.IsEmpty()) {
m = &(pg->displayMesh);
} else {
m = &(g->displayMesh);
}
Group *g = SK.GetGroup(activeGroup);
SMesh *m = &(g->displayMesh);
DWORD v = m->FirstIntersectionWith(mp);
if(v) {
s.entity.v = v;

View File

@ -312,11 +312,37 @@ void Group::GenerateDisplayItems(void) {
// to find the emphasized edges for a mesh), so we will run it only
// if its inputs have changed.
if(displayDirty) {
Group *pg = RunningMeshGroup();
if(pg && thisMesh.IsEmpty() && thisShell.IsEmpty()) {
// We don't contribute any new solid model in this group, so our
// display items are identical to the previous group's; which means
// that we can just display those, and stop ourselves from
// recalculating for those every time we get a change in this group.
//
// Note that this can end up recursing multiple times (if multiple
// groups that contribute no solid model exist in sequence), but
// that's okay.
pg->GenerateDisplayItems();
displayMesh.Clear();
displayMesh.MakeFromCopyOf(&(pg->displayMesh));
displayEdges.Clear();
if(SS.GW.showEdges) {
SEdge *se;
SEdgeList *src = &(pg->displayEdges);
for(se = src->l.First(); se; se = src->l.NextAfter(se)) {
displayEdges.l.Add(se);
}
}
} else {
// We do contribute new solid model, so we have to triangulate the
// shell, and edge-find the mesh.
displayMesh.Clear();
runningShell.TriangulateInto(&displayMesh);
STriangle *tr;
for(tr = runningMesh.l.First(); tr; tr = runningMesh.l.NextAfter(tr)) {
STriangle trn = *tr;
STriangle *t;
for(t = runningMesh.l.First(); t; t = runningMesh.l.NextAfter(t)) {
STriangle trn = *t;
Vector n = trn.Normal();
trn.an = n;
trn.bn = n;
@ -330,6 +356,7 @@ void Group::GenerateDisplayItems(void) {
runningShell.MakeEdgesInto(&displayEdges);
runningMesh.MakeEmphasizedEdgesInto(&displayEdges);
}
}
displayDirty = false;
}
@ -397,20 +424,8 @@ void Group::Draw(void) {
// can control this stuff independently, with show/hide solids, edges,
// mesh, etc.
// If this changes then make sure to also do the face selection off the
// correct mesh, in draw.cpp.
Group *pg = RunningMeshGroup();
if(pg && thisMesh.IsEmpty() && thisShell.IsEmpty()) {
// We don't contribute any new solid model in this group, so our
// display items are identical to the previous group's; which means
// that we can just display those, and stop ourselves from
// recalculating for those every time we get a change in this group.
pg->GenerateDisplayItems();
pg->DrawDisplayItems(type);
} else {
GenerateDisplayItems();
DrawDisplayItems(type);
}
if(!SS.checkClosedContour) return;

View File

@ -1,13 +1,14 @@
multi-drag
copy and paste
wireframe export
import mirrored
-----
some kind of import
filled contours for export
wireframe export
faster triangulation
interpolating splines
copy and paste
loop detection
IGES export
incremental regen of entities