public virtual void Draw(Graphics3D graphics) { if (Solid) { //var t = graphics.LightEnabled; //graphics.LightEnabled = false; //foreach (var facet in Indices) // for (int i = 1; i < facet.Length - 1; ++i) // { // var a = new Vertex(Coordinates[facet[0]], NextColor(new Random(facet[0]))); // var b = new Vertex(Coordinates[facet[i]], NextColor(new Random(facet[i]))); // var c = new Vertex(Coordinates[facet[i + 1]], NextColor(new Random(facet[i + 1]))); // graphics.DrawTriangle(a, b, c); // } //graphics.LightEnabled = t; } else { foreach (var facet in Indices) { for (int i = 0; i < facet.Length; ++i) { var a = new Vertex(Coordinates[facet[i]]); var b = new Vertex(Coordinates[facet[(i + 1) % facet.Length]]); graphics.DrawLine(a, b); } } } }
public SceneView() : base() { var flags = ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint; SetStyle(flags, true); ResizeRedraw = true; Graphics3D = new Graphics3D(this); }