DALi Version 2.2.42
[platform/core/uifw/dali-demo.git] / examples / bullet-physics / shaders / rendering-textured-shape.vert
1 attribute mediump vec3 aPosition;  // DALi shader builtin
2 attribute mediump vec2 aTexCoord;  // DALi shader builtin
3 uniform   mediump mat4 uMvpMatrix; // DALi shader builtin
4 uniform   mediump mat4 uViewMatrix; // DALi shader builtin
5 uniform   mediump mat4 uModelView; // DALi shader builtin
6 uniform   mediump vec3 uSize;      // DALi shader builtin
7 varying mediump vec3 vIllumination;
8 varying mediump vec2 vTexCoord;
9
10 void main()
11 {
12   mediump vec4 vertexPosition = vec4(aPosition, 1.0);
13   mediump vec3 normal = normalize(vertexPosition.xyz);
14
15   vertexPosition.xyz *= uSize;
16   vec4 pos = uModelView * vertexPosition;
17
18   vec4 lightPosition = vec4(400.0, 0.0, 100.0, 1.0);
19   vec4 mvLightPos = uViewMatrix * lightPosition;
20   vec3 vectorToLight = normalize(mvLightPos.xyz - pos.xyz);
21   float lightDiffuse = max(dot(vectorToLight, normal), 0.0);
22
23   vIllumination = vec3(lightDiffuse * 0.5 + 0.5);
24   vTexCoord = aTexCoord;
25   gl_Position = uMvpMatrix * vertexPosition;
26 }