Back to home page

EIC code displayed by LXR

 
 

    


Warning, /eic-opticks/sysrap/gl/rec_flying_point_persist/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 //uniform vec4 post_center ;
0006 //uniform vec4 post_extent ;
0007 
0008 layout (lines) in;
0009 layout (points, max_vertices = 1) out;
0010 
0011 out vec4 fcolor ;
0012 
0013 #define PERSIST 1
0014 // * With PERSIST defined the old rings remain visible after time has gone by
0015 // * Without PERSIST get the traditional flying point visualization
0016 
0017 void main ()
0018 {
0019     //vec4 p0 = gl_in[0].gl_Position*post_extent + post_center ;
0020     //vec4 p1 = gl_in[1].gl_Position*post_extent + post_center ;
0021     // HMM: this scaling only needed if the record array were
0022     //      scaled into ce already : which it is not
0023 
0024     vec4 p0 = gl_in[0].gl_Position ;
0025     vec4 p1 = gl_in[1].gl_Position ;
0026     // two consequtive record positions with propagation times in .w
0027 
0028     float tc = Param.w  ;
0029 
0030     uint valid  = (uint(p0.w > 0.) << 0) + (uint(p1.w > 0.) << 1) + (uint(p1.w > p0.w) << 2) ;
0031     // valid : times > 0. and ordered correctly (no consideration of tc, input time Param.w)
0032     // permitting zero causes "future kink" issue
0033 
0034     uint select = (uint(tc > p0.w ) << 0) + (uint(tc < p1.w) << 1) + (0x1 << 2 )  ;
0035     // select : input time Param tc is between the two point times
0036 
0037     uint valid_select = valid & select ;
0038     // bitwise combination
0039 
0040     fcolor = vec4(1.0,1.0,1.0,1.0) ; ;
0041 
0042     if(valid_select == 0x7) // both points valid and with tc inbetween the points, so can mix to get position
0043     {
0044         vec3 pt = mix( vec3(p0), vec3(p1), (tc - p0.w)/(p1.w - p0.w) );
0045         gl_Position = ModelViewProjection * vec4( pt, 1.0 ) ;
0046         gl_PointSize = 1. ;
0047         EmitVertex();
0048         EndPrimitive();
0049     }
0050 #ifdef PERSIST
0051     else if( valid == 0x7 && select == 0x5 )  // both points valid, but time is beyond them both
0052     {
0053         vec3 pt = vec3(p1) ;
0054         gl_Position = ModelViewProjection * vec4( pt, 1.0 ) ;
0055         gl_PointSize = 1. ;
0056         EmitVertex();
0057         EndPrimitive();
0058     }
0059 #endif
0060 }
0061 
0062