MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / wallSystem

Function wallSystem

examples/scene-graph/interactive.ts:84–123  ·  view source on GitHub ↗
(dt: number)

Source from the content-addressed store, hash-verified

82// ============================================================
83
84function wallSystem(dt: number): void {
85 for (const id of dirtyWalls) {
86 const wall = walls.get(id);
87 if (!wall) continue;
88
89 const [sx, sz] = wall.start;
90 const [ex, ez] = wall.end;
91 const t = wall.thickness;
92
93 const dx = ex - sx;
94 const dz = ez - sz;
95 const len = Math.sqrt(dx * dx + dz * dz);
96 if (len < 0.001) continue;
97
98 const nx = -dz / len;
99 const nz = dx / len;
100 const hx = nx * t * 0.5;
101 const hz = nz * t * 0.5;
102
103 // Wall footprint polygon
104 const polygon = [
105 sx + hx, sz + hz,
106 ex + hx, ez + hz,
107 ex - hx, ez - hz,
108 sx - hx, sz - hz,
109 ];
110
111 extrudePolygon(wall.handle, polygon, wall.height);
112
113 // Color based on selection
114 if (wall.id === selectedWallId) {
115 setSceneNodeColor(wall.handle, 0.3, 0.6, 1.0, 1.0);
116 } else {
117 setSceneNodeColor(wall.handle, 0.95, 0.95, 0.92, 1.0);
118 }
119 setSceneNodePbr(wall.handle, 0.8, 0.0);
120
121 dirtyWalls.delete(id);
122 }
123}
124
125// Light system (priority 5)
126function lightSystem(dt: number): void {

Callers

nothing calls this directly

Calls 4

extrudePolygonFunction · 0.90
setSceneNodeColorFunction · 0.90
setSceneNodePbrFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected