Доработка, добавленототметок целей взятых на сопровождение и рекомендованных целей.

This commit is contained in:
MaD_CaT
2023-11-02 15:50:12 +03:00
parent c6b3ed55e2
commit 668a9cdc5b
10 changed files with 355 additions and 62 deletions

View File

@@ -1,4 +1,4 @@
extends TextureButton
extends Control
# Called when the node enters the scene tree for the first time.

View File

@@ -1,37 +1,169 @@
[gd_scene load_steps=5 format=3 uid="uid://nl1vklubr5kr"]
[gd_scene load_steps=12 format=3 uid="uid://nl1vklubr5kr"]
[ext_resource type="Shader" path="res://shaders/bip_test.gdshader" id="1_qbah6"]
[ext_resource type="Script" path="res://scenes/bip.gd" id="2_77mbp"]
[ext_resource type="Script" path="res://scenes/bip.gd" id="1_23kyy"]
[ext_resource type="Shader" path="res://shaders/bip.gdshader" id="2_w4jcf"]
[ext_resource type="Shader" path="res://shaders/tracked.gdshader" id="3_d16rn"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2dulj"]
shader = ExtResource("1_qbah6")
shader_parameter/color = Color(1, 0.101961, 0.494118, 1)
shader = ExtResource("2_w4jcf")
shader_parameter/color = Color(0.972549, 0.12549, 0.411765, 1)
shader_parameter/color_up = Color(1, 1, 1, 1)
shader_parameter/tick_update = 0
shader_parameter/width = 59.5
shader_parameter/band = 0.045
shader_parameter/sec_radius = 0.08
shader_parameter/dir = 0.0
shader_parameter/inner_clip = 0.055
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_w5pye"]
[sub_resource type="Shader" id="Shader_60ho7"]
code = "shader_type canvas_item;
uniform vec4 color: source_color = vec4(1, 1, 1, 1);
uniform vec4 color_up: source_color = vec4(1, 1, 1, 1); /* Цвет вспышки при обновлении */
const float ds = 0.00725; /* Относительное расстояние на котором выполняется сглаживание краёв */
const float dsr = 6.125;
const vec2 center = vec2(0.5, 0.5); /* Центр должен быть в (0.5, 0.5), но это не так */
const float radius = 0.075 - ds * 2.0; /* Радиус должен быть 0.5, но это не так */
uniform float speed: hint_range(-1024.0, 1024.0) = 0.0; /* Время вспышки при обновлении, c */
uniform int ant_band_count_0 = 3;
const float ant_band_r0_0 = 0.3;
const float ant_band_r1_0 = 0.4;
float smooth_px(float r, float R, float dss)
{
return 1.0 - smoothstep(R - dss, R + dss, r);
}
void sector(inout vec4 c, vec2 uv, vec2 cnt, float a, float da, float r0, float r1, vec4 col)
{
float l = distance(cnt, uv);
vec2 d = uv - cnt;
float sf = 500.0;
float theta = atan(d.x, d.y) * sf;
da /= 2.0;
float a0 = radians(a - da);
float a1 = radians(a + da);
float va = smooth_px(a0 * sf, theta, dsr) - smooth_px(a1 * sf, theta, dsr);
float vr = smooth_px(r0, l, ds) - smooth_px(r1, l, ds);
float rgb = sqrt(va * vr);
c.rgb += col.rgb * rgb * col.a;
c.a += rgb * col.a;
}
void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, vec4 c0, vec4 c1)
{
float da = 180.0f / float(cnt);
for (int i = -cnt; i <= cnt; i ++)
{
float v = float(i & 1);
vec4 col = v * c0 + (1.0f - v) * c1;
sector(c, uv, p0, float(i) * da, da, r0, r1, col);
}
}
vec2 rotateUVmatrinx(vec2 uv, vec2 pivot, float rotation)
{
mat2 rotation_matrix=mat2( vec2(sin(rotation),-cos(rotation)),
vec2(cos(rotation),sin(rotation))
);
uv -= pivot;
uv *= rotation_matrix;
uv += pivot;
return uv;
}
void vertex()
{
float dir = 0.0;
dir += speed * TIME;
VERTEX = rotateUVmatrinx(VERTEX, center, radians(dir));
}
void fragment()
{
ivec2 isz = textureSize(TEXTURE, 0);
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
COLOR = vec4(0, 0, 0, 0.0); //texture(TEXTURE, UV); // Цвет текущей точки
// Сетка антенн
antenas(COLOR, uv, center, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, color, color_up);
}
"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fkqwb"]
shader = SubResource("Shader_60ho7")
shader_parameter/color = Color(1, 1, 1, 0.968627)
shader_parameter/color_up = Color(1, 1, 1, 0)
shader_parameter/speed = 73.0
shader_parameter/ant_band_count_0 = 3
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_hqs6j"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lpmq6"]
shader = SubResource("Shader_60ho7")
shader_parameter/color = Color(0.0862745, 0.560784, 0.72549, 0.886275)
shader_parameter/color_up = Color(1, 1, 1, 0)
shader_parameter/speed = -73.0
shader_parameter/ant_band_count_0 = 9
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lkrha"]
shader = ExtResource("3_d16rn")
shader_parameter/ColorFig = Color(0, 0.862745, 0, 1)
shader_parameter/point_1 = Vector2(0.125, 0)
shader_parameter/point_2 = Vector2(0.125, 0.036)
shader_parameter/point_3 = Vector2(0, 0.125)
shader_parameter/point_4 = Vector2(0.036, 0.125)
shader_parameter/point_5 = Vector2(0.214, 0.125)
shader_parameter/point_6 = Vector2(0.25, 0.125)
shader_parameter/point_7 = Vector2(0.125, 0.214)
shader_parameter/point_8 = Vector2(0.125, 0.25)
shader_parameter/len = 0.264
shader_parameter/speed = 71.0
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_svd33"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 31.0
offset_bottom = 30.0
script = ExtResource("1_23kyy")
[node name="bip" type="TextureButton" parent="."]
material = SubResource("ShaderMaterial_2dulj")
layout_direction = 1
layout_mode = 0
offset_left = -15.0
offset_top = -15.0
offset_right = -12.0
offset_bottom = -12.0
offset_right = 3.0
offset_bottom = 3.0
scale = Vector2(10, 10)
texture_normal = SubResource("PlaceholderTexture2D_w5pye")
stretch_mode = 3
script = ExtResource("2_77mbp")
script = ExtResource("1_23kyy")
[node name="selector" type="Sprite2D" parent="."]
visible = false
material = SubResource("ShaderMaterial_fkqwb")
position = Vector2(10, 10)
scale = Vector2(10, 10)
texture = SubResource("PlaceholderTexture2D_hqs6j")
centered = false
[node name="recomendation" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_lpmq6")
position = Vector2(10, 10)
scale = Vector2(10, 10)
texture = SubResource("PlaceholderTexture2D_hqs6j")
centered = false
[node name="track" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_lkrha")
position = Vector2(15, 15)
scale = Vector2(13, 13)
texture = SubResource("PlaceholderTexture2D_svd33")
[connection signal="pressed" from="bip" to="bip" method="_on_pressed"]

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://0uqi1ghf7sma"]
[ext_resource type="Texture2D" uid="uid://c1maea6yhd3k7" path="res://data/кнопка-масштаб.png" id="1_iq7o5"]
[ext_resource type="Texture2D" uid="uid://c1maea6yhd3k7" path="res://data/кнопка-масштаб.png" id="1_r871k"]
[node name="btn_scale" type="TextureButton"]
self_modulate = Color(1, 1, 1, 0.509804)
@@ -8,7 +8,7 @@ offset_right = 152.0
offset_bottom = 18.0
tooltip_text = "Измененяет масштаб"
action_mode = 0
texture_normal = ExtResource("1_iq7o5")
texture_normal = ExtResource("1_r871k")
ignore_texture_size = true
stretch_mode = 0
metadata/i_scale = 0

View File

@@ -1,31 +1,31 @@
[gd_scene load_steps=7 format=3 uid="uid://b5kjdyxuwsot5"]
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://shaders/shader_edu.tres" id="1_svpxu"]
[ext_resource type="Script" path="res://scenes/canvas.gd" id="2_vajef"]
[ext_resource type="PackedScene" uid="uid://c73ahpv8uiuc7" path="res://scenes/sector.tscn" id="3_dswe7"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="4_hx35l"]
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://shaders/shader_edu.tres" id="1_27ax3"]
[ext_resource type="Script" path="res://scenes/canvas.gd" id="2_5wost"]
[ext_resource type="PackedScene" uid="uid://c73ahpv8uiuc7" path="res://scenes/sector.tscn" id="3_rminv"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="4_nkch3"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2bft1"]
size = Vector2(1600, 1200)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ctwvi"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vipcu"]
resource_local_to_scene = true
shader = ExtResource("4_hx35l")
shader = ExtResource("4_nkch3")
shader_parameter/color = Color(1, 1, 1, 0.168627)
shader_parameter/clip_color = Color(1, 0.5, 0.5, 1)
shader_parameter/width = 45.0
shader_parameter/band = 0.02
shader_parameter/radius = 0.08
shader_parameter/dir = 0.08
shader_parameter/dir = 0.0
shader_parameter/inner_clip = 0.045
[node name="canvas" type="Sprite2D"]
material = ExtResource("1_svpxu")
material = ExtResource("1_27ax3")
texture = SubResource("PlaceholderTexture2D_2bft1")
centered = false
script = ExtResource("2_vajef")
script = ExtResource("2_5wost")
[node name="строб" parent="." instance=ExtResource("3_dswe7")]
material = SubResource("ShaderMaterial_ctwvi")
[node name="строб" parent="." instance=ExtResource("3_rminv")]
material = SubResource("ShaderMaterial_vipcu")
position = Vector2(560, 560)
scale = Vector2(1100, 1100)

View File

@@ -1,32 +1,32 @@
[gd_scene load_steps=7 format=3 uid="uid://3slb0i3pvowc"]
[ext_resource type="Script" path="res://scenes/tab-switch.gd" id="1_be4as"]
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="2_eikhn"]
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="3_voomf"]
[ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал.tscn" id="4_gwdwv"]
[ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/эмс.tscn" id="5_lqysn"]
[ext_resource type="PackedScene" uid="uid://bnptm4rlp60dq" path="res://scenes/настройки.tscn" id="6_aelvp"]
[ext_resource type="Script" path="res://scenes/tab-switch.gd" id="1_tn6rq"]
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="2_vgolr"]
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="3_pwwde"]
[ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал.tscn" id="4_4hfhr"]
[ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/эмс.tscn" id="5_5gqgu"]
[ext_resource type="PackedScene" uid="uid://bnptm4rlp60dq" path="res://scenes/настройки.tscn" id="6_v5404"]
[node name="tab_switch" type="TabContainer"]
offset_right = 1600.0
offset_bottom = 1200.0
script = ExtResource("1_be4as")
script = ExtResource("1_tn6rq")
[node name="Работа" parent="." instance=ExtResource("2_eikhn")]
[node name="Работа" parent="." instance=ExtResource("2_vgolr")]
layout_mode = 2
[node name="Контроль" parent="." instance=ExtResource("3_voomf")]
[node name="Контроль" parent="." instance=ExtResource("3_pwwde")]
visible = false
layout_mode = 2
[node name="Журнал" parent="." instance=ExtResource("4_gwdwv")]
[node name="Журнал" parent="." instance=ExtResource("4_4hfhr")]
visible = false
layout_mode = 2
[node name="ЭМС" parent="." instance=ExtResource("5_lqysn")]
[node name="ЭМС" parent="." instance=ExtResource("5_5gqgu")]
visible = false
layout_mode = 2
[node name="Настройки" parent="." instance=ExtResource("6_aelvp")]
[node name="Настройки" parent="." instance=ExtResource("6_v5404")]
visible = false
layout_mode = 2

View File

@@ -1,18 +1,18 @@
[gd_scene load_steps=10 format=3 uid="uid://b276iygic5itk"]
[ext_resource type="Script" path="res://scenes/работа.gd" id="1_hmu4p"]
[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip.tscn" id="2_cn3uy"]
[ext_resource type="PackedScene" uid="uid://dem3fcec25awh" path="res://scenes/grd_side.tscn" id="3_2eau6"]
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="4_acmpi"]
[ext_resource type="PackedScene" uid="uid://cnkbk53mi7viu" path="res://scenes/grd_btns.tscn" id="5_2dg76"]
[ext_resource type="PackedScene" uid="uid://dymo732qc2doa" path="res://scenes/count_all_pad.tscn" id="6_nbfk8"]
[ext_resource type="PackedScene" uid="uid://bwti82byphl68" path="res://scenes/count_danger_pad.tscn" id="7_q8b60"]
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="8_txl8n"]
[ext_resource type="PackedScene" uid="uid://0uqi1ghf7sma" path="res://scenes/btn_scale.tscn" id="9_4ie8q"]
[ext_resource type="Script" path="res://scenes/работа.gd" id="1_r567t"]
[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip.tscn" id="2_x35jc"]
[ext_resource type="PackedScene" uid="uid://dem3fcec25awh" path="res://scenes/grd_side.tscn" id="3_3dhct"]
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="4_mf3fi"]
[ext_resource type="PackedScene" uid="uid://cnkbk53mi7viu" path="res://scenes/grd_btns.tscn" id="5_o2ae4"]
[ext_resource type="PackedScene" uid="uid://dymo732qc2doa" path="res://scenes/count_all_pad.tscn" id="6_xtpqt"]
[ext_resource type="PackedScene" uid="uid://bwti82byphl68" path="res://scenes/count_danger_pad.tscn" id="7_sfry6"]
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="8_rst8q"]
[ext_resource type="PackedScene" uid="uid://0uqi1ghf7sma" path="res://scenes/btn_scale.tscn" id="9_hqslj"]
[node name="Работа" type="Panel"]
script = ExtResource("1_hmu4p")
Bip = ExtResource("2_cn3uy")
script = ExtResource("1_r567t")
Bip = ExtResource("2_x35jc")
col_grey = Color(0.34902, 0.643137, 0.772549, 0.168627)
col_red = Color(1, 0.568627, 0.431373, 0.239216)
drag_scale_band = 0.05
@@ -29,31 +29,31 @@ strob_min_width = 5.0
metadata/_edit_vertical_guides_ = []
metadata/_edit_lock_ = true
[node name="grd_side" parent="." instance=ExtResource("3_2eau6")]
[node name="grd_side" parent="." instance=ExtResource("3_3dhct")]
layout_mode = 0
offset_left = 1114.0
offset_top = 7.0
offset_right = 1594.0
offset_bottom = 1170.0
[node name="canvas" parent="." instance=ExtResource("4_acmpi")]
[node name="canvas" parent="." instance=ExtResource("4_mf3fi")]
metadata/_edit_lock_ = true
[node name="grd_btns" parent="." instance=ExtResource("5_2dg76")]
[node name="grd_btns" parent="." instance=ExtResource("5_o2ae4")]
layout_mode = 0
offset_left = 10.0
offset_top = 1116.0
offset_right = 1106.0
offset_bottom = 1170.0
[node name="count_all_pad" parent="." instance=ExtResource("6_nbfk8")]
[node name="count_all_pad" parent="." instance=ExtResource("6_xtpqt")]
layout_mode = 0
offset_left = 100.0
offset_top = 117.0
offset_right = 133.0
offset_bottom = 140.0
[node name="count_danger_pad" parent="." instance=ExtResource("7_q8b60")]
[node name="count_danger_pad" parent="." instance=ExtResource("7_sfry6")]
layout_mode = 0
offset_left = 96.0
offset_top = 29.0
@@ -85,7 +85,7 @@ offset_right = 83.0
offset_bottom = 72.0
text = "Опасных:"
[node name="btn_auto_threat" parent="." instance=ExtResource("8_txl8n")]
[node name="btn_auto_threat" parent="." instance=ExtResource("8_rst8q")]
layout_mode = 0
offset_left = 1034.0
offset_top = 7.0
@@ -95,7 +95,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3
text = "Автомат"
[node name="btn_strob" parent="." instance=ExtResource("8_txl8n")]
[node name="btn_strob" parent="." instance=ExtResource("8_rst8q")]
layout_mode = 2
offset_left = 1034.0
offset_top = 67.0
@@ -106,7 +106,7 @@ size_flags_vertical = 3
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
text = "Строб"
[node name="btn_view" parent="." instance=ExtResource("8_txl8n")]
[node name="btn_view" parent="." instance=ExtResource("8_rst8q")]
layout_mode = 2
offset_left = 874.0
offset_top = 1023.0
@@ -116,7 +116,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3
text = "Вид"
[node name="btn_scale" parent="." instance=ExtResource("9_4ie8q")]
[node name="btn_scale" parent="." instance=ExtResource("9_hqslj")]
layout_mode = 0
offset_left = 952.0
offset_top = 1038.0

