[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view Display.java, 1.101, 1.102 PopupMenu.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-02-26 13:48:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12243/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java PopupMenu.java Log Message: Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** Display.java 5 Feb 2010 13:32:59 -0000 1.101 --- Display.java 26 Feb 2010 13:48:12 -0000 1.102 *************** *** 145,148 **** --- 145,156 ---- } } + + private static void enable(int what) { + gl.glEnable(what); + } + + private static void disable(int what) { + gl.glDisable(what); + } private static class TesselatorCallback extends GLUtessellatorCallbackAdapter { *************** *** 446,452 **** private static void paintStippled(Collection<Edge> edges, float[] color, float size) { if (!edges.isEmpty()) { ! gl.glEnable(GL.GL_LINE_STIPPLE); paintEdges(edges, color, size); ! gl.glDisable(GL.GL_LINE_STIPPLE); } } --- 454,460 ---- private static void paintStippled(Collection<Edge> edges, float[] color, float size) { if (!edges.isEmpty()) { ! enable(GL.GL_LINE_STIPPLE); paintEdges(edges, color, size); ! disable(GL.GL_LINE_STIPPLE); } } *************** *** 488,492 **** private static void paintSurfaces(Collection<Surface> surfaces, float[] color) { if (edgesEnabled) { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); gl.glPolygonOffset(1.0f, 1.0f); } --- 496,500 ---- private static void paintSurfaces(Collection<Surface> surfaces, float[] color) { if (edgesEnabled) { ! enable(GL.GL_POLYGON_OFFSET_FILL); gl.glPolygonOffset(1.0f, 1.0f); } *************** *** 498,502 **** } if (edgesEnabled) { ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } } --- 506,510 ---- } if (edgesEnabled) { ! disable(GL.GL_POLYGON_OFFSET_FILL); } } *************** *** 513,524 **** private static void paintSurfaces(Collection<Surface> surfaces, boolean transparency) { ! gl.glEnable(GL.GL_LIGHTING); gl.glShadeModel(GL.GL_SMOOTH); if (edgesEnabled) { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); gl.glPolygonOffset(1.0f, 1.0f); } ! gl.glEnable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK); for (Surface current : surfaces) { --- 521,532 ---- private static void paintSurfaces(Collection<Surface> surfaces, boolean transparency) { ! enable(GL.GL_LIGHTING); gl.glShadeModel(GL.GL_SMOOTH); if (edgesEnabled) { ! enable(GL.GL_POLYGON_OFFSET_FILL); gl.glPolygonOffset(1.0f, 1.0f); } ! enable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK); for (Surface current : surfaces) { *************** *** 543,550 **** } if (edgesEnabled) { ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_LIGHTING); } --- 551,558 ---- } if (edgesEnabled) { ! disable(GL.GL_POLYGON_OFFSET_FILL); } ! disable(GL.GL_CULL_FACE); ! disable(GL.GL_LIGHTING); } *************** *** 663,670 **** private static void paint(Line line, float[] color) { gl.glLineWidth(1.0f); ! gl.glEnable(GL.GL_LINE_STIPPLE); gl.glColor3fv(color, 0); draw(line); ! gl.glDisable(GL.GL_LINE_STIPPLE); } --- 671,678 ---- private static void paint(Line line, float[] color) { gl.glLineWidth(1.0f); ! enable(GL.GL_LINE_STIPPLE); gl.glColor3fv(color, 0); draw(line); ! disable(GL.GL_LINE_STIPPLE); } *************** *** 736,740 **** Vertex direction = to.minus(from); double dist = direction.length() * 16; ! gl.glEnable(GL.GL_LIGHTING); GLUquadric quad = glu.gluNewQuadric(); glu.gluQuadricNormals(quad, GLU.GLU_SMOOTH); --- 744,748 ---- Vertex direction = to.minus(from); double dist = direction.length() * 16; ! enable(GL.GL_LIGHTING); GLUquadric quad = glu.gluNewQuadric(); glu.gluQuadricNormals(quad, GLU.GLU_SMOOTH); *************** *** 746,750 **** glu.gluCylinder(quad, (dist / 90), 0, (dist / 20), 10, 10); gl.glPopMatrix(); ! gl.glDisable(GL.GL_LIGHTING); } --- 754,758 ---- glu.gluCylinder(quad, (dist / 90), 0, (dist / 20), 10, 10); gl.glPopMatrix(); ! disable(GL.GL_LIGHTING); } *************** *** 788,794 **** for (Edge current : lines) { if (current.getStrippled()) { ! gl.glEnable(GL.GL_LINE_STIPPLE); draw(current); ! gl.glDisable(GL.GL_LINE_STIPPLE); } else { draw(current); --- 796,802 ---- for (Edge current : lines) { if (current.getStrippled()) { ! enable(GL.GL_LINE_STIPPLE); draw(current); ! disable(GL.GL_LINE_STIPPLE); } else { draw(current); *************** *** 1006,1010 **** } } ! long t0 = System.currentTimeMillis(); long tc0 = System.currentTimeMillis(); --- 1014,1018 ---- } } ! long t0 = System.currentTimeMillis(); long tc0 = System.currentTimeMillis(); *************** *** 1121,1125 **** // Geometry rendering ! gl.glEnable(GL.GL_DEPTH_TEST); if (selecting()) { --- 1129,1133 ---- // Geometry rendering ! enable(GL.GL_DEPTH_TEST); if (selecting()) { *************** *** 1195,1199 **** } ! gl.glDisable(GL.GL_DEPTH_TEST); if (selecting()) { --- 1203,1207 ---- } ! disable(GL.GL_DEPTH_TEST); if (selecting()) { *************** *** 1258,1265 **** private static void hilite(Collection<Geometric> geometrics) { ! gl.glEnable(GL.GL_DEPTH_TEST); gl.glColor3fv(View.SELECTED_COLOR, 0); gl.glLineWidth(3.0f); ! gl.glEnable(GL.GL_POLYGON_STIPPLE); gl.glPolygonStipple(highlight, 0); --- 1266,1274 ---- private static void hilite(Collection<Geometric> geometrics) { ! enable(GL.GL_DEPTH_TEST); ! gl.glColor3fv(View.SELECTED_COLOR, 0); gl.glLineWidth(3.0f); ! enable(GL.GL_POLYGON_STIPPLE); gl.glPolygonStipple(highlight, 0); *************** *** 1280,1288 **** Item space = (Item) current; Collection<Edge> edges = space.hiliteEdges(); ! paintEdges(edges, View.SELECTED_COLOR, 2.0f); } } ! gl.glEnable(GL.GL_LINE_STIPPLE); gl.glLineWidth(3.0f); for (Geometric current : geometrics) { --- 1289,1299 ---- Item space = (Item) current; Collection<Edge> edges = space.hiliteEdges(); ! gl.glDepthMask(false); ! paintEdges(edges, View.SELECTED_COLOR, 5.0f); ! gl.glDepthMask(true); } } ! enable(GL.GL_LINE_STIPPLE); gl.glLineWidth(3.0f); for (Geometric current : geometrics) { *************** *** 1291,1298 **** } } ! gl.glDisable(GL.GL_LINE_STIPPLE); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); ! gl.glDisable(GL.GL_DEPTH_TEST); for (Geometric current : geometrics) { --- 1302,1309 ---- } } ! disable(GL.GL_LINE_STIPPLE); ! disable(GL.GL_POLYGON_STIPPLE); ! disable(GL.GL_DEPTH_TEST); for (Geometric current : geometrics) { *************** *** 1332,1340 **** } } ! gl.glEnable(GL.GL_LINE_STIPPLE); for (Edge edge : stippled) { draw(edge); } ! gl.glDisable(GL.GL_LINE_STIPPLE); } --- 1343,1351 ---- } } ! enable(GL.GL_LINE_STIPPLE); for (Edge edge : stippled) { draw(edge); } ! disable(GL.GL_LINE_STIPPLE); } *************** *** 1395,1398 **** --- 1406,1432 ---- Space world = project.world(); grid = world.getGrid(); + + if (!selecting()) { + disableClipplanes(); + Collection<Geometric> geometrics = new HashSet(); + geometrics.addAll(Selection.primary()); + if (target != null) { + Collection<Geometric> hilite = new HashSet(); + hilite.add(target); + hilite(hilite); + } + if (active.isInstance()) { + gl.glPushMatrix(); + translateToCoordinatesystem((Instance) active); + } + + hilite(geometrics); + + if (active.isInstance()) { + gl.glPopMatrix(); + } + enableClipplanes(); + } + draw(world, world == active); *************** *** 1450,1474 **** } ! if (!selecting()) { ! disableClipplanes(); ! Collection<Geometric> geometrics = new HashSet(); ! geometrics.addAll(Selection.primary()); ! if (target != null) { ! Collection<Geometric> hilite = new HashSet(); ! hilite.add(target); ! hilite(hilite); ! } ! if (active.isInstance()) { ! gl.glPushMatrix(); ! translateToCoordinatesystem((Instance) active); ! } ! ! hilite(geometrics); ! ! if (active.isInstance()) { ! gl.glPopMatrix(); ! } ! enableClipplanes(); ! } } } --- 1484,1488 ---- } ! } } Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** PopupMenu.java 25 Feb 2010 14:43:52 -0000 1.40 --- PopupMenu.java 26 Feb 2010 13:48:12 -0000 1.41 *************** *** 402,405 **** --- 402,409 ---- AbstractAction action = new SpaceMenuAction(sp, "Make Component") { public void actionPerformed(ActionEvent event) { + CoordinateSystem system = space.getHandle(); + if (system == null) { + space.add(Project.getInstance().getActiveCoordinateSystem().copy()); + } Component component = new Component(space); space.getOwner().remove(space); |