2025-04-16 01:24:10 +00:00
|
|
|
#version 450
|
|
|
|
|
2025-04-17 20:33:28 -04:00
|
|
|
layout(location = 0) in vec2 tex_coords;
|
2025-05-05 17:22:02 -04:00
|
|
|
layout(location = 1) in vec4 normal;
|
2025-04-18 23:45:11 +02:00
|
|
|
layout(set = 1, binding = 0) uniform texture2D t_diffuse;
|
|
|
|
layout(set = 1, binding = 1) uniform sampler s_diffuse;
|
2025-04-16 01:24:10 +00:00
|
|
|
layout(location = 0) out vec4 out_color;
|
2025-04-17 20:33:28 -04:00
|
|
|
// layout(group = 0, binding = 0) out texture2D;
|
2025-04-16 01:24:10 +00:00
|
|
|
void main() {
|
2025-04-27 16:06:59 -04:00
|
|
|
float ambient = 0.2;
|
|
|
|
vec3 light_dir = normalize(vec3(0.5, 1.0, 0.5));
|
2025-05-05 17:22:02 -04:00
|
|
|
float diffuse = clamp(dot(normalize(vec3(normal.x, normal.y, normal.z)), light_dir), 0.0, 1.0);
|
2025-04-27 16:06:59 -04:00
|
|
|
float brightness = ambient + (1.0 - ambient) * diffuse;
|
2025-05-05 17:22:02 -04:00
|
|
|
// out_color = vec4(normal.x, normal.y, normal.z, 1.0);
|
|
|
|
// out_color = vec3(1.0,.0.0)
|
2025-04-17 20:33:28 -04:00
|
|
|
out_color = texture(sampler2D(t_diffuse, s_diffuse), tex_coords);
|
2025-04-27 16:06:59 -04:00
|
|
|
out_color.r = clamp(out_color.r * 0.6 * brightness, 0.0, 1.0);
|
|
|
|
out_color.g = clamp(out_color.g * 0.6 * brightness, 0.0, 1.0);
|
|
|
|
out_color.b = clamp(out_color.b * 0.9 * brightness, 0.0, 1.0);
|
2025-04-16 01:24:10 +00:00
|
|
|
}
|