Java Code Examples for processing.opengl.PGraphics3D#beginShape()
The following examples show how to use
processing.opengl.PGraphics3D#beginShape() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DwHalfEdge.java From PixelFlow with MIT License | 6 votes |
private void displayPolygons(PGraphics3D pg, DwHalfEdge.Edge edge){ DwStack<DwHalfEdge.Edge> stack = new DwStack<DwHalfEdge.Edge>(); stack.push(edge); float[][] verts = ifs.getVerts(); float[] v; while(!stack.isEmpty()){ edge = stack.pop(); if(edge != null && getFLAG_display(edge)){ DwHalfEdge.Edge iter = edge; pg.beginShape(); do { v = verts[iter.vert.idx]; pg.vertex(v[0], v[1], v[2]); } while((iter = iter.next) != edge); pg.endShape(PConstants.CLOSE); // recursively draw neighbors do { setFLAG_display(iter); stack.push(iter.pair); } while((iter = iter.next) != edge); } } }
Example 2
Source File: DwHalfEdge.java From PixelFlow with MIT License | 6 votes |
private void displayQuads(PGraphics3D pg, DwHalfEdge.Edge edge){ DwStack<DwHalfEdge.Edge> stack = new DwStack<DwHalfEdge.Edge>(); stack.push(edge); float[][] verts = ifs.getVerts(); float[] v; pg.beginShape(PConstants.QUADS); while(!stack.isEmpty()){ edge = stack.pop(); if(edge != null && getFLAG_display(edge)){ // draw quad v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); // recursively draw neighbors stack.push((edge = edge.next).pair); setFLAG_display(edge); stack.push((edge = edge.next).pair); setFLAG_display(edge); stack.push((edge = edge.next).pair); setFLAG_display(edge); stack.push((edge = edge.next).pair); setFLAG_display(edge); } } pg.endShape(); }
Example 3
Source File: DwHalfEdge.java From PixelFlow with MIT License | 6 votes |
private void displayTriangles(PGraphics3D pg, DwHalfEdge.Edge edge){ DwStack<DwHalfEdge.Edge> stack = new DwStack<DwHalfEdge.Edge>(); stack.push(edge); float[][] verts = ifs.getVerts(); float[] v; pg.beginShape(PConstants.TRIANGLES); while(!stack.isEmpty()){ edge = stack.pop(); if(edge != null && getFLAG_display(edge)){ // draw triangle v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); v = verts[edge.vert.idx]; edge = edge.next; pg.vertex(v[0], v[1], v[2]); // recursively draw neighbors stack.push((edge = edge.next).pair); setFLAG_display(edge); stack.push((edge = edge.next).pair); setFLAG_display(edge); stack.push((edge = edge.next).pair); setFLAG_display(edge); } } pg.endShape(); }