397 lines
		
	
	
	
		
			12 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			397 lines
		
	
	
	
		
			12 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| [gd_scene load_steps=23 format=3 uid="uid://b761uk7sjprrp"]
 | |
| 
 | |
| [ext_resource type="Shader" path="res://assets/shaders/kaleidoscope.gdshader" id="1_nwvg1"]
 | |
| [ext_resource type="PackedScene" uid="uid://qehbjfkqs5pl" path="res://entities/ParticlesCool.tscn" id="1_yc1r8"]
 | |
| [ext_resource type="PackedScene" uid="uid://br7cnj1spc4rk" path="res://assets/auto_scale.tscn" id="2_7v8f2"]
 | |
| [ext_resource type="Shader" path="res://assets/shaders/pixelsort.gdshader" id="4_v65hu"]
 | |
| [ext_resource type="Shader" path="res://assets/shaders/cromatic-abberation.gdshader" id="5_w16wy"]
 | |
| 
 | |
| [sub_resource type="GDScript" id="GDScript_mtsk5"]
 | |
| script/source = "extends Control
 | |
| 
 | |
| @onready var pass3: TextureRect = $RandomPasses/Pass3/TextureRect;
 | |
| @onready var pass2: TextureRect = $RandomPasses/Pass2/TextureRect;
 | |
| @onready var pass1: TextureRect = $RandomPasses/Pass1/TextureRect;
 | |
| 
 | |
| var materials: Array[ShaderMaterial];
 | |
| 
 | |
| var shaders: Array[Shader];
 | |
| 
 | |
| func _ready() -> void:
 | |
| 	#TODO: FIX RNG SO IT FEELS LESS RANDOM, SO WE DON'T GET THE EXACT SAME SHOW EVERY TIME WE RUN
 | |
| 	
 | |
