mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 11:51:25 +00:00
Visual mode: noticeable performance boost (rendering now works ~40% faster).
Visual mode: fog distance calculation is now much closer to GZDoom one. Visual mode: thing brightness calculation when a thing is affected by floor glow is now much closer to GZDoom one. Linedef edit window, UDMF: added "Reset front/back brightness" buttons. Sector edit window, UDMF: added "Reset ceiling/floor brightness" buttons. Internal, Visual mode, Things mode: persistent event lines are now updated only when map objects are changed instead of doing it on every display redraw. Internal: improved Dictionary lookup times when using map objects and textures as keys. Internal: added "Release + Profiler" solution configuration. Updated ZDoom_ACS.cfg (Warp).
This commit is contained in:
parent
942c8a3276
commit
283c6c2272
50 changed files with 1011 additions and 441 deletions
|
@ -487,7 +487,7 @@ keywords
|
|||
VectorAngle = "fixed VectorAngle(int x, int y)";
|
||||
VectorLength = "int VectorLength(int x, int y)";
|
||||
Void = "void";
|
||||
Warp = "bool Warp(int destinationtid, fixed x, fixed y, fixed z, int angle, int flags[, str state[, bool exactstate]])";
|
||||
Warp = "bool Warp(int destinationtid, fixed xofs, fixed yofs, fixed zofs, int angle, int flags[, str success_state[, bool exactstate[, fixed heightoffset]]])";
|
||||
While = "while(expression)";
|
||||
WhiteReturn = "Script expression WhiteReturn";
|
||||
World = "World Int expression:identifier";
|
||||
|
|
23
Builder.sln
23
Builder.sln
|
@ -27,6 +27,7 @@ Global
|
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug + Profiler|x86 = Debug + Profiler|x86
|
||||
Debug|x86 = Debug|x86
|
||||
Release + Profiler|x86 = Release + Profiler|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
|
@ -34,66 +35,88 @@ Global
|
|||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|x86.Build.0 = Debug|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x86.ActiveCfg = Release|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x86.Build.0 = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x86.Build.0 = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.ActiveCfg = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.Build.0 = Release|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug|x86.Build.0 = Debug|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release|x86.ActiveCfg = Release|x86
|
||||
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release|x86.Build.0 = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.Build.0 = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.Build.0 = Release|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.Build.0 = Debug|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.ActiveCfg = Release|x86
|
||||
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.Build.0 = Release|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x86.Build.0 = Debug|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x86.ActiveCfg = Release|x86
|
||||
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x86.Build.0 = Release|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug|x86.Build.0 = Debug|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release|x86.ActiveCfg = Release|x86
|
||||
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release|x86.Build.0 = Release|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug|x86.Build.0 = Debug|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x86.ActiveCfg = Release|x86
|
||||
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x86.Build.0 = Release|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.Build.0 = Debug|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.ActiveCfg = Release|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.Build.0 = Release|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug|x86.Build.0 = Debug|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release|x86.ActiveCfg = Release|x86
|
||||
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release|x86.Build.0 = Release|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x86.Build.0 = Debug|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.ActiveCfg = Release|x86
|
||||
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
|
|
|
@ -61,6 +61,19 @@
|
|||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Build\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>..\..\Build\Builder.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -519,7 +532,7 @@
|
|||
<Compile Include="Rendering\WorldVertex.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="JetBrains.Profiler.Core.Api, Version=1.3.1661.20096, Culture=neutral, PublicKeyToken=1010a0d8d6380325" Condition=" '$(Configuration)|$(Platform)' == 'Debug + Profiler|x86' " />
|
||||
<Reference Include="JetBrains.Profiler.Core.Api, Version=1.3.1661.20096, Culture=neutral, PublicKeyToken=1010a0d8d6380325" Condition=" '$(Configuration)|$(Platform)' == 'Debug + Profiler|x86' Or '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' " />
|
||||
<Reference Include="SharpCompress.3.5, Version=0.11.1.0, Culture=neutral, processorArchitecture=x86" />
|
||||
<Reference Include="SlimDX, Version=2.0.13.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -58,6 +58,10 @@ namespace CodeImp.DoomBuilder.Data
|
|||
protected bool hasLongName; //mxd. Texture name is longer than DataManager.CLASIC_IMAGE_NAME_LENGTH
|
||||
protected bool hasPatchWithSameName; //mxd
|
||||
protected int level; //mxd. Folder depth of this item
|
||||
|
||||
//mxd. Hashing
|
||||
private static int hashcounter;
|
||||
private readonly int hashcode;
|
||||
|
||||
// Loading
|
||||
private volatile ImageLoadState previewstate;
|
||||
|
@ -126,6 +130,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Defaults
|
||||
usecolorcorrection = true;
|
||||
allowunload = true;
|
||||
|
||||
//mxd. Hashing
|
||||
hashcode = hashcounter++;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
@ -379,6 +386,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
General.Map.Data.GlowingFlats[longname].Color = new PixelColor(255, (byte)br, (byte)bg, (byte)bb);
|
||||
General.Map.Data.GlowingFlats[longname].CalculateTextureColor = false;
|
||||
if(!General.Map.Data.GlowingFlats[longname].Fullbright)
|
||||
General.Map.Data.GlowingFlats[longname].Brightness = (br + bg + bb) / 3;
|
||||
}
|
||||
|
||||
// Release the data
|
||||
|
@ -557,6 +566,12 @@ namespace CodeImp.DoomBuilder.Data
|
|||
return Properties.Resources.Hourglass;
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. This greatly speeds up Dictionary lookups
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
public PixelColor Color;
|
||||
public int Height;
|
||||
public int Brightness = 255;
|
||||
public bool Fullbright;
|
||||
public bool Fullblack; // GLOOME only
|
||||
public bool Subtractive; // GLOOME only
|
||||
|
|
|
@ -72,16 +72,16 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
}
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(IEnumerable<VisualThing> visualthings)
|
||||
/*public static List<Line3D> GetThingLinks(IEnumerable<VisualThing> visualthings)
|
||||
{
|
||||
List<Thing> things = new List<Thing>();
|
||||
foreach (VisualThing vt in visualthings) things.Add(vt.Thing);
|
||||
return GetThingLinks(GetSpecialThings(things, true), true);
|
||||
}
|
||||
}*/
|
||||
|
||||
public static List<Line3D> GetThingLinks(IEnumerable<Thing> things)
|
||||
public static List<Line3D> GetThingLinks(IEnumerable<Thing> things, bool correctheight)
|
||||
{
|
||||
return GetThingLinks(GetSpecialThings(things, false), false);
|
||||
return GetThingLinks(GetSpecialThings(things, correctheight), correctheight);
|
||||
}
|
||||
|
||||
private static SpecialThings GetSpecialThings(IEnumerable<Thing> things, bool correctheight)
|
||||
|
|
|
@ -36,6 +36,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
|
||||
internal bool IsVoxel;
|
||||
|
||||
// Hashing
|
||||
private static int hashcounter;
|
||||
private readonly int hashcode;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed;
|
||||
|
||||
|
@ -51,6 +55,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
TextureNames = new List<string>();
|
||||
transform = Matrix.Identity;
|
||||
transformstretched = Matrix.Identity;
|
||||
hashcode = hashcounter++;
|
||||
}
|
||||
|
||||
internal void Dispose()
|
||||
|
@ -78,6 +83,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
this.transformstretched = rotation * Matrix.Scaling(scale.X, scale.Y, scale.Z * Renderer3D.GZDOOM_INVERTED_VERTICAL_VIEW_STRETCH) * offset;
|
||||
}
|
||||
|
||||
//mxd. This greatly speeds up Dictionary lookups
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#region ================== Namespaces
|
||||
/*#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using SlimDX.Direct3D9;
|
||||
|
@ -90,4 +90,4 @@ namespace CodeImp.DoomBuilder.GZBuilder.Rendering
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#region ================== Namespaces
|
||||
/*#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using SlimDX.Direct3D9;
|
||||
|
@ -121,4 +121,4 @@ namespace CodeImp.DoomBuilder.GZBuilder.Rendering
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using SlimDX;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -233,6 +234,28 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
// Return vector
|
||||
return new Vector3D(ax, ay, az);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public static Vector3D Transform(Vector3D v, Matrix m)
|
||||
{
|
||||
return new Vector3D
|
||||
{
|
||||
x = m.M11 * v.x + m.M21 * v.y + m.M31 * v.z + m.M41,
|
||||
y = m.M12 * v.x + m.M22 * v.y + m.M32 * v.z + m.M42,
|
||||
z = m.M13 * v.x + m.M23 * v.y + m.M33 * v.z + m.M43,
|
||||
};
|
||||
}
|
||||
|
||||
//mxd
|
||||
public static Vector3D Transform(float x, float y, float z, Matrix m)
|
||||
{
|
||||
return new Vector3D
|
||||
{
|
||||
x = m.M11 * x + m.M21 * y + m.M31 * z + m.M41,
|
||||
y = m.M12 * x + m.M22 * y + m.M32 * z + m.M42,
|
||||
z = m.M13 * x + m.M23 * y + m.M33 * z + m.M43,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
// Error Ignoring (mxd)
|
||||
private List<Type> ignorederrorchecks;
|
||||
|
||||
//mxd. Hashing
|
||||
private static int hashcounter;
|
||||
private readonly int hashcode;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -67,6 +71,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Initialize
|
||||
fields = new UniFields(this);
|
||||
ignorederrorchecks = new List<Type>(); //mxd
|
||||
hashcode = hashcounter++; //mxd
|
||||
}
|
||||
|
||||
// Disposer
|
||||
|
@ -128,6 +133,12 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
BeforePropsChange();
|
||||
}
|
||||
|
||||
//mxd. This greatly speeds up Dictionary lookups
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -44,6 +44,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Disposing
|
||||
protected bool isdisposed;
|
||||
|
||||
//mxd. Settings changes
|
||||
protected bool settingschanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -166,7 +169,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// This applies properties during a pass
|
||||
public void ApplySettings()
|
||||
{
|
||||
if(manager.Enabled) effect.CommitChanges();
|
||||
if(manager.Enabled && settingschanged)
|
||||
{
|
||||
effect.CommitChanges();
|
||||
settingschanged = false; //mxd
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
effect.SetValue(rendersettings, values);
|
||||
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
|
||||
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
|
||||
effect.SetValue(transformsettings, Matrix.Multiply(world, view));
|
||||
effect.SetValue(transformsettings, world * view);
|
||||
TextureFilter filter = (bilinear ? TextureFilter.Linear : TextureFilter.Point);
|
||||
effect.SetValue(filtersettings, (int)filter);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System.Collections.Generic;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
|
@ -48,7 +50,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
void SetHighlightedObject(IVisualPickable obj);
|
||||
void AddSectorGeometry(VisualGeometry g);
|
||||
void AddThingGeometry(VisualThing t);
|
||||
void AddVisualVertices(VisualVertex[] verts);
|
||||
void SetVisualVertices(List<VisualVertex> verts);
|
||||
void SetEventLines(List<Line3D> lines);
|
||||
void RenderCrosshair();
|
||||
void SetFogMode(bool usefog);
|
||||
void SetCrosshairBusy(bool busy);
|
||||
|
|
|
@ -523,7 +523,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
Matrix scaling = Matrix.Scaling((1f / windowsize.Width) * 2f, (1f / windowsize.Height) * -2f, 1f);
|
||||
Matrix translate = Matrix.Translation(-(float)windowsize.Width * 0.5f, -(float)windowsize.Height * 0.5f, 0f);
|
||||
graphics.Device.SetTransform(TransformState.View, Matrix.Multiply(translate, scaling));
|
||||
graphics.Device.SetTransform(TransformState.View, translate * scaling);
|
||||
graphics.Device.SetTransform(TransformState.Projection, Matrix.Identity);
|
||||
Vector2D lt = DisplayToMap(new Vector2D(0.0f, 0.0f));
|
||||
Vector2D rb = DisplayToMap(new Vector2D(windowsize.Width, windowsize.Height));
|
||||
|
@ -538,7 +538,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
Matrix translate = Matrix.Translation(translatex, translatey, 0f);
|
||||
Matrix scaling = Matrix.Scaling(scale, -scale, 1f);
|
||||
graphics.Device.SetTransform(TransformState.World, Matrix.Multiply(translate, scaling));
|
||||
graphics.Device.SetTransform(TransformState.World, translate * scaling);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -20,15 +20,15 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using SlimDX;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using SlimDX.Direct3D9;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data; //mxd
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry; //mxd
|
||||
using CodeImp.DoomBuilder.GZBuilder.Rendering; //mxd
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using SlimDX;
|
||||
using SlimDX.Direct3D9;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -50,8 +50,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Matrices
|
||||
private Matrix projection;
|
||||
private Matrix view3d;
|
||||
private Matrix viewproj; //mxd
|
||||
private Matrix billboard;
|
||||
private Matrix worldviewproj;
|
||||
private Matrix view2d;
|
||||
private Matrix world;
|
||||
private Vector3D cameraposition;
|
||||
|
@ -66,9 +66,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Thing cage
|
||||
private bool renderthingcages;
|
||||
//mxd
|
||||
private ThingBoundingBox bbox;
|
||||
private VisualVertexHandle vertexHandle;
|
||||
private SizelessVisualThingCage sizelessThingHandle;
|
||||
private List<VisualThing> lightthings;
|
||||
private int[] lightOffsets;
|
||||
private Dictionary<ModelData, List<VisualThing>> modelthings;
|
||||
|
@ -108,7 +106,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
private List<VisualThing> allthings;
|
||||
|
||||
//mxd. Visual vertices
|
||||
private VisualVertex[] visualvertices;
|
||||
private List<VisualVertex> visualvertices;
|
||||
|
||||
//mxd. Event lines
|
||||
private List<Line3D> eventlines;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -134,6 +135,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
renderthingcages = true;
|
||||
showselection = true;
|
||||
showhighlight = true;
|
||||
eventlines = new List<Line3D>(); //mxd
|
||||
|
||||
// Dummy frustum
|
||||
frustum = new ProjectedFrustum2D(new Vector2D(), 0.0f, 0.0f, PROJ_NEAR_PLANE,
|
||||
|
@ -234,8 +236,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//mxd
|
||||
private void SetupHelperObjects()
|
||||
{
|
||||
bbox = new ThingBoundingBox();
|
||||
sizelessThingHandle = new SizelessVisualThingCage();
|
||||
vertexHandle = new VisualVertexHandle();
|
||||
}
|
||||
|
||||
|
@ -289,6 +289,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Make the view matrix
|
||||
view3d = Matrix.LookAtRH(D3DDevice.V3(pos), D3DDevice.V3(lookat), new Vector3(0f, 0f, 1f));
|
||||
viewproj = view3d * projection; //mxd
|
||||
|
||||
// Make the billboard matrix
|
||||
billboard = Matrix.RotationZ(anglexy + Angle2D.PI);
|
||||
|
@ -300,17 +301,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
windowsize = graphics.RenderTarget.ClientSize;
|
||||
Matrix scaling = Matrix.Scaling((1f / windowsize.Width) * 2f, (1f / windowsize.Height) * -2f, 1f);
|
||||
Matrix translate = Matrix.Translation(-(float)windowsize.Width * 0.5f, -(float)windowsize.Height * 0.5f, 0f);
|
||||
view2d = Matrix.Multiply(translate, scaling);
|
||||
view2d = translate * scaling;
|
||||
}
|
||||
|
||||
// This applies the matrices
|
||||
private void ApplyMatrices3D()
|
||||
{
|
||||
worldviewproj = world * view3d * projection;
|
||||
graphics.Shaders.World3D.WorldViewProj = worldviewproj;
|
||||
graphics.Device.SetTransform(TransformState.World, world);
|
||||
graphics.Device.SetTransform(TransformState.Projection, projection);
|
||||
graphics.Device.SetTransform(TransformState.View, view3d);
|
||||
graphics.Shaders.World3D.WorldViewProj = world * viewproj; //mxd. Multiplication is ~2x faster than "world * view3d * projection";
|
||||
}
|
||||
|
||||
// This sets the appropriate view matrix
|
||||
|
@ -346,7 +343,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.FogTableMode, FogMode.Linear);
|
||||
graphics.Device.SetRenderState(RenderState.RangeFogEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Shaders.World3D.SetHighlightColor(0);
|
||||
graphics.Shaders.World3D.HighlightColor = new Color4(); //mxd
|
||||
|
||||
// Texture addressing
|
||||
graphics.Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Wrap);
|
||||
|
@ -456,13 +453,15 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
RenderTranslucentPass(translucentgeo, translucentthings);
|
||||
|
||||
// THING CAGES
|
||||
world = Matrix.Identity;
|
||||
ApplyMatrices3D();
|
||||
if(renderthingcages) RenderThingCages();
|
||||
|
||||
//mxd. Visual vertices
|
||||
RenderVertices();
|
||||
|
||||
//mxd. Event lines
|
||||
if(General.Settings.GZShowEventLines) RenderArrows(LinksCollector.GetThingLinks(allthings));
|
||||
if(General.Settings.GZShowEventLines) RenderArrows(eventlines);
|
||||
|
||||
// Remove references
|
||||
graphics.Shaders.World3D.Texture1 = null;
|
||||
|
@ -535,10 +534,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
foreach(VisualThing t in allthings)
|
||||
{
|
||||
// Setup matrix
|
||||
world = Matrix.Multiply(t.CageScales, t.Position);
|
||||
ApplyMatrices3D();
|
||||
|
||||
// Setup color
|
||||
Color4 thingcolor;
|
||||
if(t.Selected && showselection)
|
||||
|
@ -554,35 +549,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
//Render cage
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
||||
if(t.Sizeless)
|
||||
{
|
||||
graphics.Device.SetStreamSource(0, sizelessThingHandle.Shape, 0, WorldVertex.Stride);
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.LineList, 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Device.SetStreamSource(0, bbox.Cage, 0, WorldVertex.Stride);
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.LineList, 0, 12);
|
||||
}
|
||||
|
||||
//and arrow
|
||||
if(t.Thing.IsDirectional)
|
||||
{
|
||||
float sx = t.CageScales.M11;
|
||||
Matrix arrowScaler = Matrix.Scaling(sx, sx, sx); //scale arrow evenly based on thing width\depth
|
||||
if(t.Sizeless)
|
||||
world = Matrix.Multiply(arrowScaler, t.Position);
|
||||
else
|
||||
world = Matrix.Multiply(arrowScaler, t.Position * Matrix.Translation(0.0f, 0.0f, t.CageScales.M33 / 2));
|
||||
Matrix rot = Matrix.RotationY(-t.Thing.RollRad) * Matrix.RotationX(-t.Thing.PitchRad) * Matrix.RotationZ(t.Thing.Angle);
|
||||
world = Matrix.Multiply(rot, world);
|
||||
ApplyMatrices3D();
|
||||
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
graphics.Device.SetStreamSource(0, bbox.Arrow, 0, WorldVertex.Stride);
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.LineList, 0, 5);
|
||||
}
|
||||
graphics.Device.SetStreamSource(0, t.CageBuffer, 0, WorldVertex.Stride);
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.LineList, 0, t.CageLength);
|
||||
}
|
||||
|
||||
// Done
|
||||
|
@ -723,8 +691,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//mxd. Anything to render?
|
||||
if(geopass.Count == 0 && thingspass.Count == 0) return;
|
||||
|
||||
ImageData curtexture;
|
||||
int currentshaderpass = shaderpass;
|
||||
int highshaderpass = shaderpass + 2;
|
||||
float fogfactor = -1; //mxd
|
||||
|
||||
// Begin rendering with this shader
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
|
@ -732,8 +702,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Render the geometry collected
|
||||
foreach(KeyValuePair<ImageData, List<VisualGeometry>> group in geopass)
|
||||
{
|
||||
ImageData curtexture;
|
||||
|
||||
// What texture to use?
|
||||
if(group.Key is UnknownImage)
|
||||
curtexture = General.Map.Data.UnknownTexture3D;
|
||||
|
@ -765,7 +733,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(g.Sector.NeedsUpdateGeo) g.Sector.Update();
|
||||
|
||||
// Only do this sector when a vertexbuffer is created
|
||||
//mxd. no Map means that sector was deleted recently, I suppose
|
||||
//mxd. No Map means that sector was deleted recently, I suppose
|
||||
if (g.Sector.GeometryBuffer != null && g.Sector.Sector.Map != null)
|
||||
{
|
||||
// Change current sector
|
||||
|
@ -786,7 +754,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
int wantedshaderpass = (((g == highlighted) && showhighlight) || (g.Selected && showselection)) ? highshaderpass : shaderpass;
|
||||
|
||||
//mxd. Render fog?
|
||||
if( !(!General.Settings.GZDrawFog || fullbrightness || sector.Sector.Brightness > 247) )
|
||||
if(General.Settings.GZDrawFog && !fullbrightness && sector.Sector.Brightness < 248)
|
||||
wantedshaderpass += 8;
|
||||
|
||||
// Switch shader pass?
|
||||
|
@ -795,27 +763,31 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Shaders.World3D.EndPass();
|
||||
graphics.Shaders.World3D.BeginPass(wantedshaderpass);
|
||||
currentshaderpass = wantedshaderpass;
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
if(!graphics.Shaders.Enabled)
|
||||
{
|
||||
graphics.Device.SetTexture(2, (g.Selected && showselection) ? selectionimage.Texture : null);
|
||||
graphics.Device.SetTexture(3, ((g == highlighted) && showhighlight) ? highlightimage.Texture : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
//mxd. set variables for fog rendering
|
||||
if (wantedshaderpass > 7)
|
||||
|
||||
//mxd. Set variables for fog rendering?
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
graphics.Shaders.World3D.LightColor = sector.Sector.FogColor;
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, sector.FogDistance);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Set variables for fog rendering?
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
if(g.FogFactor != fogfactor)
|
||||
{
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, g.FogFactor);
|
||||
fogfactor = g.FogFactor;
|
||||
}
|
||||
|
||||
graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection)).ToArgb());
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
graphics.Shaders.World3D.LightColor = sector.Sector.FogColor;
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
graphics.Shaders.World3D.HighlightColor = CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection));
|
||||
|
||||
// Apply changes
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
||||
// Render!
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
|
||||
|
@ -832,13 +804,15 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetSamplerState(0, SamplerState.AddressW, TextureAddress.Clamp);
|
||||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None); //mxd. Disable backside culling, because otherwise sprites with positive ScaleY and negative ScaleX will be facing away from the camera...
|
||||
|
||||
Color4 litcolor; //mxd
|
||||
Color4 vertexcolor = new Color4(); //mxd
|
||||
fogfactor = -1; //mxd
|
||||
|
||||
// Render things collected
|
||||
foreach(KeyValuePair<ImageData, List<VisualThing>> group in thingspass)
|
||||
{
|
||||
if(group.Key is UnknownImage) continue;
|
||||
|
||||
ImageData curtexture;
|
||||
|
||||
// What texture to use?
|
||||
if(!group.Key.IsImageLoaded || group.Key.IsDisposed)
|
||||
curtexture = General.Map.Data.Hourglass3D;
|
||||
|
@ -850,7 +824,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
curtexture.CreateTexture();
|
||||
|
||||
// Apply texture
|
||||
if(!graphics.Shaders.Enabled) graphics.Device.SetTexture(0, curtexture.Texture);
|
||||
graphics.Shaders.World3D.Texture1 = curtexture.Texture;
|
||||
|
||||
// Render all things with this texture
|
||||
|
@ -872,28 +845,35 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Determine the shader pass we want to use for this object
|
||||
int wantedshaderpass = (((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass;
|
||||
|
||||
//mxd. if fog is enagled, switch to shader, which calculates it
|
||||
//mxd. If fog is enagled, switch to shader, which calculates it
|
||||
if(General.Settings.GZDrawFog && !fullbrightness && t.Thing.Sector != null && (t.Thing.Sector.HasFogColor || t.Thing.Sector.Brightness < 248))
|
||||
wantedshaderpass += 8;
|
||||
|
||||
//mxd. if current thing is light - set it's color to light color
|
||||
Color4 litcolor = new Color4();
|
||||
//mxd. Create the matrix for positioning
|
||||
world = CreateThingPositionMatrix(t);
|
||||
|
||||
//mxd. If current thing is light - set it's color to light color
|
||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.Type) != -1 && !fullbrightness)
|
||||
{
|
||||
wantedshaderpass += 4; //render using one of passes, which uses World3D.VertexColor
|
||||
graphics.Shaders.World3D.VertexColor = t.LightColor;
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
litcolor = t.LightColor;
|
||||
vertexcolor = t.LightColor;
|
||||
}
|
||||
//mxd. check if Thing is affected by dynamic lights and set color accordingly
|
||||
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||
//mxd. Check if Thing is affected by dynamic lights and set color accordingly
|
||||
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||
{
|
||||
litcolor = GetLitColorForThing(t);
|
||||
if(litcolor.ToArgb() != 0)
|
||||
if(litcolor.ToArgb() != 0)
|
||||
{
|
||||
wantedshaderpass += 4; //render using one of passes, which uses World3D.VertexColor
|
||||
graphics.Shaders.World3D.VertexColor = new Color4(t.VertexColor) + litcolor;
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
vertexcolor = new Color4(t.VertexColor) + litcolor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
litcolor = new Color4();
|
||||
vertexcolor = new Color4();
|
||||
}
|
||||
|
||||
// Switch shader pass?
|
||||
if(currentshaderpass != wantedshaderpass)
|
||||
|
@ -903,53 +883,26 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
currentshaderpass = wantedshaderpass;
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
if(!graphics.Shaders.Enabled)
|
||||
{
|
||||
graphics.Device.SetTexture(2, (t.Selected && showselection) ? selectionimage.Texture : null);
|
||||
graphics.Device.SetTexture(3, ((t == highlighted) && showhighlight) ? highlightimage.Texture : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection)).ToArgb());
|
||||
}
|
||||
|
||||
//mxd. Create the matrix for positioning
|
||||
if(t.Info.RenderMode == Thing.SpriteRenderMode.NORMAL) // Apply billboarding?
|
||||
{
|
||||
if(t.Info.XYBillboard)
|
||||
{
|
||||
world = Matrix.Translation(0f, 0f, -t.LocalCenterZ)
|
||||
* Matrix.RotationX(Angle2D.PI - General.Map.VisualCamera.AngleZ)
|
||||
* Matrix.Translation(0f, 0f, t.LocalCenterZ)
|
||||
* billboard
|
||||
* Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
world = billboard
|
||||
* Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
world = Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
|
||||
ApplyMatrices3D();
|
||||
|
||||
//mxd. Set variables for fog rendering
|
||||
if(wantedshaderpass > 7)
|
||||
//mxd. Set variables for fog rendering?
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||
float fogdistance = (litcolor.ToArgb() != 0 ? VisualSector.MAXIMUM_FOG_DISTANCE : t.FogDistance);
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogdistance);
|
||||
|
||||
float curfogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
||||
if(curfogfactor != fogfactor)
|
||||
{
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, curfogfactor);
|
||||
fogfactor = curfogfactor;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
if(t.Thing.Sector != null) graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
||||
graphics.Shaders.World3D.HighlightColor = CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection));
|
||||
|
||||
// Apply changes
|
||||
ApplyMatrices3D();
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
||||
// Apply buffer
|
||||
|
@ -1018,13 +971,14 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
- (General.Map.VisualCamera.Position - vg1.BoundingBox[0]).GetLengthSq()));
|
||||
}
|
||||
|
||||
// Begin rendering with this shader
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
|
||||
ImageData curtexture;
|
||||
VisualSector sector = null;
|
||||
RenderPass currentpass = RenderPass.Solid;
|
||||
long curtexturename = 0;
|
||||
ImageData curtexture;
|
||||
float fogfactor = -1;
|
||||
|
||||
// Begin rendering with this shader
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
|
||||
// Go for all geometry
|
||||
foreach(VisualGeometry g in geopass)
|
||||
|
@ -1062,9 +1016,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
curtexture.CreateTexture();
|
||||
|
||||
// Apply texture
|
||||
if(!graphics.Shaders.Enabled) graphics.Device.SetTexture(0, curtexture.Texture);
|
||||
graphics.Shaders.World3D.Texture1 = curtexture.Texture;
|
||||
|
||||
curtexturename = g.Texture.LongName;
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1027,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(g.Sector.NeedsUpdateGeo) g.Sector.Update();
|
||||
|
||||
// Only do this sector when a vertexbuffer is created
|
||||
//mxd. no Map means that sector was deleted recently, I suppose
|
||||
//mxd. No Map means that sector was deleted recently, I suppose
|
||||
if(g.Sector.GeometryBuffer != null && g.Sector.Sector.Map != null)
|
||||
{
|
||||
// Change current sector
|
||||
|
@ -1096,7 +1048,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
int wantedshaderpass = (((g == highlighted) && showhighlight) || (g.Selected && showselection)) ? highshaderpass : shaderpass;
|
||||
|
||||
//mxd. Render fog?
|
||||
if(!(!General.Settings.GZDrawFog || fullbrightness || sector.Sector.Brightness > 247))
|
||||
if(General.Settings.GZDrawFog && !fullbrightness && sector.Sector.Brightness < 248)
|
||||
wantedshaderpass += 8;
|
||||
|
||||
// Switch shader pass?
|
||||
|
@ -1105,28 +1057,28 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Shaders.World3D.EndPass();
|
||||
graphics.Shaders.World3D.BeginPass(wantedshaderpass);
|
||||
currentshaderpass = wantedshaderpass;
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
if(!graphics.Shaders.Enabled)
|
||||
{
|
||||
graphics.Device.SetTexture(2, (g.Selected && showselection) ? selectionimage.Texture : null);
|
||||
graphics.Device.SetTexture(3, ((g == highlighted) && showhighlight) ? highlightimage.Texture : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
//mxd. set variables for fog rendering
|
||||
//mxd. Set variables for fog rendering?
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
graphics.Shaders.World3D.LightColor = sector.Sector.FogColor;
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, sector.FogDistance);
|
||||
}
|
||||
|
||||
graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection)).ToArgb());
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
}
|
||||
|
||||
// Set variables for fog rendering?
|
||||
if(wantedshaderpass > 7 && g.FogFactor != fogfactor)
|
||||
{
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, g.FogFactor);
|
||||
fogfactor = g.FogFactor;
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
graphics.Shaders.World3D.LightColor = sector.Sector.FogColor;
|
||||
graphics.Shaders.World3D.HighlightColor = CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection));
|
||||
|
||||
// Apply changes
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
||||
// Render!
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
|
||||
}
|
||||
|
@ -1145,9 +1097,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
thingspass.Sort((vt1, vt2) => (int)((General.Map.VisualCamera.Position - vt2.BoundingBox[0]).GetLengthSq()
|
||||
- (General.Map.VisualCamera.Position - vt1.BoundingBox[0]).GetLengthSq()));
|
||||
|
||||
Color4 litcolor;
|
||||
|
||||
// Reset vars
|
||||
currentpass = RenderPass.Solid;
|
||||
curtexturename = 0;
|
||||
Color4 vertexcolor = new Color4();
|
||||
fogfactor = -1;
|
||||
|
||||
// Render things collected
|
||||
foreach(VisualThing t in thingspass)
|
||||
|
@ -1185,10 +1141,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
curtexture.CreateTexture();
|
||||
|
||||
// Apply texture
|
||||
if(!graphics.Shaders.Enabled)
|
||||
graphics.Device.SetTexture(0, curtexture.Texture);
|
||||
graphics.Shaders.World3D.Texture1 = curtexture.Texture;
|
||||
|
||||
curtexturename = t.Texture.LongName;
|
||||
}
|
||||
|
||||
|
@ -1196,7 +1149,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(t.Thing.IsModel &&
|
||||
(General.Settings.GZDrawModelsMode == ModelRenderMode.ALL ||
|
||||
General.Settings.GZDrawModelsMode == ModelRenderMode.ACTIVE_THINGS_FILTER ||
|
||||
(General.Settings.GZDrawModelsMode == ModelRenderMode.SELECTION && t.Selected)))
|
||||
(General.Settings.GZDrawModelsMode == ModelRenderMode.SELECTION && t.Selected)))
|
||||
continue;
|
||||
|
||||
// Update buffer if needed
|
||||
|
@ -1212,24 +1165,31 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(General.Settings.GZDrawFog && !fullbrightness && t.Thing.Sector != null && (t.Thing.Sector.HasFogColor || t.Thing.Sector.Brightness < 248))
|
||||
wantedshaderpass += 8;
|
||||
|
||||
//mxd. if current thing is light - set it's color to light color
|
||||
Color4 litcolor = new Color4();
|
||||
//mxd. Create the matrix for positioning
|
||||
world = CreateThingPositionMatrix(t);
|
||||
|
||||
//mxd. If current thing is light - set it's color to light color
|
||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.Type) != -1 && !fullbrightness)
|
||||
{
|
||||
wantedshaderpass += 4; //render using one of passes, which uses World3D.VertexColor
|
||||
graphics.Shaders.World3D.VertexColor = t.LightColor;
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
litcolor = t.LightColor;
|
||||
vertexcolor = t.LightColor;
|
||||
}
|
||||
//mxd. check if Thing is affected by dynamic lights and set color accordingly
|
||||
//mxd. Check if Thing is affected by dynamic lights and set color accordingly
|
||||
else if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||
{
|
||||
litcolor = GetLitColorForThing(t);
|
||||
if(litcolor.ToArgb() != 0)
|
||||
{
|
||||
wantedshaderpass += 4; //render using one of passes, which uses World3D.VertexColor
|
||||
graphics.Shaders.World3D.VertexColor = new Color4(t.VertexColor) + litcolor;
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
vertexcolor = new Color4(t.VertexColor) + litcolor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
litcolor = new Color4();
|
||||
vertexcolor = new Color4();
|
||||
}
|
||||
|
||||
// Switch shader pass?
|
||||
if(currentshaderpass != wantedshaderpass)
|
||||
|
@ -1239,53 +1199,26 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
currentshaderpass = wantedshaderpass;
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
if(!graphics.Shaders.Enabled)
|
||||
{
|
||||
graphics.Device.SetTexture(2, (t.Selected && showselection) ? selectionimage.Texture : null);
|
||||
graphics.Device.SetTexture(3, ((t == highlighted) && showhighlight) ? highlightimage.Texture : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection)).ToArgb());
|
||||
}
|
||||
|
||||
//mxd. Create the matrix for positioning
|
||||
if(t.Info.RenderMode == Thing.SpriteRenderMode.NORMAL) // Apply billboarding?
|
||||
{
|
||||
if(t.Info.XYBillboard)
|
||||
{
|
||||
world = Matrix.Translation(0f, 0f, -t.LocalCenterZ)
|
||||
* Matrix.RotationX(Angle2D.PI - General.Map.VisualCamera.AngleZ)
|
||||
* Matrix.Translation(0f, 0f, t.LocalCenterZ)
|
||||
* billboard
|
||||
* Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
world = billboard
|
||||
* Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
world = Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
|
||||
ApplyMatrices3D();
|
||||
|
||||
//mxd. Set variables for fog rendering
|
||||
//mxd. set variables for fog rendering?
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||
float fogdistance = (litcolor.ToArgb() != 0 ? VisualSector.MAXIMUM_FOG_DISTANCE : t.FogDistance);
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogdistance);
|
||||
|
||||
float curfogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
||||
if(curfogfactor != fogfactor)
|
||||
{
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, curfogfactor);
|
||||
fogfactor = curfogfactor;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the colors to use
|
||||
graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
||||
graphics.Shaders.World3D.HighlightColor = CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection));
|
||||
|
||||
// Apply changes
|
||||
ApplyMatrices3D();
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
||||
// Apply buffer
|
||||
|
@ -1307,6 +1240,39 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Shaders.World3D.EndPass();
|
||||
}
|
||||
|
||||
//mxd
|
||||
private Matrix CreateThingPositionMatrix(VisualThing t)
|
||||
{
|
||||
Matrix result;
|
||||
|
||||
//mxd. Create the matrix for positioning
|
||||
if(t.Info.RenderMode == Thing.SpriteRenderMode.NORMAL) // Apply billboarding?
|
||||
{
|
||||
if(t.Info.XYBillboard)
|
||||
{
|
||||
result = Matrix.Translation(0f, 0f, -t.LocalCenterZ)
|
||||
* Matrix.RotationX(Angle2D.PI - General.Map.VisualCamera.AngleZ)
|
||||
* Matrix.Translation(0f, 0f, t.LocalCenterZ)
|
||||
* billboard
|
||||
* Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = billboard
|
||||
* Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Matrix.Scaling(t.Thing.ScaleX, t.Thing.ScaleX, t.Thing.ScaleY)
|
||||
* t.Position;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//mxd. Dynamic lights pass!
|
||||
private void RenderLights(Dictionary<ImageData, List<VisualGeometry>> geometrytolit, List<VisualThing> lights)
|
||||
{
|
||||
|
@ -1428,18 +1394,17 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Begin rendering with this shader
|
||||
graphics.Shaders.World3D.BeginPass(currentshaderpass);
|
||||
|
||||
foreach (KeyValuePair<ModelData, List<VisualThing>> group in modelthings)
|
||||
foreach(KeyValuePair<ModelData, List<VisualThing>> group in modelthings)
|
||||
{
|
||||
foreach (VisualThing t in group.Value)
|
||||
foreach(VisualThing t in group.Value)
|
||||
{
|
||||
t.Update();
|
||||
|
||||
Color4 vertexcolor = new Color4(t.VertexColor);
|
||||
vertexcolor.Alpha = 1.0f;
|
||||
|
||||
|
||||
//check if model is affected by dynamic lights and set color accordingly
|
||||
Color4 litcolor = new Color4();
|
||||
if (General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||
Color4 litcolor;
|
||||
if(General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && lightthings.Count > 0)
|
||||
{
|
||||
litcolor = GetLitColorForThing(t);
|
||||
graphics.Shaders.World3D.VertexColor = vertexcolor + litcolor;
|
||||
|
@ -1447,18 +1412,18 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
else
|
||||
{
|
||||
graphics.Shaders.World3D.VertexColor = vertexcolor;
|
||||
litcolor = vertexcolor;
|
||||
litcolor = new Color4();
|
||||
}
|
||||
|
||||
// Determine the shader pass we want to use for this object
|
||||
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
||||
|
||||
//mxd. if fog is enagled, switch to shader, which calculates it
|
||||
if (General.Settings.GZDrawFog && !fullbrightness && t.Thing.Sector != null && (t.Thing.Sector.HasFogColor || t.Thing.Sector.Brightness < 248))
|
||||
if(General.Settings.GZDrawFog && !fullbrightness && t.Thing.Sector != null && (t.Thing.Sector.HasFogColor || t.Thing.Sector.Brightness < 248))
|
||||
wantedshaderpass += 8;
|
||||
|
||||
// Switch shader pass?
|
||||
if (currentshaderpass != wantedshaderpass)
|
||||
if(currentshaderpass != wantedshaderpass)
|
||||
{
|
||||
graphics.Shaders.World3D.EndPass();
|
||||
graphics.Shaders.World3D.BeginPass(wantedshaderpass);
|
||||
|
@ -1466,15 +1431,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
// Set the colors to use
|
||||
if (!graphics.Shaders.Enabled)
|
||||
{
|
||||
graphics.Device.SetTexture(2, (t.Selected && showselection) ? selectionimage.Texture : null);
|
||||
graphics.Device.SetTexture(3, ((t == highlighted) && showhighlight) ? highlightimage.Texture : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection)).ToArgb());
|
||||
}
|
||||
graphics.Shaders.World3D.HighlightColor = CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection));
|
||||
|
||||
// Create the matrix for positioning / rotation
|
||||
float sx = t.Thing.ScaleX * t.Thing.ActorScale.Width;
|
||||
|
@ -1487,12 +1444,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
ApplyMatrices3D();
|
||||
|
||||
//mxd. set variables for fog rendering
|
||||
if (wantedshaderpass > 7)
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||
float fogdistance = (litcolor.ToArgb() != 0 ? VisualSector.MAXIMUM_FOG_DISTANCE : t.FogDistance);
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogdistance);
|
||||
if(t.Thing.Sector != null) graphics.Shaders.World3D.LightColor = t.Thing.Sector.FogColor;
|
||||
float fogfactor = (litcolor.ToArgb() != 0 ? VisualThing.LIT_FOG_DENSITY_SCALER : t.FogFactor);
|
||||
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, fogfactor);
|
||||
}
|
||||
|
||||
for(int i = 0; i < group.Key.Model.Meshes.Count; i++)
|
||||
|
@ -1618,7 +1575,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
(General.Settings.GZDrawModelsMode == ModelRenderMode.SELECTION && t.Selected)))
|
||||
{
|
||||
ModelData mde = General.Map.Data.ModeldefEntries[t.Thing.Type];
|
||||
if (!modelthings.ContainsKey(mde))
|
||||
if(!modelthings.ContainsKey(mde))
|
||||
modelthings.Add(mde, new List<VisualThing> { t });
|
||||
else
|
||||
modelthings[mde].Add(t);
|
||||
|
@ -1654,10 +1611,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
public void AddVisualVertices(VisualVertex[] verts)
|
||||
{
|
||||
visualvertices = verts;
|
||||
}
|
||||
public void SetVisualVertices(List<VisualVertex> verts) { visualvertices = verts; }
|
||||
|
||||
//mxd
|
||||
public void SetEventLines(List<Line3D> lines) { eventlines = lines; }
|
||||
|
||||
//mxd
|
||||
private static bool BoundingBoxesIntersect(Vector3D[] bbox1, Vector3D[] bbox2)
|
||||
|
|
|
@ -109,17 +109,18 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
effect.SetValue(rendersettings, values);
|
||||
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
|
||||
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
|
||||
effect.SetValue(transformsettings, Matrix.Multiply(world, view));
|
||||
effect.SetValue(transformsettings, world * view);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Used to render models
|
||||
public void SetTransformSettings(Matrix world)
|
||||
{
|
||||
if (manager.Enabled)
|
||||
if(manager.Enabled)
|
||||
{
|
||||
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
|
||||
effect.SetValue(transformsettings, Matrix.Multiply(world, view));
|
||||
effect.SetValue(transformsettings, world * view);
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//lights
|
||||
private readonly EffectHandle lightPositionAndRadiusHandle;
|
||||
private readonly EffectHandle lightColorHandle;
|
||||
private readonly EffectHandle worldHandle;
|
||||
private readonly EffectHandle world;
|
||||
//fog
|
||||
private readonly EffectHandle camPosHandle;
|
||||
//used in ModelReader
|
||||
|
@ -53,20 +53,96 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
#region ================== Properties
|
||||
|
||||
public Matrix WorldViewProj { set { if(manager.Enabled) effect.SetValue<Matrix>(worldviewproj, value); } }
|
||||
public Texture Texture1 { set { if(manager.Enabled) effect.SetTexture(texture1, value); } }
|
||||
public Matrix WorldViewProj { set { if(manager.Enabled) effect.SetValue(worldviewproj, value); settingschanged = true; } }
|
||||
public Texture Texture1 { set { if(manager.Enabled) effect.SetTexture(texture1, value); settingschanged = true; } }
|
||||
|
||||
//mxd
|
||||
public Color4 VertexColor { set { if (manager.Enabled) effect.SetValue<Color4>(vertexColorHadle, value); } }
|
||||
private Color4 vertexcolor;
|
||||
public Color4 VertexColor
|
||||
{
|
||||
set
|
||||
{
|
||||
if(manager.Enabled && vertexcolor != value)
|
||||
{
|
||||
effect.SetValue(vertexColorHadle, value);
|
||||
vertexcolor = value;
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//lights
|
||||
public Color4 LightColor { set { if (manager.Enabled) effect.SetValue<Color4>(lightColorHandle, value); } }
|
||||
public Vector4 LightPositionAndRadius { set { if (manager.Enabled) effect.SetValue(lightPositionAndRadiusHandle, value); } }
|
||||
private Color4 lightcolor;
|
||||
public Color4 LightColor
|
||||
{
|
||||
set
|
||||
{
|
||||
if(manager.Enabled && lightcolor != value)
|
||||
{
|
||||
effect.SetValue(lightColorHandle, value);
|
||||
lightcolor = value;
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Vector4 lightpos;
|
||||
public Vector4 LightPositionAndRadius
|
||||
{
|
||||
set
|
||||
{
|
||||
if(manager.Enabled && value != lightpos)
|
||||
{
|
||||
effect.SetValue(lightPositionAndRadiusHandle, value);
|
||||
lightpos = value;
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//fog
|
||||
public Vector4 CameraPosition { set { if (manager.Enabled) effect.SetValue(camPosHandle, value); } }
|
||||
private Vector4 campos;
|
||||
public Vector4 CameraPosition
|
||||
{
|
||||
set
|
||||
{
|
||||
if(manager.Enabled && campos != value)
|
||||
{
|
||||
effect.SetValue(camPosHandle, value);
|
||||
campos = value;
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix World { set { if (manager.Enabled) effect.SetValue<Matrix>(worldHandle, value); } }
|
||||
private Matrix mworld;
|
||||
public Matrix World
|
||||
{
|
||||
set
|
||||
{
|
||||
if(manager.Enabled && mworld != value)
|
||||
{
|
||||
effect.SetValue(world, value);
|
||||
mworld = value;
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. This sets the highlight color
|
||||
private Color4 hicolor;
|
||||
public Color4 HighlightColor
|
||||
{
|
||||
set
|
||||
{
|
||||
if(manager.Enabled && hicolor != value)
|
||||
{
|
||||
effect.SetValue(highlightcolor, value);
|
||||
hicolor = value;
|
||||
settingschanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -97,7 +173,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//fog
|
||||
camPosHandle = effect.GetParameter(null, "cameraPos");
|
||||
|
||||
worldHandle = effect.GetParameter(null, "world");
|
||||
world = effect.GetParameter(null, "world");
|
||||
}
|
||||
|
||||
// Initialize world vertex declaration
|
||||
|
@ -148,8 +224,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(lightColorHandle != null) lightColorHandle.Dispose();
|
||||
if(lightPositionAndRadiusHandle != null) lightPositionAndRadiusHandle.Dispose();
|
||||
if(camPosHandle != null) camPosHandle.Dispose();
|
||||
if(worldHandle != null) worldHandle.Dispose();
|
||||
|
||||
if(world != null) world.Dispose();
|
||||
|
||||
// Done
|
||||
base.Dispose();
|
||||
|
@ -192,15 +267,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
// This sets the highlight color
|
||||
public void SetHighlightColor(int hicolor)
|
||||
{
|
||||
if(manager.Enabled)
|
||||
{
|
||||
effect.SetValue(highlightcolor, new Color4(hicolor));
|
||||
}
|
||||
}
|
||||
|
||||
// This sets up the render pipeline
|
||||
public override void BeginPass(int index)
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ PixelData vs_customvertexcolor(VertexData vd)
|
|||
// Fill pixel data input
|
||||
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
||||
pd.color = vertexColor;
|
||||
pd.color.a = 1.0f;
|
||||
pd.color.a = vd.color.a;
|
||||
pd.uv = vd.uv;
|
||||
|
||||
// Return result
|
||||
|
@ -101,7 +101,7 @@ LitPixelData vs_customvertexcolor_fog(VertexData vd)
|
|||
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
||||
pd.pos_w = mul(float4(vd.pos, 1.0f), world);
|
||||
pd.color = vertexColor;
|
||||
pd.color.a = 1.0f;
|
||||
pd.color.a = vd.color.a;
|
||||
pd.uv = vd.uv;
|
||||
pd.normal = vd.normal;
|
||||
|
||||
|
@ -166,11 +166,10 @@ float4 ps_fullbright_highlight(PixelData pd) : COLOR
|
|||
float4 getFogColor(LitPixelData pd, float4 color)
|
||||
{
|
||||
float fogdist = max(16.0f, distance(pd.pos_w, cameraPos.xyz));
|
||||
float fogfactor = min(1.0f, fogdist / cameraPos.w);
|
||||
|
||||
//texture color completly replaced by fog color
|
||||
if(fogfactor == 1.0f) return float4(lightColor.rgb, color.a);
|
||||
return float4(lightColor.rgb * fogfactor + color.rgb * (1.0f - fogfactor), color.a);
|
||||
float fogfactor = exp2(cameraPos.w * fogdist);
|
||||
|
||||
color.rgb = lerp(lightColor.rgb, color.rgb, fogfactor);
|
||||
return color;
|
||||
}
|
||||
|
||||
//mxd. Shaders with fog calculation
|
||||
|
|
|
@ -31,6 +31,12 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
public abstract class VisualGeometry : IVisualPickable
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
public const float FOG_DENSITY_SCALER = -1.442692f / 256000f; //-1.442692f / 64000f; //mxd
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Texture
|
||||
|
@ -60,6 +66,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
// Rendering
|
||||
private RenderPass renderpass = RenderPass.Solid;
|
||||
protected float fogfactor;
|
||||
|
||||
// Sector buffer info
|
||||
private int vertexoffset;
|
||||
|
@ -81,6 +88,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//mxd
|
||||
public Vector3D[] BoundingBox { get { return boundingBox; } }
|
||||
public VisualGeometryType GeometryType { get { return geometrytype; } }
|
||||
public float FogFactor { get { return fogfactor; } }
|
||||
|
||||
/// <summary>
|
||||
/// Render pass in which this geometry must be rendered. Default is Solid.
|
||||
|
@ -192,6 +200,38 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
boundingBox = BoundingBoxTools.CalculateBoundingPlane(bbs);
|
||||
}
|
||||
|
||||
//mxd. Calculate fogdistance
|
||||
//TODO: this doesn't match any GZDoom light mode...
|
||||
//GZDoom: gl_renderstate.h, SetFog();
|
||||
//GZDoom: gl_lightlevel.cpp gl_SetFog();
|
||||
protected float CalculateFogDensity(int brightness)
|
||||
{
|
||||
float density;
|
||||
if(Sector.Sector.UsesOutsideFog && General.Map.Data.MapInfo.OutsideFogDensity > 0)
|
||||
{
|
||||
density = General.Map.Data.MapInfo.OutsideFogDensity;
|
||||
}
|
||||
else if(!Sector.Sector.UsesOutsideFog && General.Map.Data.MapInfo.FogDensity > 0)
|
||||
{
|
||||
density = General.Map.Data.MapInfo.FogDensity;
|
||||
}
|
||||
else if(brightness < 248)
|
||||
{
|
||||
density = General.Clamp(255 - brightness, 30, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
density = 0f;
|
||||
}
|
||||
|
||||
if(Sector.Sector.HasFogColor)
|
||||
{
|
||||
density *= 4;
|
||||
}
|
||||
|
||||
return density * FOG_DENSITY_SCALER;
|
||||
}
|
||||
|
||||
//mxd. Used to get proper sector from 3d-floors
|
||||
public virtual Sector GetControlSector()
|
||||
{
|
||||
|
|
|
@ -562,26 +562,24 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Things
|
||||
foreach(Thing t in block.Things)
|
||||
{
|
||||
VisualThing vt;
|
||||
|
||||
// Not filtered out?
|
||||
if(General.Map.ThingsFilter.IsThingVisible(t))
|
||||
{
|
||||
if(allthings.ContainsKey(t))
|
||||
{
|
||||
vt = allthings[t];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new visual thing
|
||||
vt = CreateVisualThing(t);
|
||||
allthings.Add(t, vt);
|
||||
}
|
||||
if(!General.Map.ThingsFilter.IsThingVisible(t)) continue;
|
||||
|
||||
if(vt != null)
|
||||
{
|
||||
visiblethings.Add(vt);
|
||||
}
|
||||
VisualThing vt;
|
||||
if(allthings.ContainsKey(t))
|
||||
{
|
||||
vt = allthings[t];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new visual thing
|
||||
vt = CreateVisualThing(t);
|
||||
allthings.Add(t, vt);
|
||||
}
|
||||
|
||||
if(vt != null)
|
||||
{
|
||||
visiblethings.Add(vt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
public const float MAXIMUM_FOG_DISTANCE = 2805f; //mxd. 255 * 11. Straight from GZDoom source.
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
@ -42,9 +40,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
private Dictionary<Sidedef, List<VisualGeometry>> sidedefgeometry;
|
||||
private VertexBuffer geobuffer;
|
||||
private bool updategeo;
|
||||
|
||||
//mxd. Rendering
|
||||
protected float fogdistance; // Distance, at which fog color completely replaces texture color of this thing
|
||||
|
||||
// Original sector
|
||||
private Sector sector;
|
||||
|
@ -60,7 +55,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
internal List<VisualGeometry> AllGeometry { get { return allgeometry; } }
|
||||
internal VertexBuffer GeometryBuffer { get { return geobuffer; } }
|
||||
internal bool NeedsUpdateGeo { get { return updategeo; } set { updategeo |= value; } }
|
||||
public float FogDistance { get { return fogdistance; } } //mxd
|
||||
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
public Sector Sector { get { return sector; } }
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
#region ================== Constants
|
||||
|
||||
protected const int FIXED_RADIUS = 8; //mxd. Used to render things with zero width and radius
|
||||
internal const float LIT_FOG_DENSITY_SCALER = 255 * VisualGeometry.FOG_DENSITY_SCALER; //mxd
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -54,17 +55,18 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Geometry
|
||||
private WorldVertex[] vertices;
|
||||
private VertexBuffer geobuffer;
|
||||
private VertexBuffer cagebuffer; //mxd
|
||||
private int cagelength; //mxd
|
||||
private bool updategeo;
|
||||
private int triangles;
|
||||
|
||||
// Rendering
|
||||
private RenderPass renderpass;
|
||||
private Matrix position;
|
||||
private Matrix cagescales;
|
||||
private int cameradistance;
|
||||
private Color4 cagecolor;
|
||||
protected bool sizeless; //mxd. Used to render visual things with 0 width and height
|
||||
protected float fogdistance; //mxd. Distance, at which fog color completely replaces texture color of this thing
|
||||
protected float fogfactor; //mxd
|
||||
|
||||
// Selected?
|
||||
protected bool selected;
|
||||
|
@ -73,7 +75,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
private bool isdisposed;
|
||||
|
||||
//mxd
|
||||
private int thingheight;
|
||||
protected float thingheight;
|
||||
|
||||
//mxd. light properties
|
||||
private DynamicLightType lightType;
|
||||
|
@ -96,18 +98,18 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
#region ================== Properties
|
||||
|
||||
internal VertexBuffer GeometryBuffer { get { return geobuffer; } }
|
||||
internal VertexBuffer CageBuffer { get { return cagebuffer; } } //mxd
|
||||
internal int CageLength { get { return cagelength; } } //mxd
|
||||
internal bool NeedsUpdateGeo { get { return updategeo; } }
|
||||
internal int Triangles { get { return triangles; } }
|
||||
internal Matrix Position { get { return position; } }
|
||||
internal Matrix CageScales { get { return cagescales; } }
|
||||
internal Color4 CageColor { get { return cagecolor; } }
|
||||
public ThingTypeInfo Info { get { return info; } } //mxd
|
||||
|
||||
//mxd
|
||||
internal int VertexColor { get { return vertices.Length > 0 ? vertices[0].c : 0;} }
|
||||
public int CameraDistance { get { return cameradistance; } }
|
||||
public bool Sizeless { get { return sizeless; } }
|
||||
public float FogDistance { get { return fogdistance; } }
|
||||
public float FogFactor { get { return fogfactor; } }
|
||||
public Vector3 Center
|
||||
{
|
||||
get
|
||||
|
@ -163,7 +165,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
this.thing = t;
|
||||
this.renderpass = RenderPass.Mask;
|
||||
this.position = Matrix.Identity;
|
||||
this.cagescales = Matrix.Identity;
|
||||
|
||||
//mxd
|
||||
lightType = DynamicLightType.NONE;
|
||||
|
@ -187,6 +188,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Clean up
|
||||
if(geobuffer != null) geobuffer.Dispose();
|
||||
geobuffer = null;
|
||||
if(cagebuffer != null) cagebuffer.Dispose(); //mxd
|
||||
cagebuffer = null; //mxd
|
||||
|
||||
// Unregister resource
|
||||
General.Map.Graphics.UnregisterResource(this);
|
||||
|
@ -223,15 +226,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the size of the cage around the thing geometry.
|
||||
/// </summary>
|
||||
protected void SetCageSize(float radius, float height)
|
||||
{
|
||||
cagescales = Matrix.Scaling(radius, radius, height);
|
||||
thingheight = (int)height; //mxd
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the color of the cage around the thing geometry.
|
||||
/// </summary>
|
||||
|
@ -389,14 +383,14 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
public virtual void Update()
|
||||
{
|
||||
// Do we need to update the geometry buffer?
|
||||
if (updategeo)
|
||||
if(updategeo)
|
||||
{
|
||||
// Trash geometry buffer
|
||||
if (geobuffer != null) geobuffer.Dispose();
|
||||
geobuffer = null;
|
||||
|
||||
// Any vertics?
|
||||
if (vertices.Length > 0)
|
||||
if(vertices.Length > 0)
|
||||
{
|
||||
// Make a new buffer
|
||||
geobuffer = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * vertices.Length,
|
||||
|
@ -409,6 +403,80 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
bufferstream.Dispose();
|
||||
}
|
||||
|
||||
// Trash cage buffer
|
||||
if(cagebuffer != null) cagebuffer.Dispose();
|
||||
cagebuffer = null;
|
||||
|
||||
// Make a new cage
|
||||
List<WorldVertex> cageverts;
|
||||
if(sizeless)
|
||||
{
|
||||
WorldVertex v0 = new WorldVertex(-info.Radius + position_v3.X, -info.Radius + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v1 = new WorldVertex( info.Radius + position_v3.X, info.Radius + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v2 = new WorldVertex( info.Radius + position_v3.X, -info.Radius + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v3 = new WorldVertex(-info.Radius + position_v3.X, info.Radius + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v4 = new WorldVertex(position_v3.X, position_v3.Y, info.Radius + position_v3.Z);
|
||||
WorldVertex v5 = new WorldVertex(position_v3.X, position_v3.Y, -info.Radius + position_v3.Z);
|
||||
|
||||
cageverts = new List<WorldVertex>(new[] { v0, v1, v2, v3, v4, v5 });
|
||||
}
|
||||
else
|
||||
{
|
||||
float top = position_v3.Z + info.Height;
|
||||
float bottom = position_v3.Z;
|
||||
|
||||
WorldVertex v0 = new WorldVertex(-info.Radius + position_v3.X, -info.Radius + position_v3.Y, bottom);
|
||||
WorldVertex v1 = new WorldVertex(-info.Radius + position_v3.X, info.Radius + position_v3.Y, bottom);
|
||||
WorldVertex v2 = new WorldVertex( info.Radius + position_v3.X, info.Radius + position_v3.Y, bottom);
|
||||
WorldVertex v3 = new WorldVertex( info.Radius + position_v3.X, -info.Radius + position_v3.Y, bottom);
|
||||
|
||||
WorldVertex v4 = new WorldVertex(-info.Radius + position_v3.X, -info.Radius + position_v3.Y, top);
|
||||
WorldVertex v5 = new WorldVertex(-info.Radius + position_v3.X, info.Radius + position_v3.Y, top);
|
||||
WorldVertex v6 = new WorldVertex( info.Radius + position_v3.X, info.Radius + position_v3.Y, top);
|
||||
WorldVertex v7 = new WorldVertex( info.Radius + position_v3.X, -info.Radius + position_v3.Y, top);
|
||||
|
||||
cageverts = new List<WorldVertex>(new[] { v0, v1,
|
||||
v1, v2,
|
||||
v2, v3,
|
||||
v3, v0,
|
||||
v4, v5,
|
||||
v5, v6,
|
||||
v6, v7,
|
||||
v7, v4,
|
||||
v0, v4,
|
||||
v1, v5,
|
||||
v2, v6,
|
||||
v3, v7 });
|
||||
}
|
||||
|
||||
// Make new arrow
|
||||
if(Thing.IsDirectional)
|
||||
{
|
||||
Matrix transform = Matrix.Scaling(info.Radius, info.Radius, info.Radius)
|
||||
* (Matrix.RotationY(-Thing.RollRad) * Matrix.RotationX(-Thing.PitchRad) * Matrix.RotationZ(Thing.Angle))
|
||||
* (sizeless ? position : position * Matrix.Translation(0.0f, 0.0f, thingheight / 2f));
|
||||
|
||||
WorldVertex a0 = new WorldVertex(Vector3D.Transform( 0.0f, 0.0f, 0.0f, transform)); //start
|
||||
WorldVertex a1 = new WorldVertex(Vector3D.Transform( 0.0f, -1.5f, 0.0f, transform)); //end
|
||||
WorldVertex a2 = new WorldVertex(Vector3D.Transform( 0.2f, -1.1f, 0.2f, transform));
|
||||
WorldVertex a3 = new WorldVertex(Vector3D.Transform(-0.2f, -1.1f, 0.2f, transform));
|
||||
WorldVertex a4 = new WorldVertex(Vector3D.Transform( 0.2f, -1.1f, -0.2f, transform));
|
||||
WorldVertex a5 = new WorldVertex(Vector3D.Transform(-0.2f, -1.1f, -0.2f, transform));
|
||||
|
||||
cageverts.AddRange(new[] {a0, a1,
|
||||
a1, a2,
|
||||
a1, a3,
|
||||
a1, a4,
|
||||
a1, a5});
|
||||
}
|
||||
|
||||
// Create buffer
|
||||
WorldVertex[] cv = cageverts.ToArray();
|
||||
cagelength = cv.Length / 2;
|
||||
cagebuffer = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * cv.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
|
||||
cagebuffer.Lock(0, WorldVertex.Stride * cv.Length, LockFlags.None).WriteRange(cv);
|
||||
cagebuffer.Unlock();
|
||||
|
||||
//mxd. Check if thing is light
|
||||
CheckLightState();
|
||||
|
||||
|
|
|
@ -66,12 +66,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
this.ceilingVertex = ceilingVertex;
|
||||
}
|
||||
|
||||
// This sets the distance from the camera
|
||||
internal void CalculateCameraDistance(Vector2D campos)
|
||||
{
|
||||
cameradistance = Vector2D.DistanceSq(vertex.Position, campos);
|
||||
}
|
||||
|
||||
public void SetPosition(Vector3D pos)
|
||||
{
|
||||
position = Matrix.Translation(pos.x, pos.y, pos.z);
|
||||
|
|
48
Source/Core/Windows/LinedefEditFormUDMF.Designer.cs
generated
48
Source/Core/Windows/LinedefEditFormUDMF.Designer.cs
generated
|
@ -56,6 +56,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.activationGroup = new System.Windows.Forms.GroupBox();
|
||||
this.missingactivation = new System.Windows.Forms.PictureBox();
|
||||
this.idgroup = new System.Windows.Forms.GroupBox();
|
||||
this.tagsselector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector();
|
||||
this.tabfront = new System.Windows.Forms.TabPage();
|
||||
this.frontside = new System.Windows.Forms.CheckBox();
|
||||
this.frontgroup = new System.Windows.Forms.GroupBox();
|
||||
|
@ -78,6 +79,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.pfcFrontOffsetMid = new CodeImp.DoomBuilder.GZBuilder.Controls.PairedFieldsControl();
|
||||
this.pfcFrontOffsetBottom = new CodeImp.DoomBuilder.GZBuilder.Controls.PairedFieldsControl();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.resetfrontlight = new System.Windows.Forms.Button();
|
||||
this.frontsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.customfrontbutton = new System.Windows.Forms.Button();
|
||||
this.lightFront = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
|
@ -89,6 +91,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.backside = new System.Windows.Forms.CheckBox();
|
||||
this.backgroup = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.resetbacklight = new System.Windows.Forms.Button();
|
||||
this.backsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.custombackbutton = new System.Windows.Forms.Button();
|
||||
this.lightBack = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
|
@ -121,7 +124,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
|
||||
this.imagelist = new System.Windows.Forms.ImageList(this.components);
|
||||
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.tagsselector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector();
|
||||
label2 = new System.Windows.Forms.Label();
|
||||
label11 = new System.Windows.Forms.Label();
|
||||
label12 = new System.Windows.Forms.Label();
|
||||
|
@ -456,6 +458,13 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.idgroup.TabStop = false;
|
||||
this.idgroup.Text = " Identification ";
|
||||
//
|
||||
// tagsselector
|
||||
//
|
||||
this.tagsselector.Location = new System.Drawing.Point(6, 21);
|
||||
this.tagsselector.Name = "tagsselector";
|
||||
this.tagsselector.Size = new System.Drawing.Size(524, 60);
|
||||
this.tagsselector.TabIndex = 0;
|
||||
//
|
||||
// tabfront
|
||||
//
|
||||
this.tabfront.Controls.Add(this.frontside);
|
||||
|
@ -757,6 +766,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
// groupBox5
|
||||
//
|
||||
this.groupBox5.Controls.Add(this.resetfrontlight);
|
||||
this.groupBox5.Controls.Add(this.frontsector);
|
||||
this.groupBox5.Controls.Add(label11);
|
||||
this.groupBox5.Controls.Add(this.customfrontbutton);
|
||||
|
@ -769,6 +779,17 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.groupBox5.TabIndex = 42;
|
||||
this.groupBox5.TabStop = false;
|
||||
//
|
||||
// resetfrontlight
|
||||
//
|
||||
this.resetfrontlight.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset;
|
||||
this.resetfrontlight.Location = new System.Drawing.Point(233, 50);
|
||||
this.resetfrontlight.Name = "resetfrontlight";
|
||||
this.resetfrontlight.Size = new System.Drawing.Size(23, 23);
|
||||
this.resetfrontlight.TabIndex = 28;
|
||||
this.tooltip.SetToolTip(this.resetfrontlight, "Reset Front Brightness");
|
||||
this.resetfrontlight.UseVisualStyleBackColor = true;
|
||||
this.resetfrontlight.Click += new System.EventHandler(this.resetfrontlight_Click);
|
||||
//
|
||||
// frontsector
|
||||
//
|
||||
this.frontsector.AllowDecimal = false;
|
||||
|
@ -818,7 +839,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// cbLightAbsoluteFront
|
||||
//
|
||||
this.cbLightAbsoluteFront.AutoSize = true;
|
||||
this.cbLightAbsoluteFront.Location = new System.Drawing.Point(164, 53);
|
||||
this.cbLightAbsoluteFront.Location = new System.Drawing.Point(164, 54);
|
||||
this.cbLightAbsoluteFront.Name = "cbLightAbsoluteFront";
|
||||
this.cbLightAbsoluteFront.Size = new System.Drawing.Size(67, 17);
|
||||
this.cbLightAbsoluteFront.TabIndex = 27;
|
||||
|
@ -910,6 +931,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.resetbacklight);
|
||||
this.groupBox4.Controls.Add(this.backsector);
|
||||
this.groupBox4.Controls.Add(label12);
|
||||
this.groupBox4.Controls.Add(this.custombackbutton);
|
||||
|
@ -922,6 +944,17 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.groupBox4.TabIndex = 46;
|
||||
this.groupBox4.TabStop = false;
|
||||
//
|
||||
// resetbacklight
|
||||
//
|
||||
this.resetbacklight.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset;
|
||||
this.resetbacklight.Location = new System.Drawing.Point(233, 50);
|
||||
this.resetbacklight.Name = "resetbacklight";
|
||||
this.resetbacklight.Size = new System.Drawing.Size(23, 23);
|
||||
this.resetbacklight.TabIndex = 31;
|
||||
this.tooltip.SetToolTip(this.resetbacklight, "Reset Back Brightness");
|
||||
this.resetbacklight.UseVisualStyleBackColor = true;
|
||||
this.resetbacklight.Click += new System.EventHandler(this.resetbacklight_Click);
|
||||
//
|
||||
// backsector
|
||||
//
|
||||
this.backsector.AllowDecimal = false;
|
||||
|
@ -981,7 +1014,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// cbLightAbsoluteBack
|
||||
//
|
||||
this.cbLightAbsoluteBack.AutoSize = true;
|
||||
this.cbLightAbsoluteBack.Location = new System.Drawing.Point(164, 53);
|
||||
this.cbLightAbsoluteBack.Location = new System.Drawing.Point(164, 54);
|
||||
this.cbLightAbsoluteBack.Name = "cbLightAbsoluteBack";
|
||||
this.cbLightAbsoluteBack.Size = new System.Drawing.Size(67, 17);
|
||||
this.cbLightAbsoluteBack.TabIndex = 30;
|
||||
|
@ -1339,13 +1372,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.imagelist.Images.SetKeyName(0, "Check.png");
|
||||
this.imagelist.Images.SetKeyName(1, "SearchClear.png");
|
||||
//
|
||||
// tagsselector
|
||||
//
|
||||
this.tagsselector.Location = new System.Drawing.Point(6, 21);
|
||||
this.tagsselector.Name = "tagsselector";
|
||||
this.tagsselector.Size = new System.Drawing.Size(524, 60);
|
||||
this.tagsselector.TabIndex = 0;
|
||||
//
|
||||
// LinedefEditFormUDMF
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
|
@ -1489,5 +1515,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private CodeImp.DoomBuilder.Controls.CommentEditor commenteditor;
|
||||
private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol;
|
||||
private CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector tagsselector;
|
||||
private System.Windows.Forms.Button resetfrontlight;
|
||||
private System.Windows.Forms.Button resetbacklight;
|
||||
}
|
||||
}
|
|
@ -558,6 +558,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
tagsselector.FinishSetup(); //mxd
|
||||
commenteditor.FinishSetup(); //mxd
|
||||
|
||||
//mxd. Update brightness reset buttons
|
||||
resetfrontlight.Visible = (cbLightAbsoluteFront.CheckState != CheckState.Unchecked || lightFront.GetResult(0) != 0);
|
||||
resetbacklight.Visible = (cbLightAbsoluteBack.CheckState != CheckState.Unchecked || lightBack.GetResult(0) != 0);
|
||||
|
||||
//mxd. Update some labels
|
||||
if (frontside.CheckState != CheckState.Unchecked)
|
||||
{
|
||||
|
@ -1274,6 +1278,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetfrontlight.Visible = (cbLightAbsoluteFront.CheckState != CheckState.Unchecked || lightFront.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -1301,7 +1306,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(l.Back != null)
|
||||
{
|
||||
bool absolute = false;
|
||||
switch (cbLightAbsoluteBack.CheckState)
|
||||
switch(cbLightAbsoluteBack.CheckState)
|
||||
{
|
||||
case CheckState.Indeterminate:
|
||||
absolute = l.Back.Fields.GetValue("lightabsolute", false);
|
||||
|
@ -1318,6 +1323,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetbacklight.Visible = (cbLightAbsoluteBack.CheckState != CheckState.Unchecked || lightBack.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -1364,6 +1370,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetfrontlight.Visible = (cbLightAbsoluteFront.CheckState != CheckState.Unchecked || lightFront.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -1410,6 +1417,55 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetbacklight.Visible = (cbLightAbsoluteBack.CheckState != CheckState.Unchecked || lightBack.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void resetfrontlight_Click(object sender, EventArgs e)
|
||||
{
|
||||
MakeUndo(); //mxd
|
||||
|
||||
preventchanges = true;
|
||||
|
||||
cbLightAbsoluteFront.Checked = false;
|
||||
lightFront.Text = "0";
|
||||
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
if(l.Front == null) continue;
|
||||
if(l.Front.Fields.ContainsKey("lightabsolute")) l.Front.Fields.Remove("lightabsolute");
|
||||
if(l.Front.Fields.ContainsKey("light")) l.Front.Fields.Remove("light");
|
||||
}
|
||||
|
||||
preventchanges = false;
|
||||
|
||||
resetfrontlight.Visible = false;
|
||||
lightFront.Focus();
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void resetbacklight_Click(object sender, EventArgs e)
|
||||
{
|
||||
MakeUndo(); //mxd
|
||||
|
||||
preventchanges = true;
|
||||
|
||||
cbLightAbsoluteBack.Checked = false;
|
||||
lightBack.Text = "0";
|
||||
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
if(l.Back == null) continue;
|
||||
if(l.Back.Fields.ContainsKey("lightabsolute")) l.Back.Fields.Remove("lightabsolute");
|
||||
if(l.Back.Fields.ContainsKey("light")) l.Back.Fields.Remove("light");
|
||||
}
|
||||
|
||||
preventchanges = false;
|
||||
|
||||
resetbacklight.Visible = false;
|
||||
lightBack.Focus();
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
|
56
Source/Core/Windows/SectorEditFormUDMF.Designer.cs
generated
56
Source/Core/Windows/SectorEditFormUDMF.Designer.cs
generated
|
@ -40,6 +40,7 @@
|
|||
System.Windows.Forms.Label label15;
|
||||
System.Windows.Forms.Label label6;
|
||||
System.Windows.Forms.Label label5;
|
||||
this.tagsselector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector();
|
||||
this.soundsequence = new System.Windows.Forms.ComboBox();
|
||||
this.resetsoundsequence = new System.Windows.Forms.Button();
|
||||
this.fadeColor = new CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl();
|
||||
|
@ -60,6 +61,7 @@
|
|||
this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
|
||||
this.tabSurfaces = new System.Windows.Forms.TabPage();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.resetfloorlight = new System.Windows.Forms.Button();
|
||||
this.labelFloorOffsets = new System.Windows.Forms.Label();
|
||||
this.labelFloorScale = new System.Windows.Forms.Label();
|
||||
this.cbUseFloorLineAngles = new System.Windows.Forms.CheckBox();
|
||||
|
@ -77,6 +79,7 @@
|
|||
this.floorOffsets = new CodeImp.DoomBuilder.GZBuilder.Controls.PairedFieldsControl();
|
||||
this.floortex = new CodeImp.DoomBuilder.Controls.FlatSelectorControl();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.resetceillight = new System.Windows.Forms.Button();
|
||||
this.labelCeilOffsets = new System.Windows.Forms.Label();
|
||||
this.labelCeilScale = new System.Windows.Forms.Label();
|
||||
this.cbUseCeilLineAngles = new System.Windows.Forms.CheckBox();
|
||||
|
@ -105,7 +108,6 @@
|
|||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.tagsselector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector();
|
||||
groupaction = new System.Windows.Forms.GroupBox();
|
||||
groupeffect = new System.Windows.Forms.GroupBox();
|
||||
label14 = new System.Windows.Forms.Label();
|
||||
|
@ -145,6 +147,13 @@
|
|||
groupaction.TabStop = false;
|
||||
groupaction.Text = " Identification ";
|
||||
//
|
||||
// tagsselector
|
||||
//
|
||||
this.tagsselector.Location = new System.Drawing.Point(6, 21);
|
||||
this.tagsselector.Name = "tagsselector";
|
||||
this.tagsselector.Size = new System.Drawing.Size(478, 60);
|
||||
this.tagsselector.TabIndex = 0;
|
||||
//
|
||||
// groupeffect
|
||||
//
|
||||
groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
|
@ -526,6 +535,7 @@
|
|||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.resetfloorlight);
|
||||
this.groupBox2.Controls.Add(this.labelFloorOffsets);
|
||||
this.groupBox2.Controls.Add(this.labelFloorScale);
|
||||
this.groupBox2.Controls.Add(this.cbUseFloorLineAngles);
|
||||
|
@ -549,6 +559,17 @@
|
|||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = " Floor ";
|
||||
//
|
||||
// resetfloorlight
|
||||
//
|
||||
this.resetfloorlight.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset;
|
||||
this.resetfloorlight.Location = new System.Drawing.Point(246, 114);
|
||||
this.resetfloorlight.Name = "resetfloorlight";
|
||||
this.resetfloorlight.Size = new System.Drawing.Size(23, 23);
|
||||
this.resetfloorlight.TabIndex = 60;
|
||||
this.tooltip.SetToolTip(this.resetfloorlight, "Reset Floor Brightness");
|
||||
this.resetfloorlight.UseVisualStyleBackColor = true;
|
||||
this.resetfloorlight.Click += new System.EventHandler(this.resetfloorlight_Click);
|
||||
//
|
||||
// labelFloorOffsets
|
||||
//
|
||||
this.labelFloorOffsets.Location = new System.Drawing.Point(6, 27);
|
||||
|
@ -572,7 +593,7 @@
|
|||
// cbUseFloorLineAngles
|
||||
//
|
||||
this.cbUseFloorLineAngles.AutoSize = true;
|
||||
this.cbUseFloorLineAngles.Location = new System.Drawing.Point(181, 147);
|
||||
this.cbUseFloorLineAngles.Location = new System.Drawing.Point(181, 148);
|
||||
this.cbUseFloorLineAngles.Name = "cbUseFloorLineAngles";
|
||||
this.cbUseFloorLineAngles.Size = new System.Drawing.Size(113, 17);
|
||||
this.cbUseFloorLineAngles.TabIndex = 57;
|
||||
|
@ -583,7 +604,7 @@
|
|||
//
|
||||
// floorAngleControl
|
||||
//
|
||||
this.floorAngleControl.Angle = -270;
|
||||
this.floorAngleControl.Angle = -450;
|
||||
this.floorAngleControl.AngleOffset = 90;
|
||||
this.floorAngleControl.Location = new System.Drawing.Point(6, 132);
|
||||
this.floorAngleControl.Name = "floorAngleControl";
|
||||
|
@ -661,7 +682,7 @@
|
|||
// floorLightAbsolute
|
||||
//
|
||||
this.floorLightAbsolute.AutoSize = true;
|
||||
this.floorLightAbsolute.Location = new System.Drawing.Point(181, 117);
|
||||
this.floorLightAbsolute.Location = new System.Drawing.Point(181, 118);
|
||||
this.floorLightAbsolute.Name = "floorLightAbsolute";
|
||||
this.floorLightAbsolute.Size = new System.Drawing.Size(67, 17);
|
||||
this.floorLightAbsolute.TabIndex = 49;
|
||||
|
@ -760,6 +781,7 @@
|
|||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.resetceillight);
|
||||
this.groupBox1.Controls.Add(this.labelCeilOffsets);
|
||||
this.groupBox1.Controls.Add(this.labelCeilScale);
|
||||
this.groupBox1.Controls.Add(this.cbUseCeilLineAngles);
|
||||
|
@ -783,6 +805,17 @@
|
|||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = " Ceiling ";
|
||||
//
|
||||
// resetceillight
|
||||
//
|
||||
this.resetceillight.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset;
|
||||
this.resetceillight.Location = new System.Drawing.Point(246, 114);
|
||||
this.resetceillight.Name = "resetceillight";
|
||||
this.resetceillight.Size = new System.Drawing.Size(23, 23);
|
||||
this.resetceillight.TabIndex = 62;
|
||||
this.tooltip.SetToolTip(this.resetceillight, "Reset Ceiling Brightness");
|
||||
this.resetceillight.UseVisualStyleBackColor = true;
|
||||
this.resetceillight.Click += new System.EventHandler(this.resetceillight_Click);
|
||||
//
|
||||
// labelCeilOffsets
|
||||
//
|
||||
this.labelCeilOffsets.Location = new System.Drawing.Point(6, 27);
|
||||
|
@ -806,7 +839,7 @@
|
|||
// cbUseCeilLineAngles
|
||||
//
|
||||
this.cbUseCeilLineAngles.AutoSize = true;
|
||||
this.cbUseCeilLineAngles.Location = new System.Drawing.Point(181, 147);
|
||||
this.cbUseCeilLineAngles.Location = new System.Drawing.Point(181, 148);
|
||||
this.cbUseCeilLineAngles.Name = "cbUseCeilLineAngles";
|
||||
this.cbUseCeilLineAngles.Size = new System.Drawing.Size(113, 17);
|
||||
this.cbUseCeilLineAngles.TabIndex = 56;
|
||||
|
@ -817,7 +850,7 @@
|
|||
//
|
||||
// ceilAngleControl
|
||||
//
|
||||
this.ceilAngleControl.Angle = -270;
|
||||
this.ceilAngleControl.Angle = -450;
|
||||
this.ceilAngleControl.AngleOffset = 90;
|
||||
this.ceilAngleControl.Location = new System.Drawing.Point(6, 132);
|
||||
this.ceilAngleControl.Name = "ceilAngleControl";
|
||||
|
@ -895,7 +928,7 @@
|
|||
// ceilLightAbsolute
|
||||
//
|
||||
this.ceilLightAbsolute.AutoSize = true;
|
||||
this.ceilLightAbsolute.Location = new System.Drawing.Point(181, 117);
|
||||
this.ceilLightAbsolute.Location = new System.Drawing.Point(181, 118);
|
||||
this.ceilLightAbsolute.Name = "ceilLightAbsolute";
|
||||
this.ceilLightAbsolute.Size = new System.Drawing.Size(67, 17);
|
||||
this.ceilLightAbsolute.TabIndex = 49;
|
||||
|
@ -1127,13 +1160,6 @@
|
|||
this.tooltip.InitialDelay = 10;
|
||||
this.tooltip.ReshowDelay = 100;
|
||||
//
|
||||
// tagsselector
|
||||
//
|
||||
this.tagsselector.Location = new System.Drawing.Point(6, 21);
|
||||
this.tagsselector.Name = "tagsselector";
|
||||
this.tagsselector.Size = new System.Drawing.Size(478, 60);
|
||||
this.tagsselector.TabIndex = 0;
|
||||
//
|
||||
// SectorEditFormUDMF
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
|
@ -1245,5 +1271,7 @@
|
|||
private System.Windows.Forms.TabPage tabcomment;
|
||||
private CodeImp.DoomBuilder.Controls.CommentEditor commenteditor;
|
||||
private CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector tagsselector;
|
||||
private System.Windows.Forms.Button resetfloorlight;
|
||||
private System.Windows.Forms.Button resetceillight;
|
||||
}
|
||||
}
|
|
@ -464,6 +464,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
labelFloorOffsets.Enabled = floorOffsets.NonDefaultValue;
|
||||
labelFloorScale.Enabled = floorScale.NonDefaultValue;
|
||||
|
||||
//mxd. Update brightness reset buttons
|
||||
resetceillight.Visible = (ceilLightAbsolute.CheckState != CheckState.Unchecked || ceilBrightness.GetResult(0) != 0);
|
||||
resetfloorlight.Visible = (floorLightAbsolute.CheckState != CheckState.Unchecked || floorBrightness.GetResult(0) != 0);
|
||||
|
||||
//mxd. Angle steps
|
||||
anglesteps.Sort();
|
||||
if(useCeilLineAngles) ceilRotation.StepValues = anglesteps;
|
||||
|
@ -1134,6 +1138,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetceillight.Visible = (ceilLightAbsolute.CheckState != CheckState.Unchecked || ceilBrightness.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -1173,6 +1178,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetfloorlight.Visible = (floorLightAbsolute.CheckState != CheckState.Unchecked || floorBrightness.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -1218,6 +1224,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetceillight.Visible = (ceilLightAbsolute.CheckState != CheckState.Unchecked || ceilBrightness.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -1263,10 +1270,57 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
resetfloorlight.Visible = (floorLightAbsolute.CheckState != CheckState.Unchecked || floorBrightness.Text != "0");
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void resetceillight_Click(object sender, EventArgs e)
|
||||
{
|
||||
MakeUndo(); //mxd
|
||||
|
||||
preventchanges = true;
|
||||
|
||||
ceilLightAbsolute.Checked = false;
|
||||
ceilBrightness.Text = "0";
|
||||
|
||||
foreach(Sector s in sectors)
|
||||
{
|
||||
if(s.Fields.ContainsKey("lightceilingabsolute")) s.Fields.Remove("lightceilingabsolute");
|
||||
if(s.Fields.ContainsKey("lightceiling")) s.Fields.Remove("lightceiling");
|
||||
}
|
||||
|
||||
preventchanges = false;
|
||||
|
||||
resetceillight.Visible = false;
|
||||
ceilBrightness.Focus();
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void resetfloorlight_Click(object sender, EventArgs e)
|
||||
{
|
||||
MakeUndo(); //mxd
|
||||
|
||||
preventchanges = true;
|
||||
|
||||
floorLightAbsolute.Checked = false;
|
||||
floorBrightness.Text = "0";
|
||||
|
||||
foreach(Sector s in sectors)
|
||||
{
|
||||
if(s.Fields.ContainsKey("lightfloorabsolute")) s.Fields.Remove("lightfloorabsolute");
|
||||
if(s.Fields.ContainsKey("lightfloor")) s.Fields.Remove("lightfloor");
|
||||
}
|
||||
|
||||
preventchanges = false;
|
||||
|
||||
resetfloorlight.Visible = false;
|
||||
floorBrightness.Focus();
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Slope Utility (mxd)
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -44,6 +44,15 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -23,6 +23,7 @@ using System.Windows.Forms;
|
|||
using CodeImp.DoomBuilder.Actions;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
|
@ -59,6 +60,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private bool editpressed;
|
||||
private bool thinginserted;
|
||||
private bool awaitingMouseClick; //mxd
|
||||
|
||||
//mxd. Event lines
|
||||
private List<Line3D> persistenteventlines;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -120,6 +124,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
|
||||
General.Map.Map.SelectionType = SelectionType.Things;
|
||||
UpdateSelectionInfo(); //mxd
|
||||
|
||||
//mxd. Update event lines
|
||||
persistenteventlines = LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, false);
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
|
@ -190,11 +197,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
if(General.Settings.GZShowEventLines)
|
||||
if(General.Settings.GZShowEventLines)
|
||||
{
|
||||
List<Line3D> lines = GZBuilder.Data.LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings);
|
||||
lines.AddRange(eventlines);
|
||||
if(lines.Count > 0) renderer.RenderArrows(lines);
|
||||
eventlines.AddRange(persistenteventlines);
|
||||
if(eventlines.Count > 0) renderer.RenderArrows(eventlines);
|
||||
}
|
||||
|
||||
renderer.Finish();
|
||||
|
@ -411,26 +417,50 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Interface.OnEditFormValuesChanged -= thingEditForm_OnValuesChanged;
|
||||
|
||||
// When a single thing was selected, deselect it now
|
||||
if (selected.Count == 1)
|
||||
if(selected.Count == 1)
|
||||
{
|
||||
General.Map.Map.ClearSelectedThings();
|
||||
}
|
||||
else if(result == DialogResult.Cancel) //mxd. Restore selection...
|
||||
{
|
||||
foreach (Thing t in selected) t.Selected = true;
|
||||
foreach(Thing t in selected) t.Selected = true;
|
||||
}
|
||||
|
||||
//mxd. Update event lines
|
||||
persistenteventlines = LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, false);
|
||||
|
||||
// Update display
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateSelectionInfo(); //mxd
|
||||
//mxd. Update selection info
|
||||
UpdateSelectionInfo();
|
||||
}
|
||||
|
||||
editpressed = false;
|
||||
base.OnEditEnd();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnUndoEnd()
|
||||
{
|
||||
base.OnUndoEnd();
|
||||
|
||||
// Update event lines
|
||||
persistenteventlines = LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, false);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnRedoEnd()
|
||||
{
|
||||
base.OnRedoEnd();
|
||||
|
||||
// Update event lines
|
||||
persistenteventlines = LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, false);
|
||||
}
|
||||
|
||||
//mxd. Otherwise event lines won't be drawn after panning finishes.
|
||||
protected override void EndViewPan()
|
||||
{
|
||||
|
@ -844,6 +874,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Update things filter
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
//mxd. Update event lines
|
||||
persistenteventlines = LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, false);
|
||||
|
||||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
@ -970,6 +1003,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.IsChanged = true;
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
//mxd. Update event lines
|
||||
persistenteventlines = LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, false);
|
||||
|
||||
// Invoke a new mousemove so that the highlighted item updates
|
||||
MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, (int)mousepos.x, (int)mousepos.y, 0);
|
||||
OnMouseMove(e);
|
||||
|
|
|
@ -106,7 +106,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public float scaleY; //mxd
|
||||
|
||||
private Sidedef controlside; //mxd
|
||||
public Sidedef controlSide { //mxd
|
||||
public Sidedef controlSide
|
||||
{
|
||||
get
|
||||
{
|
||||
return controlside;
|
||||
|
@ -519,6 +520,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices)
|
||||
pair.Value.Update();
|
||||
}
|
||||
|
||||
//mxd. Update event lines (still better than updating them on every frame redraw)
|
||||
renderer.SetEventLines(LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, true));
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -658,13 +662,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
List<string> results = new List<string>();
|
||||
if (numWalls > 0) results.Add(numWalls + (numWalls > 1 ? " sidedefs" : " sidedef"));
|
||||
if (numFloors > 0) results.Add(numFloors + (numFloors > 1 ? " floors" : " floor"));
|
||||
if (numCeilings > 0) results.Add(numCeilings + (numCeilings > 1 ? " ceilings" : " ceiling"));
|
||||
if (numThings > 0) results.Add(numThings + (numThings > 1 ? " things" : " thing"));
|
||||
if (numVerts > 0) results.Add(numVerts + (numVerts > 1 ? " vertices" : " vertex"));
|
||||
if(numWalls > 0) results.Add(numWalls + (numWalls > 1 ? " sidedefs" : " sidedef"));
|
||||
if(numFloors > 0) results.Add(numFloors + (numFloors > 1 ? " floors" : " floor"));
|
||||
if(numCeilings > 0) results.Add(numCeilings + (numCeilings > 1 ? " ceilings" : " ceiling"));
|
||||
if(numThings > 0) results.Add(numThings + (numThings > 1 ? " things" : " thing"));
|
||||
if(numVerts > 0) results.Add(numVerts + (numVerts > 1 ? " vertices" : " vertex"));
|
||||
|
||||
if (results.Count == 0)
|
||||
if(results.Count == 0)
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
|
||||
}
|
||||
|
@ -699,7 +703,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd
|
||||
internal void StopRealtimeInterfaceUpdate(SelectionType selectiontype)
|
||||
{
|
||||
switch (selectiontype)
|
||||
switch(selectiontype)
|
||||
{
|
||||
case SelectionType.All:
|
||||
case SelectionType.Linedefs:
|
||||
|
@ -1060,7 +1064,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
cameraflooroffset = General.Map.Config.ReadSetting("cameraflooroffset", cameraflooroffset);
|
||||
cameraceilingoffset = General.Map.Config.ReadSetting("cameraceilingoffset", cameraceilingoffset);
|
||||
|
||||
// (Re)create special effects
|
||||
RebuildElementData();
|
||||
|
||||
//mxd. Update event lines
|
||||
renderer.SetEventLines(LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, true));
|
||||
}
|
||||
|
||||
// When returning to another mode
|
||||
|
@ -1248,7 +1256,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices)
|
||||
verts.AddRange(pair.Value.Vertices);
|
||||
|
||||
renderer.AddVisualVertices(verts.ToArray());
|
||||
renderer.SetVisualVertices(verts);
|
||||
}
|
||||
|
||||
// Done rendering geometry
|
||||
|
@ -1424,7 +1432,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. As well as geometry...
|
||||
foreach(KeyValuePair<Sector, VisualSector> group in visiblesectors)
|
||||
{
|
||||
if (group.Value is BaseVisualSector)
|
||||
if(group.Value is BaseVisualSector)
|
||||
(group.Value as BaseVisualSector).Rebuild();
|
||||
}
|
||||
|
||||
|
@ -1444,9 +1452,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
RebuildElementData();
|
||||
|
||||
//mxd. As well as geometry...
|
||||
foreach (KeyValuePair<Sector, VisualSector> group in visiblesectors)
|
||||
foreach(KeyValuePair<Sector, VisualSector> group in visiblesectors)
|
||||
{
|
||||
if (group.Value is BaseVisualSector) (group.Value as BaseVisualSector).Rebuild();
|
||||
if(group.Value is BaseVisualSector) (group.Value as BaseVisualSector).Rebuild();
|
||||
}
|
||||
|
||||
RebuildSelectedObjectsList();
|
||||
|
@ -3117,6 +3125,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
General.Map.IsChanged = true;
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Update event lines
|
||||
renderer.SetEventLines(LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, true));
|
||||
}
|
||||
|
||||
//mxd. We'll just use currently selected objects
|
||||
|
@ -3152,7 +3163,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Vector3D[] translatedCoords = TranslateCoordinates(coords, hitpos, true);
|
||||
|
||||
//create things from copyBuffer
|
||||
for (int i = 0; i < copybuffer.Count; i++)
|
||||
for(int i = 0; i < copybuffer.Count; i++)
|
||||
{
|
||||
Thing t = CreateThing(new Vector2D());
|
||||
if (t != null)
|
||||
|
@ -3163,6 +3174,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
blockmap.AddThing(t);
|
||||
}
|
||||
}
|
||||
|
||||
General.Map.IsChanged = true;
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
PostAction();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,21 +35,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
protected BaseVisualMode mode;
|
||||
|
||||
protected VisualFloor floor;
|
||||
protected VisualCeiling ceiling;
|
||||
protected List<VisualFloor> extrafloors;
|
||||
protected List<VisualCeiling> extraceilings;
|
||||
protected List<VisualFloor> extrabackfloors; //mxd
|
||||
protected List<VisualCeiling> extrabackceilings; //mxd
|
||||
protected Dictionary<Sidedef, VisualSidedefParts> sides;
|
||||
private BaseVisualMode mode;
|
||||
|
||||
private VisualFloor floor;
|
||||
private VisualCeiling ceiling;
|
||||
private List<VisualFloor> extrafloors;
|
||||
private List<VisualCeiling> extraceilings;
|
||||
private List<VisualFloor> extrabackfloors; //mxd
|
||||
private List<VisualCeiling> extrabackceilings; //mxd
|
||||
private Dictionary<Sidedef, VisualSidedefParts> sides;
|
||||
|
||||
// If this is set to true, the sector will be rebuilt after the action is performed.
|
||||
protected bool changed;
|
||||
private bool changed;
|
||||
|
||||
// Prevent recursion
|
||||
protected bool isupdating;
|
||||
private bool isupdating;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -205,30 +205,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(!data.Updated) data.Update();
|
||||
|
||||
// Create floor
|
||||
floor = floor ?? new VisualFloor(mode, this);
|
||||
if(floor.Setup(data.Floor, null))
|
||||
base.AddGeometry(floor);
|
||||
floor = (floor ?? new VisualFloor(mode, this));
|
||||
if(floor.Setup(data.Floor, null)) AddGeometry(floor);
|
||||
|
||||
// Create ceiling
|
||||
ceiling = ceiling ?? new VisualCeiling(mode, this);
|
||||
if(ceiling.Setup(data.Ceiling, null))
|
||||
base.AddGeometry(ceiling);
|
||||
|
||||
//mxd. Calculate fogdistance
|
||||
float brightness = Math.Max(30, Sector.Brightness);
|
||||
if(Sector.HasFogColor)
|
||||
{
|
||||
if(Sector.UsesOutsideFog && General.Map.Data.MapInfo.OutsideFogDensity > 0)
|
||||
fogdistance = General.Map.Data.MapInfo.OutsideFogDensity;
|
||||
else if(!Sector.UsesOutsideFog && General.Map.Data.MapInfo.FogDensity > 0)
|
||||
fogdistance = General.Map.Data.MapInfo.FogDensity;
|
||||
else
|
||||
fogdistance = brightness * 11.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fogdistance = MAXIMUM_FOG_DISTANCE;
|
||||
}
|
||||
ceiling = (ceiling ?? new VisualCeiling(mode, this));
|
||||
if(ceiling.Setup(data.Ceiling, null)) AddGeometry(ceiling);
|
||||
|
||||
// Create 3D floors
|
||||
for(int i = 0; i < data.ExtraFloors.Count; i++)
|
||||
|
|
|
@ -20,12 +20,10 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
|
||||
#endregion
|
||||
|
@ -165,11 +163,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(alpha == 255) RenderPass = RenderPass.Mask;
|
||||
|
||||
int sectorcolor = new PixelColor(alpha, 255, 255, 255).ToInt();
|
||||
fogdistance = VisualSector.MAXIMUM_FOG_DISTANCE; //mxd
|
||||
fogfactor = 0f; //mxd
|
||||
|
||||
//mxd. Check thing size
|
||||
float thingradius = Thing.Size; // Thing.Size has ThingRadius arg override applied
|
||||
float thingheight = Thing.Height; // Thing.Height has ThingHeight arg override applied
|
||||
thingheight = Thing.Height; // Thing.Height has ThingHeight arg override applied
|
||||
|
||||
if(thingradius < 0.1f || thingheight < 0.1f)
|
||||
{
|
||||
|
@ -197,7 +195,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
if(!info.Bright)
|
||||
{
|
||||
SectorLevel level = sd.GetLevelAboveOrAt(new Vector3D(Thing.Position.x, Thing.Position.y, Thing.Position.z + sd.Floor.plane.GetZ(Thing.Position)));
|
||||
Vector3D thingpos = new Vector3D(Thing.Position.x, Thing.Position.y, Thing.Position.z + sd.Floor.plane.GetZ(Thing.Position));
|
||||
SectorLevel level = sd.GetLevelAboveOrAt(thingpos);
|
||||
|
||||
//mxd. Let's use point on floor plane instead of Thing.Sector.FloorHeight;
|
||||
if(nointeraction && level == null && sd.LightLevels.Count > 0) level = sd.LightLevels[sd.LightLevels.Count - 1];
|
||||
|
@ -205,36 +204,78 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Use the light level of the highest surface when a thing is above highest sector level.
|
||||
if(level != null)
|
||||
{
|
||||
// TECH: In GZDoom, ceiling glow doesn't affect thing brightness
|
||||
// Use sector brightness for color shading
|
||||
PixelColor areabrightness = PixelColor.FromInt(mode.CalculateBrightness(level.brightnessbelow));
|
||||
int brightness = level.brightnessbelow;
|
||||
|
||||
// Level is glowing
|
||||
if(level.affectedbyglow && level.type == SectorLevelType.Floor)
|
||||
{
|
||||
// Get glow brightness
|
||||
SectorData glowdata = (level.sector != Thing.Sector ? mode.GetSectorData(level.sector) : sd);
|
||||
float planez = level.plane.GetZ(thingpos);
|
||||
|
||||
int glowbrightness = glowdata.FloorGlow.Brightness / 2;
|
||||
SectorLevel nexthigher = sd.GetLevelAbove(new Vector3D(thingpos, planez));
|
||||
|
||||
// Interpolate thing brightness between glow and regular ones
|
||||
if(nexthigher != null)
|
||||
{
|
||||
float higherz = nexthigher.plane.GetZ(thingpos);
|
||||
float delta = General.Clamp(1.0f - (thingpos.z - planez) / (higherz - planez), 0f, 1f);
|
||||
brightness = (int)((glowbrightness + level.sector.Brightness / 2) * delta + nexthigher.sector.Brightness * (1.0f - delta));
|
||||
}
|
||||
}
|
||||
// Level below this one is glowing. Only possible for floor glow(?)
|
||||
else if(level.type == SectorLevelType.Glow)
|
||||
{
|
||||
// Interpolate thing brightness between glow and regular ones
|
||||
float planez = level.plane.GetZ(thingpos);
|
||||
SectorLevel nextlower = sd.GetLevelBelow(new Vector3D(thingpos, planez));
|
||||
|
||||
if(nextlower != null && nextlower.affectedbyglow)
|
||||
{
|
||||
// Get glow brightness
|
||||
SectorData glowdata = (nextlower.sector != Thing.Sector ? mode.GetSectorData(nextlower.sector) : sd);
|
||||
int glowbrightness = (level.type == SectorLevelType.Ceiling ? glowdata.CeilingGlow.Brightness : glowdata.FloorGlow.Brightness) / 2;
|
||||
|
||||
float lowerz = nextlower.plane.GetZ(thingpos);
|
||||
float delta = General.Clamp((thingpos.z - lowerz) / (planez - lowerz), 0f, 1f);
|
||||
brightness = (int)((glowbrightness + nextlower.sector.Brightness / 2) * (1.0f - delta) + level.sector.Brightness * delta);
|
||||
}
|
||||
}
|
||||
|
||||
PixelColor areabrightness = PixelColor.FromInt(mode.CalculateBrightness(brightness));
|
||||
PixelColor areacolor = PixelColor.Modulate(level.colorbelow, areabrightness);
|
||||
sectorcolor = areacolor.WithAlpha(alpha).ToInt();
|
||||
int brightness = Math.Max((byte) 30, areabrightness.r); // R, G and B of areabrightness are the same
|
||||
|
||||
//mxd. Calculate fogdistance
|
||||
if(Thing.Sector.HasFogColor)
|
||||
//mxd. Calculate fogfactor
|
||||
float density;
|
||||
if(Thing.Sector.UsesOutsideFog && General.Map.Data.MapInfo.OutsideFogDensity > 0)
|
||||
{
|
||||
if(Thing.Sector.UsesOutsideFog && General.Map.Data.MapInfo.OutsideFogDensity > 0) fogdistance = General.Map.Data.MapInfo.OutsideFogDensity;
|
||||
else if(!Thing.Sector.UsesOutsideFog && General.Map.Data.MapInfo.FogDensity > 0) fogdistance = General.Map.Data.MapInfo.FogDensity;
|
||||
else fogdistance = brightness * 11.0f;
|
||||
density = General.Map.Data.MapInfo.OutsideFogDensity;
|
||||
}
|
||||
// Thing is affected by floor glow
|
||||
else if(level.affectedbyglow)
|
||||
else if(!Thing.Sector.UsesOutsideFog && General.Map.Data.MapInfo.FogDensity > 0)
|
||||
{
|
||||
fogdistance = (float) Math.Pow(2.0f, brightness / 9.0f);
|
||||
density = General.Map.Data.MapInfo.FogDensity;
|
||||
}
|
||||
else if(brightness < 248)
|
||||
{
|
||||
density = General.Clamp(255 - brightness, 30, 255);
|
||||
}
|
||||
// Thing is not affected by floor glow
|
||||
else
|
||||
{
|
||||
fogdistance = (float) Math.Pow(2.0f, brightness / 9.0f) * 2.0f;
|
||||
density = 0f;
|
||||
}
|
||||
|
||||
if(level.sector.HasFogColor)
|
||||
{
|
||||
density *= 4;
|
||||
}
|
||||
|
||||
fogfactor = density * VisualGeometry.FOG_DENSITY_SCALER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// +BRIGHT things are not affected by fog
|
||||
fogdistance = float.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the texture is loaded
|
||||
|
@ -373,7 +414,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Apply settings
|
||||
SetPosition(pos);
|
||||
SetCageSize(thingradius, thingheight);
|
||||
SetCageColor(Thing.Color);
|
||||
|
||||
// Keep info for object picking
|
||||
|
|
|
@ -121,9 +121,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Sky is always bright
|
||||
int color;
|
||||
if(s.CeilTexture == General.Map.Config.SkyFlatName)
|
||||
{
|
||||
color = -1; // That's white. With alpha. Not very impressive, eh?
|
||||
fogfactor = 0; // No fog
|
||||
}
|
||||
else
|
||||
{
|
||||
color = PixelColor.FromInt(level.color).WithAlpha((byte)General.Clamp(level.alpha, 0, 255)).ToInt();
|
||||
fogfactor = CalculateFogDensity(level.brightnessbelow);
|
||||
}
|
||||
|
||||
// Make vertices
|
||||
ReadOnlyCollection<Vector2D> triverts = base.Sector.Sector.Triangles.Vertices;
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
s.Fields.GetValue("yscalefloor", 1.0f));
|
||||
|
||||
//Load floor texture
|
||||
if (s.LongFloorTexture != MapSet.EmptyLongName)
|
||||
if(s.LongFloorTexture != MapSet.EmptyLongName)
|
||||
{
|
||||
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
|
||||
if(base.Texture == null || base.Texture is UnknownImage)
|
||||
|
@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!base.Texture.IsImageLoaded)
|
||||
if(!base.Texture.IsImageLoaded)
|
||||
setuponloadedtexture = s.LongFloorTexture;
|
||||
}
|
||||
}
|
||||
|
@ -122,10 +122,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
//mxd. Sky is always bright
|
||||
int color;
|
||||
if(s.FloorTexture == General.Map.Config.SkyFlatName)
|
||||
if(s.FloorTexture == General.Map.Config.SkyFlatName)
|
||||
{
|
||||
color = -1; // That's white. With alpha. Not very impressive, eh?
|
||||
else
|
||||
fogfactor = 0; // No fog
|
||||
}
|
||||
else
|
||||
{
|
||||
color = PixelColor.FromInt(level.color).WithAlpha((byte)General.Clamp(level.alpha, 0, 255)).ToInt();
|
||||
fogfactor = CalculateFogDensity(level.brightnessbelow);
|
||||
}
|
||||
|
||||
// Make vertices
|
||||
ReadOnlyCollection<Vector2D> triverts = base.Sector.Sector.Triangles.Vertices;
|
||||
|
|
|
@ -173,9 +173,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Determine initial color
|
||||
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
|
||||
//mxd
|
||||
|
||||
//mxd. This calculates light with doom-style wall shading
|
||||
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
|
||||
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
|
||||
fogfactor = CalculateFogDensity(lightlevel);
|
||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||
|
||||
// Cut off the part above the other floor
|
||||
|
|
|
@ -212,9 +212,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Determine initial color
|
||||
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
|
||||
|
||||
//mxd. This calculates light with doom-style wall shading
|
||||
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
|
||||
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
|
||||
fogfactor = CalculateFogDensity(lightlevel);
|
||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||
|
||||
// Cut off the part above the 3D floor and below the 3D ceiling
|
||||
|
|
|
@ -192,9 +192,10 @@ namespace CodeImp.DoomBuilder.BuilderModes {
|
|||
else
|
||||
lightlevel = lightabsolute ? lightvalue : sourceside.Sector.Brightness + lightvalue;
|
||||
|
||||
//mxd
|
||||
//mxd. This calculates light with doom-style wall shading
|
||||
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
|
||||
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
|
||||
fogfactor = CalculateFogDensity(lightlevel);
|
||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||
|
||||
// Cut off the part above the 3D floor and below the 3D ceiling
|
||||
|
@ -238,25 +239,25 @@ namespace CodeImp.DoomBuilder.BuilderModes {
|
|||
}
|
||||
|
||||
// Process the polygon and create vertices
|
||||
if (polygons.Count > 0)
|
||||
if(polygons.Count > 0)
|
||||
{
|
||||
List<WorldVertex> verts = CreatePolygonVertices(polygons, tp, sd, lightvalue, lightabsolute);
|
||||
if (verts.Count > 2)
|
||||
if(verts.Count > 2)
|
||||
{
|
||||
if ((extrafloor.Linedef.Args[2] & (int) Effect3DFloor.Flags.RenderAdditive) != 0) //mxd
|
||||
if((extrafloor.Linedef.Args[2] & (int) Effect3DFloor.Flags.RenderAdditive) != 0) //mxd
|
||||
this.RenderPass = RenderPass.Additive;
|
||||
else if (extrafloor.Alpha < 255)
|
||||
else if(extrafloor.Alpha < 255)
|
||||
this.RenderPass = RenderPass.Alpha;
|
||||
else
|
||||
this.RenderPass = RenderPass.Mask;
|
||||
|
||||
if (extrafloor.Alpha < 255)
|
||||
if(extrafloor.Alpha < 255)
|
||||
{
|
||||
// Apply alpha to vertices
|
||||
byte alpha = (byte) General.Clamp(extrafloor.Alpha, 0, 255);
|
||||
if (alpha < 255)
|
||||
if(alpha < 255)
|
||||
{
|
||||
for (int i = 0; i < verts.Count; i++)
|
||||
for(int i = 0; i < verts.Count; i++)
|
||||
{
|
||||
WorldVertex v = verts[i];
|
||||
PixelColor c = PixelColor.FromInt(v.c);
|
||||
|
|
|
@ -181,9 +181,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Determine initial color
|
||||
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
|
||||
//mxd
|
||||
|
||||
//mxd. This calculates light with doom-style wall shading
|
||||
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
|
||||
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
|
||||
fogfactor = CalculateFogDensity(lightlevel);
|
||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||
|
||||
// Cut off the part below the other floor and above the other ceiling
|
||||
|
|
|
@ -175,9 +175,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Determine initial color
|
||||
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
|
||||
//mxd
|
||||
|
||||
//mxd. This calculates light with doom-style wall shading
|
||||
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
|
||||
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
|
||||
fogfactor = CalculateFogDensity(lightlevel);
|
||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||
|
||||
// Cut out pieces that overlap 3D floors in this sector
|
||||
|
|
|
@ -165,9 +165,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Determine initial color
|
||||
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
|
||||
//mxd
|
||||
|
||||
//mxd. This calculates light with doom-style wall shading
|
||||
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
|
||||
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
|
||||
fogfactor = CalculateFogDensity(lightlevel);
|
||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||
|
||||
// Cut off the part below the other ceiling
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -57,6 +57,14 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -48,6 +48,16 @@
|
|||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BuilderPlug.cs" />
|
||||
<Compile Include="Node.cs" />
|
||||
|
|
|
@ -37,6 +37,14 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -40,6 +40,14 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Builder, Version=1.14.0.2201, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
|
@ -40,6 +40,14 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -41,6 +41,13 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
|
@ -47,6 +47,16 @@
|
|||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release + Profiler|x86' ">
|
||||
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
|
|
Loading…
Reference in a new issue