3 layout(binding = 0) uniform sampler2D tex;
4 layout(binding = 0) uniform samplerCube dstex;
6 layout(std140, binding = 0) uniform shading_state {
11 const vec3 sky_color = vec3(0.35, 0.5, 0.65);
13 layout(location = 0) in vec3 pos;
14 layout(location = 1) in vec2 tex_coord;
15 layout(location = 2) in vec3 world_normal;
17 layout(location = 0) out vec4 color;
21 vec4 itexel = texture(dstex, normalize(world_normal));
22 vec4 texel = texture(tex, tex_coord);
24 vec3 object_color = s.diffuse.xyz * texel.xyz * itexel.xyz;
26 float fog = clamp(exp(-s.fog_density * dist), 0.0, 1.0);
28 color.xyz = mix(sky_color, object_color, fog);