import {ViewCullPlugin} from '@xeokit/xeokit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js'
ViewCullPlugin
Extends:
Viewer plugin that performs view frustum culling to accelerate rendering performance.
For each Entity that represents an object, ViewCullPlugin
will automatically
set Entity#culledfalse
whenever it falls outside our field of view.
When culled, an Entity
is not processed by xeokit's renderer.
Internally, ViewCullPlugin
organizes Entitys in
a bounding volume hierarchy, implemented as
a kd-tree.
On each Scene "tick" event, ViewCullPlugin
searches the kd-tree using a frustum generated from
the Camera, marking each Entity
culled if it falls outside the frustum.
Use ViewCullPlugin
by simply adding it to your Viewer
:
const viewer = new Viewer({
canvasId: "myCanvas",
transparent: true
});
const viewCullPlugin = new ViewCullPlugin(viewer, {
maxTreeDepth: 20
});
const xktLoader = new XKTLoaderPlugin(viewer);
const model = xktLoader.load({
id: "myModel",
src: "./models/xkt/OTCConferenceCenter.xkt"
});
Constructor Summary
Public Constructor | ||
public |
constructor(viewer: Viewer, cfg: Object) |
Member Summary
Public Members | ||
public set |
Sets whether view culling is enabled. |
|
public get |
enabled: * Gets whether view culling is enabled. |
Method Summary
Public Methods | ||
public |
destroy() Destroys this ViewCullPlugin. |
Inherited Summary
From class Plugin | ||
public |
ID for this Plugin, unique within its Viewer. |
|
public |
The Viewer that contains this Plugin. |
|
public |
destroy() Destroys this Plugin and removes it from its Viewer. |
|
public |
Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin. |
|
public |
Fires an event on this Plugin. |
|
public |
Returns true if there are any subscribers to the given event on this Plugin. |
|
public |
Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin. |
|
public |
Cancels an event subscription that was previously made with Plugin#on or Plugin#once. |
|
public |
Subscribes to an event on this Plugin. |
|
public |
Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd. |
|
public |
scheduleTask(task: *) Schedule a task to perform on the next browser interval |
|
public |
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.