Added dynamic light count = 256 for high end users. Fixed: incorrect attenuated<->subtractive light ordering caused invisible subtractive lights.

This commit is contained in:
ZZYZX 2017-02-09 13:28:55 +02:00
parent e62bbba9ff
commit 2b69b38e18
5 changed files with 36 additions and 36 deletions

View file

@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2875")]
[assembly: AssemblyVersion("2.3.0.2876")]
[assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: AssemblyHash("1fb1167")]
[assembly: AssemblyHash("e62bbba")]

View file

@ -532,9 +532,9 @@ namespace CodeImp.DoomBuilder.Rendering
{
case DynamicLightRenderStyle.NORMAL:
case DynamicLightRenderStyle.VAVOOM: lightOffsets[0]++; break;
case DynamicLightRenderStyle.ADDITIVE: lightOffsets[1]++; break;
case DynamicLightRenderStyle.NEGATIVE: lightOffsets[2]++; break;
default: lightOffsets[3]++; break;
case DynamicLightRenderStyle.ADDITIVE: lightOffsets[2]++; break;
case DynamicLightRenderStyle.NEGATIVE: lightOffsets[3]++; break;
default: lightOffsets[1]++; break; // attenuated
}
}
}
@ -1333,13 +1333,33 @@ namespace CodeImp.DoomBuilder.Rendering
}
}
//attenuated lights
if (lightOffsets[1] > 0)
{
count += lightOffsets[1];
graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add);
for (int i = lightOffsets[0]; i < count; i++)
{
if (BoundingBoxesIntersect(g.BoundingBox, lights[i].BoundingBox))
{
lpr = new Vector4(lights[i].Center, lights[i].LightRadius);
if (lpr.W == 0) continue;
graphics.Shaders.World3D.LightColor = lights[i].LightColor;
graphics.Shaders.World3D.LightPositionAndRadius = lpr;
graphics.Shaders.World3D.ApplySettings();
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
}
}
}
//additive lights
if (lightOffsets[1] > 0)
if (lightOffsets[2] > 0)
{
count += lightOffsets[1];
count += lightOffsets[2];
graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add);
for(int i = lightOffsets[0]; i < count; i++)
for(int i = lightOffsets[0] + lightOffsets[1]; i < count; i++)
{
if(BoundingBoxesIntersect(g.BoundingBox, lights[i].BoundingBox))
{
@ -1354,12 +1374,12 @@ namespace CodeImp.DoomBuilder.Rendering
}
//negative lights
if(lightOffsets[2] > 0)
if(lightOffsets[3] > 0)
{
count += lightOffsets[2];
count += lightOffsets[3];
graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.ReverseSubtract);
for(int i = lightOffsets[0] + lightOffsets[1]; i < count; i++)
for(int i = lightOffsets[0] + lightOffsets[1] + lightOffsets[2]; i < count; i++)
{
if(BoundingBoxesIntersect(g.BoundingBox, lights[i].BoundingBox))
{
@ -1373,26 +1393,6 @@ namespace CodeImp.DoomBuilder.Rendering
}
}
}
//attenuated lights
if (lightOffsets[3] > 0)
{
count += lightOffsets[3];
graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add);
for (int i = lightOffsets[0] + lightOffsets[1] + lightOffsets[2]; i < count; i++)
{
if (BoundingBoxesIntersect(g.BoundingBox, lights[i].BoundingBox))
{
lpr = new Vector4(lights[i].Center, lights[i].LightRadius);
if (lpr.W == 0) continue;
graphics.Shaders.World3D.LightColor = lights[i].LightColor;
graphics.Shaders.World3D.LightPositionAndRadius = lpr;
graphics.Shaders.World3D.ApplySettings();
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
}
}
}
}
}

View file

@ -1725,7 +1725,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tbDynLightCount.BackColor = System.Drawing.SystemColors.Window;
this.tbDynLightCount.LargeChange = 1;
this.tbDynLightCount.Location = new System.Drawing.Point(199, 237);
this.tbDynLightCount.Maximum = 8;
this.tbDynLightCount.Maximum = 16;
this.tbDynLightCount.Minimum = 1;
this.tbDynLightCount.Name = "tbDynLightCount";
this.tbDynLightCount.Size = new System.Drawing.Size(154, 42);

View file

@ -96,7 +96,7 @@ namespace CodeImp.DoomBuilder.Windows
checkforupdates.Checked = General.Settings.CheckForUpdates;
toolbar_gzdoom.Checked = General.Settings.GZToolbarGZDoom;
cbSynchCameras.Checked = General.Settings.GZSynchCameras;
tbDynLightCount.Value = General.Clamp(General.Settings.GZMaxDynamicLights / 8, tbDynLightCount.Minimum, tbDynLightCount.Maximum);
tbDynLightCount.Value = General.Clamp(General.Settings.GZMaxDynamicLights / 16, tbDynLightCount.Minimum, tbDynLightCount.Maximum);
labelDynLightCount.Text = General.Settings.GZMaxDynamicLights.ToString();
cbStretchView.Checked = General.Settings.GZStretchView;
cbOldHighlightMode.Checked = General.Settings.GZOldHighlightMode;
@ -402,7 +402,7 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
General.Settings.GZSynchCameras = cbSynchCameras.Checked;
General.Settings.GZMaxDynamicLights = tbDynLightCount.Value * 8;
General.Settings.GZMaxDynamicLights = tbDynLightCount.Value * 16;
General.Settings.FilterAnisotropy = D3DDevice.AF_STEPS[anisotropicfiltering.Value];
General.Settings.AntiAliasingSamples = D3DDevice.AA_STEPS[antialiasing.Value];
General.Settings.GZStretchView = cbStretchView.Checked;
@ -991,7 +991,7 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void tbDynLightCount_ValueChanged(object sender, EventArgs e)
{
labelDynLightCount.Text = (tbDynLightCount.Value * 8).ToString();
labelDynLightCount.Text = (tbDynLightCount.Value * 16).ToString();
}
//mxd

View file

@ -29,5 +29,5 @@ using System.Resources;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2875")]
[assembly: AssemblyVersion("2.3.0.2876")]
[assembly: NeutralResourcesLanguageAttribute("en")]