Class ThreeJSOverlayView

Implements

  • WebGLOverlayView

Constructors

Properties

anchor: LatLngAltitudeLiteral

The anchor for the scene.

animationMode: "always" | "ondemand" = "ondemand"

The animation mode controls when the overlay will redraw, either continuously (always) or on demand (ondemand). When using the on demand mode, the overlay will re-render whenever the map renders (camera movements) or when requestRedraw() is called.

To achieve animations in this mode, you can either use an outside animation-loop that calls requestRedraw() as long as needed or call requestRedraw() from within the onBeforeRender function to

camera: PerspectiveCamera
overlay: WebGLOverlayView
projectionMatrixInverse: Matrix4 = ...
raycaster: Raycaster = ...
renderer: WebGLRenderer
rotationArray: Float32Array = ...
rotationInverse: Quaternion = ...
scene: Scene

The scene object to render in the overlay. If no scene is specified, a new scene is created and can be accessed via overlay.scene.

Methods

  • Adds the given listener function to the given event name. Returns an identifier for this listener that can be used with google.maps.event.removeListener.

    Parameters

    • eventName: string
    • handler: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns MapsEventListener

  • Binds a View to a Model.

    Parameters

    • key: string
    • target: MVCObject
    • Optional targetKey: string
    • Optional noNotify: boolean

    Returns void

  • Gets a value.

    Parameters

    • key: string

    Returns any

  • Returns the map the overlay is added to.

    Returns Map

  • Convert coordinates from WGS84 Latitude Longitude to world-space coordinates while taking the origin and orientation into account.

    Parameters

    Returns Vector3

  • Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.

    Parameters

    • key: string

    Returns void

  • Overwrite this method to fetch or create intermediate data structures before the overlay is drawn that don’t require immediate access to the WebGL rendering context.

    Returns void

  • Overwrite this method to update your scene just before a new frame is drawn.

    Returns void

  • This method is called when the rendering context is lost for any reason, and is where you should clean up any pre-existing GL state, since it is no longer needed.

    Returns void

  • This method is called once the rendering context is available. Use it to initialize or bind any WebGL state such as shaders or buffer objects.

    Parameters

    • options: WebGLStateOptions

      that allow developers to restore the GL context.

    Returns void

  • Implement this method to draw WebGL content directly on the map. Note that if the overlay needs a new frame drawn then call ThreeJSOverlayView.requestRedraw.

    Parameters

    • options: WebGLDrawOptions

      that allow developers to render content to an associated Google basemap.

    Returns void

  • This method is called when the overlay is removed from the map with overlay.setMap(null), and is where you can remove all intermediate objects created in onAdd.

    Returns void

  • Overwrite this method to handle any GL state updates outside the render animation frame.

    Parameters

    • options: WebGLStateOptions

    Returns void

  • Runs raycasting for the specified screen-coordinates against all objects in the scene.

    Parameters

    • p: Vector2

      normalized screenspace coordinates of the mouse-cursor. x/y are in range [-1, 1], y is pointing up.

    • Optional options: RaycastOptions

      raycasting options. In this case the recursive option has no effect as it is always recursive.

    Returns Intersection<Object3D<Object3DEventMap>>[]

    the list of intersections

  • Runs raycasting for the specified screen-coordinates against the specified list of objects.

    Note for typescript users: the returned Intersection objects can only be properly typed for non-recursive lookups (this is handled by the internal signature below).

    Parameters

    • p: Vector2

      normalized screenspace coordinates of the mouse-cursor. x/y are in range [-1, 1], y is pointing up.

    • objects: Object3D<Object3DEventMap>[]

      list of objects to test

    • Optional options: RaycastOptions & {
          recursive: true;
      }

      raycasting options.

    Returns Intersection<Object3D<Object3DEventMap>>[]

  • Type Parameters

    • T extends Object3D<Object3DEventMap>

    Parameters

    Returns Intersection<T>[]

  • Triggers the map to redraw a frame.

    Returns void

  • Triggers the map to update GL state.

    Returns void

  • Sets a value.

    Parameters

    • key: string
    • value: unknown

    Returns void

  • Adds the overlay to the map.

    Parameters

    • map: Map

      The map to access the div, model and view state.

    Returns void

  • Sets the axis to use as "up" in the scene.

    Parameters

    • axis: Vector3 | "Z" | "Y"

    Returns void

  • Sets a collection of key-value pairs.

    Parameters

    • Optional values: object

    Returns void

  • Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.

    Parameters

    • key: string

    Returns void

  • Removes all bindings.

    Returns void