Доработка. Цвет антенн теперь Color, вместо Vector3

This commit is contained in:
sasha80
2025-10-07 12:43:06 +03:00
parent 6c60eeda74
commit 482d1f6dda
5 changed files with 19 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://s6xe8igevnv2"]
[gd_resource type="ShaderMaterial" load_steps=2 format=4 uid="uid://s6xe8igevnv2"]
[sub_resource type="Shader" id="1"]
code = "shader_type canvas_item;
@@ -15,6 +15,7 @@ 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 */
const int ant_band_count_0 = 2;
@@ -41,8 +42,7 @@ 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 vec3 ant_band_c[28];
uniform vec4 ant_band_c[28];
const float d4 = 90.0;
const float ds = 1.0;
@@ -76,11 +76,9 @@ void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, inout
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;
col.rgb = ant_band_c[j].rgb;
index++;
col.a = 0.5;
col.a = alpha;
float v = float(i & 1);
vec4 color = v * col + (1.0f - v) * col;
sector(c, uv, p0, float(i) * da, da, r0, r1, color);
@@ -98,7 +96,7 @@ 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); // Цвет текущей точки
COLOR = vec4(0, 0, 0, 0);
int index = 0;
// Сетка антенн
antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0[mode], ant_band_r1_0[mode], index);
@@ -120,5 +118,6 @@ 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/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)
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)

View File

@@ -14,8 +14,8 @@ instance uniform float inner_clip: hint_range(0.0, 0.125) = 0.045;
const vec2 center = vec2(0.125, 0.125); /* Центр. Должен быть в (0.5, 0.5), но это не так */
const float dsa = 0.0025; /* Относительное расстояние на котором выполняется сглаживание краёв по радиальным линиям */
const float dsr = 0.00025; /* Относительное расстояние на котором выполняется сглаживание краёв по круговым линиям */
const float dsa = 0.003; /* Относительное расстояние на котором выполняется сглаживание краёв по радиальным линиям */
const float dsr = 0.0003; /* Относительное расстояние на котором выполняется сглаживание краёв по круговым линиям */
vec4 sector(vec4 c, vec2 uv_pos, float r0, float r1, float w)