- major dependency reduction of the texture system.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:00:07 +02:00
commit f8e9cb8fbc
103 changed files with 820 additions and 712 deletions

View file

@ -38,31 +38,25 @@
#include "files.h"
#include "filesystem.h"
#include "templates.h"
#include "r_data/r_translate.h"
#include "textures.h"
#include "bitmap.h"
#include "colormatcher.h"
#include "c_dispatch.h"
#include "v_video.h"
#include "m_fixed.h"
#include "hwrenderer/textures/hw_material.h"
#include "hwrenderer/textures/hw_ihwtexture.h"
#include "swrenderer/textures/r_swtexture.h"
#include "imagehelpers.h"
#include "image.h"
#include "formats/multipatchtexture.h"
#include "g_levellocals.h"
#include "texturemanager.h"
// Wrappers to keep the definitions of these classes out of here.
void DeleteMaterial(FMaterial* mat);
void DeleteSoftwareTexture(FSoftwareTexture *swtex);
FTexture *CreateBrightmapTexture(FImageSource*);
// Make sprite offset adjustment user-configurable per renderer.
int r_spriteadjustSW, r_spriteadjustHW;
CUSTOM_CVAR(Int, r_spriteadjust, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
r_spriteadjustHW = !!(self & 2);
r_spriteadjustSW = !!(self & 1);
TexMan.SpriteAdjustChanged();
}
//==========================================================================
//
@ -161,12 +155,12 @@ FTexture::~FTexture ()
for (int i = 0; i < 2; i++)
{
if (Material[i] != nullptr) delete Material[i];
if (Material[i] != nullptr) DeleteMaterial(Material[i]);
Material[i] = nullptr;
}
if (SoftwareTexture != nullptr)
{
delete SoftwareTexture;
DeleteSoftwareTexture(SoftwareTexture);
SoftwareTexture = nullptr;
}
}
@ -740,21 +734,6 @@ 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();
}
}
//===========================================================================
//
// the default just returns an empty texture.
@ -768,24 +747,6 @@ TArray<uint8_t> FTexture::Get8BitPixels(bool alphatex)
return Pixels;
}
//==========================================================================
//
//
//
//==========================================================================
FWrapperTexture::FWrapperTexture(int w, int h, int bits)
{
Width = w;
Height = h;
Format = bits;
UseType = ETextureType::SWCanvas;
bNoCompress = true;
auto hwtex = screen->CreateHardwareTexture();
// todo: Initialize here.
SystemTextures.AddHardwareTexture(0, false, hwtex);
}
//===========================================================================
//
// Coordinate helper.