コード例 #1
0
ファイル: Form1.cs プロジェクト: JoebobyJoe/BloxorzGraphics3D
        /// <summary>
        /// All painting to the screen must happen in here.
        /// You don't do any calculations in here - just painting.
        /// </summary>
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics gr = e.Graphics;

            gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            gr.TranslateTransform(ClientRectangle.Width / 2, ClientRectangle.Height / 2);
            foreach (Line3D line in lines)
            {
                line.Draw(gr, distance);
            }
            //sort the spheres before painting
            SortSphere(spheres);


            // sorts the cubes so that the one directly in front are drawn first
            QuickSortCube(cubes, 0, cubes.Count - 1);
            for (int i = 0; i < cubes.Count; i++)
            {
                Cube temp = cubes[i];
                temp.Draw(gr, distance, lightSrc);
            }
            //foreach (Cube cube in cubes)
            //    cube.Draw(gr, distance, lightSrc);
            foreach (Line3D line in lines)
            {
                line.Draw(gr, distance);
            }
            sun.Fill(gr, distance);
        }
コード例 #2
0
 public void Draw(Graphics gr, double distance, Point3D lightSrc)
 {
     aCube.Pen   = pen;
     aCube.Color = color;
     aCube.Draw(gr, distance, lightSrc);
 }