mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Apply nullability and clean up conditionals
This commit is contained in:
parent
a07b033d22
commit
9a330c3cdb
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Shaders;
|
using osu.Framework.Graphics.Shaders;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using System;
|
using System;
|
||||||
@ -71,11 +69,12 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IRenderer renderer { get; set; }
|
private IRenderer renderer { get; set; } = null!;
|
||||||
|
|
||||||
private Random stableRandom;
|
private Random? stableRandom;
|
||||||
private IShader shader;
|
|
||||||
private Texture texture;
|
private IShader shader = null!;
|
||||||
|
private Texture texture = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a new triangle visualisation.
|
/// Construct a new triangle visualisation.
|
||||||
@ -116,8 +115,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
image[i, 0] = new Rgba32(
|
image[i, 0] = new Rgba32(
|
||||||
colourBottom.Value.R * ratio + colourTop.Value.R * (1f - ratio),
|
colourBottom.Value.R * ratio + colourTop.Value.R * (1f - ratio),
|
||||||
colourBottom.Value.G * ratio + colourTop.Value.G * (1f - ratio),
|
colourBottom.Value.G * ratio + colourTop.Value.G * (1f - ratio),
|
||||||
colourBottom.Value.B * ratio + colourTop.Value.B * (1f - ratio),
|
colourBottom.Value.B * ratio + colourTop.Value.B * (1f - ratio)
|
||||||
1f
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,13 +221,13 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
protected new TrianglesV2 Source => (TrianglesV2)base.Source;
|
protected new TrianglesV2 Source => (TrianglesV2)base.Source;
|
||||||
|
|
||||||
private IShader shader;
|
private IShader shader = null!;
|
||||||
private Texture texture;
|
private Texture texture = null!;
|
||||||
|
|
||||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
||||||
private Vector2 size;
|
private Vector2 size;
|
||||||
|
|
||||||
private IVertexBatch<TexturedVertex2D> vertexBatch;
|
private IVertexBatch<TexturedVertex2D>? vertexBatch;
|
||||||
|
|
||||||
public TrianglesDrawNode(TrianglesV2 source)
|
public TrianglesDrawNode(TrianglesV2 source)
|
||||||
: base(source)
|
: base(source)
|
||||||
@ -252,7 +250,10 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
base.Draw(renderer);
|
base.Draw(renderer);
|
||||||
|
|
||||||
if (Source.AimCount > 0 && (vertexBatch == null || vertexBatch.Size != Source.AimCount))
|
if (Source.AimCount == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (vertexBatch == null || vertexBatch.Size != Source.AimCount)
|
||||||
{
|
{
|
||||||
vertexBatch?.Dispose();
|
vertexBatch?.Dispose();
|
||||||
vertexBatch = renderer.CreateQuadBatch<TexturedVertex2D>(Source.AimCount, 1);
|
vertexBatch = renderer.CreateQuadBatch<TexturedVertex2D>(Source.AimCount, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user