[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.248, 1.249 Display.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-12 14:34:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31414/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Display.java Log Message: new display system in effect Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Display.java 12 Oct 2007 13:14:42 -0000 1.32 --- Display.java 12 Oct 2007 14:34:34 -0000 1.33 *************** *** 20,23 **** --- 20,24 ---- import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.glu.GLU; + import javax.media.opengl.glu.GLUquadric; import javax.media.opengl.glu.GLUtessellator; import javax.media.opengl.glu.GLUtessellatorCallback; *************** *** 32,35 **** --- 33,37 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Line; import net.sourceforge.bprocessor.model.Net; *************** *** 98,102 **** public static void initialize() { if (!initialized) { - glu = new GLU(); tesselator = glu.gluNewTess(); GLUtessellatorCallback callback = new TesselatorCallback(); --- 100,103 ---- *************** *** 515,526 **** paint((CoordinateSystem) constructor); } else if (constructor instanceof Line) { ! paint((Line) constructor); } } ! private static void paint(Line line) { gl.glLineWidth(1.0f); gl.glEnable(GL.GL_LINE_STIPPLE); ! gl.glColor3fv(middleblue, 0); draw(line); gl.glDisable(GL.GL_LINE_STIPPLE); --- 516,527 ---- paint((CoordinateSystem) constructor); } else if (constructor instanceof Line) { ! paint((Line) constructor, middleblue); } } ! private static void paint(Line line, float[] color) { gl.glLineWidth(1.0f); gl.glEnable(GL.GL_LINE_STIPPLE); ! gl.glColor3fv(color, 0); draw(line); gl.glDisable(GL.GL_LINE_STIPPLE); *************** *** 533,547 **** Vertex n = system.getN(); Line xaxis = new Line(origin, i); Line yaxis = new Line(origin, j); Line zaxis = new Line(origin, n); ! gl.glLineWidth(1.0f); ! gl.glEnable(GL.GL_LINE_STIPPLE); ! gl.glColor3fv(red, 0); ! draw(xaxis); ! gl.glColor3fv(green, 0); ! draw(yaxis); ! gl.glColor3fv(blue, 0); ! draw(zaxis); ! gl.glDisable(GL.GL_LINE_STIPPLE); } --- 534,545 ---- Vertex n = system.getN(); Line xaxis = new Line(origin, i); + xaxis.setEditable(system.isEditable()); Line yaxis = new Line(origin, j); + yaxis.setEditable(system.isEditable()); Line zaxis = new Line(origin, n); ! zaxis.setEditable(system.isEditable()); ! paint(xaxis, red); ! paint(yaxis, green); ! paint(zaxis, blue); } *************** *** 552,557 **** --- 550,559 ---- Vertex n = system.getN(); Line xaxis = new Line(origin, i); + xaxis.setEditable(system.isEditable()); Line yaxis = new Line(origin, j); + yaxis.setEditable(system.isEditable()); Line zaxis = new Line(origin, n); + zaxis.setEditable(system.isEditable()); + draw(xaxis); draw(yaxis); *************** *** 571,574 **** --- 573,606 ---- Edge edge = line.edge(grid.size()); draw(edge); + if (line.isEditable()) { + Vertex from = line.getOrigin(); + double dist = camera.distance(from); + Vertex to = line.tip(dist); + drawVectorBase(from, to); + drawVectorTip(from, to); + } + } + + private static void drawVectorBase(Vertex from, Vertex to) { + gl.glLineWidth(2); + gl.glBegin(GL.GL_LINES); + gl.glVertex3d(from.getX(), from.getY(), from.getZ()); + gl.glVertex3d(to.getX(), to.getY(), to.getZ()); + gl.glEnd(); + } + private static void drawVectorTip(Vertex from, Vertex to) { + Vertex direction = to.minus(from); + double dist = direction.length() * 16; + gl.glEnable(GL.GL_LIGHTING); + GLUquadric quad = glu.gluNewQuadric(); + glu.gluQuadricNormals(quad, GLU.GLU_SMOOTH); + gl.glPushMatrix(); + gl.glTranslated(to.getX(), to.getY(), to.getZ()); + gl.glRotated(Math.toDegrees(Geometry.degreesAboutZ(direction)), 0, 0, 1); + gl.glRotated(-Math.toDegrees(Geometry.degreesAboutY(direction)), 0, 1, 0); + gl.glRotated(90, 0, 1, 0); + glu.gluCylinder(quad, (dist / 90), 0, (dist / 20), 10, 10); + gl.glPopMatrix(); + gl.glDisable(GL.GL_LIGHTING); } *************** *** 963,970 **** /** * ! * @param gld GLAutoDrawable */ ! public static void draw(GLAutoDrawable gld) { ! gl = gld.getGL(); initialize(); project = Project.getInstance(); --- 995,1005 ---- /** * ! * @param gld gld ! * @param gl gl ! * @param glu glu */ ! public static void draw(GLAutoDrawable gld, GL gl, GLU glu) { ! Display.gl = gl; ! Display.glu = glu; initialize(); project = Project.getInstance(); Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.248 retrieving revision 1.249 diff -C2 -d -r1.248 -r1.249 *** View.java 12 Oct 2007 13:14:42 -0000 1.248 --- View.java 12 Oct 2007 14:34:34 -0000 1.249 *************** *** 82,86 **** private static final boolean DISP = false; ! private static final boolean UNIFIED_DISPLAY = false; /** OBJECTS flag */ --- 82,86 ---- private static final boolean DISP = false; ! private static final boolean UNIFIED_DISPLAY = true; /** OBJECTS flag */ *************** *** 736,740 **** Display.extras(extras); Display.glos(glObjects3D); ! Display.draw(gld); Display.selecting(false); Display.intersecting(false); --- 736,740 ---- Display.extras(extras); Display.glos(glObjects3D); ! Display.draw(gld, gl, glu); Display.selecting(false); Display.intersecting(false); *************** *** 1616,1619 **** --- 1616,1620 ---- Vertex direction = to.minus(from); double dist = direction.length() * 16; + System.out.println("dist " + dist); gl.glEnable(GL.GL_LIGHTING); GLUquadric quad = glu.gluNewQuadric(); |