ThreePipe
    Preparing search index...

    Class PerfPanelPlugin

    PerfPanelPlugin shows a small FPS / performance panel over the canvas, in plain DOM.

    Collapsed, it is a pill "60 fps" with a status dot (green, amber, red), and an amber corner dot when a warning is on. A click opens the card: a sparkline of the frame times (last 3 s; accent bars rendered, grey bars idle), frame time avg / p95 / max, CPU render time, renders per second, draw calls and triangles, canvas size, GPU and JS heap. A click on the card header collapses it again. Drag the pill or the card header to move the panel; it stays inside the container, also when the container gets smaller. Setting position (the Position dropdown) puts it back in a corner. The dragged place is kept while the page is open, not saved.

    Collapsed, the pill is an overlay on the canvas (z-index 12, under the loading screen). The open card is viewer UI (z-index 150 and up, see UI layers in CONTRIBUTING.md), below the bars of the editor (200). With other panels of that layer, such as the sticky notes, the one pressed last is in front (raiseOnPress); opening the card is a press.

    Warnings (also in stats.warnings): frame rate capped at ~30 fps (Chrome Energy Saver, Low Power Mode), CPU or GPU bound, on battery, software rendering, tab hidden.

    It measures with its own requestAnimationFrame loop and the viewer's preRender / postRender events. It never calls setDirty, so an idle viewer stays idle. Draw calls and triangles are summed over all the passes of a render (it wraps renderer.info.update while rendering, and restores it on remove).

    const perf = viewer.addPluginSync(new PerfPanelPlugin({position: 'bottom-right'}))
    perf.addEventListener('update', ({stats}) => console.log(stats.fps, stats.warnings))

    Hierarchy (View Summary)

    Index
    _dirty: boolean = false
    _viewer?: ThreeViewer
    _viewerListeners: PartialRecord<IViewerEventTypes, (e: IViewerEvent) => void> = {}
    constructor: typeof AViewerPluginSync & typeof AViewerPlugin
    element: HTMLDivElement

    The root element of the panel. It is in the container while the plugin is added.

    isViewerPluginSync: true = ...
    serializeWithViewer: boolean = false
    uiConfig: UiObjectConfig = ...
    OldPluginType?: string
    PluginType: "PerfPanelPlugin" = 'PerfPanelPlugin'