mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 14:52:35 +02:00
Small rendering optimization.
Removes WorldPosition fetch from sprite sort.
This commit is contained in:
@@ -21,9 +21,9 @@ namespace Robust.Client.Graphics.Clyde
|
||||
{
|
||||
public ClydeDebugLayers DebugLayers { get; set; }
|
||||
|
||||
private readonly RefList<(SpriteComponent sprite, Matrix3 worldMatrix, Angle worldRotation)> _drawingSpriteList
|
||||
private readonly RefList<(SpriteComponent sprite, Matrix3 worldMatrix, Angle worldRotation, float yWorldPos)> _drawingSpriteList
|
||||
=
|
||||
new RefList<(SpriteComponent, Matrix3, Angle)>();
|
||||
new RefList<(SpriteComponent, Matrix3, Angle, float)>();
|
||||
|
||||
public void Render()
|
||||
{
|
||||
@@ -212,7 +212,7 @@ namespace Robust.Client.Graphics.Clyde
|
||||
}
|
||||
|
||||
private void ProcessSpriteEntities(IEntity entity, ref Matrix3 parentTransform, Angle parentRotation,
|
||||
Box2 worldBounds, RefList<(SpriteComponent, Matrix3, Angle)> list)
|
||||
Box2 worldBounds, RefList<(SpriteComponent, Matrix3, Angle, float yWorldPos)> list)
|
||||
{
|
||||
entity.TryGetComponent(out ContainerManagerComponent containerManager);
|
||||
|
||||
@@ -246,6 +246,7 @@ namespace Robust.Client.Graphics.Clyde
|
||||
|
||||
entry.Item1 = sprite;
|
||||
entry.Item3 = childWorldRotation;
|
||||
entry.yWorldPos = worldPosition.Y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -811,9 +811,9 @@ namespace Robust.Client.Graphics.Clyde
|
||||
|
||||
private sealed class SpriteDrawingOrderComparer : IComparer<int>
|
||||
{
|
||||
private readonly RefList<(SpriteComponent, Matrix3, Angle)> _drawList;
|
||||
private readonly RefList<(SpriteComponent, Matrix3, Angle, float)> _drawList;
|
||||
|
||||
public SpriteDrawingOrderComparer(RefList<(SpriteComponent, Matrix3, Angle)> drawList)
|
||||
public SpriteDrawingOrderComparer(RefList<(SpriteComponent, Matrix3, Angle, float)> drawList)
|
||||
{
|
||||
_drawList = drawList;
|
||||
}
|
||||
@@ -836,7 +836,7 @@ namespace Robust.Client.Graphics.Clyde
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = b.Owner.Transform.WorldPosition.Y.CompareTo(a.Owner.Transform.WorldPosition.Y);
|
||||
cmp = _drawList[x].Item4.CompareTo(_drawList[y].Item4);
|
||||
|
||||
if (cmp != 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user