TexturePacker

This is a support class that generates a series of packed texture sets.

see

https://doc.babylonjs.com/babylon101/materials

Hierarchy

  • TexturePacker

Index

Constructors

constructor

Find examples in Playground
  • Initializes a texture package series from an array of meshes or a single mesh.

    Parameters

    • name: string

      The name of the package

    • meshes: AbstractMesh[]

      The target meshes to compose the package from

    • options: ITexturePackerOptions

      The arguments that texture packer should follow while building.

    • scene: Scene

      The scene which the textures are scoped to.

    Returns TexturePacker

    TexturePacker

Properties

frames

Find examples in Playground

The Container array for the frames that are generated

meshes

Find examples in Playground
meshes: AbstractMesh[]

The Meshes to target

name

Find examples in Playground
name: string

The Name of the Texture Package

options

Find examples in Playground

Arguments passed with the Constructor

promise

Find examples in Playground
promise: Nullable<Promise<TexturePacker | string>>

The promise that is started upon initialization

scene

Find examples in Playground
scene: Scene

The scene scope of the TexturePacker

sets

Find examples in Playground
sets: object

The Container object for the channel sets that are generated

Static LAYOUT_COLNUM

Find examples in Playground
LAYOUT_COLNUM: number

Packer Layout Constant 2

Static LAYOUT_POWER2

Find examples in Playground
LAYOUT_POWER2: number

Packer Layout Constant 1

Static LAYOUT_STRIP

Find examples in Playground
LAYOUT_STRIP: number

Packer Layout Constant 0

Static SUBUV_COLOR

Find examples in Playground
SUBUV_COLOR: number

Packer Layout Constant 2

Static SUBUV_EXTEND

Find examples in Playground
SUBUV_EXTEND: number

Packer Layout Constant 1

Static SUBUV_WRAP

Find examples in Playground
SUBUV_WRAP: number

Packer Layout Constant 0

Methods

dispose

Find examples in Playground
  • dispose(): void
  • Disposes all textures associated with this packer

    Returns void

download

Find examples in Playground
  • download(imageType?: string, quality?: number): void
  • Starts the download process for all the channels converting them to base64 data and embedding it all in a JSON file.

    Parameters

    • Optional imageType: string

      is the image type to use.

    • Optional quality: number

      of the image if downloading as jpeg, Ranges from >0 to 1.

    Returns void

processAsync

Find examples in Playground
  • processAsync(): Promise<void>
  • Starts the async promise to compile the texture packer.

    Returns Promise<void>

    Promise

setMeshToFrame

Find examples in Playground
  • setMeshToFrame(m: AbstractMesh, frameID: number, updateMaterial?: boolean): void
  • Public method to set a Mesh to a frame

    Parameters

    • m: AbstractMesh

      that is the target

    • frameID: number

      or the frame index

    • Optional updateMaterial: boolean

      trigger for if the Meshes attached Material be updated?

    Returns void

updateFromJSON

Find examples in Playground
  • updateFromJSON(data: string): void
  • Public method to load a texturePacker JSON file.

    Parameters

    • data: string

      of the JSON file in string format.

    Returns void

Generated using TypeDoc