summaryrefslogtreecommitdiffstats
path: root/src/extras/shaders/gl3/diffusespecularmap.frag
blob: fb809393a301f4ae6107da736f53827da10aa419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#version 150 core

// TODO: Replace with a struct
uniform vec3 ka;            // Ambient reflectivity
uniform float shininess;    // Specular shininess factor

uniform vec3 eyePosition;

uniform sampler2D diffuseTexture;
uniform sampler2D specularTexture;

in vec3 worldPosition;
in vec3 worldNormal;
in vec2 texCoord;

out vec4 fragColor;

#pragma include light.inc.frag

void main()
{
    vec3 diffuseTextureColor = texture( diffuseTexture, texCoord ).rgb;
    vec3 specularTextureColor = texture( specularTexture, texCoord ).rgb;

    vec3 diffuseColor, specularColor;
    adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor);

    fragColor = vec4( diffuseTextureColor * ( ka + diffuseColor ) + specularTextureColor * specularColor, 1.0 );
}