World is on the verge of working!

This commit is contained in:
Godzil
2020-02-20 01:41:53 +00:00
parent be6b472472
commit 999419dfe1
6 changed files with 170 additions and 0 deletions

View File

@@ -90,4 +90,23 @@ Intersect World::intersect(Ray r)
}
return ret;
}
Tuple World::shadeHit(Computation comps)
{
return comps.object->material.lighting(*this->lightList[0], comps.hitPoint, comps.eyeVector, comps.normalVector);
}
Tuple World::colourAt(Ray r)
{
Intersection hit = this->intersect(r).hit();
if (hit.nothing())
{
return Colour(0, 0, 0);
}
else
{
return this->shadeHit(hit.prepareComputation(r));
}
}