Options
All
  • Public
  • Public/Protected
  • All
Menu

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

see

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

Hierarchy

  • TexturePacker

Index

Constructors

  • 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

The Container array for the frames that are generated

meshes: AbstractMesh[]

The Meshes to target

name: string

The Name of the Texture Package

Arguments passed with the Constructor

promise: Nullable<Promise<string | TexturePacker>>

The promise that is started upon initialization

scene: Scene

The scene scope of the TexturePacker

sets: object

The Container object for the channel sets that are generated

LAYOUT_COLNUM: 2 = 2

Packer Layout Constant 2

LAYOUT_POWER2: 1 = 1

Packer Layout Constant 1

LAYOUT_STRIP: 0 = 0

Packer Layout Constant 0

SUBUV_COLOR: 2 = 2

Packer Layout Constant 2

SUBUV_EXTEND: 1 = 1

Packer Layout Constant 1

SUBUV_WRAP: 0 = 0

Packer Layout Constant 0

Methods

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

    Returns void

  • 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(): Promise<void>

Starts the async promise to compile the texture packer.

Returns Promise<void>

Promise
  • 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(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
  • Static property
  • Static method
  • Inherited constructor

Settings

Theme