- had a look at Exhumed's shade tables and implemented the necessary adjustments for the 3 with abnormal gradients.

This commit is contained in:
Christoph Oelckers 2019-12-31 22:53:03 +01:00
parent f106505344
commit 3d47652d08
3 changed files with 9 additions and 21 deletions

View file

@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "view.h" #include "view.h"
#include "cd.h" #include "cd.h"
#include "lighting.h" #include "lighting.h"
#include "../glbackend/glbackend.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -101,25 +102,11 @@ int LoadPaletteLookups()
bGreenPal = 0; bGreenPal = 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
/* // These 3 tables do not have normal gradients. The others work without adjustment.
// Very rough approximation... // Other changes than altering the fog gradient are not necessary.
palookupfogfactor[kPalNormal] = 1.f; shadediv[kPalTorch] = shadediv[kPalTorch2] = 1 / 20.f;
palookupfogfactor[kPalNoDim] = 0.f; shadediv[kPalNoTorch] = shadediv[kPalNoTorch2] = 0.25f;
palookupfogfactor[kPalTorch] = 0.36f; shadediv[kPalBrite] = shadediv[kPalBrite] = 1 / 128.f;
palookupfogfactor[kPalNoTorch] = 0.15f;
palookupfogfactor[kPalBrite] = 2.f;
palookupfogfactor[kPalRedBrite] = 0.36f;
palookupfog[kPalRedBrite] = { 248, 32, 0, 0 };
hicsetpalettetint(kPalRedBrite, 255, 255, 255, 248, 32, 0, 0);
palookupfog[kPalGreenBrite] = { 248, 32, 0, 0 };
palookupfogfactor[kPalGreenBrite] = 0.f;
hicsetpalettetint(kPalGreenBrite, 100, 200, 100, 0, 0, 0, 0);
palookupfogfactor[kPalNormal2] = 1.f;
palookupfogfactor[kPalNoDim2] = 0.f;
palookupfogfactor[kPalTorch2] = 0.36f;
palookupfogfactor[kPalNoTorch2] = 0.15f;
palookupfogfactor[kPalBrite2] = 2.f;
*/
#endif #endif
} }

View file

@ -50,6 +50,7 @@
#include "gl_renderer.h" #include "gl_renderer.h"
extern int xdim, ydim; extern int xdim, ydim;
float shadediv[MAXPALOOKUPS];
FileReader GetResource(const char* fn) FileReader GetResource(const char* fn)
{ {
@ -511,6 +512,7 @@ void GLInstance::SetPalette(int index)
void GLInstance::SetPalswap(int index) void GLInstance::SetPalswap(int index)
{ {
palmanager.BindPalswap(index); palmanager.BindPalswap(index);
renderState.ShadeDiv = shadediv[index] == 0 ? 1.f / (renderState.NumShades) : shadediv[index];
} }
void GLInstance::DrawImGui(ImDrawData* data) void GLInstance::DrawImGui(ImDrawData* data)

View file

@ -174,6 +174,7 @@ enum ETexType
struct ImDrawData; struct ImDrawData;
struct palette_t; struct palette_t;
extern float shadediv[256];
class GLInstance class GLInstance
{ {
@ -334,8 +335,6 @@ public:
{ {
renderState.Shade = shade; renderState.Shade = shade;
renderState.NumShades = numshades; renderState.NumShades = numshades;
renderState.ShadeDiv = 1.f / (numshades-2);
} }
void SetVisibility(float visibility, float fviewingrange) void SetVisibility(float visibility, float fviewingrange)