Skip to content

Commit 3a2b2cd

Browse files
committed
keep SDK NaN semantics in MatricesAreEqual, clear particle model StudioHdr cache on level shutdown
1 parent fc45e27 commit 3a2b2cd

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎Game.Client/HLClient.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ public void LevelShutdown() {
593593
gHUD.LevelShutdown();
594594

595595
g_pParticleSystemMgr.UncacheAllParticleSystems();
596+
ParticleModelDraw.ClearStudioHdrCache();
596597

597598
#if GMOD_DLL
598599
Game.Client.GarrysMod.GarrysMod.Lua.Kill();

‎Game.Shared/ParticleSystemQuery.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ static StudioHdr GetStudioHdr(MDLHandle_t handle) {
474474
return studioHdr;
475475
}
476476

477+
public static void ClearStudioHdrCache() => StudioHdrs.Clear();
478+
477479
public void SetMDL(MDLHandle_t handle) {
478480
UnreferenceMDL();
479481
Handle = handle;

‎Source.Particles/BuiltinParticleOperators.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public static Vector3 GetInitialVector(ParticleCollection particles, int attribu
9292
public static int ClampCP(int cp) => Math.Clamp(cp, 0, MAX_PARTICLE_CONTROL_POINTS - 1);
9393

9494
public static bool MatricesAreEqual(in Matrix3x4 a, in Matrix3x4 b, float tolerance)
95-
=> MathF.Abs(a.M00 - b.M00) <= tolerance && MathF.Abs(a.M01 - b.M01) <= tolerance && MathF.Abs(a.M02 - b.M02) <= tolerance && MathF.Abs(a.M03 - b.M03) <= tolerance
96-
&& MathF.Abs(a.M10 - b.M10) <= tolerance && MathF.Abs(a.M11 - b.M11) <= tolerance && MathF.Abs(a.M12 - b.M12) <= tolerance && MathF.Abs(a.M13 - b.M13) <= tolerance
97-
&& MathF.Abs(a.M20 - b.M20) <= tolerance && MathF.Abs(a.M21 - b.M21) <= tolerance && MathF.Abs(a.M22 - b.M22) <= tolerance && MathF.Abs(a.M23 - b.M23) <= tolerance;
95+
=> !(MathF.Abs(a.M00 - b.M00) > tolerance) && !(MathF.Abs(a.M01 - b.M01) > tolerance) && !(MathF.Abs(a.M02 - b.M02) > tolerance) && !(MathF.Abs(a.M03 - b.M03) > tolerance)
96+
&& !(MathF.Abs(a.M10 - b.M10) > tolerance) && !(MathF.Abs(a.M11 - b.M11) > tolerance) && !(MathF.Abs(a.M12 - b.M12) > tolerance) && !(MathF.Abs(a.M13 - b.M13) > tolerance)
97+
&& !(MathF.Abs(a.M20 - b.M20) > tolerance) && !(MathF.Abs(a.M21 - b.M21) > tolerance) && !(MathF.Abs(a.M22 - b.M22) > tolerance) && !(MathF.Abs(a.M23 - b.M23) > tolerance);
9898

9999
public static Vector3 Transform(in Vector3 v, in Matrix3x4 m) {
100100
MathLib.VectorTransform(v, m, out Vector3 result);

0 commit comments

Comments
 (0)