示例#1
0
 public virtual void Draw(Graphics3D graphics)
 {
     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);
         }
     }
 }
示例#2
0
        private void PictureBox1_Paint(object sender, PaintEventArgs e)
        {
            //e.Graphics.FillRectangle(Brushes.Black, 0, 0, pictureBox1.Width, pictureBox1.Height);
            var graphics3D = new Graphics3D(e.Graphics, camera.ViewProjection, pictureBox1.Width, pictureBox1.Height, cur_obj.Center, camera.Position);
            var zero       = new Vector(0, 0, 0);
            var x          = new Vector(0.8, 0, 0);
            var y          = new Vector(0, 0.8, 0);
            var z          = new Vector(0, 0, 0.8);

            graphics3D.DrawLine(
                new Vertex(zero, Color.Red),
                new Vertex(x, Color.Red));
            graphics3D.DrawPoint(new Vertex(x, Color.Red));
            graphics3D.DrawLine(
                new Vertex(zero, Color.Green),
                new Vertex(y, Color.Green));
            graphics3D.DrawPoint(new Vertex(y, Color.Green));
            graphics3D.DrawLine(
                new Vertex(zero, Color.Blue),
                new Vertex(z, Color.Blue));
            graphics3D.DrawPoint(new Vertex(z, Color.Blue));
            cur_obj.Draw(graphics3D);
            e.Graphics.DrawImage(graphics3D.colorBuffer, 0, 0);
        }