mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-03-10 20:11:42 +00:00
Simplify scaling in R_AddEfrags and R_CullModelForEntity
This commit is contained in:
parent
5aa79332f0
commit
b7122a882d
2 changed files with 12 additions and 22 deletions
|
@ -182,14 +182,8 @@ void R_AddEfrags (entity_t *ent)
|
||||||
scalefactor = ENTSCALE_DECODE(ent->scale);
|
scalefactor = ENTSCALE_DECODE(ent->scale);
|
||||||
if (scalefactor != 1.0f)
|
if (scalefactor != 1.0f)
|
||||||
{
|
{
|
||||||
vec3_t boundVec, scaledVec;
|
VectorMA (ent->origin, scalefactor, entmodel->mins, r_emins);
|
||||||
VectorCopy (entmodel->mins, boundVec);
|
VectorMA (ent->origin, scalefactor, entmodel->maxs, r_emaxs);
|
||||||
VectorScale (boundVec, scalefactor, scaledVec);
|
|
||||||
VectorAdd (ent->origin, scaledVec, r_emins);
|
|
||||||
|
|
||||||
VectorCopy (entmodel->maxs, boundVec);
|
|
||||||
VectorScale (boundVec, scalefactor, scaledVec);
|
|
||||||
VectorAdd (ent->origin, scaledVec, r_emaxs);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -293,34 +293,30 @@ R_CullModelForEntity -- johnfitz -- uses correct bounds based on rotation
|
||||||
*/
|
*/
|
||||||
qboolean R_CullModelForEntity (entity_t *e)
|
qboolean R_CullModelForEntity (entity_t *e)
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs, minbounds, maxbounds;
|
vec3_t mins, maxs;
|
||||||
vec_t scalefactor;
|
vec_t scalefactor, *minbounds, *maxbounds;
|
||||||
|
|
||||||
if (e->angles[0] || e->angles[2]) //pitch or roll
|
if (e->angles[0] || e->angles[2]) //pitch or roll
|
||||||
{
|
{
|
||||||
VectorCopy (e->model->rmins, minbounds);
|
minbounds = e->model->rmins;
|
||||||
VectorCopy (e->model->rmaxs, maxbounds);
|
maxbounds = e->model->rmaxs;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (e->angles[1]) //yaw
|
else if (e->angles[1]) //yaw
|
||||||
{
|
{
|
||||||
VectorCopy (e->model->ymins, minbounds);
|
minbounds = e->model->ymins;
|
||||||
VectorCopy (e->model->ymaxs, maxbounds);
|
maxbounds = e->model->ymaxs;
|
||||||
}
|
}
|
||||||
else //no rotation
|
else //no rotation
|
||||||
{
|
{
|
||||||
VectorCopy (e->model->mins, minbounds);
|
minbounds = e->model->mins;
|
||||||
VectorCopy (e->model->maxs, maxbounds);
|
maxbounds = e->model->maxs;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalefactor = ENTSCALE_DECODE(e->scale);
|
scalefactor = ENTSCALE_DECODE(e->scale);
|
||||||
if (scalefactor != 1.0f)
|
if (scalefactor != 1.0f)
|
||||||
{
|
{
|
||||||
vec3_t scaledVec;
|
VectorMA (e->origin, scalefactor, minbounds, mins);
|
||||||
VectorScale (minbounds, scalefactor, scaledVec);
|
VectorMA (e->origin, scalefactor, maxbounds, maxs);
|
||||||
VectorAdd (e->origin, scaledVec, mins);
|
|
||||||
VectorScale (maxbounds, scalefactor, scaledVec);
|
|
||||||
VectorAdd (e->origin, scaledVec, maxs);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue