[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java,1.81,1.82
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-05-03 09:59:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16503/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed more unused code Implemented mechanism for assigning a color to target Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** View.java 3 May 2006 08:49:24 -0000 1.81 --- View.java 3 May 2006 09:59:19 -0000 1.82 *************** *** 63,69 **** private static Logger log = Logger.getLogger(View.class); - /** Specify if lone vertices are displayed */ - private static final boolean DRAW_LONE_VERTICES = false; - /** the color of the x axis */ public static final float[] X_AXIS_COLOR = new float[] {0.1f, 0.8f, 0.1f}; --- 63,66 ---- *************** *** 166,175 **** public static final int VIEW_3D = 6; - /** The Snap vertex */ - protected static Vertex snapVertex = null; - - /** The current vertex */ - protected static Vertex currentVertex = null; - /** The current background color */ protected static float[] bgColor; --- 163,166 ---- *************** *** 186,189 **** --- 177,183 ---- /** The target */ protected static Object target = null; + + /** The target color */ + protected static float[] targetColor = null; /** The GL */ *************** *** 453,457 **** gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); - Plane xy = new Plane(0, 0, 1, 0); gl = gld.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); --- 447,450 ---- *************** *** 711,759 **** } ! // draw target ! gl.glColor3fv(TARGET_COLOR); if (target != null) { drawObject(target); } gl.glDisable(GL.GL_DEPTH_TEST); - Vertex to = null; - - if (to == null) { - to = currentVertex; - } - if (snapVertex != null && to != null) { - boolean doDraw = true; - if (cmp(snapVertex.getY(), to.getY()) && cmp(snapVertex.getZ(), to.getZ())) { - gl.glColor3fv(X_AXIS_COLOR); - } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getZ(), to.getZ())) { - gl.glColor3fv(Y_AXIS_COLOR); - } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getY(), to.getY())) { - gl.glColor3fv(Z_AXIS_COLOR); - } else { - doDraw = false; - } - if (doDraw) { - gl.glEnable(GL.GL_LINE_STIPPLE); - gl.glLineWidth(1.0f); - gl.glBegin(GL.GL_LINES); - gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); - gl.glVertex3d(to.getX(), to.getY(), to.getZ()); - gl.glEnd(); - gl.glDisable(GL.GL_LINE_STIPPLE); - } - } - - - // draw snap point if any - if (snapVertex != null) { - gl.glDisable(GL.GL_DEPTH_TEST); - gl.glColor3fv(TARGET_COLOR); - gl.glPointSize(5.0f); - gl.glBegin(GL.GL_POINTS); - gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); - gl.glEnd(); - gl.glPointSize(1.0f); - } { --- 704,714 ---- } ! if (target != null) { + gl.glColor3fv(targetColor); drawObject(target); } gl.glDisable(GL.GL_DEPTH_TEST); { *************** *** 845,868 **** } } - - /** - * Draw all surfaces - * @param gld The GLDrawable - * @param side The side of surfaces to draw - */ - private void drawSurfaces(GLDrawable gld, int side) { - drawSurfaces(gld, tempSurfaces, side); - - Space active = Project.getInstance().getActiveSpace(); - - if (active != null) { - drawSpaceSurfaces(gld, active, side); - } else { - Collection surfaces = Project.getInstance().getSurfaces(); - Collection spaces = Project.getInstance().getSpaces(); - drawSurfaces(gld, surfaces, side); - drawInteriorSurfaces(gld, side, spaces); - } - } /** --- 800,803 ---- *************** *** 954,971 **** /** - * Draw interior surfaces - * @param gld The GLDrawable - * @param side The side of surfaces to draw - * @param spaces The spaces - */ - private void drawInteriorSurfaces(GLDrawable gld, int side, Collection spaces) { - Iterator iter = spaces.iterator(); - while (iter.hasNext()) { - Space current = (Space) iter.next(); - drawSurfaces(gld, current.getSurfaces(), side); - } - } - - /** * * @param surface The surface --- 889,892 ---- *************** *** 1124,1129 **** */ public void reset() { - setSnapVertex(null); - setCurrentVertex(null); makeTarget(null); } --- 1045,1048 ---- *************** *** 1562,1575 **** /** - * Draw a Vertex - * @param v The Vertex to draw - */ - private void drawVertex(Vertex v) { - gl.glBegin(GL.GL_POINTS); - gl.glVertex3d(v.getX(), v.getY(), v.getZ()); - gl.glEnd(); - } - - /** * Draw a Vertex for hit-detection * @param v The Vertex to draw --- 1481,1484 ---- *************** *** 1582,1600 **** gl.glPointSize(1.0f); } - - /** - * Draw all edges - * @param gld The GLDrawable - * @param edges The edges - */ - private void drawEdges(GLDrawable gld, Collection edges) { - GL gl = gld.getGL(); - gl.glColor3fv(lineColor); - Iterator it = edges.iterator(); - while (it.hasNext()) { - Edge e = (Edge)it.next(); - drawEdge(e); - } - } /** --- 1491,1494 ---- *************** *** 1674,1714 **** /** ! * Getter for snapVertex ! * @return snapVertex ! */ ! public Vertex getSnapVertex() { ! return snapVertex; ! } ! ! /** ! * Setter for snapVertex ! * @param v The new snapVertex ! */ ! public void setSnapVertex(Vertex v) { ! snapVertex = v; ! } ! ! /** ! * Getter for currentVertex ! * @return currentVertex ! */ ! public Vertex getCurrentVertex() { ! return currentVertex; ! } ! ! /** ! * Setter for currentVertex ! * @param v The new currentVertex */ ! public void setCurrentVertex(Vertex v) { ! currentVertex = v; } ! /** ! * Setter for target * @param o The object to be target */ ! public void makeTarget(Object o) { target = o; } --- 1568,1586 ---- /** ! * Setter for target that uses default target color ! * @param o The object to be target */ ! public void makeTarget(Object o) { ! makeTarget(o, TARGET_COLOR); } ! /** ! * Setter for target that also assigns the color * @param o The object to be target + * @param color The color of the target */ ! public void makeTarget(Object o, float[] color) { target = o; + targetColor = color; } *************** *** 2411,2414 **** --- 2283,2289 ---- */ class ViewWireframe extends AbstractAction { + /** */ + private static final long serialVersionUID = 1L; + /** The GLView */ private GLView glv = null; *************** *** 2440,2443 **** --- 2315,2321 ---- */ class ViewSolid extends AbstractAction { + /** */ + private static final long serialVersionUID = 1L; + /** The GLView */ private GLView glv = null; *************** *** 2469,2472 **** --- 2347,2353 ---- */ class ViewLighting extends AbstractAction { + /** */ + private static final long serialVersionUID = 1L; + /** The GLView */ private GLView glv = null; |