Project

General

Profile

« Previous | Next » 

Revision 5e331bc8

Added by Leszek Koltunski almost 6 years ago

Update the 'main' shaders for OIT.

View differences:

src/main/res/raw/main_vertex_shader.glsl
19 19

  
20 20
precision highp float;
21 21

  
22
#if __VERSION__ != 100
23 22
in vec3 a_Position;                  // Per-vertex position.
24 23
in vec3 a_Normal;                    // Per-vertex normal vector.
25 24
in vec2 a_TexCoordinate;             // Per-vertex texture coordinate.
......
27 26
out vec3 v_endPosition;              // for Transform Feedback only
28 27
out vec3 v_Normal;                   //
29 28
out vec2 v_TexCoordinate;            //
30
#else
31
attribute vec3 a_Position;           // Per-vertex position.
32
attribute vec3 a_Normal;             // Per-vertex normal vector.
33
attribute vec2 a_TexCoordinate;      // Per-vertex texture coordinate.
34
varying vec3 v_Position;             //
35
varying vec3 v_endPosition;          // for Transform Feedback only
36
varying vec3 v_Normal;               //
37
varying vec2 v_TexCoordinate;        //
29

  
30
#ifdef OIT
31
out vec2 v_Pixel;                    // 2D pixel coords in window space
32
uniform uvec2 u_Size;                // size of the output surface, in pixels.
38 33
#endif
39 34

  
40 35
uniform vec3 u_objD;                 // half of object width x half of object height X half the depth;
......
165 160
#endif
166 161
   
167 162
  v_Position      = v;
163

  
164
#ifdef OIT
165
  v_Pixel         = (a_Position.xy + 0.5) * vec2(u_Size);
166
#endif
167

  
168 168
  v_endPosition   = v + (0.3*u_objD.x)*n;
169 169
  v_TexCoordinate = a_TexCoordinate;
170 170
  v_Normal        = normalize(vec3(u_MVMatrix*vec4(n,0.0)));

Also available in: Unified diff