| 	var shader_dir: DirAccess = DirAccess.open(\"res://assets/shaders/random-pool\");
 | |
| 	shader_dir.list_dir_begin()
 | |
| 	for file: String in shader_dir.get_files():
 | |
| 		# These should probably be preloaded, but who the fuck cares, the demoparty is in 2 days I don't have time for this
 | |
| 		var shader: Shader = load(shader_dir.get_current_dir() + \"/\" + file);
 | |
| 		shader.set_meta(\"shader_name\", file.split(\".gdshader\", false))
 | |
| 		shaders.push_back(shader);
 | |
| 	
 | |
| 	for i: int in 3:
 | |
| 		material = ShaderMaterial.new();
 | |
| 		var shader: Shader = shaders.pick_random();
 | |
| 		material.shader = shader.duplicate();
 | |
| 		
 | |
| 		var shader_name: String = \"\".join(shader.get_meta(\"shader_name\"));
 | |
| 		
 | |
| 		match shader_name:
 | |
| 			\"pixelate\":
 | |
| 				shaders.remove_at(shaders.find(shader, 0));
 | |
| 				print(\"pixelate\")
 | |
| 				material.set_shader_parameter(\"x_pixel_size\", randi_range(1, 5));
 | |
| 				material.set_shader_parameter(\"y_pixel_size\", randi_range(1, 5));
 | |
| 			
 | |
| 			\"cromatic-abberation\":
 | |
| 				print(\"cromatic-abberation\") #Tiiän et täs on typo FFS, en rupee renamaa tiedostoo
 | |
| 				material.set_shader_parameter(\"chaos\", randf_range(10.0, 32.0));
 | |
| 				material.set_shader_parameter(\"radius\", randf_range(0.3, 1.0));
 | |
| 				material.set_shader_parameter(\"attenuation\", randf_range(2.0, 5.0));
 | |
| 			
 | |
| 			\"kaleidoscope\":
 | |
| 				shaders.remove_at(shaders.find(shader, 0));
 | |
| 				print(\"kaleidoscope\")
 | |
| 				material.set_shader_parameter(\"segments\", float(randi_range(3, 5)));
 | |
| 				
 | |
| 			\"pixelsort\":
 | |
| 				shaders.remove_at(shaders.find(shader, 0));
 | |
| 				print(\"pixelsort\")
 | |
| 				material.set_shader_parameter(\"sort\", randf_range(0.1, 2.6));
 | |
| 			
 | |
| 			_:
 | |
| 				print(\"something else\")
 | |
| 				pass
 | |
| 		
 | |
| 		materials.push_back(material);
 | |
| 	
 | |
| 	pass1.material = materials[0];
 | |
| 	pass2.material = materials[1];
 | |
| 	pass3.material = materials[2];
 | |
| 	
 | |
| func _on_timer_timeout() -> void:
 | |
| 	$AnimationPlayer.play(\"kaleidoskope_1\");
 | |
| "
 | |
| 
 | |
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_a6cuy"]
 | |
| shader = ExtResource("1_nwvg1")
 | |
| shader_parameter/segments = 6.0
 | |
| shader_parameter/segmentReflect = true
 | |
| shader_parameter/polarOffset = Vector2(0.5, 0.5)
 | |
| shader_parameter/polarAngle = 0.0
 | |
| shader_parameter/sourceOffset = Vector2(0.5, 0.5)
 | |
| shader_parameter/sourceScale = 2.0
 | |
| shader_parameter/sourceAngle = 0.0
 | |
| 
 | |
| [sub_resource type="ViewportTexture" id="ViewportTexture_1y4ry"]
 | |
| viewport_path = NodePath("SubViewport")
 | |
| 
 | |
| [sub_resource type="Shader" id="Shader_mxtek"]
 | |
| code = "shader_type canvas_item;
 | |
| 
 | |
| uniform bool enabled;
 | |
| uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
 | |
| 
 | |
| 
 | |
| void vertex() {
 | |
| 	// Called for every vertex the material is visible on.
 | |
| }
 | |
| 
 | |
| void fragment() {
 | |
| 	vec4 col = texture(TEXTURE,UV).rgba;
 | |
| 	if (enabled) {
 | |
| 		if (col.a != 0.0) {
 | |
| 			col.a = 0.0;
 | |
| 		}
 | |
| 		else {
 | |
| 			col.a = 1.0;
 | |
| 		}
 | |
| 	}
 | |
| 	else {
 | |
| 		col.a = 0.0;
 | |
| 	}
 | |
| 	COLOR = col;
 | |
| }
 | |
| 
 | |
| //void light() {
 | |
| 	// Called for every pixel for every light affecting the CanvasItem.
 | |
| 	// Uncomment to replace the default light processing function with this one.
 | |
| //}
 | |
| "
 | |
| 
 | |
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_ahqjw"]
 | |
| shader = SubResource("Shader_mxtek")
 | |
| shader_parameter/enabled = null
 | |
| 
 | |
| [sub_resource type="ViewportTexture" id="ViewportTexture_b44mw"]
 | |
| viewport_path = NodePath("TextViewPort")
 | |
| 
 | |
| [sub_resource type="Animation" id="Animation_1yxhh"]
 | |
| length = 0.001
 | |
| tracks/0/type = "value"
 | |
| tracks/0/imported = false
 | |
| tracks/0/enabled = true
 | |
| tracks/0/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/segments")
 | |
| tracks/0/interp = 1
 | |
| tracks/0/loop_wrap = true
 | |
| tracks/0/keys = {
 | |
| "times": PackedFloat32Array(0),
 | |
| "transitions": PackedFloat32Array(1),
 | |
| "update": 0,
 | |
| "values": [6.0]
 | |
| }
 | |
| tracks/1/type = "value"
 | |
| tracks/1/imported = false
 | |
| tracks/1/enabled = true
 | |
| tracks/1/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceAngle")
 | |
| tracks/1/interp = 1
 | |
| tracks/1/loop_wrap = true
 | |
| tracks/1/keys = {
 | |
| "times": PackedFloat32Array(0),
 | |
| "transitions": PackedFloat32Array(1),
 | |
| "update": 0,
 | |
| "values": [0.0]
 | |
| }
 | |
| tracks/2/type = "value"
 | |
| tracks/2/imported = false
 | |
| tracks/2/enabled = true
 | |
| tracks/2/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceOffset")
 | |
| tracks/2/interp = 1
 | |
| tracks/2/loop_wrap = true
 | |
| tracks/2/keys = {
 | |
| "times": PackedFloat32Array(0),
 | |
| "transitions": PackedFloat32Array(1),
 | |
| "update": 0,
 | |
| "values": [Vector2(0.5, 0.5)]
 | |
| }
 | |
| tracks/3/type = "value"
 | |
| tracks/3/imported = false
 | |
| tracks/3/enabled = true
 | |
| tracks/3/path = NodePath("TextMask:material:shader_parameter/enabled")
 | |
| tracks/3/interp = 1
 | |
| tracks/3/loop_wrap = true
 | |
| tracks/3/keys = {
 | |
| "times": PackedFloat32Array(0),
 | |
| "transitions": PackedFloat32Array(1),
 | |
| "update": 1,
 | |
| "values": [null]
 | |
| }
 | |
| 
 | |
| [sub_resource type="Animation" id="Animation_olvxy"]
 | |
| resource_name = "kaleidoskope_1"
 | |
| length = 20.0
 | |
| tracks/0/type = "value"
 | |
| tracks/0/imported = false
 | |
| tracks/0/enabled = true
 | |
| tracks/0/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/segments")
 | |
| tracks/0/interp = 1
 | |
| tracks/0/loop_wrap = true
 | |
| tracks/0/keys = {
 | |
| "times": PackedFloat32Array(0.0333334, 1.06667, 2.1, 3.06667, 4.06667, 5.06667, 6.03333, 7.1, 8.13333, 9.1),
 | |
| "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
 | |
| "update": 1,
 | |
| "values": [4.0, 6.0, 8.0, 10.0, 12.0, 8.0, 4.0, 6.0, 8.0, 6.0]
 | |
| }
 | |
| tracks/1/type = "value"
 | |
| tracks/1/imported = false
 | |
| tracks/1/enabled = true
 | |
| tracks/1/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceAngle")
 | |
| tracks/1/interp = 1
 | |
| tracks/1/loop_wrap = true
 | |
| tracks/1/keys = {
 | |
| "times": PackedFloat32Array(0, 1.03333),
 | |
| "transitions": PackedFloat32Array(1, 1),
 | |
| "update": 0,
 | |
| "values": [0.0, 0.0]
 | |
| }
 | |
| tracks/2/type = "value"
 | |
| tracks/2/imported = false
 | |
| tracks/2/enabled = true
 | |
| tracks/2/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceOffset")
 | |
| tracks/2/interp = 1
 | |
| tracks/2/loop_wrap = true
 | |
| tracks/2/keys = {
 | |
| "times": PackedFloat32Array(0.0333333, 9.1, 11.5333, 15.0667),
 | |
| "transitions": PackedFloat32Array(1, 1, 1, 1),
 | |
| "update": 0,
 | |
| "values": [Vector2(0.5, 0.5), Vector2(0.5, 0.5), Vector2(0.5, 0), Vector2(1, -1)]
 | |
| }
 | |
| tracks/3/type = "value"
 | |
| tracks/3/imported = false
 | |
| tracks/3/enabled = true
 | |
| tracks/3/path = NodePath("TextMask:material:shader_parameter/enabled")
 | |
| tracks/3/interp = 1
 | |
| tracks/3/loop_wrap = true
 | |
| tracks/3/keys = {
 | |
| "times": PackedFloat32Array(0, 11.8),
 | |
| "transitions": PackedFloat32Array(1, 1),
 | |
| "update": 1,
 | |
| "values": [false, true]
 | |
| }
 | |
| 
 | |
| [sub_resource type="AnimationLibrary" id="AnimationLibrary_4qo5x"]
 | |
| _data = {
 | |
| "RESET": SubResource("Animation_1yxhh"),
 | |
| "kaleidoskope_1": SubResource("Animation_olvxy")
 | |
| }
 | |
| 
 | |
| [sub_resource type="LabelSettings" id="LabelSettings_n61ct"]
 | |
| font_size = 104
 | |
| shadow_size = 0
 | |
| 
 | |
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_riy6b"]
 | |
| shader = ExtResource("4_v65hu")
 | |
| shader_parameter/sort = 1.21
 | |
| 
 | |
| [sub_resource type="ViewportTexture" id="ViewportTexture_ff16u"]
 | |
| viewport_path = NodePath("KaleidoViewport")
 | |
| 
 | |
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_wyd4s"]
 | |
| shader = ExtResource("5_w16wy")
 | |
| shader_parameter/chaos = 32.0
 | |
| shader_parameter/radius = 1.0
 | |
| shader_parameter/attenuation = 1.5
 | |
| 
 | |
| [sub_resource type="ViewportTexture" id="ViewportTexture_3bfaj"]
 | |
| viewport_path = NodePath("RandomPasses/Pass1")
 | |
| 
 | |
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_j7uru"]
 | |
| 
 | |
| [sub_resource type="ViewportTexture" id="ViewportTexture_rmol4"]
 | |
| viewport_path = NodePath("RandomPasses/Pass2")
 | |
| 
 | |
| [sub_resource type="ViewportTexture" id="ViewportTexture_wumee"]
 | |
| viewport_path = NodePath("RandomPasses/Pass3")
 | |
| 
 | |
| [node name="KaleidoScope" type="Control"]
 | |
| layout_mode = 3
 | |
| anchors_preset = 15
 | |
| anchor_right = 1.0
 | |
| anchor_bottom = 1.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| script = SubResource("GDScript_mtsk5")
 | |
| 
 | |
| [node name="KaleidoViewport" type="SubViewport" parent="."]
 | |
| size = Vector2i(1152, 648)
 | |
| 
 | |
| [node name="Kaleido" type="TextureRect" parent="KaleidoViewport"]
 | |
| material = SubResource("ShaderMaterial_a6cuy")
 | |
| anchors_preset = 15
 | |
| anchor_right = 1.0
 | |
| anchor_bottom = 1.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| texture = SubResource("ViewportTexture_1y4ry")
 | |
| expand_mode = 2
 | |
| stretch_mode = 6
 | |
| 
 | |
| [node name="AutoScale" parent="KaleidoViewport" instance=ExtResource("2_7v8f2")]
 | |
| 
 | |
| [node name="TextMask" type="TextureRect" parent="."]
 | |
| material = SubResource("ShaderMaterial_ahqjw")
 | |
| layout_mode = 1
 | |
| anchors_preset = 15
 | |
| anchor_right = 1.0
 | |
| anchor_bottom = 1.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| texture = SubResource("ViewportTexture_b44mw")
 | |
| 
 | |
| [node name="SubViewport" type="SubViewport" parent="."]
 | |
| size = Vector2i(1152, 648)
 | |
| 
 | |
| [node name="Camera3D" type="Camera3D" parent="SubViewport"]
 | |
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.31619)
 | |
| 
 | |
| [node name="Node3D" parent="SubViewport" instance=ExtResource("1_yc1r8")]
 | |
| 
 | |
| [node name="AutoScale" parent="SubViewport" instance=ExtResource("2_7v8f2")]
 | |
| 
 | |
| [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
 | |
| transform = Transform3D(1, 0, 0, 0, 0.910979, 0.412453, 0, -0.412453, 0.910979, 0, 0, 0)
 | |
| 
 | |
| [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
 | |
| libraries = {
 | |
| "": SubResource("AnimationLibrary_4qo5x")
 | |
| }
 | |
| 
 | |
| [node name="Timer" type="Timer" parent="."]
 | |
| wait_time = 2.0
 | |
| autostart = true
 | |
| 
 | |
| [node name="TextViewPort" type="SubViewport" parent="."]
 | |
| transparent_bg = true
 | |
| size = Vector2i(1152, 648)
 | |
| 
 | |
| [node name="Label" type="Label" parent="TextViewPort"]
 | |
| visible = false
 | |
| anchors_preset = 8
 | |
| anchor_left = 0.5
 | |
| anchor_top = 0.5
 | |
| anchor_right = 0.5
 | |
| anchor_bottom = 0.5
 | |
| offset_left = -286.0
 | |
| offset_top = -44.0
 | |
| offset_right = 286.0
 | |
| offset_bottom = 44.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| text = "THIS IS SOME TEXT"
 | |
| label_settings = SubResource("LabelSettings_n61ct")
 | |
| 
 | |
| [node name="AutoScale" parent="TextViewPort" instance=ExtResource("2_7v8f2")]
 | |
| 
 | |
| [node name="RandomPasses" type="Control" parent="."]
 | |
| layout_mode = 1
 | |
| anchors_preset = 15
 | |
| anchor_right = 1.0
 | |
| anchor_bottom = 1.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| 
 | |
| [node name="Pass1" type="SubViewport" parent="RandomPasses"]
 | |
| size = Vector2i(1152, 648)
 | |
| 
 | |
| [node name="TextureRect" type="TextureRect" parent="RandomPasses/Pass1"]
 | |
| material = SubResource("ShaderMaterial_riy6b")
 | |
| anchors_preset = 15
 | |
| anchor_right = 1.0
 | |
| anchor_bottom = 1.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| texture = SubResource("ViewportTexture_ff16u")
 | |
| 
 | |
| [node name="AutoScale" parent="RandomPasses/Pass1" instance=ExtResource("2_7v8f2")]
 | |
| 
 | |
| [node name="Pass2" type="SubViewport" parent="RandomPasses"]
 | |
| size = Vector2i(1152, 648)
 | |
| 
 | |
| [node name="TextureRect" type="TextureRect" parent="RandomPasses/Pass2"]
 | |
| material = SubResource("ShaderMaterial_wyd4s")
 | |
| offset_right = 40.0
 | |
| offset_bottom = 40.0
 | |
| texture = SubResource("ViewportTexture_3bfaj")
 | |
| 
 | |
| [node name="AutoScale" parent="RandomPasses/Pass2" instance=ExtResource("2_7v8f2")]
 | |
| 
 | |
| [node name="Pass3" type="SubViewport" parent="RandomPasses"]
 | |
| size = Vector2i(1152, 648)
 | |
| 
 | |
| [node name="TextureRect" type="TextureRect" parent="RandomPasses/Pass3"]
 | |
| material = SubResource("ShaderMaterial_j7uru")
 | |
| offset_right = 40.0
 | |
| offset_bottom = 40.0
 | |
| texture = SubResource("ViewportTexture_rmol4")
 | |
| 
 | |
| [node name="AutoScale" parent="RandomPasses/Pass3" instance=ExtResource("2_7v8f2")]
 | |
| 
 | |
| [node name="Output" type="TextureRect" parent="."]
 | |
| layout_mode = 1
 | |
| anchors_preset = 15
 | |
| anchor_right = 1.0
 | |
| anchor_bottom = 1.0
 | |
| grow_horizontal = 2
 | |
| grow_vertical = 2
 | |
| texture = SubResource("ViewportTexture_wumee")
 | |
| 
 | |
| [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
 |