mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 08:30:50 +00:00
Let FSkyboxTexture map to the last defined regular texture of the same name instead of its first face
This is normally a better fallback for the software renderer.
This commit is contained in:
parent
0d07fb2550
commit
91bb7c0641
3 changed files with 32 additions and 17 deletions
|
@ -102,7 +102,10 @@ static void ParseVavoomSkybox()
|
||||||
sc.ScriptError("%s: Skybox definition requires 6 faces", sb->GetName().GetChars());
|
sc.ScriptError("%s: Skybox definition requires 6 faces", sb->GetName().GetChars());
|
||||||
}
|
}
|
||||||
sb->SetSize();
|
sb->SetSize();
|
||||||
if (!error) TexMan.AddTexture(sb);
|
if (!error)
|
||||||
|
{
|
||||||
|
TexMan.AddTexture(sb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,8 +967,7 @@ class GLDefsParser
|
||||||
|
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
|
|
||||||
FSkyBox * sb = new FSkyBox;
|
FSkyBox * sb = new FSkyBox(sc.String);
|
||||||
sb->Name = sc.String;
|
|
||||||
sb->Name.ToUpper();
|
sb->Name.ToUpper();
|
||||||
if (sc.CheckString("fliptop"))
|
if (sc.CheckString("fliptop"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,13 @@
|
||||||
FSkyBox::FSkyBox(const char *name)
|
FSkyBox::FSkyBox(const char *name)
|
||||||
: FTexture(name)
|
: FTexture(name)
|
||||||
{
|
{
|
||||||
faces[0]=faces[1]=faces[2]=faces[3]=faces[4]=faces[5]=NULL;
|
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::Wall);
|
||||||
|
if (texid.isValid())
|
||||||
|
{
|
||||||
|
previous = TexMan.GetTexture(texid);
|
||||||
|
CopySize(previous);
|
||||||
|
}
|
||||||
|
faces[0]=faces[1]=faces[2]=faces[3]=faces[4]=faces[5] = nullptr;
|
||||||
UseType = ETextureType::Override;
|
UseType = ETextureType::Override;
|
||||||
bSkybox = true;
|
bSkybox = true;
|
||||||
fliptop = false;
|
fliptop = false;
|
||||||
|
@ -51,8 +57,7 @@ FSkyBox::FSkyBox(const char *name)
|
||||||
|
|
||||||
TArray<uint8_t> FSkyBox::Get8BitPixels(bool alphatex)
|
TArray<uint8_t> FSkyBox::Get8BitPixels(bool alphatex)
|
||||||
{
|
{
|
||||||
if (faces[0]) return faces[0]->Get8BitPixels(alphatex);
|
return previous->Get8BitPixels(alphatex);
|
||||||
return FTexture::Get8BitPixels(alphatex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -63,7 +68,16 @@ TArray<uint8_t> FSkyBox::Get8BitPixels(bool alphatex)
|
||||||
|
|
||||||
FBitmap FSkyBox::GetBgraBitmap(PalEntry *p, int *trans)
|
FBitmap FSkyBox::GetBgraBitmap(PalEntry *p, int *trans)
|
||||||
{
|
{
|
||||||
if (faces[0]) return faces[0]->GetBgraBitmap(p, trans);
|
return previous->GetBgraBitmap(p, trans);
|
||||||
return FTexture::GetBgraBitmap(p, trans);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
FImageSource *FSkyBox::GetImage() const
|
||||||
|
{
|
||||||
|
return previous->GetImage();
|
||||||
|
}
|
||||||
|
|
|
@ -12,18 +12,22 @@ class FSkyBox : public FTexture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
FTexture *previous;
|
||||||
FTexture * faces[6];
|
FTexture * faces[6];
|
||||||
bool fliptop;
|
bool fliptop;
|
||||||
|
|
||||||
FSkyBox(const char *name = nullptr);
|
FSkyBox(const char *name);
|
||||||
TArray<uint8_t> Get8BitPixels(bool alphatex);
|
TArray<uint8_t> Get8BitPixels(bool alphatex);
|
||||||
FBitmap GetBgraBitmap(PalEntry *, int *trans) override;
|
FBitmap GetBgraBitmap(PalEntry *, int *trans) override;
|
||||||
|
FImageSource *GetImage() const override;
|
||||||
|
|
||||||
|
|
||||||
void SetSize()
|
void SetSize()
|
||||||
{
|
{
|
||||||
if (faces[0])
|
if (!previous && faces[0]) previous = faces[0];
|
||||||
|
if (previous)
|
||||||
{
|
{
|
||||||
CopySize(faces[0]);
|
CopySize(previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +40,4 @@ public:
|
||||||
{
|
{
|
||||||
return fliptop;
|
return fliptop;
|
||||||
}
|
}
|
||||||
|
|
||||||
FImageSource *GetImage() const override
|
|
||||||
{
|
|
||||||
return faces[0] ? faces[0]->GetImage() : nullptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue