Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to render sprites.

It can be used either to render Sprites or ThinSprites with ThinEngine only.

Hierarchy

  • SpriteRenderer

Index

Constructors

  • Creates a new sprite Renderer

    Parameters

    • engine: ThinEngine

      defines the engine the renderer works with

    • capacity: number

      defines the maximum allowed number of sprites

    • Optional epsilon: number

      defines the epsilon value to align texture (0.01 by default)

    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns SpriteRenderer

Properties

autoResetAlpha: boolean

Gets or sets a boolean indicating if alpha mode is automatically reset.

blendMode: 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

cellHeight: number

Defines the default height of a cell in the spritesheet

cellWidth: number

Defines the default width of a cell in the spritesheet

disableDepthWrite: 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.

fogEnabled: boolean

Gets or sets a boolean indicating if the manager must consider scene fog when rendering

Defines the texture of the spritesheet

Accessors

  • get capacity(): number
  • Gets the capacity of the manager

    Returns number

  • get pixelPerfect(): boolean
  • set pixelPerfect(value: boolean): void
  • Gets or sets a boolean indicating if the renderer must render sprites with pixel perfect rendering Note that pixel perfect mode is not supported in WebGL 1

    Returns boolean

  • Gets or sets a boolean indicating if the renderer must render sprites with pixel perfect rendering Note that pixel perfect mode is not supported in WebGL 1

    Parameters

    • value: boolean

    Returns void

Methods

  • dispose(): void
  • Release associated resources

    Returns void

  • rebuild(): void
  • Rebuilds the renderer (after a context lost, for eg)

    Returns void

  • render(sprites: ThinSprite[], deltaTime: number, viewMatrix: IMatrixLike, projectionMatrix: IMatrixLike, customSpriteUpdate?: Nullable<((sprite: ThinSprite, baseSize: ISize) => void)>): void
  • Render all child sprites

    Parameters

    • sprites: ThinSprite[]

      defines the list of sprites to render

    • deltaTime: number

      defines the time since last frame

    • viewMatrix: IMatrixLike

      defines the viewMatrix to use to render the sprites

    • projectionMatrix: IMatrixLike

      defines the projectionMatrix to use to render the sprites

    • Optional customSpriteUpdate: Nullable<((sprite: ThinSprite, baseSize: ISize) => void)>

      defines a custom function to update the sprites data before they render

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme