public OrthogonalCamera(float w, float h, bool offCenter = true) { float aspect = w / h; ViewFrustum = new Frustum(); if (offCenter) { mMatProjection = Matrix.OrthoOffCenterLH( -(Utils.Metrics.Tilesize * aspect / 2.0f), Utils.Metrics.Tilesize * aspect / 2.0f, -(Utils.Metrics.Tilesize / 2.0f), Utils.Metrics.Tilesize / 2.0f, 0.1f, 10000.0f ); } else { mMatProjection = Matrix.OrthoLH(Utils.Metrics.Tilesize * aspect, Utils.Metrics.Tilesize, 0.1f, 10000.0f); } Game.GameManager.GraphicsThread.GraphicsManager.Device.SetTransform(TransformState.Projection, mMatProjection); PreventWorldUpdate = false; }
public PerspectiveCamera() { ViewFrustum = new Frustum(); mMatProjection = Matrix.PerspectiveFovLH( 45.0f * ((float)Math.PI / 180.0f), (float)Game.GameManager.GraphicsThread.GraphicsManager.RenderWindow.ClientSize.Width / Game.GameManager.GraphicsThread.GraphicsManager.RenderWindow.ClientSize.Height, 0.1f, 1000.0f ); Game.GameManager.GraphicsThread.GraphicsManager.Device.SetTransform(TransformState.Projection, mMatProjection); }
public OrthogonalCamera() { float aspect = (float)Game.GameManager.GraphicsThread.GraphicsManager.RenderWindow.ClientSize.Width / (float)Game.GameManager.GraphicsThread.GraphicsManager.RenderWindow.ClientSize.Height; ViewFrustum = new Frustum(); mMatProjection = Matrix.OrthoOffCenterLH( -(Utils.Metrics.Tilesize * aspect / 2.0f), Utils.Metrics.Tilesize * aspect / 2.0f, -(Utils.Metrics.Tilesize / 2.0f), Utils.Metrics.Tilesize / 2.0f, 0.1f, 10000.0f ); Game.GameManager.GraphicsThread.GraphicsManager.Device.SetTransform(TransformState.Projection, mMatProjection); PreventWorldUpdate = false; }