UNPKG

2.02 kBJavaScriptView Raw
1import { Material } from './Material.js';
2import { Vector2 } from '../math/Vector2.js';
3
4/**
5 * @author mrdoob / http://mrdoob.com/
6 * @author WestLangley / http://github.com/WestLangley
7 *
8 * parameters = {
9 * opacity: <float>,
10 *
11 * bumpMap: new THREE.Texture( <Image> ),
12 * bumpScale: <float>,
13 *
14 * normalMap: new THREE.Texture( <Image> ),
15 * normalScale: <Vector2>,
16 *
17 * displacementMap: new THREE.Texture( <Image> ),
18 * displacementScale: <float>,
19 * displacementBias: <float>,
20 *
21 * wireframe: <boolean>,
22 * wireframeLinewidth: <float>
23 *
24 * skinning: <bool>,
25 * morphTargets: <bool>,
26 * morphNormals: <bool>
27 * }
28 */
29
30function MeshNormalMaterial( parameters ) {
31
32 Material.call( this );
33
34 this.type = 'MeshNormalMaterial';
35
36 this.bumpMap = null;
37 this.bumpScale = 1;
38
39 this.normalMap = null;
40 this.normalScale = new Vector2( 1, 1 );
41
42 this.displacementMap = null;
43 this.displacementScale = 1;
44 this.displacementBias = 0;
45
46 this.wireframe = false;
47 this.wireframeLinewidth = 1;
48
49 this.fog = false;
50 this.lights = false;
51
52 this.skinning = false;
53 this.morphTargets = false;
54 this.morphNormals = false;
55
56 this.setValues( parameters );
57
58}
59
60MeshNormalMaterial.prototype = Object.create( Material.prototype );
61MeshNormalMaterial.prototype.constructor = MeshNormalMaterial;
62
63MeshNormalMaterial.prototype.isMeshNormalMaterial = true;
64
65MeshNormalMaterial.prototype.copy = function ( source ) {
66
67 Material.prototype.copy.call( this, source );
68
69 this.bumpMap = source.bumpMap;
70 this.bumpScale = source.bumpScale;
71
72 this.normalMap = source.normalMap;
73 this.normalScale.copy( source.normalScale );
74
75 this.displacementMap = source.displacementMap;
76 this.displacementScale = source.displacementScale;
77 this.displacementBias = source.displacementBias;
78
79 this.wireframe = source.wireframe;
80 this.wireframeLinewidth = source.wireframeLinewidth;
81
82 this.skinning = source.skinning;
83 this.morphTargets = source.morphTargets;
84 this.morphNormals = source.morphNormals;
85
86 return this;
87
88};
89
90
91export { MeshNormalMaterial };