mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-28 23:57:28 +01:00
Sam kod exe z gałęzi siec-trakcyjna (bez testów, notatek i danych z tests/catenary). Dane (data/traction_*.txt) leżą poza repozytorium. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Tqn7T8D1Gx3ptKtZgNtX5
58 lines
1.7 KiB
GLSL
58 lines
1.7 KiB
GLSL
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
|
|
}
|