public void vertex(int x, int y) { PVertex v = new PVertex(); v.x = x; v.y = y; fVertices.Add(v); }
void DrawQuadStrip(PVertex[] pts) { for (int i = 0; i < pts.Length-2; i += 2) { quad(pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y, pts[i + 2].x, pts[i + 2].y, pts[i + 3].x, pts[i + 3].y); } }
Point2I[] GetPoints(PVertex[] pts) { Point2I[] r = new Point2I[pts.Length]; for (int i=0; i< pts.Length; i++) { r[i].x = (int)Math.Round(pts[i].x); r[i].y = (int)Math.Round(pts[i].y); } return r; }
void DrawQuads(PVertex[] pts) { for (int i = 0; i < pts.Length; i += 4) { quad(pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y, pts[i + 2].x, pts[i + 2].y, pts[i + 3].x, pts[i + 3].y); } }
void DrawTriangleFan(PVertex[] pts) { // There must be at least two points to draw a line if (pts.Length < 3) return; float x0 = pts[0].x; float y0 = pts[0].y; for (int i = 1; i < pts.Length - 1; i += 1) { triangle(x0, y0, pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y); } }
void DrawTriangleStrip(PVertex[] pts) { // There must be at least two points to draw a line if (pts.Length < 3) return; for (int i = 0; i < pts.Length-2; i += 1) { triangle(pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y, pts[i + 2].x, pts[i + 2].y); } }
void DrawLines(PVertex[] pts) { // There must be at least two points to draw a line if (pts.Length < 2) return; for (int i=0; i<pts.Length; i+=2) { line(pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y); } }
// bezierVertex // curveVertex // endShape #region DrawElements void DrawPoints(PVertex[] pts) { foreach (PVertex pt in pts) { point(pt.x, pt.y); } }