mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
lots of minor changes/fixes/additions
This commit is contained in:
parent
d904fb415c
commit
b3c83f95ce
26 changed files with 325 additions and 168 deletions
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 688 B |
|
@ -381,7 +381,6 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\MissingTexture3D.png" />
|
||||
<None Include="Resources\MissingTexture.png" />
|
||||
<None Include="Resources\UnknownImage.png" />
|
||||
<None Include="Resources\treeview.png" />
|
||||
|
@ -500,6 +499,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\Builder.ico" />
|
||||
<EmbeddedResource Include="Resources\MissingTexture3D.png" />
|
||||
<EmbeddedResource Include="Resources\Thing2D_Simple.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -36,6 +36,7 @@
|
|||
<Compile Include="LinedefsMode\DragLinedefsMode.cs" />
|
||||
<Compile Include="SectorsMode\DragSectorsMode.cs" />
|
||||
<Compile Include="Shared\DragGeometryMode.cs" />
|
||||
<Compile Include="Shared\DrawGeometryMode.cs" />
|
||||
<Compile Include="Testing\TriangulatorMode.cs" />
|
||||
<Compile Include="VisualMode\BaseVisualMode.cs" />
|
||||
<Compile Include="VisualMode\BaseVisualSector.cs" />
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
[EditMode]
|
||||
|
||||
public class DragLinedefsMode : DragGeometryMode
|
||||
public sealed class DragLinedefsMode : DragGeometryMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
[EditMode]
|
||||
|
||||
public class DragSectorsMode : DragGeometryMode
|
||||
public sealed class DragSectorsMode : DragGeometryMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
public class DragGeometryMode : ClassicMode
|
||||
public abstract class DragGeometryMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
59
Source/BuilderModes/Shared/DrawGeometryMode.cs
Normal file
59
Source/BuilderModes/Shared/DrawGeometryMode.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Shared
|
||||
{
|
||||
internal class DrawGeometryMode : IDisposable
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
// Disposing
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public DrawGeometryMode()
|
||||
{
|
||||
// Initialize
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
[EditMode]
|
||||
|
||||
public class DragVerticesMode : DragGeometryMode
|
||||
public sealed class DragVerticesMode : DragGeometryMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private float visualmousesensx;
|
||||
private float visualmousesensy;
|
||||
private float visualviewrange;
|
||||
private int imagebrightness;
|
||||
private bool backgroundload;
|
||||
private bool qualitydisplay;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -60,9 +63,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public bool BlackBrowsers { get { return blackbrowsers; } internal set { blackbrowsers = value; } }
|
||||
public float StitchDistance { get { return stitchdistance; } internal set { stitchdistance = value; } }
|
||||
public int VisualFOV { get { return visualfov; } internal set { visualfov = value; } }
|
||||
public int ImageBrightness { get { return imagebrightness; } internal set { imagebrightness = value; } }
|
||||
public float VisualMouseSensX { get { return visualmousesensx; } internal set { visualmousesensx = value; } }
|
||||
public float VisualMouseSensY { get { return visualmousesensy; } internal set { visualmousesensy = value; } }
|
||||
public float VisualViewRange { get { return visualviewrange; } internal set { visualviewrange = value; } }
|
||||
public bool BackgroundLoading { get { return backgroundload; } internal set { backgroundload = value; } }
|
||||
public bool QualityDisplay { get { return qualitydisplay; } internal set { qualitydisplay = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -93,6 +99,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
visualmousesensx = cfg.ReadSetting("visualmousesensx", 40f);
|
||||
visualmousesensy = cfg.ReadSetting("visualmousesensy", 40f);
|
||||
visualviewrange = cfg.ReadSetting("visualviewrange", 1000f);
|
||||
imagebrightness = cfg.ReadSetting("imagebrightness", 3);
|
||||
backgroundload = cfg.ReadSetting("backgroundload", true);
|
||||
qualitydisplay = cfg.ReadSetting("qualitydisplay", true);
|
||||
|
||||
// Success
|
||||
return true;
|
||||
|
@ -115,6 +124,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
cfg.WriteSetting("visualmousesensx", visualmousesensx);
|
||||
cfg.WriteSetting("visualmousesensy", visualmousesensy);
|
||||
cfg.WriteSetting("visualviewrange", visualviewrange);
|
||||
cfg.WriteSetting("imagebrightness", imagebrightness);
|
||||
cfg.WriteSetting("backgroundload", backgroundload);
|
||||
cfg.WriteSetting("qualitydisplay", qualitydisplay);
|
||||
|
||||
// Save settings configuration
|
||||
General.WriteLogLine("Saving program configuration...");
|
||||
|
|
|
@ -269,12 +269,16 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// If a loader is already running, stop it first
|
||||
if(backgroundloader != null) StopBackgroundLoader();
|
||||
|
||||
// Start a low priority thread to load images in background
|
||||
General.WriteLogLine("Starting background resource loading...");
|
||||
backgroundloader = new Thread(new ThreadStart(BackgroundLoad));
|
||||
backgroundloader.Name = "BackgroundLoader";
|
||||
backgroundloader.Priority = ThreadPriority.Lowest;
|
||||
backgroundloader.Start();
|
||||
// Only do background loading when preferred
|
||||
if(General.Settings.BackgroundLoading)
|
||||
{
|
||||
// Start a low priority thread to load images in background
|
||||
General.WriteLogLine("Starting background resource loading...");
|
||||
backgroundloader = new Thread(new ThreadStart(BackgroundLoad));
|
||||
backgroundloader.Name = "BackgroundLoader";
|
||||
backgroundloader.Priority = ThreadPriority.Lowest;
|
||||
backgroundloader.Start();
|
||||
}
|
||||
}
|
||||
|
||||
// This stops background loading
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
protected int height;
|
||||
protected float scaledwidth;
|
||||
protected float scaledheight;
|
||||
protected bool usecolorcorrection;
|
||||
|
||||
// GDI bitmap
|
||||
protected Bitmap bitmap;
|
||||
|
@ -67,8 +68,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
public string Name { get { return name; } }
|
||||
public long LongName { get { return longname; } }
|
||||
public bool UseColorCorrection { get { return usecolorcorrection; } set { usecolorcorrection = value; } }
|
||||
public PixelColorBlock PixelData { get { lock(this) { return pixeldata; } } }
|
||||
public Bitmap Bitmap { get { lock(this) { if(bitmap != null) return bitmap; else return CodeImp.DoomBuilder.Properties.Resources.Hourglass; } } }
|
||||
public Bitmap Bitmap { get { lock(this) { if(bitmap != null) return new Bitmap(bitmap); else return CodeImp.DoomBuilder.Properties.Resources.Hourglass; } } }
|
||||
public Texture Texture { get { lock(this) { return texture; } } }
|
||||
public bool IsLoaded { get { return (bitmap != null); } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
@ -86,6 +88,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
// Defaults
|
||||
usecolorcorrection = true;
|
||||
}
|
||||
|
||||
// Disposer
|
||||
|
@ -99,6 +104,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Clean up
|
||||
if(bitmap != null) bitmap.Dispose();
|
||||
if(texture != null) texture.Dispose();
|
||||
bitmap = null;
|
||||
texture = null;
|
||||
pixeldata = null;
|
||||
|
||||
// Done
|
||||
|
@ -118,9 +125,44 @@ namespace CodeImp.DoomBuilder.Data
|
|||
this.longname = Lump.MakeLongName(name);
|
||||
}
|
||||
|
||||
// This unloads the image
|
||||
public virtual void UnloadImage()
|
||||
{
|
||||
lock(this)
|
||||
{
|
||||
if(bitmap != null) bitmap.Dispose();
|
||||
bitmap = null;
|
||||
}
|
||||
}
|
||||
|
||||
// This requests loading the image
|
||||
public virtual void LoadImage()
|
||||
{
|
||||
BitmapData bmpdata;
|
||||
|
||||
// Determine amounts
|
||||
float gamma = (float)(General.Settings.ImageBrightness + 10) * 0.1f;
|
||||
float bright = (float)General.Settings.ImageBrightness * 5f;
|
||||
|
||||
// This applies brightness correction on the image
|
||||
if(IsLoaded && usecolorcorrection)
|
||||
{
|
||||
bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
|
||||
byte* pixels = (byte*)(bmpdata.Scan0.ToPointer());
|
||||
for(int p = 0; p < bmpdata.Stride * bmpdata.Height; p += 4)
|
||||
{
|
||||
// Apply color correction for individual colors
|
||||
float r = (float)pixels[p + 0] * gamma + bright;
|
||||
float g = (float)pixels[p + 1] * gamma + bright;
|
||||
float b = (float)pixels[p + 2] * gamma + bright;
|
||||
|
||||
// Clamp to 0..255 range
|
||||
if(r < 0f) pixels[p + 0] = 0; else if(r > 255f) pixels[p + 0] = 255; else pixels[p + 0] = (byte)r;
|
||||
if(g < 0f) pixels[p + 1] = 0; else if(g > 255f) pixels[p + 1] = 255; else pixels[p + 1] = (byte)g;
|
||||
if(b < 0f) pixels[p + 2] = 0; else if(b > 255f) pixels[p + 2] = 255; else pixels[p + 2] = (byte)b;
|
||||
}
|
||||
bitmap.UnlockBits(bmpdata);
|
||||
}
|
||||
}
|
||||
|
||||
// This creates the 2D pixel data
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
// Calculate camera direction vectors
|
||||
camvec = Vector3D.FromAngleXYZ(camanglexy, camanglez);
|
||||
camvecstrafe = Vector3D.FromAngleXYZ(camanglexy + Angle2D.PIHALF, camanglez);
|
||||
camvecstrafe = Vector3D.FromAngleXY(camanglexy + Angle2D.PIHALF);
|
||||
|
||||
// Move the camera
|
||||
if(keyforward) campos += camvec * CAMERA_SPEED;
|
||||
|
|
|
@ -916,10 +916,10 @@ namespace CodeImp.DoomBuilder
|
|||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
// Clean up
|
||||
config = null;
|
||||
configinfo = null;
|
||||
data.Dispose();
|
||||
data = null;
|
||||
config = null;
|
||||
configinfo = null;
|
||||
GC.Collect();
|
||||
|
||||
// Reload game configuration
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
namespace CodeImp.DoomBuilder.Geometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Responsible for creating and caching sector polygons.
|
||||
/// Responsible for creating sector polygons.
|
||||
/// Performs triangulation of sectors by using ear clipping.
|
||||
/// </summary>
|
||||
/// See: http://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
{
|
||||
Brush forecolor;
|
||||
Brush backcolor;
|
||||
|
||||
|
||||
// Do we need to redraw?
|
||||
if(CheckRedrawNeeded(bounds))
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
g.FillRectangle(backcolor, 0, 0, bounds.Width, bounds.Height);
|
||||
g.DrawImage(icon.Bitmap, General.MakeZoomedRect(icon.Bitmap.Size, imagerect));
|
||||
g.DrawString(this.Text, this.ListView.Font, forecolor, textpos);
|
||||
|
||||
|
||||
// Done
|
||||
g.Dispose();
|
||||
}
|
||||
|
|
|
@ -314,6 +314,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// This updates the status icon
|
||||
internal void UpdateStatusIcon()
|
||||
{
|
||||
if(IsDisposed) return;
|
||||
|
||||
// From another thread?
|
||||
if(statusbar.InvokeRequired)
|
||||
{
|
||||
|
@ -1094,8 +1096,14 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Update shortcut keys in menus
|
||||
ApplyShortcutKeys();
|
||||
|
||||
// Apply new settings if a map is open
|
||||
if(General.Map != null) General.Map.Map.UpdateConfiguration();
|
||||
// Map opened?
|
||||
if(General.Map != null)
|
||||
{
|
||||
// Setup and reload stuff
|
||||
General.Map.Graphics.SetupSettings();
|
||||
General.Map.Map.UpdateConfiguration();
|
||||
General.Map.ReloadResources();
|
||||
}
|
||||
|
||||
// Redraw display
|
||||
RedrawDisplay();
|
||||
|
|
100
Source/Interface/PreferencesForm.Designer.cs
generated
100
Source/Interface/PreferencesForm.Designer.cs
generated
|
@ -31,6 +31,12 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
System.Windows.Forms.Label label7;
|
||||
System.Windows.Forms.Label label6;
|
||||
System.Windows.Forms.Label label5;
|
||||
System.Windows.Forms.GroupBox groupBox1;
|
||||
System.Windows.Forms.Label label1;
|
||||
this.qualitydisplay = new System.Windows.Forms.CheckBox();
|
||||
this.backgroundload = new System.Windows.Forms.CheckBox();
|
||||
this.imagebrightnesslabel = new System.Windows.Forms.Label();
|
||||
this.imagebrightness = new System.Windows.Forms.TrackBar();
|
||||
this.colorsgroup1 = new System.Windows.Forms.GroupBox();
|
||||
this.colorgrid64 = new CodeImp.DoomBuilder.Interface.ColorControl();
|
||||
this.colorgrid = new CodeImp.DoomBuilder.Interface.ColorControl();
|
||||
|
@ -73,8 +79,13 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
label7 = new System.Windows.Forms.Label();
|
||||
label6 = new System.Windows.Forms.Label();
|
||||
label5 = new System.Windows.Forms.Label();
|
||||
groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).BeginInit();
|
||||
this.colorsgroup1.SuspendLayout();
|
||||
this.tabs.SuspendLayout();
|
||||
this.tabinterface.SuspendLayout();
|
||||
this.tabkeys.SuspendLayout();
|
||||
this.actioncontrolpanel.SuspendLayout();
|
||||
this.tabcolors.SuspendLayout();
|
||||
|
@ -109,6 +120,67 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
label5.TabIndex = 4;
|
||||
label5.Text = "Press the desired key combination here:";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(this.qualitydisplay);
|
||||
groupBox1.Controls.Add(this.backgroundload);
|
||||
groupBox1.Controls.Add(this.imagebrightnesslabel);
|
||||
groupBox1.Controls.Add(this.imagebrightness);
|
||||
groupBox1.Controls.Add(label1);
|
||||
groupBox1.Location = new System.Drawing.Point(8, 8);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new System.Drawing.Size(257, 196);
|
||||
groupBox1.TabIndex = 6;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = " Graphics ";
|
||||
//
|
||||
// qualitydisplay
|
||||
//
|
||||
this.qualitydisplay.AutoSize = true;
|
||||
this.qualitydisplay.Location = new System.Drawing.Point(25, 126);
|
||||
this.qualitydisplay.Name = "qualitydisplay";
|
||||
this.qualitydisplay.Size = new System.Drawing.Size(118, 18);
|
||||
this.qualitydisplay.TabIndex = 10;
|
||||
this.qualitydisplay.Text = "High quality display";
|
||||
this.qualitydisplay.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// backgroundload
|
||||
//
|
||||
this.backgroundload.AutoSize = true;
|
||||
this.backgroundload.Location = new System.Drawing.Point(25, 102);
|
||||
this.backgroundload.Name = "backgroundload";
|
||||
this.backgroundload.Size = new System.Drawing.Size(197, 18);
|
||||
this.backgroundload.TabIndex = 9;
|
||||
this.backgroundload.Text = "Load all texture and flats in memory";
|
||||
this.backgroundload.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// imagebrightnesslabel
|
||||
//
|
||||
this.imagebrightnesslabel.Location = new System.Drawing.Point(17, 75);
|
||||
this.imagebrightnesslabel.Name = "imagebrightnesslabel";
|
||||
this.imagebrightnesslabel.Size = new System.Drawing.Size(205, 14);
|
||||
this.imagebrightnesslabel.TabIndex = 8;
|
||||
this.imagebrightnesslabel.Text = "0";
|
||||
this.imagebrightnesslabel.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
//
|
||||
// imagebrightness
|
||||
//
|
||||
this.imagebrightness.LargeChange = 2;
|
||||
this.imagebrightness.Location = new System.Drawing.Point(17, 45);
|
||||
this.imagebrightness.Name = "imagebrightness";
|
||||
this.imagebrightness.Size = new System.Drawing.Size(205, 42);
|
||||
this.imagebrightness.TabIndex = 7;
|
||||
this.imagebrightness.ValueChanged += new System.EventHandler(this.imagebrightness_ValueChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(22, 28);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(148, 14);
|
||||
label1.TabIndex = 6;
|
||||
label1.Text = "Texture and Flats brightness:";
|
||||
//
|
||||
// colorsgroup1
|
||||
//
|
||||
this.colorsgroup1.Controls.Add(this.colorgrid64);
|
||||
|
@ -121,9 +193,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.colorsgroup1.Controls.Add(this.colorvertices);
|
||||
this.colorsgroup1.Controls.Add(this.colorhighlight);
|
||||
this.colorsgroup1.Controls.Add(this.colorlinedefs);
|
||||
this.colorsgroup1.Location = new System.Drawing.Point(12, 10);
|
||||
this.colorsgroup1.Location = new System.Drawing.Point(8, 8);
|
||||
this.colorsgroup1.Name = "colorsgroup1";
|
||||
this.colorsgroup1.Size = new System.Drawing.Size(181, 325);
|
||||
this.colorsgroup1.Size = new System.Drawing.Size(185, 327);
|
||||
this.colorsgroup1.TabIndex = 10;
|
||||
this.colorsgroup1.TabStop = false;
|
||||
this.colorsgroup1.Text = " Classic modes ";
|
||||
|
@ -287,10 +359,11 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
//
|
||||
// tabinterface
|
||||
//
|
||||
this.tabinterface.Controls.Add(groupBox1);
|
||||
this.tabinterface.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tabinterface.Location = new System.Drawing.Point(4, 23);
|
||||
this.tabinterface.Name = "tabinterface";
|
||||
this.tabinterface.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabinterface.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.tabinterface.Size = new System.Drawing.Size(590, 379);
|
||||
this.tabinterface.TabIndex = 0;
|
||||
this.tabinterface.Text = "Interface";
|
||||
|
@ -427,6 +500,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.tabcolors.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tabcolors.Location = new System.Drawing.Point(4, 23);
|
||||
this.tabcolors.Name = "tabcolors";
|
||||
this.tabcolors.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.tabcolors.Size = new System.Drawing.Size(590, 379);
|
||||
this.tabcolors.TabIndex = 2;
|
||||
this.tabcolors.Text = "Colors";
|
||||
|
@ -435,7 +509,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// blackbrowsers
|
||||
//
|
||||
this.blackbrowsers.AutoSize = true;
|
||||
this.blackbrowsers.Location = new System.Drawing.Point(13, 345);
|
||||
this.blackbrowsers.Location = new System.Drawing.Point(8, 344);
|
||||
this.blackbrowsers.Name = "blackbrowsers";
|
||||
this.blackbrowsers.Size = new System.Drawing.Size(241, 18);
|
||||
this.blackbrowsers.TabIndex = 13;
|
||||
|
@ -451,9 +525,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.colorsgroup3.Controls.Add(this.colorlinenumbers);
|
||||
this.colorsgroup3.Controls.Add(this.colorcomments);
|
||||
this.colorsgroup3.Controls.Add(this.colorplaintext);
|
||||
this.colorsgroup3.Location = new System.Drawing.Point(398, 10);
|
||||
this.colorsgroup3.Location = new System.Drawing.Point(392, 8);
|
||||
this.colorsgroup3.Name = "colorsgroup3";
|
||||
this.colorsgroup3.Size = new System.Drawing.Size(181, 325);
|
||||
this.colorsgroup3.Size = new System.Drawing.Size(190, 327);
|
||||
this.colorsgroup3.TabIndex = 12;
|
||||
this.colorsgroup3.TabStop = false;
|
||||
this.colorsgroup3.Text = " Script editor ";
|
||||
|
@ -548,9 +622,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.colorsgroup2.Controls.Add(this.colorselection3d);
|
||||
this.colorsgroup2.Controls.Add(this.colorhighlight3d);
|
||||
this.colorsgroup2.Controls.Add(this.colorcrosshair3d);
|
||||
this.colorsgroup2.Location = new System.Drawing.Point(205, 10);
|
||||
this.colorsgroup2.Location = new System.Drawing.Point(199, 8);
|
||||
this.colorsgroup2.Name = "colorsgroup2";
|
||||
this.colorsgroup2.Size = new System.Drawing.Size(181, 325);
|
||||
this.colorsgroup2.Size = new System.Drawing.Size(187, 327);
|
||||
this.colorsgroup2.TabIndex = 11;
|
||||
this.colorsgroup2.TabStop = false;
|
||||
this.colorsgroup2.Text = " 3D mode ";
|
||||
|
@ -594,9 +668,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
//
|
||||
// PreferencesForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(619, 464);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
|
@ -612,8 +684,12 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Preferences";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).EndInit();
|
||||
this.colorsgroup1.ResumeLayout(false);
|
||||
this.tabs.ResumeLayout(false);
|
||||
this.tabinterface.ResumeLayout(false);
|
||||
this.tabkeys.ResumeLayout(false);
|
||||
this.actioncontrolpanel.ResumeLayout(false);
|
||||
this.actioncontrolpanel.PerformLayout();
|
||||
|
@ -666,5 +742,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
private ColorControl colorgrid;
|
||||
private System.Windows.Forms.GroupBox colorsgroup1;
|
||||
private System.Windows.Forms.CheckBox blackbrowsers;
|
||||
private System.Windows.Forms.CheckBox qualitydisplay;
|
||||
private System.Windows.Forms.CheckBox backgroundload;
|
||||
private System.Windows.Forms.Label imagebrightnesslabel;
|
||||
private System.Windows.Forms.TrackBar imagebrightness;
|
||||
}
|
||||
}
|
|
@ -49,6 +49,11 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Initialize
|
||||
InitializeComponent();
|
||||
|
||||
// Interface
|
||||
imagebrightness.Value = General.Settings.ImageBrightness;
|
||||
backgroundload.Checked = General.Settings.BackgroundLoading;
|
||||
qualitydisplay.Checked = General.Settings.QualityDisplay;
|
||||
|
||||
// Fill list of actions
|
||||
actions = General.Actions.GetAllActions();
|
||||
foreach(Action a in actions)
|
||||
|
@ -285,6 +290,11 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// OK clicked
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Apply interface
|
||||
General.Settings.ImageBrightness = imagebrightness.Value;
|
||||
General.Settings.BackgroundLoading = backgroundload.Checked;
|
||||
General.Settings.QualityDisplay = qualitydisplay.Checked;
|
||||
|
||||
// Apply control keys to actions
|
||||
foreach(ListViewItem item in listactions.Items)
|
||||
General.Actions[item.Name].SetShortcutKey((int)item.SubItems[1].Tag);
|
||||
|
@ -343,5 +353,17 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Interface Panel
|
||||
|
||||
private void imagebrightness_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(imagebrightness.Value > 0)
|
||||
imagebrightnesslabel.Text = "+" + imagebrightness.Value.ToString();
|
||||
else
|
||||
imagebrightnesslabel.Text = imagebrightness.Value.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -117,136 +117,19 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="colorsgroup1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="colorgrid64.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorgrid.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorassociations.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorsoundlinedefs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorspeciallinedefs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorbackcolor.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorselection.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorvertices.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorhighlight.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorlinedefs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabinterface.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabkeys.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="listactions.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="actioncontrolpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="actioncontrol.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="actiontitle.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="actioncontrolclear.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="actionkey.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="actiondescription.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabcolors.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="blackbrowsers.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorsgroup3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorconstants.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorliterals.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorscriptbackground.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorkeywords.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorlinenumbers.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorcomments.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorplaintext.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorsgroup2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorselection3d.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorhighlight3d.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorcrosshair3d.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -116,7 +116,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
#region ================== Renderstates
|
||||
|
||||
// This completes initialization after the device has started or has been reset
|
||||
private void SetupSettings()
|
||||
public void SetupSettings()
|
||||
{
|
||||
// Setup renderstates
|
||||
device.SetRenderState(RenderState.AlphaRef, 0x0000007F);
|
||||
|
@ -140,6 +140,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
device.SetRenderState(RenderState.ZWriteEnable, false);
|
||||
device.SetRenderState(RenderState.Clipping, true);
|
||||
device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||
device.SetPixelShader(null);
|
||||
device.SetVertexShader(null);
|
||||
|
||||
// Sampler settings
|
||||
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
|
||||
|
@ -159,16 +161,28 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
device.SetTextureStageState(0, TextureStage.ResultArg, TextureArgument.Current);
|
||||
device.SetTextureStageState(0, TextureStage.TexCoordIndex, 0);
|
||||
|
||||
// Second texture stage
|
||||
device.SetTextureStageState(1, TextureStage.ColorOperation, TextureOperation.Modulate);
|
||||
device.SetTextureStageState(1, TextureStage.ColorArg1, TextureArgument.Current);
|
||||
device.SetTextureStageState(1, TextureStage.ColorArg2, TextureArgument.TFactor);
|
||||
device.SetTextureStageState(1, TextureStage.ResultArg, TextureArgument.Current);
|
||||
device.SetTextureStageState(1, TextureStage.TexCoordIndex, 0);
|
||||
|
||||
// No more further stages
|
||||
device.SetTextureStageState(1, TextureStage.ColorOperation, TextureOperation.Disable);
|
||||
device.SetTextureStageState(2, TextureStage.ColorOperation, TextureOperation.Disable);
|
||||
|
||||
// First alpha stage
|
||||
device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
|
||||
device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture);
|
||||
device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse);
|
||||
|
||||
// Second alpha stage
|
||||
device.SetTextureStageState(1, TextureStage.AlphaOperation, TextureOperation.Modulate);
|
||||
device.SetTextureStageState(1, TextureStage.AlphaArg1, TextureArgument.Current);
|
||||
device.SetTextureStageState(1, TextureStage.AlphaArg2, TextureArgument.TFactor);
|
||||
|
||||
// No more further stages
|
||||
device.SetTextureStageState(1, TextureStage.AlphaOperation, TextureOperation.Disable);
|
||||
device.SetTextureStageState(2, TextureStage.AlphaOperation, TextureOperation.Disable);
|
||||
|
||||
// Setup material
|
||||
Material material = new Material();
|
||||
|
@ -176,13 +190,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
material.Diffuse = ColorValue.FromColor(Color.White);
|
||||
material.Specular = ColorValue.FromColor(Color.White);
|
||||
device.Material = material;
|
||||
|
||||
// Keep a reference to the original buffers
|
||||
backbuffer = device.GetBackBuffer(0, 0);
|
||||
depthbuffer = device.GetDepthStencilSurface();
|
||||
|
||||
// Get the viewport
|
||||
viewport = device.Viewport;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -236,6 +243,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Add event to cancel resize event
|
||||
//device.DeviceResizing += new CancelEventHandler(CancelResize);
|
||||
|
||||
// Keep a reference to the original buffers
|
||||
backbuffer = device.GetBackBuffer(0, 0);
|
||||
depthbuffer = device.GetDepthStencilSurface();
|
||||
|
||||
// Get the viewport
|
||||
viewport = device.Viewport;
|
||||
|
||||
// Create shader manager
|
||||
shaders = new ShaderManager(this);
|
||||
|
||||
|
@ -324,6 +338,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
return false;
|
||||
}
|
||||
|
||||
// Keep a reference to the original buffers
|
||||
backbuffer = device.GetBackBuffer(0, 0);
|
||||
depthbuffer = device.GetDepthStencilSurface();
|
||||
|
||||
// Get the viewport
|
||||
viewport = device.Viewport;
|
||||
|
||||
// Initialize settings
|
||||
SetupSettings();
|
||||
|
||||
|
|
|
@ -144,31 +144,31 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
General.Map.Graphics.Device.VertexDeclaration = vertexdecl;
|
||||
|
||||
// Set effect
|
||||
if(manager.Enabled) effect.Begin(FX.DoNotSaveState);
|
||||
if(manager.Enabled && General.Settings.QualityDisplay) effect.Begin(FX.DoNotSaveState);
|
||||
}
|
||||
|
||||
// This begins a pass
|
||||
public void BeginPass(int index)
|
||||
{
|
||||
if(manager.Enabled) effect.BeginPass(index);
|
||||
if(manager.Enabled && General.Settings.QualityDisplay) effect.BeginPass(index);
|
||||
}
|
||||
|
||||
// This ends a pass
|
||||
public void EndPass()
|
||||
{
|
||||
if(manager.Enabled) effect.EndPass();
|
||||
if(manager.Enabled && General.Settings.QualityDisplay) effect.EndPass();
|
||||
}
|
||||
|
||||
// This ends te shader
|
||||
public void End()
|
||||
{
|
||||
if(manager.Enabled) effect.End();
|
||||
if(manager.Enabled && General.Settings.QualityDisplay) effect.End();
|
||||
}
|
||||
|
||||
// This applies properties during a pass
|
||||
public void ApplySettings()
|
||||
{
|
||||
if(manager.Enabled) effect.CommitChanges();
|
||||
if(manager.Enabled && General.Settings.QualityDisplay) effect.CommitChanges();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -75,6 +75,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
this.height = height;
|
||||
this.memorysize = (uint)width * (uint)height * (uint)sizeof(PixelColor);
|
||||
this.memory = (PixelColor*)VirtualAlloc(IntPtr.Zero, new UIntPtr(memorysize), General.MEM_COMMIT, General.PAGE_READWRITE);
|
||||
if(this.memory == (PixelColor*)0) throw new OutOfMemoryException();
|
||||
GC.AddMemoryPressure(memorysize);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Images
|
||||
private ResourceImage thingtexture;
|
||||
private ResourceImage thingtexturesimple;
|
||||
|
||||
// View settings (world coordinates)
|
||||
private float scale;
|
||||
|
@ -117,7 +118,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
internal Renderer2D(D3DDevice graphics) : base(graphics)
|
||||
{
|
||||
// Initialize
|
||||
thingtexturesimple = new ResourceImage("Thing2D_Simple.png");
|
||||
thingtexturesimple.UseColorCorrection = false;
|
||||
thingtexturesimple.LoadImage();
|
||||
thingtexturesimple.CreateTexture();
|
||||
thingtexture = new ResourceImage("Thing2D.png");
|
||||
thingtexture.UseColorCorrection = false;
|
||||
thingtexture.LoadImage();
|
||||
thingtexture.CreateTexture();
|
||||
|
||||
|
@ -137,6 +143,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Destroy rendertargets
|
||||
DestroyRendertargets();
|
||||
thingtexture.Dispose();
|
||||
thingtexturesimple.Dispose();
|
||||
|
||||
// Done
|
||||
base.Dispose();
|
||||
|
@ -164,6 +171,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Set renderstates
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetTexture(0, General.Map.Grid.Background.Texture);
|
||||
graphics.Shaders.Display2D.Texture1 = General.Map.Grid.Background.Texture;
|
||||
graphics.Shaders.Display2D.SetSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_BLEND_FACTOR, 1f);
|
||||
|
@ -183,6 +191,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Set renderstates
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetTexture(0, backtex);
|
||||
graphics.Shaders.Display2D.Texture1 = backtex;
|
||||
graphics.Shaders.Display2D.SetSettings(1f / backsize.Width, 1f / backsize.Height, 0f, 1f);
|
||||
|
@ -198,6 +207,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetTexture(0, structtex);
|
||||
graphics.Shaders.Display2D.Texture1 = structtex;
|
||||
graphics.Shaders.Display2D.SetSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_BLEND_FACTOR, 1f);
|
||||
|
@ -230,6 +240,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, (new ColorValue(alpha, 1f, 1f, 1f)).ToArgb());
|
||||
graphics.Device.SetTexture(0, thingstex);
|
||||
graphics.Shaders.Display2D.Texture1 = thingstex;
|
||||
graphics.Shaders.Display2D.SetSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_BLEND_FACTOR, alpha);
|
||||
|
@ -582,10 +593,20 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.ZEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetTexture(0, thingtexture.Texture);
|
||||
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
|
||||
|
||||
if(General.Settings.QualityDisplay)
|
||||
{
|
||||
graphics.Device.SetTexture(0, thingtexture.Texture);
|
||||
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Device.SetTexture(0, thingtexturesimple.Texture);
|
||||
graphics.Shaders.Things2D.Texture1 = thingtexturesimple.Texture;
|
||||
}
|
||||
|
||||
// Draw the things batched
|
||||
graphics.Shaders.Things2D.Begin();
|
||||
graphics.Shaders.Things2D.BeginPass(0);
|
||||
|
|
|
@ -168,6 +168,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
|
||||
// Ready
|
||||
return true;
|
||||
|
@ -188,6 +189,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.ZWriteEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
|
||||
// Setup shader
|
||||
graphics.Shaders.World3D.Begin();
|
||||
|
@ -245,6 +247,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
lasttexture.CreateTexture();
|
||||
|
||||
// Apply texture
|
||||
graphics.Device.SetTexture(0, lasttexture.Texture);
|
||||
graphics.Shaders.World3D.Texture1 = lasttexture.Texture;
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 688 B |
Loading…
Reference in a new issue