コード例 #1
0
        public void Draw(System.Drawing.Graphics g, System.Drawing.Brush b, Ratchet.Math.mat4 model, Ratchet.Math.mat4 view, Ratchet.Math.mat4 projection)
        {
            Triangle3 t = (projection * (view * (model * this)));

            Ratchet.Math.vec2 p1 = new Ratchet.Math.vec2(t.p1.x / t.p1.z, -t.p1.y / t.p1.z);
            Ratchet.Math.vec2 p2 = new Ratchet.Math.vec2(t.p2.x / t.p2.z, -t.p2.y / t.p2.z);
            Ratchet.Math.vec2 p3 = new Ratchet.Math.vec2(t.p3.x / t.p3.z, -t.p3.y / t.p3.z);

            g.FillPolygon(b, new PointF[] { new PointF((p1.x + 1.0f) * (640 / 2), (p1.y + 1.0f) * (480 / 2)), new PointF((p2.x + 1.0f) * (640 / 2), (p2.y + 1.0f) * (480 / 2)), new PointF((p3.x + 1.0f) * (640 / 2), (p3.y + 1.0f) * (480 / 2)) });
        }
コード例 #2
0
 public Triangle2(Ratchet.Math.vec2 p1, Ratchet.Math.vec2 p2, Ratchet.Math.vec2 p3)
 {
     this.p1 = p1;
     this.p2 = p2;
     this.p3 = p3;
 }