- fixed indexed display of 2D content.

This commit is contained in:
Christoph Oelckers 2020-05-29 16:46:36 +02:00
parent 87a87c155d
commit 66809ca9f4
5 changed files with 16 additions and 10 deletions

View file

@ -1726,7 +1726,8 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
}
glow = hw_glowmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, GLOWPAL, surfi, nullptr) : 0;
}
GLInterface.SetModelTexture(tex, globalpal, det, detscale, glow);
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetModelTexture(tex, palid, det, detscale, glow);
if (tspr->clipdist & TSPR_FLAGS_MDHACK)
{

View file

@ -426,7 +426,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
else if (drawpoly_trepeat) sampleroverride = SamplerClampX;
else sampleroverride = SamplerClampXY;
bool success = GLInterface.SetTexture(globalpicnum, tileGetTexture(globalpicnum), globalpal, method, sampleroverride);
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
bool success = GLInterface.SetTexture(globalpicnum, tileGetTexture(globalpicnum), palid, method, sampleroverride);
if (!success)
{
tsiz.x = tsiz.y = 1;
@ -4551,7 +4552,8 @@ 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;
GLInterface.SetTexture(dapicnum, tileGetTexture(dapicnum), dapalnum, 0, -1);
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
GLInterface.SetTexture(dapicnum, tileGetTexture(dapicnum), palid, 0, -1);
hicprecaching = 0;
if (datype == 0 || !hw_models) return;
@ -4565,7 +4567,8 @@ static void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype
for (int i = 0; i <= surfaces; i++)
{
auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i, nullptr);
if (tex) GLInterface.SetTexture(-1, tex, dapalnum, 0, -1);
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
if (tex) GLInterface.SetTexture(-1, tex, palid, 0, -1);
}
}

View file

@ -59,7 +59,7 @@
//#include "r_data/models/models.h"
#include "gl/renderer/gl_postprocessstate.h"
#include "gl/system/gl_buffers.h"
#include "../glbackend/gl_hwtexture.h"
#include "gl_hwtexture.h"
#include "build.h"
EXTERN_CVAR(Int, screenblocks)

View file

@ -201,9 +201,11 @@ TexturePick PickTexture(int tilenum, int basepal, int palette)
}
#endif
bool GLInstance::SetTextureInternal(int picnum, FGameTexture* tex, int palette, int method, int sampleroverride, FGameTexture *det, float detscale, FGameTexture *glow)
bool GLInstance::SetTextureInternal(int picnum, FGameTexture* tex, int paletteid, int method, int sampleroverride, FGameTexture *det, float detscale, FGameTexture *glow)
{
if (tex->GetTexelWidth() <= 0 || tex->GetTexelHeight() <= 0) return false;
int curbasepal = GetTranslationType(paletteid) - Translation_Remap;
int palette = GetTranslationIndex(paletteid);
int usepalette = fixpalette >= 0 ? fixpalette : curbasepal;
int usepalswap = fixpalswap >= 0 ? fixpalswap : palette;
GLInterface.SetPalette(usepalette);

View file

@ -166,9 +166,10 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
{
auto tex = cmd.mTexture;
SetFadeDisable(true);
SetShade(0, numshades);
SetNamedTexture(cmd.mTexture, cmd.mTranslationId, cmd.mFlags & F2DDrawer::DTF_Wrap ? SamplerRepeat : SamplerClampXY);
SetFadeDisable(true);
SetShade(0, numshades);
SetTexture(TileFiles.GetTileIndex(cmd.mTexture), cmd.mTexture, cmd.mTranslationId, 0, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY);
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
UseColorOnly(false);
}
@ -180,7 +181,6 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
switch (cmd.mType)
{
case F2DDrawer::DrawTypeTriangles:
case F2DDrawer::DrawTypeRotateSprite:
DrawElement(DT_TRIANGLES, cmd.mIndexIndex, cmd.mIndexCount, renderState);
break;