move conversion to fragment shader

This commit is contained in:
Imbris 2019-08-04 17:07:29 -04:00
parent c09eb77149
commit bdd7b2c22d
2 changed files with 4 additions and 4 deletions

View File

@ -16,11 +16,10 @@ out vec4 tgt_color;
#include <sky.glsl>
#include <light.glsl>
#include <srgb.glsl>
void main() {
vec3 light = get_sun_diffuse(f_norm, time_of_day.x) * f_light + light_at(f_pos, f_norm);
vec3 surf_color = srgb_to_linear(f_col) * light;
vec3 surf_color = f_col * light;
float fog_level = fog(f_pos.xy, focus_pos.xy);
vec3 fog_color = get_sky_color(normalize(f_pos - cam_pos.xyz), time_of_day.x);

View File

@ -1,6 +1,7 @@
#version 330 core
#include <globals.glsl>
#include <srgb.glsl>
in uint v_pos_norm;
in uint v_col_light;
@ -34,11 +35,11 @@ void main() {
// Use an array to avoid conditional branching
f_norm = normals[norm_axis + norm_dir];
f_col = vec3(
f_col = srgb_to_linear(vec3(
float((v_col_light >> 8) & 0xFFu),
float((v_col_light >> 16) & 0xFFu),
float((v_col_light >> 24) & 0xFFu)
) / 255.0;
) / 255.0);
f_light = float(v_col_light & 0xFFu) / 255.0;