[claude] InstancedMesh for glass tiles and island spires (#425) #443
Reference in New Issue
Block a user
Delete Branch "claude/issue-425"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #425
Summary
THREE.Meshglass tiles with a singleTHREE.InstancedMesh(one draw call instead of ~75)THREE.Meshisland crystal spires (each with a uniqueConeGeometry) with a singleTHREE.InstancedMeshusing a unit cone scaled per-instanceTHREE.StaticDrawUsagesince instance matrices never changeData Integrity Audit
Implementation Details
Glass tiles: Two-pass — collect valid tile positions into
_tileSlots, then buildInstancedMeshwithrotation.x = -π/2baked into each instance matrix. EdgeLineSegmentsstay individual (they need per-material opacity animation for the ripple effect).Island spires: Two-pass — collect
{sx, sz, posY, rotX, rotZ, scaleXZ, scaleY}per spire, then buildInstancedMesh(ConeGeometry(1,1,5), crystalMat, count). Each instance matrix isT * R * SwhereS = (spireR, spireH*2.8, spireR). This is mathematically equivalent to the original approach of pre-scaling viaConeGeometry(spireR, spireH*2.8, 5)with no scale on the mesh.Test Plan
npx serve . -l 3000and open http://localhost:3000renderer.infologging) and confirm draw calls are reduced vs. prior commitSyntax Check
node --check app.jspasses.Draw Call Reduction