/// <summary> /// Adjust the aspect ratio of the camera. /// </summary> /// <param name="width">New width of the panel.</param> /// <param name="height">New height of the panel.</param> public void adjustCamera(int width, int height) { presentParams.BackBufferWidth = width; presentParams.BackBufferHeight = height; camera.SetCamera((float)width, (float)height); }
/// <summary> /// Method to setup the rendering device. /// Also initalizes all other variables used. /// </summary> /// <param name="panel">Panel to be used for rendering.</param> public ResourceManager(Panel panel) { setupDevice(panel); camera = new Camera(ref device); camera.SetCamera((float)panel.Width, (float)panel.Height); mesh = new List <Model>(); lights = new List <LightObj>(); // Add two blank meshes. One for the ground plane and one for the first model loaded. groundPlane = new GroundPlane(device, effect); mesh.Add(new Model(device, effect)); // Add the 3 lights. lights.Add(new LightObj(device, effect, true)); lights.Add(new LightObj(device, effect, false)); lights.Add(new LightObj(device, effect, false)); renderer = new Render(ref device, ref effect, ref mesh, ref groundPlane, panel.Width, panel.Height); }
private Render renderer; // Class to render the scene. #endregion Fields #region Constructors /// <summary> /// Method to setup the rendering device. /// Also initalizes all other variables used. /// </summary> /// <param name="panel">Panel to be used for rendering.</param> public ResourceManager(Panel panel) { setupDevice(panel); camera = new Camera(ref device); camera.SetCamera((float)panel.Width, (float)panel.Height); mesh = new List<Model>(); lights = new List<LightObj>(); // Add two blank meshes. One for the ground plane and one for the first model loaded. groundPlane = new GroundPlane(device, effect); mesh.Add(new Model(device, effect)); // Add the 3 lights. lights.Add(new LightObj(device, effect, true)); lights.Add(new LightObj(device, effect, false)); lights.Add(new LightObj(device, effect, false)); renderer = new Render(ref device, ref effect, ref mesh, ref groundPlane, panel.Width, panel.Height); }