mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:20:04 +08:00
Add ability to adjust flashlight smoothness
This commit is contained in:
parent
f318452510
commit
0df217d85c
@ -201,6 +201,20 @@ namespace osu.Game.Rulesets.Mods
|
||||
}
|
||||
}
|
||||
|
||||
private float flashlightSmoothness = 1.1f;
|
||||
|
||||
public float FlashlightSmoothness
|
||||
{
|
||||
get => flashlightSmoothness;
|
||||
set
|
||||
{
|
||||
if (flashlightSmoothness == value) return;
|
||||
|
||||
flashlightSmoothness = value;
|
||||
Invalidate(Invalidation.DrawNode);
|
||||
}
|
||||
}
|
||||
|
||||
private class FlashlightDrawNode : DrawNode
|
||||
{
|
||||
protected new Flashlight Source => (Flashlight)base.Source;
|
||||
@ -210,6 +224,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
private Vector2 flashlightPosition;
|
||||
private Vector2 flashlightSize;
|
||||
private float flashlightDim;
|
||||
private float flashlightSmoothness;
|
||||
|
||||
private IVertexBatch<PositionAndColourVertex>? quadBatch;
|
||||
private Action<TexturedVertex2D>? addAction;
|
||||
@ -228,6 +243,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
flashlightPosition = Vector2Extensions.Transform(Source.FlashlightPosition, DrawInfo.Matrix);
|
||||
flashlightSize = Source.FlashlightSize * DrawInfo.Matrix.ExtractScale().Xy;
|
||||
flashlightDim = Source.FlashlightDim;
|
||||
flashlightSmoothness = Source.flashlightSmoothness;
|
||||
}
|
||||
|
||||
public override void Draw(IRenderer renderer)
|
||||
@ -249,6 +265,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
shader.GetUniform<Vector2>("flashlightPos").UpdateValue(ref flashlightPosition);
|
||||
shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref flashlightSize);
|
||||
shader.GetUniform<float>("flashlightDim").UpdateValue(ref flashlightDim);
|
||||
shader.GetUniform<float>("flashlightSmoothness").UpdateValue(ref flashlightSmoothness);
|
||||
|
||||
renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user