Back to home page

EIC code displayed by LXR

 
 

    


Warning, /eic-opticks/sysrap/gl/rec_line_strip/geom.glsl is written in an unsupported language. File is not indexed.

0001 #version 410 core
0002 
0003 // based on oglrap/gl/altrec/geom.glsl
0004 
0005 uniform mat4 ModelViewProjection ;
0006 uniform vec4 Param ;
0007 
0008 layout (lines) in;
0009 layout (line_strip, max_vertices = 2) out;
0010 
0011 out vec4 fcolor ;
0012 
0013 
0014 void main ()
0015 {
0016     vec4 p0 = gl_in[0].gl_Position ;
0017     vec4 p1 = gl_in[1].gl_Position ;
0018     // two consequtive record positions with propagation times in .w
0019 
0020     float tc = Param.w  ;
0021 
0022     uint valid  = (uint(p0.w > 0.) << 0) + (uint(p1.w > 0.) << 1) + (uint(p1.w > p0.w) << 2) ;
0023     // valid : times > 0. and ordered correctly (no consideration of tc, input time Param.w)
0024     // permitting zero causes "future kink" issue
0025 
0026     uint select = (uint(tc > p0.w ) << 0) + (uint(tc < p1.w) << 1) + (0x1 << 2 )  ;
0027     // select : input time Param tc is between the two point times
0028 
0029     uint valid_select = valid & select ;
0030     // bitwise combination
0031 
0032     fcolor = vec4(1.0,1.0,1.0,1.0) ; ;
0033 
0034     if(valid_select == 0x7) // both points valid and with tc inbetween the points, so can mix to get position
0035     {
0036         gl_Position = ModelViewProjection * vec4(vec3(p0), 1.0) ;
0037         EmitVertex();
0038 
0039         vec3 pt = mix( vec3(p0), vec3(p1), (tc - p0.w)/(p1.w - p0.w) );
0040         gl_Position = ModelViewProjection * vec4( pt, 1.0 ) ;
0041         EmitVertex();
0042     }
0043     else if( valid == 0x7 && select == 0x5 )  // both points valid, but time is beyond them both
0044     {
0045         gl_Position = ModelViewProjection * vec4( vec3(p0), 1.0 ) ;
0046         EmitVertex();
0047 
0048         gl_Position = ModelViewProjection * vec4( vec3(p1), 1.0 ) ;
0049         EmitVertex();
0050     }
0051     EndPrimitive();   // MAYBE DO THIS INSIDE THE BRACKET ? 
0052 }
0053 
0054