Preferences Form: renamed "Scale models in visual modes" to "Stretched view in visual modes". When enabled, this setting now increases vertical scale of the world and sprites in visual mode instead of decreasing vertical scale of models.

This commit is contained in:
MaxED 2014-09-20 18:34:06 +00:00
parent a1f81e6436
commit a6e44dc941
6 changed files with 27 additions and 31 deletions

View file

@ -106,7 +106,7 @@ namespace CodeImp.DoomBuilder.Config
private int gzMaxDynamicLights;
private float gzDynamicLightRadius;
private float gzDynamicLightIntensity;
private bool gzStretchModels;
private bool gzStretchView;
private float gzVertexScale2D;
private bool gzShowVisualVertices;
private float gzVertexScale3D;
@ -192,7 +192,7 @@ namespace CodeImp.DoomBuilder.Config
public int GZMaxDynamicLights { get { return gzMaxDynamicLights; } internal set { gzMaxDynamicLights = value; } }
public float GZDynamicLightRadius { get { return gzDynamicLightRadius; } internal set { gzDynamicLightRadius = value; } }
public float GZDynamicLightIntensity { get { return gzDynamicLightIntensity; } internal set { gzDynamicLightIntensity = value; } }
public bool GZStretchModels { get { return gzStretchModels; } internal set { gzStretchModels = value; } }
public bool GZStretchView { get { return gzStretchView; } internal set { gzStretchView = value; } }
public float GZVertexScale2D { get { return gzVertexScale2D; } internal set { gzVertexScale2D = value; } }
public bool GZShowVisualVertices { get { return gzShowVisualVertices; } internal set { gzShowVisualVertices = value; } }
public float GZVertexScale3D { get { return gzVertexScale3D; } internal set { gzVertexScale3D = value; } }
@ -301,7 +301,7 @@ namespace CodeImp.DoomBuilder.Config
gzMaxDynamicLights = cfg.ReadSetting("gzmaxdynamiclights", 16);
gzDynamicLightRadius = cfg.ReadSetting("gzdynamiclightradius", 1.0f);
gzDynamicLightIntensity = cfg.ReadSetting("gzdynamiclightintensity", 1.0f);
gzStretchModels = cfg.ReadSetting("gzstretchmodels", true);
gzStretchView = cfg.ReadSetting("gzstretchview", true);
gzVertexScale2D = cfg.ReadSetting("gzvertexscale2d", 1.0f);
gzShowVisualVertices = cfg.ReadSetting("gzshowvisualvertices", true);
gzVertexScale3D = cfg.ReadSetting("gzvertexscale3d", 1.0f);
@ -392,7 +392,7 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("gzmaxdynamiclights", gzMaxDynamicLights);
cfg.WriteSetting("gzdynamiclightradius", gzDynamicLightRadius);
cfg.WriteSetting("gzdynamiclightintensity", gzDynamicLightIntensity);
cfg.WriteSetting("gzstretchmodels", gzStretchModels);
cfg.WriteSetting("gzstretchview", gzStretchView);
cfg.WriteSetting("gzvertexscale2d", gzVertexScale2D);
cfg.WriteSetting("gzshowvisualvertices", gzShowVisualVertices);
cfg.WriteSetting("gzvertexscale3d", gzVertexScale3D);

View file

@ -23,8 +23,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
{
#region ================== Variables
private const float VERTICAL_STRETCH = 1 / 1.2f;
private class MD3LoadResult
{
public List<string> Skins;
@ -372,7 +370,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
v.y *= mde.Scale.X;
v.x *= mde.Scale.Y;
v.z *= mde.Scale.Z;
if(General.Settings.GZStretchModels) v.z *= VERTICAL_STRETCH; //GZDoom vertical stretch hack
//add zOffset
v.z += mde.zOffset;
@ -514,7 +511,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
v.x *= mde.Scale.X;
v.y *= mde.Scale.Y;
v.z *= mde.Scale.Z;
if(General.Settings.GZStretchModels) v.z *= VERTICAL_STRETCH; //GZDoom vertical stretch hack
//add zOffset
v.z += mde.zOffset;

View file

@ -41,6 +41,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 INVERTED_VERTICAL_STRETCH = 1.0f / 1.2f;
#endregion
@ -53,6 +54,7 @@ namespace CodeImp.DoomBuilder.Rendering
private Matrix worldviewproj;
private Matrix view2d;
private Matrix world;
private float viewstretch; //mxd
private Vector3D cameraposition;
private int shaderpass;
@ -254,8 +256,8 @@ namespace CodeImp.DoomBuilder.Rendering
internal void CreateProjection()
{
// Calculate aspect
float aspect = (float)General.Map.Graphics.RenderTarget.ClientSize.Width /
General.Map.Graphics.RenderTarget.ClientSize.Height;
float screenheight = General.Map.Graphics.RenderTarget.ClientSize.Height * (General.Settings.GZStretchView ? INVERTED_VERTICAL_STRETCH : 1.0f); //mxd
float aspect = General.Map.Graphics.RenderTarget.ClientSize.Width / screenheight;
// The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows:
// yscale = 1 / tan(fovY / 2)
@ -270,6 +272,9 @@ namespace CodeImp.DoomBuilder.Rendering
// Make the projection matrix
projection = Matrix.PerspectiveFovRH(fovy, aspect, PROJ_NEAR_PLANE, General.Settings.ViewDistance);
// Update the view stretch scaler (mxd)
viewstretch = (General.Settings.GZStretchView ? INVERTED_VERTICAL_STRETCH : 1.0f);
// Apply matrices
ApplyMatrices3D();
}
@ -1051,7 +1056,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Create the matrix for positioning / rotation
float sx = t.Thing.ScaleX * t.Thing.ActorScale.Width;
float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height;
float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height * viewstretch;
Matrix rotation = Matrix.RotationY(-(t.Thing.RollRad - General.Map.Data.ModeldefEntries[t.Thing.Type].RollOffset))
* Matrix.RotationX(-(t.Thing.PitchRad + General.Map.Data.ModeldefEntries[t.Thing.Type].PitchOffset))
* Matrix.RotationZ(t.Thing.Angle);

View file

@ -2851,9 +2851,6 @@ namespace CodeImp.DoomBuilder.Windows
[BeginAction("preferences")]
internal void ShowPreferences()
{
//mxd
bool stretchModels = General.Settings.GZStretchModels;
// Show preferences dialog
PreferencesForm prefform = new PreferencesForm();
if(prefform.ShowDialog(this) == DialogResult.OK)
@ -2873,8 +2870,6 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.Graphics.SetupSettings();
General.Map.UpdateConfiguration();
if(prefform.ReloadResources) General.Actions.InvokeAction("builder_reloadresources");
//mxd
if(stretchModels != General.Settings.GZStretchModels) General.Map.Data.ReloadModeldef();
}
// Redraw display

View file

@ -75,7 +75,7 @@ namespace CodeImp.DoomBuilder.Windows
this.colorvertices = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorhighlight = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorlinedefs = new CodeImp.DoomBuilder.Controls.ColorControl();
this.cbStretchModels = new System.Windows.Forms.CheckBox();
this.cbStretchView = new System.Windows.Forms.CheckBox();
this.squarethings = new System.Windows.Forms.CheckBox();
this.qualitydisplay = new System.Windows.Forms.CheckBox();
this.cancel = new System.Windows.Forms.Button();
@ -712,17 +712,17 @@ namespace CodeImp.DoomBuilder.Windows
this.colorlinedefs.Size = new System.Drawing.Size(168, 23);
this.colorlinedefs.TabIndex = 2;
//
// cbStretchModels
// cbStretchView
//
this.cbStretchModels.AutoSize = true;
this.cbStretchModels.Location = new System.Drawing.Point(236, 170);
this.cbStretchModels.Name = "cbStretchModels";
this.cbStretchModels.Size = new System.Drawing.Size(167, 18);
this.cbStretchModels.TabIndex = 18;
this.cbStretchModels.Text = "Scale models in visual modes";
this.toolTip1.SetToolTip(this.cbStretchModels, "If enabled, heights of models will be scaled down by 15% in Visual mode \r\nto mimi" +
"ck GZDoom\'s way of rendering.");
this.cbStretchModels.UseVisualStyleBackColor = true;
this.cbStretchView.AutoSize = true;
this.cbStretchView.Location = new System.Drawing.Point(236, 170);
this.cbStretchView.Name = "cbStretchView";
this.cbStretchView.Size = new System.Drawing.Size(177, 18);
this.cbStretchView.TabIndex = 18;
this.cbStretchView.Text = "Stretched view in visual modes";
this.toolTip1.SetToolTip(this.cbStretchView, "When enabled, visual mode will emulate \r\n(G)ZDoom\'s way of rendering by increasin" +
"g\r\nvertical scale of the world geometry and \r\nsprites by 15%.\r\n");
this.cbStretchView.UseVisualStyleBackColor = true;
//
// squarethings
//
@ -1406,7 +1406,7 @@ namespace CodeImp.DoomBuilder.Windows
this.appearancegroup1.Controls.Add(this.cbOldHighlightMode);
this.appearancegroup1.Controls.Add(label21);
this.appearancegroup1.Controls.Add(this.labelDynLightIntensity);
this.appearancegroup1.Controls.Add(this.cbStretchModels);
this.appearancegroup1.Controls.Add(this.cbStretchView);
this.appearancegroup1.Controls.Add(this.squarethings);
this.appearancegroup1.Controls.Add(this.tbDynLightIntensity);
this.appearancegroup1.Controls.Add(label20);
@ -2049,7 +2049,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label labelDynLightIntensity;
private Dotnetrix.Controls.TrackBar tbDynLightIntensity;
private System.Windows.Forms.CheckBox cbSynchCameras;
private System.Windows.Forms.CheckBox cbStretchModels;
private System.Windows.Forms.CheckBox cbStretchView;
private System.Windows.Forms.ToolTip toolTip1;
private Dotnetrix.Controls.TrackBar vertexScale;
private System.Windows.Forms.Label vertexScaleLabel;

View file

@ -102,7 +102,7 @@ namespace CodeImp.DoomBuilder.Windows
labelDynLightSize.Text = General.Settings.GZDynamicLightRadius.ToString();
tbDynLightIntensity.Value = General.Clamp((int)(General.Settings.GZDynamicLightIntensity * 10), tbDynLightIntensity.Minimum, tbDynLightIntensity.Maximum);
labelDynLightIntensity.Text = General.Settings.GZDynamicLightIntensity.ToString();
cbStretchModels.Checked = General.Settings.GZStretchModels;
cbStretchView.Checked = General.Settings.GZStretchView;
cbOldHighlightMode.Checked = General.Settings.GZOldHighlightMode;
vertexScale.Value = General.Clamp((int)(General.Settings.GZVertexScale2D), vertexScale.Minimum, vertexScale.Maximum);
vertexScaleLabel.Text = vertexScale.Value * 100 + "%" + (vertexScale.Value == 1 ? " (default)" : "");
@ -305,7 +305,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Settings.GZMaxDynamicLights = tbDynLightCount.Value;
General.Settings.GZDynamicLightRadius = (tbDynLightSize.Value / 10.0f);
General.Settings.GZDynamicLightIntensity = (tbDynLightIntensity.Value / 10.0f);
General.Settings.GZStretchModels = cbStretchModels.Checked;
General.Settings.GZStretchView = cbStretchView.Checked;
General.Settings.GZVertexScale2D = vertexScale.Value;
General.Settings.GZOldHighlightMode = cbOldHighlightMode.Checked;
General.Settings.GZMarkExtraFloors = cbMarkExtraFloors.Checked;