UNPKG

2.65 kBJavaScriptView Raw
1import { Material } from './Material.js';
2import { MultiplyOperation } from '../constants.js';
3import { Color } from '../math/Color.js';
4
5/**
6 * @author mrdoob / http://mrdoob.com/
7 * @author alteredq / http://alteredqualia.com/
8 *
9 * parameters = {
10 * color: <hex>,
11 * opacity: <float>,
12 * map: new THREE.Texture( <Image> ),
13 *
14 * lightMap: new THREE.Texture( <Image> ),
15 * lightMapIntensity: <float>
16 *
17 * aoMap: new THREE.Texture( <Image> ),
18 * aoMapIntensity: <float>
19 *
20 * specularMap: new THREE.Texture( <Image> ),
21 *
22 * alphaMap: new THREE.Texture( <Image> ),
23 *
24 * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
25 * combine: THREE.Multiply,
26 * reflectivity: <float>,
27 * refractionRatio: <float>,
28 *
29 * depthTest: <bool>,
30 * depthWrite: <bool>,
31 *
32 * wireframe: <boolean>,
33 * wireframeLinewidth: <float>,
34 *
35 * skinning: <bool>,
36 * morphTargets: <bool>
37 * }
38 */
39
40function MeshBasicMaterial( parameters ) {
41
42 Material.call( this );
43
44 this.type = 'MeshBasicMaterial';
45
46 this.color = new Color( 0xffffff ); // emissive
47
48 this.map = null;
49
50 this.lightMap = null;
51 this.lightMapIntensity = 1.0;
52
53 this.aoMap = null;
54 this.aoMapIntensity = 1.0;
55
56 this.specularMap = null;
57
58 this.alphaMap = null;
59
60 this.envMap = null;
61 this.combine = MultiplyOperation;
62 this.reflectivity = 1;
63 this.refractionRatio = 0.98;
64
65 this.wireframe = false;
66 this.wireframeLinewidth = 1;
67 this.wireframeLinecap = 'round';
68 this.wireframeLinejoin = 'round';
69
70 this.skinning = false;
71 this.morphTargets = false;
72
73 this.lights = false;
74
75 this.setValues( parameters );
76
77}
78
79MeshBasicMaterial.prototype = Object.create( Material.prototype );
80MeshBasicMaterial.prototype.constructor = MeshBasicMaterial;
81
82MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
83
84MeshBasicMaterial.prototype.copy = function ( source ) {
85
86 Material.prototype.copy.call( this, source );
87
88 this.color.copy( source.color );
89
90 this.map = source.map;
91
92 this.lightMap = source.lightMap;
93 this.lightMapIntensity = source.lightMapIntensity;
94
95 this.aoMap = source.aoMap;
96 this.aoMapIntensity = source.aoMapIntensity;
97
98 this.specularMap = source.specularMap;
99
100 this.alphaMap = source.alphaMap;
101
102 this.envMap = source.envMap;
103 this.combine = source.combine;
104 this.reflectivity = source.reflectivity;
105 this.refractionRatio = source.refractionRatio;
106
107 this.wireframe = source.wireframe;
108 this.wireframeLinewidth = source.wireframeLinewidth;
109 this.wireframeLinecap = source.wireframeLinecap;
110 this.wireframeLinejoin = source.wireframeLinejoin;
111
112 this.skinning = source.skinning;
113 this.morphTargets = source.morphTargets;
114
115 return this;
116
117};
118
119
120export { MeshBasicMaterial };