- moved the sprite positioning info out of FMaterial back into FTexture.
This cleans out half of FMaterial and brings it closer to being a texture binding descriptor, which is all it really should be.
This commit is contained in:
parent
9099bc8420
commit
0ce0099e29
7 changed files with 309 additions and 300 deletions
|
|
@ -755,8 +755,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
else
|
||||
Angles = thing->Angles;
|
||||
|
||||
FloatRect r;
|
||||
|
||||
if (sector->sectornum != thing->Sector->sectornum && !thruportal)
|
||||
{
|
||||
// This cannot create a copy in the fake sector cache because it'd interfere with the main thread, so provide a local buffer for the copy.
|
||||
|
|
@ -818,15 +816,15 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
|
||||
if (!patch.isValid()) return;
|
||||
int type = thing->renderflags & RF_SPRITETYPEMASK;
|
||||
gltexture = FMaterial::ValidateTexture(patch, (type == RF_FACESPRITE), false);
|
||||
if (!gltexture)
|
||||
return;
|
||||
auto tex = TexMan.GetGameTexture(patch, false);
|
||||
if (!tex || !tex->isValid()) return;
|
||||
auto& spi = tex->GetSpritePositioning();
|
||||
|
||||
vt = gltexture->GetSpriteVT();
|
||||
vb = gltexture->GetSpriteVB();
|
||||
vt = spi.GetSpriteVT();
|
||||
vb = spi.GetSpriteVB();
|
||||
if (thing->renderflags & RF_YFLIP) std::swap(vt, vb);
|
||||
|
||||
gltexture->GetSpriteRect(&r);
|
||||
auto r = spi.GetSpriteRect();
|
||||
|
||||
// [SP] SpriteFlip
|
||||
if (thing->renderflags & RF_SPRITEFLIP)
|
||||
|
|
@ -835,15 +833,19 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
if (mirror ^ !!(thing->renderflags & RF_XFLIP))
|
||||
{
|
||||
r.left = -r.width - r.left; // mirror the sprite's x-offset
|
||||
ul = gltexture->GetSpriteUL();
|
||||
ur = gltexture->GetSpriteUR();
|
||||
ul = spi.GetSpriteUL();
|
||||
ur = spi.GetSpriteUR();
|
||||
}
|
||||
else
|
||||
{
|
||||
ul = gltexture->GetSpriteUR();
|
||||
ur = gltexture->GetSpriteUL();
|
||||
ul = spi.GetSpriteUR();
|
||||
ur = spi.GetSpriteUL();
|
||||
}
|
||||
|
||||
gltexture = FMaterial::ValidateTexture(patch, (type == RF_FACESPRITE), false);
|
||||
if (!gltexture)
|
||||
return;
|
||||
|
||||
if (thing->renderflags & RF_SPRITEFLIP) // [SP] Flip back
|
||||
thing->renderflags ^= RF_XFLIP;
|
||||
|
||||
|
|
@ -1182,15 +1184,14 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
|
|||
|
||||
if (lump.isValid())
|
||||
{
|
||||
gltexture = FMaterial::ValidateTexture(lump, true, false);
|
||||
translation = 0;
|
||||
//auto tex = TexMan.GetGameTexture(lump, false);
|
||||
|
||||
ul = gltexture->GetUL();
|
||||
ur = gltexture->GetUR();
|
||||
vt = gltexture->GetVT();
|
||||
vb = gltexture->GetVB();
|
||||
FloatRect r;
|
||||
gltexture->GetSpriteRect(&r);
|
||||
ul = 0;
|
||||
ur = 1;
|
||||
vt = 0;
|
||||
vb = 1;
|
||||
gltexture = FMaterial::ValidateTexture(lump, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1431,7 +1431,7 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
//
|
||||
//
|
||||
FloatRect *splitrect;
|
||||
int v = gltexture->GetAreas(&splitrect);
|
||||
int v = gltexture->sourcetex->GetAreas(&splitrect);
|
||||
if (seg->frontsector == seg->backsector) flags |= HWF_NOSPLIT; // we don't need to do vertex splits if a line has both sides in the same sector
|
||||
if (v>0 && !drawfogboundary && !(seg->linedef->flags&ML_WRAP_MIDTEX))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -417,14 +417,14 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., &mirror);
|
||||
if (!lump.isValid()) return false;
|
||||
|
||||
FMaterial * tex = FMaterial::ValidateTexture(lump, true, false);
|
||||
if (!tex) return false;
|
||||
auto tex = TexMan.GetGameTexture(lump, false);
|
||||
if (!tex || !tex->isValid()) return false;
|
||||
auto& spi = tex->GetSpritePositioning();
|
||||
|
||||
float vw = (float)viewwidth;
|
||||
float vh = (float)viewheight;
|
||||
|
||||
FloatRect r;
|
||||
tex->GetSpriteRect(&r);
|
||||
FloatRect r = spi.GetSpriteRect();
|
||||
|
||||
// calculate edges of the shape
|
||||
scalex = (320.0f / (240.0f * r_viewwindow.WidescreenRatio)) * vw / 320;
|
||||
|
|
@ -452,17 +452,17 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
|
||||
if (!(mirror) != !(psp->Flags & (PSPF_FLIP)))
|
||||
{
|
||||
u2 = tex->GetSpriteUL();
|
||||
v1 = tex->GetSpriteVT();
|
||||
u1 = tex->GetSpriteUR();
|
||||
v2 = tex->GetSpriteVB();
|
||||
u2 = spi.GetSpriteUL();
|
||||
v1 = spi.GetSpriteVT();
|
||||
u1 = spi.GetSpriteUR();
|
||||
v2 = spi.GetSpriteVB();
|
||||
}
|
||||
else
|
||||
{
|
||||
u1 = tex->GetSpriteUL();
|
||||
v1 = tex->GetSpriteVT();
|
||||
u2 = tex->GetSpriteUR();
|
||||
v2 = tex->GetSpriteVB();
|
||||
u1 = spi.GetSpriteUL();
|
||||
v1 = spi.GetSpriteVT();
|
||||
u2 = spi.GetSpriteUR();
|
||||
v2 = spi.GetSpriteVB();
|
||||
}
|
||||
|
||||
auto verts = screen->mVertexData->AllocVertices(4);
|
||||
|
|
@ -473,7 +473,10 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
verts.first[2].Set(x2, y1, 0, u2, v1);
|
||||
verts.first[3].Set(x2, y2, 0, u2, v2);
|
||||
|
||||
this->tex = tex;
|
||||
FMaterial* mat = FMaterial::ValidateTexture(lump, true, false);
|
||||
if (!mat) return false;
|
||||
|
||||
this->tex = mat;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue