Class Layers

A THREE.Layers | Layers object assigns an THREE.Object3D | Object3D to 1 or more of 32 layers numbered 0 to 31 - internally the
layers are stored as a bit mask, and
by default all Object3Ds are a member of layer 0.

This can be used to control visibility - an object must share a layer with a camera to be visible when that camera's view is rendered.

Constructors

  • Create a new Layers object, with membership initially set to layer 0.

    Returns Layers

Properties

mask: number

A bit mask storing which of the 32 layers this layers object is currently a member of.

1 | 0

Expects a Integer

Methods

  • Set membership to layer, and remove membership all other layers.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Add membership of this layer.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Add membership to all layers.

    Returns void

  • Toggle membership of layer.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Remove membership of this layer.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Remove membership from all layers.

    Returns void

  • Returns true if this and the passed layers object have at least one layer in common.

    Parameters

    • layers: Layers

      A Layers object

    Returns boolean

  • Returns true if the given layer is enabled.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns boolean