Skip to content

About

three_plugins is a collection of use-case specific plugins for navara_three. While the core library provides the Plugin base class and three_default_plugin handles descriptor registration, three_plugins provides higher-level plugins that solve specific use cases out of the box.

navara_three (core: ThreeView, Plugin, addPlugin)
├── three_default_descs (descriptor implementations)
├── three_default_plugin (DefaultPlugin: bulk descriptor registration)
└── three_plugins (use-case specific plugins)
├── PersonViewPlugin (keyboard-driven first/third-person view controller)
├── OverlayPlugin (world-to-screen HTML overlay projection)
├── CesiumIonPlugin (Cesium Ion quantized-mesh terrain)
├── TileJsonPlugin (TileJSON 3.0.0 tile source registration)
├── StreetLightsPlugin (street lamps, roof beacons and traffic at night)
├── CZMLPlugin (CZML documents whose style changes over time)
├── DevtoolsPlugin (development tools: profiler, layer and camera inspectors)
└── MaterialSchemaPlugin (layer materials and styles as JSON for style UIs;
the schema itself is @navaramap/material-schema)

three_plugins depends on navara_three for the Plugin base class and core APIs, and on three_default_plugin for the DefaultDescriptions type. Each plugin is independent. You can use one without the other.

import {
PersonViewPlugin,
OverlayPlugin,
moveOverlayElement,
CesiumIonPlugin,
TileJsonPlugin,
StreetLightsPlugin,
CZMLPlugin,
DevtoolsPlugin,
MaterialSchemaPlugin,
} from "@navaramap/three-plugins";

A keyboard-driven first-/third-person view controller. Drives a virtual position on the globe with WASD / arrow keys and follows it with a chase camera (TPV) or eye camera (FPV). Optionally attaches a GLTF character whose animations cross-fade between idle and dash. See PersonViewPlugin for details.

Projects geographic positions (lat/lng/alt) to screen coordinates on every render frame, enabling HTML overlays that track world positions. See OverlayPlugin for details.

Resolves a Cesium Ion asset endpoint at init() time and registers it as a quantized-mesh terrain layer via addTerrain(). See CesiumIonPlugin for details.

Fetches a TileJSON 3.0.0 document and registers it as a single raster, vector, or raster-DEM (elevation) tile source via addSource(), deriving the tile URL, zoom range, scheme, attribution (and, for raster-DEM, the MapLibre-compatible tileSize / encoding) from the document. See TileJsonPlugin for details.

Takes the roads and the buildings of a vector tile set, each with its source and a reader for its properties, draws the road surfaces, and streams the zoom 14 tiles in around a position to place street lamps along the roads, red beacons on the roofs the reader picks and cars that drive the road segments. The lamps and beacons take part in the selective effects given to start(), such as the built-in bloom. See StreetLightsPlugin for details.

Reads a CZML document whose shapes stay in place while their style or visibility changes over time, and shows its polygons, polylines and labels as layers. While the document plays, each sampled height and color moves from one sample to the next as a transition blended on the GPU, and setTime() or setSample() moves it to another point in time. See CZMLPlugin for details, and Supported CZML for the supported properties.

Development tools on one panel: a profiler (frame time, memory, downloads, render buffers) a layer inspector (each layer’s cost, visibility and a style form) and a camera inspector (position, orientation and field of view, with copy and paste). For development builds only. See DevtoolsPlugin for details.

Describes every layer material the engine accepts as JSON: the materials of each layer type, and each field’s kind, documentation, default, accepted values and whether a change applies at once or only after the layer is added again. describeLayer() adds a layer’s own values, for building a style UI. See MaterialSchemaPlugin for details.

All plugins follow the standard plugin lifecycle: create an instance, register it with view.addPlugin() before view.init(), and then use plugin-specific methods after initialization.

import ThreeView from "@navaramap/three";
import { DefaultPlugin } from "@navaramap/three-default-plugin";
import { PersonViewPlugin, OverlayPlugin } from "@navaramap/three-plugins";
const view = new ThreeView({ container, animation: true });
const defaultPlugin = new DefaultPlugin();
const personView = new PersonViewPlugin({
character: {
modelUrl: "/glTF/bird/scene.gltf",
animation: {
idleClip: "Gliding",
dashClip: "Flapping",
speed: 1.0,
crossfadeDuration: 0.3,
},
},
});
const overlay = new OverlayPlugin({ maxDistance: 100_000 });
view.addPlugin(defaultPlugin);
view.addPlugin(personView);
view.addPlugin(overlay);
await view.init();
personView.start();