     }
     return;
   }
+  bool justClippedBox = true;
 
   if (fmodf(tbnear, dist) != 0.0f)
   {


  float tbnear = 0.0f;
  float tbfar = 0.0f;
  const bool hit = intersectBox(ray, probePos - probeSizeHalf, probePos + probeSizeHalf, &tbnear, &tbfar);
  if (!hit)
  {
    d_output[y * texwidth + x] = make_uchar4(0);

        src = blinnPhong<t_bpc>(src, pos, texCoord, Lpos, V, Ka, Kd, Ks, shininess, constAtt, linearAtt, quadAtt, &sphereNormal);
        justClippedSphere = false;
      }
      else if(justClippedBox)
      {
        src = blinnPhong<t_bpc>(src, pos, texCoord, Lpos, V, Ka, Kd, Ks, shininess, constAtt, linearAtt, quadAtt, &boxNormal);
      }
      else
      {
        src = blinnPhong<t_bpc>(src, pos, texCoord, Lpos, V, Ka, Kd, Ks, shininess, constAtt, linearAtt, quadAtt);
      }
      justClippedBox = false; // just clipped bounding box passed after any case
    }
    justClippedPlane = false;
    justClippedSphere = false;
