[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view AbstractView.java,1.59,1.60
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-11-23 19:04:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25725 Modified Files: AbstractView.java Log Message: added support for customizable colors Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** AbstractView.java 20 Nov 2005 19:33:52 -0000 1.59 --- AbstractView.java 23 Nov 2005 19:04:38 -0000 1.60 *************** *** 84,87 **** --- 84,96 ---- protected static Vertex currentVertex = null; + /** The current background color */ + protected static float[] bgColor; + + /** The current line color */ + protected static float[] lineColor; + + /** The current grid color */ + protected static float[] gridColor; + /** The target */ *************** *** 225,228 **** --- 234,240 ---- this.glv = glv; clippingPlanes = new ArrayList(); + bgColor = BACKGROUND_COLOR; + lineColor = STD_LINE_COLOR; + gridColor = GRID_COLOR; } *************** *** 243,247 **** AbstractView.aspect = AbstractView.width / AbstractView.height; ! gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); gl.glLineStipple(4, (short)0xAAAA); --- 255,259 ---- AbstractView.aspect = AbstractView.width / AbstractView.height; ! gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); gl.glViewport(0, 0, (int)width, (int)height); gl.glLineStipple(4, (short)0xAAAA); *************** *** 270,273 **** --- 282,286 ---- */ public void display(GLDrawable gld) { + gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); Plane xy = new Plane(0, 0, 1, 0); gl = gld.getGL(); *************** *** 317,321 **** } ! gl.glColor3fv(STD_LINE_COLOR); gl.glLineWidth(1.0f); drawAll(gld); --- 330,334 ---- } ! gl.glColor3fv(lineColor); gl.glLineWidth(1.0f); drawAll(gld); *************** *** 662,666 **** if (doDrawEdges) { gl.glLineWidth(1.0f); ! gl.glColor3fv(STD_LINE_COLOR); // draw all the edges in the model Iterator eit = edges.iterator(); --- 675,679 ---- if (doDrawEdges) { gl.glLineWidth(1.0f); ! gl.glColor3fv(lineColor); // draw all the edges in the model Iterator eit = edges.iterator(); *************** *** 673,682 **** // Draw any Vertex that are not part of an edge { ! gl.glColor3fv(STD_LINE_COLOR); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); if (v.getEdges().isEmpty()) { ! gl.glColor3fv(STD_LINE_COLOR); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); --- 686,695 ---- // Draw any Vertex that are not part of an edge { ! gl.glColor3fv(lineColor); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); *************** *** 751,755 **** gl.glColor3fv(Z_AXIS_COLOR); } else { ! gl.glColor3fv(STD_LINE_COLOR); } gl.glBegin(GL.GL_LINES); --- 764,768 ---- gl.glColor3fv(Z_AXIS_COLOR); } else { ! gl.glColor3fv(lineColor); } gl.glBegin(GL.GL_LINES); *************** *** 801,805 **** if (selectMode == VERTICES || selectMode == ALL) { Iterator it = vertices.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Vertex v = (Vertex)it.next(); --- 814,818 ---- if (selectMode == VERTICES || selectMode == ALL) { Iterator it = vertices.iterator(); ! gl.glColor3fv(lineColor); while (it.hasNext()) { Vertex v = (Vertex)it.next(); *************** *** 811,815 **** if (selectMode == EDGES || selectMode == ALL) { Iterator it = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Edge e = (Edge)it.next(); --- 824,828 ---- if (selectMode == EDGES || selectMode == ALL) { Iterator it = edges.iterator(); ! gl.glColor3fv(lineColor); while (it.hasNext()) { Edge e = (Edge)it.next(); *************** *** 1064,1068 **** Iterator it = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Edge e = (Edge)it.next(); --- 1077,1081 ---- Iterator it = edges.iterator(); ! gl.glColor3fv(lineColor); while (it.hasNext()) { Edge e = (Edge)it.next(); *************** *** 1624,1626 **** --- 1637,1662 ---- return rayDir.dot(normal) < 0; } + + /** + * Sets the background color + * @param color the color. + */ + public void setBGColor(float[] color) { + bgColor = color; + } + /** + * Sets the line color + * @param color the color. + */ + public void setLineColor(float[] color) { + lineColor = color; + } + + /** + * Sets the grid color + * @param color the color. + */ + public void setGridColor(float[] color) { + gridColor = color; + } } |