diff --git a/code/renderergl1/tr_model_iqm.c b/code/renderergl1/tr_model_iqm.c index 3e699619..02616469 100644 --- a/code/renderergl1/tr_model_iqm.c +++ b/code/renderergl1/tr_model_iqm.c @@ -566,6 +566,8 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na } if( header->ofs_bounds ) { size += header->num_frames * 6 * sizeof(float); // model bounds + } else if( header->num_meshes && header->num_frames == 0 ) { + size += 6 * sizeof(float); // model bounds } mod->type = MOD_IQM; @@ -641,6 +643,9 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na if( header->ofs_bounds ) { iqmData->bounds = (float*)dataPtr; dataPtr += header->num_frames * 6 * sizeof(float); // model bounds + } else if( header->num_meshes && header->num_frames == 0 ) { + iqmData->bounds = (float*)dataPtr; + dataPtr += 6 * sizeof(float); // model bounds } if( header->num_meshes ) @@ -907,6 +912,15 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na bounds++; } } + else if( header->num_meshes && header->num_frames == 0 ) + { + mat = iqmData->bounds; + + ClearBounds( &iqmData->bounds[0], &iqmData->bounds[3] ); + for ( i = 0 ; i < header->num_vertexes ; i++ ) { + AddPointToBounds( &iqmData->positions[i*3], &iqmData->bounds[0], &iqmData->bounds[3] ); + } + } return qtrue; } diff --git a/code/renderergl2/tr_model_iqm.c b/code/renderergl2/tr_model_iqm.c index 63a5d92a..1a6e1e5a 100644 --- a/code/renderergl2/tr_model_iqm.c +++ b/code/renderergl2/tr_model_iqm.c @@ -569,6 +569,8 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na } if( header->ofs_bounds ) { size += header->num_frames * 6 * sizeof(float); // model bounds + } else if( header->num_meshes && header->num_frames == 0 ) { + size += 6 * sizeof(float); // model bounds } mod->type = MOD_IQM; @@ -644,6 +646,9 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na if( header->ofs_bounds ) { iqmData->bounds = (float*)dataPtr; dataPtr += header->num_frames * 6 * sizeof(float); // model bounds + } else if( header->num_meshes && header->num_frames == 0 ) { + iqmData->bounds = (float*)dataPtr; + dataPtr += 6 * sizeof(float); // model bounds } if( header->num_meshes ) @@ -910,6 +915,15 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na bounds++; } } + else if( header->num_meshes && header->num_frames == 0 ) + { + mat = iqmData->bounds; + + ClearBounds( &iqmData->bounds[0], &iqmData->bounds[3] ); + for ( i = 0 ; i < header->num_vertexes ; i++ ) { + AddPointToBounds( &iqmData->positions[i*3], &iqmData->bounds[0], &iqmData->bounds[3] ); + } + } // Create VAO surfaces if ( iqmData->num_surfaces && iqmData->num_joints <= glRefConfig.glslMaxAnimatedBones )