mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-27 22:31:23 +00:00
Improve camera sector search somewhat
This commit is contained in:
parent
459742c840
commit
061fa30a45
1 changed files with 49 additions and 39 deletions
|
@ -593,8 +593,17 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
if(processgeometry)
|
if(processgeometry)
|
||||||
{
|
{
|
||||||
// Find camera sector
|
// Find camera sector
|
||||||
|
Sector camsector = blockmap.GetSectorAt(campos2d);
|
||||||
|
if (camsector != null)
|
||||||
|
{
|
||||||
|
General.Map.VisualCamera.Sector = camsector;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// To do: fix this code. It is retarded. Walking over all visible lines is extremely expensive.
|
||||||
|
|
||||||
Linedef nld = MapSet.NearestLinedef(visiblelines, campos2d);
|
Linedef nld = MapSet.NearestLinedef(visiblelines, campos2d);
|
||||||
if(nld != null)
|
if (nld != null)
|
||||||
{
|
{
|
||||||
General.Map.VisualCamera.Sector = GetCameraSectorFromLinedef(nld);
|
General.Map.VisualCamera.Sector = GetCameraSectorFromLinedef(nld);
|
||||||
}
|
}
|
||||||
|
@ -606,15 +615,15 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
// Here we handle this special case with brute-force. Let's find the sector
|
// Here we handle this special case with brute-force. Let's find the sector
|
||||||
// the camera is in by searching the entire map and render that sector only.
|
// the camera is in by searching the entire map and render that sector only.
|
||||||
nld = General.Map.Map.NearestLinedef(campos2d);
|
nld = General.Map.Map.NearestLinedef(campos2d);
|
||||||
if(nld != null)
|
if (nld != null)
|
||||||
{
|
{
|
||||||
General.Map.VisualCamera.Sector = GetCameraSectorFromLinedef(nld);
|
General.Map.VisualCamera.Sector = GetCameraSectorFromLinedef(nld);
|
||||||
if(General.Map.VisualCamera.Sector != null)
|
if (General.Map.VisualCamera.Sector != null)
|
||||||
{
|
{
|
||||||
foreach(Sidedef sd in General.Map.VisualCamera.Sector.Sidedefs)
|
foreach (Sidedef sd in General.Map.VisualCamera.Sector.Sidedefs)
|
||||||
{
|
{
|
||||||
float side = sd.Line.SideOfLine(campos2d);
|
float side = sd.Line.SideOfLine(campos2d);
|
||||||
if(((side < 0) && sd.IsFront) ||
|
if (((side < 0) && sd.IsFront) ||
|
||||||
((side > 0) && !sd.IsFront))
|
((side > 0) && !sd.IsFront))
|
||||||
ProcessSidedefCulling(sd);
|
ProcessSidedefCulling(sd);
|
||||||
}
|
}
|
||||||
|
@ -633,6 +642,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This finds and adds visible sectors
|
// This finds and adds visible sectors
|
||||||
private void ProcessSidedefCulling(Sidedef sd)
|
private void ProcessSidedefCulling(Sidedef sd)
|
||||||
|
|
Loading…
Reference in a new issue