Layers.js 536 字节
Newer Older
1 2 3 4
/**
 * @author mrdoob / http://mrdoob.com/
 */

R
Rich Harris 已提交
5 6
function Layers () {
	this.isLayers = true;
7 8 9 10 11

	this.mask = 1;

};

R
Rich Harris 已提交
12
Layers.prototype = {
13

R
Rich Harris 已提交
14
	constructor: Layers,
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

	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 );

38 39 40 41 42 43
	},

	test: function ( layers ) {

		return ( this.mask & layers.mask ) !== 0;

44 45 46
	}

};
R
Rich Harris 已提交
47 48 49


export { Layers };