From fd93e4f215ac5785fd170271303fad335497f580 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 18 Apr 2023 09:25:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=92=D0=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.tscn | 16 ++++++++ project.godot | 16 ++++---- scenes/nine-patch-button.gd | 1 - scenes/кнопка-помеха.tscn | 49 ------------------------- scenes/рамка.tscn | 26 ------------- scenes/ячейка-1.tscn | 8 ---- shaders/shader_edu.tres | 73 +++++++++++++++++++++++++++---------- работа.gd | 29 --------------- 8 files changed, 76 insertions(+), 142 deletions(-) create mode 100644 main.tscn delete mode 100644 scenes/кнопка-помеха.tscn delete mode 100644 scenes/рамка.tscn delete mode 100644 scenes/ячейка-1.tscn delete mode 100644 работа.gd diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..82faed1 --- /dev/null +++ b/main.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=3 uid="uid://cu3e03by7d61j"] + +[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="2_70q2b"] +[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="9_jpswg"] + +[node name="tab_switch" type="TabContainer"] +offset_top = -2.0 +offset_right = 1600.0 +offset_bottom = 1200.0 + +[node name="работа" parent="." instance=ExtResource("2_70q2b")] +layout_mode = 2 + +[node name="контроль" parent="." instance=ExtResource("9_jpswg")] +visible = false +layout_mode = 2 diff --git a/project.godot b/project.godot index 0df07d0..ad61879 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="uarep-ctl" -run/main_scene="res://Control.tscn" +run/main_scene="res://main.tscn" config/features=PackedStringArray("4.0") run/low_processor_mode=true boot_splash/show_image=false @@ -20,12 +20,15 @@ boot_splash/use_filter=false config/icon="res://data/icon.png" run/delta_sync_after_draw=true +[debug] + +file_logging/enable_file_logging=true + [display] window/size/viewport_width=1600 window/size/viewport_height=1200 -window/size/resizable=false -window/size/borderless=true +window/stretch/mode="viewport" window/vsync/vsync_mode=false [editor_plugins] @@ -46,14 +49,9 @@ buffering/agile_event_flushing=true file_logging/enable_file_logging=true -[physics] - -common/enable_pause_aware_picking=true - [rendering] renderer/rendering_method="gl_compatibility" +textures/default_filters/anisotropic_filtering_level=0 environment/defaults/default_environment="res://default_env.tres" quality/driver/fallback_to_gles2=true -quality/intended_usage/framebuffer_allocation.mobile=2 -quality/filters/msaa=1 diff --git a/scenes/nine-patch-button.gd b/scenes/nine-patch-button.gd index 73ff2c6..ca241ea 100644 --- a/scenes/nine-patch-button.gd +++ b/scenes/nine-patch-button.gd @@ -25,7 +25,6 @@ func is_pressed(): return $button.is_pressed() func is_toggle_mode(): return $button.is_toggle_mode() - func _on_button_toggled(val: bool): if val: $state.set_texture(texture_state1) else: $state.set_texture(texture_state0) diff --git a/scenes/кнопка-помеха.tscn b/scenes/кнопка-помеха.tscn deleted file mode 100644 index 1b01bbb..0000000 --- a/scenes/кнопка-помеха.tscn +++ /dev/null @@ -1,49 +0,0 @@ -[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"] - -[sub_resource type="StyleBoxEmpty" id="1"] - -[sub_resource type="StyleBoxEmpty" id="6"] - -[sub_resource type="StyleBoxEmpty" id="2"] - -[sub_resource type="StyleBoxEmpty" id="3"] - -[sub_resource type="StyleBoxEmpty" id="5"] - -[sub_resource type="StyleBoxEmpty" id="4"] - -[node name="container" type="PanelContainer"] -offset_right = 30.0 -offset_bottom = 30.0 -theme_override_styles/panel = SubResource("1") -script = ExtResource("2") -toggle_mode = true - -[node name="state" type="NinePatchRect" parent="."] -show_behind_parent = true -layout_mode = 2 -texture = ExtResource("1") -patch_margin_left = 10 -patch_margin_top = 10 -patch_margin_right = 10 -patch_margin_bottom = 10 -axis_stretch_horizontal = 1 -axis_stretch_vertical = 1 - -[node name="button" type="Button" parent="."] -layout_mode = 2 -theme_override_styles/normal = SubResource("6") -theme_override_styles/hover = SubResource("2") -theme_override_styles/pressed = SubResource("3") -theme_override_styles/disabled = SubResource("5") -theme_override_styles/focus = SubResource("4") -toggle_mode = true -clip_text = true - -[node name="label" type="Label" parent="."] -layout_mode = 2 - -[connection signal="toggled" from="button" to="." method="_on_button_toggled"] diff --git a/scenes/рамка.tscn b/scenes/рамка.tscn deleted file mode 100644 index 5f8cf3c..0000000 --- a/scenes/рамка.tscn +++ /dev/null @@ -1,26 +0,0 @@ -[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"] - -[node name="ramka" type="NinePatchRect"] -offset_right = 150.0 -offset_bottom = 100.0 -texture = ExtResource("2") -patch_margin_left = 15 -patch_margin_top = 30 -patch_margin_right = 15 -patch_margin_bottom = 10 -script = ExtResource("1") - -[node name="header" type="Label" parent="."] -clip_contents = true -layout_mode = 1 -anchors_preset = 10 -anchor_right = 1.0 -offset_bottom = 22.0 -grow_horizontal = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -text = "caption text" -horizontal_alignment = 1 -vertical_alignment = 1 diff --git a/scenes/ячейка-1.tscn b/scenes/ячейка-1.tscn deleted file mode 100644 index 0762438..0000000 --- a/scenes/ячейка-1.tscn +++ /dev/null @@ -1,8 +0,0 @@ -[gd_scene format=2] - -[node name="Label" type="Label"] -margin_right = 122.0 -margin_bottom = 34.0 -custom_colors/font_color = Color( 1, 0.596078, 0.4, 1 ) -valign = 1 -clip_text = true diff --git a/shaders/shader_edu.tres b/shaders/shader_edu.tres index 888725a..5506799 100644 --- a/shaders/shader_edu.tres +++ b/shaders/shader_edu.tres @@ -43,9 +43,9 @@ uniform float ap_ant_w = 12.0; uniform vec2 tr0 = vec2(0, 0); uniform vec2 tr1 = vec2(0, 0); uniform vec2 tr2 = vec2(0, 0); +uniform float sec_var = 0.0; -// Массивы не работают -// uniform int band_ants[3]; // количество антенн, радиус внутренний, радиус внешний, подстройка по углу +uniform int band_ants[3]; // количество антенн, радиус внутренний, радиус внешний, подстройка по углу float SMOOTH(float r, float R) { @@ -90,6 +90,7 @@ vec3 radar_scan_line(vec2 uv, vec2 center, float time, float radius, vec3 color) else return vec3(0, 0, 0); } + void sector(inout vec3 c, vec2 uv, vec2 center, float a, float da, float r0, float r1, vec3 color) { float l = distance(center, uv); @@ -105,6 +106,32 @@ void sector(inout vec3 c, vec2 uv, vec2 center, float a, float da, float r0, flo } +void rotate_uv(inout vec2 uv, float a) +{ + float mid = 0.5; + uv.x = cos(a) * (uv.x - mid) + sin(a) * (uv.y - mid) + mid; + uv.y = cos(a) * (uv.x - mid) - sin(a) * (uv.x - mid) + mid; +} + + + + +void sector2(inout vec3 c, vec2 uv, vec2 center, float a, float da, float r0, float r1, vec3 color) +{ + rotate_uv(uv, 0.0); + float l = distance(center, uv); + vec2 d = uv - center; + 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(a0 * sf, theta) - SMOOTH(a1 * sf, theta); + float vr = SMOOTH(r0, l) - SMOOTH(r1, l); + c += color * sqrt(va * vr); +} + + void circle(inout vec3 c, vec2 uv, vec2 p0, float radius, float width, vec3 color) { float r = length(uv - p0); @@ -271,10 +298,10 @@ void fragment() //line_r(COLOR.rgb, uv, pc0, 225, 580, blue1.rgb, 1.0); //line_r(COLOR.rgb, uv, pc0, 315, 580, blue1.rgb, 1.0); - //sector(COLOR.rgb, uv, pc0, sec_forward, ap_ant_w, 280, 580, red.rgb); - //sector(COLOR.rgb, uv, pc0, sec_back, ap_ant_w, 280, 580, red.rgb); - //sector(COLOR.rgb, uv, pc0, sec_left, ap_ant_w, 280, 580, red.rgb); - //sector(COLOR.rgb, uv, pc0, sec_right, ap_ant_w, 280, 580, red.rgb); + sector2(COLOR.rgb, uv, pc0, sec_var, ap_ant_w, 280, 580, red.rgb); + //sector(COLOR.rgb, uv, pc0, sec_back, ap_ant_w, 280, 580, red.rgb); + //sector(COLOR.rgb, uv, pc0, sec_left, ap_ant_w, 280, 580, red.rgb); + //sector(COLOR.rgb, uv, pc0, sec_right, ap_ant_w, 280, 580, red.rgb); //antenas(COLOR.rgb, uv, pc0, ants_count, d6 / 2.0, d7 / 2.0, blue0.rgb, blue1.rgb, 0.3, 7.5); antenas(COLOR.rgb, uv, pc0, 2, 220, 280, blue1.rgb, blue0.rgb, 0.4, 0); @@ -283,6 +310,10 @@ void fragment() antenas(COLOR.rgb, uv, pc0, 2, 400, 460, blue0.rgb, blue1.rgb, 0.4, 0); antenas(COLOR.rgb, uv, pc0, 2, 460, 520, blue1.rgb, blue0.rgb, 0.4, 0); antenas(COLOR.rgb, uv, pc0, 2, 520, 580, blue0.rgb, blue1.rgb, 0.4, 0); + + //antenas(COLOR.rgb, uv, pc0, band_ants[0], 100, 120, blue0.rgb, blue1.rgb, 0.4, 0); + //antenas(COLOR.rgb, uv, pc0, band_ants[1], 125, 150, blue0.rgb, blue1.rgb, 0.4, 0); + //antenas(COLOR.rgb, uv, pc0, band_ants[2], 155, 180, blue0.rgb, blue1.rgb, 0.4, 0); bip1(COLOR.rgb, uv, tr0, 13.0, blue1.rgb, 1.0); bip1(COLOR.rgb, uv, tr1, 13.0, blue1.rgb, 1.0); @@ -310,29 +341,31 @@ void fragment() [resource] shader = SubResource("1") -shader_parameter/blue0 = Color(0.378, 0.4272, 0.45, 1) -shader_parameter/blue1 = Color(0.336, 0.3808, 0.4, 1) +shader_parameter/blue0 = Color(0.38, 0.47, 0.51, 1) +shader_parameter/blue1 = Color(0.39, 0.44, 0.5, 1) shader_parameter/blue2 = Color(0.11, 0.21, 0.25, 1) shader_parameter/blue3 = Color(0.35, 0.76, 0.83, 1) shader_parameter/blue4 = Color(0.953, 0.969, 0.89, 1) shader_parameter/red = Color(1, 0.38, 0.227, 1) shader_parameter/line_width = 2.0 -shader_parameter/sec_forward = 0.0 -shader_parameter/sec_back = 90.0 -shader_parameter/sec_left = 180.0 -shader_parameter/sec_right = 270.0 +shader_parameter/sec_forward = 180.0 +shader_parameter/sec_back = 0.0 +shader_parameter/sec_left = 90.0 +shader_parameter/sec_right = 300.0 shader_parameter/d0 = 520.0 -shader_parameter/d1 = 1110.0 -shader_parameter/d2 = 1150.0 +shader_parameter/d1 = 1120.0 +shader_parameter/d2 = 1160.0 shader_parameter/d3 = 100.0 shader_parameter/d4 = 180.0 shader_parameter/d5 = 650.0 shader_parameter/d6 = 800.0 shader_parameter/d7 = 950.0 -shader_parameter/pc0 = Vector2(600, 600) -shader_parameter/pc1 = Vector2(120, 1090) -shader_parameter/pc2 = Vector2(90, 1110) +shader_parameter/pc0 = Vector2(590, 600) +shader_parameter/pc1 = Vector2(110, 1070) +shader_parameter/pc2 = Vector2(100, 1060) shader_parameter/ap_ant_w = 12.0 -shader_parameter/tr0 = Vector2(300, 400) -shader_parameter/tr1 = Vector2(500, 1000) -shader_parameter/tr2 = Vector2(1020, 240) +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/band_ants = PackedInt32Array(8, 8, 12) diff --git a/работа.gd b/работа.gd deleted file mode 100644 index 8897b3d..0000000 --- a/работа.gd +++ /dev/null @@ -1,29 +0,0 @@ -extends Panel - -const TableHeaderType = preload('res://scenes/ячейка-1.tscn') -const TableNodeType = preload('res://scenes/node.tscn') - -const CELI_HEADERS_TEXT = [ 'Параметр', 'Значение' ] -const CELI_HEADER_ALIGMENT = [ HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER ] -const CELI_HEADERS_TYPES = [ TableHeaderType, TableHeaderType ] -const CELI_COLUMNS_SIZE = [ 100, 100 ] -const CELI_NODES_TYPES = [ TableNodeType, TableNodeType ] -const CELI_TEXT = [ [ 'Частота, МГц', '2600' ], \ - [ 'Пееленг', '26' ] ] - - -# Called when the node enters the scene tree for the first time. -func _ready(): - var tbl_celi = get_node('ramka_celi/tbl_celi') - tbl_celi.set_header(CELI_HEADERS_TYPES) - tbl_celi.set_header_text(CELI_HEADERS_TEXT) - tbl_celi.add_row(CELI_NODES_TYPES) - tbl_celi.add_row(CELI_NODES_TYPES) - tbl_celi.set_rows_text(CELI_TEXT) - tbl_celi.set_columns_alignments(CELI_HEADER_ALIGMENT) - tbl_celi.set_columns_min_size(CELI_COLUMNS_SIZE) - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass