2022-02-05 20:44:31 +00:00
|
|
|
R"(#version 330 core
|
|
|
|
out vec4 color;
|
|
|
|
uniform vec3 u_color;
|
2022-02-06 13:47:33 +00:00
|
|
|
uniform sampler2D u_texture;
|
2022-02-05 20:44:31 +00:00
|
|
|
|
|
|
|
in vec3 normal;
|
|
|
|
in vec4 pos;
|
2022-02-06 13:47:33 +00:00
|
|
|
in vec2 v_texcoords;
|
2022-02-05 20:44:31 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec3 norm = normalize(normal);
|
|
|
|
vec3 lightDir = normalize(vec3(4.0,3.0,3.0) - pos.xyz);
|
|
|
|
|
|
|
|
float diff = max(dot(norm, lightDir), 0.0);
|
|
|
|
|
|
|
|
// set light color
|
|
|
|
vec3 diffuse = diff * vec3(1.0,1.0,1.0);
|
|
|
|
|
2022-02-06 13:47:33 +00:00
|
|
|
vec4 c = texture(u_texture, v_texcoords);
|
|
|
|
|
|
|
|
vec3 result = (diffuse) * c.xyz;
|
|
|
|
// color = vec4(result,0.0);
|
|
|
|
color = c;
|
2022-02-05 20:44:31 +00:00
|
|
|
})";
|