Exemplo n.º 1
0
 public Viewport()
 {
     camera = new Camera() { ProjectionMode = mode, Zoom = 2 };
     tw = new TextWriter(vw, vh, 50, 20);
 }
Exemplo n.º 2
0
        public void Resize()
        {
            w = pnlViewport.Control.Width;
            h = pnlViewport.Control.Height;

            if ((w == ow && h == oh) || (w <= 0 || h <= 0)) { return; }

            ow = vw;
            oh = vh;

            aspect_ratio = w / (float)h;

            perspective = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 0.1f, 1000);

            int xo = ((int)position & 1);
            int yo = ((int)position & 2) >> 1;

            vw = (w / (int)width) - 2;
            vh = (h / (int)height) - 2;

            tw = new TextWriter(vw, vh, vw, vh);
            tw.AddLine(name, new PointF(5, 5), Brushes.Blue);
            //tw.AddLine(name, new PointF(vw / 2 + 9, vh / 2 - 5), Brushes.Red, Fonts.AxisLabel);

            x = (xo * 2) + 1 + (vw * xo);
            y = (yo * 2) + 1 + (vh * yo);
        }