AngleVectors() improvement

sciogoon at gmail.com sciogoon at gmail.com
Thu Jul 12 09:38:47 EDT 2007


I've optimized the AngleVectors() function (it takes the view angles,
and generates 3 normal(ized) perpendicular vectors: forward, right,
up). Many routines use only the forward vector output, and ignore the
right and up. The sin(roll) and cos(roll) are not needed in this case.
In my modified function, these two values are only calculated if they
are needed. I've also made it look a bit better :P

Comparing to the sin() or cos(), a simple if check is unnoticable. On
my machine, the old function runs 1.45 times longer (without error),
if only the forward output is required. Basically the new one needs
approx 2/3 computing power, because of 4 of 6 sin/cos functions. (If
all 3 outputs are required, the new function has unnoticable speed
loss.) If the new version is used even only once per game frame, the
change is beneficial. Commit.

It's such a small change. Or should I send my name for credits? :D

Can someone tell me about the so called MS compiler fp bugs?



More information about the quake3 mailing list