parent
fab5318da7
commit
5f296ba39a
1 changed files with 24 additions and 10 deletions
|
@ -8,9 +8,23 @@ bool first_hit(
|
|||
double & t,
|
||||
Eigen::Vector3d & n)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Replace with your code here:
|
||||
return false;
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
bool hit = false;
|
||||
t = -1;
|
||||
|
||||
double t_temp;
|
||||
Eigen::Vector3d n_temp;
|
||||
|
||||
for (int i = 0; i < objects.size(); ++i) {
|
||||
if (objects[i]->intersect(ray, min_t, t_temp, n_temp)) {
|
||||
hit = true;
|
||||
if (t == -1 || t_temp < t) {
|
||||
hit_id = i;
|
||||
t = t_temp;
|
||||
n = n_temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue