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 // Faces, from the triangle mesh; these are lowest priority
if(s.constraint.v == 0 && s.entity.v == 0 && showShaded && showFaces) { if(s.constraint.v == 0 && s.entity.v == 0 && showShaded && showFaces) {
SMesh *m; Group *g = SK.GetGroup(activeGroup);
Group *g = SK.GetGroup(activeGroup), SMesh *m = &(g->displayMesh);
*pg = g->RunningMeshGroup();
if(pg && g->thisMesh.IsEmpty() && g->thisShell.IsEmpty()) {
m = &(pg->displayMesh);
} else {
m = &(g->displayMesh);
}
DWORD v = m->FirstIntersectionWith(mp); DWORD v = m->FirstIntersectionWith(mp);
if(v) { if(v) {
s.entity.v = v; s.entity.v = v;

View File

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

View File

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