UNPKG

4.78 kBTypeScriptView Raw
1import { Combine, NormalMapTypes } from "../constants.js";
2import { Color, ColorRepresentation } from "../math/Color.js";
3import { Euler } from "../math/Euler.js";
4import { Vector2 } from "../math/Vector2.js";
5import { Texture } from "../textures/Texture.js";
6import { Material, MaterialParameters } from "./Material.js";
7
8export interface MeshPhongMaterialParameters extends MaterialParameters {
9 /** geometry color in hexadecimal. Default is 0xffffff. */
10 color?: ColorRepresentation | undefined;
11 specular?: ColorRepresentation | undefined;
12 shininess?: number | undefined;
13 opacity?: number | undefined;
14 map?: Texture | null | undefined;
15 lightMap?: Texture | null | undefined;
16 lightMapIntensity?: number | undefined;
17 aoMap?: Texture | null | undefined;
18 aoMapIntensity?: number | undefined;
19 emissive?: ColorRepresentation | undefined;
20 emissiveIntensity?: number | undefined;
21 emissiveMap?: Texture | null | undefined;
22 bumpMap?: Texture | null | undefined;
23 bumpScale?: number | undefined;
24 normalMap?: Texture | null | undefined;
25 normalMapType?: NormalMapTypes | undefined;
26 normalScale?: Vector2 | undefined;
27 displacementMap?: Texture | null | undefined;
28 displacementScale?: number | undefined;
29 displacementBias?: number | undefined;
30 specularMap?: Texture | null | undefined;
31 alphaMap?: Texture | null | undefined;
32 envMap?: Texture | null | undefined;
33 envMapRotation?: Euler | undefined;
34 combine?: Combine | undefined;
35 reflectivity?: number | undefined;
36 refractionRatio?: number | undefined;
37 wireframe?: boolean | undefined;
38 wireframeLinewidth?: number | undefined;
39 wireframeLinecap?: string | undefined;
40 wireframeLinejoin?: string | undefined;
41 fog?: boolean | undefined;
42 flatShading?: boolean | undefined;
43}
44
45export class MeshPhongMaterial extends Material {
46 constructor(parameters?: MeshPhongMaterialParameters);
47
48 /**
49 * Read-only flag to check if a given object is of type {@link MeshPhongMaterial}.
50 * @remarks This is a _constant_ value
51 * @defaultValue `true`
52 */
53 readonly isMeshPhongMaterial: true;
54
55 /**
56 * @default new THREE.Color( 0xffffff )
57 */
58 color: Color;
59
60 /**
61 * @default new THREE.Color( 0x111111 )
62 */
63 specular: Color;
64
65 /**
66 * @default 30
67 */
68 shininess: number;
69
70 /**
71 * @default null
72 */
73 map: Texture | null;
74
75 /**
76 * @default null
77 */
78 lightMap: Texture | null;
79
80 /**
81 * @default null
82 */
83 lightMapIntensity: number;
84
85 /**
86 * @default null
87 */
88 aoMap: Texture | null;
89
90 /**
91 * @default null
92 */
93 aoMapIntensity: number;
94
95 /**
96 * @default new THREE.Color( 0x000000 )
97 */
98 emissive: Color;
99
100 /**
101 * @default 1
102 */
103 emissiveIntensity: number;
104
105 /**
106 * @default null
107 */
108 emissiveMap: Texture | null;
109
110 /**
111 * @default null
112 */
113 bumpMap: Texture | null;
114
115 /**
116 * @default 1
117 */
118 bumpScale: number;
119
120 /**
121 * @default null
122 */
123 normalMap: Texture | null;
124
125 /**
126 * @default THREE.TangentSpaceNormalMap
127 */
128 normalMapType: NormalMapTypes;
129
130 /**
131 * @default new Vector2( 1, 1 )
132 */
133 normalScale: Vector2;
134
135 /**
136 * @default null
137 */
138 displacementMap: Texture | null;
139
140 /**
141 * @default 1
142 */
143 displacementScale: number;
144
145 /**
146 * @default 0
147 */
148 displacementBias: number;
149
150 /**
151 * @default null
152 */
153 specularMap: Texture | null;
154
155 /**
156 * @default null
157 */
158 alphaMap: Texture | null;
159
160 /**
161 * @default null
162 */
163 envMap: Texture | null;
164
165 /**
166 * The rotation of the environment map in radians. Default is `(0,0,0)`.
167 */
168 envMapRotation: Euler;
169
170 /**
171 * @default THREE.MultiplyOperation
172 */
173 combine: Combine;
174
175 /**
176 * @default 1
177 */
178 reflectivity: number;
179
180 /**
181 * @default 0.98
182 */
183 refractionRatio: number;
184
185 /**
186 * @default false
187 */
188 wireframe: boolean;
189
190 /**
191 * @default 1
192 */
193 wireframeLinewidth: number;
194
195 /**
196 * @default 'round'
197 */
198 wireframeLinecap: string;
199
200 /**
201 * @default 'round'
202 */
203 wireframeLinejoin: string;
204
205 /**
206 * Define whether the material is rendered with flat shading. Default is false.
207 * @default false
208 */
209 flatShading: boolean;
210
211 /**
212 * @deprecated Use {@link MeshStandardMaterial THREE.MeshStandardMaterial} instead.
213 */
214 metal: boolean;
215
216 /**
217 * Whether the material is affected by fog. Default is true.
218 * @default fog
219 */
220 fog: boolean;
221
222 setValues(parameters: MeshPhongMaterialParameters): void;
223}