View File

@@ -54,6 +54,7 @@ func _ready() -> void:
timer_check_lost.start(repsettings.ThreatParams.time_lost / 1000.0)
## Периодически удаляет устаревшие цели
func on_timer_check_lost(time_lost: int, threats: Dictionary):
var tick = Time.get_ticks_msec()

View File

@@ -8,7 +8,7 @@ uniform uint tick_update = 0; /* Время после
const float time_delta = 0.1; /* Время вспышки при обновлении, c */
const float ds = 0.01; /* Относительное расстояние на котором выполняется сглаживание краёв */
const vec2 center = vec2(0.125, 0.125); /* Центр должен быть в (0.5, 0.5), но это не так */
const float radius = 0.125 - ds * 2.0; /* Радиус должен быть 0.5, но это не так */
const float radius = 0.075 - ds * 2.0; /* Радиус должен быть 0.5, но это не так */
float smooth_px(float r, float R)

View File

@@ -0,0 +1,80 @@
shader_type canvas_item;
uniform vec4 color: source_color = vec4(1, 1, 1, 1);
uniform vec4 color_up: source_color = vec4(1, 1, 1, 1); /* Цвет вспышки при обновлении */
const float ds = 0.00725; /* Относительное расстояние на котором выполняется сглаживание краёв */
const float dsr = 6.125;
const vec2 center = vec2(0.5, 0.5); /* Центр должен быть в (0.5, 0.5), но это не так */
const float radius = 0.075 - ds * 2.0; /* Радиус должен быть 0.5, но это не так */
uniform float speed: hint_range(0.0, 1024.0) = 0.0; /* Время вспышки при обновлении, c */
uniform int ant_band_count_0 = 3;
const float ant_band_r0_0 = 0.3;
const float ant_band_r1_0 = 0.4;
float smooth_px(float r, float R, float dss)
{
return 1.0 - smoothstep(R - dss, R + dss, r);
}
void sector(inout vec4 c, vec2 uv, vec2 cnt, float a, float da, float r0, float r1, vec4 col)
{
float l = distance(cnt, uv);
vec2 d = uv - cnt;
float sf = 500.0;
float theta = atan(d.x, d.y) * sf;
da /= 2.0;
float a0 = radians(a - da);
float a1 = radians(a + da);
float va = smooth_px(a0 * sf, theta, dsr) - smooth_px(a1 * sf, theta, dsr);
float vr = smooth_px(r0, l, ds) - smooth_px(r1, l, ds);
float rgb = sqrt(va * vr);
c.rgb += col.rgb * rgb * col.a;
c.a += rgb * col.a;
}
void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, vec4 c0, vec4 c1)
{
float da = 180.0f / float(cnt);
for (int i = -cnt; i <= cnt; i ++)
{
float v = float(i & 1);
vec4 col = v * c0 + (1.0f - v) * c1;
sector(c, uv, p0, float(i) * da, da, r0, r1, col);
}
}
vec2 rotateUVmatrinx(vec2 uv, vec2 pivot, float rotation)
{
mat2 rotation_matrix=mat2( vec2(sin(rotation),-cos(rotation)),
vec2(cos(rotation),sin(rotation))
);
uv -= pivot;
uv *= rotation_matrix;
uv += pivot;
return uv;
}
void vertex()
{
float dir = 0.0;
dir += speed * TIME;
VERTEX = rotateUVmatrinx(VERTEX, center, radians(dir));
}
void fragment()
{
ivec2 isz = textureSize(TEXTURE, 0);
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
COLOR = vec4(0, 0, 0, 0.0); //texture(TEXTURE, UV); // Цвет текущей точки
// Сетка антенн
antenas(COLOR, uv, center, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, color, color_up);
}

