Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/nuget/NUnit3TestAdapter-4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 authored Oct 8, 2023
2 parents 5cb7827 + 28ce2e6 commit 6ad3541
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2022.1.1",
"version": "2023.2.2",
"commands": [
"jb"
]
},
"nvika": {
"version": "2.2.0",
"version": "3.0.0",
"commands": [
"nvika"
]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

*An [osu!](https://github.com/ppy/osu) ruleset. Sweeping beats with your scythe.*

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/V7V6NE9ZK)

</div>

[Original](https://deadlysprinklez.itch.io/tau) idea belonging to *pizzapip* and *[DeadlySprinklez](https://github.com/DeadlySprinklez)*.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="ppy.osu.Game" Version="2023.605.0" />
<PackageReference Include="ppy.osu.Game" Version="2023.914.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu.Game.Rulesets.Tau\osu.Game.Rulesets.Tau.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public record struct SliderTexturedVertex2D : IVertex
private Vector2 drawSize;
private float radius;
private IShader shader;
private IShader maskShader;

private IUniformBuffer<SliderUniform> shaderData;
private IUniformBuffer<MaskUniform> maskData;

[StructLayout(LayoutKind.Sequential, Pack = 1)]
private record struct SliderUniform
Expand All @@ -79,14 +77,6 @@ private record struct SliderUniform
private UniformPadding4 _p4;
}

[StructLayout(LayoutKind.Sequential, Pack = 1)]
private record struct MaskUniform
{
public UniformBool WriteDepth;

private UniformPadding12 _p1;
}

// We multiply the size param by 3 such that the amount of vertices is a multiple of the amount of vertices
// per primitive (triangles in this case). Otherwise overflowing the batch will result in wrong
// grouping of vertices into primitives.
Expand Down Expand Up @@ -128,7 +118,6 @@ public override void ApplyState()
drawSize = Source.DrawSize;
radius = Source.PathRadius;
shader = Source.hitFadeTextureShader;
maskShader = Source.depthMaskShader;

var center = Source.PositionInBoundingBox(Vector2.Zero);
var edge = Source.PositionInBoundingBox(new Vector2(Source.PathDistance, 0));
Expand Down Expand Up @@ -360,55 +349,47 @@ public override void Draw(IRenderer renderer)
Reverse = reverse
};

maskData ??= renderer.CreateUniformBuffer<MaskUniform>();
//maskData ??= renderer.CreateUniformBuffer<MaskUniform>();

halfCircleBatch ??= renderer.CreateLinearBatch<SliderTexturedVertex2D>(max_resolution * 100 * 3, 10, PrimitiveTopology.Triangles);
quadBatch ??= renderer.CreateQuadBatch<SliderTexturedVertex2D>(200, 10);

if (texture?.Available != true || segments.Length == 0)
return;

renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: BufferTestFunction.Always));
maskData.Data = maskData.Data with { WriteDepth = true };
maskShader.Bind();
maskShader.BindUniformBlock("m_maskParameters", maskData);
shader.Bind();
shader.BindUniformBlock("m_sliderParameters", shaderData);

renderer.PushStencilInfo(new StencilInfo(stencilTest: true, testValue: 255, testFunction: BufferTestFunction.Always, passed: StencilOperation.Replace));

foreach (var i in innerTicks)
{
renderer.DrawQuad(renderer.WhitePixel, i, Color4.Transparent);
}

maskShader.Unbind();
renderer.PopDepthInfo();
renderer.PopStencilInfo();
renderer.PushStencilInfo(new StencilInfo(stencilTest: true, testValue: 255, testFunction: BufferTestFunction.NotEqual, passed: StencilOperation.Keep));

shader.Bind();
shader.BindUniformBlock("m_sliderParameters", shaderData);
texture.Bind();

updateVertexBuffer();

shader.Unbind();

renderer.PushDepthInfo(new DepthInfo(depthTest: true, writeDepth: true, function: BufferTestFunction.Always));
maskData.Data = maskData.Data with { WriteDepth = false };
maskShader.Bind();
maskShader.BindUniformBlock("m_maskParameters", maskData);

// not needed right now, but it clears the stencil mask
renderer.PushStencilInfo(new StencilInfo(stencilTest: true, testValue: 0, testFunction: BufferTestFunction.Always, passed: StencilOperation.Replace));
foreach (var i in innerTicks)
{
renderer.DrawQuad(renderer.WhitePixel, i, Color4.Transparent);
}
renderer.PopStencilInfo();

maskShader.Unbind();
renderer.PopDepthInfo();
renderer.PopStencilInfo();
shader.Unbind();
}

protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);

shaderData?.Dispose();
maskData?.Dispose();
halfCircleBatch?.Dispose();
quadBatch?.Dispose();
segments.Dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ private static Texture generateSmoothPathTexture(IRenderer renderer, float radiu
public partial class SliderPath : Drawable
{
public IEnumerable<DrawableSliderRepeat> Ticks = Array.Empty<DrawableSliderRepeat>();
private IShader depthMaskShader { get; set; }
private IShader hitFadeTextureShader { get; set; }

private readonly List<Vector3> vertices = new();
Expand Down Expand Up @@ -220,7 +219,6 @@ private void load(IRenderer renderer, ShaderManager shaders)
{
texture = renderer.WhitePixel;

depthMaskShader = shaders.Load("DepthMask", "DepthMask");
hitFadeTextureShader = shaders.Load("SliderPositionAndColour", "Slider");
}

Expand Down
32 changes: 0 additions & 32 deletions osu.Game.Rulesets.Tau/Resources/Shaders/sh_DepthMask.fs

This file was deleted.

6 changes: 0 additions & 6 deletions osu.Game.Rulesets.Tau/Resources/Shaders/sh_DepthMask.vs

This file was deleted.

16 changes: 8 additions & 8 deletions osu.Game.Rulesets.Tau/Resources/Shaders/sh_VisualizerFade.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
layout(location = 5) in highp vec2 v_Position;
layout(location = 2) in mediump vec2 v_TexCoord;

layout(std140, set = 0, binding = 0) uniform m_visualizerParameters {
layout(std140, set = 1, binding = 0) uniform m_visualizerParameters {
highp vec2 centerPos;
highp float range;
highp float fadeRange;
};

layout(set = 0, binding = 1) uniform lowp texture2D m_texture;
layout(set = 0, binding = 2) uniform lowp sampler m_sampler;
layout(set = 0, binding = 0) uniform lowp texture2D m_texture;
layout(set = 0, binding = 1) uniform lowp sampler m_sampler;

layout(location = 0) out vec4 o_colour;

void main(void)
void main(void)
{
vec2 diff = v_Position - centerPos;
float dist = sqrt(diff.x * diff.x + diff.y * diff.y);

if ( dist <= range )
if ( dist <= range )
{
discard;
}
else
}
else
{
vec2 wrappedCoord = wrap(v_TexCoord, v_TexRect);
vec4 colour = getRoundedColor(wrappedSampler(wrappedCoord, v_TexRect, m_texture, m_sampler, -0.9), wrappedCoord);
float progress = (fadeRange == 0.0) ? 1.0 : (abs(dist - range) / fadeRange);
o_colour = vec4(colour.xyz, min(mix(0.0, colour.w, progress), colour.w));
}
}
}
6 changes: 1 addition & 5 deletions osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Shaders\sh_DepthMask.fs" />
<None Remove="Resources\Shaders\sh_DepthMask.vs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game" Version="2023.605.0" />
<PackageReference Include="ppy.osu.Game" Version="2023.914.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Objects\Drawables\DrawableSlider.Calculations.cs">
Expand Down

0 comments on commit 6ad3541

Please sign in to comment.