Rename "depth fade falloff" to "depth fade threshold" as it makes more sense

This commit is contained in:
nashmuhandes 2024-09-09 17:06:04 +08:00
commit 27058efe85
13 changed files with 19 additions and 19 deletions

View file

@ -193,7 +193,7 @@ public:
mSurfaceUniforms.uLightFactor = 0.0f;
mSurfaceUniforms.uFogDensity = 0.0f;
mSurfaceUniforms.uLightLevel = -1.0f;
mSurfaceUniforms.uDepthFadeFalloff = 0.0f;
mSurfaceUniforms.uDepthFadeThreshold = 0.0f;
mSpecialEffect = EFF_NONE;
mLightIndex = -1;
mBoneIndexBase = -1;
@ -264,9 +264,9 @@ public:
mSurfaceUniforms.uDesaturationFactor = 0.0f;
}
void SetDepthFadeFalloff(float falloff)
void SetDepthFadeThreshold(float falloff)
{
mSurfaceUniforms.uDepthFadeFalloff = falloff;
mSurfaceUniforms.uDepthFadeThreshold = falloff;
}
void SetTextureClamp(bool on)

View file

@ -44,6 +44,6 @@ struct SurfaceUniforms
float uAlphaThreshold;
int uTextureIndex;
float uDepthFadeFalloff;
float uDepthFadeThreshold;
float padding3;
};

View file

@ -185,7 +185,7 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
if (!key.AlphaTest) definesBlock << "#define NO_ALPHATEST\n";
if (key.GBufferPass) definesBlock << "#define GBUFFER_PASS\n";
if (key.DepthFadeFalloff) definesBlock << "#define USE_DEPTHFADEFALLOFF\n";
if (key.DepthFadeThreshold) definesBlock << "#define USE_DEPTHFADETHRESHOLD\n";
if (key.Simple2D) definesBlock << "#define SIMPLE2D\n";
if (key.ClampY) definesBlock << "#define TEXF_ClampY\n";

View file

@ -79,7 +79,7 @@ public:
uint64_t UseLevelMesh : 1; // USE_LEVELMESH
uint64_t FogBalls : 1; // FOGBALLS
uint64_t NoFragmentShader : 1;
uint64_t DepthFadeFalloff : 1;
uint64_t DepthFadeThreshold : 1;
uint64_t Unused : 41;
};
uint64_t AsQWORD = 0;

View file

@ -258,7 +258,7 @@ void VkRenderState::ApplyRenderPass(int dt)
pipelineKey.ShaderKey.Detailmap = (uTextureMode & TEXF_Detailmap) != 0;
pipelineKey.ShaderKey.Glowmap = (uTextureMode & TEXF_Glowmap) != 0;
pipelineKey.ShaderKey.DepthFadeFalloff = mSurfaceUniforms.uDepthFadeFalloff > 0.0f;
pipelineKey.ShaderKey.DepthFadeThreshold = mSurfaceUniforms.uDepthFadeThreshold > 0.0f;
// The way GZDoom handles state is just plain insanity!
int fogset = 0;

View file

@ -1128,7 +1128,7 @@ public:
DVector2 AutomapOffsets; // Offset the actors' sprite view on the automap by these coordinates.
float isoscaleY; // Y-scale to compensate for Y-billboarding for isometric sprites
float isotheta; // Rotation angle to compensate for Y-billboarding for isometric sprites
double DepthFadeFalloff; // [Nash] "soft particle" fade factor
double DepthFadeThreshold; // [Nash] "soft particle" fade threshold in map units
DRotator Angles;
DRotator ViewAngles; // Angle offsets for cameras
TObjPtr<DViewPosition*> ViewPos; // Position offsets for cameras

View file

