写这个作业写 b u g bug bug 写到吐了,首先强调一点, w i n d o w window window 下跑这份代码的同学,需要修改 g l o b a l . c p p global.cpp global.cpp 中的 g e t _ r a n d o m _ f l o a t get\_random\_float get_random_float 函数,不然你的这个"随机函数"每次都是跑出来相同的结果(而且改了这个函数显著的提升效率, l i n u x linux linux 的同学应该也可以改改)。
修改如下👇
static std::random_device dev;
static std::mt19937 rng(dev());
static std::uniform_real_distribution<float> dist(0.f, 1.f); // distribution in range [1, 6]
inline float get_random_float()
{
return dist(rng);
}
前三个函数参考作业6,差异在于 I n t e r s e c t P IntersectP IntersectP 函数的判别条件,因为这个灯 tmd 没有厚度,你以文本格式查看 l i g h t . o b j light.obj