mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-23 09:52:23 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
37 lines
1.2 KiB
C#
Executable file
37 lines
1.2 KiB
C#
Executable file
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
namespace FSO.Common.Rendering.Framework.Camera
|
|
{
|
|
/// <summary>
|
|
/// Orthographic camera for the game. Used for rendering lots.
|
|
/// </summary>
|
|
public class OrthographicCamera : BasicCamera
|
|
{
|
|
public OrthographicCamera(GraphicsDevice device, Vector3 Position, Vector3 Target, Vector3 Up)
|
|
: base(device, Position, Target, Up)
|
|
{
|
|
}
|
|
|
|
protected override void CalculateProjection()
|
|
{
|
|
var device = m_Device;
|
|
var aspect = device.Viewport.AspectRatio * AspectRatioMultiplier;
|
|
|
|
var ratioX = m_ProjectionOrigin.X / device.Viewport.Width;
|
|
var ratioY = m_ProjectionOrigin.Y / device.Viewport.Height;
|
|
|
|
var projectionX = 0.0f - (1.0f * ratioX);
|
|
var projectionY = (1.0f * ratioY);
|
|
|
|
m_Projection = Matrix.CreateOrthographicOffCenter(
|
|
projectionX, projectionX + 1.0f,
|
|
((projectionY - 1.0f) / aspect), (projectionY) / aspect,
|
|
NearPlane, FarPlane
|
|
);
|
|
|
|
var zoom = 1 / m_Zoom;
|
|
m_Projection = m_Projection * Matrix.CreateScale(zoom);
|
|
}
|
|
}
|
|
}
|