taqin/src/Piece.tscn

287 lines
8.1 KiB
Plaintext
Raw Normal View History

2020-05-18 18:48:40 +02:00
[gd_scene load_steps=19 format=2]
2019-11-22 13:38:50 +01:00
[ext_resource path="res://src/Piece.gd" type="Script" id=1]
2020-06-17 17:31:12 +02:00
[ext_resource path="res://assets/artworks/escher_lizards.jpg" type="Texture" id=3]
2019-11-22 13:38:50 +01:00
2020-05-18 18:48:40 +02:00
[sub_resource type="VisualShaderNodeExpression" id=1]
2020-05-06 18:33:23 +02:00
output_port_for_preview = 0
2020-05-07 19:05:14 +02:00
size = Vector2( 657, 584 )
2020-05-06 18:33:23 +02:00
expression = "// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
vec2 rel_p = input.xy - vec2(0.5, 0.5);
2020-05-07 19:05:14 +02:00
float box_size = 0.4;
vec2 box = vec2(box_size, box_size);
vec2 d = abs(rel_p) - box; // mirroring
float dist = length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
alpha_mask = dist < (0.5 - box_size);
float thickness = 0.05;
vec2 box_thick = vec2(box_size, box_size - thickness);
vec2 d_thick = abs(rel_p) - box_thick;
float dist_thick = length(max(d_thick, 0.0)) + min(max(d_thick.x, d_thick.y), 0.0);
is_thickness = rel_p.y > 0.0 && dist_thick > (0.5 - box_size);"
2020-05-18 18:48:40 +02:00
[sub_resource type="VisualShaderNodeColorConstant" id=2]
2020-06-01 18:24:39 +02:00
constant = Color( 0.733333, 0.34902, 0.0666667, 1 )
2020-05-07 19:05:14 +02:00
2020-05-18 18:48:40 +02:00
[sub_resource type="VisualShaderNodeSwitch" id=3]
2020-05-07 19:05:14 +02:00
output_port_for_preview = 0
2020-05-06 18:33:23 +02:00
2020-05-18 18:48:40 +02:00
[sub_resource type="VisualShaderNodeExpression" id=4]
output_port_for_preview = 0
size = Vector2( 545, 407 )
expression = "float speed = 2.0;
float delta = mod(t * speed, 3) - 1.0;
float slope = 1.5;
float thickness = 0.05;
if (abs(input0.x - ((1.0 - input0.y + delta) / slope)) < thickness) {
output0 = vec3(0.5);
}"
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeColorOp" id=5]
2020-05-18 18:48:40 +02:00
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeInput" id=6]
2020-05-18 18:48:40 +02:00
input_name = "time"
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeSwitch" id=7]
2020-05-18 18:48:40 +02:00
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeBooleanUniform" id=8]
2020-05-18 18:48:40 +02:00
uniform_name = "reflection"
2020-06-10 17:15:33 +02:00
[sub_resource type="VisualShaderNodeTextureUniform" id=9]
2019-11-27 13:55:08 +01:00
output_port_for_preview = 0
2020-06-10 17:15:33 +02:00
uniform_name = "artwork"
texture_type = 1
2019-11-27 00:50:35 +01:00
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeInput" id=10]
2019-11-27 13:55:08 +01:00
output_port_for_preview = 0
input_name = "uv"
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeVectorOp" id=11]
2019-11-27 13:55:08 +01:00
output_port_for_preview = 0
2019-11-27 22:25:07 +01:00
default_input_values = [ 0, Vector3( 0, 0, 0 ), 1, Vector3( 0.25, 0.25, 1 ) ]
2019-11-27 13:55:08 +01:00
operator = 2
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeVectorOp" id=12]
2019-11-27 13:55:08 +01:00
default_input_values = [ 0, Vector3( 0, 0, 0 ), 1, Vector3( 0.8, 0.1, 0 ) ]
2019-11-27 00:50:35 +01:00
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeVec3Uniform" id=13]
2019-11-27 13:55:08 +01:00
uniform_name = "scale"
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShaderNodeVec3Uniform" id=14]
2019-11-27 13:55:08 +01:00
uniform_name = "offset"
2020-05-20 17:48:50 +02:00
[sub_resource type="VisualShader" id=15]
2019-11-27 13:55:08 +01:00
code = "shader_type canvas_item;
2020-05-18 18:48:40 +02:00
uniform bool reflection;
2019-11-27 13:55:08 +01:00
uniform vec3 scale;
uniform vec3 offset;
2020-06-10 17:15:33 +02:00
uniform sampler2D artwork : hint_albedo;
2019-11-27 00:50:35 +01:00
2020-05-06 18:33:23 +02:00
2019-11-27 00:50:35 +01:00
void vertex() {
// Output:0
}
void fragment() {
2019-11-27 13:55:08 +01:00
// Input:4
2020-05-06 18:33:23 +02:00
vec3 n_out4p0 = vec3(UV, 0.0);
2019-11-27 13:55:08 +01:00
2020-05-07 19:05:14 +02:00
// Expression:13
bool n_out13p0;
bool n_out13p1;
n_out13p0 = false;
n_out13p1 = false;
{
// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
vec2 rel_p = n_out4p0.xy - vec2(0.5, 0.5);
float box_size = 0.4;
vec2 box = vec2(box_size, box_size);
vec2 d = abs(rel_p) - box; // mirroring
float dist = length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
n_out13p0 = dist < (0.5 - box_size);
float thickness = 0.05;
vec2 box_thick = vec2(box_size, box_size - thickness);
vec2 d_thick = abs(rel_p) - box_thick;
float dist_thick = length(max(d_thick, 0.0)) + min(max(d_thick.x, d_thick.y), 0.0);
n_out13p1 = rel_p.y > 0.0 && dist_thick > (0.5 - box_size);
}
// Color:15
2020-06-01 18:24:39 +02:00
vec3 n_out15p0 = vec3(0.733333, 0.349020, 0.066667);
2020-05-07 19:05:14 +02:00
float n_out15p1 = 1.000000;
2020-05-18 18:48:40 +02:00
// BooleanUniform:24
bool n_out24p0 = reflection;
2019-11-27 13:55:08 +01:00
// VectorUniform:7
2020-05-06 18:33:23 +02:00
vec3 n_out7p0 = scale;
2019-11-27 13:55:08 +01:00
// VectorOp:5
2020-05-06 18:33:23 +02:00
vec3 n_out5p0 = n_out4p0 * n_out7p0;
2019-11-27 13:55:08 +01:00
// VectorUniform:8
2020-05-06 18:33:23 +02:00
vec3 n_out8p0 = offset;
2019-11-27 13:55:08 +01:00
// VectorOp:6
2020-05-06 18:33:23 +02:00
vec3 n_out6p0 = n_out5p0 + n_out8p0;
2019-11-27 13:55:08 +01:00
2020-06-10 17:15:33 +02:00
// TextureUniform:25
vec3 n_out25p0;
float n_out25p1;
{
vec4 n_tex_read = texture(artwork, n_out6p0.xy);
n_out25p0 = n_tex_read.rgb;
n_out25p1 = n_tex_read.a;
}
2020-05-06 18:33:23 +02:00
2020-05-18 18:48:40 +02:00
// Input:22
float n_out22p0 = TIME;
// Expression:19
vec3 n_out19p0;
n_out19p0 = vec3(0.0, 0.0, 0.0);
{
float speed = 2.0;
float delta = mod(n_out22p0 * speed, 3) - 1.0;
float slope = 1.5;
float thickness = 0.05;
if (abs(n_out6p0.x - ((1.0 - n_out6p0.y + delta) / slope)) < thickness) {
n_out19p0 = vec3(0.5);
}
}
// ColorOp:21
2020-06-10 17:15:33 +02:00
vec3 n_out21p0 = vec3(1.0) - (vec3(1.0) - n_out25p0) * (vec3(1.0) - n_out19p0);
2020-05-18 18:48:40 +02:00
// VectorSwitch:23
vec3 n_out23p0;
if(n_out24p0)
{
n_out23p0 = n_out21p0;
}
else
{
2020-06-10 17:15:33 +02:00
n_out23p0 = n_out25p0;
2020-05-18 18:48:40 +02:00
}
2020-05-07 19:05:14 +02:00
// VectorSwitch:17
vec3 n_out17p0;
if(n_out13p1)
2020-05-06 18:33:23 +02:00
{
2020-05-07 19:05:14 +02:00
n_out17p0 = n_out15p0;
}
else
{
2020-05-18 18:48:40 +02:00
n_out17p0 = n_out23p0;
2020-05-06 18:33:23 +02:00
}
2019-11-27 00:50:35 +01:00
// Output:0
2020-05-07 19:05:14 +02:00
COLOR.rgb = n_out17p0;
2020-05-06 18:33:23 +02:00
COLOR.a = n_out13p0 ? 1.0 : 0.0;
2019-11-27 00:50:35 +01:00
}
void light() {
// Output:0
}
"
mode = 1
flags/light_only = false
2020-06-10 17:15:33 +02:00
nodes/fragment/0/position = Vector2( 1680, 260 )
2020-05-20 17:48:50 +02:00
nodes/fragment/4/node = SubResource( 10 )
2020-05-07 19:21:24 +02:00
nodes/fragment/4/position = Vector2( 0, 260 )
2020-05-20 17:48:50 +02:00
nodes/fragment/5/node = SubResource( 11 )
2020-05-07 19:05:14 +02:00
nodes/fragment/5/position = Vector2( 280, -20 )
2020-05-20 17:48:50 +02:00
nodes/fragment/6/node = SubResource( 12 )
2020-05-07 19:05:14 +02:00
nodes/fragment/6/position = Vector2( 540, 140 )
2020-05-20 17:48:50 +02:00
nodes/fragment/7/node = SubResource( 13 )
2020-05-07 19:21:24 +02:00
nodes/fragment/7/position = Vector2( -20, 60 )
2020-05-20 17:48:50 +02:00
nodes/fragment/8/node = SubResource( 14 )
2020-05-07 19:05:14 +02:00
nodes/fragment/8/position = Vector2( 300, 240 )
2020-05-18 18:48:40 +02:00
nodes/fragment/13/node = SubResource( 1 )
2020-05-07 19:21:24 +02:00
nodes/fragment/13/position = Vector2( 340, 400 )
2020-05-07 19:05:14 +02:00
nodes/fragment/13/size = Vector2( 657, 584 )
2020-05-06 18:33:23 +02:00
nodes/fragment/13/input_ports = "0,1,input;"
2020-05-07 19:05:14 +02:00
nodes/fragment/13/output_ports = "0,2,alpha_mask;1,2,is_thickness;"
2020-05-06 18:33:23 +02:00
nodes/fragment/13/expression = "// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
vec2 rel_p = input.xy - vec2(0.5, 0.5);
2020-05-07 19:05:14 +02:00
float box_size = 0.4;
vec2 box = vec2(box_size, box_size);
vec2 d = abs(rel_p) - box; // mirroring
float dist = length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
alpha_mask = dist < (0.5 - box_size);
float thickness = 0.05;
vec2 box_thick = vec2(box_size, box_size - thickness);
vec2 d_thick = abs(rel_p) - box_thick;
float dist_thick = length(max(d_thick, 0.0)) + min(max(d_thick.x, d_thick.y), 0.0);
is_thickness = rel_p.y > 0.0 && dist_thick > (0.5 - box_size);"
2020-05-18 18:48:40 +02:00
nodes/fragment/15/node = SubResource( 2 )
2020-06-10 17:15:33 +02:00
nodes/fragment/15/position = Vector2( 1480, -40 )
2020-05-18 18:48:40 +02:00
nodes/fragment/17/node = SubResource( 3 )
2020-06-10 17:15:33 +02:00
nodes/fragment/17/position = Vector2( 1460, 80 )
2020-05-18 18:48:40 +02:00
nodes/fragment/19/node = SubResource( 4 )
nodes/fragment/19/position = Vector2( 420, -500 )
nodes/fragment/19/size = Vector2( 545, 407 )
nodes/fragment/19/input_ports = "0,1,input0;1,0,t;"
nodes/fragment/19/output_ports = "0,1,output0;"
nodes/fragment/19/expression = "float speed = 2.0;
float delta = mod(t * speed, 3) - 1.0;
float slope = 1.5;
float thickness = 0.05;
if (abs(input0.x - ((1.0 - input0.y + delta) / slope)) < thickness) {
output0 = vec3(0.5);
}"
2020-05-20 17:48:50 +02:00
nodes/fragment/21/node = SubResource( 5 )
2020-06-10 17:15:33 +02:00
nodes/fragment/21/position = Vector2( 1220, -200 )
2020-05-20 17:48:50 +02:00
nodes/fragment/22/node = SubResource( 6 )
2020-05-18 18:48:40 +02:00
nodes/fragment/22/position = Vector2( 160, -300 )
2020-05-20 17:48:50 +02:00
nodes/fragment/23/node = SubResource( 7 )
2020-06-10 17:15:33 +02:00
nodes/fragment/23/position = Vector2( 1200, 20 )
2020-05-20 17:48:50 +02:00
nodes/fragment/24/node = SubResource( 8 )
2020-06-10 17:15:33 +02:00
nodes/fragment/24/position = Vector2( 1200, -60 )
nodes/fragment/25/node = SubResource( 9 )
nodes/fragment/25/position = Vector2( 840, 20 )
nodes/fragment/connections = PoolIntArray( 5, 0, 6, 0, 13, 0, 0, 1, 4, 0, 5, 0, 4, 0, 13, 0, 13, 1, 17, 0, 15, 0, 17, 1, 17, 0, 0, 0, 8, 0, 6, 1, 7, 0, 5, 1, 19, 0, 21, 1, 22, 0, 19, 1, 6, 0, 19, 0, 24, 0, 23, 0, 21, 0, 23, 1, 23, 0, 17, 2, 6, 0, 25, 0, 25, 0, 23, 2, 25, 0, 21, 0 )
2020-05-18 18:48:40 +02:00
2020-05-20 17:48:50 +02:00
[sub_resource type="ShaderMaterial" id=16]
shader = SubResource( 15 )
2020-05-18 18:48:40 +02:00
shader_param/reflection = false
2019-12-02 13:42:02 +01:00
shader_param/scale = Vector3( 0.25, 0.25, 1 )
2020-05-18 18:48:40 +02:00
shader_param/offset = Vector3( 0, 0, 0 )
2020-06-17 17:31:12 +02:00
shader_param/artwork = ExtResource( 3 )
2019-11-27 00:50:35 +01:00
2019-11-25 01:16:06 +01:00
[node name="Piece" type="Node2D"]
2019-11-22 13:38:50 +01:00
script = ExtResource( 1 )
2020-06-17 17:31:12 +02:00
texture = ExtResource( 3 )
2019-11-25 01:16:06 +01:00
2019-11-27 00:50:35 +01:00
[node name="ColorRect" type="ColorRect" parent="."]
2020-05-20 17:48:50 +02:00
material = SubResource( 16 )
2019-11-27 00:50:35 +01:00
anchor_right = 1.0
anchor_bottom = 1.0
2020-05-24 17:14:51 +02:00
margin_right = 160.0
margin_bottom = 160.0
2020-06-03 19:15:38 +02:00
mouse_filter = 2
2020-02-09 17:01:32 +01:00
__meta__ = {
"_edit_use_anchors_": false
}
2019-11-27 00:50:35 +01:00
[node name="Label" type="Label" parent="ColorRect"]
2020-05-06 18:33:23 +02:00
visible = false
2019-11-27 00:50:35 +01:00
margin_left = 10.0
margin_top = 10.0
margin_right = 50.0
margin_bottom = 50.0
rect_scale = Vector2( 3, 3 )
rect_clip_content = true
size_flags_vertical = 1
2019-11-25 01:16:06 +01:00
custom_colors/font_color = Color( 0, 0, 0, 1 )
2019-11-27 00:50:35 +01:00
text = "0"
2020-02-09 17:01:32 +01:00
__meta__ = {
"_edit_use_anchors_": false
}