mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-17 18:21:10 +00:00
Merge branch 'texture-fixes' into 'master'
Texture fixes See merge request STJr/SRB2Internal!135
This commit is contained in:
commit
d315072e3f
2 changed files with 25 additions and 2 deletions
|
@ -62,19 +62,31 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
|||
UINT8 texel;
|
||||
UINT16 texelu16;
|
||||
|
||||
if (!ptexturewidth)
|
||||
return;
|
||||
|
||||
x1 = originx;
|
||||
x2 = x1 + SHORT(realpatch->width);
|
||||
|
||||
if (x1 > ptexturewidth || x2 < 0)
|
||||
return; // patch not located within texture's x bounds, ignore
|
||||
|
||||
if (originy > ptextureheight || (originy + SHORT(realpatch->height)) < 0)
|
||||
return; // patch not located within texture's y bounds, ignore
|
||||
|
||||
// patch is actually inside the texture!
|
||||
// now check if texture is partly off-screen and adjust accordingly
|
||||
|
||||
// left edge
|
||||
if (x1 < 0)
|
||||
x = 0;
|
||||
else
|
||||
x = x1;
|
||||
|
||||
// right edge
|
||||
if (x2 > ptexturewidth)
|
||||
x2 = ptexturewidth;
|
||||
|
||||
if (!ptexturewidth)
|
||||
return;
|
||||
|
||||
col = x * pblockwidth / ptexturewidth;
|
||||
ncols = ((x2 - x) * pblockwidth) / ptexturewidth;
|
||||
|
|
11
src/r_data.c
11
src/r_data.c
|
@ -439,11 +439,22 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
height = SHORT(realpatch->height);
|
||||
x2 = x1 + width;
|
||||
|
||||
if (x1 > texture->width || x2 < 0)
|
||||
continue; // patch not located within texture's x bounds, ignore
|
||||
|
||||
if (patch->originy > texture->height || (patch->originy + height) < 0)
|
||||
continue; // patch not located within texture's y bounds, ignore
|
||||
|
||||
// patch is actually inside the texture!
|
||||
// now check if texture is partly off-screen and adjust accordingly
|
||||
|
||||
// left edge
|
||||
if (x1 < 0)
|
||||
x = 0;
|
||||
else
|
||||
x = x1;
|
||||
|
||||
// right edge
|
||||
if (x2 > texture->width)
|
||||
x2 = texture->width;
|
||||
|
||||
|
|
Loading…
Reference in a new issue