From 2a2646fe43887bf19494769f562904c4d2ed551a Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 28 May 2019 21:00:02 -0500 Subject: [PATCH] Fix IQM quat normalize fail case Should only happen with invalid models though. --- code/renderergl1/tr_model_iqm.c | 3 ++- code/renderergl2/tr_model_iqm.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/renderergl1/tr_model_iqm.c b/code/renderergl1/tr_model_iqm.c index 59444a93..fe205ff4 100644 --- a/code/renderergl1/tr_model_iqm.c +++ b/code/renderergl1/tr_model_iqm.c @@ -154,7 +154,8 @@ static vec_t QuatNormalize2( const quat_t v, quat_t out) { out[2] = v[2]*ilength; out[3] = v[3]*ilength; } else { - out[0] = out[1] = out[2] = out[3] = 0; + out[0] = out[1] = out[2] = 0; + out[3] = -1; } return length; diff --git a/code/renderergl2/tr_model_iqm.c b/code/renderergl2/tr_model_iqm.c index eff80312..fc345a32 100644 --- a/code/renderergl2/tr_model_iqm.c +++ b/code/renderergl2/tr_model_iqm.c @@ -154,7 +154,8 @@ static vec_t QuatNormalize2( const quat_t v, quat_t out) { out[2] = v[2]*ilength; out[3] = v[3]*ilength; } else { - out[0] = out[1] = out[2] = out[3] = 0; + out[0] = out[1] = out[2] = 0; + out[3] = -1; } return length;