summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/shader_3d/vertex_color_vert.shd
blob: 560baad63df377e428214b93fc96929d1b1c8a8e (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
uniform     mat4  uMatrixMvp;
varying     vec4  vColor;

#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_COLOR
attribute   vec4  aColor0;
#endif //VERTEX_COLOR

#ifdef VERTEX_COLOR_BLEND
attribute   vec4  aColor1;
uniform     float uColorWeight;
#endif //VERTEX_COLOR_BLEND

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_COLOR_BLEND
   vec4 color = aColor0 * uColorWeight + aColor1 * (1.0 - uColorWeight);
#else

#ifdef VERTEX_COLOR
   vec4 color = aColor0;
#endif //VERTEX_COLOR

#endif //VERTEX_COLOR_BLEND

   vColor = color;
   gl_Position = uMatrixMvp * position;
}