- removed some test editing modes

- fixed some drawing code (this might fix the alleged 'black screen' problem some people reported)
- fixed brightness toggle in low quality display mode
This commit is contained in:
codeimp 2009-01-06 20:45:15 +00:00
parent e4c743c973
commit 7405b25612
7 changed files with 222 additions and 21 deletions

View file

@ -109,7 +109,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Testing\TriangulatorMode.cs" />
<Compile Include="ClassicModes\DragThingsMode.cs" />
<Compile Include="General\LineLengthLabel.cs" />
<Compile Include="VisualModes\IVisualEventReceiver.cs" />
@ -124,13 +123,6 @@
<Compile Include="VisualModes\VisualFloor.cs" />
<Compile Include="VisualModes\VisualLower.cs" />
<Compile Include="VisualModes\VisualMiddleSingle.cs" />
<Compile Include="Testing\WAuthorMode.cs" />
<Compile Include="Testing\WAuthorTools.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Testing\WAuthorTools.Designer.cs">
<DependentUpon>WAuthorTools.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ClassicModes\SectorsMode.cs" />
<Compile Include="ClassicModes\ThingsMode.cs" />
@ -155,10 +147,6 @@
<EmbeddedResource Include="Resources\SectorsMode.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Testing\WAuthorTools.resx">
<SubType>Designer</SubType>
<DependentUpon>WAuthorTools.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resources\WAuthor.png" />
</ItemGroup>
<ItemGroup>

View file

@ -131,28 +131,35 @@ namespace CodeImp.DoomBuilder.Rendering
public void SetupSettings()
{
// Setup renderstates
device.SetRenderState(RenderState.AlphaRef, 0x0000007E);
device.SetRenderState(RenderState.AlphaBlendEnable, false);
device.SetRenderState(RenderState.AlphaBlendEnable, false);
device.SetRenderState(RenderState.AlphaFunc, Compare.GreaterEqual);
device.SetRenderState(RenderState.AntialiasedLineEnable, false);
device.SetRenderState(RenderState.AlphaRef, 0x0000007E);
device.SetRenderState(RenderState.AlphaTestEnable, false);
device.SetRenderState(RenderState.Ambient, Color.White.ToArgb());
device.SetRenderState(RenderState.AmbientMaterialSource, ColorSource.Material);
device.SetRenderState(RenderState.ColorWriteEnable, ColorWriteEnable.Red | ColorWriteEnable.Green | ColorWriteEnable.Blue | ColorWriteEnable.Alpha);
device.SetRenderState(RenderState.AntialiasedLineEnable, false);
device.SetRenderState(RenderState.Clipping, true);
device.SetRenderState(RenderState.ColorVertex, false);
device.SetRenderState(RenderState.ColorWriteEnable, ColorWriteEnable.Red | ColorWriteEnable.Green | ColorWriteEnable.Blue | ColorWriteEnable.Alpha);
device.SetRenderState(RenderState.CullMode, Cull.None);
device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
device.SetRenderState(RenderState.DiffuseMaterialSource, ColorSource.Color1);
device.SetRenderState(RenderState.DitherEnable, true);
device.SetRenderState(RenderState.FillMode, FillMode.Solid);
device.SetRenderState(RenderState.FogEnable, false);
device.SetRenderState(RenderState.FogTableMode, FogMode.Linear);
device.SetRenderState(RenderState.Lighting, false);
device.SetRenderState(RenderState.LocalViewer, false);
device.SetRenderState(RenderState.NormalizeNormals, false);
device.SetRenderState(RenderState.PointSpriteEnable, false);
device.SetRenderState(RenderState.RangeFogEnable, false);
device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
device.SetRenderState(RenderState.SpecularEnable, false);
device.SetRenderState(RenderState.StencilEnable, false);
device.SetRenderState(RenderState.PointSpriteEnable, false);
device.SetRenderState(RenderState.DitherEnable, true);
device.SetRenderState(RenderState.AlphaBlendEnable, false);
device.SetRenderState(RenderState.TextureFactor, -1);
device.SetRenderState(RenderState.ZEnable, false);
device.SetRenderState(RenderState.ZWriteEnable, false);
device.SetRenderState(RenderState.Clipping, true);
device.SetRenderState(RenderState.CullMode, Cull.None);
device.PixelShader = null;
device.VertexShader = null;

View file

@ -159,7 +159,7 @@ namespace CodeImp.DoomBuilder.Rendering
}
// This begins a pass
public void BeginPass(int index)
public virtual void BeginPass(int index)
{
if(manager.Enabled && General.Settings.QualityDisplay) effect.BeginPass(index);
}

View file

@ -122,6 +122,68 @@ namespace CodeImp.DoomBuilder.Rendering
}
}
// This sets up the render pipeline
public override void BeginPass(int index)
{
Device device = manager.D3DDevice.Device;
if(!manager.Enabled || !General.Settings.QualityDisplay)
{
// Sampler settings
if(General.Settings.ClassicBilinear)
{
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
}
else
{
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
}
// Texture addressing
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressW, TextureAddress.Wrap);
// First texture stage
device.SetTextureStageState(0, TextureStage.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStage.ColorArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.ColorArg2, TextureArgument.Diffuse);
device.SetTextureStageState(0, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(0, TextureStage.TexCoordIndex, 0);
// Second texture stage
device.SetTextureStageState(1, TextureStage.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(1, TextureStage.ColorArg1, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.ColorArg2, TextureArgument.TFactor);
device.SetTextureStageState(1, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.TexCoordIndex, 0);
// No more further stages
device.SetTextureStageState(2, TextureStage.ColorOperation, TextureOperation.Disable);
// First alpha stage
device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse);
// Second alpha stage
device.SetTextureStageState(1, TextureStage.AlphaOperation, TextureOperation.Modulate);
device.SetTextureStageState(1, TextureStage.AlphaArg1, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.AlphaArg2, TextureArgument.TFactor);
// No more further stages
device.SetTextureStageState(2, TextureStage.AlphaOperation, TextureOperation.Disable);
}
base.BeginPass(index);
}
#endregion
}
}

