mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
Handle level check in texture coordinate calculation
This commit is contained in:
parent
473892dede
commit
f823e57446
6 changed files with 17 additions and 21 deletions
|
@ -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
|
// 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;
|
FTexCoordInfo tci;
|
||||||
|
|
||||||
gltexture->GetTexCoordInfo(&tci, seg->sidedef, texpos);
|
GetTexCoordInfo(gltexture, &tci, seg->sidedef, texpos);
|
||||||
|
|
||||||
type = _type;
|
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!!
|
// 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
|
// 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)
|
if (tci.mRenderHeight < 0)
|
||||||
{
|
{
|
||||||
mirrory = true;
|
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);
|
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::top), false, true);
|
||||||
if (!gltexture) return;
|
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)
|
else if (rover->flags&FF_LOWERTEXTURE)
|
||||||
{
|
{
|
||||||
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::bottom), false, true);
|
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::bottom), false, true);
|
||||||
if (!gltexture) return;
|
if (!gltexture) return;
|
||||||
gltexture->GetTexCoordInfo(&tci, seg->sidedef, side_t::bottom);
|
GetTexCoordInfo(gltexture, &tci, seg->sidedef, side_t::bottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gltexture = FMaterial::ValidateTexture(mastersd->GetTexture(side_t::mid), false, true);
|
gltexture = FMaterial::ValidateTexture(mastersd->GetTexture(side_t::mid), false, true);
|
||||||
if (!gltexture) return;
|
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));
|
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;
|
FTexCoordInfo tci;
|
||||||
type = RENDERWALL_BOTTOM;
|
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);
|
SetWallCoordinates(seg, &tci, bfh, bfh, bfh, ffh, ffh, 0);
|
||||||
PutWall(di, false);
|
PutWall(di, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,16 +94,6 @@ public:
|
||||||
*r = mSpriteRect;
|
*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
|
// This is scaled size in integer units as needed by walls and flats
|
||||||
int TextureHeight() const { return mRenderHeight; }
|
int TextureHeight() const { return mRenderHeight; }
|
||||||
int TextureWidth() const { return mRenderWidth; }
|
int TextureWidth() const { return mRenderWidth; }
|
||||||
|
|
|
@ -236,7 +236,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do
|
||||||
FTexCoordInfo tci;
|
FTexCoordInfo tci;
|
||||||
|
|
||||||
// We only need the vertical positioning info here.
|
// 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 y_offset = tci.RowOffset((float)side->GetTextureYOffset(side_t::mid));
|
||||||
double textureheight = tci.mRenderHeight;
|
double textureheight = tci.mRenderHeight;
|
||||||
|
|
||||||
|
|
|
@ -2640,7 +2640,7 @@ static void Vec2OffsetZ(FLevelLocals *Level, double x, double y, double dx, doub
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DVector2 v = level.GetPortalOffsetPosition(x, y, dx, dy);
|
DVector2 v = Level->GetPortalOffsetPosition(x, y, dx, dy);
|
||||||
*result = (DVector3(v, atz));
|
*result = (DVector3(v, atz));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
if (x == 1.f)
|
||||||
{
|
{
|
||||||
|
@ -904,7 +904,7 @@ void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y)
|
||||||
mScale.Y = -mScale.Y;
|
mScale.Y = -mScale.Y;
|
||||||
mRenderHeight = -mRenderHeight;
|
mRenderHeight = -mRenderHeight;
|
||||||
}
|
}
|
||||||
mWorldPanning = tex->bWorldPanning || (level.flags3 & LEVEL3_FORCEWORLDPANNING);
|
mWorldPanning = tex->bWorldPanning || forceworldpanning;
|
||||||
mWidth = tex->GetWidth();
|
mWidth = tex->GetWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,7 @@ struct FTexCoordInfo
|
||||||
float RowOffset(float ofs) const;
|
float RowOffset(float ofs) const;
|
||||||
float TextureOffset(float ofs) const;
|
float TextureOffset(float ofs) const;
|
||||||
float TextureAdjustWidth() const;
|
float TextureAdjustWidth() const;
|
||||||
void GetFromTexture(FTexture *tex, float x, float y);
|
void GetFromTexture(FTexture *tex, float x, float y, bool forceworldpanning);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue