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

M
Mr.doob 已提交
5
function Layers() {
6 7 8

	this.mask = 1;

M
Mr.doob 已提交
9
}
10

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

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

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

37 38 39 40 41 42
	},

	test: function ( layers ) {

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

43 44 45
	}

};
R
Rich Harris 已提交
46 47


48
export { Layers };