Доработка. Добавлена возможность раскраски секторов антенн в разные цвета (выбор сектора, назначение помехи)

This commit is contained in:
MaD_CaT
2024-02-07 10:15:30 +03:00
parent cf1b1a3694
commit 54e5f1bf37
8 changed files with 167 additions and 49 deletions

View File

@@ -41,7 +41,6 @@ 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};
const vec4 ant_band_colors[] = {vec4(0.38, 0.47, 0.51, 0.4),vec4(0.38, 0.47, 0.51, 0.4), vec4(0.38, 0.47, 0.51, 0.4), vec4(0.38, 0.47, 0.51, 0.4)};
uniform vec3 ant_band_c[28];
const float d4 = 90.0;
@@ -65,14 +64,26 @@ void sector(inout vec4 c, vec2 uv, vec2 center, float a, float da, float r0, flo
}
void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, vec4 c0, vec4 c1)
void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, inout int index)
{
float da = 180.0 / float(cnt);
for (int i = -cnt; i <= cnt; i ++)
{
vec4 col;
int j = index;
if (i == 2)
{
index--;
j = index - 3;
}
col.x = ant_band_c[j].x;
col.y = ant_band_c[j].y;
col.z = ant_band_c[j].z;
index++;
col.a = 0.5;
float v = float(i & 1);
vec4 col = v * c0 + (1.0f - v) * c1;
sector(c, uv, p0, float(i) * da, da, r0, r1, col);
vec4 color = v * col + (1.0f - v) * col;
sector(c, uv, p0, float(i) * da, da, r0, r1, color);
}
}
@@ -88,15 +99,15 @@ void fragment()
ivec2 isz = textureSize(TEXTURE, 0);
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
COLOR = vec4(0, 0, 0, 0); //texture(TEXTURE, UV); // Цвет текущей точки
int index = 0;
// Сетка антенн
antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0[mode], ant_band_r1_0[mode], color1, color0);
antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1[mode], ant_band_r1_1[mode], color0, color1);
antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2[mode], ant_band_r1_2[mode], color1, color0);
antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3[mode], ant_band_r1_3[mode], color0, color1);
antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4[mode], ant_band_r1_4[mode], color1, color0);
antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5[mode], ant_band_r1_5[mode], color0, color1);
antenas(COLOR, uv, pc0, ant_band_count_6, ant_band_r0_6[mode], ant_band_r1_6[mode], color1, color0);
antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0[mode], ant_band_r1_0[mode], index);
antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1[mode], ant_band_r1_1[mode], index);
antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2[mode], ant_band_r1_2[mode], index);
antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3[mode], ant_band_r1_3[mode], index);
antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4[mode], ant_band_r1_4[mode], index);
antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5[mode], ant_band_r1_5[mode], index);
antenas(COLOR, uv, pc0, ant_band_count_6, ant_band_r0_6[mode], ant_band_r1_6[mode], index);
}
"
@@ -110,4 +121,4 @@ shader_parameter/radius_inner_0 = 200.0
shader_parameter/radius_inner_1 = 480.0
shader_parameter/radius_outter = 550.0
shader_parameter/mode = 0
shader_parameter/ant_band_c = PackedVector3Array(0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5)
shader_parameter/ant_band_c = PackedVector3Array(0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5, 0.38, 0.47, 0.51, 0.39, 0.44, 0.5)