예제 #1
0
        public SceneView() : base()
        {
            var flags = ControlStyles.AllPaintingInWmPaint
                        | ControlStyles.DoubleBuffer
                        | ControlStyles.UserPaint;

            SetStyle(flags, true);
            ResizeRedraw = true;
            Graphics3D   = new Graphics3D(this);
        }
예제 #2
0
 public virtual void Draw(Graphics3D graphics)
 {
     //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;
 }
 public override void Draw(Graphics3D graphics)
 {
     foreach (var verge in Indices)
     {
         for (int i = 1; i < verge.Length - 1; ++i)
         {
             var a = new Vertex(Coordinates[verge[0]], Color.White, Normals[verge[0]]);
             var b = new Vertex(Coordinates[verge[i]], Color.White, Normals[verge[i]]);
             var c = new Vertex(Coordinates[verge[i + 1]], Color.White, Normals[verge[i + 1]]);
             graphics.DrawTriangle(a, b, c);
         }
         if (VisibleNormals)
         {
             for (int i = 0; i < Coordinates.Length; ++i)
             {
                 var a = new Vertex(Coordinates[i], Color.White, Normals[i]);
                 var b = new Vertex(Coordinates[i] + Normals[i], Color.White, Normals[i]);
                 graphics.DrawLine(a, b);
             }
         }
     }
 }