API

Interface ISpriteManager

Defines the minimum interface to fulfill in order to be a sprite manager.

interface ISpriteManager {
    cellHeight: number;
    cellWidth: number;
    doNotSerialize?: boolean;
    isPickable: boolean;
    layerMask: number;
    name: string;
    renderingGroupId: number;
    scene: Scene;
    sprites: Sprite[];
    texture: Texture;
    uniqueId: number;
    dispose(): void;
    intersects(
        ray: Ray,
        camera: Camera,
        predicate?: (sprite: Sprite) => boolean,
        fastCheck?: boolean,
    ): Nullable<PickingInfo>;
    isReady?(): boolean;
    multiIntersects(
        ray: Ray,
        camera: Camera,
        predicate?: (sprite: Sprite) => boolean,
    ): Nullable<PickingInfo[]>;
    rebuild(): void;
    render(): void;
    serialize(serializeTexture?: boolean): any;
}

Hierarchy (View Summary)

Implemented by

Index
cellHeight: number

Defines the default height of a cell in the spritesheet

cellWidth: number

Defines the default width of a cell in the spritesheet

doNotSerialize?: boolean

Specifies if the sprite manager should be serialized

isPickable: boolean

Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true

layerMask: number

Restricts the camera to viewing objects with the same layerMask. A camera with a layerMask of 1 will render spriteManager.layerMask & camera.layerMask!== 0

name: string

Gets manager's name

renderingGroupId: number

Specifies the rendering group id for this mesh (0 by default)

scene: Scene

Gets the hosting scene

sprites: Sprite[]

Defines the list of sprites managed by the manager.

texture: Texture

Gets or sets the spritesheet texture

uniqueId: number

Gets or sets the unique id of the sprite manager

  • Tests the intersection of a sprite with a specific ray.

    Parameters

    • ray: Ray

      The ray we are sending to test the collision

    • camera: Camera

      The camera space we are sending rays in

    • Optionalpredicate: (sprite: Sprite) => boolean

      A predicate allowing excluding sprites from the list of object to test

    • OptionalfastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    Returns Nullable<PickingInfo>

    picking info or null.

  • Checks whether this manager can render its sprites in the current render pass. Optional for custom sprite manager implementations.

    Returns boolean

    true when the manager is ready to render

  • Serializes the sprite manager to a JSON object

    Parameters

    • OptionalserializeTexture: boolean

      defines whether the texture must be serialized as well (false by default)

    Returns any