Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.240, 1.241 Display.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-03 10:14:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5578/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Display.java Log Message: clipping plane selecting Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Display.java 2 Oct 2007 13:04:21 -0000 1.18 --- Display.java 3 Oct 2007 10:14:20 -0000 1.19 *************** *** 24,27 **** --- 24,28 ---- import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.CoordinateSystem; *************** *** 441,444 **** --- 442,485 ---- + private static void drawClips(Collection<ClippingPlane> clips) { + for (ClippingPlane current : clips) { + draw(current); + } + } + private static void selectClips(Collection<ClippingPlane> clips) { + for (ClippingPlane current : clips) { + push(current); + draw(current); + pop(); + } + } + + + private static void draw(ClippingPlane clipplane) { + Collection<Vertex> corners = clipplane.getCorners(); + gl.glLineWidth(3.0f); + gl.glBegin(GL.GL_LINE_LOOP); + for (Vertex current : corners) { + gl.glVertex3d(current.getX(), + current.getY(), + current.getZ()); + } + gl.glEnd(); + if (clipplane.isActive()) { + gl.glLineWidth(1.5f); + Collection<Edge> lines = clipplane.getLines(); + for (Edge current : lines) { + if (current.getStrippled()) { + gl.glEnable(GL.GL_LINE_STIPPLE); + draw(current); + gl.glDisable(GL.GL_LINE_STIPPLE); + } else { + draw(current); + } + } + } + } + + private static void selectConstructors(Collection<Constructor> constructors) { if (intersecting) { *************** *** 700,703 **** --- 741,745 ---- Collection<Constructor> constructors = new LinkedList(); Collection<Vertex> vertices = new LinkedList(); + Collection<ClippingPlane> clips = Project.getInstance().getCurrentCamera().getClipplanes(); for (Geometric current : extras) { if (current instanceof Edge) { *************** *** 726,729 **** --- 768,774 ---- } + if (selecting()) { + selectClips(clips); + } } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.240 retrieving revision 1.241 diff -C2 -d -r1.240 -r1.241 *** View.java 3 Oct 2007 10:07:00 -0000 1.240 --- View.java 3 Oct 2007 10:14:20 -0000 1.241 *************** *** 804,813 **** */ private void disableClipplanes() { ! Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! if (cp.isActive()) { ! gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! if (cp.isSlice()) { gl.glDisable(GL.GL_CLIP_PLANE5); } --- 804,812 ---- */ private void disableClipplanes() { ! Collection<ClippingPlane> clips = Project.getInstance().getCurrentCamera().getClipplanes(); ! for (ClippingPlane current : clips) { ! if (current.isActive()) { ! gl.glDisable(GL.GL_CLIP_PLANE0 + current.getNumber()); ! if (current.isSlice()) { gl.glDisable(GL.GL_CLIP_PLANE5); } *************** *** 820,833 **** */ private void enableClipplanes() { ! Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! if (cp.isActive()) { ! gl.glClipPlane(GL.GL_CLIP_PLANE0 + cp.getNumber(), cp.getPlane().getDoublev(), 0); ! gl.glEnable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! if (cp.isSlice()) { ! gl.glClipPlane(GL.GL_CLIP_PLANE5, cp.getPlane().negate().getDoublev(), 0); gl.glEnable(GL.GL_CLIP_PLANE5); ! cp.getPlane().negate(); } } --- 819,831 ---- */ private void enableClipplanes() { ! Collection<ClippingPlane> clips = Project.getInstance().getCurrentCamera().getClipplanes(); ! for (ClippingPlane current : clips) { ! if (current.isActive()) { ! gl.glClipPlane(GL.GL_CLIP_PLANE0 + current.getNumber(), current.getPlane().getDoublev(), 0); ! gl.glEnable(GL.GL_CLIP_PLANE0 + current.getNumber()); ! if (current.isSlice()) { ! gl.glClipPlane(GL.GL_CLIP_PLANE5, current.getPlane().negate().getDoublev(), 0); gl.glEnable(GL.GL_CLIP_PLANE5); ! current.getPlane().negate(); } } |