mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-21 03:11:40 +00:00
Image Exporter: added option to chose between taking sector colors into account or not when exporting. Resolves #635
This commit is contained in:
parent
c2a6e577c7
commit
cbe231c853
3 changed files with 31 additions and 8 deletions
|
@ -47,13 +47,14 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
public string Extension;
|
||||
public bool Floor;
|
||||
public bool Fullbright;
|
||||
public bool ApplySectorColors;
|
||||
public bool Brightmap;
|
||||
public bool Tiles;
|
||||
public PixelFormat PixelFormat;
|
||||
public ImageFormat ImageFormat;
|
||||
public float Scale;
|
||||
|
||||
public ImageExportSettings(string path, string name, string extension, bool floor, bool fullbright, bool brightmap, bool tiles, float scale, PixelFormat pformat, ImageFormat iformat)
|
||||
public ImageExportSettings(string path, string name, string extension, bool floor, bool fullbright, bool applysectorcolors, bool brightmap, bool tiles, float scale, PixelFormat pformat, ImageFormat iformat)
|
||||
{
|
||||
Path = path;
|
||||
Name = name;
|
||||
|
@ -62,6 +63,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
Brightmap = brightmap;
|
||||
Tiles = tiles;
|
||||
Fullbright = fullbright;
|
||||
ApplySectorColors = applysectorcolors;
|
||||
PixelFormat = pformat;
|
||||
ImageFormat = iformat;
|
||||
Scale = scale;
|
||||
|
@ -306,10 +308,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
}
|
||||
|
||||
// Take sector colors into account
|
||||
int lightcolor = s.Fields.GetValue("lightcolor", 0xffffff);
|
||||
int surfacecolor = settings.Floor ? s.Fields.GetValue("color_floor", 0xffffff) : s.Fields.GetValue("color_ceiling", 0xffffff);
|
||||
Rendering.Color4 color = Rendering.PixelColor.Modulate(Rendering.PixelColor.FromInt(lightcolor), Rendering.PixelColor.FromInt(surfacecolor)).ToColorValue();
|
||||
Colorize(ref brushtexture, color.Red, color.Green, color.Blue);
|
||||
if (settings.ApplySectorColors)
|
||||
{
|
||||
int lightcolor = s.Fields.GetValue("lightcolor", 0xffffff);
|
||||
int surfacecolor = settings.Floor ? s.Fields.GetValue("color_floor", 0xffffff) : s.Fields.GetValue("color_ceiling", 0xffffff);
|
||||
Rendering.Color4 color = Rendering.PixelColor.Modulate(Rendering.PixelColor.FromInt(lightcolor), Rendering.PixelColor.FromInt(surfacecolor)).ToColorValue();
|
||||
Colorize(ref brushtexture, color.Red, color.Green, color.Blue);
|
||||
}
|
||||
|
||||
if (scale > 1.0f)
|
||||
ResizeImage(ref brushtexture, brushtexture.Width * (int)scale, brushtexture.Height * (int)scale);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.progress = new System.Windows.Forms.ProgressBar();
|
||||
this.lbPhase = new System.Windows.Forms.Label();
|
||||
this.cbApplySectorColors = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tbExportPath
|
||||
|
@ -181,7 +182,7 @@
|
|||
// cbBrightmap
|
||||
//
|
||||
this.cbBrightmap.AutoSize = true;
|
||||
this.cbBrightmap.Location = new System.Drawing.Point(279, 64);
|
||||
this.cbBrightmap.Location = new System.Drawing.Point(279, 84);
|
||||
this.cbBrightmap.Name = "cbBrightmap";
|
||||
this.cbBrightmap.Size = new System.Drawing.Size(106, 17);
|
||||
this.cbBrightmap.TabIndex = 15;
|
||||
|
@ -191,7 +192,7 @@
|
|||
// cbTiles
|
||||
//
|
||||
this.cbTiles.AutoSize = true;
|
||||
this.cbTiles.Location = new System.Drawing.Point(279, 88);
|
||||
this.cbTiles.Location = new System.Drawing.Point(279, 108);
|
||||
this.cbTiles.Name = "cbTiles";
|
||||
this.cbTiles.Size = new System.Drawing.Size(110, 17);
|
||||
this.cbTiles.TabIndex = 16;
|
||||
|
@ -240,6 +241,18 @@
|
|||
this.lbPhase.Text = "lbPhase";
|
||||
this.lbPhase.Visible = false;
|
||||
//
|
||||
// cbApplySectorColors
|
||||
//
|
||||
this.cbApplySectorColors.AutoSize = true;
|
||||
this.cbApplySectorColors.Checked = true;
|
||||
this.cbApplySectorColors.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cbApplySectorColors.Location = new System.Drawing.Point(279, 61);
|
||||
this.cbApplySectorColors.Name = "cbApplySectorColors";
|
||||
this.cbApplySectorColors.Size = new System.Drawing.Size(115, 17);
|
||||
this.cbApplySectorColors.TabIndex = 14;
|
||||
this.cbApplySectorColors.Text = "Apply sector colors";
|
||||
this.cbApplySectorColors.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ImageExportSettingsForm
|
||||
//
|
||||
this.AcceptButton = this.export;
|
||||
|
@ -253,6 +266,7 @@
|
|||
this.Controls.Add(this.cbScale);
|
||||
this.Controls.Add(this.cbTiles);
|
||||
this.Controls.Add(this.cbBrightmap);
|
||||
this.Controls.Add(this.cbApplySectorColors);
|
||||
this.Controls.Add(this.cbFullbright);
|
||||
this.Controls.Add(this.rbCeiling);
|
||||
this.Controls.Add(this.rbFloor);
|
||||
|
@ -297,5 +311,6 @@
|
|||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.ProgressBar progress;
|
||||
private System.Windows.Forms.Label lbPhase;
|
||||
private System.Windows.Forms.CheckBox cbApplySectorColors;
|
||||
}
|
||||
}
|
|
@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
|
|||
public string FilePath { get { return tbExportPath.Text.Trim(); } }
|
||||
public bool Floor { get { return rbFloor.Checked; } }
|
||||
public bool Fullbright { get { return cbFullbright.Checked; } }
|
||||
public bool ApplySectorColors { get { return cbApplySectorColors.Checked; } }
|
||||
public bool Brightmap { get { return cbBrightmap.Checked; } }
|
||||
public bool Tiles { get { return cbTiles.Checked; } }
|
||||
public float ImageScale { get { return (float)Math.Pow(2, cbScale.SelectedIndex); } }
|
||||
|
@ -99,6 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
|
|||
}
|
||||
|
||||
cbFullbright.Checked = General.Settings.ReadPluginSetting("imageexportfullbright", true);
|
||||
cbApplySectorColors.Checked = General.Settings.ReadPluginSetting("imageexportapplysectorcolors", true);
|
||||
cbBrightmap.Checked = General.Settings.ReadPluginSetting("imageexportbrightmap", false);
|
||||
cbTiles.Checked = General.Settings.ReadPluginSetting("imageexporttiles", false);
|
||||
cbScale.SelectedIndex = General.Settings.ReadPluginSetting("imageexportscale", 0);
|
||||
|
@ -158,7 +160,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
|
|||
export.Enabled = true;
|
||||
export.Text = "Cancel";
|
||||
|
||||
ImageExportSettings settings = new ImageExportSettings(Path.GetDirectoryName(FilePath), Path.GetFileNameWithoutExtension(FilePath), Path.GetExtension(FilePath), Floor, Fullbright, Brightmap, Tiles, ImageScale, GetPixelFormat(), GetImageFormat());
|
||||
ImageExportSettings settings = new ImageExportSettings(Path.GetDirectoryName(FilePath), Path.GetFileNameWithoutExtension(FilePath), Path.GetExtension(FilePath), Floor, Fullbright, ApplySectorColors, Brightmap, Tiles, ImageScale, GetPixelFormat(), GetImageFormat());
|
||||
|
||||
exportthread = new Thread(() => RunExport(settings));
|
||||
exportthread.Name = "Image export";
|
||||
|
@ -319,6 +321,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
|
|||
else
|
||||
{
|
||||
General.Settings.WritePluginSetting("imageexportfullbright", cbFullbright.Checked);
|
||||
General.Settings.WritePluginSetting("imageexportapplysectorcolors", cbApplySectorColors.Checked);
|
||||
General.Settings.WritePluginSetting("imageexportbrightmap", cbBrightmap.Checked);
|
||||
General.Settings.WritePluginSetting("imageexporttiles", cbTiles.Checked);
|
||||
General.Settings.WritePluginSetting("imageexportscale", cbScale.SelectedIndex);
|
||||
|
|
Loading…
Reference in a new issue