mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-18 10:21:42 +00:00
- fixed: y-clamped textures with negative scale need to shift their texture coordinates into the proper [0..1] range.
This commit is contained in:
parent
c39e962fd5
commit
fbfe0f1e7a
1 changed files with 19 additions and 11 deletions
|
@ -606,8 +606,8 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto
|
||||||
if (topright >= bottomright)
|
if (topright >= bottomright)
|
||||||
{
|
{
|
||||||
// normal case
|
// normal case
|
||||||
ztop[1]=FIXED2FLOAT(topright) ;
|
ztop[1]=FIXED2FLOAT(topright);
|
||||||
zbottom[1]=FIXED2FLOAT(bottomright) ;
|
zbottom[1]=FIXED2FLOAT(bottomright);
|
||||||
|
|
||||||
if (tci)
|
if (tci)
|
||||||
{
|
{
|
||||||
|
@ -640,17 +640,25 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto
|
||||||
uplft.u = lolft.u = l_ul + texlength * glseg.fracleft;
|
uplft.u = lolft.u = l_ul + texlength * glseg.fracleft;
|
||||||
uprgt.u = lorgt.u = l_ul + texlength * glseg.fracright;
|
uprgt.u = lorgt.u = l_ul + texlength * glseg.fracright;
|
||||||
|
|
||||||
|
if (gltexture != NULL)
|
||||||
if (gltexture && gltexture->tex->bHasCanvas && flags&GLT_CLAMPY)
|
|
||||||
{
|
{
|
||||||
// Camera textures are upside down so we have to shift the y-coordinate
|
bool normalize = false;
|
||||||
// from [-1..0] to [0..1] when using texture clamping
|
if (gltexture->tex->bHasCanvas) normalize = true;
|
||||||
|
else if (flags & GLT_CLAMPY)
|
||||||
|
{
|
||||||
|
// for negative scales we can get negative coordinates here.
|
||||||
|
normalize = (uplft.v > lolft.v || uprgt.v > lorgt.v);
|
||||||
|
}
|
||||||
|
if (normalize)
|
||||||
|
{
|
||||||
|
// we have to shift the y-coordinate from [-1..0] to [0..1] when using texture clamping with a negative scale
|
||||||
uplft.v+=1.f;
|
uplft.v+=1.f;
|
||||||
uprgt.v+=1.f;
|
uprgt.v+=1.f;
|
||||||
lolft.v+=1.f;
|
lolft.v+=1.f;
|
||||||
lorgt.v+=1.f;
|
lorgt.v+=1.f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue