[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.252, 1.253
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-16 11:03:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7773/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Fixed bug in Space.simplify() Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.252 retrieving revision 1.253 diff -C2 -d -r1.252 -r1.253 *** View.java 15 Oct 2007 14:08:53 -0000 1.252 --- View.java 16 Oct 2007 11:02:53 -0000 1.253 *************** *** 71,74 **** --- 71,76 ---- private static final boolean DISP = false; + + private boolean enabled; /** OBJECTS flag */ *************** *** 458,461 **** --- 460,464 ---- }); tickler.setRepeats(false); + enabled = true; } *************** *** 578,728 **** } ! /** ! * The function responsible for drawing at each update ! * @param gld The GLDrawable object ! */ ! public void display(GLAutoDrawable gld) { ! try { ! gl = gld.getGL(); ! glu = new GLU(); ! ! // remove old displayLists ! for (Integer i : deletedLists) { ! gl.glDeleteLists(i, i); ! } ! deletedLists.clear(); ! ! boolean hitdetection = false; ! ! gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); ! gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ! ! if (picking > 0) { ! try { ! gl.glRenderMode(GL.GL_RENDER); ! selectBuffer = BufferUtil.newIntBuffer(selectionLength); ! gl.glSelectBuffer(selectionLength, selectBuffer); ! gl.glRenderMode(GL.GL_SELECT); ! hitdetection = true; ! } catch (Exception error) { ! System.out.println("error " + error); ! throw new Error(); ! } ! } ! ! initCamera(); ! gl.glPushMatrix(); ! picking = 0; ! ! enableClipplanes(); ! ! gl.glColor3fv(lineColor, 0); ! gl.glLineWidth(1.0f); ! ! Display.selecting(hitdetection); ! Display.construction(gridEnabled); ! Display.mode(drawMode); ! Display.transparency(showTransparent); ! initNames(gl); ! Display.objects(objectTable); ! Display.colors(colorMap); ! Display.targetColor(targetColor); ! Display.excluded(excluded); ! if (target instanceof Geometric) { ! Display.target((Geometric) target); ! } else { ! Display.target(null); ! } ! if (selectionMode == INTERSECTIONS) { ! Display.intersecting(true); ! } else { ! Display.intersecting(false); } ! Collection<Geometric> extras = new LinkedList(); ! extras.addAll(tempEdges); ! extras.addAll(tempConstructors); ! extras.addAll(tempVertices); ! Display.extras(extras); ! Display.glos(glObjects3D); ! Display.draw(gld, gl, glu); ! Display.selecting(false); Display.intersecting(false); ! ! gl.glEnable(GL.GL_DEPTH_TEST); ! ! disableClipplanes(); ! ! //draw the clipping planes ! Collection<ClippingPlane> clips ! = Project.getInstance().getCurrentCamera().getClipplanes(); ! ! for (ClippingPlane current : clips) { ! Collection selection = Selection.primary(); ! if (current == target) { ! gl.glDisable(GL.GL_DEPTH_TEST); ! drawClipplane(current); ! gl.glEnable(GL.GL_DEPTH_TEST); } else { ! if (selection.contains(current)) { ! gl.glColor3fv(SELECTED_COLOR, 0); ! } else { ! gl.glColor3fv(CLIP_PLANE_COLOR, 0); ! } ! drawClipplane(current); } } ! ! ! gl.glMatrixMode(GL.GL_PROJECTION); ! gl.glDisable(GL.GL_DEPTH_TEST); ! gl.glPushMatrix(); ! gl.glLoadIdentity(); ! if (hitdetection) { ! int[] viewport = new int[] {0, 0, (int)width, (int)height}; ! glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport, 0); ! } ! glu.gluOrtho2D(0, width, 0, height); ! gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glPushMatrix(); ! gl.glLoadIdentity(); ! ! if (glv.getTool() instanceof SpaceTool) { ! labelSelection(hitdetection); ! } ! ! ! drawSpacePath(hitdetection); ! ! for (Widget widget : widgets) { ! widget.display(gl, glu, hitdetection); } ! ! gl.glMatrixMode(GL.GL_PROJECTION); ! gl.glPopMatrix(); ! gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glPopMatrix(); ! ! ! gl.glPopMatrix(); ! if (hitdetection) { ! gl.glFlush(); ! hits = gl.glRenderMode(GL.GL_RENDER); ! if (hits < 0) { ! System.out.println("overflow in selection buffer!"); ! // There were overflow in the selctionBuffer double the buffer and try again ! selectionLength *= 2; ! picking = 10; ! //glv.repaint(true); ! } ! if (log.isDebugEnabled()) { ! log.debug("Hits: " + hits); ! } ! } else { ! gld.swapBuffers(); } - } catch (Exception e) { - e.printStackTrace(); - throw new Error(); } } --- 581,734 ---- } ! private void draw(GLAutoDrawable gld) { ! ! gl = gld.getGL(); ! glu = new GLU(); ! ! // remove old displayLists ! for (Integer i : deletedLists) { ! gl.glDeleteLists(i, i); ! } ! deletedLists.clear(); ! ! boolean hitdetection = false; ! ! gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); ! gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ! ! if (picking > 0) { ! try { ! gl.glRenderMode(GL.GL_RENDER); ! selectBuffer = BufferUtil.newIntBuffer(selectionLength); ! gl.glSelectBuffer(selectionLength, selectBuffer); ! gl.glRenderMode(GL.GL_SELECT); ! hitdetection = true; ! } catch (Exception error) { ! System.out.println("error " + error); ! throw new Error(); } ! } ! ! initCamera(); ! gl.glPushMatrix(); ! picking = 0; ! ! enableClipplanes(); ! ! gl.glColor3fv(lineColor, 0); ! gl.glLineWidth(1.0f); ! ! Display.selecting(hitdetection); ! Display.construction(gridEnabled); ! Display.mode(drawMode); ! Display.transparency(showTransparent); ! initNames(gl); ! Display.objects(objectTable); ! Display.colors(colorMap); ! Display.targetColor(targetColor); ! Display.excluded(excluded); ! if (target instanceof Geometric) { ! Display.target((Geometric) target); ! } else { ! Display.target(null); ! } ! if (selectionMode == INTERSECTIONS) { ! Display.intersecting(true); ! } else { Display.intersecting(false); + } + Collection<Geometric> extras = new LinkedList(); + extras.addAll(tempEdges); + extras.addAll(tempConstructors); + extras.addAll(tempVertices); + Display.extras(extras); + Display.glos(glObjects3D); + Display.draw(gld, gl, glu); + Display.selecting(false); + Display.intersecting(false); ! ! gl.glEnable(GL.GL_DEPTH_TEST); ! ! disableClipplanes(); ! ! //draw the clipping planes ! Collection<ClippingPlane> clips ! = Project.getInstance().getCurrentCamera().getClipplanes(); ! ! for (ClippingPlane current : clips) { ! Collection selection = Selection.primary(); ! if (current == target) { ! gl.glDisable(GL.GL_DEPTH_TEST); ! drawClipplane(current); ! gl.glEnable(GL.GL_DEPTH_TEST); ! } else { ! if (selection.contains(current)) { ! gl.glColor3fv(SELECTED_COLOR, 0); } else { ! gl.glColor3fv(CLIP_PLANE_COLOR, 0); } + drawClipplane(current); } ! } ! ! ! gl.glMatrixMode(GL.GL_PROJECTION); ! gl.glDisable(GL.GL_DEPTH_TEST); ! gl.glPushMatrix(); ! gl.glLoadIdentity(); ! if (hitdetection) { ! int[] viewport = new int[] {0, 0, (int)width, (int)height}; ! glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport, 0); ! } ! glu.gluOrtho2D(0, width, 0, height); ! gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glPushMatrix(); ! gl.glLoadIdentity(); ! ! if (glv.getTool() instanceof SpaceTool) { ! labelSelection(hitdetection); ! } ! ! ! drawSpacePath(hitdetection); ! ! for (Widget widget : widgets) { ! widget.display(gl, glu, hitdetection); ! } ! ! gl.glMatrixMode(GL.GL_PROJECTION); ! gl.glPopMatrix(); ! gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glPopMatrix(); ! ! ! gl.glPopMatrix(); ! if (hitdetection) { ! gl.glFlush(); ! hits = gl.glRenderMode(GL.GL_RENDER); ! if (hits < 0) { ! System.out.println("overflow in selection buffer!"); ! selectionLength *= 2; ! picking = 10; } ! } else { ! gld.swapBuffers(); ! } ! } ! ! /** ! * The function responsible for drawing at each update ! * @param gld The GLDrawable object ! */ ! public void display(GLAutoDrawable gld) { ! if (enabled) { ! try { ! draw(gld); ! } catch (Exception e) { ! enabled = false; ! e.printStackTrace(); ! Project.getInstance().world().check(); } } } *************** *** 1574,1577 **** --- 1580,1588 ---- public Object getObjectAtPoint(double x, double y, Collection unWantedEntities, int mode, Plane xy) { + + if (!enabled) { + return null; + } + this.x = x; this.y = y; |