mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Use new FadeExponent shader uniform
This commit is contained in:
parent
c56f38dcbc
commit
5241029513
@ -5,7 +5,6 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||
@ -31,10 +30,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, OsuConfigManager config)
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Shader = shaders.Load(@"LegacyCursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||
|
||||
Texture = skin.GetTexture("cursortrail");
|
||||
disjointTrail = skin.GetTexture("cursormiddle") == null;
|
||||
|
||||
@ -60,6 +57,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
}
|
||||
|
||||
protected override double FadeDuration => disjointTrail ? 150 : 500;
|
||||
protected override float FadeExponent => 1;
|
||||
|
||||
protected override bool InterpolateMovements => !disjointTrail;
|
||||
|
||||
|
@ -26,11 +26,14 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
{
|
||||
private const int max_sprites = 2048;
|
||||
|
||||
/// <summary>
|
||||
/// An exponentiating factor to ease the trail fade.
|
||||
/// </summary>
|
||||
protected virtual float FadeExponent => 1.7f;
|
||||
|
||||
private readonly TrailPart[] parts = new TrailPart[max_sprites];
|
||||
private int currentIndex;
|
||||
|
||||
protected IShader Shader;
|
||||
|
||||
private IShader shader;
|
||||
private double timeOffset;
|
||||
private float time;
|
||||
|
||||
@ -65,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders)
|
||||
{
|
||||
Shader = shaders.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||
shader = shaders.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -217,10 +220,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
private Texture texture;
|
||||
|
||||
private float time;
|
||||
private float fadeExponent;
|
||||
|
||||
private readonly TrailPart[] parts = new TrailPart[max_sprites];
|
||||
private Vector2 size;
|
||||
|
||||
private Vector2 originPosition;
|
||||
|
||||
private readonly QuadBatch<TexturedTrailVertex> vertexBatch = new QuadBatch<TexturedTrailVertex>(max_sprites, 1);
|
||||
@ -234,10 +237,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
{
|
||||
base.ApplyState();
|
||||
|
||||
shader = Source.Shader;
|
||||
shader = Source.shader;
|
||||
texture = Source.texture;
|
||||
size = Source.partSize;
|
||||
time = Source.time;
|
||||
fadeExponent = Source.FadeExponent;
|
||||
|
||||
originPosition = Vector2.Zero;
|
||||
|
||||
@ -260,6 +264,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
shader.Bind();
|
||||
shader.GetUniform<float>("g_FadeClock").UpdateValue(ref time);
|
||||
shader.GetUniform<float>("g_FadeExponent").UpdateValue(ref fadeExponent);
|
||||
|
||||
texture.TextureGL.Bind();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user