panolens.js Documentation

repository·master·Indexed 25 days ago

https://github.com/pchen66/panolens.js

An event-driven, WebGL-based 360 panorama viewer built on top of Three.js. It supports equirectangular images, linking multiple panoramas, and integrating Google Street View. Key features include the ImagePanorama and GoogleStreetviewPanorama classes, interactive Infospots, and a Reticle system for user feedback. Note: This library is deprecated and will not receive further updates.

Tokens
3.9K
Snippets
4
Records
49
Agent score
83%

What's inside panolens.js

  1. Install Panolens.js via script tags

    master

    To use Panolens.js in a web project, you must include both three.min.js and panolens.min.js. Ensure the versions are compatible by checking the dependencies in package.json or by inspecting PANOLENS.VERSION and PANOLENS.THREE_VERSION at runtime.

    <script src="js/three.min.js"></script>
    <script src="js/panolens.min.js"></script>
  2. Create a 360 image panorama

    master

    To display a 360-degree equirectangular image, instantiate a PANOLENS.ImagePanorama with the image path and add it to a new PANOLENS.Viewer instance. The first panorama added to the viewer serves as the entry point.

    const panorama = new PANOLENS.ImagePanorama( 'asset/equirectangular.jpg' );
    const viewer = new PANOLENS.Viewer();
    viewer.add( panorama );
  3. Configure the Control Bar

    master

    The viewer includes a default control bar that can be customized or toggled:

    • addDefaultControlBar(array?: string[]): Adds the default control bar with an optional array of items.
    • toggleControlBar(): Shows or hides the control bar.
    • appendControlItem(option: object): Adds a custom item to the control bar.
  4. Access Viewer Components and Scene

    master

    You can retrieve the underlying Three.js objects managed by the Viewer using these getter methods:

    • getScene(): Returns the THREE.Scene.
    • getCamera(): Returns the THREE.Camera.
    • getRenderer(): Returns the THREE.WebGLRenderer.
    • getContainer(): Returns the HTMLElement container.
    • getControl(): Returns the active OrbitControls or DeviceOrientationControls instance.