Repository navigation
fix: replace GeometryMask with alpha reveal, fix building iso Y position bugs - #64
Merged
Merged
Conversation
Three bugs caused buildings to be invisible or mispositioned: 1. GeometryMask root cause: constructionMaskShape drew a rect with revealH=0 at progress=0, leaving the stencil buffer empty → bodyGraphic completely invisible. No fallback existed if the mask was never cleared before the first render frame. 2. visualRoot.y = 0 override: both the active-promotion guard and the updateConstruction() completion path set visualRoot.y = 0, wiping out the correct iso Y offset (isoPos.y - worldY) that updateRenderTransform() had just calculated. Off-diagonal buildings rendered at cartesian worldY instead of isometric isoPos.y. 3. Construction animation y: updateConstruction() used an absolute assignment (visualRoot.y = offset) which replaced the iso base position instead of adding to it. Fix: - Remove GeometryMask entirely (constructionMaskShape, constructionMask fields, setMask call, updateConstructionMask() method) - Use bodyGraphic.setAlpha(0→1) for the construction fade-in reveal - Change visualRoot.y slide-in to additive (+= offset) so it builds on top of the iso base position set by updateRenderTransform() - Remove all visualRoot.y = 0 overrides; let updateRenderTransform() own the base iso position every frame - Guard in update() now uses bodyGraphic.setAlpha(1) instead of clearMask() Result: buildings are always visible (alpha-based reveal, not stencil-based), positioned correctly at iso coordinates, with working construction animation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause 1 — GeometryMask invisibility: The
constructionMaskShapedrew a rect withrevealH=0atconstructionProgress=0, leaving the WebGL stencil buffer empty. SincebodyGraphic.setMask(constructionMask)was applied at construction, the building body was permanently invisible until the mask was explicitly cleared — but the clear path could miss in edge cases and the approach was fragile.Root cause 2 —
visualRoot.y = 0wipes iso Y offset: Both the active-promotion guard inupdate()and theupdateConstruction()completion path setthis.visualRoot.y = 0, overwriting the correct isometric Y offset (isoPos.y - worldY) thatupdateRenderTransform()had just set. This placed off-diagonal buildings at their CartesianworldYinstead of isometricisoPos.y.Root cause 3 — Construction animation y was absolute, not additive:
updateConstruction()usedvisualRoot.y = (1-progress)*14(absolute) which replaced the iso base position. Should be+=(additive).Changes
GeometryMaskentirely (constructionMaskShape,constructionMaskfields,setMask,updateConstructionMask())bodyGraphic.setAlpha(0→1)during construction fade-invisualRoot.y += (1-progress)*14so it builds on the iso base positionvisualRoot.y = 0overrides —updateRenderTransform()owns the base iso position every frameupdate()usesbodyGraphic.setAlpha(1)instead ofclearMask()Test plan
npx tsc --noEmit— passesnpx vitest run— 96/96 tests pass🤖 Generated with Claude Code