- got rid of the RF_NPOTEmulation flag.

This can easily be controlled with the 2 main variables alone.
This commit is contained in:
Christoph Oelckers 2020-06-07 09:30:55 +02:00
parent 353e3eb1fa
commit 60d7f4f7c2
4 changed files with 8 additions and 15 deletions

View file

@ -424,16 +424,16 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
int32_t size2; int32_t size2;
for (size2 = 1; size2 < size; size2 += size2) {} for (size2 = 1; size2 < size; size2 += size2) {}
if (size == size2) if (size == size2)
GLInterface.SetNpotEmulation(false, 1.f, 0.f); GLInterface.SetNpotEmulation(0.f, 0.f);
else else
{ {
float xOffset = 1.f / tilesize.x; float xOffset = 1.f / tilesize.x;
GLInterface.SetNpotEmulation(true, (1.f*size2) / size, xOffset); GLInterface.SetNpotEmulation((1.f*size2) / size, xOffset);
} }
} }
else else
{ {
GLInterface.SetNpotEmulation(false, 1.f, 0.f); GLInterface.SetNpotEmulation(0.f, 0.f);
} }
vec2_t tsiz2 = tsiz; vec2_t tsiz2 = tsiz;
@ -491,7 +491,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
GLInterface.SetTinting(-1, 0xffffff, 0xffffff); GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
GLInterface.UseDetailMapping(false); GLInterface.UseDetailMapping(false);
GLInterface.UseGlowMapping(false); GLInterface.UseGlowMapping(false);
GLInterface.SetNpotEmulation(false, 1.f, 0.f); GLInterface.SetNpotEmulation(0.f, 0.f);
if (skyzbufferhack && skyzbufferhack_pass == 0) if (skyzbufferhack && skyzbufferhack_pass == 0)
{ {

View file

@ -407,15 +407,10 @@ public:
else renderState.Flags &= ~RF_Brightmapping; else renderState.Flags &= ~RF_Brightmapping;
} }
void SetNpotEmulation(bool yes, float factor, float xOffset) void SetNpotEmulation(float factor, float xOffset)
{ {
if (yes) renderState.NPOTEmulationFactor = factor;
{ renderState.NPOTEmulationXOffset = xOffset;
renderState.Flags |= RF_NPOTEmulation;
renderState.NPOTEmulationFactor = factor;
renderState.NPOTEmulationXOffset = xOffset;
}
else renderState.Flags &= ~RF_NPOTEmulation;
} }
void SetShadeInterpolate(int32_t yes) void SetShadeInterpolate(int32_t yes)

View file

@ -21,7 +21,6 @@ enum PRSFlags
RF_DetailMapping = 4, RF_DetailMapping = 4,
RF_GlowMapping = 8, RF_GlowMapping = 8,
RF_Brightmapping = 16, RF_Brightmapping = 16,
RF_NPOTEmulation = 32,
RF_ShadeInterpolate = 64, RF_ShadeInterpolate = 64,
RF_FogDisabled = 128, RF_FogDisabled = 128,
RF_MapFog = 256, // RRRA E2L1. RF_MapFog = 256, // RRRA E2L1.

View file

@ -3,7 +3,6 @@ const int RF_UsePalette = 2;
const int RF_DetailMapping = 4; const int RF_DetailMapping = 4;
const int RF_GlowMapping = 8; const int RF_GlowMapping = 8;
const int RF_Brightmapping = 16; const int RF_Brightmapping = 16;
const int RF_NPOTEmulation = 32;
const int RF_ShadeInterpolate = 64; const int RF_ShadeInterpolate = 64;
@ -163,7 +162,7 @@ void main()
vec2 newCoord; vec2 newCoord;
// Coordinate adjustment for NPOT textures (something must have gone very wrong to make this necessary...) // Coordinate adjustment for NPOT textures (something must have gone very wrong to make this necessary...)
if ((u_flags & RF_NPOTEmulation) != 0) if (u_npotEmulationFactor != 0.0)
{ {
float period = floor(coordY / u_npotEmulationFactor); float period = floor(coordY / u_npotEmulationFactor);
coordX += u_npotEmulationXOffset * floor(mod(coordY, u_npotEmulationFactor)); coordX += u_npotEmulationXOffset * floor(mod(coordY, u_npotEmulationFactor));