From 0f30dad10a55c5f962ddbc7f3162fef751c3273a Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 29 Oct 2013 23:22:02 -0500 Subject: [PATCH] Merge last two commits into renderergl2 --- code/renderergl2/tr_local.h | 2 +- code/renderergl2/tr_model_iqm.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index b9975d39..06f17ffa 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1104,7 +1104,7 @@ typedef struct { // depending upon the exporter, blend indices and weights might be int/float // as opposed to the recommended byte/byte, for example Noesis exports // int/float whereas the official IQM tool exports byte/byte - byte blendWeightsType; // IQM_BYTE or IQM_FLOAT + byte blendWeightsType; // IQM_UBYTE or IQM_FLOAT int *jointParents; float *jointMats; diff --git a/code/renderergl2/tr_model_iqm.c b/code/renderergl2/tr_model_iqm.c index 64ed3407..44c4a956 100644 --- a/code/renderergl2/tr_model_iqm.c +++ b/code/renderergl2/tr_model_iqm.c @@ -206,6 +206,8 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na return qfalse; } + blendIndexesType = blendWeightsType = IQM_UBYTE; + // check and swap vertex arrays if( IQM_CheckRange( header, header->ofs_vertexarrays, header->num_vertexarrays, @@ -1059,7 +1061,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { for ( numWeights = 0; numWeights < 4; numWeights++ ) { if ( data->blendWeightsType == IQM_FLOAT ) blendWeights[numWeights] = data->blendWeights.f[4*vtx + numWeights]; - else // IQM_BYTE + else blendWeights[numWeights] = (float)data->blendWeights.b[4*vtx + numWeights] / 255.0f; if ( blendWeights[numWeights] <= 0 )