@ -394,7 +394,7 @@ void AActor::Serialize(FSerializer &arc)
A("WorldOffset", WorldOffset)
("modelData", modelData)
A("LandingSpeed", LandingSpeed)
A("DepthFadeFalloff", DepthFadeFalloff)
A("DepthFadeThreshold", DepthFadeThreshold)
("unmorphtime", UnmorphTime)
("morphflags", MorphFlags)

View file

@ -131,7 +131,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.SetTextureMode(RenderStyle);
if (actor)
state.SetDepthFadeFalloff(actor->DepthFadeFalloff);
state.SetDepthFadeThreshold(actor->DepthFadeThreshold);
if (hw_styleflags == STYLEHW_NoAlphaTest)
{
@ -328,7 +328,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.ClearDepthBias();
}
state.SetDepthFadeFalloff(0.0f);
state.SetDepthFadeThreshold(0.0f);
// [Nash] hitbox debug
if (actor && r_showhitbox)

View file

@ -2130,7 +2130,7 @@ DEFINE_FIELD(AActor, UnmorphTime)
DEFINE_FIELD(AActor, MorphFlags)
DEFINE_FIELD(AActor, PremorphProperties)
DEFINE_FIELD(AActor, MorphExitFlash)
DEFINE_FIELD(AActor, DepthFadeFalloff)
DEFINE_FIELD(AActor, DepthFadeThreshold)
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);

View file

@ -70,7 +70,7 @@ struct SurfaceUniforms
float uAlphaThreshold;
int uTextureIndex;
float uDepthFadeFalloff;
float uDepthFadeThreshold;
float padding3;
};

View file

@ -27,9 +27,9 @@ void main()
if (material.Base.a <= uAlphaThreshold) discard;
#endif
#ifdef USE_DEPTHFADEFALLOFF
#ifdef USE_DEPTHFADETHRESHOLD
float behindFragmentDepth = texelFetch(LinearDepth, uViewOffset + ivec2(gl_FragCoord.xy), 0).r;
material.Base.a *= clamp((behindFragmentDepth - pixelpos.w) / uDepthFadeFalloff, 0.0, 1.0);
material.Base.a *= clamp((behindFragmentDepth - pixelpos.w) / uDepthFadeThreshold, 0.0, 1.0);
#endif
FragColor = ProcessLightMode(material);

View file

@ -69,7 +69,7 @@ layout(push_constant) uniform PushConstants
#define uLightDist data[uDataIndex].uLightDist
#define uAlphaThreshold data[uDataIndex].uAlphaThreshold
#define uTextureIndex data[uDataIndex].uTextureIndex
#define uDepthFadeFalloff data[uDataIndex].uDepthFadeFalloff
#define uDepthFadeThreshold data[uDataIndex].uDepthFadeThreshold
#define VULKAN_COORDINATE_SYSTEM
#define HAS_UNIFORM_VERTEX_DATA

View file

@ -262,7 +262,7 @@ class Actor : Thinker native
native uint freezetics;
native Vector2 AutomapOffsets;
native double LandingSpeed;
native double DepthFadeFalloff;
native double DepthFadeThreshold;
meta String Obituary; // Player was killed by this actor
meta String HitObituary; // Player was killed by this actor in melee
@ -369,7 +369,7 @@ class Actor : Thinker native
property ShadowPenaltyFactor: ShadowPenaltyFactor;
property AutomapOffsets : AutomapOffsets;
property LandingSpeed: LandingSpeed;
property DepthFadeFalloff: DepthFadeFalloff;
property DepthFadeThreshold: DepthFadeThreshold;
// need some definition work first
//FRenderStyle RenderStyle;
@ -459,7 +459,7 @@ class Actor : Thinker native
RenderRequired 0;
FriendlySeeBlocks 10; // 10 (blocks) * 128 (one map unit block)
LandingSpeed -8; // landing speed from a jump with normal gravity (squats the player's view)
DepthFadeFalloff 0.0; // [Nash] "soft particle" fade factor
DepthFadeThreshold 0.0; // [Nash] "soft particle" fade factor in map units
}
// Functions