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| layers property which is an instance of this class.
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| layers property which is an instance of this class.
Extends
EventDispatcher
Constructors
Constructor
new Layers():
Layers
Returns
Layers
Inherited from
EventDispatcher.constructor
Properties
_uuid
_uuid:
string|null
Inherited from
EventDispatcher._uuid
_listeners
_listeners:
Map<Symbol,Listener<never>[]>
Inherited from
EventDispatcher._listeners
Accessors
mask
Get Signature
get mask():
number
Returns
number
Set Signature
set mask(
value):void
Parameters
value
number
Returns
void
uuid
Get Signature
get uuid():
string
Returns
string
Set Signature
set uuid(
uuid):void
Parameters
uuid
string
Returns
void
Inherited from
EventDispatcher.uuid
Methods
set()
set(
channel):this
Set membership to layer, and remove membership all other layers.
Parameters
channel
number
an integer from 0 to 31.
Returns
this
enable()
enable(
channel):this
Add membership of this layer.
Parameters
channel
number
an integer from 0 to 31.
Returns
this
toggle()
toggle(
channel):this
Toggle membership of layer.
Parameters
channel
number
an integer from 0 to 31.
Returns
this
disable()
disable(
channel):this
Remove membership of this layer.
Parameters
channel
number
an integer from 0 to 31.
Returns
this
test()
test(
layers):boolean
Returns true if this and the passed layers object are members of the same set of layers.
Parameters
layers
Layers
a Layers object.
Returns
boolean
copy()
copy(
value):void
Copies the mask of given layers to this.
Parameters
value
Layers
Returns
void
clone()
clone():
Layers
Returns a new Layers with the same mask as this one.
Returns
Layers
on()
on<
T>(type,listener):void
Adds a listener to an event type.
Type Parameters
T
T
Parameters
type
EventType<T>
The type of event to listen to.
listener
Listener<T>
The function that gets called when the event is fired.
Returns
void
Inherited from
EventDispatcher.on
once()
once<
T>(type,listener):void
Only active the listener one times and then off it| it.
Type Parameters
T
T
Parameters
type
EventType<T>
listener
Listener<T>
Returns
void
Inherited from
EventDispatcher.once
has()
has<
T>(type,listener):boolean
Checks if listener is added to an event type.
Type Parameters
T
T
Parameters
type
EventType<T>
listener
Listener<T>
Returns
boolean
Inherited from
EventDispatcher.has
off()
off<
T>(type,listener):void
Removes a listener from listening list.
Type Parameters
T
T
Parameters
type
EventType<T>
listener
Listener<T>
Returns
void
Inherited from
EventDispatcher.off
emit()
Call Signature
emit(
type):void
Active the event and call the registered listener.
Parameters
type
EventType<never>
Returns
void
Inherited from
EventDispatcher.emit
Call Signature
emit<
T>(type,payload):void
Active the event and call the registered listener.
Type Parameters
T
T
Parameters
type
EventType<T>
payload
T
Returns
void
Inherited from
EventDispatcher.emit
clearAllListeners()
clearAllListeners():
void
Removes all listeners from listening list.
Returns
void
Inherited from
EventDispatcher.clearAllListeners