mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-06-02 01:41:49 +00:00
- updated to latest slimdx library (march 2008)
- added error dialog when missing DirectX
This commit is contained in:
parent
3fd1ce1e8d
commit
5ca3cd46cb
43 changed files with 3379 additions and 2511 deletions
BIN
Build/SlimDX.dll
BIN
Build/SlimDX.dll
Binary file not shown.
5617
Build/SlimDX.xml
5617
Build/SlimDX.xml
File diff suppressed because it is too large
Load diff
Binary file not shown.
BIN
Build/d3dx9_37.dll
Normal file
BIN
Build/d3dx9_37.dll
Normal file
Binary file not shown.
BIN
Build/dxwebsetup.exe
Normal file
BIN
Build/dxwebsetup.exe
Normal file
Binary file not shown.
|
@ -354,10 +354,7 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\Build\Sharpzip.dll</HintPath>
|
<HintPath>..\Build\Sharpzip.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SlimDX, Version=1.0.2863.25597, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86">
|
<Reference Include="SlimDX, Version=2.0.3.37, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\Build\SlimDX.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
// Set cooperative level
|
// Set cooperative level
|
||||||
mouse.SetCooperativeLevel(source,
|
mouse.SetCooperativeLevel(source,
|
||||||
CooperativeLevel.NonExclusive | CooperativeLevel.Foreground);
|
CooperativeLevel.Nonexclusive | CooperativeLevel.Foreground);
|
||||||
|
|
||||||
// Aquire device
|
// Aquire device
|
||||||
try { mouse.Acquire(); }
|
try { mouse.Acquire(); }
|
||||||
|
@ -112,11 +112,10 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
MouseState ms;
|
MouseState ms;
|
||||||
float changex, changey;
|
float changex, changey;
|
||||||
|
|
||||||
try
|
// Poll the device
|
||||||
|
Result result = mouse.Poll();
|
||||||
|
if(result.IsSuccess)
|
||||||
{
|
{
|
||||||
// Poll the device
|
|
||||||
mouse.Poll();
|
|
||||||
|
|
||||||
// Get the changes since previous poll
|
// Get the changes since previous poll
|
||||||
ms = mouse.GetCurrentState();
|
ms = mouse.GetCurrentState();
|
||||||
|
|
||||||
|
@ -127,16 +126,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Return changes
|
// Return changes
|
||||||
return new Vector2D(changex, changey);
|
return new Vector2D(changex, changey);
|
||||||
}
|
}
|
||||||
// Lost device?
|
else
|
||||||
catch(InputLostException)
|
|
||||||
{
|
|
||||||
// Reaquire device
|
|
||||||
try { mouse.Acquire(); }
|
|
||||||
catch(Exception) { }
|
|
||||||
return new Vector2D();
|
|
||||||
}
|
|
||||||
// Lost device?
|
|
||||||
catch(DeviceNotAcquiredException)
|
|
||||||
{
|
{
|
||||||
// Reaquire device
|
// Reaquire device
|
||||||
try { mouse.Acquire(); }
|
try { mouse.Acquire(); }
|
||||||
|
|
|
@ -395,6 +395,9 @@ namespace CodeImp.DoomBuilder
|
||||||
// Enable OS visual styles
|
// Enable OS visual styles
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.DoEvents(); // This must be here to work around a .NET bug
|
Application.DoEvents(); // This must be here to work around a .NET bug
|
||||||
|
|
||||||
|
// Hook to DLL loading failure event
|
||||||
|
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
||||||
|
|
||||||
// Get a reference to this assembly
|
// Get a reference to this assembly
|
||||||
thisasm = Assembly.GetExecutingAssembly();
|
thisasm = Assembly.GetExecutingAssembly();
|
||||||
|
@ -452,7 +455,9 @@ namespace CodeImp.DoomBuilder
|
||||||
|
|
||||||
// Start Direct3D
|
// Start Direct3D
|
||||||
General.WriteLogLine("Starting Direct3D graphics driver...");
|
General.WriteLogLine("Starting Direct3D graphics driver...");
|
||||||
Direct3D.Initialize();
|
try { Direct3D.Initialize(); }
|
||||||
|
catch(Direct3D9NotFoundException) { AskDownloadDirectX(); return; }
|
||||||
|
catch(Direct3DX9NotFoundException) { AskDownloadDirectX(); return; }
|
||||||
|
|
||||||
// Load plugin manager
|
// Load plugin manager
|
||||||
General.WriteLogLine("Loading plugins...");
|
General.WriteLogLine("Loading plugins...");
|
||||||
|
@ -489,6 +494,33 @@ namespace CodeImp.DoomBuilder
|
||||||
Terminate(false);
|
Terminate(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This handles DLL linking errors
|
||||||
|
private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
||||||
|
{
|
||||||
|
// Check if SlimDX failed loading
|
||||||
|
if(args.Name.Contains("SlimDX")) AskDownloadDirectX();
|
||||||
|
|
||||||
|
// Return null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This asks the user to download DirectX
|
||||||
|
private static void AskDownloadDirectX()
|
||||||
|
{
|
||||||
|
// Ask the user to download DirectX
|
||||||
|
if(MessageBox.Show("This application requires the latest version of Microsoft DirectX installed on your computer." + Environment.NewLine +
|
||||||
|
"Do you want to install and update Microsoft DirectX now?", "DirectX Error", System.Windows.Forms.MessageBoxButtons.YesNo,
|
||||||
|
System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Yes)
|
||||||
|
{
|
||||||
|
// Open DX web setup
|
||||||
|
//System.Diagnostics.Process.Start("http://www.microsoft.com/downloads/details.aspx?FamilyId=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3").WaitForExit(1000);
|
||||||
|
System.Diagnostics.Process.Start(Path.Combine(apppath, "dxwebsetup.exe")).WaitForExit(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End program here
|
||||||
|
Terminate(false);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -505,15 +537,6 @@ namespace CodeImp.DoomBuilder
|
||||||
// Unbind static methods from actions
|
// Unbind static methods from actions
|
||||||
General.Actions.UnbindMethods(typeof(General));
|
General.Actions.UnbindMethods(typeof(General));
|
||||||
|
|
||||||
// Clean up
|
|
||||||
if(map != null) map.Dispose();
|
|
||||||
map = null;
|
|
||||||
mainwindow.Dispose();
|
|
||||||
actions.Dispose();
|
|
||||||
clock.Dispose();
|
|
||||||
plugins.Dispose();
|
|
||||||
Direct3D.Terminate();
|
|
||||||
|
|
||||||
// Save colors
|
// Save colors
|
||||||
colors.SaveColors(settings.Config);
|
colors.SaveColors(settings.Config);
|
||||||
|
|
||||||
|
@ -527,6 +550,14 @@ namespace CodeImp.DoomBuilder
|
||||||
General.WriteLogLine("Saving program configuration...");
|
General.WriteLogLine("Saving program configuration...");
|
||||||
settings.Save(Path.Combine(settingspath, SETTINGS_FILE));
|
settings.Save(Path.Combine(settingspath, SETTINGS_FILE));
|
||||||
|
|
||||||
|
// Clean up
|
||||||
|
if(map != null) map.Dispose(); map = null;
|
||||||
|
if(mainwindow != null) mainwindow.Dispose();
|
||||||
|
if(actions != null) actions.Dispose();
|
||||||
|
if(clock != null) clock.Dispose();
|
||||||
|
if(plugins != null) plugins.Dispose();
|
||||||
|
try { Direct3D.Terminate(); } catch(Exception) { }
|
||||||
|
|
||||||
// Application ends here and now
|
// Application ends here and now
|
||||||
General.WriteLogLine("Termination done");
|
General.WriteLogLine("Termination done");
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -30,7 +30,8 @@ using CodeImp.DoomBuilder.Config;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
|
using SlimDX;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -172,7 +173,7 @@ namespace CodeImp.DoomBuilder.Interface
|
||||||
// This brightens or darkens a color
|
// This brightens or darkens a color
|
||||||
private Color AdjustedColor(Color c, float amount)
|
private Color AdjustedColor(Color c, float amount)
|
||||||
{
|
{
|
||||||
ColorValue cc = ColorValue.FromColor(c);
|
Color4 cc = new Color4(c);
|
||||||
|
|
||||||
// Adjust color
|
// Adjust color
|
||||||
cc.Red = Saturate((cc.Red * (1f + amount)) + (amount * 0.5f));
|
cc.Red = Saturate((cc.Red * (1f + amount)) + (amount * 0.5f));
|
||||||
|
|
|
@ -242,33 +242,36 @@ namespace CodeImp.DoomBuilder.Interface
|
||||||
{
|
{
|
||||||
int windowstate;
|
int windowstate;
|
||||||
|
|
||||||
General.WriteLogLine("Closing main interface window...");
|
if(e.CloseReason != CloseReason.ApplicationExitCall)
|
||||||
|
{
|
||||||
|
General.WriteLogLine("Closing main interface window...");
|
||||||
|
|
||||||
// Stop exclusive mode, if any is active
|
// Stop exclusive mode, if any is active
|
||||||
StopExclusiveMouseInput();
|
StopExclusiveMouseInput();
|
||||||
SetProcessorState(false);
|
SetProcessorState(false);
|
||||||
|
|
||||||
// Unbind methods
|
|
||||||
General.Actions.UnbindMethods(this);
|
|
||||||
|
|
||||||
// Determine window state to save
|
|
||||||
if(this.WindowState != FormWindowState.Minimized)
|
|
||||||
windowstate = (int)this.WindowState;
|
|
||||||
else
|
|
||||||
windowstate = (int)FormWindowState.Normal;
|
|
||||||
|
|
||||||
// Save window settings
|
|
||||||
General.Settings.WriteSetting("mainwindow.positionx", lastposition.X);
|
|
||||||
General.Settings.WriteSetting("mainwindow.positiony", lastposition.Y);
|
|
||||||
General.Settings.WriteSetting("mainwindow.sizewidth", lastsize.Width);
|
|
||||||
General.Settings.WriteSetting("mainwindow.sizeheight", lastsize.Height);
|
|
||||||
General.Settings.WriteSetting("mainwindow.windowstate", windowstate);
|
|
||||||
|
|
||||||
// Save recent files
|
// Unbind methods
|
||||||
SaveRecentFiles();
|
General.Actions.UnbindMethods(this);
|
||||||
|
|
||||||
// Terminate the program
|
// Determine window state to save
|
||||||
General.Terminate(true);
|
if(this.WindowState != FormWindowState.Minimized)
|
||||||
|
windowstate = (int)this.WindowState;
|
||||||
|
else
|
||||||
|
windowstate = (int)FormWindowState.Normal;
|
||||||
|
|
||||||
|
// Save window settings
|
||||||
|
General.Settings.WriteSetting("mainwindow.positionx", lastposition.X);
|
||||||
|
General.Settings.WriteSetting("mainwindow.positiony", lastposition.Y);
|
||||||
|
General.Settings.WriteSetting("mainwindow.sizewidth", lastsize.Width);
|
||||||
|
General.Settings.WriteSetting("mainwindow.sizeheight", lastsize.Height);
|
||||||
|
General.Settings.WriteSetting("mainwindow.windowstate", windowstate);
|
||||||
|
|
||||||
|
// Save recent files
|
||||||
|
SaveRecentFiles();
|
||||||
|
|
||||||
|
// Terminate the program
|
||||||
|
General.Terminate(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -22,7 +22,7 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -24,7 +24,10 @@ using System.Text;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CodeImp.DoomBuilder.IO;
|
using CodeImp.DoomBuilder.IO;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
|
using SlimDX;
|
||||||
|
|
||||||
|
using Configuration = CodeImp.DoomBuilder.IO.Configuration;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -207,8 +210,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// This creates assist colors
|
// This creates assist colors
|
||||||
internal void CreateAssistColors()
|
internal void CreateAssistColors()
|
||||||
{
|
{
|
||||||
ColorValue o;
|
Color4 o;
|
||||||
ColorValue c = new ColorValue(1f, 0f, 0f, 0f);
|
Color4 c = new Color4(1f, 0f, 0f, 0f);
|
||||||
|
|
||||||
// Go for all colors
|
// Go for all colors
|
||||||
for(int i = 0; i < NUM_COLORS; i++)
|
for(int i = 0; i < NUM_COLORS; i++)
|
||||||
|
|
|
@ -26,7 +26,6 @@ using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
|
@ -141,8 +140,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
device.SetRenderState(RenderState.ZWriteEnable, false);
|
device.SetRenderState(RenderState.ZWriteEnable, false);
|
||||||
device.SetRenderState(RenderState.Clipping, true);
|
device.SetRenderState(RenderState.Clipping, true);
|
||||||
device.SetRenderState(RenderState.CullMode, Cull.None);
|
device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||||
device.SetPixelShader(null);
|
device.PixelShader = null;
|
||||||
device.SetVertexShader(null);
|
device.VertexShader = null;
|
||||||
|
|
||||||
// Sampler settings
|
// Sampler settings
|
||||||
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
|
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
|
||||||
|
@ -187,9 +186,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
// Setup material
|
// Setup material
|
||||||
Material material = new Material();
|
Material material = new Material();
|
||||||
material.Ambient = ColorValue.FromColor(Color.White);
|
material.Ambient = new Color4(Color.White);
|
||||||
material.Diffuse = ColorValue.FromColor(Color.White);
|
material.Diffuse = new Color4(Color.White);
|
||||||
material.Specular = ColorValue.FromColor(Color.White);
|
material.Specular = new Color4(Color.White);
|
||||||
device.Material = material;
|
device.Material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +245,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
// Keep a reference to the original buffers
|
// Keep a reference to the original buffers
|
||||||
backbuffer = device.GetBackBuffer(0, 0);
|
backbuffer = device.GetBackBuffer(0, 0);
|
||||||
depthbuffer = device.GetDepthStencilSurface();
|
depthbuffer = device.DepthStencilSurface;
|
||||||
|
|
||||||
// Get the viewport
|
// Get the viewport
|
||||||
viewport = device.Viewport;
|
viewport = device.Viewport;
|
||||||
|
@ -341,7 +340,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
// Keep a reference to the original buffers
|
// Keep a reference to the original buffers
|
||||||
backbuffer = device.GetBackBuffer(0, 0);
|
backbuffer = device.GetBackBuffer(0, 0);
|
||||||
depthbuffer = device.GetDepthStencilSurface();
|
depthbuffer = device.DepthStencilSurface;
|
||||||
|
|
||||||
// Get the viewport
|
// Get the viewport
|
||||||
viewport = device.Viewport;
|
viewport = device.Viewport;
|
||||||
|
@ -361,31 +360,24 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
#region ================== Rendering
|
#region ================== Rendering
|
||||||
|
|
||||||
// This begins a drawing session
|
// This begins a drawing session
|
||||||
public bool StartRendering(bool clear, int backcolor, Surface target, Surface depthbuffer)
|
public bool StartRendering(bool clear, Color4 backcolor, Surface target, Surface depthbuffer)
|
||||||
{
|
{
|
||||||
CooperativeLevel coopresult;
|
|
||||||
|
|
||||||
// When minimized, do not render anything
|
// When minimized, do not render anything
|
||||||
if(General.MainWindow.WindowState != FormWindowState.Minimized)
|
if(General.MainWindow.WindowState != FormWindowState.Minimized)
|
||||||
{
|
{
|
||||||
// Test the cooperative level
|
// Test the cooperative level
|
||||||
coopresult = device.CheckCooperativeLevel();
|
Result coopresult = device.TestCooperativeLevel();
|
||||||
|
|
||||||
// Check if device must be reset
|
// Check if device must be reset
|
||||||
if(coopresult == CooperativeLevel.DeviceNotReset)
|
if(!coopresult.IsSuccess)
|
||||||
{
|
{
|
||||||
// Device is lost and must be reset now
|
// Device is lost and must be reset now
|
||||||
|
// TODO: Check result codes, device cannot always be reset
|
||||||
return Reset();
|
return Reset();
|
||||||
}
|
}
|
||||||
// Check if device is lost
|
|
||||||
else if(coopresult == CooperativeLevel.DeviceLost)
|
|
||||||
{
|
|
||||||
// Device is lost and cannot be reset now
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set rendertarget
|
// Set rendertarget
|
||||||
device.SetDepthStencilSurface(depthbuffer);
|
device.DepthStencilSurface = depthbuffer;
|
||||||
device.SetRenderTarget(0, target);
|
device.SetRenderTarget(0, target);
|
||||||
|
|
||||||
// Clear the screen
|
// Clear the screen
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -25,7 +25,7 @@ using System.Windows.Forms;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -23,7 +23,8 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
|
using SlimDX;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -92,14 +93,14 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
}
|
}
|
||||||
|
|
||||||
// To ColorValue
|
// To ColorValue
|
||||||
public ColorValue ToColorValue()
|
public Color4 ToColorValue()
|
||||||
{
|
{
|
||||||
return new ColorValue((float)a * 0.00392156862745098f,
|
return new Color4((float)a * 0.00392156862745098f,
|
||||||
(float)r * 0.00392156862745098f,
|
(float)r * 0.00392156862745098f,
|
||||||
(float)g * 0.00392156862745098f,
|
(float)g * 0.00392156862745098f,
|
||||||
(float)b * 0.00392156862745098f);
|
(float)b * 0.00392156862745098f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Methods
|
#region ================== Methods
|
||||||
|
|
|
@ -23,7 +23,7 @@ using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using SlimDX.Direct3D;
|
using SlimDX.Direct3D9;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
@ -88,7 +87,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
private Texture overlaytex;
|
private Texture overlaytex;
|
||||||
|
|
||||||
// Locking data
|
// Locking data
|
||||||
private LockedRect plotlocked;
|
private DataRectangle plotlocked;
|
||||||
private Surface targetsurface;
|
private Surface targetsurface;
|
||||||
|
|
||||||
// Rendertarget sizes
|
// Rendertarget sizes
|
||||||
|
@ -196,7 +195,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
public void Present()
|
public void Present()
|
||||||
{
|
{
|
||||||
// Start drawing
|
// Start drawing
|
||||||
if(graphics.StartRendering(true, General.Colors.Background.ToInt(), graphics.BackBuffer, graphics.DepthBuffer))
|
if(graphics.StartRendering(true, General.Colors.Background.ToColorValue(), graphics.BackBuffer, graphics.DepthBuffer))
|
||||||
{
|
{
|
||||||
// Renderstates that count for this whole sequence
|
// Renderstates that count for this whole sequence
|
||||||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||||
|
@ -244,7 +243,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InvSourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||||
graphics.Device.SetTexture(0, plottertex);
|
graphics.Device.SetTexture(0, plottertex);
|
||||||
graphics.Shaders.Display2D.Texture1 = plottertex;
|
graphics.Shaders.Display2D.Texture1 = plottertex;
|
||||||
|
@ -264,7 +263,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InvSourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||||
graphics.Device.SetTexture(0, overlaytex);
|
graphics.Device.SetTexture(0, overlaytex);
|
||||||
graphics.Shaders.Display2D.Texture1 = overlaytex;
|
graphics.Shaders.Display2D.Texture1 = overlaytex;
|
||||||
|
@ -296,8 +295,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InvSourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.TextureFactor, (new ColorValue(alpha, 1f, 1f, 1f)).ToArgb());
|
graphics.Device.SetRenderState(RenderState.TextureFactor, (new Color4(alpha, 1f, 1f, 1f)).ToArgb());
|
||||||
graphics.Device.SetTexture(0, thingstex);
|
graphics.Device.SetTexture(0, thingstex);
|
||||||
graphics.Shaders.Display2D.Texture1 = thingstex;
|
graphics.Shaders.Display2D.Texture1 = thingstex;
|
||||||
graphics.Shaders.Display2D.SetSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_PLOTTER_BLEND_FACTOR, alpha);
|
graphics.Shaders.Display2D.SetSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_PLOTTER_BLEND_FACTOR, alpha);
|
||||||
|
@ -404,7 +403,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
StartOverlay(true); Finish();
|
StartOverlay(true); Finish();
|
||||||
|
|
||||||
// Create font
|
// Create font
|
||||||
font = new SlimDX.Direct3D9.Font(graphics.Device, FONT_WIDTH, FONT_HEIGHT, FontWeight.Bold, 1, false, CharacterSet.Ansi, Precision.Default, FontQuality.AntiAliased, PitchAndFamily.Default, FONT_NAME);
|
font = new SlimDX.Direct3D9.Font(graphics.Device, FONT_WIDTH, FONT_HEIGHT, FontWeight.Bold, 1, false, CharacterSet.Ansi, Precision.Default, FontQuality.Antialiased, PitchAndFamily.Default, FONT_NAME);
|
||||||
|
|
||||||
// Create vertex buffers
|
// Create vertex buffers
|
||||||
screenverts = new VertexBuffer(graphics.Device, 4 * sizeof(FlatVertex), Usage.Dynamic | Usage.WriteOnly, VertexFormat.None, Pool.Default);
|
screenverts = new VertexBuffer(graphics.Device, 4 * sizeof(FlatVertex), Usage.Dynamic | Usage.WriteOnly, VertexFormat.None, Pool.Default);
|
||||||
|
@ -552,7 +551,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// This begins a drawing session
|
// This begins a drawing session
|
||||||
public unsafe bool StartPlotter(bool clear)
|
public unsafe bool StartPlotter(bool clear)
|
||||||
{
|
{
|
||||||
if(renderlayer != RenderLayers.None) throw new InvalidCallException("Renderer starting called before finished previous layer. Call Finish() first!");
|
if(renderlayer != RenderLayers.None) throw new InvalidOperationException("Renderer starting called before finished previous layer. Call Finish() first!");
|
||||||
renderlayer = RenderLayers.Plotter;
|
renderlayer = RenderLayers.Plotter;
|
||||||
|
|
||||||
// Rendertargets available?
|
// Rendertargets available?
|
||||||
|
@ -586,7 +585,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// This begins a drawing session
|
// This begins a drawing session
|
||||||
public unsafe bool StartThings(bool clear)
|
public unsafe bool StartThings(bool clear)
|
||||||
{
|
{
|
||||||
if(renderlayer != RenderLayers.None) throw new InvalidCallException("Renderer starting called before finished previous layer. Call Finish() first!");
|
if(renderlayer != RenderLayers.None) throw new InvalidOperationException("Renderer starting called before finished previous layer. Call Finish() first!");
|
||||||
renderlayer = RenderLayers.Things;
|
renderlayer = RenderLayers.Things;
|
||||||
|
|
||||||
// Rendertargets available?
|
// Rendertargets available?
|
||||||
|
@ -600,7 +599,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
// Set the rendertarget to the things texture
|
// Set the rendertarget to the things texture
|
||||||
targetsurface = thingstex.GetSurfaceLevel(0);
|
targetsurface = thingstex.GetSurfaceLevel(0);
|
||||||
if(graphics.StartRendering(clear, 0, targetsurface, null))
|
if(graphics.StartRendering(clear, new Color4(0), targetsurface, null))
|
||||||
{
|
{
|
||||||
// Ready for rendering
|
// Ready for rendering
|
||||||
return true;
|
return true;
|
||||||
|
@ -623,7 +622,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// This begins a drawing session
|
// This begins a drawing session
|
||||||
public unsafe bool StartOverlay(bool clear)
|
public unsafe bool StartOverlay(bool clear)
|
||||||
{
|
{
|
||||||
if(renderlayer != RenderLayers.None) throw new InvalidCallException("Renderer starting called before finished previous layer. Call Finish() first!");
|
if(renderlayer != RenderLayers.None) throw new InvalidOperationException("Renderer starting called before finished previous layer. Call Finish() first!");
|
||||||
renderlayer = RenderLayers.Overlay;
|
renderlayer = RenderLayers.Overlay;
|
||||||
|
|
||||||
// Rendertargets available?
|
// Rendertargets available?
|
||||||
|
@ -631,7 +630,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
{
|
{
|
||||||
// Set the rendertarget to the things texture
|
// Set the rendertarget to the things texture
|
||||||
targetsurface = overlaytex.GetSurfaceLevel(0);
|
targetsurface = overlaytex.GetSurfaceLevel(0);
|
||||||
if(graphics.StartRendering(clear, 0, targetsurface, null))
|
if(graphics.StartRendering(clear, new Color4(0), targetsurface, null))
|
||||||
{
|
{
|
||||||
// Ready for rendering
|
// Ready for rendering
|
||||||
return true;
|
return true;
|
||||||
|
@ -671,7 +670,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// Release rendertarget
|
// Release rendertarget
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
graphics.Device.SetDepthStencilSurface(graphics.DepthBuffer);
|
graphics.Device.DepthStencilSurface = graphics.DepthBuffer;
|
||||||
graphics.Device.SetRenderTarget(0, graphics.BackBuffer);
|
graphics.Device.SetRenderTarget(0, graphics.BackBuffer);
|
||||||
}
|
}
|
||||||
catch(Exception) { }
|
catch(Exception) { }
|
||||||
|
@ -731,7 +730,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
private void RenderBackgroundGrid()
|
private void RenderBackgroundGrid()
|
||||||
{
|
{
|
||||||
Plotter gridplotter;
|
Plotter gridplotter;
|
||||||
LockedRect lockedrect;
|
DataRectangle lockedrect;
|
||||||
|
|
||||||
// Do we need to redraw grid?
|
// Do we need to redraw grid?
|
||||||
if((lastgridscale != scale) || (lastgridx != offsetx) || (lastgridy != offsety))
|
if((lastgridscale != scale) || (lastgridx != offsetx) || (lastgridy != offsety))
|
||||||
|
@ -1065,7 +1064,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
if(font != null) font.DrawString(null, text, posr, DrawTextFormat.VCenter | DrawTextFormat.Left | DrawTextFormat.NoClip, c.ToInt());
|
if(font != null) font.DrawString(null, text, posr, DrawTextFormat.VCenter | DrawTextFormat.Left | DrawTextFormat.NoClip, c.ToColorValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// This renders text
|
// This renders text
|
||||||
|
@ -1083,7 +1082,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
if(font != null) font.DrawString(null, text, posr, DrawTextFormat.VCenter | DrawTextFormat.Center | DrawTextFormat.NoClip, c.ToInt());
|
if(font != null) font.DrawString(null, text, posr, DrawTextFormat.VCenter | DrawTextFormat.Center | DrawTextFormat.NoClip, c.ToColorValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// This renders a rectangle with given border size and color
|
// This renders a rectangle with given border size and color
|
||||||
|
|
|
@ -25,7 +25,6 @@ using System.Windows.Forms;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
@ -159,7 +158,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
public bool Start()
|
public bool Start()
|
||||||
{
|
{
|
||||||
// Start drawing
|
// Start drawing
|
||||||
if(graphics.StartRendering(true, General.Colors.Background.ToInt(), graphics.BackBuffer, graphics.DepthBuffer))
|
if(graphics.StartRendering(true, General.Colors.Background.ToColorValue(), graphics.BackBuffer, graphics.DepthBuffer))
|
||||||
{
|
{
|
||||||
// Beginning renderstates
|
// Beginning renderstates
|
||||||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||||
|
@ -167,7 +166,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InvSourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||||
|
|
||||||
// Ready
|
// Ready
|
||||||
|
@ -184,7 +183,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
public void StartGeometry()
|
public void StartGeometry()
|
||||||
{
|
{
|
||||||
// Renderstates
|
// Renderstates
|
||||||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.CounterClockwise);
|
graphics.Device.SetRenderState(RenderState.CullMode, Cull.Counterclockwise);
|
||||||
graphics.Device.SetRenderState(RenderState.ZEnable, true);
|
graphics.Device.SetRenderState(RenderState.ZEnable, true);
|
||||||
graphics.Device.SetRenderState(RenderState.ZWriteEnable, true);
|
graphics.Device.SetRenderState(RenderState.ZWriteEnable, true);
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
@ -130,7 +129,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
Capabilities caps;
|
Capabilities caps;
|
||||||
|
|
||||||
// Check if we can use shaders
|
// Check if we can use shaders
|
||||||
caps = General.Map.Graphics.Device.GetDeviceCaps();
|
caps = General.Map.Graphics.Device.Capabilities;
|
||||||
useshaders = (caps.PixelShaderVersion.Major >= 2);
|
useshaders = (caps.PixelShaderVersion.Major >= 2);
|
||||||
shadertechnique = "SM20";
|
shadertechnique = "SM20";
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
|
@ -27,7 +27,6 @@ using System.Reflection;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using SlimDX.Direct3D;
|
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue