Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Scaled Models Dissappearing Due to Bounds not in View #108

Open
wants to merge 1 commit into
base: qsrebase
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions Quake/gl_rmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,41 @@ R_CullModelForEntity -- johnfitz -- uses correct bounds based on rotation
qboolean R_CullModelForEntity (entity_t *e)
{
vec3_t mins, maxs;
vec3_t minbounds, maxbounds;

if (e->angles[0] || e->angles[2]) //pitch or roll
{
VectorAdd (e->origin, e->model->rmins, mins);
VectorAdd (e->origin, e->model->rmaxs, maxs);
VectorCopy (e->model->rmins, minbounds);
VectorCopy (e->model->rmaxs, maxbounds);

}
else if (e->angles[1]) //yaw
{
VectorAdd (e->origin, e->model->ymins, mins);
VectorAdd (e->origin, e->model->ymaxs, maxs);
VectorCopy (e->model->ymins, minbounds);
VectorCopy (e->model->ymaxs, maxbounds);
}
else //no rotation
{
VectorAdd (e->origin, e->model->mins, mins);
VectorAdd (e->origin, e->model->maxs, maxs);
VectorCopy (e->model->mins, minbounds);
VectorCopy (e->model->maxs, maxbounds);
}

vec_t scalefactor = e->netstate.scale/16.0f;
if (scalefactor < 0.001f)
scalefactor = 1.0f;

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);
}
else
{
VectorAdd (e->origin, minbounds, mins);
VectorAdd (e->origin, maxbounds, maxs);
}

return R_CullBox (mins, maxs);
Expand Down
6 changes: 3 additions & 3 deletions Quake/snd_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ sfxcache_t *S_LoadSound (sfx_t *s)
info = GetWavinfo (s->name, data, com_filesize);
if (info.channels != 1 && info.channels != 2)
{
Con_Printf ("%s is a stereo sample\n",s->name);
Con_Printf ("%s is a stereo sample, not loaded!\n",s->name);
return NULL;
}

if (info.width != 1 && info.width != 2)
{
Con_Printf("%s is not 8 or 16 bit\n", s->name);
Con_Printf("%s is not 8 or 16 bit, not loaded!\n", s->name);
return NULL;
}

Expand All @@ -203,7 +203,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)

if (info.samples == 0 || len == 0)
{
Con_Printf("%s has zero samples\n", s->name);
Con_Printf("%s has zero samples, not loaded!\n", s->name);
return NULL;
}

Expand Down