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

Function makeBox

examples/scene-graph/shadows.ts:82–93  ·  view source on GitHub ↗
(cx: number, cy: number, cz: number, w: number, h: number, d: number, r: number, g: number, b: number)

Source from the content-addressed store, hash-verified

80
81// Simple "table" made from extruded boxes
82function makeBox(cx: number, cy: number, cz: number, w: number, h: number, d: number, r: number, g: number, b: number): void {
83 const node = createSceneNode();
84 const hw = w / 2;
85 const hd = d / 2;
86 const poly = [cx - hw, cz - hd, cx + hw, cz - hd, cx + hw, cz + hd, cx - hw, cz + hd];
87 extrudePolygon(node, poly, h);
88 // Offset Y via transform
89 const t = mat4Translate(mat4Identity(), 0, cy, 0);
90 setSceneNodeTransform(node, t);
91 setSceneNodeColor(node, r, g, b, 1.0);
92 setSceneNodePbr(node, 0.6, 0.0);
93}
94
95// Table
96makeBox(0, 0, 0, 1.5, 0.75, 0.8, 0.6, 0.4, 0.25); // tabletop

Callers 1

shadows.tsFile · 0.85

Calls 7

createSceneNodeFunction · 0.90
extrudePolygonFunction · 0.90
setSceneNodeTransformFunction · 0.90
setSceneNodeColorFunction · 0.90
setSceneNodePbrFunction · 0.90
mat4TranslateFunction · 0.85
mat4IdentityFunction · 0.85

Tested by

no test coverage detected