MeshLambertMaterial.js 2.7 KB
Newer Older
N
Nicolas Garcia Belmonte 已提交
1
/**
M
Mr.doob 已提交
2
 * @author mrdoob / http://mrdoob.com/
3
 * @author alteredq / http://alteredqualia.com/
M
Mr.doob 已提交
4 5 6
 *
 * parameters = {
 *  color: <hex>,
7
 *  emissive: <hex>,
8
 *  opacity: <float>,
9
 *
10
 *  map: new THREE.Texture( <Image> ),
11
 *
12 13
 *  specularMap: new THREE.Texture( <Image> ),
 *
14 15
 *  alphaMap: new THREE.Texture( <Image> ),
 *
16
 *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
17
 *  combine: THREE.Multiply,
18
 *  reflectivity: <float>,
19
 *  refractionRatio: <float>,
20
 *
21
 *  shading: THREE.SmoothShading,
M
Mr.doob 已提交
22
 *  blending: THREE.NormalBlending,
23
 *  depthTest: <bool>,
24
 *  depthWrite: <bool>,
25
 *
M
Mr.doob 已提交
26
 *  wireframe: <boolean>,
27
 *  wireframeLinewidth: <float>,
28
 *
29 30
 *  vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
 *
31
 *  skinning: <bool>,
32 33
 *  morphTargets: <bool>,
 *  morphNormals: <bool>,
34 35
 *
 *	fog: <bool>
36
 * }
N
Nicolas Garcia Belmonte 已提交
37 38
 */

M
Mr.doob 已提交
39
THREE.MeshLambertMaterial = function ( parameters ) {
N
Nicolas Garcia Belmonte 已提交
40

M
Mr.doob 已提交
41
	THREE.Material.call( this );
42

43 44
	this.type = 'MeshLambertMaterial';

M
Mr.doob 已提交
45 46
	this.color = new THREE.Color( 0xffffff ); // diffuse
	this.emissive = new THREE.Color( 0x000000 );
47

M
Mr.doob 已提交
48 49
	this.map = null;

50 51
	this.specularMap = null;

52 53
	this.alphaMap = null;

M
Mr.doob 已提交
54 55 56 57
	this.envMap = null;
	this.combine = THREE.MultiplyOperation;
	this.reflectivity = 1;
	this.refractionRatio = 0.98;
58

M
Mr.doob 已提交
59
	this.fog = true;
N
Nicolas Garcia Belmonte 已提交
60

M
Mr.doob 已提交
61
	this.shading = THREE.SmoothShading;
62

M
Mr.doob 已提交
63 64 65 66
	this.wireframe = false;
	this.wireframeLinewidth = 1;
	this.wireframeLinecap = 'round';
	this.wireframeLinejoin = 'round';
N
Nicolas Garcia Belmonte 已提交
67

M
Mr.doob 已提交
68
	this.vertexColors = THREE.NoColors;
69

M
Mr.doob 已提交
70 71 72
	this.skinning = false;
	this.morphTargets = false;
	this.morphNormals = false;
73

M
Mr.doob 已提交
74
	this.setValues( parameters );
M
Mr.doob 已提交
75

76
};
77

78
THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );
79
THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;
L
libra guest 已提交
80

M
Mr.doob 已提交
81 82
THREE.MeshLambertMaterial.prototype.clone = function () {

83 84
	var material = new THREE.MeshLambertMaterial();

85
	THREE.Material.prototype._copyFrom.call( material, this );
86 87 88 89 90 91

	material.color.copy( this.color );
	material.emissive.copy( this.emissive );

	material.map = this.map;

92 93
	material.specularMap = this.specularMap;

94 95
	material.alphaMap = this.alphaMap;

96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
	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;
	material.morphNormals = this.morphNormals;

	return material;
M
Mr.doob 已提交
117

L
libra guest 已提交
118
};