Class TexturePacker
Constructors
constructor
-
new TexturePacker(
name: string,
meshes: AbstractMesh[],
options: ITexturePackerOptions,
scene: Scene,
): TexturePackerInitializes 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
- name: string
Properties
frames
The Container array for the frames that are generated
meshes
The Meshes to target
name
The Name of the Texture Package
options
Arguments passed with the Constructor
promise
The promise that is started upon initialization
scene
The scene scope of the TexturePacker
sets
The Container object for the channel sets that are generated
Static ReadonlyLAYOUT_ COLNUM
Packer Layout Constant 2
Static ReadonlyLAYOUT_ POWER2
Packer Layout Constant 1
Static ReadonlyLAYOUT_ STRIP
Packer Layout Constant 0
Static ReadonlySUBUV_ COLOR
Packer Layout Constant 2
Static ReadonlySUBUV_ EXTEND
Packer Layout Constant 1
Static ReadonlySUBUV_ WRAP
Packer Layout Constant 0
Methods
dispose
-
Disposes all textures associated with this packer
Returns void
download
-
Starts the download process for all the channels converting them to base64 data and embedding it all in a JSON file.
Parameters
- imageType: string = "png"
is the image type to use.
- quality: number = 1
of the image if downloading as jpeg, Ranges from >0 to 1.
Returns void
- imageType: string = "png"
process Async
Starts the async promise to compile the texture packer.
Returns Promise<void>
Promiseset Mesh To Frame
-
Public method to set a Mesh to a frame
Parameters
- m: AbstractMesh
that is the target
- frameID: number
or the frame index
- updateMaterial: boolean = false
trigger for if the Meshes attached Material be updated?
Returns void
- m: AbstractMesh
update From JSON
-
Public method to load a texturePacker JSON file.
Parameters
- data: string
of the JSON file in string format.
Returns void
- data: string
This is a support class that generates a series of packed texture sets.
See
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction