Beispiel #1
0
        private void SimpleLookAt_Paint(object sender, PaintEventArgs e)
        {
            Ratchet.Math.mat4 screen = Ratchet.Math.mat4.Perspective(2.8f, Width / Height, 0.0f, 1.0f).Transpose();
            Ratchet.Math.mat4 lookAt = Ratchet.Math.mat4.LookAt(_CameraPosition, _CameraLookAt, new Ratchet.Math.vec3(0.0f, 1.0f, 0.0f));

            _Cube.Draw(e.Graphics, Brushes.Red, Ratchet.Math.mat4.Identity(), lookAt, screen);
        }
Beispiel #2
0
 public void Draw(System.Drawing.Graphics g, System.Drawing.Brush b, Ratchet.Math.mat4 model, Ratchet.Math.mat4 view, Ratchet.Math.mat4 projection)
 {
     _1.Draw(g, b, model, view, projection);
     _2.Draw(g, b, model, view, projection);
     _3.Draw(g, b, model, view, projection);
     _4.Draw(g, b, model, view, projection);
     _5.Draw(g, b, model, view, projection);
     _6.Draw(g, b, model, view, projection);
 }
        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)) });
        }