Revision 3fc9327a
Added by Leszek Koltunski about 7 years ago
src/main/res/raw/main_vertex_shader.glsl | ||
---|---|---|
24 | 24 |
in vec3 a_Normal; // Per-vertex normal vector. |
25 | 25 |
in vec2 a_TexCoordinate; // Per-vertex texture coordinate. |
26 | 26 |
out vec3 v_Position; // |
27 |
out vec2 v_ndcPosition; // for Transform Feedback only
|
|
27 |
out vec3 v_endPosition; // for Transform Feedback only
|
|
28 | 28 |
out vec3 v_Normal; // |
29 | 29 |
out vec2 v_TexCoordinate; // |
30 | 30 |
#else |
... | ... | |
32 | 32 |
attribute vec3 a_Normal; // Per-vertex normal vector. |
33 | 33 |
attribute vec2 a_TexCoordinate; // Per-vertex texture coordinate. |
34 | 34 |
varying vec3 v_Position; // |
35 |
varying vec2 v_ndcPosition; // for Transform Feedback only
|
|
35 |
varying vec3 v_endPosition; // for Transform Feedback only
|
|
36 | 36 |
varying vec3 v_Normal; // |
37 | 37 |
varying vec2 v_TexCoordinate; // |
38 | 38 |
#endif |
... | ... | |
527 | 527 |
{ |
528 | 528 |
vec3 v = 2.0*u_objD*a_Position; |
529 | 529 |
vec3 n = a_Normal; |
530 |
vec4 mvpPos; |
|
531 | 530 |
|
532 | 531 |
#if NUM_VERTEX>0 |
533 | 532 |
int j=0; |
... | ... | |
559 | 558 |
#endif |
560 | 559 |
|
561 | 560 |
v_Position = v; |
561 |
v_endPosition = v + (0.3*u_objD.x)*n; |
|
562 | 562 |
v_TexCoordinate = a_TexCoordinate; |
563 | 563 |
v_Normal = normalize(vec3(u_MVMatrix*vec4(n,0.0))); |
564 |
mvpPos = u_MVPMatrix*vec4(v,1.0); |
|
565 |
v_ndcPosition = vec2(mvpPos.x/mvpPos.w,mvpPos.y/mvpPos.w); |
|
566 |
gl_Position = mvpPos; |
|
564 |
gl_Position = u_MVPMatrix*vec4(v,1.0); |
|
567 | 565 |
} |
Also available in: Unified diff
Use Transform Feedback to (optionally) display the Normal vectors.