Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.158, 1.159
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-10-30 10:32:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24012/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: packed enable and disabling of clip planes in methods, and turned them off for constructor drawing, need still some work, not all are shown, maybe they should. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** View.java 22 Oct 2006 14:32:56 -0000 1.158 --- View.java 30 Oct 2006 10:31:51 -0000 1.159 *************** *** 575,586 **** picking = 0; ! 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()); ! gl.glEnable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! } ! } gl.glColor3fv(lineColor); --- 575,579 ---- picking = 0; ! enableClipplanes(); gl.glColor3fv(lineColor); *************** *** 591,606 **** gl.glEnable(GL.GL_DEPTH_TEST); ! 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()); ! } ! } ! clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); - // draw the clipping planes Collection selection = Selection.primary(); if (cp == target) { --- 584,593 ---- gl.glEnable(GL.GL_DEPTH_TEST); ! disableClipplanes(); ! //draw the clipping planes ! Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); Collection selection = Selection.primary(); if (cp == target) { *************** *** 616,620 **** } - if (glv.getTool() instanceof SpaceTool) { gl.glMatrixMode(GL.GL_PROJECTION); --- 603,606 ---- *************** *** 675,678 **** --- 661,694 ---- /** + * disable all clipping planes + */ + 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.getClipdepth() != 0) { + gl.glDisable(GL.GL_CLIP_PLANE5); + } + } + } + } + + /** + * Turn all clipplanes on + */ + 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()); + gl.glEnable(GL.GL_CLIP_PLANE0 + cp.getNumber()); + } + } + } + + /** * The camera setup function * @param gld The GLDrawable object *************** *** 1125,1132 **** gl.glDisable(GL.GL_POLYGON_STIPPLE); } else if (o instanceof ClippingPlane) { - gl.glDisable(GL.GL_DEPTH_TEST); ClippingPlane cp = (ClippingPlane) o; ! drawClipplane(cp); ! gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Constructor) { Constructor c = (Constructor) o; --- 1141,1152 ---- gl.glDisable(GL.GL_POLYGON_STIPPLE); } else if (o instanceof ClippingPlane) { ClippingPlane cp = (ClippingPlane) o; ! if (cp.isActive()) { ! gl.glDisable(GL.GL_DEPTH_TEST); ! drawClipplane(cp); ! gl.glEnable(GL.GL_DEPTH_TEST); ! } else { ! drawClipplane(cp); ! } } else if (o instanceof Constructor) { Constructor c = (Constructor) o; *************** *** 1183,1186 **** --- 1203,1208 ---- double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; if (active != null) { + // Should be drawn regardless of clipplanes + disableClipplanes(); gl.glPushMatrix(); transformTo(active); *************** *** 1189,1192 **** --- 1211,1215 ---- grid(Project.getInstance().getActiveCoordinateSystem()); gl.glPopMatrix(); + enableClipplanes(); } while (true) { *************** *** 2113,2117 **** { gl.glLineWidth(2.0f); ! gl.glBegin(GL.GL_LINE_STRIP); Iterator it = corners.iterator(); while (it.hasNext()) { --- 2136,2140 ---- { gl.glLineWidth(2.0f); ! gl.glBegin(GL.GL_LINE_LOOP); Iterator it = corners.iterator(); while (it.hasNext()) { *************** *** 2121,2136 **** v.getZ()); } - Vertex v = (Vertex) corners.iterator().next(); - gl.glVertex3d(v.getX(), - v.getY(), - v.getZ()); gl.glEnd(); } Collection lines = clipplane.getLines(); Iterator it = lines.iterator(); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawConstructor(e); ! } } --- 2144,2163 ---- v.getZ()); } gl.glEnd(); } Collection lines = clipplane.getLines(); Iterator it = lines.iterator(); ! if (clipplane.getClipdepth() == 0) { ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawConstructor(e); ! } ! } else { ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawEdge(e); ! } ! } ! } |