fireball/lib/core/Layers.js
2018-12-25 17:29:22 +03:30

47 lines
525 B
JavaScript

/**
* @author mrdoob / http://mrdoob.com/
*/
function Layers() {
this.mask = 1 | 0;
}
Object.assign( Layers.prototype, {
set: function ( channel ) {
this.mask = 1 << channel | 0;
},
enable: function ( channel ) {
this.mask |= 1 << channel | 0;
},
toggle: function ( channel ) {
this.mask ^= 1 << channel | 0;
},
disable: function ( channel ) {
this.mask &= ~ ( 1 << channel | 0 );
},
test: function ( layers ) {
return ( this.mask & layers.mask ) !== 0;
}
} );
export { Layers };