Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #version 410 core
0002 
0003 uniform mat4 ModelViewProjection ;
0004 uniform vec4 Param ;
0005 
0006 layout (lines) in;
0007 layout (points, max_vertices = 1) out;
0008 
0009 out vec4 fcolor ;
0010 
0011 //#define PERSIST 1
0012 // * With PERSIST defined the old rings remain visible after time has gone by
0013 // * Without PERSIST get the traditional flying point visualization
0014 
0015 void main ()
0016 {
0017     vec4 p0 = gl_in[0].gl_Position ;
0018     vec4 p1 = gl_in[1].gl_Position ;
0019     // two consequtive record positions with propagation times in .w
0020 
0021     float tc = Param.w  ;
0022 
0023     uint valid  = (uint(p0.w > 0.) << 0) + (uint(p1.w > 0.) << 1) + (uint(p1.w > p0.w) << 2) ;
0024     // valid : times >= 0. and ordered correctly (no consideration of tc, input time Param.w)
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         vec3 pt = mix( vec3(p0), vec3(p1), (tc - p0.w)/(p1.w - p0.w) );
0037         gl_Position = ModelViewProjection * vec4( pt, 1.0 ) ;
0038         gl_PointSize = 2. ;
0039         EmitVertex();
0040         EndPrimitive();
0041     }
0042 #ifdef PERSIST
0043     else if( valid == 0x7 && select == 0x5 )  // both points valid, but time is beyond them both
0044     {
0045         vec3 pt = vec3(p1) ;
0046         gl_Position = ModelViewProjection * vec4( pt, 1.0 ) ;
0047         gl_PointSize = 2. ;
0048         EmitVertex();
0049         EndPrimitive();
0050     }
0051 #endif
0052 }
0053 
0054