- fixed: For hires replacements on redirected textures the composite texture must be checked, not the patch.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@654 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-12-11 22:43:27 +00:00
parent fa60c5d14f
commit ea05417c36
2 changed files with 12 additions and 12 deletions

View file

@ -110,7 +110,7 @@ FGLTexture::~FGLTexture()
// Checks for the presence of a hires texture replacement and loads it
//
//==========================================================================
unsigned char *FGLTexture::LoadHiresTexture(int *width, int *height, int cm)
unsigned char *FGLTexture::LoadHiresTexture(FTexture *tex, int *width, int *height, int cm)
{
if (HiresLump==-1)
{
@ -272,7 +272,7 @@ BYTE *FGLTexture::WarpBuffer(BYTE *buffer, int Width, int Height, int warp)
//
//===========================================================================
unsigned char * FGLTexture::CreateTexBuffer(int _cm, int translation, int & w, int & h, bool expand, bool allowhires, int warp)
unsigned char * FGLTexture::CreateTexBuffer(int _cm, int translation, int & w, int & h, bool expand, FTexture *hirescheck, int warp)
{
unsigned char * buffer;
intptr_t cm = _cm;
@ -281,9 +281,9 @@ unsigned char * FGLTexture::CreateTexBuffer(int _cm, int translation, int & w, i
// Textures that are already scaled in the texture lump will not get replaced
// by hires textures
if (gl_texture_usehires && allowhires)
if (gl_texture_usehires && hirescheck != NULL)
{
buffer = LoadHiresTexture (&w, &h, _cm);
buffer = LoadHiresTexture (hirescheck, &w, &h, _cm);
if (buffer)
{
return buffer;
@ -388,7 +388,7 @@ bool FGLTexture::CreatePatch()
//
//===========================================================================
const FHardwareTexture *FGLTexture::Bind(int texunit, int cm, int clampmode, int translation, bool allowhires, int warp)
const FHardwareTexture *FGLTexture::Bind(int texunit, int cm, int clampmode, int translation, FTexture *hirescheck, int warp)
{
int usebright = false;
@ -435,7 +435,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int cm, int clampmode, int
if (!tex->bHasCanvas)
{
buffer = CreateTexBuffer(cm, translation, w, h, false, allowhires, warp);
buffer = CreateTexBuffer(cm, translation, w, h, false, hirescheck, warp);
tex->ProcessData(buffer, w, h, false);
}
if (!hwtex->CreateTexture(buffer, w, h, true, texunit, cm, translation))
@ -664,7 +664,7 @@ const WorldTextureInfo *FMaterial::Bind(int cm, int clampmode, int translation)
else if (clampmode != -1) clampmode &= 3;
else clampmode = 4;
wti.gltexture = mBaseLayer->Bind(0, cm, clampmode, translation, allowhires, softwarewarp);
wti.gltexture = mBaseLayer->Bind(0, cm, clampmode, translation, allowhires? tex:NULL, softwarewarp);
if (wti.gltexture != NULL && shaderindex > 0)
{
for(unsigned i=0;i<mTextureLayers.Size();i++)
@ -680,7 +680,7 @@ const WorldTextureInfo *FMaterial::Bind(int cm, int clampmode, int translation)
{
layer = mTextureLayers[i].texture;
}
layer->gl_info.SystemTexture->Bind(i+1, CM_DEFAULT, clampmode, 0, allowhires, false);
layer->gl_info.SystemTexture->Bind(i+1, CM_DEFAULT, clampmode, 0, NULL, false);
maxbound = i+1;
}
}

View file

@ -89,21 +89,21 @@ private:
bool bExpand;
float AlphaThreshold;
unsigned char * LoadHiresTexture(int *width, int *height, int cm);
unsigned char * LoadHiresTexture(FTexture *hirescheck, int *width, int *height, int cm);
BYTE *WarpBuffer(BYTE *buffer, int Width, int Height, int warp);
FHardwareTexture *CreateTexture(int clampmode);
//bool CreateTexture();
bool CreatePatch();
const FHardwareTexture *Bind(int texunit, int cm, int clamp, int translation, bool allowhires, int warp);
const FHardwareTexture *Bind(int texunit, int cm, int clamp, int translation, FTexture *hirescheck, int warp);
const FHardwareTexture *BindPatch(int texunit, int cm, int translation, int warp);
public:
FGLTexture(FTexture * tx, bool expandpatches);
~FGLTexture();
unsigned char * CreateTexBuffer(int cm, int translation, int & w, int & h, bool expand, bool allowhires, int warp);
unsigned char * CreateTexBuffer(int cm, int translation, int & w, int & h, bool expand, FTexture *hirescheck, int warp);
void Clean(bool all);
int Dump(int i);
@ -161,7 +161,7 @@ public:
unsigned char * CreateTexBuffer(int cm, int translation, int & w, int & h, bool expand = false, bool allowhires=true)
{
return mBaseLayer->CreateTexBuffer(cm, translation, w, h, expand, allowhires, 0);
return mBaseLayer->CreateTexBuffer(cm, translation, w, h, expand, allowhires? tex:NULL, 0);
}
void Clean(bool f)