1 attribute vec3 inVertexPosition;
\r
2 attribute vec3 inVertexNormal;
\r
3 attribute vec4 inVertexColor;
\r
4 attribute vec2 inTexCoord0;
\r
6 uniform mat4 mWorldViewProj;
\r
7 uniform mat4 mInvWorld;
\r
8 uniform mat4 mTransWorld;
\r
9 uniform vec3 mLightPos;
\r
10 uniform vec4 mLightColor;
\r
12 varying mediump vec4 v_color;
\r
13 varying mediump vec2 v_texCoord;
\r
17 gl_Position = mWorldViewProj * vec4(inVertexPosition,1.0);
\r
19 vec4 normal = vec4(inVertexNormal, 0.0);
\r
20 normal = mInvWorld * normal;
\r
21 normal = normalize(normal);
\r
23 vec4 worldpos = vec4(inVertexPosition,1.0) * mTransWorld;
\r
25 vec4 lightVector = worldpos - vec4(mLightPos,1.0);
\r
26 lightVector = normalize(lightVector);
\r
28 float tmp2 = dot(-lightVector, normal);
\r
30 vec4 tmp = mLightColor * tmp2;
\r
31 v_color = vec4(tmp.x, tmp.y, tmp.z, 0.0);
\r
33 v_texCoord = inTexCoord0;
\r