Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.117, 1.118
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-07-21 10:43:24
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20777/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Changes to the drawing of constructors, yet again everything including constructors are cut by clippingplanes and isActive drawing of lines are working. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** View.java 20 Jul 2006 12:58:52 -0000 1.117 --- View.java 21 Jul 2006 10:43:20 -0000 1.118 *************** *** 524,529 **** // grid and coords are always completely lit gl.glLineWidth(1.0f); ! grid(); ! coords(); Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); --- 524,532 ---- // grid and coords are always completely lit gl.glLineWidth(1.0f); ! grid(Project.getInstance().getActiveCoordinateSystem()); ! ! Camera camera = Project.getInstance().getCurrentCamera(); ! double scale = (camera.getFocalwidth() / 65) * (500 / height); ! drawCoordinateSystem(Project.getInstance().getActiveCoordinateSystem(), camera.dist() * scale); Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); *************** *** 661,666 **** /** * Draw a grid */ ! protected void grid() { double size = View.gridSize(); gl.glLineWidth(0.5f); --- 664,670 ---- /** * Draw a grid + * @param cs the coordinatesystem */ ! protected void grid(CoordinateSystem cs) { double size = View.gridSize(); gl.glLineWidth(0.5f); *************** *** 669,682 **** gl.glBegin(GL.GL_LINES); - - - 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(); --- 673,692 ---- gl.glBegin(GL.GL_LINES); for (int x = -(int)size; x <= (int)size; x++) { ! Vertex v1 = new Vertex((double) x * 2, -size * 2, 0); ! Vertex v2 = new Vertex((double) x * 2, size * 2, 0); ! v1 = cs.unTranslate(v1); ! v2 = cs.unTranslate(v2); ! gl.glVertex3d(v1.getX(), v1.getY(), v1.getZ()); ! gl.glVertex3d(v2.getX(), v2.getY(), v2.getZ()); } for (int y = -(int)size; y <= (int)size; y++) { ! Vertex v1 = new Vertex(-size * 2, (double) y * 2, 0); ! Vertex v2 = new Vertex(size * 2, (double) y * 2, 0); ! v1 = cs.unTranslate(v1); ! v2 = cs.unTranslate(v2); ! gl.glVertex3d(v1.getX(), v1.getY(), v1.getZ()); ! gl.glVertex3d(v2.getX(), v2.getY(), v2.getZ()); ! } gl.glEnd(); *************** *** 773,779 **** } ! //Draw constructors ! ! drawConstructors(); { --- 783,790 ---- } ! // draw constructors ! { ! drawConstructors(); ! } { *************** *** 795,799 **** } } - // draw target --- 806,809 ---- *************** *** 950,958 **** double scale = (camera.getFocalwidth() / 65) * (500 / height); double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! while (iter.hasNext()) { Object o = iter.next(); Constructor c = (Constructor)o; - if (camera.getType() == Camera.PERSPECTIVE) { dist = (c.getOrigin().minus(v)).length() * scale; --- 960,967 ---- double scale = (camera.getFocalwidth() / 65) * (500 / height); double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! CoordinateSystem cs = Project.getInstance().getActiveCoordinateSystem(); while (iter.hasNext()) { Object o = iter.next(); Constructor c = (Constructor)o; if (camera.getType() == Camera.PERSPECTIVE) { dist = (c.getOrigin().minus(v)).length() * scale; *************** *** 960,981 **** if (o instanceof Point) { drawConstructorPoint(((Point)o).getOrigin(), dist); } else if (o instanceof Line) { Line l = (Line)o; ! drawConstructorPoint(l.getOrigin(), dist); drawConstructorVector(l.getOrigin(), l.getDirection(), dist); } else if (o instanceof CoordinateSystem) { ! CoordinateSystem cs = (CoordinateSystem)o; ! Vertex i = cs.getI(); ! Vertex j = cs.getJ(); ! gl.glColor3fv(X_AXIS_COLOR); ! drawConstructorVector(cs.getOrigin(), i, dist); ! gl.glColor3fv(Y_AXIS_COLOR); ! drawConstructorVector(cs.getOrigin(), j, dist); ! if (!cs.onlyPlane()) { ! Vertex n = cs.getN(); ! gl.glColor3fv(Z_AXIS_COLOR); ! drawConstructorVector(cs.getOrigin(), n, dist); ! } } } --- 969,987 ---- if (o instanceof Point) { + gl.glColor3fv(CONSTRUCTOR_COLOR); drawConstructorPoint(((Point)o).getOrigin(), dist); } else if (o instanceof Line) { + gl.glColor3fv(CONSTRUCTOR_COLOR); Line l = (Line)o; ! //drawConstructorPoint(l.getOrigin(), dist); drawConstructorVector(l.getOrigin(), l.getDirection(), dist); + if (l.isActive()) { + drawConstructorLine(l.getOrigin(), l.getDirection(), dist); + } } else if (o instanceof CoordinateSystem) { ! CoordinateSystem coo = (CoordinateSystem)o; ! if (cs != coo) { ! drawCoordinateSystem(coo, dist); ! } } } *************** *** 988,991 **** --- 994,1025 ---- /** + * draw the coordinatesystem + * @param cs The coordinatesystem + * @param dist The distance to the center of the system + */ + private void drawCoordinateSystem(CoordinateSystem cs, double dist) { + Vertex i = cs.getI(); + Vertex j = cs.getJ(); + gl.glColor3fv(X_AXIS_COLOR); + drawConstructorVector(cs.getOrigin(), i, dist); + if (cs.isActive()) { + drawConstructorLine(cs.getOrigin(), i, dist); + } + gl.glColor3fv(Y_AXIS_COLOR); + drawConstructorVector(cs.getOrigin(), j, dist); + if (cs.isActive()) { + drawConstructorLine(cs.getOrigin(), j, dist); + } + if (!cs.onlyPlane()) { + Vertex n = cs.getN(); + gl.glColor3fv(Z_AXIS_COLOR); + drawConstructorVector(cs.getOrigin(), n, dist); + if (cs.isActive()) { + drawConstructorLine(cs.getOrigin(), n, dist); + } + } + } + + /** * Draw a point in the location of center * @param center The location for the point *************** *** 994,998 **** private void drawConstructorPoint(Vertex center, double dist) { gl.glPointSize(8); - gl.glColor3fv(CONSTRUCTOR_COLOR); gl.glBegin(GL.GL_POINTS); gl.glVertex3d(center.getX(), center.getY(), center.getZ()); --- 1028,1031 ---- *************** *** 1027,1031 **** gl.glPopMatrix(); gl.glDisable(GL.GL_LIGHTING); - drawConstructorLine(from, direction, dist); } --- 1060,1063 ---- *************** *** 1593,1604 **** } } ! if (selectMode == CLIPPLANES || selectMode == ALL) { ! { ! Iterator it = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); ! while (it.hasNext()) { ! ClippingPlane cp = (ClippingPlane)it.next(); ! gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! } } { Iterator it = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); --- 1625,1636 ---- } } ! { ! Iterator it = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); ! while (it.hasNext()) { ! ClippingPlane cp = (ClippingPlane)it.next(); ! gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); } + } + if (selectMode == CLIPPLANES || selectMode == ALL) { { Iterator it = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); *************** *** 1643,1649 **** drawVertexHit(tip); popName(gl); ! pushName(gl, constructor); ! drawEdge(constructor); ! popName(gl); } } --- 1675,1683 ---- drawVertexHit(tip); popName(gl); ! if (current.isActive()) { ! pushName(gl, constructor); ! drawEdge(constructor); ! popName(gl); ! } } } |