2016-09-29 00:50:51 +00:00
|
|
|
R"raw_string(
|
|
|
|
#version 120
|
2016-09-29 02:24:14 +00:00
|
|
|
|
2016-09-29 00:50:51 +00:00
|
|
|
varying vec3 vertex;
|
2016-09-29 02:24:14 +00:00
|
|
|
varying vec3 normal;
|
|
|
|
|
2016-09-29 00:50:51 +00:00
|
|
|
uniform vec3 color;
|
2016-09-29 02:24:14 +00:00
|
|
|
varying vec3 lightvec;
|
|
|
|
|
2016-09-29 00:50:51 +00:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
//gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
|
|
|
//gl_FragColor = vec4(0.5+0.5*vertex.xyz, 1.0);
|
2016-09-29 02:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
vec3 Eye = normalize(-vertex);
|
2016-09-29 06:28:56 +00:00
|
|
|
vec3 Reflected = normalize(reflect( -lightvec, normal));
|
2016-09-29 02:24:14 +00:00
|
|
|
|
|
|
|
//todo materials (& light color)
|
2016-09-29 06:28:56 +00:00
|
|
|
vec4 IAmbient = vec4(0.2f, 0.2f, 0.2f, 1.0f);
|
2016-09-29 07:36:57 +00:00
|
|
|
vec4 IDiffuse = vec4(color, 0.0f) * max(dot(normal, lightvec), 0.0);
|
2016-09-29 02:24:14 +00:00
|
|
|
//todo shininess
|
|
|
|
vec4 ISpecular = vec4(1.0f, 0.0f, 0.0f, 0.0f) * pow(max(dot(Reflected, Eye), 0.0), 3);
|
2016-09-29 06:28:56 +00:00
|
|
|
|
2016-09-29 02:24:14 +00:00
|
|
|
gl_FragColor = vec4((IAmbient + IDiffuse) + ISpecular);
|
2016-09-29 06:28:56 +00:00
|
|
|
//gl_FragColor = vec4(0.5+0.5*normal, 1.0);
|
2016-09-29 00:50:51 +00:00
|
|
|
}
|
|
|
|
)raw_string"
|