checkpoint
[anneal.git] / src / edu / berkeley / qfat / MeshViewer.java
index 3f57d77..3751ddf 100644 (file)
@@ -33,7 +33,6 @@ public class MeshViewer extends Viewer {
     public int temps;
     public int accepts;
     public    int vertss;
-    protected HashSet<Mesh.T> safeTriangles = new HashSet<Mesh.T>();
 
     public MeshViewer(JFrame f) { super(f); }
 
@@ -47,6 +46,7 @@ public class MeshViewer extends Viewer {
         gl.glPointSize(5.0f);
         gl.glLoadIdentity();
         glu.gluPerspective(50, ((float)drawable.getWidth())/drawable.getHeight(), 0.5, 10);
+
         glu.gluLookAt(0, 0, -((tz/10)-1), 0, 0, 0, 0, 1, 0);
         gl.glRotatef(anglex/3, 0, 1, 0);
         gl.glRotatef(-(angley/3), 1, 0, 0);
@@ -54,15 +54,7 @@ public class MeshViewer extends Viewer {
         tile.render(gl, Matrix.ONE);
         goal.render(gl, Matrix.ONE);
 
-        int i = 0;
-        gl.glColor4f(1,1,1,1);
-        for(Matrix m : transforms) {
-            i++;
-            if (neighborsWireOne && i!=whichNeighbor) continue;
-            if (neighbors) tile.render(gl, m);
-            else if (neighborsWire || neighborsWireOne) tile.render(gl, m);
-        }
-
+        // highlight the point closest to the mouse
         gl.glDisable(GL.GL_LIGHTING);
         gl.glShadeModel(GL.GL_FLAT);
         if (closest != null) {
@@ -72,18 +64,22 @@ public class MeshViewer extends Viewer {
             gl.glEnd();
         }
 
+        // update vertex visibilities
+        // FIXME: only do this when we switch into vertex-finding mode
         updateVisibility(gl, tile);
 
         Matrix projection = Matrix.getProjectionMatrix(gl);
         double dist = Double.MAX_VALUE;
-        if (clickPoint != null) return;
+        if (getMouseClick() != null) return;
         closest = null;
         for(Mesh.Vertex v : tile.vertices()) {
             if (!v.visible) continue;
             Point p = projection.times(v.getPoint());
             int x = (int)p.x;
             int y = (int)p.y;
-            y = glcanvas.getHeight()-y;
+            //y = glcanvas.getHeight()-y;
+            int mousex = (int)getMouse().x;
+            int mousey = (int)getMouse().y;
             if (closest==null || (x-mousex)*(x-mousex)+(y-mousey)*(y-mousey) < dist) {
                 dist = (x-mousex)*(x-mousex)+(y-mousey)*(y-mousey);
                 closest = v;