Move depth fade definition to GLDEFS

This commit is contained in:
nashmuhandes 2024-09-09 18:08:10 +08:00 committed by Nash Muhandes
commit 58fecd4b92
10 changed files with 12 additions and 16 deletions

View file

@ -264,11 +264,6 @@ public:
mSurfaceUniforms.uDesaturationFactor = 0.0f;
}
void SetDepthFadeThreshold(float falloff)
{
mSurfaceUniforms.uDepthFadeThreshold = falloff;
}
void SetTextureClamp(bool on)
{
if (on) mTextureClamp = TM_CLAMPY;

View file

@ -865,10 +865,12 @@ void VkLevelMeshUploader::UploadUniforms()
{
auto source = material.mMaterial->Source();
surfaceUniforms.uSpecularMaterial = { source->GetGlossiness(), source->GetSpecularLevel() };
surfaceUniforms.uDepthFadeThreshold = source->GetDepthFadeThreshold();
surfaceUniforms.uTextureIndex = Mesh->fb->GetBindlessTextureIndex(material.mMaterial, material.mClampMode, material.mTranslation);
}
else
{
surfaceUniforms.uDepthFadeThreshold = 0.f;
surfaceUniforms.uTextureIndex = 0;
}
}

View file

@ -413,9 +413,11 @@ void VkRenderState::ApplySurfaceUniforms()
mSurfaceUniforms.uTextureIndex = static_cast<VkMaterial*>(mMaterial.mMaterial)->GetBindlessIndex(mMaterial);
mSurfaceUniforms.uSpecularMaterial = { source->GetGlossiness(), source->GetSpecularLevel() };
mSurfaceUniforms.uDepthFadeThreshold = source->GetDepthFadeThreshold();
}
else
{
mSurfaceUniforms.uDepthFadeThreshold = 0.f;
mSurfaceUniforms.uTextureIndex = 0;
}
mMaterial.mChanged = false;

View file

@ -118,6 +118,7 @@ class FGameTexture
FVector2 detailScale = { 1.f, 1.f };
float Glossiness = 10.f;
float SpecularLevel = 0.1f;
float DepthFadeThreshold = 0.0f;
float shaderspeed = 1.f;
int shaderindex = 0;
@ -258,6 +259,8 @@ public:
float GetGlossiness() const { return Glossiness; }
float GetSpecularLevel() const { return SpecularLevel; }
float GetDepthFadeThreshold() const { return DepthFadeThreshold; }
void CopySize(FGameTexture* BaseTexture, bool forfont = false)
{
Base->CopySize(BaseTexture->Base.get());

View file

@ -1128,7 +1128,6 @@ 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 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,6 @@ void AActor::Serialize(FSerializer &arc)
A("WorldOffset", WorldOffset)
("modelData", modelData)
A("LandingSpeed", LandingSpeed)
A("DepthFadeThreshold", DepthFadeThreshold)
("unmorphtime", UnmorphTime)
("morphflags", MorphFlags)

View file

@ -1346,6 +1346,11 @@ class GLDefsParser
sc.MustGetFloat();
mlay.SpecularLevel = (float)sc.Float;
}
else if (sc.Compare("depthfadethreshold"))
{
sc.MustGetFloat();
tex->DepthFadeThreshold = (float)sc.Float;
}
else if (sc.Compare("speed"))
{
sc.MustGetFloat();

View file

@ -130,9 +130,6 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.SetRenderStyle(RenderStyle);
state.SetTextureMode(RenderStyle);
if (actor)
state.SetDepthFadeThreshold(actor->DepthFadeThreshold);
if (hw_styleflags == STYLEHW_NoAlphaTest)
{
state.AlphaFunc(Alpha_GEqual, 0.f);
@ -328,8 +325,6 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.ClearDepthBias();
}
state.SetDepthFadeThreshold(0.0f);
// [Nash] hitbox debug
if (actor && r_showhitbox)
{

View file

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

View file

@ -262,7 +262,6 @@ class Actor : Thinker native
native uint freezetics;
native Vector2 AutomapOffsets;
native double LandingSpeed;
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 +368,6 @@ class Actor : Thinker native
property ShadowPenaltyFactor: ShadowPenaltyFactor;
property AutomapOffsets : AutomapOffsets;
property LandingSpeed: LandingSpeed;
property DepthFadeThreshold: DepthFadeThreshold;
// need some definition work first
//FRenderStyle RenderStyle;
@ -459,7 +457,6 @@ 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)
DepthFadeThreshold 0.0; // [Nash] "soft particle" fade factor in map units
}
// Functions