[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view Display.java, 1.33, 1.34
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-15 08:18:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8725/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Improved hit-detection Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Display.java 12 Oct 2007 14:34:34 -0000 1.33 --- Display.java 15 Oct 2007 08:18:26 -0000 1.34 *************** *** 485,489 **** drawContour(surface, reverse); for (Surface current : surface.getHoles()) { ! drawContour(current, false); } glu.gluTessEndPolygon(tesselator); --- 485,491 ---- drawContour(surface, reverse); for (Surface current : surface.getHoles()) { ! if (surface.getOwner() == current.getOwner()) { ! drawContour(current, false); ! } } glu.gluTessEndPolygon(tesselator); *************** *** 719,871 **** Collection<Constructor> constructors = new LinkedList(); ! for (Space current : space.getElements()) { ! if (!hidden.contains(current)) { ! elements.add(current); } } { ! Set<Surface> visible = new HashSet(); ! for (Space current : elements) { ! visible.addAll(current.getEnvelope()); ! } ! for (Surface current : visible) { if (!hidden.contains(current)) { ! surfaces.add(current); } } ! } ! { ! Set<Edge> visible = new HashSet(); ! for (Surface current : surfaces) { ! visible.addAll(current.getEdges()); ! for (Surface hole : current.getHoles()) { ! visible.addAll(hole.getEdges()); } ! } ! for (Edge current : visible) { ! if (!hidden.contains(current)) { ! edges.add(current); } } ! ! // FIXME the set of edges not connected ! // to a surface should be cashed. ! Set<Edge> mark = new HashSet(); ! for (Surface current : space.getSurfaces()) { ! mark.addAll(current.getEdges()); ! } ! for (Edge current : space.getEdges()) { ! if (!mark.contains(current)) { if (!hidden.contains(current)) { edges.add(current); } } ! } ! } ! ! { ! if (selecting() || (space instanceof Net && space == active)) { ! Set<Vertex> visible = new HashSet(); ! for (Edge current : edges) { ! visible.add(current.getFrom()); ! visible.add(current.getTo()); } ! for (Vertex current : visible) { ! if (!hidden.contains(current)) { ! vertices.add(current); } } } ! ! //FIXME: The set of lonely vertices should be cached. ! Set<Vertex> mark = new HashSet(); ! for (Edge current : space.getEdges()) { ! mark.add(current.getFrom()); ! mark.add(current.getTo()); ! } ! for (Vertex current : space.getVertices()) { ! if (!mark.contains(current)) { ! if (!hidden.contains(current)) { ! vertices.add(current); } } } ! } ! ! for (Constructor current : space.getConstructors()) { ! if (!hidden.contains(current)) { ! constructors.add(current); } } - - gl.glEnable(GL.GL_DEPTH_TEST); ! if (selecting()) { ! if (inside) { ! if (mode != View.WIREFRAME_MODE) { ! selectSurfaces(surfaces, transparency); } ! } ! if (inside || (intersecting() && !(active instanceof Net))) { ! selectEdges(edges); ! } ! if (construction()) { ! selectConstructors(constructors); ! } ! } else { ! if (inside) { ! if (mode == View.SOLID_MODE) { ! paintSurfaces(surfaces, alice); ! } else if (mode == View.LIGHTING_MODE) { ! paintSurfaces(surfaces, transparency); ! } else if (mode == View.WIREFRAME_MODE) { ! // do not paint surfaces } - } - if (active == space) { if (construction()) { ! gl.glDepthMask(false); ! draw(grid); ! paintConstructors(constructors); ! gl.glDepthMask(true); } - } - Collection<Edge> stippled = new LinkedList(); - Collection<Edge> normal = new LinkedList(); - split(edges, normal, stippled); - - float size; - float[] color; - - if (space instanceof Net) { - size = 2.0f; - } else { - size = 1.0f; - } - if (inside) { - color = black; } else { ! color = grey; ! } ! paintEdges(normal, color, size); ! paintStippled(stippled, middleblue, size); ! } ! ! gl.glDisable(GL.GL_DEPTH_TEST); ! ! if (selecting()) { ! if (inside || intersecting()) { ! selectVertices(vertices); } ! } else { ! float[] color; ! if (space instanceof Net) { ! color = middleblue; } else { ! color = black; } - paintVertices(vertices, color, 9.0f); } ! for (Space current : elements) { draw(current, inside || (current == active)); --- 721,905 ---- Collection<Constructor> constructors = new LinkedList(); ! boolean interior; ! ! if (selecting) { ! if (!intersecting && transparency) { ! if (space == active) { ! interior = true; ! } else { ! interior = false; ! } ! } else { ! interior = true; } + } else { + interior = true; } + { ! // Geometry collection ! ! for (Space current : space.getElements()) { if (!hidden.contains(current)) { ! elements.add(current); } } ! { ! Set<Surface> visible = new HashSet(); ! for (Space current : elements) { ! visible.addAll(current.getEnvelope()); } ! for (Surface current : visible) { ! if (transparency) { ! if (!hidden.contains(current)) { ! surfaces.add(current); ! } ! } else { ! if (!transparent(current)) { ! surfaces.add(current); ! } ! } } } ! { ! Set<Edge> visible = new HashSet(); ! for (Surface current : surfaces) { ! visible.addAll(current.getEdges()); ! for (Surface hole : current.getHoles()) { ! if (current.getOwner() == hole.getOwner()) { ! visible.addAll(hole.getEdges()); ! } ! } ! } ! for (Edge current : visible) { if (!hidden.contains(current)) { edges.add(current); } } ! ! // FIXME the set of edges not connected ! // to a surface should be cashed. ! Set<Edge> mark = new HashSet(); ! for (Surface current : space.getSurfaces()) { ! mark.addAll(current.getEdges()); } ! for (Edge current : space.getEdges()) { ! if (!mark.contains(current)) { ! if (!hidden.contains(current)) { ! edges.add(current); ! } } } } ! ! { ! if (selecting() || (space instanceof Net && space == active)) { ! Set<Vertex> visible = new HashSet(); ! for (Edge current : edges) { ! visible.add(current.getFrom()); ! visible.add(current.getTo()); ! } ! for (Vertex current : visible) { ! if (!hidden.contains(current)) { ! vertices.add(current); ! } ! } ! } ! ! //FIXME: The set of lonely vertices should be cached. ! Set<Vertex> mark = new HashSet(); ! for (Edge current : space.getEdges()) { ! mark.add(current.getFrom()); ! mark.add(current.getTo()); ! } ! for (Vertex current : space.getVertices()) { ! if (!mark.contains(current)) { ! if (!hidden.contains(current)) { ! vertices.add(current); ! } } } } ! ! for (Constructor current : space.getConstructors()) { ! if (!hidden.contains(current)) { ! constructors.add(current); ! } } } ! if (interior) { ! // Geometry rendering ! ! gl.glEnable(GL.GL_DEPTH_TEST); ! ! if (selecting()) { ! if (inside) { ! if (mode != View.WIREFRAME_MODE) { ! selectSurfaces(surfaces, transparency); ! } } ! if (inside || (intersecting() && !(active instanceof Net))) { ! selectEdges(edges); } if (construction()) { ! selectConstructors(constructors); } } else { ! if (inside) { ! if (mode == View.SOLID_MODE) { ! paintSurfaces(surfaces, alice); ! } else if (mode == View.LIGHTING_MODE) { ! paintSurfaces(surfaces, transparency); ! } else if (mode == View.WIREFRAME_MODE) { ! // do not paint surfaces ! } ! } ! if (active == space) { ! if (construction()) { ! gl.glDepthMask(false); ! draw(grid); ! paintConstructors(constructors); ! gl.glDepthMask(true); ! } ! } ! Collection<Edge> stippled = new LinkedList(); ! Collection<Edge> normal = new LinkedList(); ! split(edges, normal, stippled); ! ! float size; ! float[] color; ! ! if (space instanceof Net) { ! size = 2.0f; ! } else { ! size = 1.0f; ! } ! if (inside) { ! color = black; ! } else { ! color = grey; ! } ! paintEdges(normal, color, size); ! paintStippled(stippled, middleblue, size); } ! ! gl.glDisable(GL.GL_DEPTH_TEST); ! ! if (selecting()) { ! if (inside || intersecting()) { ! selectVertices(vertices); ! } } else { ! float[] color; ! if (space instanceof Net) { ! color = middleblue; ! } else { ! color = black; ! } ! paintVertices(vertices, color, 9.0f); } } ! for (Space current : elements) { draw(current, inside || (current == active)); |