- reworking some lower level texture code.
This commit is contained in:
parent
72835c5462
commit
9099bc8420
21 changed files with 76 additions and 61 deletions
|
|
@ -1000,14 +1000,15 @@ void PPCustomShaderInstance::SetTextures(PPRenderState *renderstate)
|
|||
while (it.NextPair(pair))
|
||||
{
|
||||
FString name = pair->Value;
|
||||
FTexture *tex = TexMan.GetTexture(TexMan.CheckForTexture(name, ETextureType::Any), true);
|
||||
if (tex && tex->isValid())
|
||||
auto gtex = TexMan.GetGameTexture(TexMan.CheckForTexture(name, ETextureType::Any), true);
|
||||
if (gtex && gtex->isValid())
|
||||
{
|
||||
// Why does this completely circumvent the normal way of handling textures?
|
||||
// This absolutely needs fixing because it will also circumvent any potential caching system that may get implemented.
|
||||
//
|
||||
// To do: fix the above problem by adding PPRenderState::SetInput(FTexture *tex)
|
||||
|
||||
auto tex = gtex->GetTexture();
|
||||
auto &pptex = Textures[tex];
|
||||
if (!pptex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
|
|||
{
|
||||
if (!seg->linedef->isVisualPortal())
|
||||
{
|
||||
FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::mid), true);
|
||||
auto tex = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::mid), true);
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
// nothing to do here!
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ bool HWDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez, area_t in_
|
|||
if (sec->GetPlaneTexZ(sector_t::ceiling) == Planez)
|
||||
{
|
||||
// If there's a texture abort
|
||||
FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::top));
|
||||
auto tex = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::top));
|
||||
if (!tex || !tex->isValid()) continue;
|
||||
else return false;
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ bool HWDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez, area_t in_
|
|||
if (sec->GetPlaneTexZ(sector_t::floor) == Planez)
|
||||
{
|
||||
// If there's a texture abort
|
||||
FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom));
|
||||
auto tex = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::bottom));
|
||||
if (!tex || !tex->isValid()) continue;
|
||||
else return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -793,7 +793,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
if (isPicnumOverride)
|
||||
{
|
||||
// Animate picnum overrides.
|
||||
auto tex = TexMan.GetTexture(thing->picnum, true);
|
||||
auto tex = TexMan.GetGameTexture(thing->picnum, true);
|
||||
if (tex == nullptr) return;
|
||||
patch = tex->GetID();
|
||||
mirror = false;
|
||||
|
|
|
|||
|
|
@ -1238,7 +1238,7 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
// Set up the top
|
||||
//
|
||||
//
|
||||
FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::top), true);
|
||||
auto tex = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::top), true);
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
if (front->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
|
|
@ -1274,7 +1274,7 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
// Set up the bottom
|
||||
//
|
||||
//
|
||||
tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom), true);
|
||||
tex = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::bottom), true);
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
// texture is missing - use the lower plane
|
||||
|
|
@ -1543,7 +1543,7 @@ void HWWall::BuildFFBlock(HWDrawInfo *di, seg_t * seg, F3DFloor * rover,
|
|||
if (rover->flags&FF_UPPERTEXTURE)
|
||||
{
|
||||
gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::top), false, true);
|
||||
if (!gltexture) return;
|
||||
if (!gltexture) return;
|
||||
GetTexCoordInfo(gltexture, &tci, seg->sidedef, side_t::top);
|
||||
}
|
||||
else if (rover->flags&FF_LOWERTEXTURE)
|
||||
|
|
@ -2073,14 +2073,14 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
sector_t *backsec = isportal? seg->linedef->getPortalDestination()->frontsector : backsector;
|
||||
|
||||
bool drawfogboundary = !di->isFullbrightScene() && di->CheckFog(frontsector, backsec);
|
||||
FTexture *tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::mid), true);
|
||||
auto tex = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::mid), true);
|
||||
if (tex != NULL)
|
||||
{
|
||||
if (di->Level->i_compatflags & COMPATF_MASKEDMIDTEX)
|
||||
{
|
||||
tex = tex->GetRawTexture();
|
||||
}
|
||||
gltexture = FMaterial::ValidateTexture(tex, false);
|
||||
gltexture = FMaterial::ValidateTexture(tex->GetTexture(), false);
|
||||
}
|
||||
else gltexture = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ static bool isBright(DPSprite *psp)
|
|||
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr);
|
||||
if (lump.isValid())
|
||||
{
|
||||
FTexture * tex = TexMan.GetTexture(lump, true);
|
||||
auto tex = TexMan.GetGameTexture(lump, true);
|
||||
if (tex) disablefullbright = tex->isFullbrightDisabled();
|
||||
}
|
||||
return psp->GetState()->GetFullbright() && !disablefullbright;
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
// HIT_Wall must be checked for MBF-style sky transfers.
|
||||
if (texhitlist[i] & (FTextureManager::HIT_Sky | FTextureManager::HIT_Wall))
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
auto tex = TexMan.GameByIndex(i);
|
||||
if (tex->isSkybox())
|
||||
{
|
||||
FSkyBox *sb = static_cast<FSkyBox*>(tex);
|
||||
FSkyBox *sb = static_cast<FSkyBox*>(tex->GetTexture());
|
||||
for (int i = 0; i<6; i++)
|
||||
{
|
||||
if (sb->faces[i])
|
||||
|
|
@ -193,12 +193,12 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
// prepare the textures for precaching. First collect all used layer textures so that we know which ones should not be deleted.
|
||||
for (int i = cnt - 1; i >= 0; i--)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
auto tex = TexMan.GameByIndex(i);
|
||||
if (tex != nullptr)
|
||||
{
|
||||
if (texhitlist[i] & (FTextureManager::HIT_Wall | FTextureManager::HIT_Flat | FTextureManager::HIT_Sky))
|
||||
{
|
||||
FMaterial* mat = FMaterial::ValidateTexture(tex, false, false);
|
||||
FMaterial* mat = FMaterial::ValidateTexture(tex->GetTexture(), false, false);
|
||||
if (mat != nullptr)
|
||||
{
|
||||
for (auto ftex : mat->GetLayerArray())
|
||||
|
|
@ -209,7 +209,7 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
}
|
||||
if (spritehitlist[i] != nullptr && (*spritehitlist[i]).CountUsed() > 0)
|
||||
{
|
||||
FMaterial *mat = FMaterial::ValidateTexture(tex, true, false);
|
||||
FMaterial *mat = FMaterial::ValidateTexture(tex->GetTexture(), true, false);
|
||||
if (mat != nullptr)
|
||||
{
|
||||
for (auto ftex : mat->GetLayerArray())
|
||||
|
|
@ -224,16 +224,16 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
// delete unused textures (i.e. those which didn't get referenced by any material in the cache list.
|
||||
for (int i = cnt - 1; i >= 0; i--)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
auto tex = TexMan.GameByIndex(i);
|
||||
if (tex != nullptr && tex->GetUseType() != ETextureType::FontChar)
|
||||
{
|
||||
if (usedTextures.CheckKey(tex) == nullptr)
|
||||
if (usedTextures.CheckKey(tex->GetTexture()) == nullptr)
|
||||
{
|
||||
tex->CleanHardwareTextures(true, false);
|
||||
tex->GetTexture()->CleanHardwareTextures(true, false);
|
||||
}
|
||||
if (usedSprites.CheckKey(tex) == nullptr)
|
||||
if (usedSprites.CheckKey(tex->GetTexture()) == nullptr)
|
||||
{
|
||||
tex->CleanHardwareTextures(false, true);
|
||||
tex->GetTexture()->CleanHardwareTextures(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -249,7 +249,8 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
// cache all used textures
|
||||
for (int i = cnt - 1; i >= 0; i--)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
auto gtex = TexMan.GameByIndex(i);
|
||||
auto tex = gtex->GetTexture();
|
||||
if (tex != nullptr && tex->GetImage() != nullptr)
|
||||
{
|
||||
if (texhitlist[i] & (FTextureManager::HIT_Wall | FTextureManager::HIT_Flat | FTextureManager::HIT_Sky))
|
||||
|
|
@ -271,7 +272,8 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
// cache all used textures
|
||||
for (int i = cnt - 1; i >= 0; i--)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
auto gtex = TexMan.GameByIndex(i);
|
||||
auto tex = gtex->GetTexture();
|
||||
if (tex != nullptr)
|
||||
{
|
||||
PrecacheTexture(tex, texhitlist[i]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue