Class: PrepareBase

PrepareBase

Part of the prepare system. Responsible for uploading all the items to the GPU. This class provides the base functionality and handles processing the queue asynchronously.

new PrepareBase (renderer)

  • @param {Renderer} renderer - A reference to the current renderer
Name Type Description
renderer Renderer

Members

uploadsPerFrame number static

The number of uploads to process per frame

Default Value:
  • 4

queue PrepareQueueItem[] protected

The queue to process over a async timer

renderer Renderer protected

Reference to the renderer

resolves ((value: void | PromiseLike<void>) => void)[] protected

Collection of callbacks to call when the uploads are finished

timeout number protected

Timeout id for next processing call

Methods

add (resource) this

Add a textures or graphics resource to the queue

Name Type Description
resource PrepareSourceItem | PrepareSourceItem<Array>
Returns:
Type Description
this

dedupeQueue () void

eliminate duplicates before processing

getQueue () Array<PrepareQueueItem>

Return a copy of the queue

Returns:
Type Description
Array<PrepareQueueItem> The queue

upload (resource) Promise<void>

Upload all the textures and graphics to the GPU (optionally add more resources to the queue first)

Name Type Attributes Description
resource PrepareSourceItem | PrepareSourceItem<Array> | unknown <optional>
Returns:
Type Description
Promise<void>

resolveQueueItem (source, queue) void abstractprotected

Resolve the given resource type and return an item for the queue

Name Type Description
source PrepareSourceItem
queue PrepareQueueItem[]