Skip to content

Instantly share code, notes, and snippets.

@mrdoob
Created August 16, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrdoob/7d75270a22b9d62da2e1e991ef846188 to your computer and use it in GitHub Desktop.
Save mrdoob/7d75270a22b9d62da2e1e991ef846188 to your computer and use it in GitHub Desktop.
import { Layers } from './Layers.js';
var test = new Layers();
console.log( test );
/**
* @author mrdoob / http://mrdoob.com/
*/
function Layers() {
this.mask = 1;
}
Layers.prototype = {
constructor: Layers,
set: function ( channel ) {
this.mask = 1 << channel;
},
enable: function ( channel ) {
this.mask |= 1 << channel;
},
toggle: function ( channel ) {
this.mask ^= 1 << channel;
},
disable: function ( channel ) {
this.mask &= ~ ( 1 << channel );
},
test: function ( layers ) {
return ( this.mask & layers.mask ) !== 0;
}
};
export { Layers };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment