API (v2.0.0) - Giro3D
    Preparing search index...

    Represent the users's point of view. Internally this encapsulate a three.js camera.

    Hierarchy

    • EventDispatcher<ViewEvents>
      • View

    Implements

    Index

    Constructors

    • Parameters

      • params: {
            camera?: PerspectiveCamera | OrthographicCamera;
            crs: CoordinateSystem;
            height: number;
            width: number;
        }

        The constructor parameters.

        • Optionalcamera?: PerspectiveCamera | OrthographicCamera

          The three.js camera to use. If unspecified, a default perspective camera is created.

        • crs: CoordinateSystem

          The coordinate system of the view.

        • height: number

          The height in pixels of the camera viewport

        • width: number

          The width in pixels of the camera viewport

      Returns View

    Accessors

    • get camera(): PerspectiveCamera | OrthographicCamera

      Gets or sets the current camera.

      Returns PerspectiveCamera | OrthographicCamera

    • set camera(c: PerspectiveCamera | OrthographicCamera): void

      Parameters

      • c: PerspectiveCamera | OrthographicCamera

      Returns void

    • get height(): number

      The height, in pixels, of this view.

      Returns number

    • get maxFarPlane(): number

      Gets or sets the maximum distance allowed for the camera far plane.

      Returns number

    • set maxFarPlane(distance: number): void

      Parameters

      • distance: number

      Returns void

    • get minNearPlane(): number

      Gets or sets the minimum distance allowed for the camera near plane.

      Returns number

    • set minNearPlane(distance: number): void

      Parameters

      • distance: number

      Returns void

    • get width(): number

      The width, in pixels, of this view.

      Returns number

    Methods

    • Parameters

      • box3: Box3
      • matrixWorld: Matrix4

      Returns Box3

    • Computes a PointOfView for the given object.

      Parameters

      • obj: Object3D<Object3DEventMap> | Box3

        The object to compute the point of view, or a world space bounding box.

      • Optionaloptions: { camera?: Camera }

        Optional parameters.

        • Optionalcamera?: Camera

          The optional camera to compute this point of view. If unspecified, the currently active camera on this view is used.

      Returns Readonly<PointOfView> | null

      The readonly point of view if it could be computed, null otherwise.

    • Setup the camera to match the specified object or point of view.

      • If the argument is a PointOfView, this will be used directly.
      • If the object implements HasDefaultPointOfView, this will be used to compute the point of view.
      • Otherwise, a default point of view is computed from the object's bounding box.

      Important note: this method does not update any camera controls that are controlling the camera. Those controls have to be updated manually so they do not override the new camera position. For example, controls that have a target must be updated so that the target position matches the one returned by this method.

      Parameters

      • obj: Object3D<Object3DEventMap> | PointOfView | HasDefaultPointOfView

        The object to go to.

      • Optionaloptions: { allowTranslation?: boolean }

        The options.

        • OptionalallowTranslation?: boolean

          Allow moving the camera. If false, the camera is only rotated to look at the object.

          true
          

      Returns Readonly<PointOfView> | null

      The immutable PointOfView that was used to setup the camera, or null if it couldn't be computed.

    • Parameters

      • box3: Box3
      • OptionalmatrixWorld: Matrix4

      Returns boolean

    • Parameters

      • worldOBB: OBB

      Returns boolean

    • Parameters

      • sphere: Sphere
      • OptionalmatrixWorld: Matrix4

      Returns boolean

    • Resets the near and far planes to their default value.

      Returns void

    • Registers external controls that must be udpated periodically.

      Note: this is the case of simple controls in the examples/{js,jsm}/controls folder of THREE.js (e.g MapControls):

      • they fire 'change' events when the controls' state has changed and the view must be rendered,
      • they have an update() method to update the controls' state.

      For more complex controls, such as the package camera-controls, a more complex logic is required. Please refer to the appropriate examples for a detailed documentation on how to bind Giro3D and those controls.

      Parameters

      • controls: ExternalControls | null

        The controls to register. If null, currently registered controls are unregistered (they are not disabled however).

      Returns void

    • Parameters

      • Optionalwidth: number
      • Optionalheight: number

      Returns void