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(); }
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); }
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(); }
private void OnReset(object sender, EventArgs e) { RenderDrawing.SetupCamera(); RenderDrawing.SetupLights(); }