--- /dev/null
+package edu.berkeley.qfat;
+import java.io.*;
+import java.nio.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.media.opengl.*;
+import javax.media.opengl.glu.*;
+import com.sun.opengl.util.*;
+import java.util.*;
+import edu.berkeley.qfat.geom.*;
+import edu.berkeley.qfat.geom.Point;
+
+public class InteractiveMeshViewer extends MeshViewer {
+
+ public InteractiveMeshViewer(JFrame f) { super(f); }
+
+}
\ No newline at end of file
gl.glShadeModel(GL.GL_SMOOTH);
gl.glEnable(GL.GL_LIGHTING);
gl.glDrawBuffer(GL.GL_FRONT);
-
-
-
- /*
- IntBuffer selectionBuffer =
- ByteBuffer.allocateDirect(4*10000).order(ByteOrder.nativeOrder()).asIntBuffer();
- gl.glSelectBuffer(selectionBuffer.capacity(), selectionBuffer);
- gl.glInitNames();
- gl.glRenderMode(GL.GL_SELECT);
- draw(gl, true, safeTriangles);
- int hits = gl.glRenderMode(GL.GL_RENDER);
- synchronized(safeTriangles) {
- for(Mesh.T t : safeTriangles) {
- t.occluded = true;
- }
- processHits(hits, selectionBuffer);
- }
- */
}
Mesh.Vertex closest = null;
Matrix projection = null;
- // I copied this method without changes from the mentioned base class.
- // It extracts the data in the selection buffer and writes it on the console.
- public void processHits(int hits, IntBuffer buffer) {
- /*
- System.out.println("---------------------------------");
- System.out.println(" HITS: " + hits);
- */
- int offset = 0;
- int names;
- float z1, z2;
- for (int i = 0; i < hits; i++) {
- /*
- System.out.println("- - - - - - - - - - - -");
- System.out.println(" hit: " + (i + 1));
- */
- names = buffer.get(offset);
- offset++;
- z1 = (float) buffer.get(offset) / 0x7fffffff;
- offset++;
- z2 = (float) buffer.get(offset) / 0x7fffffff;
- offset++;
- /*
- System.out.println(" number of names: " + names);
- System.out.println(" z1: " + z1);
- System.out.println(" z2: " + z2);
- System.out.println(" names: ");
- */
-
- for (int j = 0; j < names; j++) {
- int who = buffer.get(offset);
- for(Mesh.T t : safeTriangles) {
- if (t.serial==who) {
- t.occluded = false;
- }
- }
- /*
- System.out.print(" " + who);
- if (j == (names - 1)) {
- System.out.println("<-");
- } else {
- System.out.println();
- }
- */
- offset++;
- }
- /*
- System.out.println("- - - - - - - - - - - -");
- */
- }
- /*
- System.out.println("--------------------------------- ");
- */
- }
-
protected HashSet<Mesh.T> safeTriangles = new HashSet<Mesh.T>();
private void draw(GL gl, boolean triangles, Iterable<Mesh.T> tris) { draw(gl, triangles, tris, Matrix.ONE); }
}
}
-
- //private JTextArea ocanvas = new JTextArea();
private JFrame f;
private GLCanvas glcanvas;
public MeshViewer(JFrame f) {
public void repaint() {
glcanvas.repaint();
}
-
-
-
}
\ No newline at end of file