SHARE
TWEET

Untitled

a guest May 22nd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top