3 #define SHADING_UNIFORMS 1
5 layout(binding = 0) uniform sampler2D tex;
6 layout(binding = 1) uniform samplerCube dstex;
8 layout(std140, binding = SHADING_UNIFORMS) uniform fu {
15 const vec3 sky_color = vec3(0.35, 0.5, 0.65);
16 // const float fog_density = 0.005;
19 layout(location = 4) in vec3 pos;
20 layout(location = 5) in vec2 tex_coord;
21 layout(location = 6) in vec3 world_normal;
23 layout(location = 0) out vec4 color;
27 vec4 itexel = textureCube(dstex, normalize(world_normal));
30 float fog = clamp(exp(-s.fog_density * dist), 0.0, 1.0);
32 vec4 texel = texture2D(tex, tex_coord);
34 // vec3 object_color = (diffuse.xyz * cdiff * texel.xyz + specular.xyz * cspec) * itexel.xyz;
35 vec3 object_color = s.diffuse.xyz * texel.xyz * itexel.xyz;
37 color.xyz = mix(sky_color, object_color, fog);