[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java,1.31,1.32
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-12-15 12:38:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30453/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: clipping planes use alpha and the depth buffer now uses <= and not < Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** View.java 14 Dec 2005 14:36:17 -0000 1.31 --- View.java 15 Dec 2005 12:38:06 -0000 1.32 *************** *** 91,95 **** /** Used for clipping planes */ ! public static final float[] CLIP_PLANE_COLOR = new float[] {1.0f, 0.65f, 0.0f}; /** Used for target objects */ --- 91,95 ---- /** Used for clipping planes */ ! public static final float[] CLIP_PLANE_COLOR = new float[] {1.0f, 0.65f, 0.0f, 0.3f}; /** Used for target objects */ *************** *** 99,102 **** --- 99,111 ---- public static final float [] CONSTRUCTOR_COLOR = new float[] {0.8f, 0.7f, 0.6f, 0.50f}; + /** Front color for surfaces */ + protected static float[] frontCcolor = new float[] {0.96f, 0.87f, 0.70f}; + + /** NONE color for surfaces */ + protected static float[] noneColor = new float[] {0.70f, 0.70f, 0.70f}; + + /** Back color for surfaces */ + protected static float[] backColor = new float[] {0.94f, 0.97f, 1.00f}; + /** Select mode for selecting edges */ private static final int EDGES = 0; *************** *** 133,137 **** /** The size of the viewing area */ ! protected static double size = 25.0; /** The Active edge */ --- 142,146 ---- /** The size of the viewing area */ ! protected static double gridSize = 25.0; /** The Active edge */ *************** *** 171,186 **** /** The current constructor color */ protected static float[] constructorColor; - - /** Front color for surfaces */ - protected static float[] frontCcolor = new float[] {0.96f, 0.87f, 0.70f}; - - /** NONE color for surfaces */ - protected static float[] noneColor = new float[] {0.70f, 0.70f, 0.70f}; - - /** Back color for surfaces */ - protected static float[] backColor = new float[] {0.94f, 0.97f, 1.00f}; /** The target */ - protected static Object target = null; --- 180,185 ---- *************** *** 390,395 **** gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! //gl.glDepthMask(true); ! gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); --- 389,395 ---- gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! gl.glDepthMask(true); ! gl.glDepthFunc(GL.GL_LEQUAL); ! gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); *************** *** 424,446 **** // grid and coords are always completely lit - gl.glDisable(GL.GL_DEPTH_TEST); gl.glLineWidth(1.0f); grid(); - gl.glLineWidth(1.0f); - gl.glEnable(GL.GL_DEPTH_TEST); - gl.glDepthFunc(GL.GL_LESS); coords(); - - // draw the clipping planes - Iterator clipit = clippingPlanes.iterator(); - gl.glEnable(GL.GL_POLYGON_STIPPLE); - gl.glPolygonStipple(highlight); - while (clipit.hasNext()) { - ClippingPlane cp = (ClippingPlane)clipit.next(); - drawClipplane(cp); - } - gl.glDisable(GL.GL_POLYGON_STIPPLE); ! clipit = clippingPlanes.iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); --- 424,432 ---- // grid and coords are always completely lit gl.glLineWidth(1.0f); grid(); coords(); ! Iterator clipit = clippingPlanes.iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); *************** *** 452,455 **** --- 438,442 ---- gl.glLineWidth(1.0f); drawAll(gld); + gl.glEnable(GL.GL_DEPTH_TEST); clipit = clippingPlanes.iterator(); *************** *** 458,462 **** gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); } ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 445,456 ---- gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); } ! ! clipit = clippingPlanes.iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! // draw the clipping planes ! drawClipplane(cp); ! } ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 1074,1078 **** Collection corners = clipplane.getCorners(); { ! gl.glColor3fv(CLIP_PLANE_COLOR); gl.glBegin(GL.GL_QUADS); gl.glNormal3d(d[0], d[1], d[2]); --- 1068,1072 ---- Collection corners = clipplane.getCorners(); { ! gl.glColor4fv(CLIP_PLANE_COLOR); gl.glBegin(GL.GL_QUADS); gl.glNormal3d(d[0], d[1], d[2]); *************** *** 2072,2076 **** */ protected void grid() { ! double size = this.size; if (aspect > 1) { size *= aspect; --- 2066,2070 ---- */ protected void grid() { ! double size = View.gridSize; if (aspect > 1) { size *= aspect; *************** *** 2079,2092 **** } gl.glColor4fv(gridColor); gl.glBegin(GL.GL_LINES); size /= 2; for (int x = -(int)size; x <= (int)size; x++) { ! gl.glVertex3d((double) x * 2, -size * 2, -0.01); ! gl.glVertex3d((double) x * 2, size * 2, -0.01); } for (int y = -(int)size; y <= (int)size; y++) { ! gl.glVertex3d(-size * 2, (double) y * 2, -0.01); ! gl.glVertex3d(size * 2, (double) y * 2, -0.01); } gl.glEnd(); --- 2073,2087 ---- } gl.glColor4fv(gridColor); + gl.glDisable(GL.GL_DEPTH_TEST); gl.glBegin(GL.GL_LINES); size /= 2; for (int x = -(int)size; x <= (int)size; x++) { ! gl.glVertex3d((double) x * 2, -size * 2, 0); ! gl.glVertex3d((double) x * 2, size * 2, 0); } for (int y = -(int)size; y <= (int)size; y++) { ! gl.glVertex3d(-size * 2, (double) y * 2, 0); ! gl.glVertex3d(size * 2, (double) y * 2, 0); } gl.glEnd(); *************** *** 2097,2101 **** */ protected void coords() { ! double size = View.size; if (aspect > 1) { size *= aspect; --- 2092,2096 ---- */ protected void coords() { ! double size = View.gridSize; if (aspect > 1) { size *= aspect; *************** *** 2104,2107 **** --- 2099,2103 ---- } gl.glBegin(GL.GL_LINES); + gl.glDisable(GL.GL_DEPTH_TEST); gl.glColor3fv(X_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); *************** *** 2110,2113 **** --- 2106,2112 ---- gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, size, 0.0); + gl.glEnd(); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glBegin(GL.GL_LINES); gl.glColor3fv(Z_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); |