Skip to main content

flywave-3dtile-datasource.tilesrendererbase

Home > @flywave/flywave-3dtile-datasource > TilesRendererBase

TilesRendererBase class

Base class for 3D Tiles renderers with core functionality for loading, managing, and rendering tilesets.

This class provides the foundational infrastructure for 3D Tiles rendering, including: - Tile loading and management using LRU cache - Hierarchical tile traversal and refinement - Priority-based downloading and parsing queues - Memory management and resource disposal - Event dispatching for loading progress and errors

Signature:

export declare class TilesRendererBase 

Constructors

Constructor

Modifiers

Description

(constructor)(url)

Creates a new TilesRendererBase instance

Properties

Property

Modifiers

Type

Description

activeTiles

readonly

Set<ITile>

Set of currently active tiles

displayActiveTiles

boolean

Whether to display active tiles

downloadQueue

readonly

PriorityQueue<ITile>

Priority queue for tile downloads

dracoPath

protected

readonly

string | undefined

errorTarget

number

Error target for level-of-detail calculations

errorThreshold

number

Gets the error threshold (deprecated)

fetchOptions

protected

RequestInit

Fetch options for tile requests

frameCount

number

Frame counter for tracking updates

loadProgress

readonly

number

Gets the current loading progress (0 to 1)

lruCache

readonly

LRUCache<ITile>

LRU cache for tile management

maxDepth

number

Maximum depth for tile traversal

parseQueue

readonly

PriorityQueue<ITile>

Priority queue for tile parsing

preprocessURL?

(url: string, parent?: ITile) => string

(Optional) Optional URL preprocessing function

processNodeQueue

readonly

PriorityQueue<ITile>

Priority queue for node processing

root

readonly

ITile | null

Gets the root tile of the tileset

rootTileSet

protected

TileSet | null

Root tileset object

stats

Stats

Statistics object for tracking tile loading and rendering status

usedSet

readonly

Set<ITile>

Set of currently used tiles

visibleTiles

readonly

Set<ITile>

Set of currently visible tiles

Methods

Method

Modifiers

Description

calculateTileViewError(tile, target)

Calculates the screen space error for a tile

dispatchEvent(e)

Dispatches an event (to be overridden by subclasses)

dispose()

Disposes of all resources

This function cleans up all tiles and resets statistics.

disposeTile(tile)

Disposes of tile resources

ensureChildrenArePreprocessed(tile, immediate)

Ensures children tiles are preprocessed

fetchSubtreeTile(url, fetchOptions)

Fetches subtree data from a URL

fetchTileContent(url, fetchOptions)

Fetches tile content from a URL

fetchTileJson(url, fetchOptions)

Fetches tileset JSON data from a URL

loadRootTileSet()

protected

Loads the root tileset

markTileUsed(tile)

Marks a tile as used (preventing it from being unloaded)

parseTile(content, tile, extension, uri, signal)

Parses tile content

parseTileSubtree(content, tile, extension, uri, signal)

protected

Parses subtree tile content

preprocessNode(tile, tileSetDir, parentTile)

Preprocesses a tile node

This function initializes tile properties and prepares the tile for rendering.

queueTileForDownload(tile)

Queues a tile for download

resetFailedTiles()

Resets tiles that failed to load

This function resets the loading state of failed tiles and the root tileset so they can be retried.

setTileActive(tile, active)

Sets a tile's active state

setTileVisible(tile, visible)

Sets a tile's visibility state

traverse(beforecb, aftercb, ensureFullyProcessed)

Traverses the tile hierarchy

update()

Main update function that should be called every frame

This function performs the core tile loading and rendering logic: - Loads the root tileset if not already loaded - Updates tile states based on camera visibility - Loads queued tiles - Unloads unused tiles - Dispatches events for loading progress