Esempio n. 1
0
 public virtual void DrawLines(Bitmap btm, ref int[] zbuffer)
 {
     for (int i = 0; i < m.Row - 1; i += 2)
     {
         Vec3i A = new Vec3i((int)m.matrix[i, 0], (int)m.matrix[i, 1], (int)m.matrix[i, 2]);
         Vec3i B = new Vec3i((int)m.matrix[i + 1, 0], (int)m.matrix[i + 1, 1], (int)m.matrix[i + 1, 2]);
         DrawMethods.line(A, B, ref zbuffer, btm, color);
     }
 }
Esempio n. 2
0
        public virtual void Draw(Bitmap btm, ref int[] zbuffer)
        {
            for (int i = 0; i < m.Row; i++)
            {
                Triangle tr1 = new Triangle(
                    new Vec3i((int)m.matrix[i, 0], (int)m.matrix[i, 1], (int)m.matrix[i, 2]),
                    new Vec3i((int)m.matrix[(i + 1) % m.Row, 0], (int)m.matrix[(i + 1) % m.Row, 1], (int)m.matrix[(i + 1) % m.Row, 2]),
                    new Vec3i((int)m1.matrix[i, 0], (int)m1.matrix[i, 1], (int)m1.matrix[i, 2]));

                Triangle tr2 = new Triangle(
                    new Vec3i((int)m1.matrix[i, 0], (int)m1.matrix[i, 1], (int)m1.matrix[i, 2]),
                    new Vec3i((int)m1.matrix[(i + 1) % m.Row, 0], (int)m1.matrix[(i + 1) % m.Row, 1], (int)m1.matrix[(i + 1) % m.Row, 2]),
                    new Vec3i((int)m.matrix[(i + 1) % m.Row, 0], (int)m.matrix[(i + 1) % m.Row, 1], (int)m.matrix[(i + 1) % m.Row, 2]));

                DrawMethods.triangle(tr1, ref zbuffer, btm, color);
                DrawMethods.triangle(tr2, ref zbuffer, btm, color);
            }
        }
Esempio n. 3
0
 public override void DrawLines(Bitmap btm, ref int[] zbuffer)
 {
     for (int i = 0; i < m.Row; i++)
     {
         Vec3i A = new Vec3i((int)m.matrix[i, 0], (int)m.matrix[i, 1], (int)m.matrix[i, 2]);
         Vec3i B = new Vec3i((int)m.matrix[(i + 1) % m.Row, 0], (int)m.matrix[(i + 1) % m.Row, 1], (int)m.matrix[(i + 1) % m.Row, 2]);
         DrawMethods.line(A, B, ref zbuffer, btm, Color.Black);
         Vec3i A1 = new Vec3i((int)m1.matrix[i, 0], (int)m1.matrix[i, 1], (int)m1.matrix[i, 2]);
         Vec3i B1 = new Vec3i((int)m1.matrix[(i + 1) % m.Row, 0], (int)m1.matrix[(i + 1) % m.Row, 1], (int)m1.matrix[(i + 1) % m.Row, 2]);
         DrawMethods.line(A1, B1, ref zbuffer, btm, Color.Black);
     }
     for (int i = 0; i < m.Row; i++)
     {
         Vec3i A  = new Vec3i((int)m.matrix[i, 0], (int)m.matrix[i, 1], (int)m.matrix[i, 2]);
         Vec3i A1 = new Vec3i((int)m1.matrix[i, 0], (int)m1.matrix[i, 1], (int)m1.matrix[i, 2]);
         DrawMethods.line(A, A1, ref zbuffer, btm, Color.Black);
     }
 }
Esempio n. 4
0
        public override void Draw(Bitmap btm, ref int[] zbuffer)
        {
            base.Draw(btm, ref zbuffer);

            Triangle tr1 = new Triangle(
                new Vec3i((int)m.matrix[0, 0], (int)m.matrix[0, 1], (int)m.matrix[0, 2]),
                new Vec3i((int)m.matrix[1, 0], (int)m.matrix[1, 1], (int)m.matrix[1, 2]),
                new Vec3i((int)m.matrix[2, 0], (int)m.matrix[2, 1], (int)m.matrix[2, 2]));
            Triangle tr2 = new Triangle(
                new Vec3i((int)m.matrix[0, 0], (int)m.matrix[0, 1], (int)m.matrix[0, 2]),
                new Vec3i((int)m.matrix[3, 0], (int)m.matrix[3, 1], (int)m.matrix[3, 2]),
                new Vec3i((int)m.matrix[2, 0], (int)m.matrix[2, 1], (int)m.matrix[2, 2]));

            tr1.ityA = tr1.ityB = tr1.ityC = tr2.ityA = tr2.ityB = tr2.ityC = 1;

            DrawMethods.triangle(tr1, ref zbuffer, btm, color);
            DrawMethods.triangle(tr2, ref zbuffer, btm, color);
        }
