mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
modelalpha and currenentity cleanups.
This commit is contained in:
parent
c5f4af0109
commit
de0b4f65fa
4 changed files with 26 additions and 31 deletions
|
@ -391,21 +391,22 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
vec3_t dist, mins, maxs;
|
vec3_t dist, mins, maxs;
|
||||||
vert_order_t *vo;
|
vert_order_t *vo;
|
||||||
|
|
||||||
clmodel = currententity->model;
|
clmodel = e->model;
|
||||||
|
|
||||||
VectorAdd (currententity->origin, clmodel->mins, mins);
|
VectorAdd (e->origin, clmodel->mins, mins);
|
||||||
VectorAdd (currententity->origin, clmodel->maxs, maxs);
|
VectorAdd (e->origin, clmodel->maxs, maxs);
|
||||||
|
|
||||||
if (cull && R_CullBox (mins, maxs))
|
if (cull && R_CullBox (mins, maxs))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: shadecolor is supposed to be the lighting for the model, not
|
// FIXME: shadecolor is supposed to be the lighting for the model, not
|
||||||
// just colormod
|
// just colormod
|
||||||
shadecolor[0] = currententity->colormod[0] * 2.0;
|
shadecolor[0] = e->colormod[0] * 2.0;
|
||||||
shadecolor[1] = currententity->colormod[1] * 2.0;
|
shadecolor[1] = e->colormod[1] * 2.0;
|
||||||
shadecolor[2] = currententity->colormod[2] * 2.0;
|
shadecolor[2] = e->colormod[2] * 2.0;
|
||||||
|
modelalpha = e->alpha;
|
||||||
|
|
||||||
VectorCopy (currententity->origin, r_entorigin);
|
VectorCopy (e->origin, r_entorigin);
|
||||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||||
|
|
||||||
if (strnequal (clmodel->name, "progs/flame", 11)
|
if (strnequal (clmodel->name, "progs/flame", 11)
|
||||||
|
@ -414,7 +415,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
shadelight = 1.0; // make certain models full brightness always
|
shadelight = 1.0; // make certain models full brightness always
|
||||||
} else {
|
} else {
|
||||||
// get lighting information
|
// get lighting information
|
||||||
shadelight = R_LightPoint (currententity->origin);
|
shadelight = R_LightPoint (e->origin);
|
||||||
|
|
||||||
// always give the gun some light
|
// always give the gun some light
|
||||||
if (e == r_view_model)
|
if (e == r_view_model)
|
||||||
|
@ -422,8 +423,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
|
|
||||||
for (lnum = 0; lnum < r_maxdlights; lnum++) {
|
for (lnum = 0; lnum < r_maxdlights; lnum++) {
|
||||||
if (r_dlights[lnum].die >= r_realtime) {
|
if (r_dlights[lnum].die >= r_realtime) {
|
||||||
VectorSubtract (currententity->origin, r_dlights[lnum].origin,
|
VectorSubtract (e->origin, r_dlights[lnum].origin, dist);
|
||||||
dist);
|
|
||||||
add = (r_dlights[lnum].radius * r_dlights[lnum].radius * 8) /
|
add = (r_dlights[lnum].radius * r_dlights[lnum].radius * 8) /
|
||||||
(DotProduct (dist, dist)); // FIXME Deek
|
(DotProduct (dist, dist)); // FIXME Deek
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
}
|
}
|
||||||
|
|
||||||
// locate the proper data
|
// locate the proper data
|
||||||
paliashdr = Cache_Get (¤tentity->model->cache);
|
paliashdr = Cache_Get (&e->model->cache);
|
||||||
c_alias_polys += paliashdr->mdl.numtris;
|
c_alias_polys += paliashdr->mdl.numtris;
|
||||||
|
|
||||||
// draw all the triangles
|
// draw all the triangles
|
||||||
|
@ -461,22 +461,22 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
|
|
||||||
if (strequal (clmodel->name, "progs/eyes.mdl")) {
|
if (strequal (clmodel->name, "progs/eyes.mdl")) {
|
||||||
qfglTranslatef (paliashdr->mdl.scale_origin[0],
|
qfglTranslatef (paliashdr->mdl.scale_origin[0],
|
||||||
paliashdr->mdl.scale_origin[1],
|
paliashdr->mdl.scale_origin[1],
|
||||||
paliashdr->mdl.scale_origin[2] - (22 + 8));
|
paliashdr->mdl.scale_origin[2] - (22 + 8));
|
||||||
// double size of eyes, since they are really hard to see in GL
|
// double size of eyes, since they are really hard to see in GL
|
||||||
qfglScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2,
|
qfglScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2,
|
||||||
paliashdr->mdl.scale[2] * 2);
|
paliashdr->mdl.scale[2] * 2);
|
||||||
} else {
|
} else {
|
||||||
qfglTranslatef (paliashdr->mdl.scale_origin[0],
|
qfglTranslatef (paliashdr->mdl.scale_origin[0],
|
||||||
paliashdr->mdl.scale_origin[1],
|
paliashdr->mdl.scale_origin[1],
|
||||||
paliashdr->mdl.scale_origin[2]);
|
paliashdr->mdl.scale_origin[2]);
|
||||||
qfglScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1],
|
qfglScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1],
|
||||||
paliashdr->mdl.scale[2]);
|
paliashdr->mdl.scale[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
anim = (int) (r_realtime * 10) & 3;
|
anim = (int) (r_realtime * 10) & 3;
|
||||||
|
|
||||||
skinnum = currententity->skinnum;
|
skinnum = e->skinnum;
|
||||||
if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) {
|
if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) {
|
||||||
Con_DPrintf ("R_AliasSetupSkin: no such skin # %d\n", skinnum);
|
Con_DPrintf ("R_AliasSetupSkin: no such skin # %d\n", skinnum);
|
||||||
skinnum = 0;
|
skinnum = 0;
|
||||||
|
@ -488,8 +488,8 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
|
|
||||||
// we can't dynamically colormap textures, so they are cached
|
// we can't dynamically colormap textures, so they are cached
|
||||||
// seperately for the players. Heads are just uncolored.
|
// seperately for the players. Heads are just uncolored.
|
||||||
if (currententity->skin && !gl_nocolors->int_val) {
|
if (e->skin && !gl_nocolors->int_val) {
|
||||||
skin_t *skin = currententity->skin;
|
skin_t *skin = e->skin;
|
||||||
|
|
||||||
texture = skin->texture;
|
texture = skin->texture;
|
||||||
if (gl_fb_models->int_val) {
|
if (gl_fb_models->int_val) {
|
||||||
|
@ -502,8 +502,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
if (gl_affinemodels->int_val)
|
if (gl_affinemodels->int_val)
|
||||||
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
|
|
||||||
vo = GL_GetAliasFrameVerts (currententity->frame, paliashdr,
|
vo = GL_GetAliasFrameVerts (e->frame, paliashdr, e);
|
||||||
currententity);
|
|
||||||
|
|
||||||
GL_DrawAliasFrame (vo, false);
|
GL_DrawAliasFrame (vo, false);
|
||||||
|
|
||||||
|
@ -534,7 +533,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
|
|
||||||
if (gl_lerp_anim->int_val) {
|
if (gl_lerp_anim->int_val) {
|
||||||
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum,
|
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum,
|
||||||
currententity);
|
e);
|
||||||
} else {
|
} else {
|
||||||
GL_DrawAliasShadow (paliashdr, lastposenum);
|
GL_DrawAliasShadow (paliashdr, lastposenum);
|
||||||
}
|
}
|
||||||
|
@ -543,5 +542,5 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
qfglPopMatrix ();
|
qfglPopMatrix ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache_Release (¤tentity->model->cache);
|
Cache_Release (&e->model->cache);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ R_GetSpriteFrame (entity_t *currententity)
|
||||||
return pspriteframe;
|
return pspriteframe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: add modelalpha support?
|
||||||
void
|
void
|
||||||
R_DrawSpriteModel (entity_t *e)
|
R_DrawSpriteModel (entity_t *e)
|
||||||
{
|
{
|
||||||
|
@ -118,10 +119,10 @@ R_DrawSpriteModel (entity_t *e)
|
||||||
// don't even bother culling, because it's just a single
|
// don't even bother culling, because it's just a single
|
||||||
// polygon without a surface cache
|
// polygon without a surface cache
|
||||||
frame = R_GetSpriteFrame (e);
|
frame = R_GetSpriteFrame (e);
|
||||||
psprite = currententity->model->cache.data;
|
psprite = e->model->cache.data;
|
||||||
|
|
||||||
if (psprite->type == SPR_ORIENTED) { // bullet marks on walls
|
if (psprite->type == SPR_ORIENTED) { // bullet marks on walls
|
||||||
AngleVectors (currententity->angles, v_forward, v_right, v_up);
|
AngleVectors (e->angles, v_forward, v_right, v_up);
|
||||||
up = v_up;
|
up = v_up;
|
||||||
right = v_right;
|
right = v_right;
|
||||||
} else { // normal sprite
|
} else { // normal sprite
|
||||||
|
|
|
@ -178,7 +178,6 @@ R_DrawEntitiesOnList (void)
|
||||||
if (r_visedicts[i]->model->type != mod_brush)
|
if (r_visedicts[i]->model->type != mod_brush)
|
||||||
continue;
|
continue;
|
||||||
currententity = r_visedicts[i];
|
currententity = r_visedicts[i];
|
||||||
modelalpha = currententity->alpha;
|
|
||||||
|
|
||||||
R_DrawBrushModel (currententity);
|
R_DrawBrushModel (currententity);
|
||||||
}
|
}
|
||||||
|
@ -187,7 +186,6 @@ R_DrawEntitiesOnList (void)
|
||||||
if (r_visedicts[i]->model->type != mod_alias)
|
if (r_visedicts[i]->model->type != mod_alias)
|
||||||
continue;
|
continue;
|
||||||
currententity = r_visedicts[i];
|
currententity = r_visedicts[i];
|
||||||
modelalpha = currententity->alpha;
|
|
||||||
|
|
||||||
if (currententity == r_player_entity)
|
if (currententity == r_player_entity)
|
||||||
currententity->angles[PITCH] *= 0.3;
|
currententity->angles[PITCH] *= 0.3;
|
||||||
|
@ -201,7 +199,6 @@ R_DrawEntitiesOnList (void)
|
||||||
if (r_visedicts[i]->model->type != mod_sprite)
|
if (r_visedicts[i]->model->type != mod_sprite)
|
||||||
continue;
|
continue;
|
||||||
currententity = r_visedicts[i];
|
currententity = r_visedicts[i];
|
||||||
modelalpha = currententity->alpha;
|
|
||||||
|
|
||||||
R_DrawSpriteModel (currententity);
|
R_DrawSpriteModel (currententity);
|
||||||
}
|
}
|
||||||
|
@ -219,9 +216,6 @@ R_DrawViewModel (void)
|
||||||
|| !currententity->model)
|
|| !currententity->model)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// this is a HACK! --KB
|
|
||||||
modelalpha = currententity->alpha;
|
|
||||||
|
|
||||||
// hack the depth range to prevent view model from poking into walls
|
// hack the depth range to prevent view model from poking into walls
|
||||||
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
||||||
R_DrawAliasModel (currententity, false);
|
R_DrawAliasModel (currententity, false);
|
||||||
|
|
|
@ -621,6 +621,7 @@ DrawTextureChains (void)
|
||||||
qfglEnable (GL_BLEND);
|
qfglEnable (GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: add modelalpha support?
|
||||||
void
|
void
|
||||||
R_DrawBrushModel (entity_t *e)
|
R_DrawBrushModel (entity_t *e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue