MeshBasicMaterial.js 1.5 KB
Newer Older
N
Nicolas Garcia Belmonte 已提交
1 2
/**
 * @author mr.doob / http://mrdoob.com/
3
 * @author alteredq / http://alteredqualia.com/
M
Mr.doob 已提交
4 5 6
 *
 * parameters = {
 *  color: <hex>,
7
 *  map: new THREE.Texture( <Image> ),
M
Mr.doob 已提交
8 9 10 11
 *  opacity: <float>,
 *  blending: THREE.NormalBlending,
 *  wireframe: <boolean>,
 *  wireframe_linewidth: <float>
12
 * }
N
Nicolas Garcia Belmonte 已提交
13 14
 */

M
Mr.doob 已提交
15
THREE.MeshBasicMaterial = function ( parameters ) {
N
Nicolas Garcia Belmonte 已提交
16

M
Mr.doob 已提交
17 18
	this.id = THREE.MeshBasicMaterialCounter.value ++;

M
Mr.doob 已提交
19
	this.color = new THREE.Color( 0xeeeeee );
M
Mr.doob 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
	this.map = null;
	this.opacity = 1;
	this.blending = THREE.NormalBlending;
	this.wireframe = false;
	this.wireframe_linewidth = 1;

	if ( parameters ) {

		if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
		if ( parameters.map !== undefined ) this.map = parameters.map;
		if ( parameters.opacity !== undefined ) this.opacity  = parameters.opacity;
		if ( parameters.blending !== undefined ) this.blending = parameters.blending;
		if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
		if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;

	}
N
Nicolas Garcia Belmonte 已提交
36 37 38

	this.toString = function () {

M
Mr.doob 已提交
39 40 41 42 43 44 45 46 47
		return 'THREE.MeshBasicMaterial (<br/>' +
			'id: ' + this.id + '<br/>' +
			'color: ' + this.color + '<br/>' +
			'map: ' + this.map + '<br/>' +
			'opacity: ' + this.opacity + '<br/>' +
			'blending: ' + this.blending + '<br/>' +
			'wireframe: ' + this.wireframe + '<br/>' +
			'wireframe_linewidth: ' + this.wireframe_linewidth +'<br/>' +
			')';
N
Nicolas Garcia Belmonte 已提交
48 49 50

	};

M
Mr.doob 已提交
51 52 53
}

THREE.MeshBasicMaterialCounter = { value: 0 };