Class SpritePackedManager
Hierarchy
- SpriteManager
- SpritePackedManager
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Creates a new sprite manager from a packed sprite sheet
Parameters
name: string
defines the manager's name
imgUrl: string
defines the sprite sheet url
capacity: number
defines the maximum allowed number of sprites
scene: Scene
defines the hosting scene
Optional spriteJSON: null | string
null otherwise a JSON object defining sprite sheet data
Optional epsilon: number
defines the epsilon value to align texture (0.01 by default)
Optional samplingMode: number
defines the sampling mode to use with spritesheet
Returns SpritePackedManager
Properties
is PickableSearch playground for isPickable
Gets or sets a boolean indicating if the sprites are pickable
layer MaskSearch playground for layerMask
Gets or sets camera layer mask
nameSearch playground for name
defines the packed manager's name
on Dispose ObservableSearch playground for onDisposeObservable
An event triggered when the manager is disposed.
rendering Group IdSearch playground for renderingGroupId
Gets or sets the rendering group id (0 by default)
snippet IdSearch playground for snippetId
Snippet ID if the manager was created from the snippet server
spritesSearch playground for sprites
Gets the list of sprites
unique IdSearch playground for uniqueId
Gets or sets the unique id of the sprite
Static Create From Snippet AsyncSearch playground for CreateFromSnippetAsync
Type declaration
Creates a sprite manager from a snippet saved by the sprite editor
Parameters
snippetId: string
defines the snippet to load (can be set to _BLANK to create a default one)
scene: Scene
defines the hosting scene
Optional rootUrl: string
defines the root URL to use to load textures and relative dependencies
Returns Promise<SpriteManager>
a promise that will resolve to the new sprite manager
Static Snippet UrlSearch playground for SnippetUrl
Define the Url to load snippets
Accessors
blend Mode
Blend mode use to render the particle, it can be any of the static Constants.ALPHA_x properties provided in this class. Default value is Constants.ALPHA_COMBINE
Returns number
Blend mode use to render the particle, it can be any of the static Constants.ALPHA_x properties provided in this class. Default value is Constants.ALPHA_COMBINE
Parameters
blendMode: number
Returns void
capacity
Gets the capacity of the manager
Returns number
cell Height
Defines the default height of a cell in the spritesheet
Returns number
Defines the default height of a cell in the spritesheet
Parameters
value: number
Returns void
cell Width
Defines the default width of a cell in the spritesheet
Returns number
Defines the default width of a cell in the spritesheet
Parameters
value: number
Returns void
children
Gets the array of sprites
Returns Sprite[]
disable Depth Write
Disables writing to the depth buffer when rendering the sprites. It can be handy to disable depth writing when using textures without alpha channel and setting some specific blend modes.
Returns boolean
Disables writing to the depth buffer when rendering the sprites. It can be handy to disable depth writing when using textures without alpha channel and setting some specific blend modes.
Parameters
value: boolean
Returns void
fog Enabled
Gets or sets a boolean indicating if the manager must consider scene fog when rendering
Returns boolean
Gets or sets a boolean indicating if the manager must consider scene fog when rendering
Parameters
value: boolean
Returns void
on Dispose
Callback called when the manager is disposed
Parameters
callback: (() => void)
Returns void
Returns void
scene
Gets the hosting scene
Returns Scene
texture
Methods
disposeSearch playground for dispose
Release associated resources
Returns void
get Class NameSearch playground for getClassName
Returns the string "SpriteManager"
Returns string
"SpriteManager"
intersectsSearch playground for intersects
Intersects the sprites with a ray
Parameters
ray: Ray
defines the ray to intersect with
camera: Camera
defines the current active camera
Optional predicate: ((sprite: Sprite) => boolean)
defines a predicate used to select candidate sprites
Parameters
sprite: Sprite
Returns boolean
Optional fastCheck: boolean
defines if a fast check only must be done (the first potential sprite is will be used and not the closer)
Returns Nullable<PickingInfo>
null if no hit or a PickingInfo
multi IntersectsSearch playground for multiIntersects
Intersects the sprites with a ray
Parameters
ray: Ray
defines the ray to intersect with
camera: Camera
defines the current active camera
Optional predicate: ((sprite: Sprite) => boolean)
defines a predicate used to select candidate sprites
Parameters
sprite: Sprite
Returns boolean
Returns Nullable<PickingInfo[]>
null if no hit or a PickingInfo array
rebuildSearch playground for rebuild
Rebuilds the manager (after a context lost, for eg)
Returns void
renderSearch playground for render
Render all child sprites
Returns void
serializeSearch playground for serialize
Serializes the sprite manager to a JSON object
Parameters
Optional serializeTexture: boolean
defines if the texture must be serialized as well
Returns any
the JSON object
Static ParseSearch playground for Parse
Parses a JSON object to create a new sprite manager.
Parameters
parsedManager: any
The JSON object to parse
scene: Scene
The scene to create the sprite manager
rootUrl: string
The root url to use to load external dependencies like texture
Returns SpriteManager
the new sprite manager
Static Parse From File AsyncSearch playground for ParseFromFileAsync
Creates a sprite manager from a snippet saved in a remote file
Parameters
name: Nullable<string>
defines the name of the sprite manager to create (can be null or empty to use the one from the json data)
url: string
defines the url to load from
scene: Scene
defines the hosting scene
Optional rootUrl: string
defines the root URL to use to load textures and relative dependencies
Returns Promise<SpriteManager>
a promise that will resolve to the new sprite manager
Static Parse From Snippet AsyncSearch playground for ParseFromSnippetAsync
Creates a sprite manager from a snippet saved by the sprite editor
Parameters
snippetId: string
defines the snippet to load (can be set to _BLANK to create a default one)
scene: Scene
defines the hosting scene
Optional rootUrl: string
defines the root URL to use to load textures and relative dependencies
Returns Promise<SpriteManager>
a promise that will resolve to the new sprite manager
Class used to manage multiple sprites of different sizes on the same spritesheet
https://doc.babylonjs.com/babylon101/sprites