From 0306d579ecf3d2c61444fc3160cae526e0442015 Mon Sep 17 00:00:00 2001 From: scamiv <6170744+scamiv@users.noreply.github.com> Date: Mon, 12 Jan 2026 23:17:14 +0100 Subject: [PATCH] Refactor smooth animation logic in TerritoryWebGLRenderer - Updated seed validation checks to simplify smooth animation handling. - Adjusted comments for clarity regarding seed conditions and animation behavior. - Enhanced performance by skipping unnecessary computations when seed data is invalid. --- src/client/graphics/layers/TerritoryWebGLRenderer.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/graphics/layers/TerritoryWebGLRenderer.ts b/src/client/graphics/layers/TerritoryWebGLRenderer.ts index 9fa85dce2..3e85557ab 100644 --- a/src/client/graphics/layers/TerritoryWebGLRenderer.ts +++ b/src/client/graphics/layers/TerritoryWebGLRenderer.ts @@ -3204,9 +3204,10 @@ export class TerritoryWebGLRenderer { bool hasOldSeed = seedOld.x >= 0.0; bool hasNewSeed = seedNew.x >= 0.0; - // If neither seed is valid, this tile is far from any change - skip smooth logic - if (!hasOldSeed && !hasNewSeed) { - // Just use the current color, no animation needed + // If either seed is invalid, we can't compute meaningful distances + // for smooth animation - just use the current color + if (!hasOldSeed || !hasNewSeed) { + // Skip smooth animation - show current state } else { float oldDistance = hasOldSeed ? max(length(seedOld - mapCoord) - 0.5, 0.0)