From 67751b080804f59f0a0561d9fbdbd0fbbdac9641 Mon Sep 17 00:00:00 2001 From: codeimp Date: Mon, 12 Jan 2009 15:45:55 +0000 Subject: [PATCH] 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?) --- Source/Rendering/Renderer3D.cs | 18 ++++++++++++++---- Source/VisualModes/VisualCamera.cs | 5 ++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/Rendering/Renderer3D.cs b/Source/Rendering/Renderer3D.cs index fe71bf4d..6f9ec0fc 100644 --- a/Source/Rendering/Renderer3D.cs +++ b/Source/Rendering/Renderer3D.cs @@ -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 diff --git a/Source/VisualModes/VisualCamera.cs b/Source/VisualModes/VisualCamera.cs index 3d3b5854..0e708d43 100644 --- a/Source/VisualModes/VisualCamera.cs +++ b/Source/VisualModes/VisualCamera.cs @@ -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);