1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 08:03:12 +08:00

Merge pull request #21343 from goodtrailer/nonsquare-smoke

Add support for nonsquare smoke textures
This commit is contained in:
Dean Herbert 2022-11-21 12:06:49 +09:00 committed by GitHub
commit 85167d8de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,11 +52,13 @@ namespace osu.Game.Rulesets.Osu.Skinning
protected Texture? Texture { get; set; } protected Texture? Texture { get; set; }
private float radius => Texture?.DisplayWidth * 0.165f ?? 3; private float height => Texture?.DisplayHeight * 0.165f ?? 3;
private float width => Texture?.DisplayWidth * 0.165f ?? 3;
protected readonly List<SmokePoint> SmokePoints = new List<SmokePoint>(); protected readonly List<SmokePoint> SmokePoints = new List<SmokePoint>();
private float pointInterval => radius * 7f / 8; private float pointInterval => width * 7f / 8;
private double smokeStartTime { get; set; } = double.MinValue; private double smokeStartTime { get; set; } = double.MinValue;
@ -179,7 +181,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
private readonly List<SmokePoint> points = new List<SmokePoint>(); private readonly List<SmokePoint> points = new List<SmokePoint>();
private IVertexBatch<TexturedVertex2D>? quadBatch; private IVertexBatch<TexturedVertex2D>? quadBatch;
private float radius; private float width;
private float height;
private Vector2 drawSize; private Vector2 drawSize;
private Texture? texture; private Texture? texture;
private int rotationSeed; private int rotationSeed;
@ -202,7 +205,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
{ {
base.ApplyState(); base.ApplyState();
radius = Source.radius; width = Source.width;
height = Source.height;
drawSize = Source.DrawSize; drawSize = Source.DrawSize;
texture = Source.Texture; texture = Source.Texture;
@ -334,11 +338,13 @@ namespace osu.Game.Rulesets.Osu.Skinning
var dir = PointDirection(point, index); var dir = PointDirection(point, index);
var ortho = dir.PerpendicularLeft; var ortho = dir.PerpendicularLeft;
dir *= scale * width;
ortho *= scale * height;
var localTopLeft = point.Position + (radius * scale * (-ortho - dir)); var localTopLeft = point.Position - ortho - dir;
var localTopRight = point.Position + (radius * scale * (-ortho + dir)); var localTopRight = point.Position - ortho + dir;
var localBotLeft = point.Position + (radius * scale * (ortho - dir)); var localBotLeft = point.Position + ortho - dir;
var localBotRight = point.Position + (radius * scale * (ortho + dir)); var localBotRight = point.Position + ortho + dir;
quadBatch.Add(new TexturedVertex2D quadBatch.Add(new TexturedVertex2D
{ {