edna dornblazer wrote:
> lighting.c and render.c are both from June 10.
> My trace says its crashing from Reflect()
[ ... ]
I think I found it.
In lighting.c, in Reflect():
z = (FRAND() * 2) - 1;
t = FRAND() * M_PI * 2;
r = sqrt(1 - z*z);
Well, FRAND*2 (at least with MSDOS/DJGPP) on occasion returns
numbers slightly bigger than 1.0, and the subsequent
r=sqrt(negative number) yields NaN vectors a little later.
Replacing the r=sqrt() line with
r = sqrt(fabs(1 - z*z));
at least lets that stupid triangle render.
Post a reply to this message
|