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; }
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>();
private float pointInterval => radius * 7f / 8;
private float pointInterval => width * 7f / 8;
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 IVertexBatch<TexturedVertex2D>? quadBatch;
private float radius;
private float width;
private float height;
private Vector2 drawSize;
private Texture? texture;
private int rotationSeed;
@ -202,7 +205,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
{
base.ApplyState();
radius = Source.radius;
width = Source.width;
height = Source.height;
drawSize = Source.DrawSize;
texture = Source.Texture;
@ -334,11 +338,13 @@ namespace osu.Game.Rulesets.Osu.Skinning
var dir = PointDirection(point, index);
var ortho = dir.PerpendicularLeft;
dir *= scale * width;
ortho *= scale * height;
var localTopLeft = point.Position + (radius * scale * (-ortho - dir));
var localTopRight = point.Position + (radius * scale * (-ortho + dir));
var localBotLeft = point.Position + (radius * scale * (ortho - dir));
var localBotRight = point.Position + (radius * scale * (ortho + dir));
var localTopLeft = point.Position - ortho - dir;
var localTopRight = point.Position - ortho + dir;
var localBotLeft = point.Position + ortho - dir;
var localBotRight = point.Position + ortho + dir;
quadBatch.Add(new TexturedVertex2D
{