implemented Invert Y Axis mouse option and Fixed 4:3 Aspect option (but I have my doubt about the fixed aspect, is it correct? is it useful?)

This commit is contained in:
codeimp 2009-01-12 15:45:55 +00:00
parent 503be5d709
commit 67751b0808
2 changed files with 18 additions and 5 deletions

View file

@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.Rendering
private const float PROJ_NEAR_PLANE = 1f;
private const float CROSSHAIR_SCALE = 0.06f;
private const float FOG_RANGE = 0.9f;
private const float FIXED_ASPECT = 4.0f / 3.0f;
#endregion
@ -275,10 +276,19 @@ namespace CodeImp.DoomBuilder.Rendering
// This creates the projection
internal void CreateProjection()
{
// Calculate aspect
float aspect = (float)General.Map.Graphics.RenderTarget.ClientSize.Width /
(float)General.Map.Graphics.RenderTarget.ClientSize.Height;
float aspect;
// Determine aspect to use
if(General.Settings.FixedAspect)
{
aspect = FIXED_ASPECT;
}
else
{
aspect = (float)General.Map.Graphics.RenderTarget.ClientSize.Width /
(float)General.Map.Graphics.RenderTarget.ClientSize.Height;
}
// The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows:
// yscale = 1 / tan(fovY / 2)
// xscale = yscale / aspect

View file

@ -68,7 +68,10 @@ namespace CodeImp.DoomBuilder.VisualModes
{
// Change camera angles with the mouse changes
anglexy -= delta.x * ANGLE_FROM_MOUSE;
anglez += delta.y * ANGLE_FROM_MOUSE;
if(General.Settings.InvertYAxis)
anglez -= delta.y * ANGLE_FROM_MOUSE;
else
anglez += delta.y * ANGLE_FROM_MOUSE;
// Normalize angles
anglexy = Angle2D.Normalized(anglexy);