Options
All
  • Public
  • Public/Protected
  • All
Menu

Class 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

  • 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

framesSearch playground for frames

The Container array for the frames that are generated

meshesSearch playground for meshes

meshes: AbstractMesh[]

The Meshes to target

nameSearch playground for name

name: string

The Name of the Texture Package

optionsSearch playground for options

Arguments passed with the Constructor

promiseSearch playground for promise

promise: Nullable<Promise<TexturePacker | string>>

The promise that is started upon initialization

sceneSearch playground for scene

scene: Scene

The scene scope of the TexturePacker

setsSearch playground for sets

sets: object

The Container object for the channel sets that are generated

Static Readonly LAYOUT_COLNUMSearch playground for LAYOUT_COLNUM

LAYOUT_COLNUM: 2 = 2

Packer Layout Constant 2

Static Readonly LAYOUT_POWER2Search playground for LAYOUT_POWER2

LAYOUT_POWER2: 1 = 1

Packer Layout Constant 1

Static Readonly LAYOUT_STRIPSearch playground for LAYOUT_STRIP

LAYOUT_STRIP: 0 = 0

Packer Layout Constant 0

Static Readonly SUBUV_COLORSearch playground for SUBUV_COLOR

SUBUV_COLOR: 2 = 2

Packer Layout Constant 2

Static Readonly SUBUV_EXTENDSearch playground for SUBUV_EXTEND

SUBUV_EXTEND: 1 = 1

Packer Layout Constant 1

Static Readonly SUBUV_WRAPSearch playground for SUBUV_WRAP

SUBUV_WRAP: 0 = 0

Packer Layout Constant 0

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Disposes all textures associated with this packer

    Returns void

downloadSearch playground for download

  • 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

  • processAsync(): Promise<void>

Starts the async promise to compile the texture packer.

Returns Promise<void>

Promise

setMeshToFrameSearch playground for setMeshToFrame

  • 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

updateFromJSONSearch playground for updateFromJSON

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

    Parameters

    • data: string

      of the JSON file in string format.

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method