1 | import { Material } from './Material.js';
|
2 | import { MultiplyOperation } from '../constants.js';
|
3 | import { Vector2 } from '../math/Vector2.js';
|
4 | import { Color } from '../math/Color.js';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | function MeshPhongMaterial( parameters ) {
|
57 |
|
58 | Material.call( this );
|
59 |
|
60 | this.type = 'MeshPhongMaterial';
|
61 |
|
62 | this.color = new Color( 0xffffff );
|
63 | this.specular = new Color( 0x111111 );
|
64 | this.shininess = 30;
|
65 |
|
66 | this.map = null;
|
67 |
|
68 | this.lightMap = null;
|
69 | this.lightMapIntensity = 1.0;
|
70 |
|
71 | this.aoMap = null;
|
72 | this.aoMapIntensity = 1.0;
|
73 |
|
74 | this.emissive = new Color( 0x000000 );
|
75 | this.emissiveIntensity = 1.0;
|
76 | this.emissiveMap = null;
|
77 |
|
78 | this.bumpMap = null;
|
79 | this.bumpScale = 1;
|
80 |
|
81 | this.normalMap = null;
|
82 | this.normalScale = new Vector2( 1, 1 );
|
83 |
|
84 | this.displacementMap = null;
|
85 | this.displacementScale = 1;
|
86 | this.displacementBias = 0;
|
87 |
|
88 | this.specularMap = null;
|
89 |
|
90 | this.alphaMap = null;
|
91 |
|
92 | this.envMap = null;
|
93 | this.combine = MultiplyOperation;
|
94 | this.reflectivity = 1;
|
95 | this.refractionRatio = 0.98;
|
96 |
|
97 | this.wireframe = false;
|
98 | this.wireframeLinewidth = 1;
|
99 | this.wireframeLinecap = 'round';
|
100 | this.wireframeLinejoin = 'round';
|
101 |
|
102 | this.skinning = false;
|
103 | this.morphTargets = false;
|
104 | this.morphNormals = false;
|
105 |
|
106 | this.setValues( parameters );
|
107 |
|
108 | }
|
109 |
|
110 | MeshPhongMaterial.prototype = Object.create( Material.prototype );
|
111 | MeshPhongMaterial.prototype.constructor = MeshPhongMaterial;
|
112 |
|
113 | MeshPhongMaterial.prototype.isMeshPhongMaterial = true;
|
114 |
|
115 | MeshPhongMaterial.prototype.copy = function ( source ) {
|
116 |
|
117 | Material.prototype.copy.call( this, source );
|
118 |
|
119 | this.color.copy( source.color );
|
120 | this.specular.copy( source.specular );
|
121 | this.shininess = source.shininess;
|
122 |
|
123 | this.map = source.map;
|
124 |
|
125 | this.lightMap = source.lightMap;
|
126 | this.lightMapIntensity = source.lightMapIntensity;
|
127 |
|
128 | this.aoMap = source.aoMap;
|
129 | this.aoMapIntensity = source.aoMapIntensity;
|
130 |
|
131 | this.emissive.copy( source.emissive );
|
132 | this.emissiveMap = source.emissiveMap;
|
133 | this.emissiveIntensity = source.emissiveIntensity;
|
134 |
|
135 | this.bumpMap = source.bumpMap;
|
136 | this.bumpScale = source.bumpScale;
|
137 |
|
138 | this.normalMap = source.normalMap;
|
139 | this.normalScale.copy( source.normalScale );
|
140 |
|
141 | this.displacementMap = source.displacementMap;
|
142 | this.displacementScale = source.displacementScale;
|
143 | this.displacementBias = source.displacementBias;
|
144 |
|
145 | this.specularMap = source.specularMap;
|
146 |
|
147 | this.alphaMap = source.alphaMap;
|
148 |
|
149 | this.envMap = source.envMap;
|
150 | this.combine = source.combine;
|
151 | this.reflectivity = source.reflectivity;
|
152 | this.refractionRatio = source.refractionRatio;
|
153 |
|
154 | this.wireframe = source.wireframe;
|
155 | this.wireframeLinewidth = source.wireframeLinewidth;
|
156 | this.wireframeLinecap = source.wireframeLinecap;
|
157 | this.wireframeLinejoin = source.wireframeLinejoin;
|
158 |
|
159 | this.skinning = source.skinning;
|
160 | this.morphTargets = source.morphTargets;
|
161 | this.morphNormals = source.morphNormals;
|
162 |
|
163 | return this;
|
164 |
|
165 | };
|
166 |
|
167 |
|
168 | export { MeshPhongMaterial };
|