Simplify scaling in R_AddEfrags and R_CullModelForEntity

This commit is contained in:
Andrei Drexler 2022-08-08 15:18:16 +03:00 committed by Ozkan Sezer
parent 5aa79332f0
commit b7122a882d
2 changed files with 12 additions and 22 deletions

View file

@ -182,14 +182,8 @@ void R_AddEfrags (entity_t *ent)
scalefactor = ENTSCALE_DECODE(ent->scale);
if (scalefactor != 1.0f)
{
vec3_t boundVec, scaledVec;
VectorCopy (entmodel->mins, boundVec);
VectorScale (boundVec, scalefactor, scaledVec);
VectorAdd (ent->origin, scaledVec, r_emins);
VectorCopy (entmodel->maxs, boundVec);
VectorScale (boundVec, scalefactor, scaledVec);
VectorAdd (ent->origin, scaledVec, r_emaxs);
VectorMA (ent->origin, scalefactor, entmodel->mins, r_emins);
VectorMA (ent->origin, scalefactor, entmodel->maxs, r_emaxs);
}
else
{

View file

@ -293,34 +293,30 @@ R_CullModelForEntity -- johnfitz -- uses correct bounds based on rotation
*/
qboolean R_CullModelForEntity (entity_t *e)
{
vec3_t mins, maxs, minbounds, maxbounds;
vec_t scalefactor;
vec3_t mins, maxs;
vec_t scalefactor, *minbounds, *maxbounds;
if (e->angles[0] || e->angles[2]) //pitch or roll
{
VectorCopy (e->model->rmins, minbounds);
VectorCopy (e->model->rmaxs, maxbounds);
minbounds = e->model->rmins;
maxbounds = e->model->rmaxs;
}
else if (e->angles[1]) //yaw
{
VectorCopy (e->model->ymins, minbounds);
VectorCopy (e->model->ymaxs, maxbounds);
minbounds = e->model->ymins;
maxbounds = e->model->ymaxs;
}
else //no rotation
{
VectorCopy (e->model->mins, minbounds);
VectorCopy (e->model->maxs, maxbounds);
minbounds = e->model->mins;
maxbounds = e->model->maxs;
}
scalefactor = ENTSCALE_DECODE(e->scale);
if (scalefactor != 1.0f)
{
vec3_t scaledVec;
VectorScale (minbounds, scalefactor, scaledVec);
VectorAdd (e->origin, scaledVec, mins);
VectorScale (maxbounds, scalefactor, scaledVec);
VectorAdd (e->origin, scaledVec, maxs);
VectorMA (e->origin, scalefactor, minbounds, mins);
VectorMA (e->origin, scalefactor, maxbounds, maxs);
}
else
{