Move IQM freeing into common code.

This commit is contained in:
Bill Currie 2012-05-16 18:09:44 +09:00
parent 041d63c828
commit 23284536b5
3 changed files with 22 additions and 14 deletions

View file

@ -1,6 +1,7 @@
#ifndef __mod_internal_h
#define __mod_internal_h
#include "QF/iqm.h"
#include "QF/model.h"
#include "QF/skin.h"
#include "QF/plugin/vid_render.h"
@ -51,6 +52,7 @@ void glsl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
void sw_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
void Mod_LoadIQM (model_t *mod, void *buffer);
void Mod_FreeIQM (iqm_t *iqm);
void Mod_LoadAliasModel (model_t *mod, void *buffer,
cache_allocator_t allocator);
void Mod_LoadSpriteModel (model_t *mod, void *buffer);

View file

@ -86,20 +86,7 @@ glsl_iqm_clear (model_t *mod)
GLSL_ReleaseTexture (glsl->normmaps[i]);
}
free (glsl);
free (iqm->text);
if (iqm->vertices)
free (iqm->vertices);
free (iqm->vertexarrays);
if (iqm->elements)
free (iqm->elements);
free (iqm->meshes);
free (iqm->joints);
free (iqm->baseframe);
free (iqm->inverse_baseframe);
free (iqm->anims);
free (iqm->frames[0]);
free (iqm->frames);
free (iqm);
Mod_FreeIQM (iqm);
}
static void

View file

@ -523,3 +523,22 @@ Mod_LoadIQM (model_t *mod, void *buffer)
Sys_Error ("%s: error loading anims", loadname);
m_funcs->Mod_IQMFinish (mod);
}
void
Mod_FreeIQM (iqm_t *iqm)
{
free (iqm->text);
if (iqm->vertices)
free (iqm->vertices);
free (iqm->vertexarrays);
if (iqm->elements)
free (iqm->elements);
free (iqm->meshes);
free (iqm->joints);
free (iqm->baseframe);
free (iqm->inverse_baseframe);
free (iqm->anims);
free (iqm->frames[0]);
free (iqm->frames);
free (iqm);
}