Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. case Reflective:
  2. searchClosestHit(shadowRay, hRec); //Checks point to lightsource for shadowing spheres
  3. if (hRec.anyHit == true && scene->spheres[hRec.primIndex].type != Reflective_and_Refractive) //if transparent we wont shade
  4. {
  5. color = CalculateLight(sphere, P, ray, lightReflection, lightDirection, N, true); //if true we stop phong model at ambient
  6. }
  7. else
  8. {
  9. color = CalculateLight(sphere, P, ray, lightReflection, lightDirection, N, false);
  10. }
  11.  
  12. searchClosestHit(reflectionRay, hRec);
  13. if (hRec.anyHit == true)
  14. {
  15. reflectedColor = RayCasting(reflectionRay, scene->spheres[hRec.primIndex], hRec.tHit, rayJump + 1);
  16.  
  17. if (reflectedColor.x < 0 || reflectedColor.y < 0 || reflectedColor.z < 0)
  18. cout << "NegativeColor!";
  19. }
  20. color *= (1.f - sphere.reflectiveIndex);
  21. color += reflectedColor * sphere.reflectiveIndex;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement