2020-02-12 08:15:40 +01:00
|
|
|
[gd_scene load_steps=4 format=2]
|
2019-12-08 08:50:14 +01:00
|
|
|
|
2020-01-25 15:20:08 +01:00
|
|
|
[ext_resource path="res://material_maker/preview/preview_2d.gd" type="Script" id=1]
|
|
|
|
|
2019-12-08 08:50:14 +01:00
|
|
|
[sub_resource type="Shader" id=1]
|
|
|
|
|
|
|
|
[sub_resource type="ShaderMaterial" id=2]
|
2020-02-28 08:41:17 +01:00
|
|
|
resource_local_to_scene = true
|
2019-12-08 08:50:14 +01:00
|
|
|
shader = SubResource( 1 )
|
|
|
|
|
2020-03-13 07:50:04 +01:00
|
|
|
[node name="Preview2D" type="ColorRect" groups=[
|
|
|
|
"preview",
|
|
|
|
]]
|
2019-12-08 08:50:14 +01:00
|
|
|
material = SubResource( 2 )
|
|
|
|
anchor_right = 1.0
|
|
|
|
anchor_bottom = 1.0
|
2020-02-12 08:15:40 +01:00
|
|
|
margin_right = -695.0
|
|
|
|
margin_bottom = -228.0
|
2019-12-08 08:50:14 +01:00
|
|
|
rect_min_size = Vector2( 64, 64 )
|
2019-12-27 22:30:49 +01:00
|
|
|
rect_clip_content = true
|
2019-12-08 08:50:14 +01:00
|
|
|
mouse_filter = 1
|
|
|
|
size_flags_horizontal = 0
|
|
|
|
size_flags_vertical = 8
|
|
|
|
script = ExtResource( 1 )
|
2020-02-10 23:13:10 +01:00
|
|
|
__meta__ = {
|
|
|
|
"_edit_use_anchors_": false
|
|
|
|
}
|
2020-03-13 07:50:04 +01:00
|
|
|
shader = "uniform vec2 size;
|
|
|
|
|
|
|
|
void fragment() {
|
|
|
|
float ms = max(size.x, size.y);
|
|
|
|
vec2 uv = fract(0.5+1.2*(UV-vec2(0.5))*ms/size.yx);
|
|
|
|
float is = min(size.x, size.y)/1.2;
|
|
|
|
vec2 m2 = min(fract(uv), 1.0-fract(uv));
|
|
|
|
vec4 image = preview_2d(uv);
|
|
|
|
vec3 image_with_background = mix(vec3(mod(floor(uv.x*32.0)+floor(uv.y*32.0), 2.0)), image.xyz, image.a);
|
|
|
|
float lines_color = 0.5*(cos(5.0*TIME+100.0*(uv.x+uv.y))+1.0);
|
|
|
|
COLOR = vec4(mix(image_with_background, vec3(lines_color), step(is*min(m2.x, m2.y), 1.0)), 1.0);
|
|
|
|
}"
|
2019-12-10 08:00:55 +01:00
|
|
|
[connection signal="resized" from="." to="." method="on_resized"]
|