-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathIcon2D.tscn
More file actions
29 lines (23 loc) · 871 Bytes
/
Copy pathIcon2D.tscn
File metadata and controls
29 lines (23 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Icon2D.gd" type="Script" id=1]
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
render_mode unshaded,blend_mix;
uniform vec2 minimap_corner;
uniform vec2 minimap_corner2;
void fragment() {
COLOR = vec4(0,0,0,0);
vec2 screen_pixel_size = vec2(textureSize(SCREEN_TEXTURE, 0));
vec2 screen_pixel = SCREEN_UV * screen_pixel_size;
if (screen_pixel.x > minimap_corner.x && screen_pixel.x < minimap_corner2.x
&& screen_pixel.y > minimap_corner.y && screen_pixel.y < minimap_corner2.y) {
COLOR = texture(TEXTURE, vec2(UV.y, -UV.x));
}
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/minimap_corner = Vector2( 0, 0 )
shader_param/minimap_corner2 = Vector2( 0, 0 )
[node name="Icon2D" type="Sprite"]
material = SubResource( 2 )
script = ExtResource( 1 )