Пример #1
0
        //第一个 着色模式 第二三个 线框模式
        private void DrawPrimitive(Vertex v1, Vertex v2, Vertex v3)
        {
            Vector v4 = v1.point * View;
            Vector v5 = v2.point * View;
            Vector v6 = v3.point * View;

            Vector v7 = v4 * Projection;
            Vector v8 = v5 * Projection;
            Vector v9 = v6 * Projection;

            Vector p1 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v7);
            Vector p2 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v8);
            Vector p3 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v9);

            //纹理渲染模式 IsShaded true
            Vertex v11 = new Vertex(v1);

            v11.point   = new Vector(p1);
            v11.point.t = v7.t;

            Vertex v22 = new Vertex(v2);

            v22.point   = new Vector(p2);
            v22.point.t = v8.t;

            Vertex v33 = new Vertex(v3);

            v33.point   = new Vector(p3);
            v33.point.t = v9.t;

            DrawTriangle_Shaded(v11, v22, v33);
        }
Пример #2
0
        private void DrawPrimitive(Vector v1, Vector v2, Vector v3)
        {
            Vector v5 = v1 * View;
            Vector v6 = v2 * View;
            Vector v7 = v3 * View;

            Vector v9  = v5 * Projection;
            Vector v10 = v6 * Projection;
            Vector v11 = v7 * Projection;

            Vector p1 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v9);
            Vector p2 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v10);
            Vector p3 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v11);

            //三角形的线框模式
            DrawTriangle_WireFrame(p1, p2, p3);
        }
Пример #3
0
        private void DrawPrimitive(Vector v1, Vector v2, Vector v3, Vector v4)
        {
            Vector v5 = v1 * View;
            Vector v6 = v2 * View;
            Vector v7 = v3 * View;
            Vector v8 = v4 * View;

            Vector v9  = v5 * Projection;
            Vector v10 = v6 * Projection;
            Vector v11 = v7 * Projection;
            Vector v12 = v8 * Projection;

            Vector p1 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v9);
            Vector p2 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v10);
            Vector p3 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v11);
            Vector p4 = MyStaticMethod.TransformHomogenize(this.BitMapWidth, this.BitMapHeight, v12);

            //四边形的线框模式
            DrawRect_WireFrame(p1, p2, p3, p4);
        }