mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Allow flashlight size to be variant
This commit is contained in:
parent
2cffce805a
commit
5c09662c14
@ -32,7 +32,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private class Flashlight : Drawable, IRequireHighFrequencyMousePosition
|
private class Flashlight : Drawable, IRequireHighFrequencyMousePosition
|
||||||
{
|
{
|
||||||
private Shader shader;
|
private Shader shader;
|
||||||
private readonly MousePositionWrapper mousePosWrapper = new MousePositionWrapper();
|
private readonly MousePositionWrapper mousePosWrapper = new MousePositionWrapper
|
||||||
|
{
|
||||||
|
FlashlightSize = 300f
|
||||||
|
};
|
||||||
|
|
||||||
protected override DrawNode CreateDrawNode() => new FlashlightDrawNode();
|
protected override DrawNode CreateDrawNode() => new FlashlightDrawNode();
|
||||||
|
|
||||||
@ -45,7 +48,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
flashNode.Shader = shader;
|
flashNode.Shader = shader;
|
||||||
flashNode.ScreenSpaceDrawQuad = ScreenSpaceDrawQuad;
|
flashNode.ScreenSpaceDrawQuad = ScreenSpaceDrawQuad;
|
||||||
flashNode.MousePosWrapper = mousePosWrapper;
|
flashNode.MousePosWrapper = mousePosWrapper;
|
||||||
flashNode.FlashlightSize = 100f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -64,6 +66,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private class MousePositionWrapper
|
private class MousePositionWrapper
|
||||||
{
|
{
|
||||||
public Vector2 MousePosition;
|
public Vector2 MousePosition;
|
||||||
|
public float FlashlightSize;
|
||||||
|
public bool FlashlightUniformUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FlashlightDrawNode : DrawNode
|
private class FlashlightDrawNode : DrawNode
|
||||||
@ -71,8 +75,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public Shader Shader;
|
public Shader Shader;
|
||||||
public Quad ScreenSpaceDrawQuad;
|
public Quad ScreenSpaceDrawQuad;
|
||||||
public MousePositionWrapper MousePosWrapper;
|
public MousePositionWrapper MousePosWrapper;
|
||||||
public float FlashlightSize;
|
|
||||||
private bool sizeSet;
|
|
||||||
|
|
||||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||||
{
|
{
|
||||||
@ -80,8 +82,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
Shader.Bind();
|
Shader.Bind();
|
||||||
// ReSharper disable once AssignmentInConditionalExpression
|
// ReSharper disable once AssignmentInConditionalExpression
|
||||||
if(sizeSet = !sizeSet)
|
if(MousePosWrapper.FlashlightUniformUpdated = !MousePosWrapper.FlashlightUniformUpdated)
|
||||||
Shader.GetUniform<float>("flashlightSize").UpdateValue(ref FlashlightSize);
|
Shader.GetUniform<float>("flashlightSize").UpdateValue(ref MousePosWrapper.FlashlightSize);
|
||||||
|
|
||||||
Shader.GetUniform<Vector2>("mousePos").UpdateValue(ref MousePosWrapper.MousePosition);
|
Shader.GetUniform<Vector2>("mousePos").UpdateValue(ref MousePosWrapper.MousePosition);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user