示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Vector4 a = new Vector4(0, 0.5f, 0, 1);
            Vector4 b = new Vector4(0.5f, -0.5f, 0, 1);
            Vector4 c = new Vector4(-0.5f, -0.5f, 0, 1);

            t = new Triangle3D(a, b, c);

            m_view       = new Matriax4x4();
            m_view[1, 1] = 1;
            m_view[2, 2] = 1;
            m_view[3, 3] = 1;
            m_view[4, 3] = 250;
            m_view[4, 4] = 1;

            m_projection       = new Matriax4x4();
            m_projection[1, 1] = 1;
            m_projection[2, 2] = 1;
            m_projection[3, 3] = 1;
            m_projection[3, 4] = 1.0 / 250;
            m_projection[4, 4] = 0;

            m_rotationX = new Matriax4x4();
            m_rotationY = new Matriax4x4();
            m_rotationZ = new Matriax4x4();
        }
示例#2
0
 public Cube()
 {
     // Top  可见顺时针
     triangles[0] = new Triangle3D(a, b, c);
     triangles[1] = new Triangle3D(a, c, d);
     // Bottom 不可见逆时针
     triangles[2] = new Triangle3D(e, h, f);
     triangles[3] = new Triangle3D(f, h, g);
     // Front 可见顺时针
     triangles[4] = new Triangle3D(d, c, g);
     triangles[5] = new Triangle3D(d, g, h);
     // Back 不可见逆时针
     triangles[6] = new Triangle3D(a, e, b);
     triangles[7] = new Triangle3D(b, e, f);
     // Right 可见顺时针
     triangles[8] = new Triangle3D(b, f, c);
     triangles[9] = new Triangle3D(c, f, g);
     // Left 可见顺时针
     triangles[10] = new Triangle3D(a, d, h);
     triangles[11] = new Triangle3D(a, h, e);
 }