[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.200, 1.201
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nordholt <nor...@us...> - 2007-04-15 10:43:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17474/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: added some generics, and made sure not to get a null pointer exception when something goes wrong in getting an vertexlist from a surface. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** View.java 23 Mar 2007 13:20:04 -0000 1.200 --- View.java 15 Apr 2007 10:43:08 -0000 1.201 *************** *** 1659,1663 **** */ private void drawContour(Surface surface, GLUtessellator tess) { ! List vertices = null; try { vertices = surface.getVertices(); --- 1659,1663 ---- */ private void drawContour(Surface surface, GLUtessellator tess) { ! List<Vertex> vertices = null; try { vertices = surface.getVertices(); *************** *** 1666,1675 **** return; } ! if (vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); - Iterator iter = vertices.iterator(); glu.gluTessBeginContour(tess); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; glu.gluTessVertex(tess, coords, 0, new TesselatorPoint(coords[0], coords[1], coords[2])); --- 1666,1673 ---- return; } ! if (vertices != null && vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); glu.gluTessBeginContour(tess); ! for (Vertex current : vertices) { double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; glu.gluTessVertex(tess, coords, 0, new TesselatorPoint(coords[0], coords[1], coords[2])); *************** *** 1678,1681 **** --- 1676,1682 ---- glu.gluTessVertex(tess, coords, 0, new TesselatorPoint(coords[0], coords[1], coords[2])); glu.gluTessEndContour(tess); + } else { + log.error("Did not draw suface " + surface + + " because its verticelist were null or empty"); } } |