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

32
source/intersection.cpp Normal file
View File

@@ -0,0 +1,32 @@
/*
* DoRayMe - a quick and dirty Raytracer
* Intersection implementation
*
* Created by Manoël Trapier
* Copyright (c) 2020 986-Studio.
*
*/
#include <intersection.h>
#include <shape.h>
Computation Intersection::prepareComputation(Ray r)
{
Tuple hitP = r.position(this->t);
Tuple normalV = this->object->normalAt(hitP);
Tuple eyeV = -r.direction;
bool inside;
if (normalV.dot(eyeV) < 0)
{
inside = true;
normalV = -normalV;
}
return Computation(this->object,
this->t,
hitP,
eyeV,
normalV,
inside);
}