2019-12-08 08:50:14 +01:00
|
|
|
[gd_scene load_steps=4 format=2]
|
|
|
|
|
|
|
|
[ext_resource path="res://addons/material_maker/preview/preview_2d.gd" type="Script" id=1]
|
|
|
|
|
|
|
|
[sub_resource type="Shader" id=1]
|
|
|
|
code = "shader_type canvas_item;
|
|
|
|
|
|
|
|
uniform sampler2D tex;
|
2019-12-10 08:00:55 +01:00
|
|
|
uniform vec2 size;
|
2019-12-08 08:50:14 +01:00
|
|
|
|
|
|
|
void fragment() {
|
2019-12-10 08:00:55 +01:00
|
|
|
float ms = max(size.x, size.y);
|
|
|
|
vec2 uv = fract(0.5+1.2*(UV-vec2(0.5))*ms/size.yx);
|
|
|
|
vec2 m2 = min(fract(uv), 1.0-fract(uv));
|
|
|
|
COLOR = mix(texture(tex, uv), vec4(0.0, 1.0, 0.0, 1.0), step(min(m2.x, m2.y), 1.0/min(size.x, size.y)));
|
2019-12-08 08:50:14 +01:00
|
|
|
}"
|
|
|
|
|
|
|
|
[sub_resource type="ShaderMaterial" id=2]
|
|
|
|
shader = SubResource( 1 )
|
2019-12-11 08:02:22 +01:00
|
|
|
shader_param/size = Vector2( 64, 64 )
|
2019-12-08 08:50:14 +01:00
|
|
|
|
|
|
|
[node name="Preview2D" type="ColorRect"]
|
|
|
|
material = SubResource( 2 )
|
|
|
|
anchor_right = 1.0
|
|
|
|
anchor_bottom = 1.0
|
2019-12-11 08:02:22 +01:00
|
|
|
margin_right = -1216.0
|
|
|
|
margin_bottom = -656.0
|
2019-12-08 08:50:14 +01:00
|
|
|
rect_min_size = Vector2( 64, 64 )
|
|
|
|
mouse_filter = 1
|
|
|
|
size_flags_horizontal = 0
|
|
|
|
size_flags_vertical = 8
|
|
|
|
script = ExtResource( 1 )
|
2019-12-10 08:00:55 +01:00
|
|
|
[connection signal="resized" from="." to="." method="on_resized"]
|