Merge remote-tracking branch 'MaD_CaT/master'

# Conflicts:
#	scenes/tab-switch.tscn
#	scenes/работа.tscn
This commit is contained in:
sasha80
2023-11-03 09:23:06 +03:00
14 changed files with 372 additions and 43 deletions

15
scenes/bip.gd Normal file
View File

@@ -0,0 +1,15 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_pressed():
print_debug('Click')

View File

@@ -1,16 +1,169 @@
[gd_scene load_steps=4 format=3 uid="uid://nl1vklubr5kr"]
[gd_scene load_steps=12 format=3 uid="uid://nl1vklubr5kr"]
[ext_resource type="Shader" path="res://shaders/bip.gdshader" id="1_k6vue"]
[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_k6vue")
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
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_tgf76"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_w5pye"]
[node name="bip" type="Sprite2D"]
[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_right = 3.0
offset_bottom = 3.0
scale = Vector2(10, 10)
texture = SubResource("PlaceholderTexture2D_tgf76")
texture_normal = SubResource("PlaceholderTexture2D_w5pye")
stretch_mode = 3
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_yxc3k"]
[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_yxc3k")
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_uxbga"]
[ext_resource type="Script" path="res://scenes/canvas.gd" id="2_vkwmy"]
[ext_resource type="PackedScene" uid="uid://c73ahpv8uiuc7" path="res://scenes/sector.tscn" id="3_uhdvc"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="4_gb4a1"]
[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_iqsw2"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vipcu"]
resource_local_to_scene = true
shader = ExtResource("4_gb4a1")
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_uxbga")
material = ExtResource("1_27ax3")
texture = SubResource("PlaceholderTexture2D_2bft1")
centered = false
script = ExtResource("2_vkwmy")
script = ExtResource("2_5wost")
[node name="строб" parent="." instance=ExtResource("3_uhdvc")]
material = SubResource("ShaderMaterial_iqsw2")
[node name="строб" parent="." instance=ExtResource("3_rminv")]
material = SubResource("ShaderMaterial_vipcu")
position = Vector2(560, 560)
scale = Vector2(1100, 1100)

View File

@@ -1,12 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://dymo732qc2doa"]
[ext_resource type="FontFile" uid="uid://befva8r034a4v" path="res://data/DSEG7Classic-Regular.ttf" id="1_di0yu"]
[ext_resource type="FontFile" uid="uid://befva8r034a4v" path="res://data/DSEG7Classic-Regular.ttf" id="1_omx3t"]
[node name="count_all_pad" type="Label"]
self_modulate = Color(0.403922, 0.403922, 0.403922, 1)
offset_right = 33.0
offset_bottom = 23.0
theme_override_fonts/font = ExtResource("1_di0yu")
theme_override_fonts/font = ExtResource("1_omx3t")
theme_override_font_sizes/font_size = 20
text = "88"
vertical_alignment = 1
@@ -15,7 +15,7 @@ vertical_alignment = 1
layout_mode = 0
offset_right = 33.0
offset_bottom = 23.0
theme_override_fonts/font = ExtResource("1_di0yu")
theme_override_fonts/font = ExtResource("1_omx3t")
theme_override_font_sizes/font_size = 20
text = "00"
vertical_alignment = 1

View File

@@ -1,10 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://c73ahpv8uiuc7"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="1_aikdh"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="1_jalbg"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xo5or"]
resource_local_to_scene = true
shader = ExtResource("1_aikdh")
shader = ExtResource("1_jalbg")
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

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://trt0q8th3bn2"]
[ext_resource type="Script" path="res://scenes/журнал.gd" id="1_ifi7q"]
[ext_resource type="Script" path="res://addons/godot-logger/scripts/logger_output.gd" id="2_i478f"]
[ext_resource type="Script" path="res://scenes/журнал.gd" id="1_jtuvb"]
[ext_resource type="Script" path="res://addons/godot-logger/scripts/logger_output.gd" id="2_wm8il"]
[node name="журнал" type="Panel"]
anchors_preset = 15
@@ -13,7 +13,7 @@ offset_right = -2.0
offset_bottom = -1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ifi7q")
script = ExtResource("1_jtuvb")
[node name="content" type="RichTextLabel" parent="."]
layout_mode = 0
@@ -26,7 +26,7 @@ theme_override_colors/selection_color = Color(0.72549, 0.270588, 0.133333, 1)
threaded = true
selection_enabled = true
deselect_on_focus_loss_enabled = false
script = ExtResource("2_i478f")
script = ExtResource("2_wm8il")
[node name="btn_save" type="Button" parent="."]
layout_mode = 0
@@ -46,8 +46,8 @@ text = "Очистить"
[node name="dlg_file" type="FileDialog" parent="."]
gui_embed_subwindows = true
title = "Сохранить журнал работы в файл"
initial_position = 2
title = "Сохранить журнал работы в файл"
size = Vector2i(900, 900)
borderless = true
ok_button_text = "Да"

View File

@@ -67,7 +67,7 @@ func _ready():
## Производит отображение цели на диаграмму
func map_threat_to_bip(th: threats.Threat, bip: Sprite2D):
func map_threat_to_bip(th: threats.Threat, bip: Control):
bip.position = tools.pos_calc(
th.freq,
th.aoa,

View File

@@ -25,7 +25,7 @@ col_red = Color(1, 0.568627, 0.431373, 0.239216)
drag_scale_band = 0.05
drag_scale_width = 0.5
freq_high = 6000.0
freq_low = 400.0
freq_low = 200.0
radius_center = Vector2(560, 560)
radius_internal = 200.0
radius_outter = 400.0

View File

@@ -1,25 +1,25 @@
[gd_scene load_steps=7 format=3 uid="uid://by22sta8tt8dn"]
[ext_resource type="Script" path="res://scenes/состояния-эмс.gd" id="1_fvtic"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="2_6nlah"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="3_1phdq"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="4_8x71b"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="5_rmevl"]
[ext_resource type="Script" path="res://scenes/состояния-эмс.gd" id="1_5cq67"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="2_don4l"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="3_lu634"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="4_b33qw"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="5_q2yfw"]
[sub_resource type="SpriteFrames" id="SpriteFrames_ow7xh"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_6nlah")
"texture": ExtResource("2_don4l")
}, {
"duration": 1.0,
"texture": ExtResource("3_1phdq")
"texture": ExtResource("3_lu634")
}, {
"duration": 1.0,
"texture": ExtResource("4_8x71b")
"texture": ExtResource("4_b33qw")
}, {
"duration": 1.0,
"texture": ExtResource("5_rmevl")
"texture": ExtResource("5_q2yfw")
}],
"loop": true,
"name": &"default",
@@ -35,7 +35,7 @@ offset_right = -1540.0
offset_bottom = -1182.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_fvtic")
script = ExtResource("1_5cq67")
[node name="sprite" type="AnimatedSprite2D" parent="."]
position = Vector2(34, 9)

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

@@ -9,7 +9,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, но это не так */

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);
}