Faster random implementation

This commit is contained in:
David 2021-08-29 16:17:13 +02:00
commit 742ef283e4
7 changed files with 49 additions and 10 deletions

View file

@ -34,8 +34,8 @@ bool hittable_list<T>::hit(const ray& r, float t_min, float t_max, hit_record& r
bool hit_anything = false;
float closest_so_far = t_max;
for (uint32_t i = 0; i < objects.size(); ++i)
uint32_t s = objects.size();
for (uint32_t i = 0; i < s; ++i)
{
T *object = &objects[i];
if (object->hit(r, t_min, closest_so_far, temp_rec))