mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- tweaked the fade ramp a bit.
For Duke Nukem and its direct offspring (Nam, WW2GI and Redneck Rampage) the ramp is not a linear fade from 0 to 1, it needs to be a little darker than that. Unfortunately the proper factor needed here must be set manually, this cannot really be calculated from the lookup tables.
This commit is contained in:
parent
9437387b4a
commit
85d377647a
8 changed files with 37 additions and 14 deletions
|
@ -354,6 +354,8 @@ static void sighandler(int signum)
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
FString currentGame; // Currently there is no global state for the current game. This is a temporary workaround because the video init code needs to do a few things based on the active game.
|
||||
|
||||
namespace Duke
|
||||
{
|
||||
extern GameInterface Interface;
|
||||
|
@ -376,6 +378,7 @@ GameInterface *CheckFrontend()
|
|||
FILE* f = fopen("blood.rff", "rb");
|
||||
if (f)
|
||||
{
|
||||
currentGame = "Blood";
|
||||
fclose(f);
|
||||
return &Blood::Interface;
|
||||
}
|
||||
|
@ -384,13 +387,26 @@ GameInterface *CheckFrontend()
|
|||
f = fopen("redneck.grp", "rb");
|
||||
if (f)
|
||||
{
|
||||
currentGame = "Redneck"; // RRRA is not separately covered
|
||||
fclose(f);
|
||||
return &Redneck::Interface;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = fopen("sw.grp", "rb");
|
||||
if (f) return &ShadowWarrior::Interface;
|
||||
if (f)
|
||||
{
|
||||
currentGame = "ShadowWarrior";
|
||||
fclose(f);
|
||||
return &ShadowWarrior::Interface;
|
||||
}
|
||||
f = fopen("fury.grp", "rb");
|
||||
if (f)
|
||||
{
|
||||
currentGame = "Fury";
|
||||
fclose(f);
|
||||
}
|
||||
else currentGame = "Duke"; // also covers Nam and WW2GI.
|
||||
return &Duke::Interface;
|
||||
}
|
||||
}
|
||||
|
@ -1341,11 +1357,12 @@ void sdlayer_setvideomode_opengl(void)
|
|||
GLInterface.Deinit();
|
||||
GLInterface.Init();
|
||||
GLInterface.InitGLState(4, glmultisample);
|
||||
#if 1
|
||||
GLInterface.mSamplers->SetTextureFilterMode(0, 1);
|
||||
#else
|
||||
// I have no idea how to get this info from the lookup tables. Fortunately it is consistent per game.
|
||||
if (!currentGame.Compare("Blood")) GLInterface.SetShadeDiv(62);
|
||||
else if (!currentGame.Compare("Fury")) GLInterface.SetShadeDiv(30);
|
||||
else GLInterface.SetShadeDiv(26);
|
||||
|
||||
GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -421,10 +421,6 @@ void G_CacheMapData(void)
|
|||
|
||||
S_TryPlaySpecialMusic(MUS_LOADING);
|
||||
|
||||
#if defined EDUKE32_TOUCH_DEVICES && defined USE_OPENGL
|
||||
polymost_glreset();
|
||||
#endif
|
||||
|
||||
uint32_t const cacheStartTime = timerGetTicks();
|
||||
|
||||
cacheFlaggedTiles();
|
||||
|
|
|
@ -27,7 +27,8 @@ struct PolymostRenderState
|
|||
{
|
||||
float Shade;
|
||||
float NumShades = 64.f;
|
||||
float VisFactor = 128.f;
|
||||
float ShadeDiv = 62.f;
|
||||
float VisFactor = 128.f;
|
||||
int Flags = 0;
|
||||
float NPOTEmulationFactor = 1.f;
|
||||
float NPOTEmulationXOffset;
|
||||
|
|
|
@ -137,7 +137,8 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
|
|||
|
||||
Flags.Init(hShader, "u_flags");
|
||||
Shade.Init(hShader, "u_shade");
|
||||
NumShades.Init(hShader, "u_numShades");
|
||||
ShadeDiv.Init(hShader, "u_shadeDiv");
|
||||
NumShades.Init(hShader, "u_numShades");
|
||||
VisFactor.Init(hShader, "u_visFactor");
|
||||
NPOTEmulationFactor.Init(hShader, "u_npotEmulationFactor");
|
||||
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
|
||||
|
|
|
@ -38,7 +38,8 @@ public:
|
|||
FBufferedUniform1i Flags;
|
||||
FBufferedUniform1f Shade;
|
||||
FBufferedUniform1f NumShades;
|
||||
FBufferedUniform1f VisFactor;
|
||||
FBufferedUniform1f ShadeDiv;
|
||||
FBufferedUniform1f VisFactor;
|
||||
FBufferedUniform1f NPOTEmulationFactor;
|
||||
FBufferedUniform1f NPOTEmulationXOffset;
|
||||
FBufferedUniform1f Brightness;
|
||||
|
|
|
@ -484,6 +484,7 @@ void PolymostRenderState::Apply(PolymostShader* shader)
|
|||
shader->Flags.Set(Flags);
|
||||
shader->Shade.Set(Shade);
|
||||
shader->NumShades.Set(NumShades);
|
||||
shader->ShadeDiv.Set(ShadeDiv);
|
||||
shader->VisFactor.Set(VisFactor);
|
||||
shader->Flags.Set(Flags);
|
||||
shader->NPOTEmulationFactor.Set(NPOTEmulationFactor);
|
||||
|
|
|
@ -320,9 +320,14 @@ public:
|
|||
renderState.NumShades = numshades;
|
||||
}
|
||||
|
||||
void SetShadeDiv(int value)
|
||||
{
|
||||
renderState.ShadeDiv = 1.f / value; // There's 3 values here: Blood uses 62 with numShades = 64, Ion Fury uses 30 with NumShades = 32, the other games use 26 with NumShades = 32.
|
||||
}
|
||||
|
||||
void SetVisibility(float visibility, float fviewingrange)
|
||||
{
|
||||
renderState.VisFactor = visibility * fviewingrange * (1.f / (64.f * 65536.f));
|
||||
renderState.VisFactor = visibility* fviewingrange* (1.f / (64.f * 65536.f));
|
||||
}
|
||||
|
||||
void UseColorOnly(bool yes)
|
||||
|
|
|
@ -30,6 +30,7 @@ uniform sampler2D s_glow;
|
|||
|
||||
uniform float u_shade;
|
||||
uniform float u_numShades;
|
||||
uniform float u_shadeDiv;
|
||||
uniform float u_visFactor;
|
||||
uniform int u_flags;
|
||||
|
||||
|
@ -192,7 +193,7 @@ void main()
|
|||
color.rgb *= detailColor.rgb;
|
||||
if ((u_flags & RF_FogDisabled) == 0)
|
||||
{
|
||||
shade = clamp(shade / (u_numShades-2), 0.0, 1.0);
|
||||
shade = clamp(shade * u_shadeDiv, 0.0, 1.0); // u_shadeDiv is really 1/shadeDiv.
|
||||
// Apply the shade as a linear depth fade ramp.
|
||||
color.rgb = mix(color.rgb, u_fogColor.rgb, shade);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue