• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1in vec3 a_position;
2in vec3 a_normal;
3
4#ifdef texturedFlag
5in vec2 a_texCoord0;
6in vec3 a_tangent;
7in vec3 a_binormal;
8#else
9in vec4 a_color;
10#endif
11
12uniform mat4 u_worldTrans;
13uniform mat4 u_projViewTrans;
14uniform mat3 u_normalMatrix;
15
16out vec3 v_normal;
17out vec3 v_position;
18
19#ifdef texturedFlag
20out vec3 v_tangent;
21out vec3 v_binormal;
22out vec2 v_texCoords;
23#else
24out vec4 v_color;
25#endif
26
27void main() {
28
29    v_normal = normalize(u_normalMatrix * a_normal);
30
31    #ifdef texturedFlag
32        v_tangent = normalize(u_normalMatrix * a_tangent);
33        v_binormal = normalize(u_normalMatrix * a_binormal);
34        v_texCoords = a_texCoord0;
35    #else
36        v_color = a_color;
37    #endif
38
39    vec4 position = u_worldTrans * vec4(a_position, 1.0);
40    v_position = position.xyz;
41
42    vec4 pos = u_projViewTrans * position;
43    gl_Position = pos;
44}
45