Documentation - v20.0.0-dev
    Preparing search index...

    Entry point of the sprites: images facing the camera, of a size in world units (as three.js Sprites), for markers and labels. addSprites() takes InputSprites and returns a SpriteProxy per sprite. Each sprite is an index of the SpriteTable (its position, size, image, opacity, layer, whether shown), its image a layer of a TextureArray (the scene's settings.sprites.imageSize pixels square), drawn once per key and shared. An image of any size fills its sprite's rectangle: a sprite of the image's aspect shows it undistorted.

    The controller is the only writer of its sprites. They are added and removed many at once (addSprites, removeSprites); each is changed through its proxy (sprite.visible = false), which calls the controller: it updates its table, and queues the changes of its leaf for the scene's BoxTree (boxTree, shared with the meshes: their picking, later their culling), those of a task sent in one command. It tells nobody: the renderers read the table's and the images' changes once per frame, and draw the shown sprites of a layer in one instanced draw, listed again when one is shown, hidden or moved to another layer (SpriteTable.listVersion).

    Index

    Constructors

    Properties

    boxTree: BoxTree

    The scene's BoxTree, shared with the meshes: a leaf per sprite (its id from LeafIds), its box whatever the camera (getBoundingBox), whether it is shown and the bit of its layer, as the mesh parts'. Followed a message later (see BoxTree.whenApplied): read it, do not change it.

    group: Group<Object3DEventMap> = ...

    The three.js objects that draw the sprites, in the scene's three.js scene: filled by the sprite renderer of the backend drawing the scene, emptied when it is freed.

    Accessors

    • get byteLength(): number

      Memory of the sprites, in bytes: their table and images (the scene's BoxTree apart).

      Returns number

    • get count(): number

      Sprites in the controller.

      Returns number

    • get version(): number

      Changes with every change of its sprites: added, removed, moved, resized, shown, hidden, made more or less opaque, moved to another layer or given another image. Compare it with the value read last to know whether something changed since.

      Returns number

    Methods

    • Adds sprites, shown, in their layer (MeshLayer.Layer4 by default): each image drawn the first time its key comes; their leaves inserted into the BoxTree at once, with their layer. Throws, adding none, at a sprite whose layer is not one, or whose image the array cannot hold (the scene's settings.sprites.maxImages, or fewer on a GPU taking fewer), and when the BoxTree cannot hold them (settings.scene.boxTreeMaxNodes).

      Parameters

      Returns SpriteProxy[]

      Their proxies, in the order of inputs.

    • Removes every sprite (see removeSprites): the BoxTree emptied at once when it holds only their leaves, else the meshes' kept.

      Returns void

    • The sprites in the controller.

      Returns SpriteProxy[]

    • Whether the proxy is of a sprite of this controller (not removed).

      Parameters

      Returns boolean

    • Whether an image of this key is held (see TextureImage): a sprite given it shares it, its source not read, e.g. not drawn by the application.

      Parameters

      • key: string

      Returns boolean

    • Whether the sprite is active: its leaf in the BoxTree (see setActive). True when added; false for a removed sprite.

      Parameters

      Returns boolean

    • Removes sprites: their leaves from the BoxTree at once, their proxies invalidated, their image with its last sprite. The proxies removed already are skipped; throws, removing none, at a proxy of another controller.

      Parameters

      Returns void

    • Takes the sprite out of the BoxTree, or puts it back: inactive, it is neither bounded, culled in nor picked, its image and state kept (e.g. a sprite deleted, its deletion undoable). Hide it too for the renderers drawing without culling. Nothing for a removed sprite, nor when it is so already.

      Parameters

      Returns void

      When the BoxTree cannot hold it again (see BoxTree.canHold).