mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- moved the ShadeDiv array into the lookup table and took the numshades-2 divisor out of the stored value.
The value was changed to allow easier reuse in scenarios where the size of the shade table does not matter anymore.
This commit is contained in:
parent
0bd460d9e3
commit
f159496f6e
5 changed files with 8 additions and 9 deletions
|
@ -53,6 +53,7 @@ struct LookupTable
|
|||
{
|
||||
FString Shades;
|
||||
PalEntry FadeColor = 0;
|
||||
float ShadeFactor = 1.f;
|
||||
float Visibility = 0;
|
||||
bool hasBrightmap = false;
|
||||
bool noFloorPal = false;
|
||||
|
|
|
@ -139,10 +139,11 @@ void LookupTableInfo::postLoadTables(void)
|
|||
bool isbright = false;
|
||||
if (divider > 0.9)
|
||||
{
|
||||
shadediv[j] = 1 / 10000.f; // this translation is fullbright.
|
||||
tables[j].ShadeFactor = 1 / 10000.f; // this translation is fullbright.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tables[j].ShadeFactor == 0) tables[j].ShadeFactor = 1.f;
|
||||
// Fullbright lookups do not need brightmaps.
|
||||
auto fog = tables[j].FadeColor;
|
||||
if (GPalette.HasGlobalBrightmap && fog.r == 0 && fog.g == 0 && fog.b == 0)
|
||||
|
|
|
@ -100,9 +100,9 @@ int LoadPaletteLookups()
|
|||
#ifdef USE_OPENGL
|
||||
// These 3 tables do not have normal gradients. The others work without adjustment.
|
||||
// Other changes than altering the fog gradient are not necessary.
|
||||
shadediv[kPalTorch] = shadediv[kPalTorch2] = 1 / 20.f;
|
||||
shadediv[kPalNoTorch] = shadediv[kPalNoTorch2] = 0.25f;
|
||||
shadediv[kPalBrite] = shadediv[kPalBrite] = 1 / 128.f;
|
||||
lookups.tables[kPalTorch].ShadeFactor = lookups.tables[kPalTorch2].ShadeFactor = (numshades - 2) / 20.f;
|
||||
lookups.tables[kPalNoTorch].ShadeFactor = lookups.tables[kPalNoTorch2].ShadeFactor = (numshades - 2) / 4.f;
|
||||
lookups.tables[kPalBrite].ShadeFactor = lookups.tables[kPalBrite].ShadeFactor = (numshades - 2) / 128.f;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -60,8 +60,6 @@
|
|||
F2DDrawer twodpsp;
|
||||
static int BufferLock = 0;
|
||||
|
||||
float shadediv[MAXPALOOKUPS];
|
||||
|
||||
static int blendstyles[] = { GL_ZERO, GL_ONE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA };
|
||||
static int renderops[] = { GL_FUNC_ADD, GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT };
|
||||
int depthf[] = { GL_ALWAYS, GL_LESS, GL_EQUAL, GL_LEQUAL };
|
||||
|
@ -303,7 +301,7 @@ void GLInstance::SetPalette(int index)
|
|||
void GLInstance::SetPalswap(int index)
|
||||
{
|
||||
palmanager.BindPalswap(index);
|
||||
renderState.ShadeDiv = shadediv[index] == 0 ? 1.f / (numshades - 2) : shadediv[index];
|
||||
renderState.ShadeDiv = lookups.tables[index].ShadeFactor;
|
||||
}
|
||||
|
||||
void GLInstance::DrawImGui(ImDrawData* data)
|
||||
|
@ -522,7 +520,7 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
|
|||
if (!(Flags & RF_FogDisabled) && !FogColor.isBlack()) Flags &= ~RF_Brightmapping;
|
||||
shader->Flags.Set(Flags);
|
||||
shader->Shade.Set(Shade);
|
||||
shader->ShadeDiv.Set(ShadeDiv);
|
||||
shader->ShadeDiv.Set(ShadeDiv / (numshades - 2));
|
||||
shader->VisFactor.Set(VisFactor);
|
||||
shader->Flags.Set(Flags);
|
||||
shader->NPOTEmulationFactor.Set(NPOTEmulationFactor);
|
||||
|
|
|
@ -89,7 +89,6 @@ enum EWinding
|
|||
|
||||
struct ImDrawData;
|
||||
struct palette_t;
|
||||
extern float shadediv[256];
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue