Добавление шейдеров
This commit is contained in:
62
PRD.gd
62
PRD.gd
@@ -3,7 +3,7 @@ extends Node2D
|
|||||||
var unit = Yau07.YaU07.new('ЯУ07')
|
var unit = Yau07.YaU07.new('ЯУ07')
|
||||||
var soc_unicast: Socket
|
var soc_unicast: Socket
|
||||||
var soc_brodcast: Socket
|
var soc_brodcast: Socket
|
||||||
var address: String = '0.0.0.0'
|
var address: String = '10.1.1.11'
|
||||||
var ports_wr: Dictionary # Словарь с портами для записи
|
var ports_wr: Dictionary # Словарь с портами для записи
|
||||||
var port: int
|
var port: int
|
||||||
var broadcast_packet: PackedByteArray
|
var broadcast_packet: PackedByteArray
|
||||||
@@ -12,6 +12,7 @@ var timeout: float = Yau07.ONLINE_TIMEOUT
|
|||||||
var last_update_time: float = 0.0
|
var last_update_time: float = 0.0
|
||||||
var flag_yau_control: bool
|
var flag_yau_control: bool
|
||||||
|
|
||||||
|
|
||||||
## Класс для отправки данных в сокет
|
## Класс для отправки данных в сокет
|
||||||
class Socket extends PacketPeerUDP:
|
class Socket extends PacketPeerUDP:
|
||||||
func send_to(addr: String, port: int, data: PackedByteArray):
|
func send_to(addr: String, port: int, data: PackedByteArray):
|
||||||
@@ -31,8 +32,7 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник
|
|||||||
$control_dev/control_dev.get_node2(0, 0).modulate = Constants.GREEN
|
$control_dev/control_dev.get_node2(0, 0).modulate = Constants.GREEN
|
||||||
flag_yau_control = true
|
flag_yau_control = true
|
||||||
last_update_time = 0.0
|
last_update_time = 0.0
|
||||||
|
unit.parse(broadcast_packet)
|
||||||
#unit.parse(broadcast_packet)
|
|
||||||
else:
|
else:
|
||||||
if sock.get_available_packet_count():
|
if sock.get_available_packet_count():
|
||||||
last_update_time = 0.0
|
last_update_time = 0.0
|
||||||
@@ -44,14 +44,16 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
# Таблица 1
|
|
||||||
|
# Таблица 1 (temp)
|
||||||
node_select1 = $scroll1/table1
|
node_select1 = $scroll1/table1
|
||||||
draw_tabl(node_select1, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
|
draw_tabl(node_select1, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
|
||||||
|
|
||||||
# Выбор прибора для подключения
|
# Выбор прибора для подключения
|
||||||
var node_select_device = $select_dev/select_dev
|
var node_select_device = $select_dev/select_dev
|
||||||
draw_tabl(node_select_device, Constants.SELECT_DEVIСE, Constants.SELECT_DEVIСE.size())
|
draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size())
|
||||||
var get_select_device = node_select_device.get_node2(1, 0)
|
var get_select_device = node_select_device.get_node2(1, 0)
|
||||||
|
|
||||||
# Заполнение адресов
|
# Заполнение адресов
|
||||||
for i_addr in Constants.ADDRESSES.size():
|
for i_addr in Constants.ADDRESSES.size():
|
||||||
get_select_device.add_item(Constants.ADDRESSES[i_addr][0])
|
get_select_device.add_item(Constants.ADDRESSES[i_addr][0])
|
||||||
@@ -62,9 +64,10 @@ func _ready() -> void:
|
|||||||
|
|
||||||
# Контроль
|
# Контроль
|
||||||
var node_control_device = $control_dev/control_dev
|
var node_control_device = $control_dev/control_dev
|
||||||
draw_tabl(node_control_device, Constants.CONTROL_DEVICE, Constants.CONTROL_DEVICE.size())
|
draw_tabl(node_control_device, Constants.CONTROL_TABLE, Constants.CONTROL_TABLE.size())
|
||||||
|
for i in Constants.CONTROL_DEVICE.size():
|
||||||
|
node_control_device.get_node2(0, i).text = Constants.CONTROL_DEVICE[i]
|
||||||
node_control_device.set_columns_min_size([300])
|
node_control_device.set_columns_min_size([300])
|
||||||
|
|
||||||
|
|
||||||
# Привязка для принятия широковещательного канала
|
# Привязка для принятия широковещательного канала
|
||||||
soc_brodcast = Socket.new()
|
soc_brodcast = Socket.new()
|
||||||
@@ -80,7 +83,7 @@ func _ready() -> void:
|
|||||||
unit.connect('line_changed', Callable(self, 'on_line_changed'))
|
unit.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||||
unit.connect('command_fail', Callable(self, 'on_command_fail'))
|
unit.connect('command_fail', Callable(self, 'on_command_fail'))
|
||||||
unit.connect('command_done', Callable(self, 'on_command_done'))
|
unit.connect('command_done', Callable(self, 'on_command_done'))
|
||||||
|
unit.connect('data_received', Callable(self, 'data_received'))
|
||||||
|
|
||||||
## Рисует таблицу
|
## Рисует таблицу
|
||||||
func draw_tabl(tbl, row: Array, count_row: int):
|
func draw_tabl(tbl, row: Array, count_row: int):
|
||||||
@@ -91,7 +94,7 @@ func draw_tabl(tbl, row: Array, count_row: int):
|
|||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
last_update_time += delta
|
last_update_time += delta
|
||||||
poll_receive(soc_brodcast)
|
poll_receive(soc_brodcast)
|
||||||
if broadcast_packet and flag_yau_control:
|
if broadcast_packet:
|
||||||
parse_broadcast(broadcast_packet)
|
parse_broadcast(broadcast_packet)
|
||||||
|
|
||||||
match unit.process(delta):
|
match unit.process(delta):
|
||||||
@@ -125,29 +128,29 @@ func parse_broadcast(packet):
|
|||||||
node_select1.set_node_text(2, 0, '%d' % dry_contact)
|
node_select1.set_node_text(2, 0, '%d' % dry_contact)
|
||||||
for i in 9:
|
for i in 9:
|
||||||
if i == 0:
|
if i == 0:
|
||||||
node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП МАА №1' if dry_contact & (1 << i) and flag_yau_control else 'ИП МАА №1'
|
node_control_device.get_node2(0, i+6).text = 'ИП МАА №1' if dry_contact & (1 << i) == 0 and flag_yau_control else 'ОШИБКА. КОНТРОЛЬ ИП МАА №1'
|
||||||
node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
node_control_device.get_node2(0, i+6).modulate = Constants.GREEN if dry_contact & (1 << i) == 0 and flag_yau_control else Constants.RED
|
||||||
elif i == 1:
|
elif i == 1:
|
||||||
node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП МАА №2' if dry_contact & (1 << i) and flag_yau_control else 'ИП МАА №2'
|
node_control_device.get_node2(0, i+6).text = 'ИП МАА №2' if dry_contact & (1 << i) == 0 and flag_yau_control else 'ОШИБКА. КОНТРОЛЬ ИП МАА №2'
|
||||||
node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
node_control_device.get_node2(0, i+6).modulate = Constants.GREEN if dry_contact & (1 << i) == 0 and flag_yau_control else Constants.RED
|
||||||
elif i == 2:
|
elif i == 2:
|
||||||
node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП9-50 №1' if dry_contact & (1 << i) and flag_yau_control else 'ИП9-50 №1'
|
node_control_device.get_node2(0, i+6).text = 'ИП9-50 №1' if dry_contact & (1 << i) == 0 and flag_yau_control else 'ОШИБКА. КОНТРОЛЬ ИП9-50 №1'
|
||||||
node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
node_control_device.get_node2(0, i+6).modulate = Constants.GREEN if dry_contact & (1 << i) == 0 and flag_yau_control else Constants.RED
|
||||||
elif i == 3:
|
elif i == 3:
|
||||||
node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП9-50 №2' if dry_contact & (1 << i) and flag_yau_control else 'ИП9-50 №2'
|
node_control_device.get_node2(0, i+6).text = 'ИП9-50 №2' if dry_contact & (1 << i) == 0 and flag_yau_control else 'ОШИБКА. КОНТРОЛЬ ИП9-50 №2'
|
||||||
node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
node_control_device.get_node2(0, i+6).modulate = Constants.GREEN if dry_contact & (1 << i) == 0 and flag_yau_control else Constants.RED
|
||||||
#elif i == 4:
|
#elif i == 4:
|
||||||
#node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП9-50 №3' if dry_contact & (1 << i) and flag_yau_control else 'ИП9-50 №3'
|
#node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП9-50 №3' if dry_contact & (1 << i) and flag_yau_control else 'ИП9-50 №3'
|
||||||
#node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
#node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
||||||
elif i == 4:
|
elif i == 4:
|
||||||
node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП12-50 №1' if dry_contact & (1 << i) and flag_yau_control else 'ИП12-50 №1'
|
node_control_device.get_node2(0, i+6).text = 'ИП12-50 №1' if dry_contact & (1 << i) == 0 and flag_yau_control else 'ОШИБКА. КОНТРОЛЬ ИП12-50 №1'
|
||||||
node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
node_control_device.get_node2(0, i+6).modulate = Constants.GREEN if dry_contact & (1 << i) == 0 and flag_yau_control else Constants.RED
|
||||||
#elif i == 6:
|
#elif i == 6:
|
||||||
#node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП12-50 №2' if dry_contact & (1 << i) and flag_yau_control else 'ИП12-50 №2'
|
#node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП12-50 №2' if dry_contact & (1 << i) and flag_yau_control else 'ИП12-50 №2'
|
||||||
#node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
#node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
||||||
elif i == 7:
|
elif i == 7:
|
||||||
node_control_device.get_node2(0, i+6).text = 'ОШИБКА. КОНТРОЛЬ ИП5-25' if dry_contact & (1 << i) and flag_yau_control else 'ИП5-25'
|
node_control_device.get_node2(0, i+6).text = 'ИП5-25' if dry_contact & (1 << i) == 0 and flag_yau_control else 'ОШИБКА. КОНТРОЛЬ ИП5-25'
|
||||||
node_control_device.get_node2(0, i+6).modulate = Constants.RED if dry_contact & (1 << i) and flag_yau_control else Constants.GREEN
|
node_control_device.get_node2(0, i+6).modulate = Constants.GREEN if dry_contact & (1 << i) == 0 and flag_yau_control else Constants.RED
|
||||||
|
|
||||||
DKM = packet.decode_u16(37)
|
DKM = packet.decode_u16(37)
|
||||||
node_select1.set_node_text(3, 0, '%d' % DKM)
|
node_select1.set_node_text(3, 0, '%d' % DKM)
|
||||||
@@ -176,6 +179,23 @@ func parse_broadcast(packet):
|
|||||||
node_select1.set_node_text(3, i+1, '%d' % EMS_G)
|
node_select1.set_node_text(3, i+1, '%d' % EMS_G)
|
||||||
|
|
||||||
|
|
||||||
|
func data_received(unit):
|
||||||
|
var status = unit.status
|
||||||
|
#var bit_online = 0 + id_board
|
||||||
|
#var bit_load = 3 + id_board
|
||||||
|
#online = (status[0] >> bit_online) & 1
|
||||||
|
#ems_load = (status[0] >> bit_load) & 1
|
||||||
|
var in_blank = int(status[1] | (status[2] << 8) | (status[3] << 16) | \
|
||||||
|
(status[4] << 24) | (status[5] << 32))
|
||||||
|
var in_imp = int(status[7] | (status[8] << 8) | (status[9] << 16) | \
|
||||||
|
(status[10] << 24) | (status[11] << 32))
|
||||||
|
var out_blank = int(status[13] | (status[14] << 8) | (status[15] << 16) | \
|
||||||
|
(status[16] << 24) | (status[17] << 32))
|
||||||
|
var out_imp = int(status[19] | (status[20] << 8) | (status[21] << 16)| \
|
||||||
|
(status[22] << 24) | (status[23] << 32))
|
||||||
|
var out_kz = int(status[25] | (status[26] << 8))
|
||||||
|
|
||||||
|
|
||||||
func on_line_changed(_unit) -> void:
|
func on_line_changed(_unit) -> void:
|
||||||
if unit.online:
|
if unit.online:
|
||||||
print('Off line')
|
print('Off line')
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://cvor2jm4xk3ha"]
|
[gd_scene load_steps=16 format=3 uid="uid://cvor2jm4xk3ha"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://PRD.gd" id="1_v273n"]
|
[ext_resource type="Script" path="res://PRD.gd" id="1_v273n"]
|
||||||
[ext_resource type="Script" path="res://table/table.gd" id="2_vmbyo"]
|
[ext_resource type="Script" path="res://table/table.gd" id="2_vmbyo"]
|
||||||
|
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://Shaders/shader_edu.tres" id="3_3syd3"]
|
||||||
|
[ext_resource type="Shader" path="res://Shaders/ray.gdshader" id="4_uy5o2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://62v0xejejuwj" path="res://Web.png" id="5_i3nvb"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ovl8a"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ovl8a"]
|
||||||
bg_color = Color(0.388235, 0.227451, 0.290196, 1)
|
bg_color = Color(0.388235, 0.227451, 0.290196, 1)
|
||||||
@@ -14,6 +17,26 @@ anti_aliasing = false
|
|||||||
|
|
||||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_hdj8q"]
|
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_hdj8q"]
|
||||||
|
|
||||||
|
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_723du"]
|
||||||
|
size = Vector2(1600, 1200)
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_0sobq"]
|
||||||
|
script/source = "extends Sprite2D
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_o7txs"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dgiai"]
|
||||||
|
shader = ExtResource("4_uy5o2")
|
||||||
|
shader_parameter/color_signal = Color(0.690196, 0.776471, 0, 1)
|
||||||
|
shader_parameter/turn = 0.785
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_ki0n7"]
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture2D" id="GradientTexture2D_0pk2o"]
|
||||||
|
gradient = SubResource("Gradient_ki0n7")
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
script = ExtResource("1_v273n")
|
script = ExtResource("1_v273n")
|
||||||
|
|
||||||
@@ -68,10 +91,10 @@ script = ExtResource("2_vmbyo")
|
|||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="scroll1" type="ScrollContainer" parent="."]
|
[node name="scroll1" type="ScrollContainer" parent="."]
|
||||||
offset_left = 586.0
|
offset_left = 478.0
|
||||||
offset_top = 22.0
|
offset_top = 65.0
|
||||||
offset_right = 949.0
|
offset_right = 841.0
|
||||||
offset_bottom = 606.0
|
offset_bottom = 649.0
|
||||||
|
|
||||||
[node name="table1" type="GridContainer" parent="scroll1"]
|
[node name="table1" type="GridContainer" parent="scroll1"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -91,4 +114,32 @@ text = "broadcast"
|
|||||||
editable = false
|
editable = false
|
||||||
wrap_mode = 1
|
wrap_mode = 1
|
||||||
|
|
||||||
|
[node name="PSK" type="Sprite2D" parent="."]
|
||||||
|
material = ExtResource("3_3syd3")
|
||||||
|
position = Vector2(1243, 81)
|
||||||
|
scale = Vector2(0.340625, 0.321666)
|
||||||
|
texture = SubResource("PlaceholderTexture2D_723du")
|
||||||
|
offset = Vector2(800, 600)
|
||||||
|
script = SubResource("GDScript_0sobq")
|
||||||
|
|
||||||
|
[node name="PSK grad" type="TextureRect" parent="PSK"]
|
||||||
|
modulate = Color(0, 0, 0, 1)
|
||||||
|
self_modulate = Color(0, 0, 0, 1)
|
||||||
|
show_behind_parent = true
|
||||||
|
material = SubResource("ShaderMaterial_o7txs")
|
||||||
|
offset_left = 554.954
|
||||||
|
offset_top = -30.0
|
||||||
|
offset_right = 1290.95
|
||||||
|
offset_bottom = 1134.0
|
||||||
|
texture = ExtResource("5_i3nvb")
|
||||||
|
expand_mode = 1
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="ray" type="Sprite2D" parent="PSK"]
|
||||||
|
material = SubResource("ShaderMaterial_dgiai")
|
||||||
|
position = Vector2(549.221, 560.705)
|
||||||
|
scale = Vector2(21.8765, 21.6782)
|
||||||
|
texture = SubResource("GradientTexture2D_0pk2o")
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[connection signal="toggled" from="control_button" to="." method="_on_control_button"]
|
[connection signal="toggled" from="control_button" to="." method="_on_control_button"]
|
||||||
|
|||||||
84
Shaders/ray.gdshader
Normal file
84
Shaders/ray.gdshader
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform vec4 color_signal: source_color;
|
||||||
|
uniform float turn = 0.785;
|
||||||
|
|
||||||
|
const float outer_radius = 0.309;
|
||||||
|
const float inner_radius = 0.72;
|
||||||
|
const float zoom = 100.0;
|
||||||
|
const float speed = 2.1;
|
||||||
|
const float size = 6.0;
|
||||||
|
const float blur = 0.000001;
|
||||||
|
const float fill_ratio = 0.03;
|
||||||
|
|
||||||
|
|
||||||
|
float remap(float i_min, float i_max, float o_min, float o_max, float val) {
|
||||||
|
float t = (val - i_min) / (i_max - i_min);
|
||||||
|
return o_min + (o_max - o_min) * t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float mask(vec2 uv, float value)
|
||||||
|
{
|
||||||
|
float r = atan(uv.x, uv.y);
|
||||||
|
r = remap(-PI, PI, 0.0, 1.0, r);
|
||||||
|
r = step(r, value * 0.5);
|
||||||
|
|
||||||
|
uv.x = uv.x + 1.0;
|
||||||
|
uv.x = uv.x * -1.0;
|
||||||
|
uv.x += 1.0;
|
||||||
|
float l = atan(uv.x, uv.y);
|
||||||
|
l = remap(-PI, PI, 0.0, 1.0, l);
|
||||||
|
l = step(l, value * 0.5);
|
||||||
|
|
||||||
|
return r + l ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec2 rotate_uv(vec2 uv, vec2 pivot, float rotation) {
|
||||||
|
float cosa = cos(rotation);
|
||||||
|
float sina = sin(rotation);
|
||||||
|
uv -= pivot;
|
||||||
|
return vec2(
|
||||||
|
cosa * uv.x - sina * uv.y,
|
||||||
|
cosa * uv.y + sina * uv.x
|
||||||
|
) + pivot;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float circle(vec2 uv, float value)
|
||||||
|
{
|
||||||
|
float d = length(uv);
|
||||||
|
float t = smoothstep(
|
||||||
|
inner_radius + blur,
|
||||||
|
inner_radius - blur,
|
||||||
|
d
|
||||||
|
) - smoothstep(
|
||||||
|
outer_radius + blur,
|
||||||
|
outer_radius - blur,
|
||||||
|
d
|
||||||
|
);
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fragment(){
|
||||||
|
float d = length((UV-0.5)*2.0);
|
||||||
|
float t = pow(smoothstep(0.9,0.2,d),0.35);
|
||||||
|
vec2 uv = (UV * 2.0) - 1.0;
|
||||||
|
|
||||||
|
vec3 rainbow = 0.5*cos(TIME+UV.xyx+vec3(0,2,4));
|
||||||
|
vec4 color = vec4(rainbow.rgb,1.0);
|
||||||
|
vec2 origin = vec2(0.0, 0.0);
|
||||||
|
color = vec4(color_signal.rgb,1.0);
|
||||||
|
uv = rotate_uv(uv, origin, turn * TAU);
|
||||||
|
float c = circle(uv, 0.5);
|
||||||
|
float mask = mask(uv, fill_ratio);
|
||||||
|
d = sin(zoom*d - speed*TIME);
|
||||||
|
//d = abs(d);
|
||||||
|
d = size/d;
|
||||||
|
color *= d*t;
|
||||||
|
|
||||||
|
COLOR = vec4(color * mask * c);
|
||||||
|
}
|
||||||
159
Shaders/shader_edu.tres
Normal file
159
Shaders/shader_edu.tres
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://s6xe8igevnv2"]
|
||||||
|
|
||||||
|
[sub_resource type="Shader" id="1"]
|
||||||
|
code = "shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform vec4 colore: source_color;
|
||||||
|
uniform vec2 pc0; /* Центр сетки антенн */
|
||||||
|
uniform vec4 color0: source_color = vec4(0.38, 0.47, 0.51, 0.4);
|
||||||
|
uniform vec4 color1: source_color = vec4(0.39, 0.44, 0.50, 0.4);
|
||||||
|
|
||||||
|
const float mask_grad = 0.75;
|
||||||
|
const float rotation = 135.0;
|
||||||
|
const float radius_inner = 200.0; /* Радиус внутренний. Должно быть равно ant_band_r0_0 */
|
||||||
|
const float radius_outter = 550.0; /* Радиус внешний. Должно быть равно ant_band_r1_6 */
|
||||||
|
|
||||||
|
const float ant_band_count_0 = 6.0;
|
||||||
|
const float ant_band_count_1 = 6.0;
|
||||||
|
const float ant_band_count_2 = 6.0;
|
||||||
|
const float ant_band_count_3 = 6.0;
|
||||||
|
const float ant_band_count_4 = 6.0;
|
||||||
|
const float ant_band_count_5 = 6.0;
|
||||||
|
const float ant_band_count_6 = 6.0;
|
||||||
|
|
||||||
|
const float ant_band_r0_0 = 200.0;
|
||||||
|
const float ant_band_r0_1 = 250.0;
|
||||||
|
const float ant_band_r0_2 = 300.0;
|
||||||
|
const float ant_band_r0_3 = 350.0;
|
||||||
|
const float ant_band_r0_4 = 400.0;
|
||||||
|
const float ant_band_r0_5 = 450.0;
|
||||||
|
const float ant_band_r0_6 = 500.0;
|
||||||
|
|
||||||
|
const float ant_band_r1_0 = 250.0;
|
||||||
|
const float ant_band_r1_1 = 300.0;
|
||||||
|
const float ant_band_r1_2 = 350.0;
|
||||||
|
const float ant_band_r1_3 = 400.0;
|
||||||
|
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 ds = 1.0;
|
||||||
|
|
||||||
|
|
||||||
|
float SMOOTH(float r, float R, float d)
|
||||||
|
{
|
||||||
|
return 1.0 - smoothstep(R - d, R + d, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float remap(float i_min, float i_max, float o_min, float o_max, float val) {
|
||||||
|
float t = (val - i_min) / (i_max - i_min);
|
||||||
|
return o_min + (o_max - o_min) * t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float mask(vec2 uv, float value)
|
||||||
|
{
|
||||||
|
float r = atan(uv.x, uv.y);
|
||||||
|
r = remap(-PI, PI, 0.0, 1.0, r);
|
||||||
|
r = step(r, value * 0.5);
|
||||||
|
|
||||||
|
uv.x = uv.x + 1.0;
|
||||||
|
uv.x = uv.x * -1.0;
|
||||||
|
uv.x += 1.0;
|
||||||
|
float l = atan(uv.x, uv.y);
|
||||||
|
l = remap(-PI, PI, 0.0, 1.0, l);
|
||||||
|
l = step(l, value * 0.5);
|
||||||
|
|
||||||
|
return r + l ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
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, ds) - SMOOTH(a1 * sf, theta, ds);
|
||||||
|
float vr = SMOOTH(r0, l, ds) - SMOOTH(r1, l, ds);
|
||||||
|
float rgb = sqrt(va * vr);
|
||||||
|
c.rgb += color.rgb * rgb * color.a;
|
||||||
|
c.a += rgb * color.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);
|
||||||
|
vec4 col = v * c0 + (1.0f - v) * c1;
|
||||||
|
sector(c, uv, p0, float(i) * da, da, r0, r1, col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void circle_thin(inout vec3 color, vec2 uv, vec2 p, float r, float w, vec3 c, float a)
|
||||||
|
{
|
||||||
|
float d = distance(uv, p);
|
||||||
|
float v0 = r - w;
|
||||||
|
float v1 = r + w;
|
||||||
|
color += a * sqrt(smoothstep(v1, v0, d) * smoothstep(v0, v1, d) * c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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.rgb += c.rgb * SMOOTH(l, 1.0, ds) * c.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rotate_vec2(inout vec2 vert, float a)
|
||||||
|
{
|
||||||
|
float sin_a = sin(a);
|
||||||
|
float cos_a = cos(a);
|
||||||
|
vert *= mat2(vec2(cos_a, sin_a), vec2(-sin_a, cos_a));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vertex()
|
||||||
|
{
|
||||||
|
VERTEX -= pc0;
|
||||||
|
rotate_vec2(VERTEX, radians(rotation));
|
||||||
|
VERTEX += pc0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fragment()
|
||||||
|
{
|
||||||
|
ivec2 isz = textureSize(TEXTURE, 0);
|
||||||
|
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
|
||||||
|
float mask = mask(uv, mask_grad);
|
||||||
|
COLOR = vec4(0.0, 0.0, 0.0, 0.0) - mask; //texture(TEXTURE, UV); // Цвет текущей точки
|
||||||
|
|
||||||
|
// Сетка антенн
|
||||||
|
antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, color1, color0);
|
||||||
|
antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1, ant_band_r1_1, color0, color1);
|
||||||
|
antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2, ant_band_r1_2, color1, color0);
|
||||||
|
antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3, ant_band_r1_3, color0, color1);
|
||||||
|
antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4, ant_band_r1_4, color1, color0);
|
||||||
|
antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5, ant_band_r1_5, color0, color1);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
"
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
shader = SubResource("1")
|
||||||
|
shader_parameter/colore = Color(0, 0, 0, 1)
|
||||||
|
shader_parameter/pc0 = Vector2(560.03, 560)
|
||||||
|
shader_parameter/color0 = Color(0.203922, 0.203922, 0.203922, 0.478431)
|
||||||
|
shader_parameter/color1 = Color(0.945098, 0.964706, 0.972549, 0.117647)
|
||||||
34
Web.png.import
Normal file
34
Web.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://62v0xejejuwj"
|
||||||
|
path="res://.godot/imported/Web.png-c71665e7797af3c541effa7e6a335fc8.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Web.png"
|
||||||
|
dest_files=["res://.godot/imported/Web.png-c71665e7797af3c541effa7e6a335fc8.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
30
constants.gd
30
constants.gd
@@ -13,8 +13,8 @@ const MINIMUM_CODE_AD: int = 2660
|
|||||||
const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD)
|
const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD)
|
||||||
const TableNode = preload("res://table/node.tscn")
|
const TableNode = preload("res://table/node.tscn")
|
||||||
const TableList = preload("res://table/node_list.tscn")
|
const TableList = preload("res://table/node_list.tscn")
|
||||||
const SELECT_DEVIСE: Array = [[TableNode, TableList]]
|
const SELECT_DEVICE: Array = [[TableNode, TableList]]
|
||||||
const CONTROL_DEVICE: Array = [
|
const CONTROL_TABLE: Array = [
|
||||||
[TableNode],
|
[TableNode],
|
||||||
[TableNode],
|
[TableNode],
|
||||||
[TableNode],
|
[TableNode],
|
||||||
@@ -30,6 +30,7 @@ const CONTROL_DEVICE: Array = [
|
|||||||
[TableNode],
|
[TableNode],
|
||||||
[TableNode],
|
[TableNode],
|
||||||
[TableNode],]
|
[TableNode],]
|
||||||
|
const CONTROL_DEVICE: Array = ['ЯЧЕЙКА ЯУ-07Б', 'ФС', 'ЯЧЕЙКА ЭМС-Г', 'ЯЧЕЙКА УГ', 'ЯЧЕЙКА УКП №1', 'ЯЧЕЙКА УКП №2', 'ИП МАА №1', 'ИП МАА №2', 'ИП9-50 №1', 'ИП9-50 №2', 'ИП12-50 №1', '-', '-','ИП5-25']
|
||||||
const ROWS_REGS_DATA: Array = [
|
const ROWS_REGS_DATA: Array = [
|
||||||
[TableNode, TableNode, TableNode, TableNode],
|
[TableNode, TableNode, TableNode, TableNode],
|
||||||
[TableNode, TableNode, TableNode, TableNode],
|
[TableNode, TableNode, TableNode, TableNode],
|
||||||
@@ -48,16 +49,15 @@ const ROWS_REGS_DATA: Array = [
|
|||||||
[TableNode, TableNode, TableNode, TableNode],
|
[TableNode, TableNode, TableNode, TableNode],
|
||||||
[TableNode, TableNode, TableNode, TableNode],]
|
[TableNode, TableNode, TableNode, TableNode],]
|
||||||
const ADDRESSES: Array = [
|
const ADDRESSES: Array = [
|
||||||
['ПРД-Н1', '10.1.1.11', 50011],
|
['ПРД-Н1', '10.1.1.11', 50011],
|
||||||
['ПРД-Н2', '10.1.1.21', 50021],
|
['ПРД-Н2', '10.1.1.21', 50021],
|
||||||
['ПРД-Н3', '10.1.1.31', 50031],
|
['ПРД-Н3', '10.1.1.31', 50031],
|
||||||
['ПРД-Н4', '10.1.1.41', 50041],
|
['ПРД-Н4', '10.1.1.41', 50041],
|
||||||
['ПРД-В1', '10.1.1.12', 50012],
|
['ПРД-В1', '10.1.1.12', 50012],
|
||||||
['ПРД-В2', '10.1.1.22', 50022],
|
['ПРД-В2', '10.1.1.22', 50022],
|
||||||
['ПРД-В3', '10.1.1.32', 50032],
|
['ПРД-В3', '10.1.1.32', 50032],
|
||||||
['ПРД-В4', '10.1.1.42', 50042],
|
['ПРД-В4', '10.1.1.42', 50042],
|
||||||
['ПРД-К1', '10.1.1.13', 50013],
|
['ПРД-К1', '10.1.1.13', 50013],
|
||||||
['ПРД-К2', '10.1.1.23', 50023],
|
['ПРД-К2', '10.1.1.23', 50023],
|
||||||
['ПРД-К3', '10.1.1.33', 50033],
|
['ПРД-К3', '10.1.1.33', 50033],
|
||||||
['ПРД-К4', '10.1.1.43', 50043],
|
['ПРД-К4', '10.1.1.43', 50043]]
|
||||||
]
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Yau07="*res://yau07.gd"
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1237
|
window/size/viewport_width=1800
|
||||||
window/size/viewport_height=800
|
window/size/viewport_height=800
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|||||||
2
yau07.gd
2
yau07.gd
@@ -37,6 +37,7 @@ class YaU07:
|
|||||||
signal command_done(unit: YaU07) ## Вызывается после выполнения команды
|
signal command_done(unit: YaU07) ## Вызывается после выполнения команды
|
||||||
signal command_fail(unit: YaU07) ## Вызывается если возникла ошибка при выполнении команды и команда не выполнена
|
signal command_fail(unit: YaU07) ## Вызывается если возникла ошибка при выполнении команды и команда не выполнена
|
||||||
signal parse_failed(unit: YaU07)
|
signal parse_failed(unit: YaU07)
|
||||||
|
signal data_received(unit: YaU07) ## Вызывается, когда получены данные
|
||||||
|
|
||||||
var name: = String()
|
var name: = String()
|
||||||
var cmd_num_rx: = 0 ## Номер команды принятый
|
var cmd_num_rx: = 0 ## Номер команды принятый
|
||||||
@@ -260,6 +261,7 @@ class YaU07:
|
|||||||
if byte_i < len_rx_data:
|
if byte_i < len_rx_data:
|
||||||
status[i] = rx_data[byte_i] # Массив байтовый "состояние прибора"
|
status[i] = rx_data[byte_i] # Массив байтовый "состояние прибора"
|
||||||
i += 1
|
i += 1
|
||||||
|
emit_signal('data_received', self)
|
||||||
|
|
||||||
if rx_data_len == (status_len + 6):
|
if rx_data_len == (status_len + 6):
|
||||||
return true # Нет поля "ответ на команду", разбор пакета завершить
|
return true # Нет поля "ответ на команду", разбор пакета завершить
|
||||||
|
|||||||
Reference in New Issue
Block a user