円形
中心と周囲361個の点が必要
private const int VERT_NUM = 362; // 円形
vertexBuf = new VertexBuffer(typeof(CustomVertex.PositionTextured), VERT_NUM, device, Usage.None, CustomVertex.PositionTextured.Format, Pool.Managed); // 円形、プール自動管理 CustomVertex.PositionTextured[] verts = new CustomVertex.PositionTextured[VERT_NUM]; verts[0] = new CustomVertex.PositionTextured(0, 0, 0, 0, 0); // 中心 float x, y, r = 1; for (int i = 0; i < VERT_NUM-1; i++) { x = (float)(r * Math.Cos((double)i/180*Math.PI)); y = (float)(r * Math.Sin((double)i/180*Math.PI)); verts[i+1] = new CustomVertex.PositionTextured(x, y, 0, 0, 0); } GraphicsStream gs = vertexBuf.Lock(0, 0, 0); // 全体ロック、フラグとりあえず0 gs.Write(verts); vertexBuf.Unlock();
device.DrawPrimitives(PrimitiveType.TriangleFan, 0, VERT_NUM-2); // 三角形、vertex開始点、個数