bool bvhIsBlocked(RayRecord &originalIntersect, BVH bvh, Light * light, glm::vec2 offset) { glm::vec3 lightP0 = originalIntersect.getP0() + originalIntersect.getP1() * originalIntersect.getT() ; glm::vec3 lightP1 ; //glm::vec3 lightDir ; GLfloat boundT = INF ; if (!light->isPointLight()) { //if directional light lightP1 = light->_position ; } else { //if point light lightP1 = light->_position - lightP0 ; boundT = 1.0f ; } //Material mt ; //RayRecord shadowRay(INF, mt, lightP0 + 0.0005f * lightP1, lightP1) ; RayRecord * shadowRay = light->getRayToLight(lightP0, offset) ; //return bvh.intersectionTest(*shadowRay, boundT) ; bool retval = bvh.intersectionTest(*shadowRay, boundT) ; delete shadowRay ; return retval ; }