Optimise DecalOverlay (#25266)
ChunkSize is still 32 so doesn't cut down on heaps of decals atm though we avoid passing many decals to drawing with the coordinates bounds check now.
This commit is contained in:
@@ -122,39 +122,6 @@ namespace Content.Shared.Decals
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Pretty sure paul was moving this somewhere but just so people know
|
||||
public struct ChunkIndicesEnumerator
|
||||
{
|
||||
private Vector2i _chunkLB;
|
||||
private Vector2i _chunkRT;
|
||||
|
||||
private int _xIndex;
|
||||
private int _yIndex;
|
||||
|
||||
public ChunkIndicesEnumerator(Box2 localAABB, int chunkSize)
|
||||
{
|
||||
_chunkLB = new Vector2i((int)Math.Floor(localAABB.Left / chunkSize), (int)Math.Floor(localAABB.Bottom / chunkSize));
|
||||
_chunkRT = new Vector2i((int)Math.Floor(localAABB.Right / chunkSize), (int)Math.Floor(localAABB.Top / chunkSize));
|
||||
|
||||
_xIndex = _chunkLB.X;
|
||||
_yIndex = _chunkLB.Y;
|
||||
}
|
||||
|
||||
public bool MoveNext([NotNullWhen(true)] out Vector2i? indices)
|
||||
{
|
||||
if (_yIndex > _chunkRT.Y)
|
||||
{
|
||||
_yIndex = _chunkLB.Y;
|
||||
_xIndex += 1;
|
||||
}
|
||||
|
||||
indices = new Vector2i(_xIndex, _yIndex);
|
||||
_yIndex += 1;
|
||||
|
||||
return _xIndex <= _chunkRT.X;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sent by clients to request that a decal is placed on the server.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user