mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- reimplemented the GetRawTexture redirect.
This commit is contained in:
parent
1aba33122b
commit
dc9c7afa24
3 changed files with 20 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "sc_man.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -28,6 +29,7 @@ struct TexPart
|
|||
|
||||
class FMultiPatchTexture : public FImageSource
|
||||
{
|
||||
friend class FTexture;
|
||||
public:
|
||||
FMultiPatchTexture(int w, int h, const TArray<TexPart> &parts, bool complex, bool textual);
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "swrenderer/textures/r_swtexture.h"
|
||||
#include "imagehelpers.h"
|
||||
#include "image.h"
|
||||
#include "formats/multipatchtexture.h"
|
||||
|
||||
FTexture *CreateBrightmapTexture(FImageSource*);
|
||||
|
||||
|
@ -221,7 +222,20 @@ FBitmap FTexture::GetBgraBitmap(PalEntry *remap, int *ptrans)
|
|||
|
||||
FTexture *FTexture::GetRawTexture()
|
||||
{
|
||||
return this;
|
||||
if (OffsetLess) return OffsetLess;
|
||||
// Reject anything that cannot have been a single-patch multipatch texture in vanilla.
|
||||
auto image = static_cast<FMultiPatchTexture *>(GetImage());
|
||||
if (bMultiPatch != 1 || UseType != ETextureType::Wall || Scale.X != 1 || Scale.Y != 1 || bWorldPanning || image == nullptr || image->NumParts != 1)
|
||||
{
|
||||
OffsetLess = this;
|
||||
return this;
|
||||
}
|
||||
// Set up a new texture that directly references the underlying patch.
|
||||
// From here we cannot retrieve the original texture made for it, so just create a new one.
|
||||
FImageSource *source = image->Parts[0].Image;
|
||||
OffsetLess = new FImageTexture(source, "");
|
||||
TexMan.AddTexture(OffsetLess);
|
||||
return OffsetLess;
|
||||
}
|
||||
|
||||
void FTexture::SetScaledSize(int fitwidth, int fitheight)
|
||||
|
|
|
@ -338,7 +338,7 @@ public:
|
|||
int GetSkyOffset() const { return SkyOffset; }
|
||||
FTextureID GetID() const { return id; }
|
||||
PalEntry GetSkyCapColor(bool bottom);
|
||||
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
||||
FTexture *GetRawTexture();
|
||||
virtual int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
|
||||
void GetGlowColor(float *data);
|
||||
bool isGlowing() const { return bGlowing; }
|
||||
|
@ -371,11 +371,12 @@ protected:
|
|||
public:
|
||||
FHardwareTextureContainer SystemTextures;
|
||||
protected:
|
||||
//IHardwareTexture *SystemTexture[2] = { nullptr, nullptr };
|
||||
FSoftwareTexture *SoftwareTexture = nullptr;
|
||||
|
||||
// None of the following pointers are owned by this texture, they are all controlled by the texture manager.
|
||||
|
||||
// Offset-less version for COMPATF_MASKEDMIDTEX
|
||||
FTexture *OffsetLess = nullptr;
|
||||
// Paletted variant
|
||||
FTexture *PalVersion = nullptr;
|
||||
// External hires texture
|
||||
|
|
Loading…
Reference in a new issue