/* R_AliasPreparePoints General clipped case */ static void R_AliasPreparePoints (void) { int i; stvert_t *pstverts; finalvert_t *fv; auxvert_t *av; mtriangle_t *ptri; finalvert_t *pfv[3]; pstverts = (stvert_t *) ((byte *) paliashdr + paliashdr->stverts); r_anumverts = pmdl->numverts; fv = pfinalverts; av = pauxverts; if (pmdl->ident == HEADER_MDL16) { for (i = 0; i < r_anumverts; i++, fv++, av++, r_apverts++, pstverts++) { R_AliasTransformFinalVert16 (av, r_apverts); R_AliasTransformFinalVert (fv, r_apverts, pstverts); R_AliasClipAndProjectFinalVert (fv, av); } } else { for (i = 0; i < r_anumverts; i++, fv++, av++, r_apverts++, pstverts++) { R_AliasTransformFinalVert8 (av, r_apverts); R_AliasTransformFinalVert (fv, r_apverts, pstverts); R_AliasClipAndProjectFinalVert (fv, av); } } // clip and draw all triangles r_affinetridesc.numtriangles = 1; ptri = (mtriangle_t *) ((byte *) paliashdr + paliashdr->triangles); for (i = 0; i < pmdl->numtris; i++, ptri++) { pfv[0] = &pfinalverts[ptri->vertindex[0]]; pfv[1] = &pfinalverts[ptri->vertindex[1]]; pfv[2] = &pfinalverts[ptri->vertindex[2]]; if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP)) continue; // completely clipped if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) { // totally unclipped r_affinetridesc.pfinalverts = pfinalverts; r_affinetridesc.ptriangles = ptri; D_PolysetDraw (); } else { // partially clipped R_AliasClipTriangle (ptri); } } }
/* ================ R_AliasPreparePoints General clipped case ================ */ void R_AliasPreparePoints(void) { int i; stvert_t *pstverts; finalvert_t *fv; auxvert_t *av; mtriangle_t *ptri; finalvert_t *pfv[3]; pstverts = (stvert_t *)((byte *)paliashdr + paliashdr->stverts); r_anumverts = pmdl->numverts; fv = pfinalverts; av = pauxverts; for (i=0 ; i<r_anumverts ; i++, fv++, av++, r_apverts++, pstverts++) { R_AliasTransformFinalVert(fv, av, r_apverts, pstverts); if (av->fv[2] < ALIAS_Z_CLIP_PLANE) { fv->flags |= ALIAS_Z_CLIP; } else { R_AliasProjectFinalVert(fv, av); if (fv->v[0] < r_refdef.aliasvrect.x) { fv->flags |= ALIAS_LEFT_CLIP; } if (fv->v[1] < r_refdef.aliasvrect.y) { fv->flags |= ALIAS_TOP_CLIP; } if (fv->v[0] > r_refdef.aliasvrectright) { fv->flags |= ALIAS_RIGHT_CLIP; } if (fv->v[1] > r_refdef.aliasvrectbottom) { fv->flags |= ALIAS_BOTTOM_CLIP; } } } // // clip and draw all triangles // r_affinetridesc.numtriangles = 1; ptri = (mtriangle_t *)((byte *)paliashdr + paliashdr->triangles); for (i=0 ; i<pmdl->numtris ; i++, ptri++) { pfv[0] = &pfinalverts[ptri->vertindex[0]]; pfv[1] = &pfinalverts[ptri->vertindex[1]]; pfv[2] = &pfinalverts[ptri->vertindex[2]]; if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP)) { continue; // completely clipped } if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) { // totally unclipped r_affinetridesc.pfinalverts = pfinalverts; r_affinetridesc.ptriangles = ptri; D_PolysetDraw(); } else { // partially clipped R_AliasClipTriangle(ptri); } } }
/* ================ R_AliasPreparePoints General clipped case ================ */ static void R_AliasPreparePoints (void) { int i; stvert_t *pstverts; finalvert_t *fv; auxvert_t *av; mtriangle_t *ptri; finalvert_t *pfv[3]; pstverts = (stvert_t *)((byte *)paliashdr + paliashdr->stverts); r_anumverts = pmdl->numverts; fv = pfinalverts; av = pauxverts; for (i = 0 ; i < r_anumverts ; i++, fv++, av++, r_apverts++) { fv->flags = 0; R_AliasTransformFinalVert (fv, av, r_apverts); if (av->fv[2] < ALIAS_Z_CLIP_PLANE) fv->flags |= ALIAS_Z_CLIP; else { R_AliasProjectFinalVert (fv, av); if (fv->v[0] < r_refdef.aliasvrect.x) fv->flags |= ALIAS_LEFT_CLIP; if (fv->v[1] < r_refdef.aliasvrect.y) fv->flags |= ALIAS_TOP_CLIP; if (fv->v[0] > r_refdef.aliasvrectright) fv->flags |= ALIAS_RIGHT_CLIP; if (fv->v[1] > r_refdef.aliasvrectbottom) fv->flags |= ALIAS_BOTTOM_CLIP; } } // // clip and draw all triangles // r_affinetridesc.numtriangles = 1; ptri = (mtriangle_t *)((byte *)paliashdr + paliashdr->triangles); for (i = 0 ; i < pmdl->numtris ; i++, ptri++) { pfv[0] = &pfinalverts[ptri->vertindex[0]]; pfv[1] = &pfinalverts[ptri->vertindex[1]]; pfv[2] = &pfinalverts[ptri->vertindex[2]]; if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) continue; // completely clipped //jfm: fill in the triangles s and t into the finalvert pfv[0]->v[2] = pstverts[ptri->stindex[0]].s; pfv[0]->v[3] = pstverts[ptri->stindex[0]].t; pfv[0]->flags |= pstverts[ptri->stindex[0]].onseam; pfv[1]->v[2] = pstverts[ptri->stindex[1]].s; pfv[1]->v[3] = pstverts[ptri->stindex[1]].t; pfv[1]->flags |= pstverts[ptri->stindex[1]].onseam; pfv[2]->v[2] = pstverts[ptri->stindex[2]].s; pfv[2]->v[3] = pstverts[ptri->stindex[2]].t; pfv[2]->flags |= pstverts[ptri->stindex[2]].onseam; if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) ) { // totally unclipped r_affinetridesc.pfinalverts = pfinalverts; r_affinetridesc.ptriangles = ptri; if ((currententity->model->flags & EF_SPECIAL_TRANS)) D_PolysetDrawT5 (); else if (currententity->drawflags & DRF_TRANSLUCENT) D_PolysetDrawT (); else if ((currententity->model->flags & EF_TRANSPARENT)) D_PolysetDrawT2 (); else if ((currententity->model->flags & EF_HOLEY)) D_PolysetDrawT3 (); else D_PolysetDraw (); } else { // partially clipped R_AliasClipTriangle (ptri); } } }