[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view AbstractView.java,1.23,1.24
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-09-07 14:12:11
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16693/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Improved hit detection of vertices Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** AbstractView.java 7 Sep 2005 11:30:34 -0000 1.23 --- AbstractView.java 7 Sep 2005 14:11:34 -0000 1.24 *************** *** 27,30 **** --- 27,31 ---- import net.java.games.jogl.GLDrawable; import net.java.games.jogl.GLU; + import net.java.games.jogl.GLUquadric; import net.java.games.jogl.util.BufferUtils; import net.java.games.jogl.GLUtesselatorCallbackAdapter; *************** *** 107,110 **** --- 108,115 ---- protected ArrayList objectTable; + /** The ball is used for hit-detecting vertices */ + + protected GLUquadric ball; + /** The last used near value */ protected double near; *************** *** 183,186 **** --- 188,193 ---- gl.glClearColor(0.7f, 0.7f, 0.7f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); + ball = glu.gluNewQuadric(); + } *************** *** 326,332 **** gl.glColor3fv(SELECTED_COLOR); if (o instanceof Vertex) { gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); - Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); gl.glEnd(); --- 333,339 ---- gl.glColor3fv(SELECTED_COLOR); if (o instanceof Vertex) { + Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); gl.glEnd(); *************** *** 429,433 **** Vertex v = (Vertex)it.next(); pushName(gl, v); ! drawVertex(v); popName(gl); } --- 436,440 ---- Vertex v = (Vertex)it.next(); pushName(gl, v); ! drawVertexHit(v); popName(gl); } *************** *** 581,584 **** --- 588,602 ---- gl.glEnd(); } + + /** + * Draw a Vertex for hit-detection + * @param v The Vertex to draw + */ + private void drawVertexHit(Vertex v) { + gl.glPushMatrix(); + gl.glTranslated(v.getX(), v.getY(), v.getZ()); + glu.gluSphere(ball, 0.2, 8, 8); + gl.glPopMatrix(); + } /** |