https://github.com/sueda/eol-cloth
Revision 09335f460c9908790628c216a26700fda3188671 authored by Nick Weidner on 05 September 2018, 20:54:38 UTC, committed by Nick Weidner on 05 September 2018, 20:54:38 UTC
1 parent ebf97b9
Tip revision: 09335f460c9908790628c216a26700fda3188671 authored by Nick Weidner on 05 September 2018, 20:54:38 UTC
Fixed some forces and boundary problems
Fixed some forces and boundary problems
Tip revision: 09335f4
phong_frag.glsl
#version 120
varying vec3 vPos; // in camera space
varying vec3 vNor; // in camera space
varying vec2 vTex;
uniform vec3 kdFront;
uniform vec3 kdBack;
void main()
{
vec3 lightPos = vec3(0.0, 0.0, 0.0);
vec3 n = normalize(vNor);
vec3 l = normalize(lightPos - vPos);
vec3 v = -normalize(vPos);
vec3 h = normalize(l + v);
vec3 kd = kdFront;
float ln = dot(l, n);
if(ln < 0.0) {
kd = kdBack;
ln = -ln;
}
vec3 diffuse = ln * kd;
vec3 color = diffuse;
gl_FragColor = vec4(color, 1.0);
}

Computing file changes ...