mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- moved gl_use_hires check back into material class and cleaned up the interface a bit.
The function is supposed to be a worker, nothing more and its result should only depend on its arguments.
This commit is contained in:
parent
c60c025554
commit
0ae371f3ce
3 changed files with 11 additions and 17 deletions
|
@ -50,6 +50,7 @@
|
|||
EXTERN_CVAR(Bool, gl_render_precise)
|
||||
EXTERN_CVAR(Int, gl_lightmode)
|
||||
EXTERN_CVAR(Bool, gl_precache)
|
||||
EXTERN_CVAR(Bool, gl_texture_usehires)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -141,7 +142,7 @@ FHardwareTexture *FGLTexture::CreateHwTexture()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int translation, FTexture *hirescheck)
|
||||
const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int translation, int flags)
|
||||
{
|
||||
int usebright = false;
|
||||
|
||||
|
@ -179,11 +180,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
|
|||
|
||||
if (!tex->bHasCanvas)
|
||||
{
|
||||
int flags = CTF_ProcessData;
|
||||
if (bExpandFlag) flags |= CTF_Expand;
|
||||
if (hirescheck) flags |= CTF_CheckHires;
|
||||
|
||||
buffer = tex->CreateTexBuffer(translation, w, h, flags);
|
||||
buffer = tex->CreateTexBuffer(translation, w, h, flags | CTF_ProcessData);
|
||||
if (tex->bWarped && gl.legacyMode && w*h <= 256*256) // do not software-warp larger textures, especially on the old systems that still need this fallback.
|
||||
{
|
||||
// need to do software warping
|
||||
|
@ -486,8 +483,8 @@ void FMaterial::SetSpriteRect()
|
|||
|
||||
//===========================================================================
|
||||
//
|
||||
// Finds gaps in the texture which can be skipped by the renderer
|
||||
// This was mainly added to speed up one area in E4M6 of 007LTSD
|
||||
// Finds empty space around the texture.
|
||||
// Used for sprites that got placed into a huge empty frame.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
@ -607,12 +604,14 @@ void FMaterial::Bind(int clampmode, int translation)
|
|||
|
||||
int usebright = false;
|
||||
int maxbound = 0;
|
||||
bool allowhires = tex->Scale.X == 1 && tex->Scale.Y == 1 && clampmode <= CLAMP_XY && !mExpanded;
|
||||
|
||||
if (tex->bHasCanvas) clampmode = CLAMP_CAMTEX;
|
||||
else if (tex->bWarped && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE;
|
||||
|
||||
const FHardwareTexture *gltexture = mBaseLayer->Bind(0, clampmode, translation, allowhires? tex:NULL);
|
||||
// Textures that are already scaled in the texture lump will not get replaced by hires textures.
|
||||
int flags = mExpanded? CTF_Expand : (gl_texture_usehires && tex->Scale.X == 1 && tex->Scale.Y == 1 && clampmode <= CLAMP_XY)? CTF_CheckHires : 0;
|
||||
|
||||
const FHardwareTexture *gltexture = mBaseLayer->Bind(0, clampmode, translation, flags);
|
||||
if (gltexture != NULL)
|
||||
{
|
||||
for(unsigned i=0;i<mTextureLayers.Size();i++)
|
||||
|
|
|
@ -59,13 +59,12 @@ public:
|
|||
private:
|
||||
FHardwareTexture *mHwTexture;
|
||||
|
||||
bool bExpandFlag;
|
||||
uint8_t lastSampler;
|
||||
int lastTranslation;
|
||||
|
||||
FHardwareTexture *CreateHwTexture();
|
||||
|
||||
const FHardwareTexture *Bind(int texunit, int clamp, int translation, FTexture *hirescheck);
|
||||
const FHardwareTexture *Bind(int texunit, int clamp, int translation, int flags);
|
||||
|
||||
public:
|
||||
FGLTexture(FTexture * tx, bool expandpatches);
|
||||
|
@ -73,8 +72,6 @@ public:
|
|||
|
||||
void Clean(bool all);
|
||||
void CleanUnused(SpriteHits &usedtranslations);
|
||||
int Dump(int i);
|
||||
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -59,8 +59,6 @@ CUSTOM_CVAR(Int, r_spriteadjust, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
TexMan.SpriteAdjustChanged();
|
||||
}
|
||||
|
||||
EXTERN_CVAR(Bool, gl_texture_usehires)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -1357,7 +1355,7 @@ unsigned char * FTexture::CreateTexBuffer(int translation, int & w, int & h, int
|
|||
|
||||
// Textures that are already scaled in the texture lump will not get replaced
|
||||
// by hires textures
|
||||
if (gl_texture_usehires && (flags & CTF_CheckHires) && translation != STRange_AlphaTexture)
|
||||
if ((flags & CTF_CheckHires) && translation != STRange_AlphaTexture)
|
||||
{
|
||||
buffer = LoadHiresTexture(&w, &h);
|
||||
if (buffer)
|
||||
|
|
Loading…
Reference in a new issue