20 lines
538 B
Text
20 lines
538 B
Text
|
#version 150 compatibility
|
||
|
|
||
|
in vec3 normal;
|
||
|
in vec4 color;
|
||
|
in vec3 position;
|
||
|
flat in int side;
|
||
|
uniform int illumination_mode = 1;
|
||
|
|
||
|
vec4 doLighting(vec3 position, vec3 normal, vec4 diffuseMaterial);
|
||
|
vec4 doTwoSidedLighting(vec3 position, vec3 normal, vec4 diffuseMaterial, int side);
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
// illumination
|
||
|
gl_FragColor = color;
|
||
|
switch (illumination_mode) {
|
||
|
case 1: gl_FragColor.rgb = doLighting(position, normal, color).rgb; break;
|
||
|
case 2: gl_FragColor.rgb = doTwoSidedLighting(position, normal, color, side).rgb; break;
|
||
|
}
|
||
|
}
|