 
 
 
-
-
-
-

{
    vec3 wiW = normalize(endW - startW);
    float ewi = dot(EmitterDir, wiW);
    //shit
    float spreadAngle = max(0.5*abs(EmitterSpread)*M_PI/180.0, 5.0e-4);         // @todo: calc on CPU
    float cosSpreadAngle = cos(spreadAngle);                                    // @todo: calc on CPU
    if (ewi > -cosSpreadAngle) return false;                                  

///////////////////////////////////////////////////////////////////////////////////


// find first hit over specified segment
bool traceDistance(in vec3 start, in vec3 dir, float maxDist,
                   inout vec3 hit, inout int material)
