2023-11-07 08:27:44 -06:00
|
|
|
@vs vs
|
|
|
|
in vec3 a_pos;
|
|
|
|
in vec2 a_tex_coords;
|
2024-04-23 18:12:45 -05:00
|
|
|
in vec4 a_norm;
|
2023-11-07 08:27:44 -06:00
|
|
|
|
|
|
|
out vec2 tex_coords;
|
2024-04-23 15:58:08 -05:00
|
|
|
out vec3 normal;
|
2023-11-07 08:27:44 -06:00
|
|
|
|
|
|
|
uniform vs_p {
|
|
|
|
uniform mat4 vp;
|
|
|
|
uniform mat4 model;
|
|
|
|
};
|
|
|
|
|
|
|
|
void main() {
|
2024-04-23 18:12:45 -05:00
|
|
|
gl_Position = vp * model * vec4(a_pos,1.0);
|
2023-11-07 08:27:44 -06:00
|
|
|
tex_coords = a_tex_coords;
|
2024-04-23 18:12:45 -05:00
|
|
|
normal = a_norm.xyz;
|
2023-11-07 08:27:44 -06:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@fs fs
|
|
|
|
in vec2 tex_coords;
|
2024-04-23 15:58:08 -05:00
|
|
|
in vec3 normal;
|
2023-11-07 08:27:44 -06:00
|
|
|
out vec4 color;
|
|
|
|
|
|
|
|
uniform texture2D diffuse;
|
|
|
|
uniform sampler smp;
|
|
|
|
|
|
|
|
void main() {
|
2024-04-23 15:58:08 -05:00
|
|
|
vec3 lightDir = normalize(vec3(0.5f, 0.5f, 1.0f));
|
|
|
|
float diff = max(dot(normal, lightDir), 0.0f);
|
2024-04-23 18:12:45 -05:00
|
|
|
color = texture(sampler2D(diffuse,smp),tex_coords)*diff;
|
2023-11-07 08:27:44 -06:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@program unlit vs fs
|