ThickFogDistance and ThickFogMultiplier MAPINFO variables adds thicker fog (Vulkan and OpenGL only) beyond ThickFogDistance, as long as it is possible. But default it is -1.f (disabled).
This commit is contained in:
parent
f4ac616b57
commit
c6a6ae23a6
17 changed files with 92 additions and 0 deletions
|
|
@ -330,6 +330,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
int uShadowmapFilter;
|
||||
|
||||
int uLightBlendMode;
|
||||
|
||||
float uThickFogDistance;
|
||||
float uThickFogMultiplier;
|
||||
};
|
||||
|
||||
uniform int uTextureMode;
|
||||
|
|
|
|||
|
|
@ -231,6 +231,8 @@ bool FGLRenderState::ApplyShader()
|
|||
activeShader->cur->muClipHeight.Set(mHwUniforms->mClipHeight);
|
||||
activeShader->cur->muClipHeightDirection.Set(mHwUniforms->mClipHeightDirection);
|
||||
//activeShader->cur->muShadowmapFilter.Set(mHwUniforms->mShadowmapFilter);
|
||||
activeShader->cur->muThickFogDistance.Set(mHwUniforms->mThickFogDistance);
|
||||
activeShader->cur->muThickFogMultiplier.Set(mHwUniforms->mThickFogMultiplier);
|
||||
}
|
||||
|
||||
glVertexAttrib4fv(VATTR_COLOR, &mStreamData.uVertexColor.X);
|
||||
|
|
|
|||
|
|
@ -284,6 +284,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
uniform float uClipHeightDirection;
|
||||
uniform int uShadowmapFilter;
|
||||
|
||||
uniform float uThickFogDistance;
|
||||
uniform float uThickFogMultiplier;
|
||||
|
||||
uniform int uTextureMode;
|
||||
uniform vec2 uClipSplit;
|
||||
uniform float uAlphaThreshold;
|
||||
|
|
@ -582,6 +585,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
shaderData->muClipHeightDirection.Init(shaderData->hShader, "uClipHeightDirection");
|
||||
shaderData->muShadowmapFilter.Init(shaderData->hShader, "uShadowmapFilter");
|
||||
|
||||
shaderData->muThickFogDistance.Init(shaderData->hShader, "uThickFogDistance");
|
||||
shaderData->muThickFogMultiplier.Init(shaderData->hShader, "uThickFogMultiplier");
|
||||
////
|
||||
|
||||
shaderData->muDesaturation.Init(shaderData->hShader, "uDesaturationFactor");
|
||||
|
|
|
|||
|
|
@ -319,6 +319,9 @@ public: class ShaderVariantData
|
|||
FBufferedUniform1f muClipHeight;
|
||||
FBufferedUniform1f muClipHeightDirection;
|
||||
FBufferedUniform1i muShadowmapFilter;
|
||||
|
||||
FBufferedUniform1f muThickFogDistance;
|
||||
FBufferedUniform1f muThickFogMultiplier;
|
||||
/////
|
||||
|
||||
FBufferedUniform1f muDesaturation;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ struct HWViewpointUniforms
|
|||
|
||||
int mLightBlendMode = 0;
|
||||
|
||||
float mThickFogDistance = -1.f;
|
||||
float mThickFogMultiplier = 30.f;
|
||||
|
||||
void CalcDependencies()
|
||||
{
|
||||
mNormalViewMatrix.computeNormalMatrix(mViewMatrix);
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ static const char *shaderBindings = R"(
|
|||
int uShadowmapFilter;
|
||||
|
||||
int uLightBlendMode;
|
||||
|
||||
float uThickFogDistance;
|
||||
float uThickFogMultiplier;
|
||||
};
|
||||
|
||||
layout(set = 1, binding = 1, std140) uniform MatricesUBO {
|
||||
|
|
|
|||
|
|
@ -952,6 +952,36 @@ CCMD(skymisttoggle)
|
|||
primaryLevel->flags3 ^= LEVEL3_SKYMIST;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CCMD(thickfogdistance)
|
||||
{
|
||||
if (argv.argc() > 1)
|
||||
{
|
||||
// Do this only on the primary level.
|
||||
primaryLevel->thickfogdistance = (float)strtod(argv[1], NULL);
|
||||
}
|
||||
Printf("%f (positive means enabled)\n", primaryLevel->thickfogdistance);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CCMD(thickfogmultiplier)
|
||||
{
|
||||
if (argv.argc() > 1)
|
||||
{
|
||||
// Do this only on the primary level.
|
||||
primaryLevel->thickfogmultiplier = max(0.f, (float)strtod(argv[1], NULL));
|
||||
}
|
||||
Printf("%f\n", primaryLevel->thickfogmultiplier);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@ CCMD(skyfog)
|
|||
// Do this only on the primary level.
|
||||
primaryLevel->skyfog = max(0, (int)strtoull(argv[1], NULL, 0));
|
||||
}
|
||||
Printf("%d\n", primaryLevel->skyfog);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1903,6 +1903,9 @@ void FLevelLocals::Init()
|
|||
skyfog = info->skyfog;
|
||||
deathsequence = info->deathsequence;
|
||||
|
||||
thickfogdistance = info->thickfogdistance;
|
||||
thickfogmultiplier = info->thickfogmultiplier;
|
||||
|
||||
pixelstretch = info->pixelstretch;
|
||||
|
||||
compatflags->Callback();
|
||||
|
|
|
|||
|
|
@ -753,6 +753,8 @@ public:
|
|||
bool lightadditivesurfaces;
|
||||
bool notexturefill;
|
||||
int ImpactDecalCount;
|
||||
float thickfogdistance;
|
||||
float thickfogmultiplier;
|
||||
|
||||
FGlobalDLightLists lightlists;
|
||||
|
||||
|
|
|
|||
|
|
@ -313,6 +313,8 @@ void level_info_t::Reset()
|
|||
fogdensity = 0;
|
||||
outsidefogdensity = 0;
|
||||
skyfog = 0;
|
||||
thickfogdistance = -1.0f;
|
||||
thickfogmultiplier = 30.0f;
|
||||
pixelstretch = 1.2f;
|
||||
|
||||
specialactions.Clear();
|
||||
|
|
@ -1575,6 +1577,20 @@ DEFINE_MAP_OPTION(skyfog, false)
|
|||
info->skyfog = parse.sc.Number;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(thickfogdistance, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetFloat();
|
||||
info->thickfogdistance = (float)parse.sc.Float;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(thickfogmultiplier, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetFloat();
|
||||
info->thickfogmultiplier = (float)parse.sc.Float;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(pixelratio, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
|
|
|
|||
|
|
@ -382,6 +382,8 @@ struct level_info_t
|
|||
int fogdensity;
|
||||
int outsidefogdensity;
|
||||
int skyfog;
|
||||
float thickfogdistance;
|
||||
float thickfogmultiplier;
|
||||
float pixelstretch;
|
||||
|
||||
// Redirection: If any player is carrying the specified item, then
|
||||
|
|
|
|||
|
|
@ -982,6 +982,8 @@ void FLevelLocals::Serialize(FSerializer &arc, bool hubload)
|
|||
("fogdensity", fogdensity)
|
||||
("outsidefogdensity", outsidefogdensity)
|
||||
("skyfog", skyfog)
|
||||
("thickfogdistance", thickfogdistance)
|
||||
("thickfogmultiplier", thickfogmultiplier)
|
||||
("deathsequence", deathsequence)
|
||||
("bodyqueslot", bodyqueslot)
|
||||
("spawnindex", spawnindex)
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ void HWDrawInfo::StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uni
|
|||
VPUniforms.mClipLine.X = -10000000.0f;
|
||||
VPUniforms.mShadowmapFilter = gl_shadowmap_filter;
|
||||
VPUniforms.mLightBlendMode = (level.info ? (int)level.info->lightblendmode : 0);
|
||||
VPUniforms.mThickFogDistance = Level->thickfogdistance;
|
||||
VPUniforms.mThickFogMultiplier = Level->thickfogmultiplier;
|
||||
}
|
||||
mClipper->SetViewpoint(Viewpoint);
|
||||
vClipper->SetViewpoint(Viewpoint);
|
||||
|
|
|
|||
|
|
@ -2838,6 +2838,8 @@ DEFINE_FIELD_X(LevelInfo, level_info_t, deathsequence)
|
|||
DEFINE_FIELD_X(LevelInfo, level_info_t, fogdensity)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, outsidefogdensity)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, skyfog)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, thickfogdistance)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, thickfogmultiplier)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, pixelstretch)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, RedirectType)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, RedirectMapName)
|
||||
|
|
@ -2889,6 +2891,8 @@ DEFINE_FIELD(FLevelLocals, teamdamage)
|
|||
DEFINE_FIELD(FLevelLocals, fogdensity)
|
||||
DEFINE_FIELD(FLevelLocals, outsidefogdensity)
|
||||
DEFINE_FIELD(FLevelLocals, skyfog)
|
||||
DEFINE_FIELD(FLevelLocals, thickfogdistance)
|
||||
DEFINE_FIELD(FLevelLocals, thickfogmultiplier)
|
||||
DEFINE_FIELD(FLevelLocals, pixelstretch)
|
||||
DEFINE_FIELD(FLevelLocals, MusicVolume)
|
||||
DEFINE_FIELD(FLevelLocals, deathsequence)
|
||||
|
|
|
|||
|
|
@ -855,6 +855,13 @@ void main()
|
|||
{
|
||||
fogdist = max(16.0, distance(pixelpos.xyz, uCameraPos.xyz));
|
||||
}
|
||||
if (uThickFogDistance > 0.0)
|
||||
{
|
||||
if (fogdist > uThickFogDistance)
|
||||
{
|
||||
fogdist = fogdist + uThickFogMultiplier * (fogdist - uThickFogDistance);
|
||||
}
|
||||
}
|
||||
fogfactor = exp2 (uFogDensity * fogdist);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -414,6 +414,8 @@ struct LevelInfo native
|
|||
native readonly int fogdensity;
|
||||
native readonly int outsidefogdensity;
|
||||
native readonly int skyfog;
|
||||
native readonly float thickfogdistance;
|
||||
native readonly float thickfogmultiplier;
|
||||
native readonly float pixelstretch;
|
||||
native readonly name RedirectType;
|
||||
native readonly String RedirectMapName;
|
||||
|
|
@ -527,6 +529,8 @@ struct LevelLocals native
|
|||
native readonly int fogdensity;
|
||||
native readonly int outsidefogdensity;
|
||||
native readonly int skyfog;
|
||||
native readonly float thickfogdistance;
|
||||
native readonly float thickfogmultiplier;
|
||||
native readonly float pixelstretch;
|
||||
native readonly float MusicVolume;
|
||||
native name deathsequence;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue