polyadvent

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

terrain.tc.glsl (982B)


      1 #include profile
      2 
      3 layout(vertices = 3) out;
      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 // uniform float TessLevelInner;
     16 // uniform float TessLevelOuter;
     17 
     18 
     19 void main()
     20 {
     21 
     22     // gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
     23     const float inner = 1.0;
     24     const float outer = 2.0;
     25 
     26     if (gl_InvocationID == 0) {
     27         gl_TessLevelInner[0] = inner;
     28         gl_TessLevelOuter[0] = outer;
     29         gl_TessLevelOuter[1] = outer;
     30         gl_TessLevelOuter[2] = outer;
     31     }
     32 
     33     // data_out[gl_InvocationID] = data_in[gl_InvocationID];
     34     data_out[gl_InvocationID].position     = data_in[gl_InvocationID].position;
     35     data_out[gl_InvocationID].color        = data_in[gl_InvocationID].color;
     36     data_out[gl_InvocationID].color_smooth = data_in[gl_InvocationID].color_smooth;
     37     data_out[gl_InvocationID].normal       = data_in[gl_InvocationID].normal;
     38 }