Пример #1
0
        public static void CameraControl()
        {
            Vector i = Input.mouseInput * 0.1f;

            camera.eulerAngles += new Vector(i.y, i.x, 0);
            camera.MoveAt(Input.arrows);
            RenderDrawing.SetupCamera();
        }
Пример #2
0
        public RenderForm()
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            device = RenderDrawing.InitializeGraphics(this);

            renderers = new List <Renderer> ();

            RenderForm.renderers.Add(new Renderer(new Matrix4x4(), Models.ModelImporter.FromFile("Elf")));
            RenderForm.camera = new Camera(1000, -Vector.forward * 200 + Vector.up * 50, Vector.forward, Vector.up);

            text = new d3d.Font(device, this.Font);

            device.DeviceReset += new EventHandler(OnReset);
            OnReset(this, new EventArgs());
            Input.SetInputTo(this);
        }
Пример #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            CameraControl();
            base.OnPaint(e);
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.CornflowerBlue, 1.0f, 0);

            device.BeginScene();
            text.DrawText(null, "Camera : " + '\n' + "position " + camera.position.ToString() + '\n' + "euler " + camera.eulerAngles.ToString(), new Point(10, 10), Color.White);
            foreach (var rend in renderers)
            {
                RenderDrawing.DrawModel(rend);
            }
            device.EndScene();

            device.Present();
            this.Invalidate();
        }
Пример #4
0
 private void OnReset(object sender, EventArgs e)
 {
     RenderDrawing.SetupCamera();
     RenderDrawing.SetupLights();
 }