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
20 changes: 20 additions & 0 deletions prefabs/spaces/solid.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[gd_scene format=3 uid="uid://bloah4i51wdsj"]

[ext_resource type="Script" uid="uid://2onud88s5nkr" path="res://scripts/spaces/Solid.cs" id="1_rw8lf"]

[sub_resource type="Environment" id="Environment_n6lso"]
background_mode = 1
background_color = Color(0.011764706, 0, 0.09019608, 1)
background_energy_multiplier = 1.2
glow_intensity = 1.5
glow_bloom = 0.15

[node name="Squircles" type="Node3D" unique_id=1958332010]
script = ExtResource("1_rw8lf")

[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=495103429]
environment = SubResource("Environment_n6lso")

[node name="Camera3D" type="Camera3D" parent="." unique_id=1770879942]
fov = 50.0
size = 1.25
4 changes: 2 additions & 2 deletions scripts/database/settings/SettingsProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public SettingsProfile()
UpdateAction = (_, init) => { if (!init) { SkinManager.Load(); } },
List = new("skin")
{
Values = ["skin", "void", "grid", "squircles", "waves", "galaxy", "tunnel", "vortex"]
Values = ["skin", "void", "grid", "squircles", "waves", "galaxy", "tunnel", "vortex", "solid"]
}
};

Expand All @@ -550,7 +550,7 @@ public SettingsProfile()
UpdateAction = (_, init) => { if (!init) { SkinManager.Load(); } },
List = new("skin")
{
Values = ["skin", "void", "grid", "squircles", "waves", "galaxy", "tunnel", "vortex"]
Values = ["skin", "void", "grid", "squircles", "waves", "galaxy", "tunnel", "vortex", "solid"]
}
};

Expand Down
81 changes: 81 additions & 0 deletions scripts/spaces/Solid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Godot;

namespace Spaces;

public partial class Solid : BaseSpace
{
private Color defaultEnvironmentColor;

public override void _Ready()
{
base._Ready();


defaultEnvironmentColor = WorldEnvironment.Environment.BackgroundColor;
}

public override void _Process(double delta)
{
base._Process(delta);

if (Playing)
{
updateColor(NoteHitColor);
}
else
{
Viewport viewport = GetViewport();
Vector2 centerOffset = viewport.GetMousePosition() - viewport.GetVisibleRect().Size / 2;

Camera.Position = new Vector3(centerOffset.X, centerOffset.Y, 0) / 40000;
}
}

public override void UpdateMap(Map map)
{
base.UpdateMap(map);

Color color = defaultEnvironmentColor;

if (!Playing && Cover != null)
{
Image coverImage = Cover.GetImage();

if (coverImage.IsCompressed())
{
return;
}

Vector3 avg = Vector3.Zero;
int pixelCount = 0;

for (int x = 0; x < coverImage.GetWidth(); x++)
{
for (int y = 0; y < coverImage.GetHeight(); y++)
{
Color pixel = coverImage.GetPixel(x, y);

if (pixel.A == 0)
{
continue;
}

avg += new Vector3(pixel.R, pixel.G, pixel.B);
pixelCount++;
}
}

avg /= pixelCount;
color = new(avg.X, avg.Y, avg.Z);
}

updateColor(color);
}

private void updateColor(Color color)
{
Color darkened = color.Darkened(0.9f);

WorldEnvironment.Environment.BackgroundColor = Playing ? darkened : (Cover != null ? darkened : defaultEnvironmentColor);
}
}
1 change: 1 addition & 0 deletions scripts/spaces/Solid.cs.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://2onud88s5nkr
Loading