[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view Display.java, 1.15, 1.16
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-02 06:42:07
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24295/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: constructor drawing Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Display.java 1 Oct 2007 11:07:01 -0000 1.15 --- Display.java 2 Oct 2007 06:42:09 -0000 1.16 *************** *** 24,30 **** --- 24,33 ---- import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Constructor; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Defaults; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Line; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 40,43 **** --- 43,47 ---- private static final boolean TRUE = true; + private static boolean initialized; private static boolean selecting; *************** *** 48,51 **** --- 52,57 ---- private static Geometric target; private static Collection<? extends Geometric> extras; + private static Grid grid; + private static float[] white = new float[] {1.0f, 1.0f, 1.0f}; *************** *** 58,62 **** private static float[] babyblue = new float[] {224f / 255, 255f / 255, 255f / 255}; private static float[] middleblue = new float[] {0.11f, 0.72f, 0.67f, 0.0f}; ! private static float[] misty = new float[] {255f / 280, 228f / 280, 225f / 280}; --- 64,70 ---- private static float[] babyblue = new float[] {224f / 255, 255f / 255, 255f / 255}; private static float[] middleblue = new float[] {0.11f, 0.72f, 0.67f, 0.0f}; ! private static float[] red = new float[]{0.8f, 0.1f, 0.1f}; ! private static float[] green = new float[]{0.1f, 0.8f, 0.1f}; ! private static float[] blue = new float[]{0.1f, 0.1f, 0.8f}; private static float[] misty = new float[] {255f / 280, 228f / 280, 225f / 280}; *************** *** 101,105 **** } } ! initialized = true; } --- 109,113 ---- } } ! grid = new Grid(); initialized = true; } *************** *** 346,349 **** --- 354,435 ---- } + private static void paintConstructors(Collection<Constructor> constructors) { + for (Constructor current : constructors) { + paint(current); + } + } + + + private static void paint(Constructor constructor) { + if (constructor instanceof CoordinateSystem) { + 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); + } + + private static void paint(CoordinateSystem system) { + Vertex origin = system.getOrigin(); + Vertex i = system.getI(); + Vertex j = system.getJ(); + 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); + } + + private static void draw(CoordinateSystem system) { + Vertex origin = system.getOrigin(); + Vertex i = system.getI(); + Vertex j = system.getJ(); + Vertex n = system.getN(); + Line xaxis = new Line(origin, i); + Line yaxis = new Line(origin, j); + Line zaxis = new Line(origin, n); + draw(xaxis); + draw(yaxis); + draw(zaxis); + } + + + private static void draw(Constructor constructor) { + if (constructor instanceof CoordinateSystem) { + draw((CoordinateSystem) constructor); + } else if (constructor instanceof Line) { + draw((Line) constructor); + } + } + + private static void draw(Line line) { + Edge edge = line.edge(grid.size()); + draw(edge); + } + + + private static void selectConstructors(Collection<Constructor> constructors) { + for (Constructor current : constructors) { + push(current); + draw(current); + pop(); + } + } + private static boolean transparent(Space space) { Project project = Project.getInstance(); *************** *** 385,389 **** Collection<Edge> edges = new LinkedList(); Collection<Vertex> vertices = new LinkedList(); ! for (Space current : space.getElements()) { if (!hidden.contains(current)) { --- 471,476 ---- Collection<Edge> edges = new LinkedList(); Collection<Vertex> vertices = new LinkedList(); ! Collection<Constructor> constructors = new LinkedList(); ! for (Space current : space.getElements()) { if (!hidden.contains(current)) { *************** *** 461,465 **** } } ! gl.glEnable(GL.GL_DEPTH_TEST); --- 548,557 ---- } } ! ! for (Constructor current : space.getConstructors()) { ! if (!hidden.contains(current)) { ! constructors.add(current); ! } ! } gl.glEnable(GL.GL_DEPTH_TEST); *************** *** 470,473 **** --- 562,566 ---- } selectEdges(edges); + selectConstructors(constructors); } else { if (active) { *************** *** 476,480 **** if (project.getActiveSpace() == space) { gl.glDepthMask(false); ! draw(new Grid()); gl.glDepthMask(true); } --- 569,574 ---- if (project.getActiveSpace() == space) { gl.glDepthMask(false); ! draw(grid); ! paintConstructors(constructors); gl.glDepthMask(true); } *************** *** 514,517 **** --- 608,619 ---- } + gl.glEnable(GL.GL_LINE_STIPPLE); + for (Geometric current : geometrics) { + if (current instanceof Constructor) { + draw((Constructor) current); + } + } + gl.glDisable(GL.GL_LINE_STIPPLE); + gl.glDisable(GL.GL_POLYGON_STIPPLE); gl.glDisable(GL.GL_DEPTH_TEST); |