[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view Display.java, 1.102, 1.103 PopupMenu.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-03-09 13:02:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7495/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.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Display.java 26 Feb 2010 13:48:12 -0000 1.102 --- Display.java 9 Mar 2010 13:01:53 -0000 1.103 *************** *** 52,56 **** private static final boolean TRUE = true; - private static boolean initialized; private static boolean selecting; --- 52,55 ---- *************** *** 74,83 **** private static Collection<Geometric> excluded; - private static Project project; private static Camera camera; private static Item active; - private static float hilitesize = 9.0f; private static float normalsize = 7.0f; --- 73,80 ---- *************** *** 99,107 **** private static byte[] highlight = new byte[128]; ! ! private static Map<Geometric, Integer> displayLists = ! new HashMap<Geometric, Integer>(); ! ! private static final boolean USEDL = false; /** --- 96,103 ---- private static byte[] highlight = new byte[128]; ! private static Map<Geometric, Integer> shadedLines = new HashMap<Geometric, Integer>(); ! private static Map<Geometric, Integer> shaded = new HashMap<Geometric, Integer>(); ! private static Map<Geometric, Integer> solid = new HashMap<Geometric, Integer>(); ! private static Map<Geometric, Integer> wire = new HashMap<Geometric, Integer>(); /** *************** *** 930,955 **** } } ! ! private static void drawInstance(Instance space, boolean inside) { gl.glPushMatrix(); ! if (space == active) { ! paint(space.getAnchor()); } else { ! // paint(space.getAnchor()); } translateToCoordinatesystem(space); ! if (USEDL && inside) { ! Space work = space.getProto(); ! Integer index = displayLists.get(work); ! if (index != null) { ! gl.glCallList(index); ! gl.glPopMatrix(); ! return; ! } else { ! index = gl.glGenLists(1); ! displayLists.put(work, index); ! gl.glNewList(index, GL.GL_COMPILE_AND_EXECUTE); } } boolean activeSet = false; if (selecting()) { --- 926,995 ---- } } ! ! private static void renderInstance(Instance space, boolean inside) { ! if (Project.useDisplayLists()) { ! drawInstanceFast(space, inside); ! } else { ! drawInstanceSlow(space, inside); ! } ! } ! ! private static void drawInstanceFast(Instance space, boolean inside) { ! Map<Geometric, Integer> lists = null; ! ! if (mode == View.SOLID_MODE) { ! lists = solid; ! } else if (mode == View.LIGHTING_MODE) { ! if (edgesEnabled) { ! lists = shadedLines; ! } else { ! lists = shaded; ! } ! } else if (mode == View.WIREFRAME_MODE) { ! lists = wire; ! } ! gl.glPushMatrix(); ! translateToCoordinatesystem(space); ! Space work = space.getProto(); ! Integer index = lists.get(work); ! if (index != null) { ! gl.glCallList(index); ! gl.glPopMatrix(); ! return; } else { ! index = gl.glGenLists(1); ! lists.put(work, index); ! gl.glNewList(index, GL.GL_COMPILE_AND_EXECUTE); } + drawSpace(space.getProto(), inside || space == active); + gl.glEndList(); + gl.glPopMatrix(); + } + + private static void drawInstanceSlow(Instance space, boolean inside) { + gl.glPushMatrix(); translateToCoordinatesystem(space); ! drawSpace(space.getProto(), inside || space == active); ! gl.glPopMatrix(); ! } ! ! private static void drawInstance(Instance space, boolean inside) { ! if (Project.useDisplayLists()) { ! if (selecting()) { ! push(space); ! } ! drawInstanceFast(space, inside); ! if (selecting()) { ! pop(); } + } else { + drawInstanceOriginal(space, inside); } + } + + private static void drawInstanceOriginal(Instance space, boolean inside) { + gl.glPushMatrix(); + translateToCoordinatesystem(space); boolean activeSet = false; if (selecting()) { *************** *** 977,988 **** } } - - if (USEDL && inside) { - //will only reach here if a displaylist are being generated - gl.glEndList(); - } gl.glPopMatrix(); } ! private static void drawSpace(Space space, boolean inside) { Set<Geometric> hidden = new HashSet(); --- 1017,1023 ---- } } gl.glPopMatrix(); } ! private static void drawSpace(Space space, boolean inside) { Set<Geometric> hidden = new HashSet(); *************** *** 994,997 **** --- 1029,1038 ---- Collection<Vertex> vertices = new LinkedList(); Collection<Constructor> constructors = new LinkedList(); + + boolean displayEdges = true; + + if (mode == View.LIGHTING_MODE) { + displayEdges = edgesEnabled; + } boolean interior; *************** *** 1051,1055 **** } ! if (edgesEnabled) { Set<Edge> visible = new HashSet(); for (Surface current : surfaces) { --- 1092,1096 ---- } ! if (displayEdges) { Set<Edge> visible = new HashSet(); for (Surface current : surfaces) { *************** *** 1068,1074 **** } } - - // FIXME the set of edges not connected - // to a surface should be cashed. Set<Edge> mark = new HashSet(); for (Surface current : space.getSurfaces()) { --- 1109,1112 ---- *************** *** 1225,1229 **** long stime = ts1 - ts0; long etime = te1 - te0; ! if (overall > 1000) { System.out.println(space + " all: " + overall); System.out.println("c: " + ctime + " s: " + stime + " e: " + etime); --- 1263,1267 ---- long stime = ts1 - ts0; long etime = te1 - te0; ! if (overall > 100) { System.out.println(space + " all: " + overall); System.out.println("c: " + ctime + " s: " + stime + " e: " + etime); Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** PopupMenu.java 26 Feb 2010 13:48:12 -0000 1.41 --- PopupMenu.java 9 Mar 2010 13:01:53 -0000 1.42 *************** *** 1054,1058 **** /** {@inheritDoc} */ public JPopupMenu menuFor(Entity entity) { - System.out.println("get menu for " + entity); Collection<Entity> c = new LinkedList<Entity>(); c.add(entity); --- 1054,1057 ---- |