- simplified the texture sampler setup.

DAMETH_CLAMPED was redundant and only causig problems.
This commit is contained in:
Christoph Oelckers 2020-06-02 16:55:02 +02:00
parent 1b12c08c66
commit 7638ead1c8
6 changed files with 8 additions and 9 deletions

View file

@ -1730,7 +1730,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
}
#endif
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetTexture(-1, tex, palid, 0, CLAMP_XY);
GLInterface.SetTexture(-1, tex, palid, CLAMP_XY);
if (tspr->clipdist & TSPR_FLAGS_MDHACK)
{

View file

@ -402,7 +402,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
bool success = GLInterface.SetTexture(globalpicnum, tileGetTexture(globalpicnum), palid, method, sampleroverride);
bool success = GLInterface.SetTexture(globalpicnum, tileGetTexture(globalpicnum), palid, sampleroverride);
if (!success)
{
tsiz.x = tsiz.y = 1;
@ -4352,7 +4352,7 @@ static void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype
//Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
hicprecaching = 1;
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
GLInterface.SetTexture(dapicnum, tileGetTexture(dapicnum), palid, 0, -1);
GLInterface.SetTexture(dapicnum, tileGetTexture(dapicnum), palid, CLAMP_NONE);
hicprecaching = 0;
if (datype == 0 || !hw_models) return;
@ -4367,7 +4367,7 @@ static void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype
{
auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i, nullptr);
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
if (tex) GLInterface.SetTexture(-1, tex, palid, 0, -1);
if (tex) GLInterface.SetTexture(-1, tex, palid, CLAMP_NONE);
}
}

View file

@ -1154,7 +1154,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
GLInterface.SetPalswap(globalpal);
// The texture here is already translated.
GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, 0, CLAMP_NOFILTER_XY);
GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, CLAMP_NOFILTER_XY);
// This must be done after setting up the texture.
auto& h = lookups.tables[globalpal];

View file

@ -61,13 +61,12 @@ OpenGLRenderer::FHardwareTexture* GLInstance::LoadTexture(FTexture *tex, int tex
return hwtex;
}
bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int method, int sampleroverride)
bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler)
{
TexturePick texpick;
if (!PickTexture(picnum, tex, paletteid, texpick)) return false;
int TextureType = (texpick.translation & 0x80000000) ? TT_INDEXED : TT_TRUECOLOR;
auto sampler = (method & DAMETH_CLAMPED) ? (sampleroverride != -1 ? sampleroverride : SamplerClampXY) : SamplerRepeat;
if (TextureType == TT_INDEXED)
{
sampler = sampler + SamplerNoFilterRepeat - SamplerRepeat;

View file

@ -499,7 +499,7 @@ public:
renderState.LookupTexture = tex;
}
bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int method, int sampleroverride);
bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int sampleroverride);
};
extern GLInstance GLInterface;

View file

@ -170,7 +170,7 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
SetFadeDisable(true);
SetShade(0, numshades);
SetTexture(TileFiles.GetTileIndex(tex), tex, cmd.mTranslationId, 0, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY);
SetTexture(TileFiles.GetTileIndex(tex), tex, cmd.mTranslationId, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY);
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
UseColorOnly(false);
}