mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-30 00:10:53 +00:00
soft: resuse compact vert_t
This commit is contained in:
parent
3f33522977
commit
5fcf0a3afc
4 changed files with 117 additions and 136 deletions
|
@ -201,20 +201,18 @@ typedef struct
|
|||
** if you change this structure be sure to change the #defines
|
||||
** listed after it!
|
||||
*/
|
||||
typedef struct finalvert_s {
|
||||
int u, v, s, t;
|
||||
light3_t l; // full color light
|
||||
zvalue_t zi;
|
||||
int flags;
|
||||
float xyz[3]; // eye space
|
||||
} finalvert_t;
|
||||
|
||||
typedef struct compactvert_s {
|
||||
int u, v, s, t;
|
||||
light3_t l; // full color light
|
||||
zvalue_t zi;
|
||||
} compactvert_t;
|
||||
|
||||
typedef struct finalvert_s {
|
||||
compactvert_t cv; // reuse compacted type
|
||||
int flags;
|
||||
float xyz[3]; // eye space
|
||||
} finalvert_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pixel_t *pskin;
|
||||
|
|
|
@ -43,11 +43,11 @@ R_Alias_clip_z (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *o
|
|||
out->xyz[1] = pfv0->xyz[1] + (pfv1->xyz[1] - pfv0->xyz[1]) * scale;
|
||||
out->xyz[2] = ALIAS_Z_CLIP_PLANE;
|
||||
|
||||
out->s = pfv0->s + (pfv1->s - pfv0->s) * scale;
|
||||
out->t = pfv0->t + (pfv1->t - pfv0->t) * scale;
|
||||
out->cv.s = pfv0->cv.s + (pfv1->cv.s - pfv0->cv.s) * scale;
|
||||
out->cv.t = pfv0->cv.t + (pfv1->cv.t - pfv0->cv.t) * scale;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv0->l[i] + (pfv1->l[i] - pfv0->l[i]) * scale;
|
||||
out->cv.l[i] = pfv0->cv.l[i] + (pfv1->cv.l[i] - pfv0->cv.l[i]) * scale;
|
||||
|
||||
R_AliasProjectAndClipTestFinalVert (out);
|
||||
}
|
||||
|
@ -57,37 +57,37 @@ R_Alias_clip_left (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t
|
|||
{
|
||||
float scale;
|
||||
|
||||
if (pfv0->v >= pfv1->v )
|
||||
if (pfv0->cv.v >= pfv1->cv.v )
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrect.x - pfv0->u) /
|
||||
(pfv1->u - pfv0->u);
|
||||
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5;
|
||||
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5;
|
||||
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5;
|
||||
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5;
|
||||
scale = (float)(r_refdef.aliasvrect.x - pfv0->cv.u) /
|
||||
(pfv1->cv.u - pfv0->cv.u);
|
||||
out->cv.u = pfv0->cv.u + ( pfv1->cv.u - pfv0->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv0->cv.v + ( pfv1->cv.v - pfv0->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv0->cv.s + ( pfv1->cv.s - pfv0->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv0->cv.t + ( pfv1->cv.t - pfv0->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv1->l[i] + ( pfv0->l[i] - pfv1->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv1->cv.l[i] + ( pfv0->cv.l[i] - pfv1->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv0->cv.zi + ( pfv1->cv.zi - pfv0->cv.zi) * scale + 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrect.x - pfv1->u) /
|
||||
(pfv0->u - pfv1->u);
|
||||
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5;
|
||||
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5;
|
||||
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5;
|
||||
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5;
|
||||
scale = (float)(r_refdef.aliasvrect.x - pfv1->cv.u) /
|
||||
(pfv0->cv.u - pfv1->cv.u);
|
||||
out->cv.u = pfv1->cv.u + ( pfv0->cv.u - pfv1->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv1->cv.v + ( pfv0->cv.v - pfv1->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv1->cv.s + ( pfv0->cv.s - pfv1->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv1->cv.t + ( pfv0->cv.t - pfv1->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv1->l[i] + ( pfv0->l[i] - pfv1->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv1->cv.l[i] + ( pfv0->cv.l[i] - pfv1->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv1->cv.zi + ( pfv0->cv.zi - pfv1->cv.zi) * scale + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,37 +96,37 @@ R_Alias_clip_right (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_
|
|||
{
|
||||
float scale;
|
||||
|
||||
if ( pfv0->v >= pfv1->v )
|
||||
if ( pfv0->cv.v >= pfv1->cv.v )
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrectright - pfv0->u ) /
|
||||
(pfv1->u - pfv0->u );
|
||||
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5;
|
||||
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5;
|
||||
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5;
|
||||
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5;
|
||||
scale = (float)(r_refdef.aliasvrectright - pfv0->cv.u ) /
|
||||
(pfv1->cv.u - pfv0->cv.u );
|
||||
out->cv.u = pfv0->cv.u + ( pfv1->cv.u - pfv0->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv0->cv.v + ( pfv1->cv.v - pfv0->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv0->cv.s + ( pfv1->cv.s - pfv0->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv0->cv.t + ( pfv1->cv.t - pfv0->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv0->l[i] + ( pfv1->l[i] - pfv0->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv0->cv.l[i] + ( pfv1->cv.l[i] - pfv0->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv0->cv.zi + ( pfv1->cv.zi - pfv0->cv.zi) * scale + 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrectright - pfv1->u ) /
|
||||
(pfv0->u - pfv1->u );
|
||||
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5;
|
||||
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5;
|
||||
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5;
|
||||
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5;
|
||||
scale = (float)(r_refdef.aliasvrectright - pfv1->cv.u ) /
|
||||
(pfv0->cv.u - pfv1->cv.u );
|
||||
out->cv.u = pfv1->cv.u + ( pfv0->cv.u - pfv1->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv1->cv.v + ( pfv0->cv.v - pfv1->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv1->cv.s + ( pfv0->cv.s - pfv1->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv1->cv.t + ( pfv0->cv.t - pfv1->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv1->l[i] + ( pfv0->l[i] - pfv1->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv1->cv.l[i] + ( pfv0->cv.l[i] - pfv1->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv1->cv.zi + ( pfv0->cv.zi - pfv1->cv.zi) * scale + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,37 +135,37 @@ R_Alias_clip_top (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t
|
|||
{
|
||||
float scale;
|
||||
|
||||
if (pfv0->v >= pfv1->v)
|
||||
if (pfv0->cv.v >= pfv1->cv.v)
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrect.y - pfv0->v) /
|
||||
(pfv1->v - pfv0->v);
|
||||
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5;
|
||||
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5;
|
||||
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5;
|
||||
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5;
|
||||
scale = (float)(r_refdef.aliasvrect.y - pfv0->cv.v) /
|
||||
(pfv1->cv.v - pfv0->cv.v);
|
||||
out->cv.u = pfv0->cv.u + ( pfv1->cv.u - pfv0->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv0->cv.v + ( pfv1->cv.v - pfv0->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv0->cv.s + ( pfv1->cv.s - pfv0->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv0->cv.t + ( pfv1->cv.t - pfv0->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv0->l[i] + ( pfv1->l[i] - pfv0->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv0->cv.l[i] + ( pfv1->cv.l[i] - pfv0->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv0->cv.zi + ( pfv1->cv.zi - pfv0->cv.zi) * scale + 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrect.y - pfv1->v) /
|
||||
(pfv0->v - pfv1->v);
|
||||
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5;
|
||||
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5;
|
||||
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5;
|
||||
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5;
|
||||
scale = (float)(r_refdef.aliasvrect.y - pfv1->cv.v) /
|
||||
(pfv0->cv.v - pfv1->cv.v);
|
||||
out->cv.u = pfv1->cv.u + ( pfv0->cv.u - pfv1->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv1->cv.v + ( pfv0->cv.v - pfv1->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv1->cv.s + ( pfv0->cv.s - pfv1->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv1->cv.t + ( pfv0->cv.t - pfv1->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv1->l[i] + ( pfv0->l[i] - pfv1->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv1->cv.l[i] + ( pfv0->cv.l[i] - pfv1->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv1->cv.zi + ( pfv0->cv.zi - pfv1->cv.zi) * scale + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,39 +175,39 @@ R_Alias_clip_bottom (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert
|
|||
{
|
||||
float scale;
|
||||
|
||||
if (pfv0->v >= pfv1->v)
|
||||
if (pfv0->cv.v >= pfv1->cv.v)
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrectbottom - pfv0->v) /
|
||||
(pfv1->v - pfv0->v);
|
||||
scale = (float)(r_refdef.aliasvrectbottom - pfv0->cv.v) /
|
||||
(pfv1->cv.v - pfv0->cv.v);
|
||||
|
||||
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5;
|
||||
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5;
|
||||
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5;
|
||||
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5;
|
||||
out->cv.u = pfv0->cv.u + ( pfv1->cv.u - pfv0->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv0->cv.v + ( pfv1->cv.v - pfv0->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv0->cv.s + ( pfv1->cv.s - pfv0->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv0->cv.t + ( pfv1->cv.t - pfv0->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv0->l[i] + ( pfv1->l[i] - pfv0->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv0->cv.l[i] + ( pfv1->cv.l[i] - pfv0->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv0->cv.zi + ( pfv1->cv.zi - pfv0->cv.zi) * scale + 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
scale = (float)(r_refdef.aliasvrectbottom - pfv1->v) /
|
||||
(pfv0->v - pfv1->v);
|
||||
scale = (float)(r_refdef.aliasvrectbottom - pfv1->cv.v) /
|
||||
(pfv0->cv.v - pfv1->cv.v);
|
||||
|
||||
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5;
|
||||
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5;
|
||||
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5;
|
||||
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5;
|
||||
out->cv.u = pfv1->cv.u + ( pfv0->cv.u - pfv1->cv.u ) * scale + 0.5;
|
||||
out->cv.v = pfv1->cv.v + ( pfv0->cv.v - pfv1->cv.v ) * scale + 0.5;
|
||||
out->cv.s = pfv1->cv.s + ( pfv0->cv.s - pfv1->cv.s ) * scale + 0.5;
|
||||
out->cv.t = pfv1->cv.t + ( pfv0->cv.t - pfv1->cv.t ) * scale + 0.5;
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
out->l[i] = pfv1->l[i] + ( pfv0->l[i] - pfv1->l[i] ) * scale + 0.5;
|
||||
out->cv.l[i] = pfv1->cv.l[i] + ( pfv0->cv.l[i] - pfv1->cv.l[i] ) * scale + 0.5;
|
||||
|
||||
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5;
|
||||
out->cv.zi = pfv1->cv.zi + ( pfv0->cv.zi - pfv1->cv.zi) * scale + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,13 +236,13 @@ R_AliasClip (const finalvert_t *in, finalvert_t *out, int flag, int count,
|
|||
{
|
||||
clip (&in[j], &in[i], &out[k]);
|
||||
out[k].flags = 0;
|
||||
if (out[k].u < r_refdef.aliasvrect.x)
|
||||
if (out[k].cv.u < r_refdef.aliasvrect.x)
|
||||
out[k].flags |= ALIAS_LEFT_CLIP;
|
||||
if (out[k].v < r_refdef.aliasvrect.y)
|
||||
if (out[k].cv.v < r_refdef.aliasvrect.y)
|
||||
out[k].flags |= ALIAS_TOP_CLIP;
|
||||
if (out[k].u > r_refdef.aliasvrectright)
|
||||
if (out[k].cv.u > r_refdef.aliasvrectright)
|
||||
out[k].flags |= ALIAS_RIGHT_CLIP;
|
||||
if (out[k].v > r_refdef.aliasvrectbottom)
|
||||
if (out[k].cv.v > r_refdef.aliasvrectbottom)
|
||||
out[k].flags |= ALIAS_BOTTOM_CLIP;
|
||||
k++;
|
||||
}
|
||||
|
@ -335,15 +335,15 @@ R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, co
|
|||
|
||||
for (i=0 ; i<k ; i++)
|
||||
{
|
||||
if (fv[pingpong][i].u < r_refdef.aliasvrect.x)
|
||||
fv[pingpong][i].u = r_refdef.aliasvrect.x;
|
||||
else if (fv[pingpong][i].u > r_refdef.aliasvrectright)
|
||||
fv[pingpong][i].u = r_refdef.aliasvrectright;
|
||||
if (fv[pingpong][i].cv.u < r_refdef.aliasvrect.x)
|
||||
fv[pingpong][i].cv.u = r_refdef.aliasvrect.x;
|
||||
else if (fv[pingpong][i].cv.u > r_refdef.aliasvrectright)
|
||||
fv[pingpong][i].cv.u = r_refdef.aliasvrectright;
|
||||
|
||||
if (fv[pingpong][i].v < r_refdef.aliasvrect.y)
|
||||
fv[pingpong][i].v = r_refdef.aliasvrect.y;
|
||||
else if (fv[pingpong][i].v > r_refdef.aliasvrectbottom)
|
||||
fv[pingpong][i].v = r_refdef.aliasvrectbottom;
|
||||
if (fv[pingpong][i].cv.v < r_refdef.aliasvrect.y)
|
||||
fv[pingpong][i].cv.v = r_refdef.aliasvrect.y;
|
||||
else if (fv[pingpong][i].cv.v > r_refdef.aliasvrectbottom)
|
||||
fv[pingpong][i].cv.v = r_refdef.aliasvrectbottom;
|
||||
|
||||
fv[pingpong][i].flags = 0;
|
||||
}
|
||||
|
|
|
@ -257,14 +257,14 @@ R_AliasPreparePoints (const entity_t *currententity, finalvert_t *verts, const f
|
|||
continue; // completely clipped
|
||||
|
||||
// insert s/t coordinates
|
||||
pfv[0]->s = pstverts[ptri->index_st[0]].s << SHIFT16XYZ;
|
||||
pfv[0]->t = pstverts[ptri->index_st[0]].t << SHIFT16XYZ;
|
||||
pfv[0]->cv.s = pstverts[ptri->index_st[0]].s << SHIFT16XYZ;
|
||||
pfv[0]->cv.t = pstverts[ptri->index_st[0]].t << SHIFT16XYZ;
|
||||
|
||||
pfv[1]->s = pstverts[ptri->index_st[1]].s << SHIFT16XYZ;
|
||||
pfv[1]->t = pstverts[ptri->index_st[1]].t << SHIFT16XYZ;
|
||||
pfv[1]->cv.s = pstverts[ptri->index_st[1]].s << SHIFT16XYZ;
|
||||
pfv[1]->cv.t = pstverts[ptri->index_st[1]].t << SHIFT16XYZ;
|
||||
|
||||
pfv[2]->s = pstverts[ptri->index_st[2]].s << SHIFT16XYZ;
|
||||
pfv[2]->t = pstverts[ptri->index_st[2]].t << SHIFT16XYZ;
|
||||
pfv[2]->cv.s = pstverts[ptri->index_st[2]].s << SHIFT16XYZ;
|
||||
pfv[2]->cv.t = pstverts[ptri->index_st[2]].t << SHIFT16XYZ;
|
||||
|
||||
if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
|
||||
{
|
||||
|
@ -289,14 +289,14 @@ R_AliasPreparePoints (const entity_t *currententity, finalvert_t *verts, const f
|
|||
continue; // completely clipped
|
||||
|
||||
// insert s/t coordinates
|
||||
pfv[0]->s = pstverts[ptri->index_st[0]].s << SHIFT16XYZ;
|
||||
pfv[0]->t = pstverts[ptri->index_st[0]].t << SHIFT16XYZ;
|
||||
pfv[0]->cv.s = pstverts[ptri->index_st[0]].s << SHIFT16XYZ;
|
||||
pfv[0]->cv.t = pstverts[ptri->index_st[0]].t << SHIFT16XYZ;
|
||||
|
||||
pfv[1]->s = pstverts[ptri->index_st[1]].s << SHIFT16XYZ;
|
||||
pfv[1]->t = pstverts[ptri->index_st[1]].t << SHIFT16XYZ;
|
||||
pfv[1]->cv.s = pstverts[ptri->index_st[1]].s << SHIFT16XYZ;
|
||||
pfv[1]->cv.t = pstverts[ptri->index_st[1]].t << SHIFT16XYZ;
|
||||
|
||||
pfv[2]->s = pstverts[ptri->index_st[2]].s << SHIFT16XYZ;
|
||||
pfv[2]->t = pstverts[ptri->index_st[2]].t << SHIFT16XYZ;
|
||||
pfv[2]->cv.s = pstverts[ptri->index_st[2]].s << SHIFT16XYZ;
|
||||
pfv[2]->cv.t = pstverts[ptri->index_st[2]].t << SHIFT16XYZ;
|
||||
|
||||
if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
|
||||
{
|
||||
|
@ -443,11 +443,11 @@ R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalve
|
|||
if (temp < 0)
|
||||
temp = 0;
|
||||
|
||||
fv->l[j] = temp;
|
||||
fv->cv.l[j] = temp;
|
||||
}
|
||||
}
|
||||
else
|
||||
memcpy(fv->l, r_ambientlight, sizeof(light3_t)); // light;
|
||||
memcpy(fv->cv.l, r_ambientlight, sizeof(light3_t)); // light;
|
||||
|
||||
if ( fv->xyz[2] < ALIAS_Z_CLIP_PLANE )
|
||||
{
|
||||
|
@ -478,18 +478,18 @@ R_AliasProjectAndClipTestFinalVert( finalvert_t *fv )
|
|||
z = fv->xyz[2];
|
||||
zi = 1.0 / z;
|
||||
|
||||
fv->zi = zi * s_ziscale;
|
||||
fv->cv.zi = zi * s_ziscale;
|
||||
|
||||
fv->u = (x * aliasxscale * zi) + aliasxcenter;
|
||||
fv->v = (y * aliasyscale * zi) + aliasycenter;
|
||||
fv->cv.u = (x * aliasxscale * zi) + aliasxcenter;
|
||||
fv->cv.v = (y * aliasyscale * zi) + aliasycenter;
|
||||
|
||||
if (fv->u < r_refdef.aliasvrect.x)
|
||||
if (fv->cv.u < r_refdef.aliasvrect.x)
|
||||
fv->flags |= ALIAS_LEFT_CLIP;
|
||||
if (fv->v < r_refdef.aliasvrect.y)
|
||||
if (fv->cv.v < r_refdef.aliasvrect.y)
|
||||
fv->flags |= ALIAS_TOP_CLIP;
|
||||
if (fv->u > r_refdef.aliasvrectright)
|
||||
if (fv->cv.u > r_refdef.aliasvrectright)
|
||||
fv->flags |= ALIAS_RIGHT_CLIP;
|
||||
if (fv->v > r_refdef.aliasvrectbottom)
|
||||
if (fv->cv.v > r_refdef.aliasvrectbottom)
|
||||
fv->flags |= ALIAS_BOTTOM_CLIP;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,14 +170,14 @@ R_DrawTriangle(const entity_t *currententity, const finalvert_t *a, const finalv
|
|||
( a->v[0] - b->v[0] ) * ( a->v[1] - c->v[1] );
|
||||
*/
|
||||
|
||||
dv0_ab = a->u - b->u;
|
||||
dv1_ab = a->v - b->v;
|
||||
dv0_ab = a->cv.u - b->cv.u;
|
||||
dv1_ab = a->cv.v - b->cv.v;
|
||||
|
||||
if ( !( dv0_ab | dv1_ab ) )
|
||||
return;
|
||||
|
||||
dv0_ac = a->u - c->u;
|
||||
dv1_ac = a->v - c->v;
|
||||
dv0_ac = a->cv.u - c->cv.u;
|
||||
dv1_ac = a->cv.v - c->cv.v;
|
||||
|
||||
if ( !( dv0_ac | dv1_ac ) )
|
||||
return;
|
||||
|
@ -186,26 +186,9 @@ R_DrawTriangle(const entity_t *currententity, const finalvert_t *a, const finalv
|
|||
|
||||
if ( d_xdenom < 0 )
|
||||
{
|
||||
r_p0.u = a->u; // u
|
||||
r_p0.v = a->v; // v
|
||||
r_p0.s = a->s; // s
|
||||
r_p0.t = a->t; // t
|
||||
memcpy(r_p0.l, a->l, sizeof(light3_t)); // light
|
||||
r_p0.zi = a->zi; // iz
|
||||
|
||||
r_p1.u = b->u;
|
||||
r_p1.v = b->v;
|
||||
r_p1.s = b->s;
|
||||
r_p1.t = b->t;
|
||||
memcpy(r_p1.l, b->l, sizeof(light3_t)); // light
|
||||
r_p1.zi = b->zi;
|
||||
|
||||
r_p2.u = c->u;
|
||||
r_p2.v = c->v;
|
||||
r_p2.s = c->s;
|
||||
r_p2.t = c->t;
|
||||
memcpy(r_p2.l, c->l, sizeof(light3_t)); // light;
|
||||
r_p2.zi = c->zi;
|
||||
memcpy(&r_p0, &a->cv, sizeof(compactvert_t));
|
||||
memcpy(&r_p1, &b->cv, sizeof(compactvert_t));
|
||||
memcpy(&r_p2, &c->cv, sizeof(compactvert_t));
|
||||
|
||||
R_PolysetSetEdgeTable ();
|
||||
R_RasterizeAliasPolySmooth(currententity);
|
||||
|
|
Loading…
Reference in a new issue