MeshBasicMaterial.js 2.2 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
 *  opacity: <float>,
8
 *  map: new THREE.Texture( <Image> ),
9
 *
10
 *  lightMap: new THREE.Texture( <Image> ),
11
 *
12
 *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
13
 *  combine: THREE.Multiply,
14
 *  reflectivity: <float>,
15
 *  refractionRatio: <float>,
16
 *
17
 *  shading: THREE.SmoothShading,
M
Mr.doob 已提交
18
 *  blending: THREE.NormalBlending,
19
 *  depthTest: <bool>,
20
 *
M
Mr.doob 已提交
21
 *  wireframe: <boolean>,
22
 *  wireframeLinewidth: <float>,
23
 *
24 25
 *  vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
 *
26
 *  skinning: <bool>,
27
 *  morphTargets: <bool>,
28
 *
M
Mr.doob 已提交
29
 *  fog: <bool>
30
 * }
N
Nicolas Garcia Belmonte 已提交
31 32
 */

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

M
Mr.doob 已提交
35
	THREE.Material.call( this );
36

M
Mr.doob 已提交
37
	this.color = new THREE.Color( 0xffffff ); // emissive
38

M
Mr.doob 已提交
39
	this.map = null;
40

M
Mr.doob 已提交
41
	this.lightMap = null;
42

M
Mr.doob 已提交
43 44 45 46
	this.envMap = null;
	this.combine = THREE.MultiplyOperation;
	this.reflectivity = 1;
	this.refractionRatio = 0.98;
47

M
Mr.doob 已提交
48
	this.fog = true;
49

M
Mr.doob 已提交
50
	this.shading = THREE.SmoothShading;
M
Mr.doob 已提交
51

M
Mr.doob 已提交
52 53 54 55
	this.wireframe = false;
	this.wireframeLinewidth = 1;
	this.wireframeLinecap = 'round';
	this.wireframeLinejoin = 'round';
M
Mr.doob 已提交
56

M
Mr.doob 已提交
57
	this.vertexColors = THREE.NoColors;
58

M
Mr.doob 已提交
59 60
	this.skinning = false;
	this.morphTargets = false;
M
Mr.doob 已提交
61

M
Mr.doob 已提交
62
	this.setValues( parameters );
N
Nicolas Garcia Belmonte 已提交
63

M
Mr.doob 已提交
64
};
65

66
THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype );
L
libra guest 已提交
67

M
Mr.doob 已提交
68 69
THREE.MeshBasicMaterial.prototype.clone = function () {

70 71
	var material = new THREE.MeshBasicMaterial();

M
Mr.doob 已提交
72 73
	THREE.Material.prototype.clone.call( this, material );

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
	material.color.copy( this.color );

	material.map = this.map;

	material.lightMap = this.lightMap;
	
	material.envMap = this.envMap;
	material.combine = this.combine;
	material.reflectivity = this.reflectivity;
	material.refractionRatio = this.refractionRatio;

	material.fog = this.fog;

	material.shading = this.shading;

	material.wireframe = this.wireframe;
	material.wireframeLinewidth = this.wireframeLinewidth;
	material.wireframeLinecap = this.wireframeLinecap;
	material.wireframeLinejoin = this.wireframeLinejoin;

	material.vertexColors = this.vertexColors;

	material.skinning = this.skinning;
	material.morphTargets = this.morphTargets;

	return material;
L
libra guest 已提交
100 101

};