2014-03-21 13:36:47 -04:00
|
|
|
uniform sampler2D DiffuseMap;
|
|
|
|
uniform sampler2D SpecularMap;
|
|
|
|
uniform sampler2D SSAO;
|
|
|
|
uniform vec3 ambient;
|
|
|
|
|
2014-05-16 20:39:55 -04:00
|
|
|
layout (std140) uniform MatrixesData
|
|
|
|
{
|
|
|
|
mat4 ViewMatrix;
|
|
|
|
mat4 ProjectionMatrix;
|
|
|
|
mat4 InverseViewMatrix;
|
|
|
|
mat4 InverseProjectionMatrix;
|
|
|
|
mat4 ShadowViewProjMatrixes[4];
|
|
|
|
vec2 screen;
|
|
|
|
};
|
|
|
|
|
2014-03-21 13:36:47 -04:00
|
|
|
vec3 getLightFactor(float specMapValue)
|
|
|
|
{
|
|
|
|
vec2 tc = gl_FragCoord.xy / screen;
|
|
|
|
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
|
|
|
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
|
|
|
float ao = texture(SSAO, tc).x;
|
|
|
|
vec3 tmp = ao * ambient + DiffuseComponent + SpecularComponent * specMapValue;
|
2014-03-30 16:38:58 -04:00
|
|
|
return tmp * ao;
|
2014-03-21 13:36:47 -04:00
|
|
|
}
|