- got rid of the gl_info substructure in FTexture and moved all elements into the main class.

This commit is contained in:
Christoph Oelckers 2018-04-24 23:51:19 +02:00
commit e24b597ae4
5 changed files with 86 additions and 93 deletions

View file

@ -46,6 +46,7 @@
#include "v_video.h"
#include "m_fixed.h"
#include "textures/warpbuffer.h"
#include "hwrenderer/textures/hw_material.h"
FTexture *CreateBrightmapTexture(FTexture*);
@ -188,6 +189,7 @@ FTexture::FTexture (const char *name, int lumpnum)
bDisableFullbright = false;
bSkybox = false;
bNoCompress = false;
bNoExpand = false;
bTranslucent = -1;
@ -214,6 +216,16 @@ FTexture::~FTexture ()
if (link == this) Wads.SetLinkedTexture(SourceLump, nullptr);
if (areas != nullptr) delete[] areas;
areas = nullptr;
for (int i = 0; i < 2; i++)
{
if (Material[i] != nullptr) delete Material[i];
Material[i] = nullptr;
if (SystemTexture[i] != nullptr) delete SystemTexture[i];
SystemTexture[i] = nullptr;
}
}
void FTexture::Unload()
@ -1464,6 +1476,21 @@ bool FTexture::GetTranslucency()
return !!bTranslucent;
}
//===========================================================================
//
// Sprite adjust has changed.
// This needs to alter the material's sprite rect.
//
//===========================================================================
void FTexture::SetSpriteAdjust()
{
for (auto mat : Material)
{
if (mat != nullptr) mat->SetSpriteRect();
}
}
//===========================================================================
//
// empty stubs to be overloaded by child classes.

View file

@ -228,6 +228,9 @@ public:
int SourceLump;
FTextureID id;
FMaterial *Material[2] = { nullptr, nullptr };
IHardwareTexture *SystemTexture[2] = { nullptr, nullptr };
// None of the following pointers are owned by this texture, they are all controlled by the texture manager.
// Paletted variant
@ -265,6 +268,7 @@ public:
uint8_t bDisableFullbright : 1; // This texture will not be displayed as fullbright sprite
uint8_t bSkybox : 1; // is a cubic skybox
uint8_t bNoCompress : 1;
uint8_t bNoExpand : 1;
int8_t bTranslucent : 2;
bool bHiresHasColorKey = false; // Support for old color-keyed Doomsday textures
@ -446,7 +450,6 @@ protected:
CopySize(other);
bNoDecals = other->bNoDecals;
Rotations = other->Rotations;
gl_info = other->gl_info;
}
std::vector<uint32_t> PixelsBgra;
@ -481,16 +484,6 @@ public:
public:
struct GLTexInfo
{
FMaterial *Material[2] = { nullptr, nullptr };
IHardwareTexture *SystemTexture[2] = { nullptr, nullptr };
bool bNoExpand = false;
~GLTexInfo();
};
GLTexInfo gl_info;
void GetGlowColor(float *data);
bool isGlowing() { return bGlowing; }
bool isFullbright() { return bFullbright; }