Layers

A Layers object assigns an 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 renderered.

All classes that inherit from Object3D have an Object3D.layers property which is an instance of this class.

Examples

WebGL / layers

Constructor

Layers()

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

Properties

.mask : Integer

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

Methods

.disable (layer : Integer) : null

layer - an integer from 0 to 31.

Remove membership of this layer.

.enable (layer : Integer) : null

layer - an integer from 0 to 31.

Add membership of this layer.

.set (layer : Integer) : null

layer - an integer from 0 to 31.

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

.test (layers : Layers) : Boolean

layers - a Layers object

Returns true if this and the passed layers object are members of the same set of layers.

.toggle (layer : Integer) : null

layer - an integer from 0 to 31.

Toggle membership of layer.

Source

For more info on how to obtain the source code of this module see this page.