updated colors, shader, configs, bleh

This commit is contained in:
codeimp 2007-10-20 12:34:27 +00:00
parent c5815c5032
commit 224cc67afb
30 changed files with 278 additions and 93 deletions

View file

@ -11,12 +11,15 @@ game = "Boom";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 1;
generalizedsectors = 1;
generalizedlinedefs = true;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Doom";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Doom 2";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -14,12 +14,15 @@ game = "Edge";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Eternity";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 1;
generalizedsectors = 1;
generalizedlinedefs = true;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Heretic";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Hexen";
// The format interface handles the map data format
formatinterface = "HexenMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Doom Legacy";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 1;
generalizedsectors = 1;
generalizedlinedefs = true;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Risen3D";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 1;
generalizedsectors = 1;
generalizedlinedefs = true;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Skull Tag (Doom in Doom format)";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 1;
generalizedsectors = 1;
generalizedlinedefs = true;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Skull Tag (Doom in Hexen format)";
// The format interface handles the map data format
formatinterface = "HexenMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Strife";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "Ultimate Doom";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,14 +11,17 @@ game = "ZDoom (Doom in Doom format)";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;
// No generalized types
generalizedlinedefs = 1;
generalizedsectors = 1;
generalizedlinedefs = true;
generalizedsectors = true;
// Thing number for start position in 3D Mode
start3dmode = 32000;

View file

@ -11,12 +11,15 @@ game = "ZDoom (Doom in Hexen format)";
// The format interface handles the map data format
formatinterface = "HexenMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 1;
generalizedlinedefs = false;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "ZDoom (Heretic in Hexen format)";
// The format interface handles the map data format
formatinterface = "HexenMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 1;
generalizedlinedefs = false;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "ZDoom (Hexen)";
// The format interface handles the map data format
formatinterface = "HexenMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "ZDoom (Strife in Hexen format)";
// The format interface handles the map data format
formatinterface = "HexenMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 1;
generalizedlinedefs = false;
generalizedsectors = true;
// Engine specific features
mixtexturesflats = 1;
mixtexturesflats = true;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -11,12 +11,15 @@ game = "jDoom";
// The format interface handles the map data format
formatinterface = "DoomMapSetIO";
// Special linedefs
soundlinedefflags = 64; // See linedefflags
// No generalized types
generalizedlinedefs = 0;
generalizedsectors = 0;
generalizedlinedefs = false;
generalizedsectors = false;
// Engine specific features
mixtexturesflats = 0;
mixtexturesflats = false;
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;

View file

@ -61,6 +61,7 @@
<Compile Include="Controls\ActionManager.cs" />
<Compile Include="General\CompilerInfo.cs" />
<Compile Include="General\ConfigurationInfo.cs" />
<Compile Include="General\GameConfigurationCache.cs" />
<Compile Include="General\MapManager.cs" />
<Compile Include="Controls\SpecialKeys.cs" />
<Compile Include="General\NodebuilderInfo.cs" />

View file

