Skip to content

1681-engine / index / planAtlas

Function: planAtlas() ​

ts
function planAtlas(sizes, limit): AtlasPlan;

Defined in: src/core/atlasPlan.ts:45

Shelf-packs the images, tallest first, into pages no larger than limit on either side. The page width is the power of two that fits the widest image and the square root of the total area (at least 1024), capped at limit; a shelf that would run past limit starts a new page. With everything fitting under limit this is exactly the single page the atlas always was. An image larger than limit itself is given a page of its own (the GPU will refuse it, but nothing else is lost with it).

Parameters ​

ParameterType
sizesreadonly AtlasSize[]
limitnumber

Returns ​

AtlasPlan

Released under the MIT License.