80
shaders/tracked.gdshader Normal file
View File

@@ -0,0 +1,80 @@
shader_type canvas_item;
uniform vec4 ColorFig:source_color;
uniform vec2 point_1;
uniform vec2 point_2;
uniform vec2 point_3;
uniform vec2 point_4;
uniform vec2 point_5;
uniform vec2 point_6;
uniform vec2 point_7;
uniform vec2 point_8;
uniform float len: hint_range(0.0, 1.0) = 0.5;
const vec2 center = vec2(0.125, 0.125);
const float DSS = 0.001225;
const float radius = 0.125;
uniform float speed: hint_range(0.0, 1024.0) = 0.0;
float smooth_px(float r, float R, float dss)
{
return 1.0 - smoothstep(R - dss, R + dss, r);
}
float line(vec2 p1, vec2 p2, float width, vec2 uv)
{
float dist = distance(p1, p2); // Дистанция между точками
float dist_uv = distance(p1, uv); // Дистанция между точкой и текущим пикселем
return 1.0 - floor(1.0 - (0.001 * width) + distance (mix(p1, p2, clamp(dist_uv / dist, 0.0, 1.0)), uv));
}
void get_line_points(inout float px0, inout float px1, inout float py0 ,inout float py1, float ang)
{
px0 = (sin(ang*PI/180.0)/4.0);
py0 = (cos(ang*PI/180.0)/4.0);
px1 = px0 * len;
py1 = py0 * len;
px0 +=0.125;
py0 +=0.125;
px1 +=0.125;
py1 +=0.125;
}
vec2 rotateUVmatrinx(vec2 uv, vec2 pivot, float rotation)
{
mat2 rotation_matrix=mat2( vec2(sin(rotation),-cos(rotation)),
vec2(cos(rotation),sin(rotation))
);
uv -= pivot;
uv *= rotation_matrix;
uv += pivot;
return uv;
}
void vertex()
{
float dir = 0.0;
vec2 offset = vec2(0.125, 0.125);
dir -= speed * TIME;
VERTEX = rotateUVmatrinx(VERTEX, center - offset, radians(dir));
}
void fragment()
{
float px0 = 0.0;
float px1 = 0.0;
float py0 = 0.0;
float py1 = 0.0;
COLOR = vec4(1.0, 0.0, 0.0, 0.0); //texture(TEXTURE, UV); // Цвет текущей точки
get_line_points(px0, px1, py0, py1, 330.0);
COLOR.a += line(vec2(px0, py0), vec2(px1, py1), 5.0, UV);
get_line_points(px0, px1, py0, py1, 90.0);
COLOR.a += line(vec2(px0, py0), vec2(px1, py1), 5.0, UV);
get_line_points(px0, px1, py0, py1, 210.0);
COLOR.a += line(vec2(px0, py0), vec2(px1, py1), 5.0, UV);
COLOR *= smooth_px(length(UV-center), radius, DSS);
}