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} from "../src/viewer/Viewer.js";
import {XKTLoaderPlugin} from "../src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js";
import {FastNavPlugin} from "../src/plugins/FastNavPlugin/FastNavPlugin.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, {});

const xktLoader = new XKTLoaderPlugin(viewer);

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

Constructor Summary

Public Constructor
public

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() source

Creates this Plugin and installs it into the given Viewer.

Override:

Plugin#constructor

Public Methods

public destroy() source

Destroys this plugin.

Override:

Plugin#destroy