make background (judgement-line) animatable
This commit is contained in:
+14
-8
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://bqh00ot0csqmk"]
|
[gd_scene load_steps=16 format=3 uid="uid://bqh00ot0csqmk"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Scripts/Scenes/Play.cs" id="1_d6iv3"]
|
[ext_resource type="Script" path="res://Scripts/Scenes/Play.cs" id="1_d6iv3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cyetvgmwnoy8l" path="res://Things/HitLine.tscn" id="2_8g6gv"]
|
[ext_resource type="PackedScene" uid="uid://cyetvgmwnoy8l" path="res://Things/Background.tscn" id="2_8g6gv"]
|
||||||
|
[ext_resource type="Shader" path="res://Shaders/Cutout2D.gdshader" id="3_rjbyl"]
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_nefjb"]
|
[sub_resource type="Environment" id="Environment_nefjb"]
|
||||||
ambient_light_source = 1
|
ambient_light_source = 1
|
||||||
@@ -55,6 +56,14 @@ shading_mode = 0
|
|||||||
albedo_texture = SubResource("ViewportTexture_ln6xl")
|
albedo_texture = SubResource("ViewportTexture_ln6xl")
|
||||||
uv1_scale = Vector3(-1, 1, 1)
|
uv1_scale = Vector3(-1, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="ViewportTexture" id="ViewportTexture_w20vk"]
|
||||||
|
viewport_path = NodePath("Mask")
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_80tx5"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("3_rjbyl")
|
||||||
|
shader_parameter/mask = SubResource("ViewportTexture_w20vk")
|
||||||
|
|
||||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_5ymar"]
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_5ymar"]
|
||||||
blend_mode = 3
|
blend_mode = 3
|
||||||
|
|
||||||
@@ -69,10 +78,11 @@ width = 1920
|
|||||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_27qpl"]
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_27qpl"]
|
||||||
blend_mode = 1
|
blend_mode = 1
|
||||||
|
|
||||||
[node name="Play" type="Node" node_paths=PackedStringArray("noteDisplay", "scrollDisplay", "mainViewport", "leftViewport", "rightViewport")]
|
[node name="Play" type="Node" node_paths=PackedStringArray("noteDisplay", "scrollDisplay", "background", "mainViewport", "leftViewport", "rightViewport")]
|
||||||
script = ExtResource("1_d6iv3")
|
script = ExtResource("1_d6iv3")
|
||||||
noteDisplay = NodePath("ViewportView/2D Viewport/Viewport Control/Notes Scroll")
|
noteDisplay = NodePath("ViewportView/2D Viewport/Viewport Control/Notes Scroll")
|
||||||
scrollDisplay = NodePath("ViewportView/2D Viewport/Viewport Control/Holds ViewportView/Holds Viewport/Holds Scroll")
|
scrollDisplay = NodePath("ViewportView/2D Viewport/Viewport Control/Holds ViewportView/Holds Viewport/Holds Scroll")
|
||||||
|
background = NodePath("ViewportView/2D Viewport/Viewport Control/Background")
|
||||||
mainViewport = NodePath("ViewportView/2D Viewport")
|
mainViewport = NodePath("ViewportView/2D Viewport")
|
||||||
leftViewport = NodePath("ViewportView/2D Viewport/Viewport Control/ViewportView Left/Viewport Left")
|
leftViewport = NodePath("ViewportView/2D Viewport/Viewport Control/ViewportView Left/Viewport Left")
|
||||||
rightViewport = NodePath("ViewportView/2D Viewport/Viewport Control/ViewportView Right/Viewport Right")
|
rightViewport = NodePath("ViewportView/2D Viewport/Viewport Control/ViewportView Right/Viewport Right")
|
||||||
@@ -136,6 +146,7 @@ anchor_mode = 0
|
|||||||
editor_draw_screen = false
|
editor_draw_screen = false
|
||||||
|
|
||||||
[node name="Background" parent="ViewportView/2D Viewport/Viewport Control" instance=ExtResource("2_8g6gv")]
|
[node name="Background" parent="ViewportView/2D Viewport/Viewport Control" instance=ExtResource("2_8g6gv")]
|
||||||
|
material = SubResource("ShaderMaterial_80tx5")
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
offset_top = -1920.0
|
offset_top = -1920.0
|
||||||
offset_right = 1920.0
|
offset_right = 1920.0
|
||||||
@@ -162,11 +173,6 @@ offset_bottom = 1920.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="HoldTest" type="Polygon2D" parent="ViewportView/2D Viewport/Viewport Control/Holds ViewportView/Holds Viewport/Holds Scroll"]
|
|
||||||
color = Color(1, 1, 1, 0.921569)
|
|
||||||
antialiased = true
|
|
||||||
polygon = PackedVector2Array(0, 0, 300, 0, 1100, -1920, 800, -1920)
|
|
||||||
|
|
||||||
[node name="Holds Filter" type="TextureRect" parent="ViewportView/2D Viewport/Viewport Control/Holds ViewportView/Holds Viewport"]
|
[node name="Holds Filter" type="TextureRect" parent="ViewportView/2D Viewport/Viewport Control/Holds ViewportView/Holds Viewport"]
|
||||||
material = SubResource("CanvasItemMaterial_5ymar")
|
material = SubResource("CanvasItemMaterial_5ymar")
|
||||||
custom_minimum_size = Vector2(1920, 1920)
|
custom_minimum_size = Vector2(1920, 1920)
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace WacK.Scenes
|
|||||||
public Control noteDisplay;
|
public Control noteDisplay;
|
||||||
[Export]
|
[Export]
|
||||||
public Control scrollDisplay;
|
public Control scrollDisplay;
|
||||||
|
[Export]
|
||||||
|
public Background background;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public Viewport mainViewport;
|
public Viewport mainViewport;
|
||||||
|
|||||||
@@ -17,39 +17,23 @@ namespace WacK.Things.TunnelObjects
|
|||||||
}
|
}
|
||||||
public partial class Background : Node
|
public partial class Background : Node
|
||||||
{
|
{
|
||||||
private bool isReady = false;
|
|
||||||
private float _drawLength;
|
|
||||||
private List<Node3D> segments = new List<Node3D>();
|
|
||||||
private StandardMaterial3D bgMaterial;
|
|
||||||
[Export]
|
[Export]
|
||||||
public float DrawLength
|
private ColorRect firstSegment;
|
||||||
{
|
private List<ColorRect> segments = new(60);
|
||||||
set
|
|
||||||
{
|
|
||||||
_drawLength = value;
|
|
||||||
if (!isReady) return;
|
|
||||||
|
|
||||||
bgMaterial.DistanceFadeMinDistance = _drawLength;
|
|
||||||
bgMaterial.DistanceFadeMaxDistance = 0;
|
|
||||||
foreach (Node segment in segments)
|
|
||||||
{
|
|
||||||
segment.GetChild<Node3D>(1).Scale = new Vector3(1, _drawLength, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get { return _drawLength; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
foreach (Node3D segment in GetChildren())
|
var segmentsNode = FindChild("Segment Masks");
|
||||||
|
segments.Add(firstSegment);
|
||||||
|
for (int i = 1; i < 60; ++i)
|
||||||
{
|
{
|
||||||
segments.Add(segment);
|
var n = (ColorRect)firstSegment.Duplicate();
|
||||||
|
segmentsNode.AddChild(n);
|
||||||
|
segments.Add(n);
|
||||||
|
n.Name = i.ToString();
|
||||||
|
n.SetPosition(new Vector2(i * 1920 / 60, 0));
|
||||||
}
|
}
|
||||||
bgMaterial = (StandardMaterial3D) segments[0].GetChild<CsgPolygon3D>(1).Material;
|
|
||||||
|
|
||||||
isReady = true;
|
|
||||||
// DrawLength = DrawLength;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw in 6/60 frames (0.1s)
|
// draw in 6/60 frames (0.1s)
|
||||||
@@ -59,10 +43,10 @@ namespace WacK.Things.TunnelObjects
|
|||||||
// GD.Print($"{direction} = {state}. Even? {size % 2 == 0}");
|
// GD.Print($"{direction} = {state}. Even? {size % 2 == 0}");
|
||||||
|
|
||||||
double timer = 0;
|
double timer = 0;
|
||||||
double time = 0.1f;
|
double time = .5f;
|
||||||
|
|
||||||
int centerSeg = pos + size/2;
|
int centerSeg = pos + size/2;
|
||||||
while (timer < 0.1f)
|
while (timer < time)
|
||||||
{
|
{
|
||||||
timer = Mathf.Clamp(timer + GetProcessDeltaTime(), 0, time);
|
timer = Mathf.Clamp(timer + GetProcessDeltaTime(), 0, time);
|
||||||
var timerRatio = (float)(timer / time);
|
var timerRatio = (float)(timer / time);
|
||||||
@@ -93,7 +77,7 @@ namespace WacK.Things.TunnelObjects
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
await ToSignal(GetTree(), "idle_frame");
|
await ToSignal(GetTree(), "process_frame");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform sampler2D mask;
|
||||||
|
|
||||||
|
void fragment( )
|
||||||
|
{
|
||||||
|
vec4 mask_color = texture(mask, UV).rgba;
|
||||||
|
vec4 sprite_color = texture(TEXTURE, UV).rgba;
|
||||||
|
|
||||||
|
if (mask_color.a == 0.0)
|
||||||
|
{
|
||||||
|
sprite_color.a = 0.0;
|
||||||
|
}
|
||||||
|
COLOR = sprite_color;
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
[gd_scene load_steps=10 format=3 uid="uid://cyetvgmwnoy8l"]
|
||||||
|
|
||||||
|
[ext_resource type="Shader" path="res://Shaders/Cutout2D.gdshader" id="1_f6ion"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dkohutwp0yujj" path="res://_Assets/Textures/HitLine/BGLine.png" id="1_w0gbp"]
|
||||||
|
[ext_resource type="Script" path="res://Scripts/Things/TunnelObjects/Background.cs" id="2_0fgoc"]
|
||||||
|
|
||||||
|
[sub_resource type="ViewportTexture" id="ViewportTexture_atol7"]
|
||||||
|
viewport_path = NodePath("Segment Masks")
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h3xxm"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("1_f6ion")
|
||||||
|
shader_parameter/mask = SubResource("ViewportTexture_atol7")
|
||||||
|
|
||||||
|
[sub_resource type="ViewportTexture" id="ViewportTexture_oigfv"]
|
||||||
|
viewport_path = NodePath("Segment Masks")
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0uexd"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("1_f6ion")
|
||||||
|
shader_parameter/mask = SubResource("ViewportTexture_oigfv")
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_djnn4"]
|
||||||
|
offsets = PackedFloat32Array(0)
|
||||||
|
colors = PackedColorArray(0.0308856, 0.0596563, 0.141577, 0.894118)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_kn5i7"]
|
||||||
|
gradient = SubResource("Gradient_djnn4")
|
||||||
|
width = 2048
|
||||||
|
|
||||||
|
[node name="Background" type="Control" node_paths=PackedStringArray("firstSegment")]
|
||||||
|
material = SubResource("ShaderMaterial_h3xxm")
|
||||||
|
custom_minimum_size = Vector2(1920, 1920)
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -32.0
|
||||||
|
grow_vertical = 0
|
||||||
|
script = ExtResource("2_0fgoc")
|
||||||
|
firstSegment = NodePath("Segment Masks/0")
|
||||||
|
|
||||||
|
[node name="FullBG" type="SubViewportContainer" parent="."]
|
||||||
|
material = SubResource("ShaderMaterial_0uexd")
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="SubViewport" type="SubViewport" parent="FullBG"]
|
||||||
|
handle_input_locally = false
|
||||||
|
size = Vector2i(1920, 1920)
|
||||||
|
render_target_update_mode = 4
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="FullBG/SubViewport"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -1920.0
|
||||||
|
offset_right = 1920.0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="DarkBG" type="TextureRect" parent="FullBG/SubViewport/Control"]
|
||||||
|
custom_minimum_size = Vector2(1920, 1920)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("GradientTexture1D_kn5i7")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="HitLine" type="Control" parent="FullBG/SubViewport/Control"]
|
||||||
|
custom_minimum_size = Vector2(1920, 32)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -40.0
|
||||||
|
offset_right = 1920.0
|
||||||
|
offset_bottom = -8.0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="Reverse" type="Control" parent="FullBG/SubViewport/Control/HitLine"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Line" type="TextureRect" parent="FullBG/SubViewport/Control/HitLine/Reverse"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("1_w0gbp")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="Line2" type="TextureRect" parent="FullBG/SubViewport/Control/HitLine/Reverse"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
texture = ExtResource("1_w0gbp")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="Segment Masks" type="SubViewport" parent="."]
|
||||||
|
transparent_bg = true
|
||||||
|
size = Vector2i(1920, 1920)
|
||||||
|
|
||||||
|
[node name="0" type="ColorRect" parent="Segment Masks"]
|
||||||
|
offset_right = 32.0
|
||||||
|
offset_bottom = 1920.0
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://cyetvgmwnoy8l"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dkohutwp0yujj" path="res://_Assets/Textures/HitLine/BGLine.png" id="1_w0gbp"]
|
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_djnn4"]
|
|
||||||
offsets = PackedFloat32Array(0)
|
|
||||||
colors = PackedColorArray(0.0308856, 0.0596563, 0.141577, 0.894118)
|
|
||||||
|
|
||||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_kn5i7"]
|
|
||||||
gradient = SubResource("Gradient_djnn4")
|
|
||||||
width = 2048
|
|
||||||
|
|
||||||
[node name="Background" type="Control"]
|
|
||||||
custom_minimum_size = Vector2(1920, 1920)
|
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 2
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_top = -32.0
|
|
||||||
grow_vertical = 0
|
|
||||||
|
|
||||||
[node name="DarkBG" type="TextureRect" parent="."]
|
|
||||||
custom_minimum_size = Vector2(1920, 1920)
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 2
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_right = 1920.0
|
|
||||||
offset_bottom = 1920.0
|
|
||||||
grow_vertical = 0
|
|
||||||
rotation = -1.5708
|
|
||||||
texture = SubResource("GradientTexture1D_kn5i7")
|
|
||||||
expand_mode = 1
|
|
||||||
|
|
||||||
[node name="HitLine" type="Control" parent="."]
|
|
||||||
custom_minimum_size = Vector2(1920, 32)
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 2
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_top = -32.0
|
|
||||||
offset_right = 1920.0
|
|
||||||
grow_vertical = 0
|
|
||||||
|
|
||||||
[node name="Reverse" type="Control" parent="HitLine"]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
|
|
||||||
[node name="Line" type="TextureRect" parent="HitLine/Reverse"]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = -1
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_vertical = 2
|
|
||||||
texture = ExtResource("1_w0gbp")
|
|
||||||
expand_mode = 1
|
|
||||||
|
|
||||||
[node name="Line2" type="TextureRect" parent="HitLine/Reverse"]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = -1
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 0
|
|
||||||
texture = ExtResource("1_w0gbp")
|
|
||||||
expand_mode = 1
|
|
||||||
Reference in New Issue
Block a user