Merge branch 'master-lepshiy'
# Conflicts: # scenes/настройки/настройки.gd
This commit is contained in:
78
shaders/select-tr.gdshader
Normal file
78
shaders/select-tr.gdshader
Normal file
@@ -0,0 +1,78 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 color: source_color = vec4(1, 1, 1, 1);
|
||||
uniform vec4 color_up: source_color = vec4(1, 1, 1, 1); /* Цвет вспышки при обновлении */
|
||||
const float ds = 0.01425; /* Относительное расстояние на котором выполняется сглаживание краёв */
|
||||
const float dsr = 12.125;
|
||||
const vec2 center = vec2(0.5, 0.5); /* Центр должен быть в (0.5, 0.5), но это не так */
|
||||
const float radius = 0.075 - ds * 2.0; /* Радиус должен быть 0.5, но это не так */
|
||||
|
||||
uniform float speed: hint_range(0.0, 1024.0) = 0.0; /* Время вспышки при обновлении, c */
|
||||
uniform int ant_band_count_0 = 3;
|
||||
|
||||
uniform float ant_band_r0_0 = 0.3;
|
||||
|
||||
uniform float ant_band_r1_0 = 0.4;
|
||||
|
||||
float smooth_px(float r, float R, float dss)
|
||||
{
|
||||
return 1.0 - smoothstep(R - dss, R + dss, r);
|
||||
}
|
||||
|
||||
void sector(inout vec4 c, vec2 uv, vec2 cnt, float a, float da, float r0, float r1, vec4 col)
|
||||
{
|
||||
float l = distance(cnt, uv);
|
||||
vec2 d = uv - cnt;
|
||||
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_px(a0 * sf, theta, dsr) - smooth_px(a1 * sf, theta, dsr);
|
||||
float vr = smooth_px(r0, l, ds) - smooth_px(r1, l, ds);
|
||||
float rgb = sqrt(va * vr);
|
||||
c.rgb += col.rgb * rgb * col.a;
|
||||
c.a += rgb * col.a;
|
||||
}
|
||||
|
||||
|
||||
void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, vec4 c0, vec4 c1)
|
||||
{
|
||||
float da = 180.0f / float(cnt);
|
||||
for (int i = -cnt; i <= 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);
|
||||
}
|
||||
}
|
||||
|
||||
vec2 rotateUVmatrinx(vec2 uv, vec2 pivot, float rotation)
|
||||
{
|
||||
mat2 rotation_matrix=mat2(vec2(sin(rotation), -cos(rotation)), vec2(cos(rotation),sin(rotation)));
|
||||
uv -= pivot;
|
||||
uv *= rotation_matrix;
|
||||
uv += pivot;
|
||||
return uv;
|
||||
}
|
||||
|
||||
|
||||
void vertex()
|
||||
{
|
||||
float dir = 0.0;
|
||||
dir += speed * TIME;
|
||||
VERTEX = rotateUVmatrinx(VERTEX, center, radians(dir));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fragment()
|
||||
{
|
||||
|
||||
ivec2 isz = textureSize(TEXTURE, 0);
|
||||
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
|
||||
COLOR = vec4(0, 0, 0, 0.0); //texture(TEXTURE, UV); // Цвет текущей точки
|
||||
|
||||
// Сетка антенн
|
||||
antenas(COLOR, uv, center, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, color, color_up);
|
||||
}
|
||||
Reference in New Issue
Block a user