Tweaked S3 ViRGE clipping. Based on patch from rene.
This commit is contained in:
parent
2c5824f2cd
commit
140903f4cb
1 changed files with 6 additions and 3 deletions
|
|
@ -2975,7 +2975,7 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3
|
||||||
y_count -= diff_y;
|
y_count -= diff_y;
|
||||||
}
|
}
|
||||||
if ((state->y - y_count) < s3d_tri->clip_t)
|
if ((state->y - y_count) < s3d_tri->clip_t)
|
||||||
y_count = state->y - s3d_tri->clip_t;
|
y_count = (state->y - s3d_tri->clip_t) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; y_count > 0; y_count--)
|
for (; y_count > 0; y_count--)
|
||||||
|
|
@ -3018,7 +3018,7 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3
|
||||||
if (xe < s3d_tri->clip_l)
|
if (xe < s3d_tri->clip_l)
|
||||||
goto tri_skip_line;
|
goto tri_skip_line;
|
||||||
if (xe > s3d_tri->clip_r)
|
if (xe > s3d_tri->clip_r)
|
||||||
xe = s3d_tri->clip_r;
|
xe = s3d_tri->clip_r + 1;
|
||||||
if (x < s3d_tri->clip_l)
|
if (x < s3d_tri->clip_l)
|
||||||
{
|
{
|
||||||
int diff_x = s3d_tri->clip_l - x;
|
int diff_x = s3d_tri->clip_l - x;
|
||||||
|
|
@ -3043,7 +3043,7 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3
|
||||||
if (xe > s3d_tri->clip_r)
|
if (xe > s3d_tri->clip_r)
|
||||||
goto tri_skip_line;
|
goto tri_skip_line;
|
||||||
if (xe < s3d_tri->clip_l)
|
if (xe < s3d_tri->clip_l)
|
||||||
xe = s3d_tri->clip_l;
|
xe = s3d_tri->clip_l - 1;
|
||||||
if (x > s3d_tri->clip_r)
|
if (x > s3d_tri->clip_r)
|
||||||
{
|
{
|
||||||
int diff_x = x - s3d_tri->clip_r;
|
int diff_x = x - s3d_tri->clip_r;
|
||||||
|
|
@ -3068,6 +3068,9 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3
|
||||||
dest_addr = dest_offset + (x * (bpp + 1));
|
dest_addr = dest_offset + (x * (bpp + 1));
|
||||||
z_addr = z_offset + (x << 1);
|
z_addr = z_offset + (x << 1);
|
||||||
|
|
||||||
|
x &= 0xfff;
|
||||||
|
xe &= 0xfff;
|
||||||
|
|
||||||
for (; x != xe; x = (x + x_dir) & 0xfff)
|
for (; x != xe; x = (x + x_dir) & 0xfff)
|
||||||
{
|
{
|
||||||
int update = 1;
|
int update = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue