(dt: number)
| 160 | |
| 161 | // WallSystem (priority 4) — generates wall geometry with door cutouts |
| 162 | function wallSystem(dt: number): void { |
| 163 | for (const id of dirtyNodes) { |
| 164 | const node = nodes.get(id); |
| 165 | if (!node || node.type !== 'wall') continue; |
| 166 | |
| 167 | const handle = ensureSceneNode(id); |
| 168 | const wall = node as WallNode; |
| 169 | |
| 170 | // Generate wall polygon |
| 171 | const polygon = generateWallVertices(wall); |
| 172 | if (polygon.length === 0) continue; |
| 173 | |
| 174 | // Extrude wall polygon |
| 175 | extrudePolygon(handle, polygon, wall.height); |
| 176 | |
| 177 | // Apply door cutouts via CSG box subtraction |
| 178 | for (const childId of wall.children) { |
| 179 | const child = nodes.get(childId); |
| 180 | if (!child || child.type !== 'door') continue; |
| 181 | const door = child as DoorNode; |
| 182 | |
| 183 | // Compute door position along wall |
| 184 | const [sx, sz] = wall.start; |
| 185 | const [ex, ez] = wall.end; |
| 186 | const dx = ex - sx; |
| 187 | const dz = ez - sz; |
| 188 | const len = Math.sqrt(dx * dx + dz * dz); |
| 189 | const nx = -dz / len; |
| 190 | const nz = dx / len; |
| 191 | |
| 192 | // Door center along wall |
| 193 | const cx = sx + dx * door.position; |
| 194 | const cz = sz + dz * door.position; |
| 195 | |
| 196 | // Cutout box (slightly wider than wall thickness for clean cut) |
| 197 | const halfW = door.width * 0.5; |
| 198 | const wt = wall.thickness * 1.5; |
| 199 | subtractBox(handle, |
| 200 | cx - halfW * (dx / len) - nx * wt, 0.0, cz - halfW * (dz / len) - nz * wt, |
| 201 | cx + halfW * (dx / len) + nx * wt, door.height, cz + halfW * (dz / len) + nz * wt, |
| 202 | ); |
| 203 | } |
| 204 | |
| 205 | // White wall material |
| 206 | setSceneNodeColor(handle, 0.95, 0.95, 0.92, 1.0); |
| 207 | setSceneNodePbr(handle, 0.8, 0.0); |
| 208 | |
| 209 | clearDirty(id); |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | // LightSystem (priority 5) — sets up lighting each frame |
| 214 | function lightSystem(dt: number): void { |
nothing calls this directly
no test coverage detected