Handle level check in texture coordinate calculation

This commit is contained in:
Christoph Oelckers 2019-01-29 02:51:06 +01:00
parent 473892dede
commit f823e57446
6 changed files with 17 additions and 21 deletions

View file

@ -1095,6 +1095,12 @@ void GLWall::CheckTexturePosition(FTexCoordInfo *tci)
}
}
static void GetTexCoordInfo(FMaterial *tex, FTexCoordInfo *tci, side_t *side, int texpos)
{
tci->GetFromTexture(tex->tex, (float)side->GetTextureXScale(texpos), (float)side->GetTextureYScale(texpos), !!(side->GetLevel()->flags3 & LEVEL3_FORCEWORLDPANNING));
}
//==========================================================================
//
// Handle one sided walls, upper and lower texture
@ -1129,7 +1135,7 @@ void GLWall::DoTexture(HWDrawInfo *di, int _type,seg_t * seg, int peg,
FTexCoordInfo tci;
gltexture->GetTexCoordInfo(&tci, seg->sidedef, texpos);
GetTexCoordInfo(gltexture, &tci, seg->sidedef, texpos);
type = _type;
@ -1190,7 +1196,7 @@ void GLWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
// Align the texture to the ORIGINAL sector's height!!
// At this point slopes don't matter because they don't affect the texture's z-position
gltexture->GetTexCoordInfo(&tci, seg->sidedef, side_t::mid);
GetTexCoordInfo(gltexture, &tci, seg->sidedef, side_t::mid);
if (tci.mRenderHeight < 0)
{
mirrory = true;
@ -1530,19 +1536,19 @@ void GLWall::BuildFFBlock(HWDrawInfo *di, seg_t * seg, F3DFloor * rover,
{
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::top), false, true);
if (!gltexture) return;
gltexture->GetTexCoordInfo(&tci, seg->sidedef, side_t::top);
GetTexCoordInfo(gltexture, &tci, seg->sidedef, side_t::top);
}
else if (rover->flags&FF_LOWERTEXTURE)
{
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::bottom), false, true);
if (!gltexture) return;
gltexture->GetTexCoordInfo(&tci, seg->sidedef, side_t::bottom);
GetTexCoordInfo(gltexture, &tci, seg->sidedef, side_t::bottom);
}
else
{
gltexture = FMaterial::ValidateTexture(mastersd->GetTexture(side_t::mid), false, true);
if (!gltexture) return;
gltexture->GetTexCoordInfo(&tci, mastersd, side_t::mid);
GetTexCoordInfo(gltexture, &tci, mastersd, side_t::mid);
}
to = (rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ? 0 : tci.TextureOffset(mastersd->GetTextureXOffset(side_t::mid));
@ -2195,7 +2201,7 @@ void GLWall::ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t * frontsec
{
FTexCoordInfo tci;
type = RENDERWALL_BOTTOM;
gltexture->GetTexCoordInfo(&tci, 1.f, 1.f);
tci.GetFromTexture(gltexture->tex, 1, 1, false);
SetWallCoordinates(seg, &tci, bfh, bfh, bfh, ffh, ffh, 0);
PutWall(di, false);
}

View file

@ -94,16 +94,6 @@ public:
*r = mSpriteRect;
}
void GetTexCoordInfo(FTexCoordInfo *tci, float x, float y) const
{
tci->GetFromTexture(tex, x, y);
}
void GetTexCoordInfo(FTexCoordInfo *tci, side_t *side, int texpos) const
{
GetTexCoordInfo(tci, (float)side->GetTextureXScale(texpos), (float)side->GetTextureYScale(texpos));
}
// This is scaled size in integer units as needed by walls and flats
int TextureHeight() const { return mRenderHeight; }
int TextureWidth() const { return mRenderWidth; }

View file

@ -236,7 +236,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do
FTexCoordInfo tci;
// We only need the vertical positioning info here.
tci.GetFromTexture(tex, 1., (float)side->GetTextureYScale(side_t::mid));
tci.GetFromTexture(tex, 1., (float)side->GetTextureYScale(side_t::mid), !!(line->GetLevel()->flags3 & LEVEL3_FORCEWORLDPANNING));
double y_offset = tci.RowOffset((float)side->GetTextureYOffset(side_t::mid));
double textureheight = tci.mRenderHeight;

View file

@ -2640,7 +2640,7 @@ static void Vec2OffsetZ(FLevelLocals *Level, double x, double y, double dx, doub
}
else
{
DVector2 v = level.GetPortalOffsetPosition(x, y, dx, dy);
DVector2 v = Level->GetPortalOffsetPosition(x, y, dx, dy);
*result = (DVector3(v, atz));
}
}

View file

@ -870,7 +870,7 @@ float FTexCoordInfo::TextureAdjustWidth() const
//
//===========================================================================
void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y)
void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y, bool forceworldpanning)
{
if (x == 1.f)
{
@ -904,7 +904,7 @@ void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y)
mScale.Y = -mScale.Y;
mRenderHeight = -mRenderHeight;
}
mWorldPanning = tex->bWorldPanning || (level.flags3 & LEVEL3_FORCEWORLDPANNING);
mWorldPanning = tex->bWorldPanning || forceworldpanning;
mWidth = tex->GetWidth();
}

View file

@ -755,7 +755,7 @@ struct FTexCoordInfo
float RowOffset(float ofs) const;
float TextureOffset(float ofs) const;
float TextureAdjustWidth() const;
void GetFromTexture(FTexture *tex, float x, float y);
void GetFromTexture(FTexture *tex, float x, float y, bool forceworldpanning);
};