Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/database/settings/ISettingsItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public interface ISettingsItem

void SetVariant(Variant variant);

void Reset();

string Id { get; }

Type Type { get; }
Expand Down
2 changes: 2 additions & 0 deletions scripts/database/settings/SettingsItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public void SetVariant(Variant value)
Value = value.As<T>();
}

public void Reset() => Value = DefaultValue;

public Action<T, bool> UpdateAction { get; set; } = null;

public static implicit operator T(SettingsItem<T> item) => item.Value;
Expand Down
27 changes: 27 additions & 0 deletions scripts/database/settings/SettingsProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ public partial class SettingsProfile
[Order]
public SettingsItem<bool> VSyncMenus { get; private set; }

/// <summary>
/// Sets the MSAA value in the viewport
/// </summary>
[Order]
public SettingsItem<string> AntiAliasing { get; private set; }

#endregion

#region Audio
Expand Down Expand Up @@ -1047,6 +1053,27 @@ public SettingsProfile()
},
};

AntiAliasing = new("Off (roughest)")
{
Id = "AntiAliasing",
Title = "Anti Aliasing",
Description = "Smoothes edges, at the cost of performance",
Section = SettingsSection.Video,
UpdateAction = (value, _) =>
{
var root = (Engine.GetMainLoop() as SceneTree)?.Root;
root?.Msaa3D = value switch
{
"Off (roughest)" => Viewport.Msaa.Disabled,
"2x (rough)" => Viewport.Msaa.Msaa2X,
"4x (smooth)" => Viewport.Msaa.Msaa4X,
"8x (smoothest)" => Viewport.Msaa.Msaa8X,
_ => Viewport.Msaa.Disabled,
};
},
List = new("Off (roughest)") { Values = ["Off (roughest)", "2x (rough)", "4x (smooth)", "8x (smoothest)"] },
};

#endregion

#region Audio
Expand Down
10 changes: 9 additions & 1 deletion scripts/database/settings/SettingsProfileConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ public static void Deserialize(string path, SettingsProfile profile)
{
object value = property.GetValue(profile);

if (value is ISettingsItem item && item.SaveToDisk && data.ContainsKey(property.Name))
if (value is not ISettingsItem { SaveToDisk: true } item)
{
continue;
}
if (data.ContainsKey(property.Name))
{
item.SetVariant(data[property.Name]);
}
else
{
item.Reset();
}
}
}
catch (Exception)
Expand Down
8 changes: 5 additions & 3 deletions scripts/shaders/combo_progress.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ void fragment() {
vec2 middle = (points[a] + points[b]) / 2.0;
float dotp = dot(normalize(point_diff), UV - middle);

if (abs(dotp) <= distance(point_diff, vec2(0.0, 0.0)) / 2.0 + thickness && distance(UV, middle + dotp * normalize(point_diff)) <= thickness / 256.0)
{
COLOR = vec4(background_colour.rgb, 1.0);
float dist_to_line = distance(UV, middle + dotp * normalize(point_diff));
float line_alpha = smoothstep((thickness / 256.0) + fwidth(dist_to_line), (thickness / 256.0) - fwidth(dist_to_line), dist_to_line);

if (abs(dotp) <= distance(point_diff, vec2(0.0, 0.0)) / 2.0 + thickness) {
COLOR = mix(COLOR, vec4(background_colour.rgb, 1.0), line_alpha);
}

if (frag_angle <= progress * 360.0)
Expand Down
8 changes: 7 additions & 1 deletion scripts/skinning/SkinManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ private static ImageTexture loadTexture(string skinPath)
}

var image = Image.LoadFromFile(fullPath);
return image != null ? ImageTexture.CreateFromImage(image) : null;
if (image == null)
return null;

image.Convert(Image.Format.Rgba8);
image.GenerateMipmaps();

return ImageTexture.CreateFromImage(image);
}

private static byte[] loadSound(string skinPath)
Expand Down
Loading