CGII/framework/shader/cgv_gl/glsl/box.glfs

20 lines
538 B
Text
Raw Normal View History

2018-05-17 14:01:02 +00:00
#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;
}
}