-
Notifications
You must be signed in to change notification settings - Fork 19
/
Icon.tscn
59 lines (45 loc) · 1.43 KB
/
Icon.tscn
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[gd_scene load_steps=5 format=2]
[ext_resource path="res://icon.png" type="Texture" id=1]
[ext_resource path="res://Icon.gd" type="Script" id=2]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode cull_back, unshaded;
uniform sampler2D texture_albedo : hint_albedo;
uniform vec2 map_size;
uniform bool map_flipped;
uniform float map_bottom_offset = 36.0;
//uniform float smallest_scale = 0.3;
uniform float smallest_scale = 0.0;
void vertex() {
float dist = max(-MODELVIEW_MATRIX[3].z * smallest_scale, 1.0);
VERTEX = (CAMERA_MATRIX * vec4(VERTEX,0)).xyz * dist;
}
void fragment() {
if (SCREEN_UV.x * VIEWPORT_SIZE.x > VIEWPORT_SIZE.x - map_size.x) {
if (map_flipped && SCREEN_UV.y * VIEWPORT_SIZE.y > VIEWPORT_SIZE.y - map_size.y) {
return;
}
if (!map_flipped && SCREEN_UV.y * VIEWPORT_SIZE.y < map_size.y + map_bottom_offset) {
return;
}
}
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo_tex.rgb;
ALPHA = albedo_tex.a;
}
"
[sub_resource type="ShaderMaterial" id=2]
resource_local_to_scene = true
shader = SubResource( 1 )
shader_param/map_size = null
shader_param/map_flipped = null
shader_param/map_bottom_offset = 36.0
shader_param/smallest_scale = 0.0
shader_param/texture_albedo = ExtResource( 1 )
[node name="Icon" type="Sprite3D"]
material_override = SubResource( 2 )
billboard = 2
double_sided = false
texture = ExtResource( 1 )
script = ExtResource( 2 )