From 4d75061dbc604880a4b3ca41a6b1e7d86bf32c38 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 23 Dec 2011 16:11:21 +0000 Subject: [PATCH] iqm fixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3936 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/com_mesh.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 120632d6d..98ab08769 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -1519,7 +1519,15 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int surfnum, ent #ifdef SKELETALMODELS meshcache.usebonepose = NULL; - if (inf->numbones) + if (inf->ofs_skel_xyz && !inf->ofs_skel_weight) + { + meshcache.usebonepose = false; + mesh->xyz_array = (vecV_t*)((char*)inf + inf->ofs_skel_xyz); + mesh->normals_array = (vec3_t*)((char*)inf + inf->ofs_skel_norm); + mesh->snormals_array = (vec3_t*)((char*)inf + inf->ofs_skel_svect); + mesh->tnormals_array = (vec3_t*)((char*)inf + inf->ofs_skel_tvect); + } + else if (inf->numbones) { meshcache.usebonepose = Alias_GetBonePositions(inf, &e->framestate, meshcache.bonepose, MAX_BONES, true); @@ -5948,6 +5956,7 @@ qboolean Mod_ParseIQMAnim(char *buffer, galiasinfo_t *prototype, void**poseofs, qboolean Mod_LoadInterQuakeModel(model_t *mod, void *buffer) { + int i; unsigned int hunkstart, hunkend, hunktotal; galiasinfo_t *root; struct iqmheader *h = (struct iqmheader *)buffer; @@ -5963,6 +5972,10 @@ qboolean Mod_LoadInterQuakeModel(model_t *mod, void *buffer) mod->flags = h->flags; + ClearBounds(mod->mins, mod->maxs); + for (i = 0; i < root->numverts; i++) + AddPointToBounds((float*)((char*)root + root->ofs_skel_xyz + i*sizeof(vecV_t)), mod->mins, mod->maxs); + Mod_ClampModelSize(mod); Hunk_Alloc(0);