fixing system orders for ensuring level calculation comes last

This commit is contained in:
wass08
2026-02-23 09:08:15 +09:00
parent 4555325389
commit 3894d7c8bf
5 changed files with 13 additions and 11 deletions
@@ -51,7 +51,7 @@ export const ItemSystem = () => {
}
clearDirty(id as AnyNodeId)
})
}, 2)
})
return null
@@ -29,7 +29,7 @@ export const SlabSystem = () => {
}
// If mesh not found, keep it dirty for next frame
})
})
}, 1)
return null
}
@@ -1,7 +1,7 @@
import { useFrame } from '@react-three/fiber'
import * as THREE from 'three'
import { computeBoundsTree } from 'three-mesh-bvh'
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg'
import { computeBoundsTree } from 'three-mesh-bvh'
import { sceneRegistry } from '../../hooks/scene-registry/scene-registry'
import { spatialGridManager } from '../../hooks/spatial-grid/spatial-grid-manager'
import { resolveLevelId } from '../../hooks/spatial-grid/spatial-grid-sync'
@@ -22,7 +22,7 @@ const csgEvaluator = new Evaluator()
// WALL SYSTEM
// ============================================================================
let useFrameNb = 0;
let useFrameNb = 0
export const WallSystem = () => {
const dirtyNodes = useScene((state) => state.dirtyNodes)
const clearDirty = useScene((state) => state.clearDirty)
@@ -35,7 +35,7 @@ export const WallSystem = () => {
// Collect dirty walls and their levels
const dirtyWallsByLevel = new Map<string, Set<string>>()
useFrameNb += 1;
useFrameNb += 1
dirtyNodes.forEach((id) => {
const node = nodes[id]
if (!node || node.type !== 'wall') return
@@ -75,7 +75,7 @@ export const WallSystem = () => {
}
}
}
})
}, 4)
return null
}
@@ -108,7 +108,6 @@ function updateWallGeometry(wallId: string, miterData: WallMiterData) {
const node = nodes[wallId as WallNode['id']]
if (!node || node.type !== 'wall') return
const mesh = sceneRegistry.nodes.get(wallId) as THREE.Mesh
if (!mesh) return
@@ -50,7 +50,7 @@ export const WindowSystem = () => {
useScene.getState().dirtyNodes.add((node as WindowNode).parentId as AnyNodeId)
}
})
})
}, 3)
return null
}