Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24699/src/net/sourceforge/bprocessor/gl/view
Modified Files:
Display.java
Log Message:
Added displaylists to display but deactivated them for now
Index: Display.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** Display.java 26 Oct 2007 08:58:40 -0000 1.42
--- Display.java 29 Oct 2007 18:14:37 -0000 1.43
***************
*** 11,14 ****
--- 11,15 ----
import java.util.Collection;
import java.util.Collections;
+ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
***************
*** 90,93 ****
--- 91,102 ----
private static byte[] highlight = new byte[128];
+
+
+ private static Map<Geometric, Integer> displayLists =
+ new HashMap<Geometric, Integer>();
+ private static Map<Geometric, Integer> displayListsSelecting =
+ new HashMap<Geometric, Integer>();
+
+ private static final boolean USEDL = false;
/**
***************
*** 513,516 ****
--- 522,535 ----
}
glu.gluTessEndPolygon(tesselator);
+ /*
+ List<Vertex> vertices = surface.getVertices();
+ int index = 0;
+ if (surface.getNormals() != null) {
+ for (Vertex v : surface.getNormals()) {
+ Vertex v0 = vertices.get(index);
+ draw(new Edge(v0.add(v), v0));
+ index++;
+ }
+ }*/
}
***************
*** 768,771 ****
--- 787,824 ----
private static void draw(Space space, boolean inside) {
+ if (space.isUnion()) {
+ CoordinateSystem cs = space.getCoordinateSystems().iterator().next();
+ Vertex translation = cs.center();
+ gl.glPushMatrix();
+ gl.glTranslated(translation.getX(), translation.getY(), translation.getZ());
+ }
+ if (space.isLocked() && USEDL) {
+ if (selecting) {
+ Integer index = displayListsSelecting.get(space);
+ if (index != null) {
+ gl.glCallList(index);
+ return;
+ } else {
+ //if there aint any start generation of one
+ index = gl.glGenLists(1);
+ displayListsSelecting.put(space, index);
+ System.out.println(index + " for " + space);
+ gl.glNewList(index, GL.GL_COMPILE_AND_EXECUTE);
+ }
+ } else {
+ //Locate displaylist for space and draw it
+ Integer index = displayLists.get(space);
+ if (index != null) {
+ gl.glCallList(index);
+ return;
+ } else {
+ //if there aint any start generation of one
+ index = gl.glGenLists(1);
+ displayLists.put(space, index);
+ System.out.println(index + " for " + space);
+ gl.glNewList(index, GL.GL_COMPILE_AND_EXECUTE);
+ }
+ }
+ }
Set<Geometric> hidden = new HashSet();
hidden.addAll(camera.getHiddenGeometrics());
***************
*** 885,893 ****
}
}
!
! for (Constructor current : space.getConstructors()) {
! if (!hidden.contains(current)) {
! constructors.add(current);
}
}
}
--- 938,949 ----
}
}
! Space work = space;
! while (work != null) {
! for (Constructor current : work.getConstructors()) {
! if (!hidden.contains(current)) {
! constructors.add(current);
! }
}
+ work = (Space)work.parent();
}
}
***************
*** 966,973 ****
}
}
!
for (Space current : elements) {
draw(current, inside || (current == active));
}
}
--- 1022,1035 ----
}
}
! if (space.isLocked() && USEDL) {
! //will only reach here if a displaylist are being generated
! gl.glEndList();
! }
for (Space current : elements) {
draw(current, inside || (current == active));
}
+ if (space.isUnion()) {
+ gl.glPopMatrix();
+ }
}
|