1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 23:52:54 +08:00

Merge pull request #410 from peppy/general-fixes

Add exponential fall-off of triangles' alpha values.
This commit is contained in:
Dean Herbert 2017-03-01 13:08:04 +09:00 committed by GitHub
commit 5bd18ce629
4 changed files with 16 additions and 4 deletions

@ -1 +1 @@
Subproject commit b0613241512e46eed9dc16ae08ed4064d2db4101
Subproject commit 4c0762eec20d2a3063df908a49432326570bea9f

View File

@ -54,9 +54,6 @@
<Reference Include="SQLite.Net.Platform.Generic">
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll</HintPath>
</Reference>
<Reference Include="OpenTK">
<HintPath>$(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1339\lib\net45\OpenTK.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BenchmarkTest.cs" />

View File

@ -14,6 +14,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
public TrianglesPiece()
{
TriangleScale = 1.2f;
HideAlphaDiscrepancies = false;
}
protected override void Update()

View File

@ -10,6 +10,7 @@ using osu.Framework.MathUtils;
using OpenTK;
using OpenTK.Graphics;
using System;
using osu.Framework.Graphics.Colour;
namespace osu.Game.Graphics.Backgrounds
{
@ -37,6 +38,13 @@ namespace osu.Game.Graphics.Backgrounds
private float triangleScale = 1;
/// <summary>
/// Whether we should drop-off alpha values of triangles more quickly to improve
/// the visual appearance of fading. This defaults to on as it is generally more
/// aesthetically pleasing, but should be turned off in <see cref="BufferedContainer{T}"/>s.
/// </summary>
public bool HideAlphaDiscrepancies = true;
public float TriangleScale
{
get { return triangleScale; }
@ -63,8 +71,14 @@ namespace osu.Game.Graphics.Backgrounds
{
base.Update();
float adjustedAlpha = HideAlphaDiscrepancies ?
// Cubically scale alpha to make it drop off more sharply.
(float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) :
1;
foreach (var t in Children)
{
t.Alpha = adjustedAlpha;
t.Position -= new Vector2(0, (float)(t.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale);
if (ExpireOffScreenTriangles && t.DrawPosition.Y + t.DrawSize.Y * t.Scale.Y < 0)
t.Expire();