From 2e0b093c79f787cf3d1d5f00e8149a1ac7c4554c Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Thu, 25 Jul 2024 04:05:51 +0200 Subject: [PATCH] Soft particles: Disable Particle Stage "softeningRadius" keyword this avoid breaking the game DLL ABI (framework/DeclParticle.h is part of the SDK), and for now doesn't make a difference, because that keyword was introduced by TDM and thus is only used in their particle defs. When we break the game ABI/API anyway (probably for high FPS support), this commit can just be reverted --- neo/framework/DeclParticle.cpp | 12 +++++++++--- neo/framework/DeclParticle.h | 4 +++- neo/renderer/Model_prt.cpp | 7 +++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/neo/framework/DeclParticle.cpp b/neo/framework/DeclParticle.cpp index 7cd4fcc1..2f8b843f 100644 --- a/neo/framework/DeclParticle.cpp +++ b/neo/framework/DeclParticle.cpp @@ -410,7 +410,10 @@ idParticleStage *idDeclParticle::ParseParticleStage( idLexer &src ) { continue; } if ( !token.Icmp( "softeningRadius" ) ) { // #3878 soft particles - stage->softeningRadius = src.ParseFloat(); + common->Warning( "Particle %s from %s has stage with \"softeningRadius\" attribute, which is currently ignored (we soften all suitable particles)\n", + this->GetName(), src.GetFileName() ); + // DG: disable this for now to avoid breaking the game ABI + //stage->softeningRadius = src.ParseFloat(); continue; } @@ -737,7 +740,9 @@ idParticleStage::idParticleStage( void ) { hidden = false; boundsExpansion = 0.0f; bounds.Clear(); - softeningRadius = -2.0f; // -2 means "auto" - #3878 soft particles + // DG: disable softeningRadius for now to avoid breaking the game ABI + // (will always behave like if softeningRadius = -2.0f) + //softeningRadius = -2.0f; // -2 means "auto" - #3878 soft particles } /* @@ -811,7 +816,8 @@ void idParticleStage::Default() { randomDistribution = true; entityColor = false; cycleMsec = ( particleLife + deadTime ) * 1000; - softeningRadius = -2.0f; // -2 means "auto" - #3878 soft particles + // DG: disable softeningRadius for now to avoid breaking game ABI + //softeningRadius = -2.0f; // -2 means "auto" - #3878 soft particles } /* diff --git a/neo/framework/DeclParticle.h b/neo/framework/DeclParticle.h index 8819cef4..edc2cb05 100644 --- a/neo/framework/DeclParticle.h +++ b/neo/framework/DeclParticle.h @@ -202,7 +202,9 @@ public: This is more flexible even when not using soft particles, as modelDepthHack can be turned off for specific stages to stop them poking through walls. */ - float softeningRadius; + // DG: disable this for now because it breaks the game DLL's ABI (re-enable in dhewm3 1.6.0 or 2.0.0) + // (this header is part of the SDK) + //float softeningRadius; }; diff --git a/neo/renderer/Model_prt.cpp b/neo/renderer/Model_prt.cpp index a603d5f7..09d2c4ab 100644 --- a/neo/renderer/Model_prt.cpp +++ b/neo/renderer/Model_prt.cpp @@ -310,11 +310,14 @@ void idRenderModelPrt::SetSofteningRadii() for ( int i = 0; i < particleSystem->stages.Num(); ++i ) { const idParticleStage* ps = particleSystem->stages[i]; - if ( ps->softeningRadius > -2.0f ) // User has specified a setting + // DG: for now softeningRadius isn't configurable to avoid breaking the game DLL's ABI + // => always behave like if ps->softeningRadius == -2, which means "auto" + // (doesn't make a difference, so far only TDM particles set the softeningRadius) + /* if ( ps->softeningRadius > -2.0f ) // User has specified a setting { softeningRadii[i] = ps->softeningRadius; } - else if ( ps->orientation == POR_VIEW ) // Only view-aligned particle stages qualify for softening + else */ if ( ps->orientation == POR_VIEW ) // Only view-aligned particle stages qualify for softening { float diameter = Max( ps->size.from, ps->size.to ); float scale = Max( ps->aspect.from, ps->aspect.to );