View file

@ -517,6 +517,7 @@ namespace CodeImp.DoomBuilder.Rendering
Matrix scaling = Matrix.Scaling((1f / (float)windowsize.Width) * 2f, (1f / (float)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.Projection, Matrix.Identity);
}
// This sets the world matrix for transformation
@ -1019,6 +1020,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, alphacolor.ToArgb());
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
@ -1147,6 +1149,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(true);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1164,6 +1167,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(true);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1181,6 +1185,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(true);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1259,6 +1264,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
graphics.Shaders.Display2D.Texture1 = t;
graphics.Device.SetTexture(0, t);
SetWorldTransformation(transformcoords);
@ -1288,6 +1294,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
graphics.Shaders.Display2D.Texture1 = graphics.FontTexture;
SetWorldTransformation(false);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, true);
@ -1352,6 +1359,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false);
graphics.Device.SetTexture(0, whitetexture.Texture);
graphics.Shaders.Display2D.Texture1 = whitetexture.Texture;
@ -1390,6 +1398,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false);
graphics.Device.SetTexture(0, whitetexture.Texture);
graphics.Shaders.Display2D.Texture1 = whitetexture.Texture;
@ -1443,6 +1452,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false);
graphics.Device.SetTexture(0, whitetexture.Texture);
graphics.Shaders.Display2D.Texture1 = whitetexture.Texture;

View file

@ -116,6 +116,68 @@ namespace CodeImp.DoomBuilder.Rendering
}
}
// This sets up the render pipeline
public override void BeginPass(int index)
{
Device device = manager.D3DDevice.Device;
if(!manager.Enabled || !General.Settings.QualityDisplay)
{
// Sampler settings
if(General.Settings.ClassicBilinear)
{
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
}
else
{
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
}
// Texture addressing
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressW, TextureAddress.Wrap);
// First texture stage
device.SetTextureStageState(0, TextureStage.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStage.ColorArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.ColorArg2, TextureArgument.Diffuse);
device.SetTextureStageState(0, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(0, TextureStage.TexCoordIndex, 0);
// Second texture stage
device.SetTextureStageState(1, TextureStage.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(1, TextureStage.ColorArg1, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.ColorArg2, TextureArgument.TFactor);
device.SetTextureStageState(1, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.TexCoordIndex, 0);
// No more further stages
device.SetTextureStageState(2, TextureStage.ColorOperation, TextureOperation.Disable);
// First alpha stage
device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse);
// Second alpha stage
device.SetTextureStageState(1, TextureStage.AlphaOperation, TextureOperation.Modulate);
device.SetTextureStageState(1, TextureStage.AlphaArg1, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.AlphaArg2, TextureArgument.TFactor);
// No more further stages
device.SetTextureStageState(2, TextureStage.AlphaOperation, TextureOperation.Disable);
}
base.BeginPass(index);
}
#endregion
}
}

View file

@ -133,6 +133,78 @@ namespace CodeImp.DoomBuilder.Rendering
{
effect.SetValue<Color4>(modulatecolor, new Color4(modcolor));
}
// This sets up the render pipeline
public override void BeginPass(int index)
{
Device device = manager.D3DDevice.Device;
if(!manager.Enabled || !General.Settings.QualityDisplay)
{
// Sampler settings
if(General.Settings.VisualBilinear)
{
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
}
else
{
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
}
// Texture addressing
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressW, TextureAddress.Wrap);
// First texture stage
if(index == 0)
{
device.SetTextureStageState(0, TextureStage.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStage.ColorArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.ColorArg2, TextureArgument.Diffuse);
device.SetTextureStageState(0, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(0, TextureStage.TexCoordIndex, 0);
}
else
{
device.SetTextureStageState(0, TextureStage.ColorOperation, TextureOperation.SelectArg1);
device.SetTextureStageState(0, TextureStage.ColorArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(0, TextureStage.TexCoordIndex, 0);
}
// Second texture stage
device.SetTextureStageState(1, TextureStage.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(1, TextureStage.ColorArg1, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.ColorArg2, TextureArgument.TFactor);
device.SetTextureStageState(1, TextureStage.ResultArg, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.TexCoordIndex, 0);
// No more further stages
device.SetTextureStageState(2, TextureStage.ColorOperation, TextureOperation.Disable);
// First alpha stage
device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture);
device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse);
// Second alpha stage
device.SetTextureStageState(1, TextureStage.AlphaOperation, TextureOperation.Modulate);
device.SetTextureStageState(1, TextureStage.AlphaArg1, TextureArgument.Current);
device.SetTextureStageState(1, TextureStage.AlphaArg2, TextureArgument.TFactor);
// No more further stages
device.SetTextureStageState(2, TextureStage.AlphaOperation, TextureOperation.Disable);
}
base.BeginPass(index);
}
#endregion
}