diff --git a/main.tscn b/main.tscn index c030b3c..0b1987d 100644 --- a/main.tscn +++ b/main.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=3 uid="uid://cu3e03by7d61j"] -[ext_resource type="PackedScene" uid="uid://3slb0i3pvowc" path="res://scenes/tab_switch.tscn" id="1_q31c2"] -[ext_resource type="PackedScene" uid="uid://w6ta0ck1bedl" path="res://scenes/wnd_stc.tscn" id="2_hsjlm"] +[ext_resource type="PackedScene" uid="uid://3slb0i3pvowc" path="res://scenes/tab_switch.tscn" id="1_mnvlx"] +[ext_resource type="PackedScene" uid="uid://w6ta0ck1bedl" path="res://scenes/wnd_stc.tscn" id="2_s3md7"] [node name="main" type="Control"] layout_mode = 3 @@ -10,11 +10,11 @@ offset_top = -55.0 offset_right = 1600.0 offset_bottom = 1145.0 -[node name="tab_switch" parent="." instance=ExtResource("1_q31c2")] +[node name="tab_switch" parent="." instance=ExtResource("1_mnvlx")] layout_mode = 0 offset_left = 3.0 offset_top = 55.0 offset_right = 1603.0 offset_bottom = 1257.0 -[node name="wnd_stc" parent="." instance=ExtResource("2_hsjlm")] +[node name="wnd_stc" parent="." instance=ExtResource("2_s3md7")] diff --git a/project.godot b/project.godot index 2c42ad0..5c995f9 100644 --- a/project.godot +++ b/project.godot @@ -12,8 +12,8 @@ config_version=5 config/name="uarep-ctl" run/main_scene="res://main.tscn" -config/features=PackedStringArray("4.0") -run/low_processor_mode=true +config/features=PackedStringArray("4.1") +run/delta_smoothing=false boot_splash/show_image=false boot_splash/fullsize=false boot_splash/use_filter=false @@ -31,15 +31,20 @@ window/size/mode=3 window/subwindows/embed_subwindows=false window/vsync/vsync_mode=false +[editor] + +version_control/autoload_on_startup=true + [editor_plugins] enabled=PackedStringArray() [gui] -fonts/dynamic_fonts/use_oversampling=false common/text_edit_undo_stack_max_size=10 theme/custom_font="res://data/main-font.tres" +theme/default_font_antialiasing=0 +theme/default_font_hinting=2 theme/lcd_subpixel_layout=0 common/drop_mouse_on_gui_input_disabled=true @@ -51,9 +56,18 @@ buffering/agile_event_flushing=true file_logging/enable_file_logging=true +[physics] + +2d/run_on_separate_thread=true +common/physics_ticks_per_second=1 +common/max_physics_steps_per_frame=1 +common/enable_object_picking=false + [rendering] renderer/rendering_method="gl_compatibility" +gl_compatibility/item_buffer_size=8192 +shader_compiler/shader_cache/strip_debug=true textures/default_filters/anisotropic_filtering_level=0 anti_aliasing/screen_space_roughness_limiter/enabled=false environment/defaults/default_environment="res://default_env.tres" diff --git a/scenes/Sector.tscn b/scenes/Sector.tscn new file mode 100644 index 0000000..af1aa7f --- /dev/null +++ b/scenes/Sector.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=3 uid="uid://c73ahpv8uiuc7"] + +[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="1_sp5oo"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xo5or"] +resource_local_to_scene = true +shader = ExtResource("1_sp5oo") +shader_parameter/color = Color(1, 1, 1, 0.168627) +shader_parameter/width = 45.0 +shader_parameter/inner_radius = 0.1 +shader_parameter/outer_radius = 0.125 + +[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2lkm8"] + +[node name="строб" type="Sprite2D"] +material = SubResource("ShaderMaterial_xo5or") +position = Vector2(610, 600) +scale = Vector2(1108, 1108) +texture = SubResource("PlaceholderTexture2D_2lkm8") diff --git a/scenes/bip.tscn b/scenes/bip.tscn new file mode 100644 index 0000000..ec298c3 --- /dev/null +++ b/scenes/bip.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=5 format=3 uid="uid://cfk41dnfbr0wx"] + +[ext_resource type="Shader" path="res://shaders/bip.gdshader" id="1_tkf3y"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_2dulj"] +shader = ExtResource("1_tkf3y") +shader_parameter/color = Color(1, 1, 1, 1) + +[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_tgf76"] + +[sub_resource type="GDScript" id="GDScript_4xy3s"] +script/source = "extends Sprite2D + +func set_bip_color(col: Color): material.set('shader_parameter/color', col) +func get_bip_color() -> Color: return material.get('shader_parameter/color') +" + +[node name="bip" type="Sprite2D"] +material = SubResource("ShaderMaterial_2dulj") +scale = Vector2(10, 10) +texture = SubResource("PlaceholderTexture2D_tgf76") +script = SubResource("GDScript_4xy3s") diff --git a/scenes/button-flat.tscn b/scenes/button-flat.tscn index 1b01bbb..a0eb6d2 100644 --- a/scenes/button-flat.tscn +++ b/scenes/button-flat.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=9 format=3 uid="uid://da7w3vkhadfwe"] -[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="1"] -[ext_resource type="Script" path="res://scenes/nine-patch-button.gd" id="2"] +[ext_resource type="Script" path="res://scenes/nine-patch-button.gd" id="1_wo7pi"] +[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_r8bpq"] [sub_resource type="StyleBoxEmpty" id="1"] @@ -19,13 +19,13 @@ offset_right = 30.0 offset_bottom = 30.0 theme_override_styles/panel = SubResource("1") -script = ExtResource("2") +script = ExtResource("1_wo7pi") toggle_mode = true [node name="state" type="NinePatchRect" parent="."] show_behind_parent = true layout_mode = 2 -texture = ExtResource("1") +texture = ExtResource("2_r8bpq") patch_margin_left = 10 patch_margin_top = 10 patch_margin_right = 10 diff --git a/scenes/canvas.gd b/scenes/canvas.gd new file mode 100644 index 0000000..6f76f59 --- /dev/null +++ b/scenes/canvas.gd @@ -0,0 +1,11 @@ +extends Sprite2D + +func get_center() -> Vector2: return $строб.position +func set_strob_color(color: Color): $строб.material.set('shader_parameter/color', color); +func set_strob_dir(dir: float): $строб.rotation_degrees = dir - 90.0 +func set_strob_width(width: float): $строб.material.set('shader_parameter/width', width) +func get_strob_width() -> float: return $строб.material.get('shader_parameter/width') +func set_strob_visible(val: bool): $строб.visible = val +func get_strob_visible() -> bool: return $строб.visible +func set_strob_band(val: float): $строб.material.set('shader_parameter/inner_radius', val) +func get_strob_band() -> float: return $строб.material.get('shader_parameter/inner_radius') diff --git a/scenes/canvas.tscn b/scenes/canvas.tscn index 5b66791..072c373 100644 --- a/scenes/canvas.tscn +++ b/scenes/canvas.tscn @@ -1,163 +1,32 @@ -[gd_scene load_steps=14 format=3 uid="uid://b5kjdyxuwsot5"] +[gd_scene load_steps=8 format=3 uid="uid://b5kjdyxuwsot5"] -[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://shaders/shader_edu.tres" id="1_ow7xo"] -[ext_resource type="Texture2D" uid="uid://cqu18m05sdl5w" path="res://data/прицел-табличка.png" id="2_g47s7"] -[ext_resource type="Texture2D" uid="uid://6qqcqds5majk" path="res://data/отметка-бпла.png" id="3_bgvyj"] -[ext_resource type="Texture2D" uid="uid://bibsq2uejlm0s" path="res://data/отметка-корабль.png" id="4_wasyy"] -[ext_resource type="Texture2D" uid="uid://b8ern67qnb5ky" path="res://data/кораблик-22800.png" id="5_1y104"] -[ext_resource type="Texture2D" uid="uid://biy3dmtuefrqe" path="res://data/отметка-ракета.png" id="6_mvioa"] -[ext_resource type="Texture2D" uid="uid://b3woliae871je" path="res://data/отметка-неопред.png" id="7_6ag6n"] -[ext_resource type="Texture2D" uid="uid://ccgavrtpkd56i" path="res://data/прицел-сопровождение.png" id="8_l63ig"] +[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://shaders/shader_edu.tres" id="1_utgq5"] +[ext_resource type="Script" path="res://scenes/canvas.gd" id="2_crgvr"] +[ext_resource type="Texture2D" uid="uid://b8ern67qnb5ky" path="res://data/кораблик-22800.png" id="3_s5jac"] +[ext_resource type="PackedScene" uid="uid://c73ahpv8uiuc7" path="res://scenes/Sector.tscn" id="4_nfjoq"] +[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="5_bj4e3"] [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2bft1"] size = Vector2(1600, 1200) -[sub_resource type="Animation" id="Animation_vbwp0"] -length = 0.001 -loop_mode = 1 - -[sub_resource type="Animation" id="Animation_wfwqs"] -resource_name = "вращение" -length = 6.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("canvas/прицел-сопровождение-3:rotation") -tracks/0/interp = 1 -tracks/0/loop_wrap = false -tracks/0/keys = { -"times": PackedFloat32Array(0, 3, 6), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [0.0, 6.28319, 12.5664] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("canvas/прицел-сопровождение-1:rotation") -tracks/1/interp = 1 -tracks/1/loop_wrap = false -tracks/1/keys = { -"times": PackedFloat32Array(0, 3, 6), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [0.0, 6.28319, 12.5664] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("canvas/прицел-табличка:rotation") -tracks/2/interp = 1 -tracks/2/loop_wrap = false -tracks/2/keys = { -"times": PackedFloat32Array(0, 3, 6), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [6.28319, 0.0, -6.28319] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("canvas:material:shader_parameter/pc2") -tracks/3/interp = 2 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0, 2.5, 6), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [Vector2(100, 1065), Vector2(115, 1070), Vector2(100, 1065)] -} - -[sub_resource type="Animation" id="Animation_dch6g"] -resource_name = "направление" -length = 3.6 - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_codoa"] -_data = { -"RESET": SubResource("Animation_vbwp0"), -"вращение": SubResource("Animation_wfwqs"), -"направление": SubResource("Animation_dch6g") -} +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xjvew"] +resource_local_to_scene = true +shader = ExtResource("5_bj4e3") +shader_parameter/color = Color(1, 1, 1, 0.168627) +shader_parameter/width = 97.2 +shader_parameter/inner_radius = 0.0742 +shader_parameter/outer_radius = 0.1099 [node name="canvas" type="Sprite2D"] -material = ExtResource("1_ow7xo") -position = Vector2(800, 596) +material = ExtResource("1_utgq5") texture = SubResource("PlaceholderTexture2D_2bft1") -metadata/_edit_lock_ = true - -[node name="animator" type="AnimationPlayer" parent="."] -root_node = NodePath("../..") -libraries = { -"": SubResource("AnimationLibrary_codoa") -} - -[node name="прицел-табличка" type="Sprite2D" parent="."] -position = Vector2(-101, -176) -rotation = 6.28319 -texture = ExtResource("2_g47s7") - -[node name="отметка-бпла" type="Sprite2D" parent="."] -position = Vector2(-101, -176) -texture = ExtResource("3_bgvyj") - -[node name="отметка-корабль" type="Sprite2D" parent="."] -position = Vector2(-350, -103) -rotation = -2.09439 -texture = ExtResource("4_wasyy") +centered = false +script = ExtResource("2_crgvr") [node name="кораблик" type="Sprite2D" parent="."] -position = Vector2(-192, 3) -scale = Vector2(0.25, 0.25) -texture = ExtResource("5_1y104") +position = Vector2(610, 600) +scale = Vector2(0.2, 0.2) +texture = ExtResource("3_s5jac") -[node name="отметка_ракета" type="Sprite2D" parent="."] -position = Vector2(-130, 19) -rotation = -1.309 -texture = ExtResource("6_mvioa") - -[node name="отметка_неопред" type="Sprite2D" parent="."] -position = Vector2(-200, -191) -texture = ExtResource("7_6ag6n") - -[node name="прицел-сопровождение-3" type="Sprite2D" parent="."] -position = Vector2(-500, -200) -texture = ExtResource("8_l63ig") - -[node name="прицел-сопровождение-1" type="Sprite2D" parent="."] -position = Vector2(-200, 400) -texture = ExtResource("8_l63ig") - -[node name="номер-цели-3" type="Label" parent="."] -offset_left = -517.0 -offset_top = -248.0 -offset_right = -477.0 -offset_bottom = -226.0 -theme_override_colors/font_outline_color = Color(0, 0, 0, 1) -theme_override_constants/outline_size = 2 -text = "3" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="номер-цели-2" type="Label" parent="."] -z_index = 1 -offset_left = -120.0 -offset_top = -212.0 -offset_right = -80.0 -offset_bottom = -190.0 -theme_override_colors/font_outline_color = Color(0, 0, 0, 1) -theme_override_constants/outline_size = 2 -text = "2" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="номер-цели-1" type="Label" parent="."] -offset_left = -219.0 -offset_top = 357.0 -offset_right = -179.0 -offset_bottom = 379.0 -theme_override_colors/font_outline_color = Color(0, 0, 0, 1) -theme_override_constants/outline_size = 2 -text = "1" -horizontal_alignment = 1 -vertical_alignment = 1 +[node name="строб" parent="." instance=ExtResource("4_nfjoq")] +material = SubResource("ShaderMaterial_xjvew") diff --git a/scenes/frame.tscn b/scenes/frame.tscn index 5f8cf3c..73d5cb7 100644 --- a/scenes/frame.tscn +++ b/scenes/frame.tscn @@ -1,17 +1,17 @@ [gd_scene load_steps=3 format=3 uid="uid://bq7haw1ypiv48"] -[ext_resource type="Script" path="res://scenes/рамка.gd" id="1"] -[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="2"] +[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="1_s1rm1"] +[ext_resource type="Script" path="res://scenes/рамка.gd" id="2_pjc2i"] [node name="ramka" type="NinePatchRect"] offset_right = 150.0 offset_bottom = 100.0 -texture = ExtResource("2") +texture = ExtResource("1_s1rm1") patch_margin_left = 15 patch_margin_top = 30 patch_margin_right = 15 patch_margin_bottom = 10 -script = ExtResource("1") +script = ExtResource("2_pjc2i") [node name="header" type="Label" parent="."] clip_contents = true diff --git a/scenes/tab_switch.tscn b/scenes/tab_switch.tscn index b493f55..fca23b9 100644 --- a/scenes/tab_switch.tscn +++ b/scenes/tab_switch.tscn @@ -1,15 +1,15 @@ [gd_scene load_steps=3 format=3 uid="uid://3slb0i3pvowc"] -[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="1_jjcv4"] -[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="2_h2mc4"] +[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="1_kf06s"] +[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="2_ep1i3"] [node name="tab_switch" type="TabContainer"] offset_right = 1600.0 offset_bottom = 1200.0 -[node name="работа" parent="." instance=ExtResource("1_jjcv4")] +[node name="работа" parent="." instance=ExtResource("1_kf06s")] layout_mode = 2 -[node name="контроль" parent="." instance=ExtResource("2_h2mc4")] +[node name="контроль" parent="." instance=ExtResource("2_ep1i3")] visible = false layout_mode = 2 diff --git a/scenes/wnd_stc.tscn b/scenes/wnd_stc.tscn index 10d00bf..35995a5 100644 --- a/scenes/wnd_stc.tscn +++ b/scenes/wnd_stc.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://w6ta0ck1bedl"] -[ext_resource type="PackedScene" uid="uid://cbfp6bylx8g4i" path="res://tab_container_stc.tscn" id="1_c76qk"] +[ext_resource type="PackedScene" uid="uid://cbfp6bylx8g4i" path="res://tab_container_stc.tscn" id="1_76mnm"] [node name="wnd_stc" type="Window"] initial_position = 3 @@ -8,4 +8,4 @@ size = Vector2i(1600, 1200) mode = 3 current_screen = 1 -[node name="TabContainer" parent="." instance=ExtResource("1_c76qk")] +[node name="TabContainer" parent="." instance=ExtResource("1_76mnm")] diff --git a/scenes/контроль.tscn b/scenes/контроль.tscn index 8b63914..d0b62c1 100644 --- a/scenes/контроль.tscn +++ b/scenes/контроль.tscn @@ -1,11 +1,11 @@ [gd_scene load_steps=7 format=3 uid="uid://lwmw4egynmd1"] -[ext_resource type="Script" path="res://scenes/контроль.gd" id="1_tse8d"] -[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2"] -[ext_resource type="Texture2D" uid="uid://dkqlvd750pplc" path="res://data/СПТ.png" id="3"] -[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="4"] -[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="5"] -[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="6"] +[ext_resource type="Script" path="res://scenes/контроль.gd" id="1_pdhey"] +[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_c8mnm"] +[ext_resource type="Texture2D" uid="uid://dkqlvd750pplc" path="res://data/СПТ.png" id="3_uldf5"] +[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="4_pojm0"] +[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="5_5hce7"] +[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="6_0mr8a"] [node name="Контроль" type="Panel"] anchors_preset = 15 @@ -13,7 +13,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_tse8d") +script = ExtResource("1_pdhey") metadata/_edit_lock_ = true [node name="pribor_uf" type="TextureButton" parent="."] @@ -24,7 +24,7 @@ offset_right = 1191.0 offset_bottom = 657.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("2") +texture_normal = ExtResource("2_c8mnm") stretch_mode = 4 [node name="pribor_rtr" type="TextureButton" parent="."] @@ -35,7 +35,7 @@ offset_right = 1198.0 offset_bottom = 361.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("3") +texture_normal = ExtResource("3_uldf5") stretch_mode = 4 [node name="pribor_afsp_l" type="TextureButton" parent="."] @@ -47,7 +47,7 @@ offset_bottom = 860.0 scale = Vector2(0.2, 0.2) size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("6") +texture_normal = ExtResource("4_pojm0") stretch_mode = 4 [node name="pribor_afsp_r" type="TextureButton" parent="."] @@ -59,7 +59,7 @@ offset_bottom = 865.0 scale = Vector2(0.2, 0.2) size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("6") +texture_normal = ExtResource("4_pojm0") stretch_mode = 4 [node name="pribor_sch3" type="TextureButton" parent="."] @@ -70,7 +70,7 @@ offset_right = 1208.0 offset_bottom = 951.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("4") +texture_normal = ExtResource("5_5hce7") stretch_mode = 4 [node name="pribor_spt_l" type="TextureButton" parent="."] @@ -81,7 +81,7 @@ offset_right = 1053.0 offset_bottom = 951.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("3") +texture_normal = ExtResource("3_uldf5") stretch_mode = 4 [node name="pribor_spt_r" type="TextureButton" parent="."] @@ -92,7 +92,7 @@ offset_right = 1353.0 offset_bottom = 951.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("3") +texture_normal = ExtResource("3_uldf5") stretch_mode = 4 [node name="pribor_prd_v_2" type="TextureButton" parent="."] @@ -103,7 +103,7 @@ offset_right = 872.0 offset_bottom = 377.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 [node name="pribor_prd_n_2" type="TextureButton" parent="."] @@ -114,7 +114,7 @@ offset_right = 827.0 offset_bottom = 553.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 [node name="pribor_prd_k_2" type="TextureButton" parent="."] @@ -125,7 +125,7 @@ offset_right = 952.0 offset_bottom = 555.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 [node name="pribor_prd_v_3" type="TextureButton" parent="."] @@ -136,7 +136,7 @@ offset_right = 1494.0 offset_bottom = 896.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 flip_h = true @@ -148,7 +148,7 @@ offset_right = 1417.0 offset_bottom = 721.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 flip_h = true @@ -160,7 +160,7 @@ offset_right = 1537.0 offset_bottom = 721.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 flip_h = true @@ -172,7 +172,7 @@ offset_right = 1522.0 offset_bottom = 391.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 flip_h = true @@ -184,7 +184,7 @@ offset_right = 1412.0 offset_bottom = 553.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 flip_h = true @@ -196,7 +196,7 @@ offset_right = 1537.0 offset_bottom = 562.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 flip_h = true @@ -208,7 +208,7 @@ offset_right = 882.0 offset_bottom = 896.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 [node name="pribor_prd_n_4" type="TextureButton" parent="."] @@ -219,7 +219,7 @@ offset_right = 827.0 offset_bottom = 723.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 [node name="pribor_prd_k_4" type="TextureButton" parent="."] @@ -230,7 +230,7 @@ offset_right = 962.0 offset_bottom = 723.0 size_flags_horizontal = 15 size_flags_vertical = 15 -texture_normal = ExtResource("5") +texture_normal = ExtResource("6_0mr8a") stretch_mode = 4 [node name="pribor_sch" type="Panel" parent="."] diff --git a/scenes/работа.gd b/scenes/работа.gd index 7fc8077..b2871ca 100644 --- a/scenes/работа.gd +++ b/scenes/работа.gd @@ -1,9 +1,15 @@ extends Panel -@export_color_no_alpha var col_red -@export_color_no_alpha var col_grey +@export var col_red: Color +@export var col_grey: Color +@export var strob_min_width: float +@export var strob_max_width: float +@export var strob_min_band: float +@export var strob_max_band: float +@export var drag_scale: float -enum DRAG_FSM { IDLE, DRAG } + +enum DRAG_FSM { IDLE, DRAG, DISABLE } """ Состояние перетаскивания """ var drag_pos_begin: Vector2 @@ -15,13 +21,16 @@ var drag_fsm: DRAG_FSM = DRAG_FSM.IDLE var drag_button: MouseButton """ Кнопка мыши нажатая при перетаскивании """ -var ant_width_begin: float -""" Ширина ДН антенны в момент начала перетаскивания """ +var strob_width_begin: float +""" Ширина строба по углу в момент начала перетаскивания """ -var ant_dir_begin: float +var strob_dir_begin: float """ Направление антенны в момент начала перетаскивания """ -var ant_center: Vector2 +var strob_band_begin: float +""" Ширина строба в момент начала перетаскивания """ + +var strob_center: Vector2 """ Центр антенн """ signal drag_begin @@ -38,33 +47,42 @@ signal full_screen func _ready(): - $btn_strobe.button_connect('pressed', Callable(self, 'on_button_stobe_pressed')) - $canvas/animator.play('вращение') + $btn_strobe.button_connect('pressed', Callable(self, 'on_button_strobe_pressed')) $'рамка-режим/btn_off'.set_pressed(true) - ant_center = $canvas.material.get('shader_parameter/pc0') - $canvas.material.set('shader_parameter/ap_ant_col', col_grey) + strob_center = $canvas.get_center() + on_button_strobe_pressed() + drag_fsm = DRAG_FSM.DISABLE var nodes: = get_tree().get_nodes_in_group('группа-режим-помехи') for btn in nodes: btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes)) -func on_button_stobe_pressed(): - if $btn_strobe.is_pressed(): - $canvas.material.set('shader_parameter/ap_ant_col', col_red) +func on_button_strobe_pressed(): + if $btn_strobe.is_pressed(): + $canvas.set_strob_visible(true) + drag_fsm = DRAG_FSM.IDLE else: - $canvas.material.set('shader_parameter/ap_ant_col', col_grey) + $canvas.set_strob_visible(false) + drag_fsm = DRAG_FSM.DISABLE func on_button_pressed(btn_this, btn_others): # поведение радиокнопок в группе - for btn_other in btn_others: btn_other.set_pressed(btn_this == btn_other) + for btn_other in btn_others: + btn_other.set_pressed(btn_this == btn_other) func hypot(x: float, y: float) -> float: return sqrt(x * x + y * y) -func map_xy_ang(pos0: Vector2, pos: Vector2) -> Vector2: +func clip_value(val, val_min, val_max): + if val < val_min: val = val_min + if val > val_max: val = val_max + return val + + +func map_dec_to_rad(pos0: Vector2, pos: Vector2) -> Vector2: """ Преобразует декартовые координаты в полярные """ var x1: float = pos.x - pos0.x var y1: float = pos.y - pos0.y @@ -74,33 +92,41 @@ func map_xy_ang(pos0: Vector2, pos: Vector2) -> Vector2: return Vector2(ang, radius) -func get_ant_width(pos: Vector2, prev: float) -> float: - var ap_ant_w: float = prev + (drag_pos_begin.y - pos.y) / 5.0 - if ap_ant_w < 5.0: ap_ant_w = 5.0 - if ap_ant_w > 90.0: ap_ant_w = 90.0 - return ap_ant_w +func get_strob_width(pos: Vector2, prev: float) -> float: + var strob_dir_width: float = prev + (drag_pos_begin.y - pos.y) / drag_scale + strob_dir_width = clip_value(strob_dir_width, strob_min_width, strob_max_width) + return strob_dir_width -func set_ant_dir(pos: Vector2): - var radp: Vector2 = map_xy_ang(ant_center, pos) - if radp.y < 600: - $canvas.material.set('shader_parameter/sec_var', radp.x) +func get_strob_band(pos: Vector2, prev: float) -> float: + var strob_dir_band: float = prev + (drag_pos_begin.x - pos.x) / drag_scale + strob_dir_band = clip_value(strob_dir_band, strob_min_band, strob_max_band) + return strob_dir_band + + +func set_strob_dir(pos: Vector2): + var radp: Vector2 = map_dec_to_rad(strob_center, pos) + if radp.y < 600.0: + $canvas.set_strob_dir(radp.x) func _on_drag_continue(event): if drag_button == MOUSE_BUTTON_RIGHT: - var ap_ant_w: float = get_ant_width(event.position, ant_width_begin) - $canvas.material.set('shader_parameter/ap_ant_w', ap_ant_w) + var strob_width: float = get_strob_width(event.position, strob_width_begin) + $canvas.set_strob_width(strob_width) + print_debug(strob_width_begin, strob_width) + #var strob_band: float = get_strob_band(event.position, strob_band_begin) + #$canvas.set_strob_band(strob_band) elif drag_button == MOUSE_BUTTON_LEFT: - set_ant_dir(event.position) + set_strob_dir(event.position) func _on_drag_begin(event): drag_pos_begin = event.position if drag_button == MOUSE_BUTTON_LEFT: - set_ant_dir(event.position) + set_strob_dir(event.position) elif drag_button == MOUSE_BUTTON_RIGHT: - ant_width_begin = $canvas.material.get('shader_parameter/ap_ant_w') + strob_width_begin = $canvas.get_strob_width() func _input(event): diff --git a/scenes/работа.tscn b/scenes/работа.tscn index c953d1e..e898c39 100644 --- a/scenes/работа.tscn +++ b/scenes/работа.tscn @@ -1,20 +1,22 @@ [gd_scene load_steps=6 format=3 uid="uid://b276iygic5itk"] -[ext_resource type="Script" path="res://scenes/работа.gd" id="1_6kl7p"] -[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_jfiel"] -[ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="11_pmacq"] -[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="12_pcemc"] +[ext_resource type="Script" path="res://scenes/работа.gd" id="1_bn2wv"] +[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_7v6xf"] +[ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="3_hqrod"] +[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="4_vg7if"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5ugj8"] [node name="Работа" type="Panel"] -script = ExtResource("1_6kl7p") -col_red = Color(1, 0.568627, 0.431373, 1) -col_grey = Color(0.6, 0.6, 0.6, 1) +script = ExtResource("1_bn2wv") +col_red = Color(1, 0.568627, 0.431373, 0.239216) +col_grey = Color(0.34902, 0.643137, 0.772549, 0.168627) +drag_scale = 5.0 +metadata/_edit_vertical_guides_ = [] -[node name="canvas" parent="." instance=ExtResource("2_jfiel")] +[node name="canvas" parent="." instance=ExtResource("2_7v6xf")] -[node name="рамка-режим" parent="." instance=ExtResource("11_pmacq")] +[node name="рамка-режим" parent="." instance=ExtResource("3_hqrod")] layout_mode = 0 offset_left = 1180.0 offset_top = 892.0 @@ -22,7 +24,7 @@ offset_right = 1589.0 offset_bottom = 1162.0 text = "Режим помехи" -[node name="btn_off" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_off" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 10.0 offset_top = 30.0 @@ -30,7 +32,7 @@ offset_right = 100.0 offset_bottom = 80.0 text = "Откл" -[node name="btn_p4" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p4" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 110.0 offset_top = 210.0 @@ -38,7 +40,7 @@ offset_right = 200.0 offset_bottom = 260.0 text = "13" -[node name="btn_p5" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p5" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 1 anchors_preset = -1 offset_left = 10.0 @@ -49,7 +51,7 @@ grow_horizontal = 2 grow_vertical = 2 text = "12" -[node name="btn_p6" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p6" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 210.0 offset_top = 150.0 @@ -57,7 +59,7 @@ offset_right = 300.0 offset_bottom = 200.0 text = "10" -[node name="btn_p7" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p7" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 310.0 offset_top = 150.0 @@ -65,7 +67,7 @@ offset_right = 400.0 offset_bottom = 200.0 text = "11" -[node name="btn_p8" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p8" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 110.0 offset_top = 150.0 @@ -73,7 +75,7 @@ offset_right = 200.0 offset_bottom = 200.0 text = "9" -[node name="btn_p9" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p9" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 10.0 offset_top = 150.0 @@ -81,7 +83,7 @@ offset_right = 100.0 offset_bottom = 200.0 text = "8" -[node name="btn_p10" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p10" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 1 anchors_preset = -1 offset_left = 310.0 @@ -92,7 +94,7 @@ grow_horizontal = 2 grow_vertical = 2 text = "7" -[node name="btn_p11" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p11" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 310.0 offset_top = 30.0 @@ -100,7 +102,7 @@ offset_right = 399.0 offset_bottom = 80.0 text = "3" -[node name="btn_p12" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p12" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 1 anchors_preset = -1 offset_left = 10.0 @@ -111,7 +113,7 @@ grow_horizontal = 2 grow_vertical = 2 text = "4" -[node name="btn_p13" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p13" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 1 anchors_preset = -1 offset_left = 110.0 @@ -122,7 +124,7 @@ grow_horizontal = 2 grow_vertical = 2 text = "5" -[node name="btn_p14" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p14" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 1 anchors_preset = -1 offset_left = 210.0 @@ -133,7 +135,7 @@ grow_horizontal = 2 grow_vertical = 2 text = "6" -[node name="btn_p15" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p15" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 1 anchors_preset = -1 offset_left = 210.0 @@ -144,7 +146,7 @@ grow_horizontal = 2 grow_vertical = 2 text = "2" -[node name="btn_p16" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_p16" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 110.0 offset_top = 30.0 @@ -152,7 +154,7 @@ offset_right = 200.0 offset_bottom = 80.0 text = "1" -[node name="btn_auto_rfi" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")] +[node name="btn_auto_rfi" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 210.0 offset_top = 210.0 @@ -160,7 +162,7 @@ offset_right = 400.0 offset_bottom = 260.0 text = "Автоматически" -[node name="рамка-цели" parent="." instance=ExtResource("11_pmacq")] +[node name="рамка-цели" parent="." instance=ExtResource("3_hqrod")] layout_mode = 0 offset_left = 1180.0 offset_top = 547.0 @@ -364,7 +366,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "2" horizontal_alignment = 1 -[node name="рамка-общие" parent="." instance=ExtResource("11_pmacq")] +[node name="рамка-общие" parent="." instance=ExtResource("3_hqrod")] layout_mode = 0 offset_left = 1180.0 offset_top = 276.0 @@ -461,7 +463,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "3" horizontal_alignment = 1 -[node name="рамка-сеансы" parent="." instance=ExtResource("11_pmacq")] +[node name="рамка-сеансы" parent="." instance=ExtResource("3_hqrod")] layout_mode = 0 offset_left = 1180.0 offset_top = 436.0 @@ -555,37 +557,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "ПД-М4С" horizontal_alignment = 1 -[node name="надпись-качка" type="Label" parent="."] -layout_mode = 0 -offset_left = 87.0 -offset_top = 954.0 -offset_right = 133.0 -offset_bottom = 976.0 -text = "Качка" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="lbl_b45" type="Label" parent="."] -layout_mode = 0 -offset_left = 191.0 -offset_top = 1057.0 -offset_right = 237.0 -offset_bottom = 1079.0 -text = "45" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="lbl_k45" type="Label" parent="."] -layout_mode = 0 -offset_left = 84.0 -offset_top = 1154.0 -offset_right = 130.0 -offset_bottom = 1176.0 -text = "-45" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="рамка-помеха" parent="." instance=ExtResource("11_pmacq")] +[node name="рамка-помеха" parent="." instance=ExtResource("3_hqrod")] layout_mode = 0 offset_left = 1180.0 offset_top = 6.0 @@ -744,7 +716,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "ЛЧМ" horizontal_alignment = 1 -[node name="btn_auto_threat" parent="." instance=ExtResource("12_pcemc")] +[node name="btn_auto_threat" parent="." instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 980.0 offset_top = 1101.0 @@ -752,7 +724,7 @@ offset_right = 1170.0 offset_bottom = 1151.0 text = "Автоматически" -[node name="btn_strobe" parent="." instance=ExtResource("12_pcemc")] +[node name="btn_strobe" parent="." instance=ExtResource("4_vg7if")] layout_mode = 0 offset_left = 980.0 offset_top = 30.0 diff --git a/shaders/bip.gdshader b/shaders/bip.gdshader new file mode 100644 index 0000000..bfbc50b --- /dev/null +++ b/shaders/bip.gdshader @@ -0,0 +1,18 @@ +shader_type canvas_item; + +uniform vec4 color: source_color = vec4(1, 1, 1, 1); +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 rate = 10.0; + +float smooth_px(float r, float R) +{ + return 1.0 - smoothstep(R - ds, R + ds, r); +} + +void fragment() +{ + COLOR = vec4(1.0, 1.0, 1.0, 1.); + COLOR = color * smooth_px(length(UV - center), radius); +} diff --git a/shaders/sector.gdshader b/shaders/sector.gdshader new file mode 100644 index 0000000..c690e3a --- /dev/null +++ b/shaders/sector.gdshader @@ -0,0 +1,41 @@ +shader_type canvas_item; + +uniform vec4 color: source_color = vec4(1, 1, 1, 1); +uniform float width: hint_range(0.0, 360.0, 0.1) = 45.0; +uniform float inner_radius: hint_range(0.0, 0.125, 0.0001) = 0.1; +uniform float outer_radius: hint_range(0.0, 0.125, 0.0001) = 0.125; + +const vec2 center = vec2(0.125, 0.125); // Центр должен быть в (0.5, 0.5) но по неведомой причине это не так +const float dsa = 0.0025; // Относительное расстояние на котором выполняется сглаживание краёв +const float dsr = 0.00025; // Относительное расстояние на котором выполняется сглаживание краёв + + +float smooth_px(float r, float R, float ds) +{ + return 1.0 - smoothstep(R - ds, R + ds, r); +} + + +void sector(inout vec4 uv_color, vec2 uv_pos, float r0, float r1, float w, vec4 c) +{ + vec2 d = uv_pos - center; + float theta = atan(d.x, d.y); + w = radians(w / 2.0); + float l = distance(center, uv_pos); + float vr = smooth_px(r0, l, dsr) - smooth_px(r1, l, dsr); + float va = smooth_px(-w, theta, dsa) - smooth_px(w, theta, dsa); + uv_color *= sqrt(va * vr) * c; +} + + +void rotate_vertex(inout vec2 vert, float a) +{ + vert *= mat2(vec2(cos(a), sin(a)), vec2(-sin(a), cos(a))); +} + + +void fragment() +{ + COLOR = vec4(1.0, 1.0, 1.0, 1.0); + sector(COLOR, UV, inner_radius, outer_radius, width, color); +} diff --git a/shaders/shader_edu.tres b/shaders/shader_edu.tres index 6ad2442..3faf3f9 100644 --- a/shaders/shader_edu.tres +++ b/shaders/shader_edu.tres @@ -9,11 +9,11 @@ uniform vec2 pc2; uniform vec2 tr0; uniform vec2 tr1; uniform vec2 tr2; -uniform float sec_var = 0.0; -uniform float ap_ant_w = 12.0; -uniform vec4 ap_ant_col; +uniform float strob_dir = 0.0; +uniform float strob_dir_width = 12.0; +uniform vec4 strob_color; -#define ANTENNAS_GRID_SIZE 7 +const float ANTENNAS_GRID_SIZE = 7.0; const float line_width = 2.0; const float ant_band_count_0 = 2.0; @@ -40,10 +40,9 @@ const float ant_band_r1_4 = 450.0; const float ant_band_r1_5 = 500.0; const float ant_band_r1_6 = 550.0; const float d4 = 90.0; -const float ap_ant_alpha = 0.3; -const vec4 blue0 = vec4(0.38, 0.47, 0.51, 1.0); -const vec4 blue1 = vec4(0.39, 0.44, 0.50, 1.0); +const vec4 blue0 = vec4(0.38, 0.47, 0.51, 0.4); +const vec4 blue1 = vec4(0.39, 0.44, 0.50, 0.4); float SMOOTH(float r, float R) @@ -52,7 +51,7 @@ float SMOOTH(float r, float R) } -void sector(inout vec3 c, vec2 uv, vec2 center, float a, float da, float r0, float r1, vec3 color, float alpha) +void sector(inout vec4 c, vec2 uv, vec2 center, float a, float da, float r0, float r1, vec4 color) { float l = distance(center, uv); vec2 d = uv - center; @@ -63,24 +62,18 @@ void sector(inout vec3 c, vec2 uv, vec2 center, float a, float da, float r0, flo float a1 = radians(a + da); float va = SMOOTH(a0 * sf, theta) - SMOOTH(a1 * sf, theta); float vr = SMOOTH(r0, l) - SMOOTH(r1, l); - c += color * sqrt(va * vr) * alpha; + c.rgb += color.rgb * sqrt(va * vr) * color.a; } -void bip1(inout vec3 color, vec2 uv, vec2 center, float r, vec3 c, float a) -{ - color += c * SMOOTH(length(uv - center), r) * a; -} - - -void antenas(inout vec3 c, vec2 uv, vec2 p0, float cnt, float r0, float r1, vec3 c0, vec3 c1, float a) +void antenas(inout vec4 c, vec2 uv, vec2 p0, float cnt, float r0, float r1, vec4 c0, vec4 c1) { float da = 180.0f / float(cnt); for (int i = int(-cnt); i <= int(cnt); i ++) { float v = float(i & 1); - vec3 col = v * c0 + (1.0f - v) * c1; - sector(c, uv, p0, float(i) * da, da, r0, r1, col, a); + vec4 col = v * c0 + (1.0f - v) * c1; + sector(c, uv, p0, float(i) * da, da, r0, r1, col); } } @@ -94,12 +87,12 @@ void circle_thin(inout vec3 color, vec2 uv, vec2 p, float r, float w, vec3 c, fl } -void line_r(inout vec3 color, vec2 uv, vec2 center, float theta0, float radius, vec3 c, float a) +void line_r(inout vec4 color, vec2 uv, vec2 center, float theta0, float radius, vec4 c) { vec2 d = uv - center; vec2 p = radius * vec2(cos(theta0 * PI / 180.0), - sin(theta0 * PI / 180.0)); float l = length(d - p * clamp(dot(d, p) / dot(p, p), 0.0, 1.0)); - color += c * SMOOTH(l, 1.0); + color.rgb += c.rgb * SMOOTH(l, 1.0) * c.a; } @@ -121,30 +114,14 @@ void fragment() vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях COLOR = vec4(0, 0, 0, 1.0); //texture(TEXTURE, UV); // Цвет текущей точки - // Сектор направления - sector(COLOR.rgb, uv, pc0, get_ang_atack(450.0 - sec_var), ap_ant_w, float(ant_band_r0_0), float(ant_band_r1_6), ap_ant_col.rgb, ap_ant_alpha); - // Сетка антенн - antenas(COLOR.rgb, uv, pc0, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, blue1.rgb, blue0.rgb, 0.4); - antenas(COLOR.rgb, uv, pc0, ant_band_count_1, ant_band_r0_1, ant_band_r1_1, blue0.rgb, blue1.rgb, 0.4); - antenas(COLOR.rgb, uv, pc0, ant_band_count_2, ant_band_r0_2, ant_band_r1_2, blue1.rgb, blue0.rgb, 0.4); - antenas(COLOR.rgb, uv, pc0, ant_band_count_3, ant_band_r0_3, ant_band_r1_3, blue0.rgb, blue1.rgb, 0.4); - antenas(COLOR.rgb, uv, pc0, ant_band_count_4, ant_band_r0_4, ant_band_r1_4, blue1.rgb, blue0.rgb, 0.4); - antenas(COLOR.rgb, uv, pc0, ant_band_count_5, ant_band_r0_5, ant_band_r1_5, blue0.rgb, blue1.rgb, 0.4); - antenas(COLOR.rgb, uv, pc0, ant_band_count_6, ant_band_r0_6, ant_band_r1_6, blue1.rgb, blue0.rgb, 0.4); - - // Цели - bip1(COLOR.rgb, uv, tr0, 13.0, blue1.rgb, 1.0); - bip1(COLOR.rgb, uv, tr1, 13.0, blue1.rgb, 1.0); - bip1(COLOR.rgb, uv, tr2, 13.0, blue1.rgb, 1.0); - - // Качка - circle_thin(COLOR.rgb, uv, pc1, d4, line_width, blue1.rgb, 1.0); - line_r(COLOR.rgb, uv, pc1, 0, d4, blue1.rgb, 1.0); - line_r(COLOR.rgb, uv, pc1, 90, d4, blue1.rgb, 1.0); - line_r(COLOR.rgb, uv, pc1, 180, d4, blue1.rgb, 1.0); - line_r(COLOR.rgb, uv, pc1, 270, d4, blue1.rgb, 1.0); - bip1(COLOR.rgb, uv, pc2, 13.0, blue1.rgb, 1.0); + antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, blue1, blue0); + antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1, ant_band_r1_1, blue0, blue1); + antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2, ant_band_r1_2, blue1, blue0); + antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3, ant_band_r1_3, blue0, blue1); + antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4, ant_band_r1_4, blue1, blue0); + antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5, ant_band_r1_5, blue0, blue1); + antenas(COLOR, uv, pc0, ant_band_count_6, ant_band_r0_6, ant_band_r1_6, blue1, blue0); } " @@ -156,6 +133,6 @@ shader_parameter/pc2 = Vector2(100, 1065) shader_parameter/tr0 = Vector2(600, 1000) shader_parameter/tr1 = Vector2(1000, 600) shader_parameter/tr2 = Vector2(300, 400) -shader_parameter/sec_var = 0.0 -shader_parameter/ap_ant_w = 12.0 -shader_parameter/ap_ant_col = null +shader_parameter/strob_dir = 0.0 +shader_parameter/strob_dir_width = 12.0 +shader_parameter/strob_color = null diff --git a/tab_container_stc.gd b/tab_container_stc.gd index 0a82c8c..5acbb5a 100644 --- a/tab_container_stc.gd +++ b/tab_container_stc.gd @@ -7,7 +7,7 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): +func _process(_delta): pass diff --git a/tab_container_stc.tscn b/tab_container_stc.tscn index 97965bc..86e30ff 100644 --- a/tab_container_stc.tscn +++ b/tab_container_stc.tscn @@ -1,21 +1,21 @@ [gd_scene load_steps=10 format=3 uid="uid://cbfp6bylx8g4i"] -[ext_resource type="Texture2D" uid="uid://tfju4shlxd7g" path="res://data/1.png" id="1_5wdck"] -[ext_resource type="Script" path="res://tab_container_stc.gd" id="1_6hxhh"] -[ext_resource type="Texture2D" uid="uid://bhvo4qe45sof6" path="res://data/2.png" id="2_iwy0o"] -[ext_resource type="Texture2D" uid="uid://eixrw0k33lan" path="res://data/3.png" id="3_378a8"] -[ext_resource type="Texture2D" uid="uid://c52qoo3dp877e" path="res://data/4.png" id="4_n106p"] -[ext_resource type="Texture2D" uid="uid://kx8tn03k5ips" path="res://data/5.png" id="5_gkcgk"] -[ext_resource type="Texture2D" uid="uid://b6jjplsdvxmh2" path="res://data/7.png" id="6_7khta"] -[ext_resource type="Texture2D" uid="uid://cv2cj5ffmcked" path="res://data/6.png" id="7_3ndk8"] -[ext_resource type="VideoStream" path="res://data/dji-mini-2.mkv.ogv" id="9_3phym"] +[ext_resource type="Script" path="res://tab_container_stc.gd" id="1_xhvjk"] +[ext_resource type="Texture2D" uid="uid://tfju4shlxd7g" path="res://data/1.png" id="2_b360a"] +[ext_resource type="Texture2D" uid="uid://bhvo4qe45sof6" path="res://data/2.png" id="3_5v0ar"] +[ext_resource type="Texture2D" uid="uid://eixrw0k33lan" path="res://data/3.png" id="4_4ffa7"] +[ext_resource type="Texture2D" uid="uid://c52qoo3dp877e" path="res://data/4.png" id="5_81lhn"] +[ext_resource type="Texture2D" uid="uid://kx8tn03k5ips" path="res://data/5.png" id="6_8drcw"] +[ext_resource type="Texture2D" uid="uid://b6jjplsdvxmh2" path="res://data/7.png" id="7_b5lkb"] +[ext_resource type="Texture2D" uid="uid://cv2cj5ffmcked" path="res://data/6.png" id="8_ef4ag"] +[ext_resource type="VideoStream" path="res://data/dji-mini-2.mkv.ogv" id="9_3hyy5"] [node name="TabContainer" type="TabContainer"] offset_left = 10.0 offset_top = 5.0 offset_right = 1595.0 offset_bottom = 1200.0 -script = ExtResource("1_6hxhh") +script = ExtResource("1_xhvjk") [node name="Panel1" type="Panel" parent="."] layout_mode = 2 @@ -23,7 +23,7 @@ layout_mode = 2 [node name="Sprite2D1" type="Sprite2D" parent="Panel1"] position = Vector2(792.5, 589) scale = Vector2(1.22951, 1.43142) -texture = ExtResource("1_5wdck") +texture = ExtResource("2_b360a") [node name="Panel2" type="Panel" parent="."] visible = false @@ -32,7 +32,7 @@ layout_mode = 2 [node name="Sprite2D2" type="Sprite2D" parent="Panel2"] position = Vector2(789.5, 586) scale = Vector2(1.20724, 1.54768) -texture = ExtResource("2_iwy0o") +texture = ExtResource("3_5v0ar") [node name="Panel3" type="Panel" parent="."] visible = false @@ -41,7 +41,7 @@ layout_mode = 2 [node name="Sprite2D3" type="Sprite2D" parent="Panel3"] position = Vector2(795.75, 582.25) scale = Vector2(1.23536, 1.44257) -texture = ExtResource("3_378a8") +texture = ExtResource("4_4ffa7") [node name="Panel4" type="Panel" parent="."] visible = false @@ -50,7 +50,7 @@ layout_mode = 2 [node name="Sprite2D4" type="Sprite2D" parent="Panel4"] position = Vector2(799.25, 582.75) scale = Vector2(1.24902, 1.44271) -texture = ExtResource("4_n106p") +texture = ExtResource("5_81lhn") [node name="Panel5" type="Panel" parent="."] visible = false @@ -59,7 +59,7 @@ layout_mode = 2 [node name="Sprite2D5" type="Sprite2D" parent="Panel5"] position = Vector2(797.5, 586.5) scale = Vector2(1.34957, 1.69559) -texture = ExtResource("5_gkcgk") +texture = ExtResource("6_8drcw") [node name="Panel7" type="Panel" parent="."] visible = false @@ -68,7 +68,7 @@ layout_mode = 2 [node name="Sprite2D7" type="Sprite2D" parent="Panel7"] position = Vector2(790, 586) scale = Vector2(1.24219, 1.7432) -texture = ExtResource("6_7khta") +texture = ExtResource("7_b5lkb") [node name="Panel6" type="Panel" parent="."] visible = false @@ -77,7 +77,7 @@ layout_mode = 2 [node name="Sprite2D6" type="Sprite2D" parent="Panel6"] position = Vector2(790, 577) scale = Vector2(1.23437, 1.73112) -texture = ExtResource("7_3ndk8") +texture = ExtResource("8_ef4ag") [node name="Panel8" type="Panel" parent="."] visible = false @@ -89,7 +89,7 @@ offset_left = 8.0 offset_top = 9.0 offset_right = 1570.0 offset_bottom = 1155.0 -stream = ExtResource("9_3phym") +stream = ExtResource("9_3hyy5") expand = true [connection signal="tab_changed" from="." to="." method="_on_tab_changed"]