Skip to main content

Interface: ImportedTexture

Defined in: rendering/utilities/import-texture.ts:34

The result of running a texture through importTexture.

Extends​

Properties​

height​

height: number

Defined in: rendering/utilities/import-texture.ts:28

The texture's pixel height to import. Defaults to image.height.

Inherited from​

ImportTextureOptions.height


image​

image: HTMLImageElement

Defined in: rendering/utilities/import-texture.ts:38

The source image this texture was imported from.


pixelsPerUnit​

pixelsPerUnit: number

Defined in: rendering/utilities/import-texture.ts:15

How many pixels of the texture span one world unit, mirroring a texture asset's "Pixels Per Unit" import setting in engines like Unity. The resulting worldWidth/worldHeight are width / pixelsPerUnit and height / pixelsPerUnit. This is independent of calculatePixelsPerUnit, which converts world units to screen pixels at render time based on the camera; pixelsPerUnit here converts texture pixels to world units once, at import time. Defaults to 100.

Inherited from​

ImportTextureOptions.pixelsPerUnit


width​

width: number

Defined in: rendering/utilities/import-texture.ts:23

The texture's pixel width to import. Defaults to image.width; override for a texture whose usable pixel width differs from the source image, for example a single frame trimmed out of a larger sprite sheet.

Inherited from​

ImportTextureOptions.width


worldHeight​

worldHeight: number

Defined in: rendering/utilities/import-texture.ts:48

The texture's height in world units: height / pixelsPerUnit.


worldWidth​

worldWidth: number

Defined in: rendering/utilities/import-texture.ts:43

The texture's width in world units: width / pixelsPerUnit.