17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 10:22:09 +01:00

Merge remote-tracking branch 'jano211/siec-radio' into feat/renderers-cleanup

This commit is contained in:
2026-10-26 16:36:36 +01:00
57 changed files with 23957 additions and 22 deletions

57
shaders/mat_wire.frag Normal file
View File

@@ -0,0 +1,57 @@
in vec3 f_normal;
in vec2 f_coord;
in vec4 f_pos;
in vec4 f_clip_pos;
in vec4 f_clip_future_pos;
#include <common>
// overhead line wires, ropes and fittings drawn as solids: untextured metal.
// param[0].rgb - metal colour (sRGB), param[0].a - opacity
// param[1].x - colour intensity, param[1].y - metalness, param[1].z - reflection, param[1].w - glossiness
#param (color, 0, 0, 4, diffuse)
#param (diffuse, 1, 0, 1, diffuse)
#param (specular, 1, 1, 1, specular)
#param (reflection, 1, 2, 1, zero)
#param (glossiness, 1, 3, 1, glossiness)
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
#include <light_common.glsl>
#include <apply_fog.glsl>
#include <tonemapping.glsl>
void main()
{
// no texture: the metal colour alone makes the albedo, apply_lights() applies it to the white base
vec4 tex_color = vec4(1.0, 1.0, 1.0, param[0].a);
vec3 fragcolor = ambient;
vec3 fragnormal = normalize(f_normal);
float reflectivity = param[1].z;
// bare metal: the colour tints the highlights instead of the diffuse term
metalic = clamp(param[1].y, 0.0, 1.0);
float specularity = dot(pow(param[0].rgb, vec3(2.2)), vec3(0.5));
glossiness = abs(param[1].w);
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
#if POSTFX_ENABLED
out_color = color;
#else
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
{
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
out_motion = vec4(a - b, 0.0f, 0.0f);
}
#endif
}