12Ray glup_primary_ray() {
 
   14        2.0 * ( (gl_FragCoord.x - GLUP.viewport[0]) / GLUP.viewport[2] - 0.5),
 
   15        2.0 * ( (gl_FragCoord.y - GLUP.viewport[1]) / GLUP.viewport[3] - 0.5),
 
   19    near = GLUP.inverse_modelviewprojection_matrix * near ;
 
   20    vec4 far = near + GLUP.inverse_modelviewprojection_matrix[2] ;
 
   23    return Ray(near.xyz, far.xyz-near.xyz) ;
 
   27void glup_update_depth(in vec3 M_world_space) {
 
   28    vec4 M_clip_space = GLUP.modelviewprojection_matrix * 
vec4(M_world_space,1.0);
 
   29    float z = 0.5*(1.0 + M_clip_space.z/M_clip_space.w);
 
   30    glup_FragDepth = (1.0-z)*gl_DepthRange.near + z*gl_DepthRange.far;
 
vecng< 4, Numeric::float64 > vec4
Represents points and vectors in 4d.