taqin/src/Piece.tscn

167 lines
4.6 KiB
Plaintext
Raw Normal View History

2020-05-06 18:33:23 +02:00
[gd_scene load_steps=14 format=2]
2019-11-22 13:38:50 +01:00
[ext_resource path="res://src/Piece.gd" type="Script" id=1]
2019-11-27 13:55:08 +01:00
[ext_resource path="res://assets/escher_lizards.jpg" type="Texture" id=2]
2019-11-22 13:38:50 +01:00
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeVec3Constant" id=1]
2019-11-27 22:25:07 +01:00
constant = Vector3( 0.3, 0.3, 0 )
2020-05-06 18:33:23 +02:00
[sub_resource type="VisualShaderNodeExpression" id=12]
output_port_for_preview = 0
size = Vector2( 620, 395 )
expression = "// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
vec2 rel_p = input.xy - vec2(0.5, 0.5);
float box = 0.4;
vec2 d = abs(rel_p) - vec2(box, box); // mirroring
float dist = length(max(d, 0.0)) + min(max(d.x,d.y), 0.0);
alpha_mask = dist < (0.5 - box);"
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeTexture" id=2]
2019-11-27 13:55:08 +01:00
output_port_for_preview = 0
texture = ExtResource( 2 )
2019-11-27 00:50:35 +01:00
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeInput" id=3]
2019-11-27 13:55:08 +01:00
output_port_for_preview = 0
input_name = "uv"
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeVectorOp" id=4]
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
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeVectorOp" id=5]
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
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeVec3Uniform" id=6]
2019-11-27 13:55:08 +01:00
uniform_name = "scale"
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeVec3Uniform" id=7]
2019-11-27 13:55:08 +01:00
uniform_name = "offset"
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShaderNodeVec3Constant" id=8]
2019-11-27 22:25:07 +01:00
constant = Vector3( 0.25, 0.25, 1 )
2019-12-02 13:42:02 +01:00
[sub_resource type="VisualShader" id=9]
2019-11-27 13:55:08 +01:00
code = "shader_type canvas_item;
uniform vec3 scale;
uniform vec3 offset;
uniform sampler2D tex_frg_3;
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
// 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
// Texture:3
2020-05-06 18:33:23 +02:00
vec4 tex_frg_3_read = texture(tex_frg_3, n_out6p0.xy);
vec3 n_out3p0 = tex_frg_3_read.rgb;
float n_out3p1 = tex_frg_3_read.a;
// Expression:13
bool n_out13p0;
n_out13p0 = false;
{
// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
vec2 rel_p = n_out4p0.xy - vec2(0.5, 0.5);
float box = 0.4;
vec2 d = abs(rel_p) - vec2(box, box); // mirroring
float dist = length(max(d, 0.0)) + min(max(d.x,d.y), 0.0);
n_out13p0 = dist < (0.5 - box);
}
2019-11-27 00:50:35 +01:00
// Output:0
2019-11-27 13:55:08 +01:00
COLOR.rgb = n_out3p0;
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
}
"
2020-05-06 18:33:23 +02:00
graph_offset = Vector2( -213.196, 77.3248 )
2019-11-27 00:50:35 +01:00
mode = 1
flags/light_only = false
2020-05-06 18:33:23 +02:00
nodes/fragment/0/position = Vector2( 1120, 360 )
2019-12-02 13:42:02 +01:00
nodes/fragment/3/node = SubResource( 2 )
2019-11-27 13:55:08 +01:00
nodes/fragment/3/position = Vector2( 820, 120 )
2019-12-02 13:42:02 +01:00
nodes/fragment/4/node = SubResource( 3 )
2020-05-06 18:33:23 +02:00
nodes/fragment/4/position = Vector2( -120, 360 )
2019-12-02 13:42:02 +01:00
nodes/fragment/5/node = SubResource( 4 )
2019-11-27 22:25:07 +01:00
nodes/fragment/5/position = Vector2( 360, 80 )
2019-12-02 13:42:02 +01:00
nodes/fragment/6/node = SubResource( 5 )
2019-11-27 22:25:07 +01:00
nodes/fragment/6/position = Vector2( 620, 240 )
2019-12-02 13:42:02 +01:00
nodes/fragment/7/node = SubResource( 6 )
2020-05-06 18:33:23 +02:00
nodes/fragment/7/position = Vector2( 80, 60 )
2019-12-02 13:42:02 +01:00
nodes/fragment/8/node = SubResource( 7 )
2020-05-06 18:33:23 +02:00
nodes/fragment/8/position = Vector2( 380, 340 )
2019-12-02 13:42:02 +01:00
nodes/fragment/9/node = SubResource( 8 )
2020-05-06 18:33:23 +02:00
nodes/fragment/9/position = Vector2( -80, 120 )
2019-12-02 13:42:02 +01:00
nodes/fragment/11/node = SubResource( 1 )
2020-05-06 18:33:23 +02:00
nodes/fragment/11/position = Vector2( 220, 400 )
nodes/fragment/13/node = SubResource( 12 )
nodes/fragment/13/position = Vector2( 260, 540 )
nodes/fragment/13/size = Vector2( 620, 395 )
nodes/fragment/13/input_ports = "0,1,input;"
nodes/fragment/13/output_ports = "0,2,alpha_mask;"
nodes/fragment/13/expression = "// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
vec2 rel_p = input.xy - vec2(0.5, 0.5);
float box = 0.4;
vec2 d = abs(rel_p) - vec2(box, box); // mirroring
float dist = length(max(d, 0.0)) + min(max(d.x,d.y), 0.0);
alpha_mask = dist < (0.5 - box);"
nodes/fragment/connections = PoolIntArray( 3, 0, 0, 0, 5, 0, 6, 0, 6, 0, 3, 0, 13, 0, 0, 1, 4, 0, 5, 0, 4, 0, 13, 0, 8, 0, 6, 1, 7, 0, 5, 1 )
2019-11-27 13:55:08 +01:00
2019-12-02 13:42:02 +01:00
[sub_resource type="ShaderMaterial" id=10]
shader = SubResource( 9 )
shader_param/scale = Vector3( 0.25, 0.25, 1 )
shader_param/offset = Vector3( 0, 0, 0 )
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 )
2019-12-03 13:50:42 +01:00
size = 64
2019-11-25 01:16:06 +01:00
2019-11-27 00:50:35 +01:00
[node name="ColorRect" type="ColorRect" parent="."]
2019-12-02 13:42:02 +01:00
material = SubResource( 10 )
2019-11-27 00:50:35 +01:00
anchor_right = 1.0
anchor_bottom = 1.0
2019-11-27 13:55:08 +01:00
margin_right = 64.0
margin_bottom = 64.0
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
}