mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 03:09:18 +02:00
motion blur
This commit is contained in:
@@ -25,9 +25,9 @@ vec3 apply_fog(vec3 color)
|
||||
{
|
||||
float sun_amount = 0.0;
|
||||
if (lights_count >= 1U && lights[0].type == LIGHT_DIR)
|
||||
sun_amount = max(dot(normalize(f_pos), normalize(-lights[0].dir)), 0.0);
|
||||
sun_amount = max(dot(normalize(f_pos.xyz), normalize(-lights[0].dir)), 0.0);
|
||||
vec3 fog_color_v = mix(fog_color, lights[0].color, pow(sun_amount, 30.0));
|
||||
float fog_amount_v = 1.0 - min(1.0, exp(-length(f_pos) * fog_density));
|
||||
float fog_amount_v = 1.0 - min(1.0, exp(-length(f_pos.xyz) * fog_density));
|
||||
return mix(color, fog_color_v, fog_amount_v);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ vec2 calc_light(vec3 light_dir)
|
||||
#else
|
||||
vec3 normal = normalize(f_normal);
|
||||
#endif
|
||||
vec3 view_dir = normalize(vec3(0.0f, 0.0f, 0.0f) - f_pos);
|
||||
vec3 view_dir = normalize(vec3(0.0f, 0.0f, 0.0f) - f_pos.xyz);
|
||||
vec3 halfway_dir = normalize(light_dir + view_dir);
|
||||
|
||||
float diffuse_v = max(dot(normal, light_dir), 0.0);
|
||||
@@ -51,10 +51,10 @@ vec2 calc_light(vec3 light_dir)
|
||||
|
||||
vec2 calc_point_light(light_s light)
|
||||
{
|
||||
vec3 light_dir = normalize(light.pos - f_pos);
|
||||
vec3 light_dir = normalize(light.pos - f_pos.xyz);
|
||||
vec2 val = calc_light(light_dir);
|
||||
|
||||
float distance = length(light.pos - f_pos);
|
||||
float distance = length(light.pos - f_pos.xyz);
|
||||
float atten = 1.0f / (1.0f + light.linear * distance + light.quadratic * (distance * distance));
|
||||
|
||||
return val * atten;
|
||||
@@ -62,7 +62,7 @@ vec2 calc_point_light(light_s light)
|
||||
|
||||
vec2 calc_spot_light(light_s light)
|
||||
{
|
||||
vec3 light_dir = normalize(light.pos - f_pos);
|
||||
vec3 light_dir = normalize(light.pos - f_pos.xyz);
|
||||
|
||||
float theta = dot(light_dir, normalize(-light.dir));
|
||||
float epsilon = light.in_cutoff - light.out_cutoff;
|
||||
|
||||
Reference in New Issue
Block a user