Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#version 420 core
in vec3 FragPos;
in vec2 texCoordsExport;
in vec3 normalExport;
out vec4 colorsOut;
struct Light
{
vec4 ambCols;
vec4 difCols;
vec4 specCols;
vec4 direction;
};
struct Material
{
vec4 ambRefl;
vec4 difRefl;
vec4 specRefl;
vec4 emitCols;
float shininess;
};
uniform sampler2D texture2D;
uniform Light light0;
uniform Material material;
uniform vec3 viewPos;
void main(void)
{
vec3 normal = normalize(normalExport);
vec3 lightDirection = vec3(light0.direction);
vec4 diffuse = max(dot(normal, lightDirection), 0.0f) * (light0.difCols * material.difRefl);
vec3 viewDir = normalize(viewPos - FragPos);
vec3 reflectDir = reflect(-lightDirection, normal);
float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);
vec4 specular = light0.specCols * spec * material.specRefl;
//colorsOut = specular;
//((vec4(vec3(min(diffuse, vec4(1.0))), 1.0) + light0.ambCols + material.emitCols)
colorsOut = (diffuse + light0.ambCols + material.emitCols) * texture(texture2D, texCoordsExport);
}