atlas

package
v0.0.0-...-03afc55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package atlas provides a basic texture atlas

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAtlasFull is returned when an image can't fit in an atlas
	ErrAtlasFull = errors.New("atlas full")
)

Functions

func CopyImage

func CopyImage(data, buffer []byte, targetX, targetY, w, h, width, height, pixelSize, padding int)

CopyImage copies the passed image data to the target buffer, accounting for padding.

Types

type Rect

type Rect struct {
	X, Y          int
	Width, Height int
}

Rect represents a location in a texture atlas.

type Type

type Type struct {
	Buffer []byte
	// contains filtered or unexported fields
}

Type is a texture atlas for storing quake pictures (from the bsp package). The buffer is public to allow easy uploading to the gpu.

func New

func New(width, height, pixelSize int) *Type

New creates an atlas of the specified size with zero padding around the textures. pixelSize controls the number of bytes per a pixel

func NewLight

func NewLight(width, height, padding int) *Type

NewLight creates an atlas of the specified size. Textures are padded with the passed number of pixels around each size. This is useful for filtering textures without other textures bleeding through. pixelSize controls the number of bytes per a pixel. This will have no backing buffer.

func NewPadded

func NewPadded(width, height, pixelSize, padding int) *Type

NewPadded creates an atlas of the specified size. Textures are padded with the passed number of pixels around each size. This is useful for filtering textures without other textures bleeding through. pixelSize controls the number of bytes per a pixel

func (*Type) Add

func (a *Type) Add(image []byte, width, height int) (*Rect, error)

Add adds the passed texture to the atlas and returns the location in the atlas. This method panics if the atlas has been baked.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL