From ea05417c3686af4b695af3bb59eb3a0b5dec94ec Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 11 Dec 2009 22:43:27 +0000 Subject: [PATCH] - 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 --- src/gl/textures/gl_material.cpp | 16 ++++++++-------- src/gl/textures/gl_material.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 4fd59b78..ac59bddf 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -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;igl_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; } } diff --git a/src/gl/textures/gl_material.h b/src/gl/textures/gl_material.h index 850223b5..506702f2 100644 --- a/src/gl/textures/gl_material.h +++ b/src/gl/textures/gl_material.h @@ -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)