Documentation
¶
Overview ¶
Package atlas packs rectangles into a texture atlas: the placement half of "many small images in one texture" (textures, lightmaps, glyphs, sprites), which a WebGPU program does to bind one texture instead of hundreds. It has no GOOS constraint and no dependency; copying the pixels in (and into the GPU texture) is the caller's.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFull = errors.New("atlas: full")
ErrFull is returned by Shelf.Place when the rectangle does not fit.
Functions ¶
This section is empty.
Types ¶
type Shelf ¶
type Shelf struct {
// contains filtered or unexported fields
}
Shelf is a shelf packer: rectangles go left to right in rows (shelves), each as tall as its tallest rectangle; a rectangle that does not fit the row starts the next one. It is simple, fast and tight enough for images of similar height.
func NewShelf ¶
NewShelf returns a packer for an atlas width texels wide that may grow to maxHeight texels (the device's maxTextureDimension2D bounds it).