From 286eef4523881589b16fc01f3018e1d0bcad85ca Mon Sep 17 00:00:00 2001 From: eihrul Date: Mon, 8 Mar 2010 08:50:03 +0000 Subject: [PATCH] IQM base pose cleanups git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10043 d7cf8633-e32d-0410-b094-e92efae38249 --- model_alias.c | 20 ++++---------------- model_iqm.h | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/model_alias.c b/model_alias.c index d1c336b6..91de0dc7 100644 --- a/model_alias.c +++ b/model_alias.c @@ -3091,7 +3091,6 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) float biggestorigin; const int *inelements; int *outelements; - const float *inversebasepose; float *outvertex, *outnormal, *outtexcoord, *outsvector, *outtvector; pbase = (unsigned char *)buffer; @@ -3122,7 +3121,6 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) header->ofs_neighbors = LittleLong(header->ofs_neighbors); header->num_joints = LittleLong(header->num_joints); header->ofs_joints = LittleLong(header->ofs_joints); - header->ofs_inversebasepose = LittleLong(header->ofs_inversebasepose); header->num_poses = LittleLong(header->num_poses); header->ofs_poses = LittleLong(header->ofs_poses); header->num_anims = LittleLong(header->num_anims); @@ -3258,6 +3256,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) joint = (iqmjoint_t *) (pbase + header->ofs_joints); for (i = 0;i < loadmodel->num_bones;i++) { + matrix4x4_t base, invbase; joint[i].name = LittleLong(joint[i].name); joint[i].parent = LittleLong(joint[i].parent); for (j = 0;j < 3;j++) @@ -3269,13 +3268,9 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) loadmodel->data_bones[i].parent = joint[i].parent; if (loadmodel->data_bones[i].parent >= i) Host_Error("%s bone[%i].parent >= %i", loadmodel->name, i, i); - if (!header->ofs_inversebasepose) - { - matrix4x4_t base, invbase; - Matrix4x4_FromDoom3Joint(&base, joint[i].origin[0], joint[i].origin[1], joint[i].origin[2], joint[i].rotation[0], joint[i].rotation[1], joint[i].rotation[2]); - Matrix4x4_Invert_Simple(&invbase, &base); - Matrix4x4_ToArray12FloatD3D(&invbase, loadmodel->data_baseboneposeinverse + 12*i); - } + Matrix4x4_FromDoom3Joint(&base, joint[i].origin[0], joint[i].origin[1], joint[i].origin[2], joint[i].rotation[0], joint[i].rotation[1], joint[i].rotation[2]); + Matrix4x4_Invert_Simple(&invbase, &base); + Matrix4x4_ToArray12FloatD3D(&invbase, loadmodel->data_baseboneposeinverse + 12*i); } // set up the animscenes based on the anims @@ -3341,13 +3336,6 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) } } - if (header->ofs_inversebasepose) - { - inversebasepose = (const float *) (pbase + header->ofs_inversebasepose); - for (i = 0;i < 12*(int)header->num_poses;i++) - loadmodel->data_baseboneposeinverse[i] = LittleFloat(inversebasepose[i]); - } - // load bounding box data if (header->ofs_bounds) { diff --git a/model_iqm.h b/model_iqm.h index 39249f88..2509e034 100644 --- a/model_iqm.h +++ b/model_iqm.h @@ -11,7 +11,7 @@ typedef struct iqmheader_s unsigned int num_meshes, ofs_meshes; unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays; unsigned int num_triangles, ofs_triangles, ofs_neighbors; - unsigned int num_joints, ofs_joints, ofs_inversebasepose; + unsigned int num_joints, ofs_joints; unsigned int num_poses, ofs_poses; unsigned int num_anims, ofs_anims; unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds; -- 2.39.2