clean up code

This commit is contained in:
Denis Pauk 2018-07-24 16:54:43 +03:00
parent 6136900fac
commit a37d6cb07a

View file

@ -221,28 +221,30 @@ R_AliasPreparePoints
General clipped case
================
*/
finalvert_t *finalverts, *finalverts_max;
static void
R_AliasPreparePoints (void)
R_AliasPreparePoints (finalvert_t *verts, finalvert_t *verts_max)
{
int i;
dstvert_t *pstverts;
dtriangle_t *ptri;
finalvert_t *pfv[3];
finalvert_t *pfinalverts;
// put work vertexes on stack, cache aligned
pfinalverts = finalverts;
if ((finalverts + s_pmdl->num_xyz) >= finalverts_max)
// not fully initialized buffers?
if (!verts)
{
r_outofverts += s_pmdl->num_xyz - (finalverts_max - finalverts);
R_Printf(PRINT_ALL, "%s: verts are empty.\n", __func__);
return;
}
if ((verts + s_pmdl->num_xyz) >= verts_max)
{
r_outofverts += s_pmdl->num_xyz - (verts_max - verts);
return;
}
R_AliasTransformFinalVerts( s_pmdl->num_xyz,
pfinalverts, // destination for transformed verts
verts, // destination for transformed verts
r_lastframe->verts, // verts from the last frame
r_thisframe->verts // verts from this frame
);
@ -256,9 +258,9 @@ R_AliasPreparePoints (void)
{
for (i=0 ; i<s_pmdl->num_tris ; i++, ptri++)
{
pfv[0] = &pfinalverts[ptri->index_xyz[0]];
pfv[1] = &pfinalverts[ptri->index_xyz[1]];
pfv[2] = &pfinalverts[ptri->index_xyz[2]];
pfv[0] = &verts[ptri->index_xyz[0]];
pfv[1] = &verts[ptri->index_xyz[1]];
pfv[2] = &verts[ptri->index_xyz[2]];
if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
continue; // completely clipped
@ -291,9 +293,9 @@ R_AliasPreparePoints (void)
{
for (i=0 ; i<s_pmdl->num_tris ; i++, ptri++)
{
pfv[0] = &pfinalverts[ptri->index_xyz[0]];
pfv[1] = &pfinalverts[ptri->index_xyz[1]];
pfv[2] = &pfinalverts[ptri->index_xyz[2]];
pfv[0] = &verts[ptri->index_xyz[0]];
pfv[1] = &verts[ptri->index_xyz[1]];
pfv[2] = &verts[ptri->index_xyz[2]];
if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
continue; // completely clipped
@ -697,6 +699,8 @@ R_AliasSetUpLerpData( dmdl_t *pmdl, float backlerp )
}
}
finalvert_t *finalverts, *finalverts_max;
/*
================
R_AliasDrawModel
@ -855,7 +859,7 @@ void R_AliasDrawModel (void)
else
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT;
R_AliasPreparePoints ();
R_AliasPreparePoints (finalverts, finalverts_max);
if ( currententity->flags & RF_WEAPONMODEL )
{