Documentation
    Preparing search index...

    Function boxGeometry

    • An axis-aligned box centred on the origin, as 24 vertices — four per face, each carrying that face's outward normal — and 12 counter-clockwise triangles (§53 "box", §68).

      const geometry = boxGeometry({ width: 2, height: 1, depth: 1 });
      geometry.vertexCount; // 24 — 4 per face; corners split for per-face normals
      geometry.drawCount; // 36 indices

      Corners sit at (±width/2, ±height/2, ±depth/2), so the box spans exactly the requested extents and its bounds are [-half, +half] per axis. Until the §68 lighting packet (2026-08-04) the builder shared 8 corner vertices; a corner belongs to three faces with three different normals, so a lit box needs the split — exactly the trade the original attribute note predicted. The triangles drawn are the same 12, so unlit rendering is unchanged.

      Per face, not an atlas: each of the six faces maps the whole [0, 1]² texture, with (0, 0) at the face's first listed corner and v growing towards the face's "up". A single texture therefore appears once on every side — the behaviour a crate, a die, or a debug grid wants — instead of six strips of one image. An atlased box, where each face takes a sub-rectangle, is what §55's frame regions are for and needs a layout convention this builder must not invent (decision, R-19).

      Parameters

      Returns BufferGeometry