diff --git a/scenes/bip/bip.tscn b/scenes/bip/bip.tscn index c296aff8..861cc7f8 100644 --- a/scenes/bip/bip.tscn +++ b/scenes/bip/bip.tscn @@ -7,6 +7,7 @@ [sub_resource type="ShaderMaterial" id="ShaderMaterial_2dulj"] shader = ExtResource("2_rt0la") shader_parameter/tick_update = 0.0 +shader_parameter/color = Color(0.972549, 0.12549, 0.411765, 1) [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_w5pye"] @@ -233,6 +234,7 @@ layout_mode = 0 offset_right = 1.0 offset_bottom = 1.0 scale = Vector2(20, 20) +action_mode = 0 button_mask = 3 texture_normal = SubResource("PlaceholderTexture2D_w5pye") stretch_mode = 3 diff --git a/shaders/bip.gdshader b/shaders/bip.gdshader index 17eb2315..b617d0fc 100644 --- a/shaders/bip.gdshader +++ b/shaders/bip.gdshader @@ -4,9 +4,7 @@ shader_type canvas_item; /* Закрашенная окружность */ uniform float tick_update = 0.0; /* Время последнего обновления, мс */ -const float red_channel = 0.972549; -const float green_channel = 0.12549; -const float blue_channel = 0.411765; +uniform vec3 color : source_color = vec3(0.972549, 0.12549, 0.411765); const float time_delta = 0.5; /* Время вспышки при обновлении, c */ const float ds = 0.01; /* Относительное расстояние на котором выполняется сглаживание краёв */ const vec2 center = vec2(0.125, 0.125); /* Центр должен быть в (0.5, 0.5), но это не так */ @@ -16,12 +14,10 @@ const float alpha_main = 1.0; void fragment() { - float time_now = TIME; float alpha = 0.0; - if ((time_now - tick_update) < time_delta) + if ((TIME - tick_update) < time_delta) { - alpha = time_delta - (time_now - tick_update) * alpha_offset; + alpha = time_delta - (TIME - tick_update) * alpha_offset; } - vec4 color = vec4(red_channel, green_channel, blue_channel, alpha_main - alpha); - COLOR = color * smooth_px(length(UV - center), radius, ds); + COLOR = vec4(color, alpha_main - alpha) * smooth_px(length(UV - center), radius, ds); }