Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iondune/ebb132bec885422314a0252c776e597b to your computer and use it in GitHub Desktop.
Save iondune/ebb132bec885422314a0252c776e597b to your computer and use it in GitHub Desktop.
Unit tests for schlick's approximation
TEST_CASE("shlick's approximation")
{
CHECK(CRayTracerMath::SchlicksApproximation(1.02f, vec3f(0, 1, 0), vec3f(0, 1, 0)) == Approx(0.0001f));
CHECK(CRayTracerMath::SchlicksApproximation(1.02f, vec3f(0, 1, 0), vec3f(0.707107f, 0.707107f, 0)) == Approx(0.00225f));
CHECK(CRayTracerMath::SchlicksApproximation(1.02f, vec3f(0, 1, 0), vec3f(0.866025f, 0.5f, 0)) == Approx(0.03134f));
CHECK(CRayTracerMath::SchlicksApproximation(1.02f, vec3f(0, 1, 0), vec3f(0.965926f, 0.258819f, 0)) == Approx(0.22375f));
CHECK(CRayTracerMath::SchlicksApproximation(1.02f, vec3f(0, 1, 0), vec3f(0.996195f, 0.087156f, 0)) == Approx(0.63388f));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment