mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
- Increased max view distance from 9000 to 64000 map units. Step size increased from 200 to 500 map units
@ Improved performance of VisualBlockMap.GetFrustumRange so that high view distances is actually usable. This does not do anything to the rendering speed, so that's still slow
This commit is contained in:
parent
560d23894d
commit
4b86f5458f
4 changed files with 2407 additions and 2365 deletions
|
@ -21,6 +21,8 @@ using System.Collections.Generic;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -105,14 +107,12 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
public VisualBlockEntry GetBlock(Point p)
|
||||
{
|
||||
ulong k = GetBlockKey(p);
|
||||
if(blockmap.ContainsKey(k))
|
||||
{
|
||||
return blockmap[k];
|
||||
}
|
||||
VisualBlockEntry vbe;
|
||||
|
||||
if (blockmap.TryGetValue(k, out vbe))
|
||||
return vbe;
|
||||
else
|
||||
{
|
||||
return (blockmap[k] = new VisualBlockEntry());
|
||||
}
|
||||
}
|
||||
|
||||
// This clears the blockmap
|
||||
|
@ -148,18 +148,54 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
// Make square range from frustum circle
|
||||
// This will be the range in which we will test blocks
|
||||
Point lt = GetBlockCoordinates(frustum.Center - frustum.Radius);
|
||||
Point rb = GetBlockCoordinates(frustum.Center + frustum.Radius);
|
||||
Point lb = GetBlockCoordinates(frustum.Center - frustum.Radius);
|
||||
Point rt = GetBlockCoordinates(frustum.Center + frustum.Radius);
|
||||
|
||||
Vector2D maplb = new Vector2D();
|
||||
Vector2D maprt = new Vector2D();
|
||||
|
||||
Vertex firstvertex = General.Map.Map.Vertices.OfType<Vertex>().FirstOrDefault();
|
||||
|
||||
if (firstvertex != null)
|
||||
maplb = maprt = firstvertex.Position;
|
||||
|
||||
// Get maximum dimensions of the map. First vertices...
|
||||
foreach (Vertex v in General.Map.Map.Vertices)
|
||||
{
|
||||
if (v.Position.x < maplb.x) maplb.x = v.Position.x;
|
||||
if (v.Position.y < maplb.y) maplb.y = v.Position.y;
|
||||
if (v.Position.x > maprt.x) maprt.x = v.Position.x;
|
||||
if (v.Position.y > maprt.y) maprt.y = v.Position.y;
|
||||
}
|
||||
|
||||
// ... then things
|
||||
foreach (Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if (t.Position.x < maplb.x) maplb.x = t.Position.x;
|
||||
if (t.Position.y < maplb.y) maplb.y = t.Position.y;
|
||||
if (t.Position.x > maprt.x) maprt.x = t.Position.x;
|
||||
if (t.Position.y > maprt.y) maprt.y = t.Position.y;
|
||||
}
|
||||
|
||||
Point mlb = GetBlockCoordinates(maplb);
|
||||
Point mrt = GetBlockCoordinates(maprt);
|
||||
|
||||
// Make sure that the checked region does not exceed the dimensions where something is to be displayed
|
||||
if (lb.X < mlb.X) lb.X = mlb.X;
|
||||
if (lb.Y < mlb.Y) lb.Y = mlb.Y;
|
||||
if (rt.X > mrt.X) rt.X = mrt.X;
|
||||
if (rt.Y > mrt.Y) rt.Y = mrt.Y;
|
||||
|
||||
// Constants we need
|
||||
float blockfrustumdistance2 = (frustum.Radius * frustum.Radius) + (BLOCK_RADIUS * BLOCK_RADIUS);
|
||||
|
||||
|
||||
// Go through the range to make a list
|
||||
int entriescount = (rb.X - lt.X) * (rb.Y - lt.Y);
|
||||
int entriescount = (rt.X - lb.X) * (rt.Y - lb.Y);
|
||||
List<VisualBlockEntry> entries = new List<VisualBlockEntry>(entriescount);
|
||||
for(int x = lt.X; x <= rb.X; x++)
|
||||
|
||||
for (int x = lb.X; x <= rt.X; x++)
|
||||
{
|
||||
for(int y = lt.Y; y <= rb.Y; y++)
|
||||
for(int y = lb.Y; y <= rt.Y; y++)
|
||||
{
|
||||
// First check if the block circle is intersecting the frustum circle
|
||||
Point block = new Point(x, y);
|
||||
|
@ -167,11 +203,11 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
if(Vector2D.DistanceSq(frustum.Center, blockcenter) < blockfrustumdistance2)
|
||||
{
|
||||
// Add the block if the block circle is inside the frustum
|
||||
if(frustum.IntersectCircle(blockcenter, BLOCK_RADIUS)) entries.Add(GetBlock(block));
|
||||
if (frustum.IntersectCircle(blockcenter, BLOCK_RADIUS)) entries.Add(GetBlock(block));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return list
|
||||
return entries;
|
||||
}
|
||||
|
|
4674
Source/Core/Windows/PreferencesForm.Designer.cs
generated
4674
Source/Core/Windows/PreferencesForm.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -33,6 +33,12 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
internal partial class PreferencesForm : DelayedForm
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const float VIEW_DISTANCE_STEP_SIZE = 500.0f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
private PreferencesController controller;
|
||||
|
@ -71,7 +77,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
mousespeed.Value = General.Clamp(General.Settings.MouseSpeed / 100, mousespeed.Minimum, mousespeed.Maximum);
|
||||
movespeed.Value = General.Clamp(General.Settings.MoveSpeed / 100, movespeed.Minimum, movespeed.Maximum);
|
||||
vertexScale3D.Value = General.Clamp((int)(General.Settings.GZVertexScale3D * 10), vertexScale3D.Minimum, vertexScale3D.Maximum); //mxd
|
||||
viewdistance.Value = General.Clamp((int)(General.Settings.ViewDistance / 200.0f), viewdistance.Minimum, viewdistance.Maximum);
|
||||
viewdistance.Value = General.Clamp((int)(General.Settings.ViewDistance / VIEW_DISTANCE_STEP_SIZE), viewdistance.Minimum, viewdistance.Maximum);
|
||||
invertyaxis.Checked = General.Settings.InvertYAxis;
|
||||
autoscrollspeed.Value = General.Clamp(General.Settings.AutoScrollSpeed, autoscrollspeed.Minimum, autoscrollspeed.Maximum);
|
||||
zoomfactor.Value = General.Clamp(General.Settings.ZoomFactor, zoomfactor.Minimum, zoomfactor.Maximum);
|
||||
|
@ -301,7 +307,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
General.Settings.MouseSpeed = mousespeed.Value * 100;
|
||||
General.Settings.MoveSpeed = movespeed.Value * 100;
|
||||
General.Settings.GZVertexScale3D = vertexScale3D.Value * 0.1f; //mxd
|
||||
General.Settings.ViewDistance = viewdistance.Value * 200.0f;
|
||||
General.Settings.ViewDistance = viewdistance.Value * VIEW_DISTANCE_STEP_SIZE;
|
||||
General.Settings.InvertYAxis = invertyaxis.Checked;
|
||||
General.Settings.AutoScrollSpeed = autoscrollspeed.Value;
|
||||
General.Settings.ZoomFactor = zoomfactor.Value;
|
||||
|
@ -500,7 +506,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
private void viewdistance_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
int value = viewdistance.Value * 200;
|
||||
int value = viewdistance.Value * (int)VIEW_DISTANCE_STEP_SIZE;
|
||||
viewdistancelabel.Text = value + " mp";
|
||||
}
|
||||
|
||||
|
|
|
@ -112,33 +112,33 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label29.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="label29.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label27.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="label27.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label18.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="label18.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<data name="scriptallmanstyle.ToolTip" xml:space="preserve">
|
||||
|
@ -152,7 +152,7 @@ markers in snippets will be replaced
|
|||
with newline characters, otherwise
|
||||
they will be replaced with tabs/spaces.</value>
|
||||
</data>
|
||||
<metadata name="browseScreenshotsFolderDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="browseScreenshotsFolderDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>114, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in a new issue