Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SpriteRenderer

Class used to render sprites.

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

Hierarchy

  • SpriteRenderer

Index

Constructors

constructor

  • 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

autoResetAlphaSearch playground for autoResetAlpha

autoResetAlpha: boolean

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

blendModeSearch playground for blendMode

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

cellHeightSearch playground for cellHeight

cellHeight: number

Defines the default height of a cell in the spritesheet

cellWidthSearch playground for cellWidth

cellWidth: number

Defines the default width of a cell in the spritesheet

disableDepthWriteSearch playground for disableDepthWrite

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.

fogEnabledSearch playground for fogEnabled

fogEnabled: boolean

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

textureSearch playground for texture

Defines the texture of the spritesheet

Accessors

capacity

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

    Returns number

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Release associated resources

    Returns void

rebuildSearch playground for rebuild

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

    Returns void

renderSearch playground for render

  • 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
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method