summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/shader_3d/diffuse_vert.shd
blob: 2b62b829cc3b73f0085d67bf728d0db1fed167c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
uniform mat4  uMatrixMvp;

#ifdef VERTEX_POSITION
attribute   vec4  aPosition0;
#endif //VERTEX_POSITION

#ifdef VERTEX_POSITION_BLEND
attribute   vec4  aPosition1;
uniform     float uPositionWeight;
#endif //VERTEX_POSITION_BLEND

#ifdef VERTEX_TEXCOORD
attribute   vec4  aTexCoord0;
#endif //VERTEX_TEXCOORD

#ifdef VERTEX_TEXCOORD_BLEND
attribute   vec4  aTexCoord1;
uniform     float uTexCoordWeight;
#endif //VERTEX_TEXCOORD_BLEND

#ifdef NEED_TEX_COORD
varying vec2 vTexCoord;
#endif //NEED_TEX_COORD

void main()
{

#ifdef VERTEX_POSITION_BLEND
   vec4 position = aPosition0 * uPositionWeight +
   aPosition1 * (1.0 - uPositionWeight);
   position = vec4(position.xyz, 1.0);
#else

#ifdef VERTEX_POSITION
   vec4 position = vec4(aPosition0.xyz, 1.0);
#endif // VERTEX_POSITION

#endif //VERTEX_POSITION_BLEND

#ifdef VERTEX_TEXCOORD_BLEND
   vTexCoord = aTexCoord0.st * uTexCoordWeight +
   aTexCoord1.st * (1.0 - uTexCoordWeight);
#else

#ifdef VERTEX_TEXCOORD
   vTexCoord = aTexCoord0.st;
#endif //VERTEX_TEXCOORD

#endif //VERTEX_TEXCOORD_BLEND

   gl_Position = uMatrixMvp * position;
}