@babylonjs/loaders 8.28.1 → 8.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OBJ/solidParser.d.ts +8 -7
- package/OBJ/solidParser.js +95 -53
- package/OBJ/solidParser.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +15 -10
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +44 -28
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js +66 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js +62 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js +62 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js.map +1 -0
- package/glTF/2.0/Extensions/{EXT_materials_diffuse_roughness.d.ts → KHR_materials_diffuse_roughness.d.ts} +5 -5
- package/glTF/2.0/Extensions/{EXT_materials_diffuse_roughness.js → KHR_materials_diffuse_roughness.js} +8 -18
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +6 -31
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js +3 -7
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +5 -9
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js +3 -10
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +13 -11
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +11 -22
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js +9 -17
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +21 -32
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +7 -13
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js +13 -22
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +1 -2
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +5 -8
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/dynamic.js +3 -3
- package/glTF/2.0/Extensions/dynamic.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +4 -1
- package/glTF/2.0/Extensions/index.js +4 -1
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +17 -0
- package/glTF/2.0/glTFLoader.js +104 -50
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/index.d.ts +2 -0
- package/glTF/2.0/index.js +2 -0
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/2.0/materialLoadingAdapter.d.ts +314 -0
- package/glTF/2.0/materialLoadingAdapter.js +2 -0
- package/glTF/2.0/materialLoadingAdapter.js.map +1 -0
- package/glTF/2.0/openPbrMaterialLoadingAdapter.d.ts +594 -0
- package/glTF/2.0/openPbrMaterialLoadingAdapter.js +902 -0
- package/glTF/2.0/openPbrMaterialLoadingAdapter.js.map +1 -0
- package/glTF/2.0/pbrMaterialLoadingAdapter.d.ts +612 -0
- package/glTF/2.0/pbrMaterialLoadingAdapter.js +973 -0
- package/glTF/2.0/pbrMaterialLoadingAdapter.js.map +1 -0
- package/glTF/glTFFileLoader.d.ts +5 -0
- package/glTF/glTFFileLoader.js +6 -0
- package/glTF/glTFFileLoader.js.map +1 -1
- package/package.json +3 -3
- package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js.map +0 -1
@@ -0,0 +1,973 @@
|
|
1
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
2
|
+
import { Constants } from "@babylonjs/core/Engines/constants.js";
|
3
|
+
/**
|
4
|
+
* Material Loading Adapter for PBR materials that provides a unified OpenPBR-like interface.
|
5
|
+
*/
|
6
|
+
export class PBRMaterialLoadingAdapter {
|
7
|
+
/**
|
8
|
+
* Creates a new instance of the PBRMaterialLoadingAdapter.
|
9
|
+
* @param material - The PBR material to adapt.
|
10
|
+
*/
|
11
|
+
constructor(material) {
|
12
|
+
this._material = material;
|
13
|
+
this._material.enableSpecularAntiAliasing = true;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Gets the underlying material
|
17
|
+
*/
|
18
|
+
get material() {
|
19
|
+
return this._material;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Whether the material should be treated as unlit
|
23
|
+
*/
|
24
|
+
get isUnlit() {
|
25
|
+
return this._material.unlit;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Sets whether the material should be treated as unlit
|
29
|
+
*/
|
30
|
+
set isUnlit(value) {
|
31
|
+
this._material.unlit = value;
|
32
|
+
}
|
33
|
+
// ========================================
|
34
|
+
// CULLING PROPERTIES
|
35
|
+
// ========================================
|
36
|
+
/**
|
37
|
+
* Sets whether back face culling is enabled.
|
38
|
+
* @param value True to enable back face culling
|
39
|
+
*/
|
40
|
+
set backFaceCulling(value) {
|
41
|
+
this._material.backFaceCulling = value;
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Gets whether back face culling is enabled.
|
45
|
+
* @returns True if back face culling is enabled
|
46
|
+
*/
|
47
|
+
get backFaceCulling() {
|
48
|
+
return this._material.backFaceCulling;
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* Sets whether two-sided lighting is enabled.
|
52
|
+
* @param value True to enable two-sided lighting
|
53
|
+
*/
|
54
|
+
set twoSidedLighting(value) {
|
55
|
+
this._material.twoSidedLighting = value;
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Gets whether two-sided lighting is enabled.
|
59
|
+
* @returns True if two-sided lighting is enabled
|
60
|
+
*/
|
61
|
+
get twoSidedLighting() {
|
62
|
+
return this._material.twoSidedLighting;
|
63
|
+
}
|
64
|
+
// ========================================
|
65
|
+
// ALPHA PROPERTIES
|
66
|
+
// ========================================
|
67
|
+
/**
|
68
|
+
* Sets the alpha cutoff value for alpha testing.
|
69
|
+
* @param value The alpha cutoff threshold (0-1)
|
70
|
+
*/
|
71
|
+
set alphaCutOff(value) {
|
72
|
+
this._material.alphaCutOff = value;
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* Gets the alpha cutoff value.
|
76
|
+
* @returns The alpha cutoff threshold (0-1)
|
77
|
+
*/
|
78
|
+
get alphaCutOff() {
|
79
|
+
return this._material.alphaCutOff;
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* Sets whether to use alpha from the albedo texture.
|
83
|
+
* @param value True to use alpha from albedo texture
|
84
|
+
*/
|
85
|
+
set useAlphaFromBaseColorTexture(value) {
|
86
|
+
this._material.useAlphaFromAlbedoTexture = value;
|
87
|
+
}
|
88
|
+
/**
|
89
|
+
* Gets whether alpha is used from the albedo texture.
|
90
|
+
* @returns True if using alpha from albedo texture
|
91
|
+
*/
|
92
|
+
get useAlphaFromBaseColorTexture() {
|
93
|
+
return this._material.useAlphaFromAlbedoTexture;
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Gets whether the transparency is treated as alpha coverage.
|
97
|
+
*/
|
98
|
+
get transparencyAsAlphaCoverage() {
|
99
|
+
return this._material.useRadianceOverAlpha || this._material.useSpecularOverAlpha;
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* Sets/Gets whether the transparency is treated as alpha coverage
|
103
|
+
*/
|
104
|
+
set transparencyAsAlphaCoverage(value) {
|
105
|
+
this._material.useRadianceOverAlpha = !value;
|
106
|
+
this._material.useSpecularOverAlpha = !value;
|
107
|
+
}
|
108
|
+
// ========================================
|
109
|
+
// BASE PARAMETERS
|
110
|
+
// ========================================
|
111
|
+
/**
|
112
|
+
* Sets the base color of the material (mapped to PBR albedoColor).
|
113
|
+
* @param value The base color as a Color3
|
114
|
+
*/
|
115
|
+
set baseColor(value) {
|
116
|
+
this._material.albedoColor = value;
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Gets the base color of the material.
|
120
|
+
* @returns The base color as a Color3
|
121
|
+
*/
|
122
|
+
get baseColor() {
|
123
|
+
return this._material.albedoColor;
|
124
|
+
}
|
125
|
+
/**
|
126
|
+
* Sets the base color texture of the material (mapped to PBR albedoTexture).
|
127
|
+
* @param value The base color texture or null
|
128
|
+
*/
|
129
|
+
set baseColorTexture(value) {
|
130
|
+
this._material.albedoTexture = value;
|
131
|
+
}
|
132
|
+
/**
|
133
|
+
* Gets the base color texture of the material.
|
134
|
+
* @returns The base color texture or null
|
135
|
+
*/
|
136
|
+
get baseColorTexture() {
|
137
|
+
return this._material.albedoTexture;
|
138
|
+
}
|
139
|
+
/**
|
140
|
+
* Sets the base diffuse roughness of the material.
|
141
|
+
* @param value The diffuse roughness value (0-1)
|
142
|
+
*/
|
143
|
+
set baseDiffuseRoughness(value) {
|
144
|
+
this._material.baseDiffuseRoughness = value;
|
145
|
+
if (value > 0) {
|
146
|
+
this._material.brdf.baseDiffuseModel = Constants.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
/**
|
150
|
+
* Gets the base diffuse roughness of the material.
|
151
|
+
* @returns The diffuse roughness value (0-1), defaults to 0 if not set
|
152
|
+
*/
|
153
|
+
get baseDiffuseRoughness() {
|
154
|
+
return this._material.baseDiffuseRoughness ?? 0;
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Sets the base diffuse roughness texture of the material.
|
158
|
+
* @param value The diffuse roughness texture or null
|
159
|
+
*/
|
160
|
+
set baseDiffuseRoughnessTexture(value) {
|
161
|
+
this._material.baseDiffuseRoughnessTexture = value;
|
162
|
+
}
|
163
|
+
/**
|
164
|
+
* Gets the base diffuse roughness texture of the material.
|
165
|
+
* @returns The diffuse roughness texture or null
|
166
|
+
*/
|
167
|
+
get baseDiffuseRoughnessTexture() {
|
168
|
+
return this._material.baseDiffuseRoughnessTexture;
|
169
|
+
}
|
170
|
+
/**
|
171
|
+
* Sets the base metalness value of the material (mapped to PBR metallic).
|
172
|
+
* @param value The metalness value (0-1)
|
173
|
+
*/
|
174
|
+
set baseMetalness(value) {
|
175
|
+
this._material.metallic = value;
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* Gets the base metalness value of the material.
|
179
|
+
* @returns The metalness value (0-1), defaults to 1 if not set
|
180
|
+
*/
|
181
|
+
get baseMetalness() {
|
182
|
+
return this._material.metallic ?? 1;
|
183
|
+
}
|
184
|
+
/**
|
185
|
+
* Sets the base metalness texture of the material (mapped to PBR metallicTexture).
|
186
|
+
* @param value The metalness texture or null
|
187
|
+
*/
|
188
|
+
set baseMetalnessTexture(value) {
|
189
|
+
this._material.metallicTexture = value;
|
190
|
+
}
|
191
|
+
/**
|
192
|
+
* Gets the base metalness texture of the material.
|
193
|
+
* @returns The metalness texture or null
|
194
|
+
*/
|
195
|
+
get baseMetalnessTexture() {
|
196
|
+
return this._material.metallicTexture;
|
197
|
+
}
|
198
|
+
/**
|
199
|
+
* Sets whether to use roughness from the metallic texture's green channel.
|
200
|
+
* Also disables using roughness from the alpha channel when enabled.
|
201
|
+
* @param value True to use green channel for roughness
|
202
|
+
*/
|
203
|
+
set useRoughnessFromMetallicTextureGreen(value) {
|
204
|
+
this._material.useRoughnessFromMetallicTextureGreen = value;
|
205
|
+
this._material.useRoughnessFromMetallicTextureAlpha = !value;
|
206
|
+
}
|
207
|
+
/**
|
208
|
+
* Sets whether to use metalness from the metallic texture's blue channel.
|
209
|
+
* @param value True to use blue channel for metalness
|
210
|
+
*/
|
211
|
+
set useMetallicFromMetallicTextureBlue(value) {
|
212
|
+
this._material.useMetallnessFromMetallicTextureBlue = value;
|
213
|
+
}
|
214
|
+
// ========================================
|
215
|
+
// SPECULAR PARAMETERS
|
216
|
+
// ========================================
|
217
|
+
/**
|
218
|
+
* Configures specular properties and optionally enables OpenPBR BRDF model for edge color support.
|
219
|
+
* @param enableEdgeColor Whether to enable OpenPBR BRDF models for edge color support
|
220
|
+
*/
|
221
|
+
enableSpecularEdgeColor(enableEdgeColor = false) {
|
222
|
+
if (enableEdgeColor) {
|
223
|
+
this._material.brdf.dielectricSpecularModel = Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR;
|
224
|
+
this._material.brdf.conductorSpecularModel = Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
/**
|
228
|
+
* Sets the specular weight (mapped to PBR metallicF0Factor).
|
229
|
+
* @param value The specular weight value
|
230
|
+
*/
|
231
|
+
set specularWeight(value) {
|
232
|
+
this._material.metallicF0Factor = value;
|
233
|
+
}
|
234
|
+
/**
|
235
|
+
* Gets the specular weight.
|
236
|
+
* @returns The specular weight value, defaults to 1 if not set
|
237
|
+
*/
|
238
|
+
get specularWeight() {
|
239
|
+
return this._material.metallicF0Factor ?? 1;
|
240
|
+
}
|
241
|
+
/**
|
242
|
+
* Sets the specular weight texture (mapped to PBR metallicReflectanceTexture).
|
243
|
+
* Configures the material to use only metalness from this texture when set.
|
244
|
+
* @param value The specular weight texture or null
|
245
|
+
*/
|
246
|
+
set specularWeightTexture(value) {
|
247
|
+
if (value) {
|
248
|
+
this._material.metallicReflectanceTexture = value;
|
249
|
+
this._material.useOnlyMetallicFromMetallicReflectanceTexture = true;
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
this._material.metallicReflectanceTexture = null;
|
253
|
+
this._material.useOnlyMetallicFromMetallicReflectanceTexture = false;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
/**
|
257
|
+
* Gets the specular weight texture.
|
258
|
+
* @returns The specular weight texture or null
|
259
|
+
*/
|
260
|
+
get specularWeightTexture() {
|
261
|
+
return this._material.metallicReflectanceTexture;
|
262
|
+
}
|
263
|
+
/**
|
264
|
+
* Sets the specular color (mapped to PBR metallicReflectanceColor).
|
265
|
+
* @param value The specular color as a Color3
|
266
|
+
*/
|
267
|
+
set specularColor(value) {
|
268
|
+
this._material.metallicReflectanceColor = value;
|
269
|
+
}
|
270
|
+
/**
|
271
|
+
* Gets the specular color.
|
272
|
+
* @returns The specular color as a Color3
|
273
|
+
*/
|
274
|
+
get specularColor() {
|
275
|
+
return this._material.metallicReflectanceColor;
|
276
|
+
}
|
277
|
+
/**
|
278
|
+
* Sets the specular color texture (mapped to PBR reflectanceTexture).
|
279
|
+
* @param value The specular color texture or null
|
280
|
+
*/
|
281
|
+
set specularColorTexture(value) {
|
282
|
+
this._material.reflectanceTexture = value;
|
283
|
+
}
|
284
|
+
/**
|
285
|
+
* Gets the specular color texture.
|
286
|
+
* @returns The specular color texture or null
|
287
|
+
*/
|
288
|
+
get specularColorTexture() {
|
289
|
+
return this._material.reflectanceTexture;
|
290
|
+
}
|
291
|
+
/**
|
292
|
+
* Sets the specular roughness (mapped to PBR roughness).
|
293
|
+
* @param value The roughness value (0-1)
|
294
|
+
*/
|
295
|
+
set specularRoughness(value) {
|
296
|
+
this._material.roughness = value;
|
297
|
+
}
|
298
|
+
/**
|
299
|
+
* Gets the specular roughness.
|
300
|
+
* @returns The roughness value (0-1), defaults to 1 if not set
|
301
|
+
*/
|
302
|
+
get specularRoughness() {
|
303
|
+
return this._material.roughness ?? 1;
|
304
|
+
}
|
305
|
+
/**
|
306
|
+
* Sets the specular roughness texture.
|
307
|
+
* Note: PBR uses the same texture for both metallic and roughness,
|
308
|
+
* so this only sets the texture if no base metalness texture exists.
|
309
|
+
* @param value The roughness texture or null
|
310
|
+
*/
|
311
|
+
set specularRoughnessTexture(value) {
|
312
|
+
// PBR uses the same texture for both metallic and roughness
|
313
|
+
if (!this.baseMetalnessTexture) {
|
314
|
+
this._material.metallicTexture = value;
|
315
|
+
}
|
316
|
+
}
|
317
|
+
/**
|
318
|
+
* Gets the specular roughness texture.
|
319
|
+
* @returns The roughness texture (same as metallic texture for PBR) or null
|
320
|
+
*/
|
321
|
+
get specularRoughnessTexture() {
|
322
|
+
return this._material.metallicTexture;
|
323
|
+
}
|
324
|
+
/**
|
325
|
+
* Sets the specular index of refraction (mapped to PBR indexOfRefraction).
|
326
|
+
* @param value The IOR value
|
327
|
+
*/
|
328
|
+
set specularIor(value) {
|
329
|
+
this._material.indexOfRefraction = value;
|
330
|
+
}
|
331
|
+
/**
|
332
|
+
* Gets the specular index of refraction.
|
333
|
+
* @returns The IOR value
|
334
|
+
*/
|
335
|
+
get specularIor() {
|
336
|
+
return this._material.indexOfRefraction;
|
337
|
+
}
|
338
|
+
// ========================================
|
339
|
+
// EMISSION PARAMETERS
|
340
|
+
// ========================================
|
341
|
+
/**
|
342
|
+
* Sets the emission color (mapped to PBR emissiveColor).
|
343
|
+
* @param value The emission color as a Color3
|
344
|
+
*/
|
345
|
+
set emissionColor(value) {
|
346
|
+
this._material.emissiveColor = value;
|
347
|
+
}
|
348
|
+
/**
|
349
|
+
* Gets the emission color.
|
350
|
+
* @returns The emission color as a Color3
|
351
|
+
*/
|
352
|
+
get emissionColor() {
|
353
|
+
return this._material.emissiveColor;
|
354
|
+
}
|
355
|
+
/**
|
356
|
+
* Sets the emission luminance/intensity (mapped to PBR emissiveIntensity).
|
357
|
+
* @param value The emission intensity value
|
358
|
+
*/
|
359
|
+
set emissionLuminance(value) {
|
360
|
+
this._material.emissiveIntensity = value;
|
361
|
+
}
|
362
|
+
/**
|
363
|
+
* Gets the emission luminance/intensity.
|
364
|
+
* @returns The emission intensity value
|
365
|
+
*/
|
366
|
+
get emissionLuminance() {
|
367
|
+
return this._material.emissiveIntensity;
|
368
|
+
}
|
369
|
+
/**
|
370
|
+
* Sets the emission color texture (mapped to PBR emissiveTexture).
|
371
|
+
* @param value The emission texture or null
|
372
|
+
*/
|
373
|
+
set emissionColorTexture(value) {
|
374
|
+
this._material.emissiveTexture = value;
|
375
|
+
}
|
376
|
+
/**
|
377
|
+
* Gets the emission color texture.
|
378
|
+
* @returns The emission texture or null
|
379
|
+
*/
|
380
|
+
get emissionColorTexture() {
|
381
|
+
return this._material.emissiveTexture;
|
382
|
+
}
|
383
|
+
// ========================================
|
384
|
+
// AMBIENT OCCLUSION
|
385
|
+
// ========================================
|
386
|
+
/**
|
387
|
+
* Sets the ambient occlusion texture (mapped to PBR ambientTexture).
|
388
|
+
* Automatically enables grayscale mode when set.
|
389
|
+
* @param value The ambient occlusion texture or null
|
390
|
+
*/
|
391
|
+
set ambientOcclusionTexture(value) {
|
392
|
+
this._material.ambientTexture = value;
|
393
|
+
if (value) {
|
394
|
+
this._material.useAmbientInGrayScale = true;
|
395
|
+
}
|
396
|
+
}
|
397
|
+
/**
|
398
|
+
* Gets the ambient occlusion texture.
|
399
|
+
* @returns The ambient occlusion texture or null
|
400
|
+
*/
|
401
|
+
get ambientOcclusionTexture() {
|
402
|
+
return this._material.ambientTexture;
|
403
|
+
}
|
404
|
+
/**
|
405
|
+
* Sets the ambient occlusion texture strength.
|
406
|
+
* @param value The strength value (typically 0-1)
|
407
|
+
*/
|
408
|
+
set ambientOcclusionTextureStrength(value) {
|
409
|
+
this._material.ambientTextureStrength = value;
|
410
|
+
}
|
411
|
+
/**
|
412
|
+
* Gets the ambient occlusion texture strength.
|
413
|
+
* @returns The strength value, defaults to 1.0 if not set
|
414
|
+
*/
|
415
|
+
get ambientOcclusionTextureStrength() {
|
416
|
+
return this._material.ambientTextureStrength ?? 1.0;
|
417
|
+
}
|
418
|
+
// ========================================
|
419
|
+
// COAT PARAMETERS
|
420
|
+
// ========================================
|
421
|
+
/**
|
422
|
+
* Configures clear coat for PBR material.
|
423
|
+
* Enables clear coat and sets up proper configuration.
|
424
|
+
*/
|
425
|
+
configureCoat() {
|
426
|
+
this._material.clearCoat.isEnabled = true;
|
427
|
+
this._material.clearCoat.useRoughnessFromMainTexture = false;
|
428
|
+
this._material.clearCoat.remapF0OnInterfaceChange = false;
|
429
|
+
}
|
430
|
+
/**
|
431
|
+
* Sets the coat weight (mapped to PBR clearCoat.intensity).
|
432
|
+
* Automatically enables clear coat.
|
433
|
+
* @param value The coat weight value (0-1)
|
434
|
+
*/
|
435
|
+
set coatWeight(value) {
|
436
|
+
this._material.clearCoat.isEnabled = true;
|
437
|
+
this._material.clearCoat.intensity = value;
|
438
|
+
}
|
439
|
+
/**
|
440
|
+
* Gets the coat weight.
|
441
|
+
* @returns The coat weight value
|
442
|
+
*/
|
443
|
+
get coatWeight() {
|
444
|
+
return this._material.clearCoat.intensity;
|
445
|
+
}
|
446
|
+
/**
|
447
|
+
* Sets the coat weight texture (mapped to PBR clearCoat.texture).
|
448
|
+
* Automatically enables clear coat.
|
449
|
+
* @param value The coat weight texture or null
|
450
|
+
*/
|
451
|
+
set coatWeightTexture(value) {
|
452
|
+
this._material.clearCoat.isEnabled = true;
|
453
|
+
this._material.clearCoat.texture = value;
|
454
|
+
}
|
455
|
+
/**
|
456
|
+
* Gets the coat weight texture.
|
457
|
+
* @returns The coat weight texture or null
|
458
|
+
*/
|
459
|
+
get coatWeightTexture() {
|
460
|
+
return this._material.clearCoat.texture;
|
461
|
+
}
|
462
|
+
/**
|
463
|
+
* Sets the coat color (mapped to PBR clearCoat.tintColor).
|
464
|
+
* @param value The coat tint color as a Color3
|
465
|
+
*/
|
466
|
+
set coatColor(value) {
|
467
|
+
this._material.clearCoat.isTintEnabled = value != Color3.White();
|
468
|
+
this._material.clearCoat.tintColor = value;
|
469
|
+
}
|
470
|
+
/**
|
471
|
+
* Sets the coat color texture (mapped to PBR clearCoat.tintTexture).
|
472
|
+
* @param value The coat color texture or null
|
473
|
+
*/
|
474
|
+
set coatColorTexture(value) {
|
475
|
+
this._material.clearCoat.tintTexture = value;
|
476
|
+
}
|
477
|
+
/**
|
478
|
+
* Sets the coat roughness (mapped to PBR clearCoat.roughness).
|
479
|
+
* Automatically enables clear coat.
|
480
|
+
* @param value The coat roughness value (0-1)
|
481
|
+
*/
|
482
|
+
set coatRoughness(value) {
|
483
|
+
this._material.clearCoat.isEnabled = true;
|
484
|
+
this._material.clearCoat.roughness = value;
|
485
|
+
}
|
486
|
+
/**
|
487
|
+
* Gets the coat roughness.
|
488
|
+
* @returns The coat roughness value, defaults to 0 if not set
|
489
|
+
*/
|
490
|
+
get coatRoughness() {
|
491
|
+
return this._material.clearCoat.roughness ?? 0;
|
492
|
+
}
|
493
|
+
/**
|
494
|
+
* Sets the coat roughness texture (mapped to PBR clearCoat.textureRoughness).
|
495
|
+
* Automatically enables clear coat and disables using roughness from main texture.
|
496
|
+
* @param value The coat roughness texture or null
|
497
|
+
*/
|
498
|
+
set coatRoughnessTexture(value) {
|
499
|
+
this._material.clearCoat.isEnabled = true;
|
500
|
+
this._material.clearCoat.useRoughnessFromMainTexture = false;
|
501
|
+
this._material.clearCoat.textureRoughness = value;
|
502
|
+
}
|
503
|
+
/**
|
504
|
+
* Gets the coat roughness texture.
|
505
|
+
* @returns The coat roughness texture or null
|
506
|
+
*/
|
507
|
+
get coatRoughnessTexture() {
|
508
|
+
return this._material.clearCoat.textureRoughness;
|
509
|
+
}
|
510
|
+
/**
|
511
|
+
* Sets the coat darkening value.
|
512
|
+
* Note: PBR doesn't have a direct coat darkening property, so this is a no-op.
|
513
|
+
* @param value The coat darkening value (ignored for PBR)
|
514
|
+
*/
|
515
|
+
set coatDarkening(value) {
|
516
|
+
// PBR doesn't have a coat darkening property
|
517
|
+
}
|
518
|
+
/**
|
519
|
+
* Sets the coat darkening texture
|
520
|
+
* @param value The coat darkening texture or null
|
521
|
+
*/
|
522
|
+
set coatDarkeningTexture(value) {
|
523
|
+
// PBR doesn't have a coat darkening property
|
524
|
+
}
|
525
|
+
/**
|
526
|
+
* Sets the coat roughness anisotropy.
|
527
|
+
* Note: PBR clearCoat doesn't support anisotropy yet, so this is a placeholder.
|
528
|
+
* @param value The coat anisotropy intensity value (currently ignored)
|
529
|
+
*/
|
530
|
+
set coatRoughnessAnisotropy(value) {
|
531
|
+
// TODO: Implement when PBR clearCoat anisotropy becomes available
|
532
|
+
// this._material.clearCoat.anisotropy = value;
|
533
|
+
}
|
534
|
+
/**
|
535
|
+
* Gets the coat roughness anisotropy.
|
536
|
+
* Note: PBR clearCoat doesn't support anisotropy yet, so this returns 0.
|
537
|
+
* @returns Currently returns 0 as clearCoat anisotropy is not yet available
|
538
|
+
*/
|
539
|
+
get coatRoughnessAnisotropy() {
|
540
|
+
// TODO: Implement when PBR clearCoat anisotropy becomes available
|
541
|
+
// return this._material.clearCoat.anisotropy ?? 0;
|
542
|
+
return 0;
|
543
|
+
}
|
544
|
+
/**
|
545
|
+
* Sets the coat tangent angle for anisotropy.
|
546
|
+
* Note: PBR clearCoat doesn't support anisotropy yet, so this is a placeholder.
|
547
|
+
* @param value The coat anisotropy rotation angle in radians (currently ignored)
|
548
|
+
*/
|
549
|
+
set geometryCoatTangentAngle(value) {
|
550
|
+
// TODO: Implement when PBR clearCoat anisotropy becomes available
|
551
|
+
// this._material.clearCoat.anisotropyAngle = value;
|
552
|
+
}
|
553
|
+
/**
|
554
|
+
* Sets the coat tangent texture for anisotropy.
|
555
|
+
* Note: PBR clearCoat doesn't support anisotropy textures yet, so this is a placeholder.
|
556
|
+
* @param value The coat anisotropy texture (currently ignored)
|
557
|
+
*/
|
558
|
+
set geometryCoatTangentTexture(value) {
|
559
|
+
// TODO: Implement when PBR clearCoat anisotropy becomes available
|
560
|
+
// this._material.clearCoat.anisotropyTangentTexture = value;
|
561
|
+
}
|
562
|
+
/**
|
563
|
+
* Gets the coat tangent texture for anisotropy.
|
564
|
+
* Note: PBR clearCoat doesn't support anisotropy textures yet, so this returns null.
|
565
|
+
* @returns Currently returns null as clearCoat anisotropy is not yet available
|
566
|
+
*/
|
567
|
+
get geometryCoatTangentTexture() {
|
568
|
+
// TODO: Implement when PBR clearCoat anisotropy becomes available
|
569
|
+
// return this._material.clearCoat.anisotropyTangentTexture;
|
570
|
+
return null;
|
571
|
+
}
|
572
|
+
// ========================================
|
573
|
+
// TRANSMISSION LAYER
|
574
|
+
// ========================================
|
575
|
+
/**
|
576
|
+
* Sets the transmission weight (mapped to PBR subSurface.refractionIntensity).
|
577
|
+
* Enables refraction when value \> 0.
|
578
|
+
* @param value The transmission weight value (0-1)
|
579
|
+
*/
|
580
|
+
set transmissionWeight(value) {
|
581
|
+
this._material.subSurface.isRefractionEnabled = value > 0;
|
582
|
+
this._material.subSurface.refractionIntensity = value;
|
583
|
+
}
|
584
|
+
/**
|
585
|
+
* Gets the transmission weight.
|
586
|
+
* @returns The transmission weight value
|
587
|
+
*/
|
588
|
+
get transmissionWeight() {
|
589
|
+
return this._material.subSurface.refractionIntensity;
|
590
|
+
}
|
591
|
+
/**
|
592
|
+
* Sets the transmission weight texture (mapped to PBR subSurface.refractionIntensityTexture).
|
593
|
+
* Automatically enables refraction and glTF-style textures.
|
594
|
+
* @param value The transmission weight texture or null
|
595
|
+
*/
|
596
|
+
set transmissionWeightTexture(value) {
|
597
|
+
this._material.subSurface.isRefractionEnabled = true;
|
598
|
+
this._material.subSurface.refractionIntensityTexture = value;
|
599
|
+
this._material.subSurface.useGltfStyleTextures = true;
|
600
|
+
}
|
601
|
+
/**
|
602
|
+
* Sets the attenuation distance for volume scattering.
|
603
|
+
* @param value The attenuation distance value
|
604
|
+
*/
|
605
|
+
set transmissionDepth(value) {
|
606
|
+
this._material.subSurface.tintColorAtDistance = value;
|
607
|
+
}
|
608
|
+
/**
|
609
|
+
* Sets the attenuation color (mapped to PBR subSurface.tintColor).
|
610
|
+
* @param value The attenuation color as a Color3
|
611
|
+
*/
|
612
|
+
set transmissionColor(value) {
|
613
|
+
this._material.subSurface.tintColor = value;
|
614
|
+
}
|
615
|
+
/**
|
616
|
+
* Gets the transmission dispersion Abbe number.
|
617
|
+
* @param value The Abbe number value
|
618
|
+
*/
|
619
|
+
set transmissionDispersionAbbeNumber(value) {
|
620
|
+
if (value > 0) {
|
621
|
+
this._material.subSurface.isDispersionEnabled = true;
|
622
|
+
this._material.subSurface.dispersion = 20.0 / value;
|
623
|
+
}
|
624
|
+
else {
|
625
|
+
this._material.subSurface.isDispersionEnabled = false;
|
626
|
+
this._material.subSurface.dispersion = 0;
|
627
|
+
}
|
628
|
+
}
|
629
|
+
/**
|
630
|
+
* Configures transmission for thin-surface transmission (KHR_materials_transmission).
|
631
|
+
* Sets up the material for proper thin-surface transmission behavior.
|
632
|
+
*/
|
633
|
+
configureTransmission() {
|
634
|
+
// Since this extension models thin-surface transmission only, we must make IOR = 1.0
|
635
|
+
this._material.subSurface.volumeIndexOfRefraction = 1.0;
|
636
|
+
// Albedo colour will tint transmission.
|
637
|
+
this._material.subSurface.useAlbedoToTintRefraction = true;
|
638
|
+
this._material.subSurface.minimumThickness = 0.0;
|
639
|
+
this._material.subSurface.maximumThickness = 0.0;
|
640
|
+
}
|
641
|
+
// ========================================
|
642
|
+
// VOLUME PROPERTIES
|
643
|
+
// ========================================
|
644
|
+
/**
|
645
|
+
* Sets the thickness texture (mapped to PBR subSurface.thicknessTexture).
|
646
|
+
* Automatically enables refraction.
|
647
|
+
* @param value The thickness texture or null
|
648
|
+
*/
|
649
|
+
set volumeThicknessTexture(value) {
|
650
|
+
this._material.subSurface.thicknessTexture = value;
|
651
|
+
this._material.subSurface.useGltfStyleTextures = true;
|
652
|
+
}
|
653
|
+
/**
|
654
|
+
* Sets the thickness factor (mapped to PBR subSurface.maximumThickness).
|
655
|
+
* Automatically enables refraction.
|
656
|
+
* @param value The thickness value
|
657
|
+
*/
|
658
|
+
set volumeThickness(value) {
|
659
|
+
this._material.subSurface.minimumThickness = 0.0;
|
660
|
+
this._material.subSurface.maximumThickness = value;
|
661
|
+
this._material.subSurface.useThicknessAsDepth = true;
|
662
|
+
if (value > 0) {
|
663
|
+
this._material.subSurface.volumeIndexOfRefraction = this._material.indexOfRefraction;
|
664
|
+
}
|
665
|
+
}
|
666
|
+
// ========================================
|
667
|
+
// SUBSURFACE PROPERTIES (Subsurface Scattering)
|
668
|
+
// ========================================
|
669
|
+
/**
|
670
|
+
* Configures subsurface properties for PBR material
|
671
|
+
*/
|
672
|
+
configureSubsurface() {
|
673
|
+
this._material.subSurface.useGltfStyleTextures = true;
|
674
|
+
// Since this extension models thin-surface transmission only, we must make the
|
675
|
+
// internal IOR == 1.0 and set the thickness to 0.
|
676
|
+
this._material.subSurface.volumeIndexOfRefraction = 1.0;
|
677
|
+
this._material.subSurface.minimumThickness = 0.0;
|
678
|
+
this._material.subSurface.maximumThickness = 0.0;
|
679
|
+
// Tint color will be used for transmission.
|
680
|
+
this._material.subSurface.useAlbedoToTintTranslucency = false;
|
681
|
+
}
|
682
|
+
/**
|
683
|
+
* Sets the subsurface weight
|
684
|
+
*/
|
685
|
+
set subsurfaceWeight(value) {
|
686
|
+
this._material.subSurface.isTranslucencyEnabled = value > 0;
|
687
|
+
this._material.subSurface.translucencyIntensity = value;
|
688
|
+
}
|
689
|
+
/**
|
690
|
+
* Gets the subsurface weight
|
691
|
+
* @returns The subsurface weight value
|
692
|
+
*/
|
693
|
+
get subsurfaceWeight() {
|
694
|
+
return this._material.subSurface.isTranslucencyEnabled ? this._material.subSurface.translucencyIntensity : 0;
|
695
|
+
}
|
696
|
+
/**
|
697
|
+
* Sets the subsurface weight texture
|
698
|
+
*/
|
699
|
+
set subsurfaceWeightTexture(value) {
|
700
|
+
this._material.subSurface.translucencyIntensityTexture = value;
|
701
|
+
}
|
702
|
+
/**
|
703
|
+
* Sets the subsurface color.
|
704
|
+
* @param value The subsurface tint color as a Color3
|
705
|
+
*/
|
706
|
+
set subsurfaceColor(value) {
|
707
|
+
this._material.subSurface.tintColor = value;
|
708
|
+
}
|
709
|
+
/**
|
710
|
+
* Sets the subsurface color texture.
|
711
|
+
* @param value The subsurface tint texture or null
|
712
|
+
*/
|
713
|
+
set subsurfaceColorTexture(value) {
|
714
|
+
this._material.subSurface.translucencyColorTexture = value;
|
715
|
+
}
|
716
|
+
// ========================================
|
717
|
+
// FUZZ LAYER (Sheen)
|
718
|
+
// ========================================
|
719
|
+
/**
|
720
|
+
* Configures sheen for PBR material.
|
721
|
+
* Enables sheen and sets up proper configuration.
|
722
|
+
*/
|
723
|
+
configureFuzz() {
|
724
|
+
this._material.sheen.isEnabled = true;
|
725
|
+
this._material.sheen.useRoughnessFromMainTexture = false;
|
726
|
+
this._material.sheen.albedoScaling = true;
|
727
|
+
}
|
728
|
+
/**
|
729
|
+
* Sets the sheen weight (mapped to PBR sheen.intensity).
|
730
|
+
* Automatically enables sheen.
|
731
|
+
* @param value The sheen weight value
|
732
|
+
*/
|
733
|
+
set fuzzWeight(value) {
|
734
|
+
this._material.sheen.isEnabled = true;
|
735
|
+
this._material.sheen.intensity = value;
|
736
|
+
}
|
737
|
+
/**
|
738
|
+
* Sets the sheen color (mapped to PBR sheen.color).
|
739
|
+
* Automatically enables sheen.
|
740
|
+
* @param value The sheen color as a Color3
|
741
|
+
*/
|
742
|
+
set fuzzColor(value) {
|
743
|
+
this._material.sheen.isEnabled = true;
|
744
|
+
this._material.sheen.color = value;
|
745
|
+
}
|
746
|
+
/**
|
747
|
+
* Sets the sheen color texture (mapped to PBR sheen.texture).
|
748
|
+
* Automatically enables sheen.
|
749
|
+
* @param value The sheen color texture or null
|
750
|
+
*/
|
751
|
+
set fuzzColorTexture(value) {
|
752
|
+
this._material.sheen.isEnabled = true;
|
753
|
+
this._material.sheen.texture = value;
|
754
|
+
}
|
755
|
+
/**
|
756
|
+
* Sets the sheen roughness (mapped to PBR sheen.roughness).
|
757
|
+
* Automatically enables sheen.
|
758
|
+
* @param value The sheen roughness value (0-1)
|
759
|
+
*/
|
760
|
+
set fuzzRoughness(value) {
|
761
|
+
this._material.sheen.isEnabled = true;
|
762
|
+
this._material.sheen.roughness = value;
|
763
|
+
}
|
764
|
+
/**
|
765
|
+
* Sets the sheen roughness texture (mapped to PBR sheen.textureRoughness).
|
766
|
+
* Automatically enables sheen.
|
767
|
+
* @param value The sheen roughness texture or null
|
768
|
+
*/
|
769
|
+
set fuzzRoughnessTexture(value) {
|
770
|
+
this._material.sheen.isEnabled = true;
|
771
|
+
this._material.sheen.textureRoughness = value;
|
772
|
+
}
|
773
|
+
// ========================================
|
774
|
+
// ANISOTROPY
|
775
|
+
// ========================================
|
776
|
+
/**
|
777
|
+
* Sets the specular roughness anisotropy (mapped to PBR anisotropy.intensity).
|
778
|
+
* Automatically enables anisotropy.
|
779
|
+
* @param value The anisotropy intensity value
|
780
|
+
*/
|
781
|
+
set specularRoughnessAnisotropy(value) {
|
782
|
+
this._material.anisotropy.isEnabled = true;
|
783
|
+
this._material.anisotropy.intensity = value;
|
784
|
+
}
|
785
|
+
/**
|
786
|
+
* Gets the specular roughness anisotropy.
|
787
|
+
* @returns The anisotropy intensity value
|
788
|
+
*/
|
789
|
+
get specularRoughnessAnisotropy() {
|
790
|
+
return this._material.anisotropy.intensity;
|
791
|
+
}
|
792
|
+
/**
|
793
|
+
* Sets the anisotropy rotation (mapped to PBR anisotropy.angle).
|
794
|
+
* Automatically enables anisotropy.
|
795
|
+
* @param value The anisotropy rotation angle in radians
|
796
|
+
*/
|
797
|
+
set geometryTangentAngle(value) {
|
798
|
+
this._material.anisotropy.isEnabled = true;
|
799
|
+
this._material.anisotropy.angle = value;
|
800
|
+
}
|
801
|
+
/**
|
802
|
+
* Sets the geometry tangent texture (mapped to PBR anisotropy.texture).
|
803
|
+
* Automatically enables anisotropy.
|
804
|
+
* @param value The anisotropy texture or null
|
805
|
+
*/
|
806
|
+
set geometryTangentTexture(value) {
|
807
|
+
this._material.anisotropy.isEnabled = true;
|
808
|
+
this._material.anisotropy.texture = value;
|
809
|
+
}
|
810
|
+
/**
|
811
|
+
* Gets the geometry tangent texture.
|
812
|
+
* @returns The anisotropy texture or null
|
813
|
+
*/
|
814
|
+
get geometryTangentTexture() {
|
815
|
+
return this._material.anisotropy.texture;
|
816
|
+
}
|
817
|
+
/**
|
818
|
+
* Configures glTF-style anisotropy for the material.
|
819
|
+
* Note: PBR materials don't need this configuration, so this is a no-op.
|
820
|
+
* @param useGltfStyle Whether to use glTF-style anisotropy (ignored for PBR)
|
821
|
+
*/
|
822
|
+
configureGltfStyleAnisotropy(useGltfStyle = true) {
|
823
|
+
// PBR materials don't need this configuration
|
824
|
+
}
|
825
|
+
// ========================================
|
826
|
+
// THIN FILM IRIDESCENCE
|
827
|
+
// ========================================
|
828
|
+
/**
|
829
|
+
* Sets the iridescence weight (mapped to PBR iridescence.intensity).
|
830
|
+
* Automatically enables iridescence.
|
831
|
+
* @param value The iridescence intensity value
|
832
|
+
*/
|
833
|
+
set iridescenceWeight(value) {
|
834
|
+
this._material.iridescence.isEnabled = true;
|
835
|
+
this._material.iridescence.intensity = value;
|
836
|
+
}
|
837
|
+
/**
|
838
|
+
* Sets the iridescence IOR (mapped to PBR iridescence.indexOfRefraction).
|
839
|
+
* Automatically enables iridescence.
|
840
|
+
* @param value The iridescence IOR value
|
841
|
+
*/
|
842
|
+
set iridescenceIor(value) {
|
843
|
+
this._material.iridescence.isEnabled = true;
|
844
|
+
this._material.iridescence.indexOfRefraction = value;
|
845
|
+
}
|
846
|
+
/**
|
847
|
+
* Sets the iridescence thickness minimum (mapped to PBR iridescence.minimumThickness).
|
848
|
+
* Automatically enables iridescence.
|
849
|
+
* @param value The minimum thickness value in nanometers
|
850
|
+
*/
|
851
|
+
set iridescenceThicknessMinimum(value) {
|
852
|
+
this._material.iridescence.isEnabled = true;
|
853
|
+
this._material.iridescence.minimumThickness = value;
|
854
|
+
}
|
855
|
+
/**
|
856
|
+
* Sets the iridescence thickness maximum (mapped to PBR iridescence.maximumThickness).
|
857
|
+
* Automatically enables iridescence.
|
858
|
+
* @param value The maximum thickness value in nanometers
|
859
|
+
*/
|
860
|
+
set iridescenceThicknessMaximum(value) {
|
861
|
+
this._material.iridescence.isEnabled = true;
|
862
|
+
this._material.iridescence.maximumThickness = value;
|
863
|
+
}
|
864
|
+
/**
|
865
|
+
* Sets the iridescence texture (mapped to PBR iridescence.texture).
|
866
|
+
* Automatically enables iridescence.
|
867
|
+
* @param value The iridescence intensity texture or null
|
868
|
+
*/
|
869
|
+
set iridescenceTexture(value) {
|
870
|
+
this._material.iridescence.isEnabled = true;
|
871
|
+
this._material.iridescence.texture = value;
|
872
|
+
}
|
873
|
+
/**
|
874
|
+
* Sets the iridescence thickness texture (mapped to PBR iridescence.thicknessTexture).
|
875
|
+
* Automatically enables iridescence.
|
876
|
+
* @param value The iridescence thickness texture or null
|
877
|
+
*/
|
878
|
+
set iridescenceThicknessTexture(value) {
|
879
|
+
this._material.iridescence.isEnabled = true;
|
880
|
+
this._material.iridescence.thicknessTexture = value;
|
881
|
+
}
|
882
|
+
// ========================================
|
883
|
+
// DISPERSION
|
884
|
+
// ========================================
|
885
|
+
/**
|
886
|
+
* Sets the transmission dispersion value.
|
887
|
+
* Note: PBR doesn't have direct dispersion support, so this stores it as metadata.
|
888
|
+
* @param value The dispersion value (stored as metadata)
|
889
|
+
*/
|
890
|
+
set transmissionDispersion(value) {
|
891
|
+
// PBR doesn't have a direct dispersion property, this would need custom shader modification
|
892
|
+
// For now, we'll store it as metadata
|
893
|
+
this._material._dispersion = value;
|
894
|
+
}
|
895
|
+
// ========================================
|
896
|
+
// UNLIT MATERIALS
|
897
|
+
// ========================================
|
898
|
+
/**
|
899
|
+
* Sets whether the material is unlit.
|
900
|
+
* @param value True to make the material unlit
|
901
|
+
*/
|
902
|
+
set unlit(value) {
|
903
|
+
this._material.unlit = value;
|
904
|
+
}
|
905
|
+
// ========================================
|
906
|
+
// GEOMETRY PARAMETERS
|
907
|
+
// ========================================
|
908
|
+
/**
|
909
|
+
* Sets the geometry opacity (mapped to PBR alpha).
|
910
|
+
* @param value The opacity value (0-1)
|
911
|
+
*/
|
912
|
+
set geometryOpacity(value) {
|
913
|
+
this._material.alpha = value;
|
914
|
+
}
|
915
|
+
/**
|
916
|
+
* Gets the geometry opacity.
|
917
|
+
* @returns The opacity value (0-1)
|
918
|
+
*/
|
919
|
+
get geometryOpacity() {
|
920
|
+
return this._material.alpha;
|
921
|
+
}
|
922
|
+
/**
|
923
|
+
* Sets the geometry normal texture (mapped to PBR bumpTexture).
|
924
|
+
* Also forces irradiance computation in fragment shader for better lighting.
|
925
|
+
* @param value The normal texture or null
|
926
|
+
*/
|
927
|
+
set geometryNormalTexture(value) {
|
928
|
+
this._material.bumpTexture = value;
|
929
|
+
this._material.forceIrradianceInFragment = true;
|
930
|
+
}
|
931
|
+
/**
|
932
|
+
* Gets the geometry normal texture.
|
933
|
+
* @returns The normal texture or null
|
934
|
+
*/
|
935
|
+
get geometryNormalTexture() {
|
936
|
+
return this._material.bumpTexture;
|
937
|
+
}
|
938
|
+
/**
|
939
|
+
* Sets the normal map inversions for the material.
|
940
|
+
* @param invertX Whether to invert the normal map on the X axis
|
941
|
+
* @param invertY Whether to invert the normal map on the Y axis
|
942
|
+
*/
|
943
|
+
setNormalMapInversions(invertX, invertY) {
|
944
|
+
this._material.invertNormalMapX = invertX;
|
945
|
+
this._material.invertNormalMapY = invertY;
|
946
|
+
}
|
947
|
+
/**
|
948
|
+
* Sets the geometry coat normal texture (mapped to PBR clearCoat.bumpTexture).
|
949
|
+
* Automatically enables clear coat.
|
950
|
+
* @param value The coat normal texture or null
|
951
|
+
*/
|
952
|
+
set geometryCoatNormalTexture(value) {
|
953
|
+
this._material.clearCoat.isEnabled = true;
|
954
|
+
this._material.clearCoat.bumpTexture = value;
|
955
|
+
}
|
956
|
+
/**
|
957
|
+
* Gets the geometry coat normal texture.
|
958
|
+
* @returns The coat normal texture or null
|
959
|
+
*/
|
960
|
+
get geometryCoatNormalTexture() {
|
961
|
+
return this._material.clearCoat.bumpTexture;
|
962
|
+
}
|
963
|
+
/**
|
964
|
+
* Sets the geometry coat normal texture scale.
|
965
|
+
* @param value The scale value for the coat normal texture
|
966
|
+
*/
|
967
|
+
set geometryCoatNormalTextureScale(value) {
|
968
|
+
if (this._material.clearCoat.bumpTexture) {
|
969
|
+
this._material.clearCoat.bumpTexture.level = value;
|
970
|
+
}
|
971
|
+
}
|
972
|
+
}
|
973
|
+
//# sourceMappingURL=pbrMaterialLoadingAdapter.js.map
|