From fe329b0870ede98c5ee8ee761186774a8c26f190 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Sep 2020 21:08:10 +0200 Subject: [PATCH] - fixed voxel rendering in palette emulation mode. --- source/build/src/voxmodel.cpp | 2 +- source/glbackend/gl_texture.cpp | 6 ++---- source/glbackend/glbackend.h | 2 +- source/glbackend/pm_renderstate.h | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index cc6ac7804..e74ba36bf 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -1151,7 +1151,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)*/, CLAMP_NOFILTER_XY); + GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, CLAMP_NOFILTER_XY, true); // This must be done after setting up the texture. auto& h = lookups.tables[globalpal]; diff --git a/source/glbackend/gl_texture.cpp b/source/glbackend/gl_texture.cpp index 1eeadee8a..8420284d7 100644 --- a/source/glbackend/gl_texture.cpp +++ b/source/glbackend/gl_texture.cpp @@ -56,7 +56,7 @@ CVAR(Int, fixpalette, -1, 0) CVAR(Int, fixpalswap, -1, 0) #endif -bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler) +bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler, bool notindexed) { #ifdef _DEBUG int basepal = GetTranslationType(paletteid) - Translation_Remap; @@ -83,14 +83,12 @@ bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sa SetBasepalTint(texpick.basepalTint); auto &mat = renderState.mMaterial; - int flags = hw_useindexedcolortextures ? CTF_Indexed : 0; + int flags = (!notindexed && hw_useindexedcolortextures) ? CTF_Indexed : 0; mat.mMaterial = FMaterial::ValidateTexture(texpick.texture, flags); // todo allow scaling mat.mClampMode = sampler; mat.mTranslation = texpick.translation; mat.mOverrideShader = -1; mat.mChanged = true; - if (TextureType == TT_INDEXED) renderState.Flags |= RF_UsePalette; - else renderState.Flags &= ~RF_UsePalette; GLInterface.SetAlphaThreshold(tex->alphaThreshold); return true; } diff --git a/source/glbackend/glbackend.h b/source/glbackend/glbackend.h index ebc8d3647..952b752f4 100644 --- a/source/glbackend/glbackend.h +++ b/source/glbackend/glbackend.h @@ -351,7 +351,7 @@ public: renderState.AlphaThreshold = al; } - bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int sampleroverride); + bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int sampleroverride, bool notindexed = false); }; extern GLInstance GLInterface; diff --git a/source/glbackend/pm_renderstate.h b/source/glbackend/pm_renderstate.h index a30c35d52..ffa3b10ed 100644 --- a/source/glbackend/pm_renderstate.h +++ b/source/glbackend/pm_renderstate.h @@ -16,7 +16,6 @@ enum EMatrixType enum PRSFlags { RF_ColorOnly = 1, - RF_UsePalette = 2, RF_ShadeInterpolate = 64, RF_FogDisabled = 128, RF_MapFog = 256, // RRRA E2L1.