mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- thinned out the Texturemanager interface.
This commit is contained in:
parent
437d4f8af0
commit
f5d5888c22
5 changed files with 20 additions and 33 deletions
|
@ -79,6 +79,7 @@ FMaterial::FMaterial(FGameTexture * tx, bool expanded)
|
|||
|
||||
// Note that these layers must present a valid texture even if not used, because empty TMUs in the shader are an undefined condition.
|
||||
imgtex->CreateDefaultBrightmap();
|
||||
auto placeholder = TexMan.GameByIndex(1);
|
||||
if (imgtex->Brightmap)
|
||||
{
|
||||
mTextureLayers.Push(imgtex->Brightmap);
|
||||
|
@ -86,7 +87,7 @@ FMaterial::FMaterial(FGameTexture * tx, bool expanded)
|
|||
}
|
||||
else
|
||||
{
|
||||
mTextureLayers.Push(TexMan.ByIndex(1));
|
||||
mTextureLayers.Push(placeholder->GetTexture());
|
||||
}
|
||||
if (imgtex->Detailmap)
|
||||
{
|
||||
|
@ -95,7 +96,7 @@ FMaterial::FMaterial(FGameTexture * tx, bool expanded)
|
|||
}
|
||||
else
|
||||
{
|
||||
mTextureLayers.Push(TexMan.ByIndex(1));
|
||||
mTextureLayers.Push(placeholder->GetTexture());
|
||||
}
|
||||
if (imgtex->Glowmap)
|
||||
{
|
||||
|
@ -104,7 +105,7 @@ FMaterial::FMaterial(FGameTexture * tx, bool expanded)
|
|||
}
|
||||
else
|
||||
{
|
||||
mTextureLayers.Push(TexMan.ByIndex(1));
|
||||
mTextureLayers.Push(placeholder->GetTexture());
|
||||
}
|
||||
|
||||
if (imgtex->shaderindex >= FIRST_USER_SHADER)
|
||||
|
|
|
@ -119,6 +119,7 @@ FTexture::FTexture (const char *name, int lumpnum)
|
|||
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMultiPatch(false), bFullNameTexture(false),
|
||||
Rotations(0xFFFF), SkyOffset(0), Width(0), Height(0)
|
||||
{
|
||||
tempGameTexture = reinterpret_cast<FGameTexture*>(this);
|
||||
bBrightmapChecked = false;
|
||||
bGlowing = false;
|
||||
bAutoGlowing = false;
|
||||
|
@ -385,11 +386,11 @@ void FTexture::AddAutoMaterials()
|
|||
auto lump = fileSystem.CheckNumForFullName(lookup, false, ns_global, true);
|
||||
if (lump != -1)
|
||||
{
|
||||
auto bmtex = TexMan.FindTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
if (bmtex != nullptr)
|
||||
{
|
||||
bmtex->bMasked = false;
|
||||
this->*(layer.pointer) = bmtex;
|
||||
bmtex->GetTexture()->bMasked = false;
|
||||
this->*(layer.pointer) = bmtex->GetTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -332,10 +332,10 @@ FTextureID FTextureManager::GetTextureID (const char *name, ETextureType usetype
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FTextureManager::FindTexture(const char *texname, ETextureType usetype, BITFIELD flags)
|
||||
FGameTexture *FTextureManager::FindGameTexture(const char *texname, ETextureType usetype, BITFIELD flags)
|
||||
{
|
||||
FTextureID texnum = CheckForTexture (texname, usetype, flags);
|
||||
return GetTexture(texnum.GetIndex());
|
||||
return GetGameTexture(texnum.GetIndex());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -24,52 +24,37 @@ public:
|
|||
private:
|
||||
int ResolveLocalizedTexture(int texnum);
|
||||
|
||||
FTexture *InternalGetTexture(int texnum, bool animate, bool localize)
|
||||
FGameTexture *InternalGetTexture(int texnum, bool animate, bool localize)
|
||||
{
|
||||
if ((unsigned)texnum >= Textures.Size()) return nullptr;
|
||||
if (animate) texnum = Translation[texnum];
|
||||
if (localize && Textures[texnum].HasLocalization) texnum = ResolveLocalizedTexture(texnum);
|
||||
return Textures[texnum].Texture->GetTexture();
|
||||
return Textures[texnum].Texture;
|
||||
}
|
||||
public:
|
||||
// This only gets used in UI code so we do not need PALVERS handling.
|
||||
FTexture *GetTextureByName(const char *name, bool animate = false)
|
||||
{
|
||||
FTextureID texnum = GetTextureID (name, ETextureType::MiscPatch);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
||||
}
|
||||
|
||||
FGameTexture* GetGameTextureByName(const char *name, bool animate = false)
|
||||
{
|
||||
return reinterpret_cast<FGameTexture*>(GetTextureByName(name, animate));
|
||||
FTextureID texnum = GetTextureID(name, ETextureType::MiscPatch);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
||||
}
|
||||
|
||||
FTexture *GetTexture(FTextureID texnum, bool animate = false)
|
||||
{
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true)->GetTexture();
|
||||
}
|
||||
|
||||
FGameTexture* GetGameTexture(FTextureID texnum, bool animate = false)
|
||||
{
|
||||
return reinterpret_cast<FGameTexture*>(GetTexture(texnum, animate));
|
||||
}
|
||||
|
||||
FTexture *ByIndex(int i, bool animate = false)
|
||||
{
|
||||
return InternalGetTexture(i, animate, true);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
||||
}
|
||||
|
||||
FGameTexture* GameByIndex(int i, bool animate = false)
|
||||
{
|
||||
return reinterpret_cast<FGameTexture*>(ByIndex(i, animate));
|
||||
return InternalGetTexture(i, animate, true);
|
||||
}
|
||||
|
||||
FTexture *FindTexture(const char *texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
|
||||
|
||||
FGameTexture* FindGameTexture(const char* texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny)
|
||||
{
|
||||
return reinterpret_cast<FGameTexture*>(FindTexture(texname, usetype, flags));
|
||||
}
|
||||
FGameTexture* FindGameTexture(const char* texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
|
||||
|
||||
bool OkForLocalization(FTextureID texnum, const char *substitute, int locnum);
|
||||
|
||||
|
|
|
@ -90,13 +90,13 @@ static void ParseVavoomSkybox()
|
|||
|
||||
maplump = fileSystem.CheckNumForFullName(sc.String, true);
|
||||
|
||||
FTexture *tex = TexMan.FindTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
|
||||
auto tex = TexMan.FindGameTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
|
||||
if (tex == NULL)
|
||||
{
|
||||
sc.ScriptMessage("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->GetName().GetChars());
|
||||
error = true;
|
||||
}
|
||||
sb->faces[facecount] = tex;
|
||||
sb->faces[facecount] = tex->GetTexture();
|
||||
sc.MustGetStringName("}");
|
||||
}
|
||||
facecount++;
|
||||
|
|
Loading…
Reference in a new issue