WIP Исправление. Поиск причины проседания частоты кадров в режиме Работа
This commit is contained in:
@@ -88,6 +88,7 @@ window/subwindows/embed_subwindows=false
|
|||||||
window/frame_pacing/android/enable_frame_pacing=false
|
window/frame_pacing/android/enable_frame_pacing=false
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
window/dpi/allow_hidpi=false
|
window/dpi/allow_hidpi=false
|
||||||
|
window/vsync/vsync_mode=0
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
|
|
||||||
@@ -205,6 +206,8 @@ common/enable_object_picking=false
|
|||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
shader_compiler/shader_cache/strip_debug=true
|
shader_compiler/shader_cache/strip_debug=true
|
||||||
|
textures/default_filters/anisotropic_filtering_level=0
|
||||||
|
anti_aliasing/screen_space_roughness_limiter/enabled=false
|
||||||
quality/driver/fallback_to_gles2=true
|
quality/driver/fallback_to_gles2=true
|
||||||
|
|
||||||
[shader_globals]
|
[shader_globals]
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ func get_strob_radius() -> float: return $строб.get_instance_shader_param
|
|||||||
func get_strob_color() -> float: return $строб.get_instance_shader_parameter('color')
|
func get_strob_color() -> float: return $строб.get_instance_shader_parameter('color')
|
||||||
|
|
||||||
func get_canvas_rotation() -> float: return material.get('shader_parameter/rotation')
|
func get_canvas_rotation() -> float: return material.get('shader_parameter/rotation')
|
||||||
func get_radius_outter() -> float: return material.get('shader_parameter/radius_outter')
|
func get_radius_outter() -> float: return 280.0 # material.get('shader_parameter/radius_outter')
|
||||||
func get_radius_inner_0() -> float: return material.get('shader_parameter/radius_inner_0')
|
|
||||||
func get_radius_inner_1() -> float: return material.get('shader_parameter/radius_inner_1')
|
|
||||||
|
|
||||||
func get_band_colors(_val: Array): return material.get('shader_parameter/ant_band_c')
|
func get_band_colors(_val: Array): return material.get('shader_parameter/ant_band_c')
|
||||||
func get_band_failures(_val: Array): return material.get('shader_parameter/ant_band_m')
|
func get_band_failures(_val: Array): return material.get('shader_parameter/ant_band_m')
|
||||||
|
|||||||
@@ -6,14 +6,16 @@
|
|||||||
[ext_resource type="Shader" uid="uid://k36g8tww5yo" path="res://shaders/sector.gdshader" id="4_obn6s"]
|
[ext_resource type="Shader" uid="uid://k36g8tww5yo" path="res://shaders/sector.gdshader" id="4_obn6s"]
|
||||||
|
|
||||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2bft1"]
|
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2bft1"]
|
||||||
size = Vector2(1600, 1200)
|
size = Vector2(560, 560)
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lniyv"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lniyv"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
shader = ExtResource("4_obn6s")
|
shader = ExtResource("4_obn6s")
|
||||||
|
|
||||||
[node name="canvas" type="Sprite2D"]
|
[node name="canvas" type="Sprite2D"]
|
||||||
|
texture_filter = 1
|
||||||
material = ExtResource("1_newdt")
|
material = ExtResource("1_newdt")
|
||||||
|
scale = Vector2(2, 2)
|
||||||
texture = SubResource("PlaceholderTexture2D_2bft1")
|
texture = SubResource("PlaceholderTexture2D_2bft1")
|
||||||
centered = false
|
centered = false
|
||||||
script = ExtResource("2_8xjuy")
|
script = ExtResource("2_8xjuy")
|
||||||
@@ -21,5 +23,5 @@ SecZap = ExtResource("3_tgnog")
|
|||||||
|
|
||||||
[node name="строб" parent="." instance=ExtResource("3_tgnog")]
|
[node name="строб" parent="." instance=ExtResource("3_tgnog")]
|
||||||
material = SubResource("ShaderMaterial_lniyv")
|
material = SubResource("ShaderMaterial_lniyv")
|
||||||
position = Vector2(560, 560)
|
position = Vector2(280, 280)
|
||||||
scale = Vector2(1100, 1100)
|
scale = Vector2(550, 550)
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ func get_strob_band(pos: Vector2, prev: float) -> float:
|
|||||||
|
|
||||||
## Устанавливает центр строба по частоте и направлению.
|
## Устанавливает центр строба по частоте и направлению.
|
||||||
func set_strob(pos: Vector2) -> void:
|
func set_strob(pos: Vector2) -> void:
|
||||||
var radp: Vector2 = tools.map_dec_to_rad(radius_center, pos)
|
var radp: Vector2 = tools.map_dec_to_rad(radius_center, pos / 2.0)
|
||||||
if radp.y < $canvas.get_radius_outter():
|
if radp.y < $canvas.get_radius_outter():
|
||||||
$canvas.set_strob_dir(radp.x)
|
$canvas.set_strob_dir(radp.x)
|
||||||
$canvas.set_strob_radius(radp.y)
|
$canvas.set_strob_radius(radp.y)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ drag_scale_band = 0.05
|
|||||||
drag_scale_width = 0.5
|
drag_scale_width = 0.5
|
||||||
freq_high = 6000.0
|
freq_high = 6000.0
|
||||||
freq_low = 370.0
|
freq_low = 370.0
|
||||||
radius_center = Vector2(560, 560)
|
radius_center = Vector2(280, 280)
|
||||||
radius_internal = 200.0
|
radius_internal = 200.0
|
||||||
radius_outter = 200.0
|
radius_outter = 200.0
|
||||||
strob_max_band = 15.538
|
strob_max_band = 15.538
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="ShaderMaterial" load_steps=2 format=4 uid="uid://s6xe8igevnv2"]
|
[gd_resource type="ShaderMaterial" load_steps=3 format=4 uid="uid://s6xe8igevnv2"]
|
||||||
|
|
||||||
[sub_resource type="Shader" id="1"]
|
[sub_resource type="Shader" id="1"]
|
||||||
code = "shader_type canvas_item;
|
code = "shader_type canvas_item;
|
||||||
@@ -11,74 +11,55 @@ code = "shader_type canvas_item;
|
|||||||
#define ANT_BAND_READY 1U /* Антенна (модуль ФС) готова или исправна */
|
#define ANT_BAND_READY 1U /* Антенна (модуль ФС) готова или исправна */
|
||||||
#define ANT_BAND_FAILED 0U /* Антенна (модуль ФС) не исправно */
|
#define ANT_BAND_FAILED 0U /* Антенна (модуль ФС) не исправно */
|
||||||
|
|
||||||
uniform vec2 pc0 = vec2(560, 560); /* Центр сетки антенн */
|
uniform vec4 fxp = vec4(0.2, 0.0, 0.0, 10.0); /* Индикация неисправности модулей ФС: Заметность штриховки. Скорость движения штрховки. Наклон штрховки. Частота штриховки */
|
||||||
uniform float rotation: hint_range(0.0, 360.0) = 0.0; /* */
|
|
||||||
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);
|
|
||||||
uniform float radius_inner_0 = RADIUS_INNER_0;
|
|
||||||
uniform float radius_inner_1 = RADIUS_INNER_1;
|
|
||||||
uniform float radius_outter = 550.0; /* Радиус внешний. Должно быть равно ant_band_r1_6 */
|
|
||||||
uniform float alpha: hint_range(0.0, 1.0) = 0.5;
|
|
||||||
uniform int mode = 0; /* Режим отображения. Приоритет РТО - 0, приоритет РЛС - 1 */
|
|
||||||
uniform float ffr: hint_range(0.0, 1.0) = 0.2; /* Индикация неисправности модулей ФС. Заметность штриховки. */
|
|
||||||
uniform float sfr: hint_range(0.0, 10.0) = 0.0; /* Индикация неисправности модулей ФС. Скорость движения штрховки */
|
|
||||||
uniform float afr: hint_range(0.0, 180.0) = 0.0; /* Индикация неисправности модулей ФС. Наклон штрховки */
|
|
||||||
uniform float pfr: hint_range(1.0, 20.0) = 10.0; /* Индикация неисправности модулей ФС. Частота штриховки */
|
|
||||||
|
|
||||||
const int ant_band_count_0 = 2;
|
|
||||||
const int ant_band_count_1 = 2;
|
|
||||||
const int ant_band_count_2 = 2;
|
|
||||||
const int ant_band_count_3 = 2;
|
|
||||||
const int ant_band_count_4 = 2;
|
|
||||||
const int ant_band_count_5 = 2;
|
|
||||||
const int ant_band_count_6 = 2;
|
|
||||||
|
|
||||||
const float ant_band_r0_0[] = {RADIUS_INNER_0, RADIUS_INNER_1};
|
|
||||||
const float ant_band_r0_1[] = {250.0, 490.0};
|
|
||||||
const float ant_band_r0_2[] = {300.0, 500.0};
|
|
||||||
const float ant_band_r0_3[] = {350.0, 510.0};
|
|
||||||
const float ant_band_r0_4[] = {400.0, 520.0};
|
|
||||||
const float ant_band_r0_5[] = {450.0, 530.0};
|
|
||||||
const float ant_band_r0_6[] = {500.0, 540.0};
|
|
||||||
|
|
||||||
const float ant_band_r1_0[] = {250.0, 490.0};
|
|
||||||
const float ant_band_r1_1[] = {300.0, 500.0};
|
|
||||||
const float ant_band_r1_2[] = {350.0, 510.0};
|
|
||||||
const float ant_band_r1_3[] = {400.0, 520.0};
|
|
||||||
const float ant_band_r1_4[] = {450.0, 530.0};
|
|
||||||
const float ant_band_r1_5[] = {500.0, 540.0};
|
|
||||||
const float ant_band_r1_6[] = {550.0, 550.0};
|
|
||||||
|
|
||||||
uniform vec4 ant_band_c[ANTENAS_COUNT];
|
uniform vec4 ant_band_c[ANTENAS_COUNT];
|
||||||
uniform uint ant_band_m[ANTENAS_COUNT];
|
uniform uint ant_band_m[ANTENAS_COUNT];
|
||||||
|
uniform float rotation: hint_range(0.0, 360.0) = 0.0; /* */
|
||||||
|
uniform int mode = 0; /* Режим отображения. Приоритет РТО - 0, приоритет РЛС - 1 */
|
||||||
|
uniform sampler2D band_colors: source_color;
|
||||||
|
|
||||||
|
const float ant_band_r0_0[] = {100.0, 240.0};
|
||||||
|
const float ant_band_r0_1[] = {125.0, 245.0};
|
||||||
|
const float ant_band_r0_2[] = {150.0, 250.0};
|
||||||
|
const float ant_band_r0_3[] = {175.0, 255.0};
|
||||||
|
const float ant_band_r0_4[] = {200.0, 260.0};
|
||||||
|
const float ant_band_r0_5[] = {225.0, 265.0};
|
||||||
|
const float ant_band_r0_6[] = {250.0, 270.0};
|
||||||
|
|
||||||
|
const float ant_band_r1_0[] = {125.0, 245.0};
|
||||||
|
const float ant_band_r1_1[] = {150.0, 250.0};
|
||||||
|
const float ant_band_r1_2[] = {175.0, 255.0};
|
||||||
|
const float ant_band_r1_3[] = {200.0, 260.0};
|
||||||
|
const float ant_band_r1_4[] = {225.0, 265.0};
|
||||||
|
const float ant_band_r1_5[] = {250.0, 270.0};
|
||||||
|
const float ant_band_r1_6[] = {275.0, 275.0};
|
||||||
|
|
||||||
const float d4 = 90.0;
|
const float d4 = 90.0;
|
||||||
const float ds = 1.0;
|
const float ds = 1.0;
|
||||||
|
const float sf = 500.0;
|
||||||
|
const float radius_inner_0 = RADIUS_INNER_0;
|
||||||
|
const float radius_inner_1 = RADIUS_INNER_1;
|
||||||
|
const float alpha = 0.5;
|
||||||
|
const vec2 pc0 = vec2(280, 280); /* Центр сетки антенн */
|
||||||
|
const int ant_band_count = 2;
|
||||||
|
|
||||||
|
|
||||||
void sector(inout vec4 c, vec2 uv, vec2 center, float a, float da, float r0, float r1, vec4 color)
|
float sector(float ac, float r0, float r1, vec4 ldt)
|
||||||
{
|
{
|
||||||
float l = distance(center, uv);
|
float a0 = radians(ac - 45.0);
|
||||||
vec2 d = uv - center;
|
float a1 = radians(ac + 45.0);
|
||||||
float sf = 500.0;
|
float va = smooth_px(a0 * sf, ldt.w, ds) - smooth_px(a1 * sf, ldt.w, ds);
|
||||||
float theta = atan(d.x, d.y) * sf;
|
float vr = smooth_px(r0, ldt.x, ds) - smooth_px(r1, ldt.x, ds);
|
||||||
da /= 2.0;
|
return sqrt(va * vr);
|
||||||
float a0 = radians(a - da);
|
|
||||||
float a1 = radians(a + da);
|
|
||||||
float va = smooth_px(a0 * sf, theta, ds) - smooth_px(a1 * sf, theta, ds);
|
|
||||||
float vr = smooth_px(r0, l, ds) - smooth_px(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, int cnt, float r0, float r1, inout int index)
|
void antenas(inout vec4 c, vec2 uv, float r0, float r1, int index, vec4 ldt)
|
||||||
{
|
{
|
||||||
float da = 180.0 / float(cnt);
|
|
||||||
vec4 col;
|
vec4 col;
|
||||||
int j;
|
int j;
|
||||||
vec2 uvr;
|
vec2 uvr;
|
||||||
for (int i = -cnt; i <= cnt; i ++)
|
for (int i = -ant_band_count; i <= ant_band_count; i ++)
|
||||||
{
|
{
|
||||||
j = index;
|
j = index;
|
||||||
if (i == 2)
|
if (i == 2)
|
||||||
@@ -86,18 +67,18 @@ void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, inout
|
|||||||
index--;
|
index--;
|
||||||
j = index - 3;
|
j = index - 3;
|
||||||
}
|
}
|
||||||
col.rgb = ant_band_c[j].rgb;
|
|
||||||
index++;
|
index++;
|
||||||
col.a = alpha + (random_timed(uv) - 0.5f) * ant_band_c[j].a;
|
vec4 abc = ant_band_c[j];
|
||||||
if (ant_band_m[j] == ANT_BAND_FAILED)
|
uint abm = ant_band_m[j];
|
||||||
|
col.rgb = abc.rgb;
|
||||||
|
col.a = alpha + (random_timed(uv) - 0.5f) * abc.a;
|
||||||
|
if (abm == ANT_BAND_FAILED)
|
||||||
{
|
{
|
||||||
uvr = uv;
|
uvr = uv;
|
||||||
rotate_vec2(uvr, radians(afr), pc0);
|
rotate_vec2(uvr, radians(fxp.z), pc0);
|
||||||
col.a *= (1.0 - ffr) + tanh(10.0 * sin(TIME * sfr + 2.0 * PI * uvr.x / pfr)) * ffr;
|
col.a *= (1.0 - fxp.x) + tanh(10.0 * sin(TIME * fxp.y + 2.0 * PI * uvr.x / fxp.w)) * fxp.x;
|
||||||
}
|
}
|
||||||
float v = float(i & 1);
|
c += col * sector(float(i) * 90.0, r0, r1, ldt);
|
||||||
vec4 color = v * col + (1.0f - v) * col;
|
|
||||||
sector(c, uv, p0, float(i) * da, da, r0, r1, color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,32 +94,27 @@ void fragment()
|
|||||||
ivec2 isz = textureSize(TEXTURE, 0);
|
ivec2 isz = textureSize(TEXTURE, 0);
|
||||||
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
|
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
|
||||||
COLOR = vec4(0, 0, 0, 0);
|
COLOR = vec4(0, 0, 0, 0);
|
||||||
int index = 0;
|
vec2 d = uv - pc0;
|
||||||
// Сетка антенн
|
float theta = atan(d.x, d.y) * sf;
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0[mode], ant_band_r1_0[mode], index);
|
vec4 ldt = vec4(distance(pc0, uv), d, theta);
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1[mode], ant_band_r1_1[mode], index);
|
antenas(COLOR, uv, ant_band_r0_0[mode], ant_band_r1_0[mode], 0, ldt);
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2[mode], ant_band_r1_2[mode], index);
|
antenas(COLOR, uv, ant_band_r0_1[mode], ant_band_r1_1[mode], 4, ldt);
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3[mode], ant_band_r1_3[mode], index);
|
antenas(COLOR, uv, ant_band_r0_2[mode], ant_band_r1_2[mode], 8, ldt);
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4[mode], ant_band_r1_4[mode], index);
|
antenas(COLOR, uv, ant_band_r0_3[mode], ant_band_r1_3[mode], 12, ldt);
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5[mode], ant_band_r1_5[mode], index);
|
antenas(COLOR, uv, ant_band_r0_4[mode], ant_band_r1_4[mode], 16, ldt);
|
||||||
antenas(COLOR, uv, pc0, ant_band_count_6, ant_band_r0_6[mode], ant_band_r1_6[mode], index);
|
antenas(COLOR, uv, ant_band_r0_5[mode], ant_band_r1_5[mode], 20, ldt);
|
||||||
|
antenas(COLOR, uv, ant_band_r0_6[mode], ant_band_r1_6[mode], 24, ldt);
|
||||||
|
if (COLOR.a == 0.0) discard;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
||||||
|
[sub_resource type="ImageTexture" id="ImageTexture_ij61e"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
shader = SubResource("1")
|
shader = SubResource("1")
|
||||||
shader_parameter/pc0 = Vector2(560, 560)
|
shader_parameter/fxp = Vector4(0.13, 0, 0, 5)
|
||||||
shader_parameter/rotation = 0.0
|
|
||||||
shader_parameter/color0 = Color(0.380392, 0.470588, 0.509804, 0.537255)
|
|
||||||
shader_parameter/color1 = Color(0.3315, 0.45645, 0.51, 0.537255)
|
|
||||||
shader_parameter/radius_inner_0 = 200.0
|
|
||||||
shader_parameter/radius_inner_1 = 480.0
|
|
||||||
shader_parameter/radius_outter = 550.0
|
|
||||||
shader_parameter/alpha = 0.5
|
|
||||||
shader_parameter/mode = 0
|
|
||||||
shader_parameter/ffr = 0.2
|
|
||||||
shader_parameter/sfr = 0.0
|
|
||||||
shader_parameter/afr = 0.0
|
|
||||||
shader_parameter/pfr = 10.0
|
|
||||||
shader_parameter/ant_band_c = PackedVector4Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
shader_parameter/ant_band_c = PackedVector4Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
shader_parameter/ant_band_m = PackedInt32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
|
shader_parameter/ant_band_m = PackedInt32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
|
shader_parameter/rotation = 0.0
|
||||||
|
shader_parameter/mode = 0
|
||||||
|
shader_parameter/band_colors = SubResource("ImageTexture_ij61e")
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ float random_timed(vec2 uv)
|
|||||||
|
|
||||||
float smooth_px(float r, float R, float ds)
|
float smooth_px(float r, float R, float ds)
|
||||||
{
|
{
|
||||||
return 1.0 - smoothstep(R - ds, R + ds, r);
|
return smoothstep(R + ds, R - ds, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user