@ -41,9 +41,6 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Variables
// Selection
private MapSelection selection;
#endregion
#region ================== Properties
@ -59,15 +56,6 @@ namespace CodeImp.DoomBuilder.Editing
{
}
/// <summary>
/// From dragging
/// </summary>
public VerticesMode(MapSelection selection)
{
// Keep selection
this.selection = selection;
}
// Diposer
public override void Dispose()
{
@ -92,8 +80,8 @@ namespace CodeImp.DoomBuilder.Editing
if(renderer.StartRendering(true))
{
// Render stuff
renderer.RenderLinedefs(General.Map.Map, General.Map.Map.Linedefs);
renderer.RenderVertices(General.Map.Map, General.Map.Map.Vertices);
renderer.RenderLinedefs(General.Map.Map, General.Map.Map.Linedefs, null);
renderer.RenderVertices(General.Map.Map, General.Map.Map.Vertices, null);
// Done
renderer.FinishRendering();

View file

@ -0,0 +1,69 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.IO;
#endregion
namespace CodeImp.DoomBuilder
{
internal class GameConfigurationCache
{
#region ================== Constants
#endregion
#region ================== Variables
private int soundlinedefflags;
#endregion
#region ================== Properties
public int SoundLinedefFlags { get { return soundlinedefflags; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public GameConfigurationCache(Configuration cfg)
{
// Initialize
soundlinedefflags = cfg.ReadSetting("soundlinedefflags", 0);
// We have no destructor
GC.SuppressFinalize(this);
}
#endregion
#region ================== Methods
#endregion
}
}

View file

@ -68,10 +68,12 @@ namespace CodeImp.DoomBuilder
private MapOptions options;
private ConfigurationInfo configinfo;
private Configuration config;
private GameConfigurationCache configsettings;
private DataManager data;
private EditMode mode;
private D3DGraphics graphics;
private WAD tempwad;
private MapSelection selection;
// Disposing
private bool isdisposed = false;
@ -91,6 +93,8 @@ namespace CodeImp.DoomBuilder
public bool IsDisposed { get { return isdisposed; } }
public D3DGraphics Graphics { get { return graphics; } }
public Configuration Configuration { get { return config; } }
public GameConfigurationCache Settings { get { return configsettings; } }
public MapSelection Selection { get { return selection; } }
#endregion
@ -101,6 +105,9 @@ namespace CodeImp.DoomBuilder
{
// We have no destructor
GC.SuppressFinalize(this);
// Basic objects
selection = new MapSelection();
}
// Diposer
@ -123,7 +130,7 @@ namespace CodeImp.DoomBuilder
mode.Dispose();
General.WriteLogLine("Stopping graphics device...");
graphics.Dispose();
// Remove temp file
General.WriteLogLine("Removing temporary directory...");
try { Directory.Delete(temppath, true); } catch(Exception e)
@ -132,6 +139,9 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine("Failed to remove temporary directory!");
}
// Basic objects
selection.Dispose();
// We may spend some time to clean things up here
GC.Collect();
@ -172,6 +182,7 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine("Loading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = General.LoadGameConfiguration(options.ConfigFile);
configsettings = new GameConfigurationCache(config);
// Create map data
map = new MapSet();
@ -238,6 +249,7 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine("Loading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = General.LoadGameConfiguration(options.ConfigFile);
configsettings = new GameConfigurationCache(config);
// Create map data
map = new MapSet();
@ -812,6 +824,7 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine("Reloading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = General.LoadGameConfiguration(options.ConfigFile);
configsettings = new GameConfigurationCache(config);
// Reload data resources
General.WriteLogLine("Reloading data resources...");

View file

@ -722,6 +722,9 @@ namespace CodeImp.DoomBuilder.Interface
// Reload resources if a map is open
if(General.Map != null) General.Map.ReloadResources();
// Redraw display
RedrawDisplay();
}
// Done
@ -738,6 +741,9 @@ namespace CodeImp.DoomBuilder.Interface
{
// Update shortcut keys in menus
ApplyShortcutKeys();
// Redraw display
RedrawDisplay();
}
// Done

View file

@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.Map
#endregion
#region ================== Methods
// This returns the distance from given coordinates
public float DistanceToSq(Vector2D p)
{

View file

@ -66,6 +66,12 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Methods
// This returns a PixelColor with adjusted alpha
public PixelColor WithAlpha(byte a)
{
return new PixelColor(color, a);
}
// Equal?
public bool Equals(ColorSetting other)
{

View file

@ -305,6 +305,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Unload all Direct3D resources
foreach(ID3DResource res in resources) res.UnloadResource();
if(shaders != null) shaders.Dispose();
// Make present parameters
displaypp = CreatePresentParameters(adapter);

View file

@ -87,10 +87,10 @@ namespace CodeImp.DoomBuilder.Rendering
// This is called when the graphics need to be reset
public virtual void Reset() { }
#endregion
// For DirectX resources
public virtual void UnloadResource() { }
public virtual void ReloadResource() { }
#endregion
}
}

View file

@ -41,6 +41,9 @@ namespace CodeImp.DoomBuilder.Rendering
{
#region ================== Constants
private const byte DOUBLESIDED_LINE_ALPHA = 130;
private const float FSAA_BLEND_FACTOR = 0.6f;
#endregion
#region ================== Variables
@ -135,8 +138,11 @@ namespace CodeImp.DoomBuilder.Rendering
// Set renderstates AND shader settings
graphics.Device.SetTexture(0, tex);
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
graphics.Shaders.Base2D.Texture1 = tex;
graphics.Shaders.Base2D.SetSettings(1f / pwidth, 1f / pheight, 0.3f);
graphics.Shaders.Base2D.SetSettings(1f / pwidth, 1f / pheight, FSAA_BLEND_FACTOR);
// Draw
graphics.Shaders.Base2D.Begin();
@ -266,11 +272,11 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Map Rendering
// This renders a set of Linedefs
public void RenderLinedefs(MapSet map, ICollection<Linedef> linedefs)
public void RenderLinedefs(MapSet map, ICollection<Linedef> linedefs, Linedef highlight)
{
float ox = -offsetx + (width * 0.5f) / scale;
float oy = -offsety - (height * 0.5f) / scale;
PixelColor c = PixelColor.FromColor(Color.White);
PixelColor c;
Vector2D v1, v2;
// Go for all linedefs
@ -279,19 +285,42 @@ namespace CodeImp.DoomBuilder.Rendering
// Transform vertex coordinates
v1 = l.Start.Position.GetTransformed(ox, oy, scale, -scale);
v2 = l.End.Position.GetTransformed(ox, oy, scale, -scale);
// Draw line
plotter.DrawLineSolid((int)v1.x, (int)v1.y, (int)v2.x, (int)v2.y, c);
// Sinlgesided lines
if((l.Back == null) || (l.Front == null))
{
// Determine color
if(l == highlight) c = General.Colors.Highlight;
else if(l.Selected > 0) c = General.Colors.Selection;
else if(l.Action != 0) c = General.Colors.Actions;
else c = General.Colors.Linedefs;
// Draw line
plotter.DrawLineSolid((int)v1.x, (int)v1.y, (int)v2.x, (int)v2.y, c);
}
// Doublesided lines
else
{
// Determine color
if(l == highlight) c = General.Colors.Highlight;
else if(l.Selected > 0) c = General.Colors.Selection;
else if(l.Action != 0) c = General.Colors.Actions.WithAlpha(DOUBLESIDED_LINE_ALPHA);
else if((l.Flags & General.Map.Settings.SoundLinedefFlags) != 0) c = General.Colors.Sounds.WithAlpha(DOUBLESIDED_LINE_ALPHA);
else c = General.Colors.Linedefs.WithAlpha(DOUBLESIDED_LINE_ALPHA);
// Draw line
plotter.DrawLineSolid((int)v1.x, (int)v1.y, (int)v2.x, (int)v2.y, c);
}
}
}
// This renders a set of Linedefs
public void RenderVertices(MapSet map, ICollection<Vertex> vertices)
public void RenderVertices(MapSet map, ICollection<Vertex> vertices, Vertex highlight)
{
Vector2D nv;
float ox = -offsetx + (width * 0.5f) / scale;
float oy = -offsety - (height * 0.5f) / scale;
PixelColor c = PixelColor.FromColor(Color.DeepSkyBlue);
PixelColor c;
int x, y;
// Go for all vertices
@ -302,6 +331,11 @@ namespace CodeImp.DoomBuilder.Rendering
x = (int)nv.x;
y = (int)nv.y;
// Determine color
if(v == highlight) c = General.Colors.Highlight;
else if(v.Selected > 0) c = General.Colors.Selection;
else c = General.Colors.Vertices;
// Draw pixel here
plotter.DrawVertexSolid(x, y, 2, c);
}

View file

@ -25,9 +25,9 @@ texture texture1
sampler2D texture1samp = sampler_state
{
Texture = <texture1>;
MagFilter = Linear;
MinFilter = Linear;
MipFilter = Linear;
MagFilter = Point;
MinFilter = Point;
MipFilter = Point;
AddressU = Wrap;
AddressV = Wrap;
};
@ -38,19 +38,29 @@ float4 addcolor(float4 c1, float4 c2)
return float4(max(c1.r, c2.r),
max(c1.g, c2.g),
max(c1.b, c2.b),
max(c1.a, c2.a));
saturate(c1.a + c2.a * 0.5f));
}
// Pixel shader
float4 ps20_main(PixelData pd) : COLOR
{
// Take this pixel's color
float4 c = tex2D(texture1samp, pd.uv);
float4 neightbourblend =
tex2D(texture1samp, float2(pd.uv.x + settings.x, pd.uv.y)) * settings.z +
tex2D(texture1samp, float2(pd.uv.x - settings.x, pd.uv.y)) * settings.z +
tex2D(texture1samp, float2(pd.uv.x, pd.uv.y + settings.y)) * settings.z +
tex2D(texture1samp, float2(pd.uv.x, pd.uv.y - settings.y)) * settings.z;
return lerp(neightbourblend, c, c.a);
// If this pixel is not drawn on...
if(c.a < 0.1f)
{
// Mix the colors of nearby pixels
float4 n = (float4)0;
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x + settings.x, pd.uv.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x - settings.x, pd.uv.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x, pd.uv.y + settings.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x, pd.uv.y - settings.y)));
// If any pixels nearby where found, return a blend, otherwise return nothing
if(n.a > 0.1f) return float4(n.rgb, n.a * settings.z); else return (float4)0;
}
else return c;
}
// Technique for shader model 2.0