[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.281, 1.282 Display.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2008-09-09 12:14:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8494/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Display.java Log Message: Improved clipping Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** Display.java 22 Jul 2008 13:19:52 -0000 1.81 --- Display.java 9 Sep 2008 12:15:03 -0000 1.82 *************** *** 61,64 **** --- 61,66 ---- private static Collection<? extends Geometric> extras; private static Collection<GlObject> glos; + private static Collection<ClippingPlane> clips; + private static Map<Geometric, float[]> colors; private static float[] targetColor; *************** *** 71,74 **** --- 73,77 ---- private static Collection<Geometric> excluded; + private static Project project; private static Camera camera; *************** *** 344,349 **** /** ! * Sets the glos ! * @param value glos */ public static void glos(Collection<GlObject> value) { --- 347,352 ---- /** ! * Sets the list of GLObjects ! * @param value List of GLObjects */ public static void glos(Collection<GlObject> value) { *************** *** 353,357 **** /** * Sets the extras geometry ! * @param value Collection of geometrics */ public static void extras(Collection<? extends Geometric> value) { --- 356,360 ---- /** * Sets the extras geometry ! * @param value Collection of Geometric */ public static void extras(Collection<? extends Geometric> value) { *************** *** 359,362 **** --- 362,373 ---- } + /** + * Sets the clips parameter + * @param value List of ClippingPlanes + */ + public static void clips(Collection<ClippingPlane> value) { + clips = value; + } + private static void push(Object object) { objects.add(object); *************** *** 372,376 **** */ private static void disableClipplanes() { - Collection<ClippingPlane> clips = Project.getInstance().getCurrentCamera().getClipplanes(); for (ClippingPlane current : clips) { if (current.isActive()) { --- 383,386 ---- *************** *** 387,391 **** */ private static void enableClipplanes() { - Collection<ClippingPlane> clips = Project.getInstance().getCurrentCamera().getClipplanes(); for (ClippingPlane current : clips) { if (current.isActive()) { --- 397,400 ---- *************** *** 554,561 **** gl.glEnable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK); - // System.out.println("-- front --"); for (Surface current : surfaces) { Vertex n = current.normal(); - // System.out.println(" normal: " + n); gl.glNormal3d(n.getX(), n.getY(), n.getZ()); float[] color = frontColor(current); --- 563,568 ---- *************** *** 566,573 **** } } - // System.out.println("-- back --"); for (Surface current : surfaces) { Vertex n = current.normal(); - // System.out.println(" normal: " + n); gl.glNormal3d(-n.getX(), -n.getY(), -n.getZ()); float[] color = backColor(current); --- 573,578 ---- *************** *** 903,906 **** --- 908,922 ---- } + private static boolean clipped(Surface surface) { + for (ClippingPlane current : clips) { + if (current.isActive()) { + if (current.contains(surface)) { + return true; + } + } + } + return false; + } + private static boolean active(Container space) { if (space == null) { *************** *** 1027,1035 **** if (transparency) { if (!hidden.contains(current)) { ! surfaces.add(current); } } else { if (!transparent(current)) { ! surfaces.add(current); } } --- 1043,1055 ---- if (transparency) { if (!hidden.contains(current)) { ! if (!clipped(current)) { ! surfaces.add(current); ! } } } else { if (!transparent(current)) { ! if (!clipped(current)) { ! surfaces.add(current); ! } } } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.281 retrieving revision 1.282 diff -C2 -d -r1.281 -r1.282 *** View.java 29 Aug 2008 12:27:40 -0000 1.281 --- View.java 9 Sep 2008 12:15:03 -0000 1.282 *************** *** 640,643 **** --- 640,649 ---- extras.addAll(tempVertices); Display.extras(extras); + + Collection<ClippingPlane> clips + = Project.getInstance().getCurrentCamera().getClipplanes(); + + Display.clips(clips); + Display.glos(glObjects3D); try { *************** *** 655,660 **** //draw the clipping planes ! Collection<ClippingPlane> clips ! = Project.getInstance().getCurrentCamera().getClipplanes(); for (ClippingPlane current : clips) { --- 661,665 ---- //draw the clipping planes ! for (ClippingPlane current : clips) { |