mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Merge branch 'master' into fix-autoplay-tests
This commit is contained in:
commit
101009c92e
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
path = new SmoothPath
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
PathWidth = 1
|
||||
PathRadius = 1
|
||||
},
|
||||
marker = new CircularContainer
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
InternalChild = body = new ManualSliderBody
|
||||
{
|
||||
AccentColour = Color4.Transparent,
|
||||
PathWidth = slider.Scale * 64
|
||||
PathRadius = slider.Scale * 64
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
body.BorderColour = colours.Yellow;
|
||||
|
||||
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||
ScaleBindable.BindValueChanged(scale => body.PathWidth = scale.NewValue * 64, true);
|
||||
ScaleBindable.BindValueChanged(scale => body.PathRadius = scale.NewValue * 64, true);
|
||||
}
|
||||
|
||||
private void updatePosition() => Position = slider.StackedPosition;
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
Body = new SnakingSliderBody(s)
|
||||
{
|
||||
PathWidth = s.Scale * 64,
|
||||
PathRadius = s.Scale * 64,
|
||||
},
|
||||
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
||||
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
||||
@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||
scaleBindable.BindValueChanged(scale =>
|
||||
{
|
||||
Body.PathWidth = scale.NewValue * 64;
|
||||
Body.PathRadius = scale.NewValue * 64;
|
||||
Ball.Scale = new Vector2(scale.NewValue);
|
||||
});
|
||||
|
||||
|
@ -19,10 +19,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
|
||||
private readonly BufferedContainer container;
|
||||
|
||||
public float PathWidth
|
||||
public float PathRadius
|
||||
{
|
||||
get => path.PathWidth;
|
||||
set => path.PathWidth = value;
|
||||
get => path.PathRadius;
|
||||
set => path.PathRadius = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
{
|
||||
private int currentIndex;
|
||||
|
||||
private Shader shader;
|
||||
private IShader shader;
|
||||
private Texture texture;
|
||||
|
||||
private Vector2 size => texture.Size * Scale;
|
||||
@ -35,7 +35,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
public override bool IsPresent => true;
|
||||
|
||||
private readonly TrailDrawNodeSharedData trailDrawNodeSharedData = new TrailDrawNodeSharedData();
|
||||
private const int max_sprites = 2048;
|
||||
|
||||
private readonly TrailPart[] parts = new TrailPart[max_sprites];
|
||||
@ -55,7 +54,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
tNode.Texture = texture;
|
||||
tNode.Size = size;
|
||||
tNode.Time = time;
|
||||
tNode.Shared = trailDrawNodeSharedData;
|
||||
|
||||
for (int i = 0; i < parts.Length; ++i)
|
||||
if (parts[i].InvalidationID > tNode.Parts[i].InvalidationID)
|
||||
@ -81,7 +79,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, TextureStore textures)
|
||||
{
|
||||
shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||
shader = shaders.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||
texture = textures.Get(@"Cursor/cursortrail");
|
||||
Scale = new Vector2(1 / texture.ScaleAdjust);
|
||||
}
|
||||
@ -167,22 +165,18 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
public bool WasUpdated;
|
||||
}
|
||||
|
||||
private class TrailDrawNodeSharedData
|
||||
{
|
||||
public VertexBuffer<TexturedTrailVertex> VertexBuffer;
|
||||
}
|
||||
|
||||
private class TrailDrawNode : DrawNode
|
||||
{
|
||||
public Shader Shader;
|
||||
public IShader Shader;
|
||||
public Texture Texture;
|
||||
|
||||
public float Time;
|
||||
public TrailDrawNodeSharedData Shared;
|
||||
|
||||
public readonly TrailPart[] Parts = new TrailPart[max_sprites];
|
||||
public Vector2 Size;
|
||||
|
||||
private readonly VertexBuffer<TexturedTrailVertex> vertexBuffer = new QuadVertexBuffer<TexturedTrailVertex>(max_sprites, BufferUsageHint.DynamicDraw);
|
||||
|
||||
public TrailDrawNode()
|
||||
{
|
||||
for (int i = 0; i < max_sprites; i++)
|
||||
@ -194,9 +188,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
if (Shared.VertexBuffer == null)
|
||||
Shared.VertexBuffer = new QuadVertexBuffer<TexturedTrailVertex>(max_sprites, BufferUsageHint.DynamicDraw);
|
||||
|
||||
Shader.GetUniform<float>("g_FadeClock").UpdateValue(ref Time);
|
||||
|
||||
int updateStart = -1, updateEnd = 0;
|
||||
@ -218,7 +209,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
new Quad(pos.X - Size.X / 2, pos.Y - Size.Y / 2, Size.X, Size.Y),
|
||||
DrawColourInfo.Colour,
|
||||
null,
|
||||
v => Shared.VertexBuffer.Vertices[end++] = new TexturedTrailVertex
|
||||
v => vertexBuffer.Vertices[end++] = new TexturedTrailVertex
|
||||
{
|
||||
Position = v.Position,
|
||||
TexturePosition = v.TexturePosition,
|
||||
@ -230,24 +221,31 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
}
|
||||
else if (updateStart != -1)
|
||||
{
|
||||
Shared.VertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4);
|
||||
vertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4);
|
||||
updateStart = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Update all remaining vertices that have been changed.
|
||||
if (updateStart != -1)
|
||||
Shared.VertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4);
|
||||
vertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4);
|
||||
|
||||
base.Draw(vertexAction);
|
||||
|
||||
Shader.Bind();
|
||||
|
||||
Texture.TextureGL.Bind();
|
||||
Shared.VertexBuffer.Draw();
|
||||
vertexBuffer.Draw();
|
||||
|
||||
Shader.Unbind();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
vertexBuffer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
@ -113,6 +113,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
|
||||
[TestCase(normal)]
|
||||
[TestCase(marathon)]
|
||||
[Ignore("temporarily disabled pending DeepEqual fix (https://github.com/jamesfoster/DeepEqual/pull/35)")]
|
||||
// Currently fails:
|
||||
// [TestCase(with_sb)]
|
||||
public void TestParity(string beatmap)
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
private readonly SortedList<TriangleParticle> parts = new SortedList<TriangleParticle>(Comparer<TriangleParticle>.Default);
|
||||
|
||||
private Shader shader;
|
||||
private IShader shader;
|
||||
private readonly Texture texture;
|
||||
|
||||
public Triangles()
|
||||
@ -75,7 +75,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders)
|
||||
{
|
||||
shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -180,8 +180,6 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new TrianglesDrawNode();
|
||||
|
||||
private readonly TrianglesDrawNodeSharedData sharedData = new TrianglesDrawNodeSharedData();
|
||||
|
||||
protected override void ApplyDrawNode(DrawNode node)
|
||||
{
|
||||
base.ApplyDrawNode(node);
|
||||
@ -191,27 +189,21 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
trianglesNode.Shader = shader;
|
||||
trianglesNode.Texture = texture;
|
||||
trianglesNode.Size = DrawSize;
|
||||
trianglesNode.Shared = sharedData;
|
||||
|
||||
trianglesNode.Parts.Clear();
|
||||
trianglesNode.Parts.AddRange(parts);
|
||||
}
|
||||
|
||||
private class TrianglesDrawNodeSharedData
|
||||
{
|
||||
public readonly LinearBatch<TexturedVertex2D> VertexBatch = new LinearBatch<TexturedVertex2D>(100 * 3, 10, PrimitiveType.Triangles);
|
||||
}
|
||||
|
||||
private class TrianglesDrawNode : DrawNode
|
||||
{
|
||||
public Shader Shader;
|
||||
public IShader Shader;
|
||||
public Texture Texture;
|
||||
|
||||
public TrianglesDrawNodeSharedData Shared;
|
||||
|
||||
public readonly List<TriangleParticle> Parts = new List<TriangleParticle>();
|
||||
public Vector2 Size;
|
||||
|
||||
private readonly LinearBatch<TexturedVertex2D> vertexBatch = new LinearBatch<TexturedVertex2D>(100 * 3, 10, PrimitiveType.Triangles);
|
||||
|
||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
base.Draw(vertexAction);
|
||||
@ -239,12 +231,19 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
triangle,
|
||||
colourInfo,
|
||||
null,
|
||||
Shared.VertexBatch.AddAction,
|
||||
vertexBatch.AddAction,
|
||||
Vector2.Divide(localInflationAmount, size));
|
||||
}
|
||||
|
||||
Shader.Unbind();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
vertexBatch.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected struct TriangleParticle : IComparable<TriangleParticle>
|
||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Masking = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = path = new SmoothPath { RelativeSizeAxes = Axes.Both, PathWidth = 1 }
|
||||
Child = path = new SmoothPath { RelativeSizeAxes = Axes.Both, PathRadius = 1 }
|
||||
});
|
||||
}
|
||||
|
||||
@ -102,9 +102,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1;
|
||||
float y = GetYPosition(values[i]) * DrawHeight - 1;
|
||||
// the -1 is for inner offset in path (actually -PathWidth)
|
||||
// Make sure that we are accounting for path width when calculating vertex positions
|
||||
// We need to apply 2x the path radius to account for it because the full diameter of the line accounts into height
|
||||
float x = (i + count - values.Length) / (float)(count - 1) * (DrawWidth - 2 * path.PathRadius);
|
||||
float y = GetYPosition(values[i]) * (DrawHeight - 2 * path.PathRadius);
|
||||
path.AddVertex(new Vector2(x, y));
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class Flashlight : Drawable
|
||||
{
|
||||
internal BindableInt Combo;
|
||||
private Shader shader;
|
||||
private IShader shader;
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new FlashlightDrawNode();
|
||||
|
||||
@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
private class FlashlightDrawNode : DrawNode
|
||||
{
|
||||
public Shader Shader;
|
||||
public IShader Shader;
|
||||
public Quad ScreenSpaceDrawQuad;
|
||||
public Vector2 FlashlightPosition;
|
||||
public Vector2 FlashlightSize;
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Screens
|
||||
/// </summary>
|
||||
public class ShaderPrecompiler : Drawable
|
||||
{
|
||||
private readonly List<Shader> loadTargets = new List<Shader>();
|
||||
private readonly List<IShader> loadTargets = new List<IShader>();
|
||||
|
||||
public bool FinishedCompiling { get; private set; }
|
||||
|
||||
@ -106,7 +106,7 @@ namespace osu.Game.Screens
|
||||
loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_3, FragmentShaderDescriptor.TEXTURE));
|
||||
}
|
||||
|
||||
protected virtual bool AllLoaded => loadTargets.All(s => s.Loaded);
|
||||
protected virtual bool AllLoaded => loadTargets.All(s => s.IsLoaded);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private readonly float[] frequencyAmplitudes = new float[256];
|
||||
|
||||
private Shader shader;
|
||||
private IShader shader;
|
||||
private readonly Texture texture;
|
||||
|
||||
public LogoVisualisation()
|
||||
@ -131,8 +131,6 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new VisualisationDrawNode();
|
||||
|
||||
private readonly VisualiserSharedData sharedData = new VisualiserSharedData();
|
||||
|
||||
protected override void ApplyDrawNode(DrawNode node)
|
||||
{
|
||||
base.ApplyDrawNode(node);
|
||||
@ -142,29 +140,23 @@ namespace osu.Game.Screens.Menu
|
||||
visNode.Shader = shader;
|
||||
visNode.Texture = texture;
|
||||
visNode.Size = DrawSize.X;
|
||||
visNode.Shared = sharedData;
|
||||
visNode.Colour = AccentColour;
|
||||
visNode.AudioData = frequencyAmplitudes;
|
||||
}
|
||||
|
||||
private class VisualiserSharedData
|
||||
{
|
||||
public readonly QuadBatch<TexturedVertex2D> VertexBatch = new QuadBatch<TexturedVertex2D>(100, 10);
|
||||
}
|
||||
|
||||
private class VisualisationDrawNode : DrawNode
|
||||
{
|
||||
public Shader Shader;
|
||||
public IShader Shader;
|
||||
public Texture Texture;
|
||||
|
||||
public VisualiserSharedData Shared;
|
||||
|
||||
//Asuming the logo is a circle, we don't need a second dimension.
|
||||
public float Size;
|
||||
|
||||
public Color4 Colour;
|
||||
public float[] AudioData;
|
||||
|
||||
private readonly QuadBatch<TexturedVertex2D> vertexBatch = new QuadBatch<TexturedVertex2D>(100, 10);
|
||||
|
||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
base.Draw(vertexAction);
|
||||
@ -209,7 +201,7 @@ namespace osu.Game.Screens.Menu
|
||||
rectangle,
|
||||
colourInfo,
|
||||
null,
|
||||
Shared.VertexBatch.AddAction,
|
||||
vertexBatch.AddAction,
|
||||
//barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that.
|
||||
Vector2.Divide(inflation, barSize.Yx));
|
||||
}
|
||||
@ -218,6 +210,13 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
Shader.Unbind();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
vertexBatch.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.301.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.307.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,12 +105,12 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.301.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.301.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.307.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.307.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2019.208.0" ExcludeAssets="all" />
|
||||
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2019.307.0" ExcludeAssets="all" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user