Reference Source
public class | source

FastNavPlugin

Extends:

Plugin → FastNavPlugin

Viewer plugin that improves interactivity by disabling expensive rendering effects while the Camera is moving.

Usage

In the example below, we'll create a Viewer, add a FastNavPlugin, then use an XKTLoaderPlugin to load a model.

This viewer will only render the model with enhanced edges, physically-based rendering (PBR) and scalable ambient obscurance (SAO) when the camera is not moving.

Note how we enable SAO and PBR on the Scene and the model.

import {Viewer, XKTLoaderPlugin, FastNavPlugin} from "xeokit-sdk.es.js";

const viewer = new Viewer({
     canvasId: "myCanvas",
     transparent: true,
     pbrEnabled: true,
     saoEnabled: true
 });

viewer.scene.camera.eye = [-66.26, 105.84, -281.92];
viewer.scene.camera.look = [42.45, 49.62, -43.59];
viewer.scene.camera.up = [0.05, 0.95, 0.15];

new FastNavPlugin(viewer, {
    pbrEnabled: true,
    saoEnabled: true,
    edgesEnabled: true
});

const xktLoader = new XKTLoaderPlugin(viewer);

const model = xktLoader.load({
     id: "myModel",
     src: "./models/xkt/HolterTower.xkt",
     edges: true,
     saoEnabled: true,
     pbrEnabled: true
});

Constructor Summary

Public Constructor
public

constructor(viewer: Viewer, cfg: Object)

Member Summary

Public Members
public set

Sets whether to show enhanced edges when the camera stops moving.

public get

Gets whether to show enhanced edges when the camera stops moving.

public set

Sets whether to enable physically-based rendering (PBR) when the camera stops moving.

public get

Gets whether to enable physically-based rendering (PBR) when the camera stops moving.

public set

Sets whether to enable scalable ambient occlusion (SAO) when the camera stops moving.

public get

Gets whether the FastNavPlugin enables SAO when switching to quality rendering.

Method Summary

Public Methods
public

Destroys this plugin.

Inherited Summary

From class Plugin
public

ID for this Plugin, unique within its Viewer.

public

The Viewer that contains this Plugin.

public

Destroys this Plugin and removes it from its Viewer.

public

error(msg: String)

Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

fire(event: String, value: Object)

Fires an event at this Plugin.

public

log(msg: String)

Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

on(event: String, callback: Function)

Subscribes to an event fired at this Plugin.

public

warn(msg: String)

Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

Public Constructors

public constructor(viewer: Viewer, cfg: Object) source

Creates this Plugin and installs it into the given Viewer.

Override:

Plugin#constructor

Params:

NameTypeAttributeDescription
viewer Viewer

The Viewer.

cfg Object

FastNavPlugin configuration.

cfg.id String
  • optional
  • default: "FastNav"

Optional ID for this plugin, so that we can find it within Viewer#plugins.

cfg.pbrEnabled Boolean
  • optional

Whether to enable physically-based rendering (PBR) when the camera stops moving. When not specified, PBR will be enabled if its currently enabled for the Viewer (see Viewer#pbrEnabled).

cfg.saoEnabled Boolean
  • optional

Whether to enable scalable ambient occlusion (SAO) when the camera stops moving. When not specified, SAO will be enabled if its currently enabled for the Viewer (see Scene#pbrEnabled).

cfg.edgesEnabled Boolean
  • optional

Whether to show enhanced edges when the camera stops moving. When not specified, edges will be enabled if they're currently enabled for the Viewer (see EdgeMaterial#edges).

Public Members

public set edgesEnabled: Boolean source

Sets whether to show enhanced edges when the camera stops moving.

Return:

Boolean

Whether edge enhancement will be enabled.

public get edgesEnabled: Boolean: * source

Gets whether to show enhanced edges when the camera stops moving.

Return:

Boolean

Whether edge enhancement will be enabled.

public set pbrEnabled: Boolean source

Sets whether to enable physically-based rendering (PBR) when the camera stops moving.

Return:

Boolean

Whether PBR will be enabled.

public get pbrEnabled: Boolean: * source

Gets whether to enable physically-based rendering (PBR) when the camera stops moving.

Return:

Boolean

Whether PBR will be enabled.

public set saoEnabled: Boolean source

Sets whether to enable scalable ambient occlusion (SAO) when the camera stops moving.

Return:

Boolean

Whether SAO will be enabled.

public get saoEnabled: Boolean: * source

Gets whether the FastNavPlugin enables SAO when switching to quality rendering.

Return:

Boolean

Whether SAO will be enabled.

Public Methods

public destroy() source

Destroys this plugin.

Override:

Plugin#destroy