Added super simple lighting to shaders.
parent
6dd7d27777
commit
1ef48039b5
|
@ -2,8 +2,11 @@
|
||||||
|
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
smooth in vec4 ioFragColor;
|
smooth in vec4 ioFragColor;
|
||||||
|
in vec3 ioNormal;
|
||||||
|
in vec2 ioUV;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
fragColor = ioFragColor;
|
float diff = max(dot(ioNormal, vec3(1., 1., 1.)), 0.3);
|
||||||
|
fragColor = ioFragColor * diff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,13 @@ uniform mat4 uViewMatrix;
|
||||||
uniform mat4 uProjectionMatrix;
|
uniform mat4 uProjectionMatrix;
|
||||||
|
|
||||||
smooth out vec4 ioFragColor;
|
smooth out vec4 ioFragColor;
|
||||||
|
out vec3 ioNormal;
|
||||||
|
out vec2 ioUV;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
ioFragColor = inColor;
|
ioFragColor = inColor;
|
||||||
|
ioNormal = inNormal;
|
||||||
|
ioUV = inUV;
|
||||||
gl_Position = (uProjectionMatrix * uViewMatrix * uModelMatrix * inCoord);
|
gl_Position = (uProjectionMatrix * uViewMatrix * uModelMatrix * inCoord);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue