mirror of
https://github.com/osukey/osukey.git
synced 2025-05-26 07:57:32 +09:00
Reduce Triangle drawnode overhead by ~90%
This was never batching, ever. Pointless memory overhead.
This commit is contained in:
parent
7558ac1445
commit
00f1d1b53c
@ -137,11 +137,13 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int AimCount;
|
||||||
|
|
||||||
private void addTriangles(bool randomY)
|
private void addTriangles(bool randomY)
|
||||||
{
|
{
|
||||||
int aimTriangleCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
AimCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
||||||
|
|
||||||
for (int i = 0; i < aimTriangleCount - parts.Count; i++)
|
for (int i = 0; i < AimCount - parts.Count; i++)
|
||||||
parts.Add(createTriangle(randomY));
|
parts.Add(createTriangle(randomY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,11 +192,12 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
||||||
private Vector2 size;
|
private Vector2 size;
|
||||||
|
|
||||||
private readonly LinearBatch<TexturedVertex2D> vertexBatch = new LinearBatch<TexturedVertex2D>(100 * 3, 10, PrimitiveType.Triangles);
|
private readonly LinearBatch<TexturedVertex2D> vertexBatch;
|
||||||
|
|
||||||
public TrianglesDrawNode(Triangles source)
|
public TrianglesDrawNode(Triangles source)
|
||||||
: base(source)
|
: base(source)
|
||||||
{
|
{
|
||||||
|
vertexBatch = new LinearBatch<TexturedVertex2D>(source.AimCount * 3, 2, PrimitiveType.Triangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyState()
|
public override void ApplyState()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user