Esempio n. 5
0
        public override void Draw(Bitmap bitmap, ref int[] zbuffer)
        {
            base.Draw(bitmap, ref zbuffer);
            {
                Triangle tr1 = new Triangle(
                    new Vec3i((int)m.matrix[0, 0], (int)m.matrix[0, 1], (int)m.matrix[0, 2]),
                    new Vec3i((int)m.matrix[1, 0], (int)m.matrix[1, 1], (int)m.matrix[1, 2]),
                    new Vec3i((int)m.matrix[2, 0], (int)m.matrix[2, 1], (int)m.matrix[2, 2]));
                Triangle tr2 = new Triangle(
                    new Vec3i((int)m.matrix[2, 0], (int)m.matrix[2, 1], (int)m.matrix[2, 2]),
                    new Vec3i((int)m.matrix[3, 0], (int)m.matrix[3, 1], (int)m.matrix[3, 2]),
                    new Vec3i((int)m.matrix[4, 0], (int)m.matrix[4, 1], (int)m.matrix[4, 2]));
                Triangle tr3 = new Triangle(
                    new Vec3i((int)m.matrix[4, 0], (int)m.matrix[4, 1], (int)m.matrix[4, 2]),
                    new Vec3i((int)m.matrix[5, 0], (int)m.matrix[5, 1], (int)m.matrix[5, 2]),
                    new Vec3i((int)m.matrix[6, 0], (int)m.matrix[6, 1], (int)m.matrix[6, 2]));
                Triangle tr4 = new Triangle(
                    new Vec3i((int)m.matrix[2, 0], (int)m.matrix[2, 1], (int)m.matrix[2, 2]),
                    new Vec3i((int)m.matrix[4, 0], (int)m.matrix[4, 1], (int)m.matrix[4, 2]),
                    new Vec3i((int)m.matrix[6, 0], (int)m.matrix[6, 1], (int)m.matrix[6, 2]));
                Triangle tr5 = new Triangle(
                    new Vec3i((int)m.matrix[0, 0], (int)m.matrix[0, 1], (int)m.matrix[0, 2]),
                    new Vec3i((int)m.matrix[2, 0], (int)m.matrix[2, 1], (int)m.matrix[2, 2]),
                    new Vec3i((int)m.matrix[6, 0], (int)m.matrix[6, 1], (int)m.matrix[6, 2]));

                tr1.ityA = tr1.ityB = tr1.ityC = tr2.ityA = tr2.ityB = tr2.ityC = tr3.ityA = tr3.ityB = tr3.ityC = tr4.ityA = tr4.ityB = tr4.ityC = tr5.ityA = tr5.ityB = tr5.ityC = 1;

                DrawMethods.triangle(tr1, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr2, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr3, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr4, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr5, ref zbuffer, bitmap, color);
            }
            {
                Triangle tr1 = new Triangle(
                    new Vec3i((int)m1.matrix[0, 0], (int)m1.matrix[0, 1], (int)m1.matrix[0, 2]),
                    new Vec3i((int)m1.matrix[1, 0], (int)m1.matrix[1, 1], (int)m1.matrix[1, 2]),
                    new Vec3i((int)m1.matrix[2, 0], (int)m1.matrix[2, 1], (int)m1.matrix[2, 2]));
                Triangle tr2 = new Triangle(
                    new Vec3i((int)m1.matrix[2, 0], (int)m1.matrix[2, 1], (int)m1.matrix[2, 2]),
                    new Vec3i((int)m1.matrix[3, 0], (int)m1.matrix[3, 1], (int)m1.matrix[3, 2]),
                    new Vec3i((int)m1.matrix[4, 0], (int)m1.matrix[4, 1], (int)m1.matrix[4, 2]));
                Triangle tr3 = new Triangle(
                    new Vec3i((int)m1.matrix[4, 0], (int)m1.matrix[4, 1], (int)m1.matrix[4, 2]),
                    new Vec3i((int)m1.matrix[5, 0], (int)m1.matrix[5, 1], (int)m1.matrix[5, 2]),
                    new Vec3i((int)m1.matrix[6, 0], (int)m1.matrix[6, 1], (int)m1.matrix[6, 2]));
                Triangle tr4 = new Triangle(
                    new Vec3i((int)m1.matrix[2, 0], (int)m1.matrix[2, 1], (int)m1.matrix[2, 2]),
                    new Vec3i((int)m1.matrix[4, 0], (int)m1.matrix[4, 1], (int)m1.matrix[4, 2]),
                    new Vec3i((int)m1.matrix[6, 0], (int)m1.matrix[6, 1], (int)m1.matrix[6, 2]));
                Triangle tr5 = new Triangle(
                    new Vec3i((int)m1.matrix[0, 0], (int)m1.matrix[0, 1], (int)m1.matrix[0, 2]),
                    new Vec3i((int)m1.matrix[2, 0], (int)m1.matrix[2, 1], (int)m1.matrix[2, 2]),
                    new Vec3i((int)m1.matrix[6, 0], (int)m1.matrix[6, 1], (int)m1.matrix[6, 2]));

                tr1.ityA = tr1.ityB = tr1.ityC = tr2.ityA = tr2.ityB = tr2.ityC = tr3.ityA = tr3.ityB = tr3.ityC = tr4.ityA = tr4.ityB = tr4.ityC = tr5.ityA = tr5.ityB = tr5.ityC = 1;

                DrawMethods.triangle(tr1, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr2, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr3, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr4, ref zbuffer, bitmap, color);
                DrawMethods.triangle(tr5, ref zbuffer, bitmap, color);
            }
        }