blob: 5ad170d1d64e5ff5d1b7162665124eb3f2daf084 (
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
|
#define FP highp
// TODO: Replace with a struct
uniform FP vec4 ka; // Ambient reflectivity
uniform FP float shininess; // Specular shininess factor
uniform FP vec3 eyePosition;
uniform sampler2D diffuseTexture;
uniform sampler2D specularTexture;
varying FP vec3 worldPosition;
varying FP vec3 worldNormal;
varying FP vec2 texCoord;
#pragma include light.inc.frag
void main()
{
FP vec4 diffuseTextureColor = texture2D( diffuseTexture, texCoord );
FP vec4 specularTextureColor = texture2D( specularTexture, texCoord );
FP vec3 worldView = normalize(eyePosition - worldPosition);
gl_FragColor = phongFunction(ka, diffuseTextureColor, specularTextureColor, shininess, worldPosition, worldView, worldNormal);
}
|