From f0fbc813e29630fa3dd419817d2bbaa64ac4f97f Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 5 Sep 2021 00:35:00 +0000 Subject: [PATCH] Polo demanded more accurate bounds for mdl files, to match QSS. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6057 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/com_mesh.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 4f2f15230..b039140af 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -4285,8 +4285,26 @@ static qboolean QDECL Mod_LoadQ1Model (model_t *mod, void *buffer, size_t fsize) Mod_CompileTriangleNeighbours(mod, galias); Mod_BuildTextureVectors(galias); +#if 0 //fast (somewhat inaccurate) way. some exporters will bias all geometry weirdly (often ensuring 0 0 0 is in the bounds, resulting in unfortunate biases.) VectorCopy (pq1inmodel->scale_origin, mod->mins); VectorMA (mod->mins, 255, pq1inmodel->scale, mod->maxs); +#else + ClearBounds(mod->mins, mod->maxs); + for (i = 0; i < galias->numanimations; i++) + { + galiasanimation_t *a = galias->ofsanimations; + vecV_t *v; + size_t j, k; + for (j = 0; j < a->numposes; j++) + { + v = a->poseofs[j].ofsverts; + for (k = 0; k < galias->numverts; k++) + AddPointToBounds(v[k], mod->mins, mod->maxs); + } + } + if (mod->maxs[0] < mod->mins[0]) //no points? o.O + AddPointToBounds(vec3_origin, mod->mins, mod->maxs); +#endif mod->type = mod_alias; Mod_ClampModelSize(mod);