Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case Reflective:
- searchClosestHit(shadowRay, hRec); //Checks point to lightsource for shadowing spheres
- if (hRec.anyHit == true && scene->spheres[hRec.primIndex].type != Reflective_and_Refractive) //if transparent we wont shade
- {
- color = CalculateLight(sphere, P, ray, lightReflection, lightDirection, N, true); //if true we stop phong model at ambient
- }
- else
- {
- color = CalculateLight(sphere, P, ray, lightReflection, lightDirection, N, false);
- }
- searchClosestHit(reflectionRay, hRec);
- if (hRec.anyHit == true)
- {
- reflectedColor = RayCasting(reflectionRay, scene->spheres[hRec.primIndex], hRec.tHit, rayJump + 1);
- if (reflectedColor.x < 0 || reflectedColor.y < 0 || reflectedColor.z < 0)
- cout << "NegativeColor!";
- }
- color *= (1.f - sphere.reflectiveIndex);
- color += reflectedColor * sphere.reflectiveIndex;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement