mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Changed, Visual mode: adjusted fog density calculation to better match with GZDoom.
Fixed, Visual mode: alpha-based texture picking didn't work correctly on HiRes images. Fixed, Visual mode: fog density was calculated incorrectly for things lit by dynamic lights. Fixed, Edit Sector window, UDMF: "Fade" and "Light" color pickers initial values were incorrect when displaying mixed values. Fixed, Edit Thing window, UDMF: "Color" color picker initial value was incorrect when displaying mixed values.
This commit is contained in:
parent
b9d86faf3e
commit
5fe6c91ffc
7 changed files with 101 additions and 113 deletions
|
@ -51,6 +51,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
{
|
{
|
||||||
// Apply new color
|
// Apply new color
|
||||||
panel.BackColor = dialog.Color;
|
panel.BackColor = dialog.Color;
|
||||||
|
|
||||||
//mxd. Dispatch Event
|
//mxd. Dispatch Event
|
||||||
if(ColorChanged != null) ColorChanged(this, EventArgs.Empty);
|
if(ColorChanged != null) ColorChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
@ -59,14 +60,10 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Resized
|
// Resized
|
||||||
private void ColorControl_Resize(object sender, EventArgs e)
|
private void ColorControl_Resize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
button.Left = ClientSize.Width - button.Width;
|
||||||
{
|
panel.Left = ClientSize.Width - button.Width - panel.Width - 3;
|
||||||
button.Left = ClientSize.Width - button.Width;
|
label.Left = 0;
|
||||||
panel.Left = ClientSize.Width - button.Width - panel.Width - 3;
|
label.Width = panel.Left;
|
||||||
label.Left = 0;
|
|
||||||
label.Width = panel.Left;
|
|
||||||
}
|
|
||||||
catch(Exception) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse pressed on button
|
// Mouse pressed on button
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using System.Windows.Forms;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -15,93 +15,109 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
||||||
{
|
{
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
|
||||||
public event EventHandler OnValueChanged; //mxd
|
public event EventHandler OnValueChanged;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
private int defaultValue;
|
private int defaultvalue;
|
||||||
private string field;
|
private string field;
|
||||||
private bool blockUpdate;
|
private bool blockupdate;
|
||||||
|
private bool blockevents;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Properties
|
#region ================== Properties
|
||||||
|
|
||||||
public int DefaultValue { get { return defaultValue; } set { defaultValue = value; } }
|
public int DefaultValue { get { return defaultvalue; } set { defaultvalue = value; } }
|
||||||
public string Label { get { return cpColor.Label; } set { cpColor.Label = value; } }
|
public string Label { get { return cpColor.Label; } set { cpColor.Label = value; } }
|
||||||
public string Field { get { return field; } set { field = value; } }
|
public string Field { get { return field; } set { field = value; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ================== Constructor
|
||||||
|
|
||||||
public ColorFieldsControl()
|
public ColorFieldsControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValueFrom(UniFields fields)
|
#endregion
|
||||||
|
|
||||||
|
#region ================== Methods
|
||||||
|
|
||||||
|
public void SetValueFrom(UniFields fields, bool first)
|
||||||
{
|
{
|
||||||
string newValue = String.Format("{0:X6}", UniFields.GetInteger(fields, field, defaultValue));
|
blockevents = true;
|
||||||
tbColor.Text = ((!string.IsNullOrEmpty(tbColor.Text) && tbColor.Text != newValue) ? "" : newValue);
|
|
||||||
CheckColor();
|
string colorval = String.Format("{0:X6}", UniFields.GetInteger(fields, field, defaultvalue));
|
||||||
|
if(first)
|
||||||
|
{
|
||||||
|
tbColor.Text = colorval;
|
||||||
|
}
|
||||||
|
else if(!string.IsNullOrEmpty(tbColor.Text) && colorval != tbColor.Text)
|
||||||
|
{
|
||||||
|
blockupdate = true;
|
||||||
|
tbColor.Text = string.Empty;
|
||||||
|
cpColor.Color = PixelColor.FromInt(defaultvalue).WithAlpha(255);
|
||||||
|
blockupdate = false;
|
||||||
|
|
||||||
|
CheckColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
blockevents = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyTo(UniFields fields, int oldValue)
|
public void ApplyTo(UniFields fields, int oldvalue)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(tbColor.Text))
|
int colorval = !string.IsNullOrEmpty(tbColor.Text) ? (cpColor.Color.ToInt() & 0x00FFFFFF) : oldvalue;
|
||||||
{
|
UniFields.SetInteger(fields, field, colorval, defaultvalue);
|
||||||
UniFields.SetInteger(fields, field, oldValue, defaultValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UniFields.SetInteger(fields, field, (cpColor.Color.ToInt() & 0x00ffffff), defaultValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckColor()
|
private void CheckColor()
|
||||||
{
|
{
|
||||||
bool changed = string.IsNullOrEmpty(tbColor.Text) || (cpColor.Color.ToInt() & 0x00ffffff) != defaultValue;
|
bool changed = string.IsNullOrEmpty(tbColor.Text) || (cpColor.Color.ToInt() & 0x00FFFFFF) != defaultvalue;
|
||||||
bReset.Visible = changed;
|
bReset.Visible = changed;
|
||||||
tbColor.ForeColor = changed ? SystemColors.WindowText : SystemColors.GrayText;
|
tbColor.ForeColor = (changed ? SystemColors.WindowText : SystemColors.GrayText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
|
||||||
private void bReset_Click(object sender, EventArgs e)
|
private void bReset_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
cpColor.Color = PixelColor.FromInt(defaultValue).WithAlpha(255);
|
cpColor.Focus(); // Otherwise the focus will go to cpColor's textbox, which is not what we want
|
||||||
|
cpColor.Color = PixelColor.FromInt(defaultvalue).WithAlpha(255);
|
||||||
cpColor_ColorChanged(this, EventArgs.Empty);
|
cpColor_ColorChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cpColor_ColorChanged(object sender, EventArgs e)
|
private void cpColor_ColorChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(blockUpdate) return;
|
if(blockupdate) return;
|
||||||
|
|
||||||
blockUpdate = true;
|
blockupdate = true;
|
||||||
tbColor.Text = String.Format("{0:X6}", (cpColor.Color.ToInt() & 0x00ffffff));
|
tbColor.Text = String.Format("{0:X6}", (cpColor.Color.ToInt() & 0x00FFFFFF));
|
||||||
blockUpdate = false;
|
blockupdate = false;
|
||||||
|
|
||||||
CheckColor();
|
CheckColor();
|
||||||
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tbColor_TextChanged(object sender, EventArgs e)
|
private void tbColor_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(blockUpdate) return;
|
if(blockupdate) return;
|
||||||
int colorVal;
|
|
||||||
|
int colorval;
|
||||||
if(int.TryParse(tbColor.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out colorVal))
|
if(int.TryParse(tbColor.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out colorval))
|
||||||
{
|
{
|
||||||
colorVal = General.Clamp(colorVal, 0, 16777215);
|
colorval = General.Clamp(colorval, 0, 0xFFFFFF);
|
||||||
|
cpColor.Color = PixelColor.FromInt(colorval).WithAlpha(255);
|
||||||
blockUpdate = true;
|
|
||||||
cpColor.Color = PixelColor.FromInt(colorVal).WithAlpha(255);
|
|
||||||
blockUpdate = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckColor();
|
CheckColor();
|
||||||
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -854,17 +854,15 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = CreateThingPositionMatrix(t);
|
world = CreateThingPositionMatrix(t);
|
||||||
|
|
||||||
//mxd. If current thing is light - set it's color to light color
|
//mxd. If current thing is light - set it's color to light color
|
||||||
Color4 litcolor;
|
|
||||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.SRB2Type) != -1 && !fullbrightness)
|
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.SRB2Type) != -1 && !fullbrightness)
|
||||||
{
|
{
|
||||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||||
litcolor = t.LightColor;
|
|
||||||
vertexcolor = t.LightColor;
|
vertexcolor = t.LightColor;
|
||||||
}
|
}
|
||||||
//mxd. Check if Thing is affected by dynamic lights and set color accordingly
|
//mxd. Check if Thing is affected by dynamic lights and set color accordingly
|
||||||
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||||
{
|
{
|
||||||
litcolor = GetLitColorForThing(t);
|
Color4 litcolor = GetLitColorForThing(t);
|
||||||
if(litcolor.ToArgb() != 0)
|
if(litcolor.ToArgb() != 0)
|
||||||
{
|
{
|
||||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||||
|
@ -873,7 +871,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
litcolor = new Color4();
|
|
||||||
vertexcolor = new Color4();
|
vertexcolor = new Color4();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -889,8 +886,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
if(wantedshaderpass > 7)
|
if(wantedshaderpass > 7)
|
||||||
{
|
{
|
||||||
graphics.Shaders.World3D.World = world;
|
graphics.Shaders.World3D.World = world;
|
||||||
float fogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor);
|
||||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogfactor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the colors to use
|
// Set the colors to use
|
||||||
|
@ -1195,17 +1191,15 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = CreateThingPositionMatrix(t);
|
world = CreateThingPositionMatrix(t);
|
||||||
|
|
||||||
//mxd. If current thing is light - set it's color to light color
|
//mxd. If current thing is light - set it's color to light color
|
||||||
Color4 litcolor;
|
|
||||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.SRB2Type) != -1 && !fullbrightness)
|
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.SRB2Type) != -1 && !fullbrightness)
|
||||||
{
|
{
|
||||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||||
litcolor = t.LightColor;
|
|
||||||
vertexcolor = t.LightColor;
|
vertexcolor = t.LightColor;
|
||||||
}
|
}
|
||||||
//mxd. Check if Thing is affected by dynamic lights and set color accordingly
|
//mxd. Check if Thing is affected by dynamic lights and set color accordingly
|
||||||
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||||
{
|
{
|
||||||
litcolor = GetLitColorForThing(t);
|
Color4 litcolor = GetLitColorForThing(t);
|
||||||
if(litcolor.ToArgb() != 0)
|
if(litcolor.ToArgb() != 0)
|
||||||
{
|
{
|
||||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||||
|
@ -1214,7 +1208,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
litcolor = new Color4();
|
|
||||||
vertexcolor = new Color4();
|
vertexcolor = new Color4();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1226,16 +1219,14 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
currentshaderpass = wantedshaderpass;
|
currentshaderpass = wantedshaderpass;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. set variables for fog rendering?
|
//mxd. Set variables for fog rendering?
|
||||||
if(wantedshaderpass > 7)
|
if(wantedshaderpass > 7)
|
||||||
{
|
{
|
||||||
graphics.Shaders.World3D.World = world;
|
graphics.Shaders.World3D.World = world;
|
||||||
|
if(t.FogFactor != fogfactor)
|
||||||
float curfogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
|
||||||
if(curfogfactor != fogfactor)
|
|
||||||
{
|
{
|
||||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, curfogfactor);
|
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor);
|
||||||
fogfactor = curfogfactor;
|
fogfactor = t.FogFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1428,18 +1419,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
Color4 vertexcolor = new Color4(t.VertexColor);
|
Color4 vertexcolor = new Color4(t.VertexColor);
|
||||||
|
|
||||||
//check if model is affected by dynamic lights and set color accordingly
|
// Check if model is affected by dynamic lights and set color accordingly
|
||||||
Color4 litcolor;
|
|
||||||
if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||||
{
|
graphics.Shaders.World3D.VertexColor = vertexcolor + GetLitColorForThing(t);
|
||||||
litcolor = GetLitColorForThing(t);
|
|
||||||
graphics.Shaders.World3D.VertexColor = vertexcolor + litcolor;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
||||||
litcolor = new Color4();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the shader pass we want to use for this object
|
// Determine the shader pass we want to use for this object
|
||||||
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
||||||
|
@ -1469,13 +1453,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = General.Map.Data.ModeldefEntries[t.Thing.SRB2Type].Transform * modelscale * modelrotation * t.Position;
|
world = General.Map.Data.ModeldefEntries[t.Thing.SRB2Type].Transform * modelscale * modelrotation * t.Position;
|
||||||
ApplyMatrices3D();
|
ApplyMatrices3D();
|
||||||
|
|
||||||
//mxd. set variables for fog rendering
|
//mxd. Set variables for fog rendering
|
||||||
if(wantedshaderpass > 7)
|
if(wantedshaderpass > 7)
|
||||||
{
|
{
|
||||||
graphics.Shaders.World3D.World = world;
|
graphics.Shaders.World3D.World = world;
|
||||||
if(t.Thing.Sector != null) graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
if(t.Thing.Sector != null) graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||||
float fogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor);
|
||||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogfactor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < group.Key.Model.Meshes.Count; i++)
|
for(int i = 0; i < group.Key.Model.Meshes.Count; i++)
|
||||||
|
@ -1545,18 +1528,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
t.Update();
|
t.Update();
|
||||||
Color4 vertexcolor = new Color4(t.VertexColor);
|
Color4 vertexcolor = new Color4(t.VertexColor);
|
||||||
|
|
||||||
//check if model is affected by dynamic lights and set color accordingly
|
// Check if model is affected by dynamic lights and set color accordingly
|
||||||
Color4 litcolor;
|
|
||||||
if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||||
{
|
graphics.Shaders.World3D.VertexColor = vertexcolor + GetLitColorForThing(t);
|
||||||
litcolor = GetLitColorForThing(t);
|
|
||||||
graphics.Shaders.World3D.VertexColor = vertexcolor + litcolor;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
||||||
litcolor = new Color4();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the shader pass we want to use for this object
|
// Determine the shader pass we want to use for this object
|
||||||
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
||||||
|
@ -1586,13 +1562,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = General.Map.Data.ModeldefEntries[t.Thing.SRB2Type].Transform * modelscale * modelrotation * t.Position;
|
world = General.Map.Data.ModeldefEntries[t.Thing.SRB2Type].Transform * modelscale * modelrotation * t.Position;
|
||||||
ApplyMatrices3D();
|
ApplyMatrices3D();
|
||||||
|
|
||||||
//mxd. set variables for fog rendering
|
//mxd. Set variables for fog rendering
|
||||||
if(wantedshaderpass > 7)
|
if(wantedshaderpass > 7)
|
||||||
{
|
{
|
||||||
graphics.Shaders.World3D.World = world;
|
graphics.Shaders.World3D.World = world;
|
||||||
if(t.Thing.Sector != null) graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
if(t.Thing.Sector != null) graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||||
float fogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor);
|
||||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogfactor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GZModel model = General.Map.Data.ModeldefEntries[t.Thing.SRB2Type].Model;
|
GZModel model = General.Map.Data.ModeldefEntries[t.Thing.SRB2Type].Model;
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
{
|
{
|
||||||
#region ================== Constants
|
#region ================== Constants
|
||||||
|
|
||||||
public const float FOG_DENSITY_SCALER = -1.442692f / 256000f; //-1.442692f / 64000f; //mxd
|
private const float FOG_DENSITY_SCALER = -1.442692f / 512000f; //mxd. It's -1.442692f / 64000f in GZDoom...;
|
||||||
|
private const int FADE_MULTIPLIER = 4; //mxd
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -198,27 +199,27 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
boundingBox = BoundingBoxTools.CalculateBoundingPlane(bbs);
|
boundingBox = BoundingBoxTools.CalculateBoundingPlane(bbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Calculate fogdistance
|
//mxd. Calculate fogdistance
|
||||||
//TODO: this doesn't match any GZDoom light mode...
|
//TODO: this doesn't match any GZDoom light mode...
|
||||||
//GZDoom: gl_renderstate.h, SetFog();
|
//GZDoom: gl_renderstate.h, SetFog();
|
||||||
//GZDoom: gl_lightlevel.cpp gl_SetFog();
|
//GZDoom: gl_lightlevel.cpp gl_SetFog();
|
||||||
protected float CalculateFogFactor(int brightness) { return CalculateFogFactor(Sector.Sector.FogMode, brightness); }
|
protected float CalculateFogFactor(int brightness) { return CalculateFogFactor(Sector.Sector.FogMode, brightness); }
|
||||||
public static float CalculateFogFactor(SectorFogMode mode, int brightness)
|
public static float CalculateFogFactor(SectorFogMode mode, int brightness)
|
||||||
{
|
{
|
||||||
float density;
|
float density;
|
||||||
switch (mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case SectorFogMode.OUTSIDEFOGDENSITY:
|
case SectorFogMode.OUTSIDEFOGDENSITY:
|
||||||
density = General.Map.Data.MapInfo.OutsideFogDensity;
|
density = General.Map.Data.MapInfo.OutsideFogDensity * FADE_MULTIPLIER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SectorFogMode.FOGDENSITY:
|
case SectorFogMode.FOGDENSITY:
|
||||||
density = General.Map.Data.MapInfo.FogDensity;
|
density = General.Map.Data.MapInfo.FogDensity * FADE_MULTIPLIER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SectorFogMode.FADE:
|
case SectorFogMode.FADE:
|
||||||
density = General.Clamp(255 - brightness, 30, 255) * 4;
|
density = General.Clamp(255 - brightness, 30, 255) * FADE_MULTIPLIER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SectorFogMode.CLASSIC:
|
case SectorFogMode.CLASSIC:
|
||||||
density = General.Clamp(255 - brightness, 30, 255);
|
density = General.Clamp(255 - brightness, 30, 255);
|
||||||
|
|
|
@ -37,7 +37,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
#region ================== Constants
|
#region ================== Constants
|
||||||
|
|
||||||
protected const int FIXED_RADIUS = 8; //mxd. Used to render things with zero width and radius
|
protected const int FIXED_RADIUS = 8; //mxd. Used to render things with zero width and radius
|
||||||
internal const float LIT_FOG_DENSITY_SCALER = 255 * VisualGeometry.FOG_DENSITY_SCALER; //mxd
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -314,8 +314,8 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
desaturation.Text = General.Clamp(sc.Fields.GetValue("desaturation", 0.0f), 0f, 1f).ToString();
|
desaturation.Text = General.Clamp(sc.Fields.GetValue("desaturation", 0.0f), 0f, 1f).ToString();
|
||||||
|
|
||||||
//Sector colors
|
//Sector colors
|
||||||
fadeColor.SetValueFrom(sc.Fields);
|
fadeColor.SetValueFrom(sc.Fields, true);
|
||||||
lightColor.SetValueFrom(sc.Fields);
|
lightColor.SetValueFrom(sc.Fields, true);
|
||||||
|
|
||||||
//Slopes
|
//Slopes
|
||||||
SetupFloorSlope(sc, true);
|
SetupFloorSlope(sc, true);
|
||||||
|
@ -421,8 +421,8 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
if(s.Fields.GetValue("desaturation", 0.0f).ToString() != desaturation.Text) desaturation.Text = "";
|
if(s.Fields.GetValue("desaturation", 0.0f).ToString() != desaturation.Text) desaturation.Text = "";
|
||||||
|
|
||||||
//Sector colors
|
//Sector colors
|
||||||
fadeColor.SetValueFrom(s.Fields);
|
fadeColor.SetValueFrom(s.Fields, false);
|
||||||
lightColor.SetValueFrom(s.Fields);
|
lightColor.SetValueFrom(s.Fields, false);
|
||||||
|
|
||||||
//Slopes
|
//Slopes
|
||||||
SetupFloorSlope(s, false);
|
SetupFloorSlope(s, false);
|
||||||
|
|
|
@ -213,7 +213,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
score.Text = ft.Fields.GetValue("score", 0).ToString();
|
score.Text = ft.Fields.GetValue("score", 0).ToString();
|
||||||
health.Text = ft.Fields.GetValue("health", 1).ToString();
|
health.Text = ft.Fields.GetValue("health", 1).ToString();
|
||||||
alpha.Text = ft.Fields.GetValue("alpha", 1.0f).ToString();
|
alpha.Text = ft.Fields.GetValue("alpha", 1.0f).ToString();
|
||||||
color.SetValueFrom(ft.Fields);
|
color.SetValueFrom(ft.Fields, true);
|
||||||
scale.SetValues(ft.ScaleX, ft.ScaleY, true);
|
scale.SetValues(ft.ScaleX, ft.ScaleY, true);
|
||||||
pitch.Text = ft.Pitch.ToString();
|
pitch.Text = ft.Pitch.ToString();
|
||||||
roll.Text = ft.Roll.ToString();
|
roll.Text = ft.Roll.ToString();
|
||||||
|
@ -293,7 +293,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
if(t.Fields.GetValue("alpha", 1.0f).ToString() != alpha.Text) alpha.Text = "";
|
if(t.Fields.GetValue("alpha", 1.0f).ToString() != alpha.Text) alpha.Text = "";
|
||||||
|
|
||||||
scale.SetValues(t.ScaleX, t.ScaleY, false);
|
scale.SetValues(t.ScaleX, t.ScaleY, false);
|
||||||
color.SetValueFrom(t.Fields);
|
color.SetValueFrom(t.Fields, false);
|
||||||
|
|
||||||
if(t.Pitch.ToString() != pitch.Text) pitch.Text = "";
|
if(t.Pitch.ToString() != pitch.Text) pitch.Text = "";
|
||||||
if(t.Roll.ToString() != roll.Text) roll.Text = "";
|
if(t.Roll.ToString() != roll.Text) roll.Text = "";
|
||||||
|
|
Loading…
Reference in a new issue