25 lines
503 B
GLSL
25 lines
503 B
GLSL
R"(#version 330 core
|
|
out vec4 color;
|
|
uniform vec3 u_color;
|
|
uniform sampler2D u_texture;
|
|
|
|
in vec3 normal;
|
|
in vec4 pos;
|
|
in vec2 v_texcoords;
|
|
|
|
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);
|
|
|
|
vec4 c = texture(u_texture, v_texcoords);
|
|
|
|
vec3 result = (diffuse) * c.xyz;
|
|
// color = vec4(result,0.0);
|
|
color = c;
|
|
})"; |