polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

terrain.te.glsl (783B)


      1 #include profile
      2 
      3 layout(triangles, equal_spacing, cw) in;
      4 
      5 in shader_data {
      6 #include shadervars.glsl
      7 } data_in[];
      8 
      9 out shader_data {
     10 #include shadervars.glsl
     11 } data_out;
     12 
     13 #include uniforms.glsl
     14 
     15 
     16 // out vec3 tePatchDistance = gl_TessCoord;
     17 
     18 
     19 void main()
     20 {
     21     vec4 v = gl_TessCoord.x * vec4(data_in[0].position, 1.0);
     22     + gl_TessCoord.y * vec4(data_in[1].position, 1.0);
     23     + gl_TessCoord.z * vec4(data_in[2].position, 1.0);
     24     // tePatchDistance = gl_TessCoord;
     25     gl_Position = mvp * v;
     26 
     27     data_out.position = gl_Position.xyz;
     28     data_out.color = data_in[0].color;
     29     data_out.color_smooth = data_in[0].color_smooth;
     30     data_out.normal = data_in[0].normal;
     31     // data_out.shadow_coord = depth_mvp * data_in[0].shadow_coord;
     32     data_out.world_pos = (world * v).xyz;
     33 
     34 }