X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FViewer.java;h=92be44506785943b6ad2322c05eebc646d986fdc;hp=eccb6b69d1cbed103f47966c358b34f3d02b2b27;hb=c281150b050b1848177e3e2316986ca48644d89f;hpb=cc01f8302c76073129f8c331a545f34d01667861 diff --git a/src/edu/berkeley/qfat/Viewer.java b/src/edu/berkeley/qfat/Viewer.java index eccb6b6..92be445 100644 --- a/src/edu/berkeley/qfat/Viewer.java +++ b/src/edu/berkeley/qfat/Viewer.java @@ -14,32 +14,12 @@ import edu.berkeley.qfat.geom.Point; public abstract class Viewer implements GLEventListener, MouseListener, MouseMotionListener, KeyListener, MouseWheelListener { Mesh.Vertex closest = null; + Matrix projection = null; - public boolean force = false; public Mesh tile = new Mesh(false); public Mesh goal = new Mesh(false); - public Matrix[] transforms; - public Mesh.Vertex[] points; - - public int whichNeighbor = 1; - - public double temp; - public boolean tileon = true; - public boolean tilemeshon = false; - public boolean goalon = true; - public boolean anneal = false; - public boolean hillclimb = false; - public boolean neighbors = false; - public boolean neighborsWire = false; - public boolean neighborsWireOne = false; - public boolean errorNormals = false; - - public int breaks = 0; - boolean alt = false; - boolean shift = false; - boolean control = false; - Matrix projection = null; + JFrame f; GLCanvas glcanvas; Point clickPoint = null; @@ -53,6 +33,10 @@ public abstract class Viewer implements GLEventListener, MouseListener, MouseMot float anglex = 0; float angley = 0; + boolean alt = false; + boolean shift = false; + boolean control = false; + public abstract void _display(GLAutoDrawable drawable, GL gl); public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); @@ -60,6 +44,7 @@ public abstract class Viewer implements GLEventListener, MouseListener, MouseMot this.projection = Matrix.getProjectionMatrix(gl); } + /** return the position of the mouse as a point in window-space */ public Point getMouse() { return new Point(mousex, glcanvas.getHeight()-mousey, 0); } @@ -92,12 +77,12 @@ public abstract class Viewer implements GLEventListener, MouseListener, MouseMot clickPoint = getMouse(); clickClosest = closest == null ? null : closest.getPoint(); } + public void mouseReleased(MouseEvent e) { clickPoint = null; clickClosest = null; } - public void mouseMoved(MouseEvent e) { mousex = e.getX(); mousey = e.getY(); @@ -128,17 +113,15 @@ public abstract class Viewer implements GLEventListener, MouseListener, MouseMot public Viewer(JFrame f) { this.f = f; - - GLCapabilities glcaps = new GLCapabilities(); glcanvas = new GLCanvas(); glcanvas.addGLEventListener(this); f.add(glcanvas, BorderLayout.CENTER); - glcanvas.addMouseListener(this); glcanvas.addMouseMotionListener(this); glcanvas.addMouseWheelListener(this); glcanvas.addKeyListener(this); } + public void repaint() { glcanvas.repaint(); }