[game] prevent NaNs when there's a zero area triangle in edgegrab (#1404)

This commit is contained in:
water111
2022-06-01 19:48:48 -04:00
committed by GitHub
parent ec9c7a55ce
commit 63174b401d
@@ -104,6 +104,12 @@ u64 execute(void* ctxt) {
c->vmadd_bc(DEST::w, BC::z, vf9, vf0, vf9); // vmaddz.w vf9, vf0, vf9
// nop // sll r0, r0, 0
c->vrsqrt(vf0, BC::w, vf9, BC::w); // vrsqrt Q, vf0.w, vf9.w
if (c->vfs[vf9].f[3] == 0.f) {
// hack to prevent NaNs from getting in the collide data if we have a zero-area triangle
// this value doesn't matter - the normal is zeros anyway and the triangle will be rejected
// by every other step.
c->Q = 0.f;
}
// nop // sll r0, r0, 0
c->dsll32(t5, t5, 12); // dsll32 t5, t5, 12
c->dsrl32(t5, t5, 26); // dsrl32 t5, t5, 26