@babylonjs/loaders 8.5.0 → 8.6.1
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/BVH/bvhFileLoader.d.ts +66 -0
- package/BVH/bvhFileLoader.js +105 -0
- package/BVH/bvhFileLoader.js.map +1 -0
- package/BVH/bvhFileLoader.metadata.d.ts +8 -0
- package/BVH/bvhFileLoader.metadata.js +8 -0
- package/BVH/bvhFileLoader.metadata.js.map +1 -0
- package/BVH/bvhLoader.d.ts +11 -0
- package/BVH/bvhLoader.js +329 -0
- package/BVH/bvhLoader.js.map +1 -0
- package/BVH/bvhLoadingOptions.d.ts +9 -0
- package/BVH/bvhLoadingOptions.js +2 -0
- package/BVH/bvhLoadingOptions.js.map +1 -0
- package/BVH/index.d.ts +1 -0
- package/BVH/index.js +3 -0
- package/BVH/index.js.map +1 -0
- package/OBJ/mtlFileLoader.js +6 -6
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +1 -1
- package/OBJ/objFileLoader.js +2 -2
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/solidParser.js +4 -2
- package/OBJ/solidParser.js.map +1 -1
- package/SPLAT/splatFileLoader.d.ts +2 -2
- package/SPLAT/splatFileLoader.js +7 -7
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/bvh/license.md +21 -0
- package/dynamic.js +9 -0
- package/dynamic.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.js +4 -0
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.js +114 -86
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +3 -3
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.js +2 -0
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_ies.js +2 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +1 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +1 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +1 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.js +1 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js +2 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +2 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.js +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +1 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.js +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +1 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.js +7 -6
- package/glTF/2.0/Extensions/KHR_node_hoverability.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.js +1 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.js +1 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +1 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +1 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +6 -6
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +3 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.js +5 -0
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +1 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +2 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/objectModelMapping.js +120 -118
- package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
- package/glTF/2.0/glTFLoader.js +18 -1
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.js +3 -0
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtensionRegistry.js +7 -4
- package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +2 -2
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js +5 -5
- package/glTF/glTFValidation.js.map +1 -1
- package/legacy/legacy-glTF.js +5 -5
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.js +5 -5
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF2.js +5 -4
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-objFileLoader.js +4 -4
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.js +4 -4
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/package.json +3 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MSFT_sRGBFactors.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/MSFT_sRGBFactors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAahC,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,OAAO,gBAAgB;IASzB,gBAAgB;IAChB,YAAY,MAAkB;QAT9B,gBAAgB;QACA,SAAI,GAAG,IAAI,CAAC;QASxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,
|
1
|
+
{"version":3,"file":"MSFT_sRGBFactors.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/MSFT_sRGBFactors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAahC,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,OAAO,gBAAgB;IASzB,gBAAgB;IAChB,YAAY,MAAkB;QAT9B,gBAAgB;QACA,SAAI,GAAG,IAAI,CAAC;QASxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,eAAe;IACf,gDAAgD;IACzC,2BAA2B,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAC9F,OAAO,UAAU,CAAC,cAAc,CAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE;YAC5F,IAAI,KAAK,EAAE,CAAC;gBACR,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE,CAAC;oBAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,+BAA+B,CAAC,CAAC;gBACpE,CAAC;gBAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;gBAE7F,MAAM,uBAAuB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,uBAAuB,CAAC;gBAC/F,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;oBACjC,eAAe,CAAC,WAAW,CAAC,kBAAkB,CAAC,eAAe,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;gBACzG,CAAC;gBAED,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE,CAAC;oBACvC,eAAe,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC;gBACrH,CAAC;gBAED,OAAO,OAAO,CAAC;YACnB,CAAC;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"MSFT_sRGBFactors\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/naming-convention\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the MSFT_sRGBFactors extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"MSFT_sRGBFactors\"]: {};\r\n }\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class MSFT_sRGBFactors implements IGLTFLoaderExtension {\r\n /** @internal */\r\n public readonly name = NAME;\r\n\r\n /** @internal */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /** @internal */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /** @internal*/\r\n // eslint-disable-next-line no-restricted-syntax\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtraAsync<boolean>(context, material, this.name, (extraContext, extra) => {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${extraContext}: Material type not supported`);\r\n }\r\n\r\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n\r\n const useExactSrgbConversions = babylonMaterial.getScene().getEngine().useExactSrgbConversions;\r\n if (!babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor, useExactSrgbConversions);\r\n }\r\n\r\n if (!babylonMaterial.reflectivityTexture) {\r\n babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor, useExactSrgbConversions);\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n return null;\r\n });\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new MSFT_sRGBFactors(loader));\r\n"]}
|
@@ -244,98 +244,98 @@ const materialsTree = {
|
|
244
244
|
__target__: true,
|
245
245
|
emissiveFactor: {
|
246
246
|
type: "Color3",
|
247
|
-
get: (material, index, payload) =>
|
248
|
-
set: (value, material, index, payload) =>
|
249
|
-
getTarget: (material, index, payload) =>
|
247
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).emissiveColor,
|
248
|
+
set: (value, material, index, payload) => GetMaterial(material, index, payload).emissiveColor.copyFrom(value),
|
249
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
250
250
|
getPropertyName: [() => "emissiveColor"],
|
251
251
|
},
|
252
252
|
emissiveTexture: {
|
253
253
|
extensions: {
|
254
|
-
KHR_texture_transform:
|
254
|
+
KHR_texture_transform: GenerateTextureMap("emissiveTexture"),
|
255
255
|
},
|
256
256
|
},
|
257
257
|
normalTexture: {
|
258
258
|
scale: {
|
259
259
|
type: "number",
|
260
|
-
get: (material, index, payload) =>
|
260
|
+
get: (material, index, payload) => GetTexture(material, payload, "bumpTexture")?.level,
|
261
261
|
set: (value, material, index, payload) => {
|
262
|
-
const texture =
|
262
|
+
const texture = GetTexture(material, payload, "bumpTexture");
|
263
263
|
if (texture) {
|
264
264
|
texture.level = value;
|
265
265
|
}
|
266
266
|
},
|
267
|
-
getTarget: (material, index, payload) =>
|
267
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
268
268
|
getPropertyName: [() => "level"],
|
269
269
|
},
|
270
270
|
extensions: {
|
271
|
-
KHR_texture_transform:
|
271
|
+
KHR_texture_transform: GenerateTextureMap("bumpTexture"),
|
272
272
|
},
|
273
273
|
},
|
274
274
|
occlusionTexture: {
|
275
275
|
strength: {
|
276
276
|
type: "number",
|
277
|
-
get: (material, index, payload) =>
|
277
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).ambientTextureStrength,
|
278
278
|
set: (value, material, index, payload) => {
|
279
|
-
const mat =
|
279
|
+
const mat = GetMaterial(material, index, payload);
|
280
280
|
if (mat) {
|
281
281
|
mat.ambientTextureStrength = value;
|
282
282
|
}
|
283
283
|
},
|
284
|
-
getTarget: (material, index, payload) =>
|
284
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
285
285
|
getPropertyName: [() => "ambientTextureStrength"],
|
286
286
|
},
|
287
287
|
extensions: {
|
288
|
-
KHR_texture_transform:
|
288
|
+
KHR_texture_transform: GenerateTextureMap("ambientTexture"),
|
289
289
|
},
|
290
290
|
},
|
291
291
|
pbrMetallicRoughness: {
|
292
292
|
baseColorFactor: {
|
293
293
|
type: "Color4",
|
294
294
|
get: (material, index, payload) => {
|
295
|
-
const mat =
|
295
|
+
const mat = GetMaterial(material, index, payload);
|
296
296
|
return Color4.FromColor3(mat.albedoColor, mat.alpha);
|
297
297
|
},
|
298
298
|
set: (value, material, index, payload) => {
|
299
|
-
const mat =
|
299
|
+
const mat = GetMaterial(material, index, payload);
|
300
300
|
mat.albedoColor.set(value.r, value.g, value.b);
|
301
301
|
mat.alpha = value.a;
|
302
302
|
},
|
303
|
-
getTarget: (material, index, payload) =>
|
303
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
304
304
|
// This is correct on the animation level, but incorrect as a single property of a type Color4
|
305
305
|
getPropertyName: [() => "albedoColor", () => "alpha"],
|
306
306
|
},
|
307
307
|
baseColorTexture: {
|
308
308
|
extensions: {
|
309
|
-
KHR_texture_transform:
|
309
|
+
KHR_texture_transform: GenerateTextureMap("albedoTexture"),
|
310
310
|
},
|
311
311
|
},
|
312
312
|
metallicFactor: {
|
313
313
|
type: "number",
|
314
|
-
get: (material, index, payload) =>
|
314
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).metallic,
|
315
315
|
set: (value, material, index, payload) => {
|
316
|
-
const mat =
|
316
|
+
const mat = GetMaterial(material, index, payload);
|
317
317
|
if (mat) {
|
318
318
|
mat.metallic = value;
|
319
319
|
}
|
320
320
|
},
|
321
|
-
getTarget: (material, index, payload) =>
|
321
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
322
322
|
getPropertyName: [() => "metallic"],
|
323
323
|
},
|
324
324
|
roughnessFactor: {
|
325
325
|
type: "number",
|
326
|
-
get: (material, index, payload) =>
|
326
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).roughness,
|
327
327
|
set: (value, material, index, payload) => {
|
328
|
-
const mat =
|
328
|
+
const mat = GetMaterial(material, index, payload);
|
329
329
|
if (mat) {
|
330
330
|
mat.roughness = value;
|
331
331
|
}
|
332
332
|
},
|
333
|
-
getTarget: (material, index, payload) =>
|
333
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
334
334
|
getPropertyName: [() => "roughness"],
|
335
335
|
},
|
336
336
|
metallicRoughnessTexture: {
|
337
337
|
extensions: {
|
338
|
-
KHR_texture_transform:
|
338
|
+
KHR_texture_transform: GenerateTextureMap("metallicTexture"),
|
339
339
|
},
|
340
340
|
},
|
341
341
|
},
|
@@ -343,239 +343,239 @@ const materialsTree = {
|
|
343
343
|
KHR_materials_anisotropy: {
|
344
344
|
anisotropyStrength: {
|
345
345
|
type: "number",
|
346
|
-
get: (material, index, payload) =>
|
346
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).anisotropy.intensity,
|
347
347
|
set: (value, material, index, payload) => {
|
348
|
-
|
348
|
+
GetMaterial(material, index, payload).anisotropy.intensity = value;
|
349
349
|
},
|
350
|
-
getTarget: (material, index, payload) =>
|
350
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
351
351
|
getPropertyName: [() => "anisotropy.intensity"],
|
352
352
|
},
|
353
353
|
anisotropyRotation: {
|
354
354
|
type: "number",
|
355
|
-
get: (material, index, payload) =>
|
355
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).anisotropy.angle,
|
356
356
|
set: (value, material, index, payload) => {
|
357
|
-
|
357
|
+
GetMaterial(material, index, payload).anisotropy.angle = value;
|
358
358
|
},
|
359
|
-
getTarget: (material, index, payload) =>
|
359
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
360
360
|
getPropertyName: [() => "anisotropy.angle"],
|
361
361
|
},
|
362
362
|
anisotropyTexture: {
|
363
363
|
extensions: {
|
364
|
-
KHR_texture_transform:
|
364
|
+
KHR_texture_transform: GenerateTextureMap("anisotropy", "texture"),
|
365
365
|
},
|
366
366
|
},
|
367
367
|
},
|
368
368
|
KHR_materials_clearcoat: {
|
369
369
|
clearcoatFactor: {
|
370
370
|
type: "number",
|
371
|
-
get: (material, index, payload) =>
|
371
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).clearCoat.intensity,
|
372
372
|
set: (value, material, index, payload) => {
|
373
|
-
|
373
|
+
GetMaterial(material, index, payload).clearCoat.intensity = value;
|
374
374
|
},
|
375
|
-
getTarget: (material, index, payload) =>
|
375
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
376
376
|
getPropertyName: [() => "clearCoat.intensity"],
|
377
377
|
},
|
378
378
|
clearcoatRoughnessFactor: {
|
379
379
|
type: "number",
|
380
|
-
get: (material, index, payload) =>
|
380
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).clearCoat.roughness,
|
381
381
|
set: (value, material, index, payload) => {
|
382
|
-
|
382
|
+
GetMaterial(material, index, payload).clearCoat.roughness = value;
|
383
383
|
},
|
384
|
-
getTarget: (material, index, payload) =>
|
384
|
+
getTarget: (material, index, payload) => GetMaterial(material, index, payload),
|
385
385
|
getPropertyName: [() => "clearCoat.roughness"],
|
386
386
|
},
|
387
387
|
clearcoatTexture: {
|
388
388
|
extensions: {
|
389
|
-
KHR_texture_transform:
|
389
|
+
KHR_texture_transform: GenerateTextureMap("clearCoat", "texture"),
|
390
390
|
},
|
391
391
|
},
|
392
392
|
clearcoatNormalTexture: {
|
393
393
|
scale: {
|
394
394
|
type: "number",
|
395
|
-
get: (material, index, payload) =>
|
396
|
-
getTarget:
|
397
|
-
set: (value, material, index, payload) => (
|
395
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).clearCoat.bumpTexture?.level,
|
396
|
+
getTarget: GetMaterial,
|
397
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).clearCoat.bumpTexture.level = value),
|
398
398
|
},
|
399
399
|
extensions: {
|
400
|
-
KHR_texture_transform:
|
400
|
+
KHR_texture_transform: GenerateTextureMap("clearCoat", "bumpTexture"),
|
401
401
|
},
|
402
402
|
},
|
403
403
|
clearcoatRoughnessTexture: {
|
404
404
|
extensions: {
|
405
|
-
KHR_texture_transform:
|
405
|
+
KHR_texture_transform: GenerateTextureMap("clearCoat", "textureRoughness"),
|
406
406
|
},
|
407
407
|
},
|
408
408
|
},
|
409
409
|
KHR_materials_dispersion: {
|
410
410
|
dispersion: {
|
411
411
|
type: "number",
|
412
|
-
get: (material, index, payload) =>
|
413
|
-
getTarget:
|
414
|
-
set: (value, material, index, payload) => (
|
412
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.dispersion,
|
413
|
+
getTarget: GetMaterial,
|
414
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).subSurface.dispersion = value),
|
415
415
|
},
|
416
416
|
},
|
417
417
|
KHR_materials_emissive_strength: {
|
418
418
|
emissiveStrength: {
|
419
419
|
type: "number",
|
420
|
-
get: (material, index, payload) =>
|
421
|
-
getTarget:
|
422
|
-
set: (value, material, index, payload) => (
|
420
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).emissiveIntensity,
|
421
|
+
getTarget: GetMaterial,
|
422
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).emissiveIntensity = value),
|
423
423
|
},
|
424
424
|
},
|
425
425
|
KHR_materials_ior: {
|
426
426
|
ior: {
|
427
427
|
type: "number",
|
428
|
-
get: (material, index, payload) =>
|
429
|
-
getTarget:
|
430
|
-
set: (value, material, index, payload) => (
|
428
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).indexOfRefraction,
|
429
|
+
getTarget: GetMaterial,
|
430
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).indexOfRefraction = value),
|
431
431
|
},
|
432
432
|
},
|
433
433
|
KHR_materials_iridescence: {
|
434
434
|
iridescenceFactor: {
|
435
435
|
type: "number",
|
436
|
-
get: (material, index, payload) =>
|
437
|
-
getTarget:
|
438
|
-
set: (value, material, index, payload) => (
|
436
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).iridescence.intensity,
|
437
|
+
getTarget: GetMaterial,
|
438
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).iridescence.intensity = value),
|
439
439
|
},
|
440
440
|
iridescenceIor: {
|
441
441
|
type: "number",
|
442
|
-
get: (material, index, payload) =>
|
443
|
-
getTarget:
|
444
|
-
set: (value, material, index, payload) => (
|
442
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).iridescence.indexOfRefraction,
|
443
|
+
getTarget: GetMaterial,
|
444
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).iridescence.indexOfRefraction = value),
|
445
445
|
},
|
446
446
|
iridescenceTexture: {
|
447
447
|
extensions: {
|
448
|
-
KHR_texture_transform:
|
448
|
+
KHR_texture_transform: GenerateTextureMap("iridescence", "texture"),
|
449
449
|
},
|
450
450
|
},
|
451
451
|
iridescenceThicknessMaximum: {
|
452
452
|
type: "number",
|
453
|
-
get: (material, index, payload) =>
|
454
|
-
getTarget:
|
455
|
-
set: (value, material, index, payload) => (
|
453
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).iridescence.maximumThickness,
|
454
|
+
getTarget: GetMaterial,
|
455
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).iridescence.maximumThickness = value),
|
456
456
|
},
|
457
457
|
iridescenceThicknessMinimum: {
|
458
458
|
type: "number",
|
459
|
-
get: (material, index, payload) =>
|
460
|
-
getTarget:
|
461
|
-
set: (value, material, index, payload) => (
|
459
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).iridescence.minimumThickness,
|
460
|
+
getTarget: GetMaterial,
|
461
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).iridescence.minimumThickness = value),
|
462
462
|
},
|
463
463
|
iridescenceThicknessTexture: {
|
464
464
|
extensions: {
|
465
|
-
KHR_texture_transform:
|
465
|
+
KHR_texture_transform: GenerateTextureMap("iridescence", "thicknessTexture"),
|
466
466
|
},
|
467
467
|
},
|
468
468
|
},
|
469
469
|
KHR_materials_sheen: {
|
470
470
|
sheenColorFactor: {
|
471
471
|
type: "Color3",
|
472
|
-
get: (material, index, payload) =>
|
473
|
-
getTarget:
|
474
|
-
set: (value, material, index, payload) =>
|
472
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).sheen.color,
|
473
|
+
getTarget: GetMaterial,
|
474
|
+
set: (value, material, index, payload) => GetMaterial(material, index, payload).sheen.color.copyFrom(value),
|
475
475
|
},
|
476
476
|
sheenColorTexture: {
|
477
477
|
extensions: {
|
478
|
-
KHR_texture_transform:
|
478
|
+
KHR_texture_transform: GenerateTextureMap("sheen", "texture"),
|
479
479
|
},
|
480
480
|
},
|
481
481
|
sheenRoughnessFactor: {
|
482
482
|
type: "number",
|
483
|
-
get: (material, index, payload) =>
|
484
|
-
getTarget:
|
485
|
-
set: (value, material, index, payload) => (
|
483
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).sheen.intensity,
|
484
|
+
getTarget: GetMaterial,
|
485
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).sheen.intensity = value),
|
486
486
|
},
|
487
487
|
sheenRoughnessTexture: {
|
488
488
|
extensions: {
|
489
|
-
KHR_texture_transform:
|
489
|
+
KHR_texture_transform: GenerateTextureMap("sheen", "thicknessTexture"),
|
490
490
|
},
|
491
491
|
},
|
492
492
|
},
|
493
493
|
KHR_materials_specular: {
|
494
494
|
specularFactor: {
|
495
495
|
type: "number",
|
496
|
-
get: (material, index, payload) =>
|
497
|
-
getTarget:
|
498
|
-
set: (value, material, index, payload) => (
|
496
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).metallicF0Factor,
|
497
|
+
getTarget: GetMaterial,
|
498
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).metallicF0Factor = value),
|
499
499
|
getPropertyName: [() => "metallicF0Factor"],
|
500
500
|
},
|
501
501
|
specularColorFactor: {
|
502
502
|
type: "Color3",
|
503
|
-
get: (material, index, payload) =>
|
504
|
-
getTarget:
|
505
|
-
set: (value, material, index, payload) =>
|
503
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).metallicReflectanceColor,
|
504
|
+
getTarget: GetMaterial,
|
505
|
+
set: (value, material, index, payload) => GetMaterial(material, index, payload).metallicReflectanceColor.copyFrom(value),
|
506
506
|
getPropertyName: [() => "metallicReflectanceColor"],
|
507
507
|
},
|
508
508
|
specularTexture: {
|
509
509
|
extensions: {
|
510
|
-
KHR_texture_transform:
|
510
|
+
KHR_texture_transform: GenerateTextureMap("metallicReflectanceTexture"),
|
511
511
|
},
|
512
512
|
},
|
513
513
|
specularColorTexture: {
|
514
514
|
extensions: {
|
515
|
-
KHR_texture_transform:
|
515
|
+
KHR_texture_transform: GenerateTextureMap("reflectanceTexture"),
|
516
516
|
},
|
517
517
|
},
|
518
518
|
},
|
519
519
|
KHR_materials_transmission: {
|
520
520
|
transmissionFactor: {
|
521
521
|
type: "number",
|
522
|
-
get: (material, index, payload) =>
|
523
|
-
getTarget:
|
524
|
-
set: (value, material, index, payload) => (
|
522
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.refractionIntensity,
|
523
|
+
getTarget: GetMaterial,
|
524
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).subSurface.refractionIntensity = value),
|
525
525
|
getPropertyName: [() => "subSurface.refractionIntensity"],
|
526
526
|
},
|
527
527
|
transmissionTexture: {
|
528
528
|
extensions: {
|
529
|
-
KHR_texture_transform:
|
529
|
+
KHR_texture_transform: GenerateTextureMap("subSurface", "refractionIntensityTexture"),
|
530
530
|
},
|
531
531
|
},
|
532
532
|
},
|
533
533
|
KHR_materials_diffuse_transmission: {
|
534
534
|
diffuseTransmissionFactor: {
|
535
535
|
type: "number",
|
536
|
-
get: (material, index, payload) =>
|
537
|
-
getTarget:
|
538
|
-
set: (value, material, index, payload) => (
|
536
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.translucencyIntensity,
|
537
|
+
getTarget: GetMaterial,
|
538
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).subSurface.translucencyIntensity = value),
|
539
539
|
},
|
540
540
|
diffuseTransmissionTexture: {
|
541
541
|
extensions: {
|
542
|
-
KHR_texture_transform:
|
542
|
+
KHR_texture_transform: GenerateTextureMap("subSurface", "translucencyIntensityTexture"),
|
543
543
|
},
|
544
544
|
},
|
545
545
|
diffuseTransmissionColorFactor: {
|
546
546
|
type: "Color3",
|
547
|
-
get: (material, index, payload) =>
|
548
|
-
getTarget:
|
549
|
-
set: (value, material, index, payload) => value &&
|
547
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.translucencyColor,
|
548
|
+
getTarget: GetMaterial,
|
549
|
+
set: (value, material, index, payload) => value && GetMaterial(material, index, payload).subSurface.translucencyColor?.copyFrom(value),
|
550
550
|
},
|
551
551
|
diffuseTransmissionColorTexture: {
|
552
552
|
extensions: {
|
553
|
-
KHR_texture_transform:
|
553
|
+
KHR_texture_transform: GenerateTextureMap("subSurface", "translucencyColorTexture"),
|
554
554
|
},
|
555
555
|
},
|
556
556
|
},
|
557
557
|
KHR_materials_volume: {
|
558
558
|
attenuationColor: {
|
559
559
|
type: "Color3",
|
560
|
-
get: (material, index, payload) =>
|
561
|
-
getTarget:
|
562
|
-
set: (value, material, index, payload) =>
|
560
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.tintColor,
|
561
|
+
getTarget: GetMaterial,
|
562
|
+
set: (value, material, index, payload) => GetMaterial(material, index, payload).subSurface.tintColor.copyFrom(value),
|
563
563
|
},
|
564
564
|
attenuationDistance: {
|
565
565
|
type: "number",
|
566
|
-
get: (material, index, payload) =>
|
567
|
-
getTarget:
|
568
|
-
set: (value, material, index, payload) => (
|
566
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.tintColorAtDistance,
|
567
|
+
getTarget: GetMaterial,
|
568
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).subSurface.tintColorAtDistance = value),
|
569
569
|
},
|
570
570
|
thicknessFactor: {
|
571
571
|
type: "number",
|
572
|
-
get: (material, index, payload) =>
|
573
|
-
getTarget:
|
574
|
-
set: (value, material, index, payload) => (
|
572
|
+
get: (material, index, payload) => GetMaterial(material, index, payload).subSurface.maximumThickness,
|
573
|
+
getTarget: GetMaterial,
|
574
|
+
set: (value, material, index, payload) => (GetMaterial(material, index, payload).subSurface.maximumThickness = value),
|
575
575
|
},
|
576
576
|
thicknessTexture: {
|
577
577
|
extensions: {
|
578
|
-
KHR_texture_transform:
|
578
|
+
KHR_texture_transform: GenerateTextureMap("subSurface", "thicknessTexture"),
|
579
579
|
},
|
580
580
|
},
|
581
581
|
},
|
@@ -657,8 +657,9 @@ const extensionsTree = {
|
|
657
657
|
type: "number",
|
658
658
|
get: (light) => light._babylonTexture?.level,
|
659
659
|
set: (value, light) => {
|
660
|
-
if (light._babylonTexture)
|
660
|
+
if (light._babylonTexture) {
|
661
661
|
light._babylonTexture.level = value;
|
662
|
+
}
|
662
663
|
},
|
663
664
|
getTarget: (light) => light._babylonTexture,
|
664
665
|
},
|
@@ -666,8 +667,9 @@ const extensionsTree = {
|
|
666
667
|
type: "Quaternion",
|
667
668
|
get: (light) => light._babylonTexture && Quaternion.FromRotationMatrix(light._babylonTexture?.getReflectionTextureMatrix()),
|
668
669
|
set: (value, light) => {
|
669
|
-
if (!light._babylonTexture)
|
670
|
+
if (!light._babylonTexture) {
|
670
671
|
return;
|
672
|
+
}
|
671
673
|
// Invert the rotation so that positive rotation is counter-clockwise.
|
672
674
|
if (!light._babylonTexture.getScene()?.useRightHandedSystem) {
|
673
675
|
value = Quaternion.Inverse(value);
|
@@ -680,26 +682,26 @@ const extensionsTree = {
|
|
680
682
|
},
|
681
683
|
},
|
682
684
|
};
|
683
|
-
function
|
684
|
-
const babylonMaterial =
|
685
|
+
function GetTexture(material, payload, textureType, textureInObject) {
|
686
|
+
const babylonMaterial = GetMaterial(material, payload);
|
685
687
|
return textureInObject ? babylonMaterial[textureType][textureInObject] : babylonMaterial[textureType];
|
686
688
|
}
|
687
|
-
function
|
689
|
+
function GetMaterial(material, _index, payload) {
|
688
690
|
return material._data?.[payload?.fillMode ?? Constants.MATERIAL_TriangleFillMode]?.babylonMaterial;
|
689
691
|
}
|
690
|
-
function
|
692
|
+
function GenerateTextureMap(textureType, textureInObject) {
|
691
693
|
return {
|
692
694
|
offset: {
|
693
695
|
componentsCount: 2,
|
694
696
|
// assuming two independent values for u and v, and NOT a Vector2
|
695
697
|
type: "Vector2",
|
696
698
|
get: (material, _index, payload) => {
|
697
|
-
const texture =
|
699
|
+
const texture = GetTexture(material, payload, textureType, textureInObject);
|
698
700
|
return new Vector2(texture?.uOffset, texture?.vOffset);
|
699
701
|
},
|
700
|
-
getTarget:
|
702
|
+
getTarget: GetMaterial,
|
701
703
|
set: (value, material, _index, payload) => {
|
702
|
-
const texture =
|
704
|
+
const texture = GetTexture(material, payload, textureType, textureInObject);
|
703
705
|
(texture.uOffset = value.x), (texture.vOffset = value.y);
|
704
706
|
},
|
705
707
|
getPropertyName: [
|
@@ -709,21 +711,21 @@ function _GenerateTextureMap(textureType, textureInObject) {
|
|
709
711
|
},
|
710
712
|
rotation: {
|
711
713
|
type: "number",
|
712
|
-
get: (material, _index, payload) =>
|
713
|
-
getTarget:
|
714
|
-
set: (value, material, _index, payload) => (
|
714
|
+
get: (material, _index, payload) => GetTexture(material, payload, textureType, textureInObject)?.wAng,
|
715
|
+
getTarget: GetMaterial,
|
716
|
+
set: (value, material, _index, payload) => (GetTexture(material, payload, textureType, textureInObject).wAng = value),
|
715
717
|
getPropertyName: [() => `${textureType}${textureInObject ? "." + textureInObject : ""}.wAng`],
|
716
718
|
},
|
717
719
|
scale: {
|
718
720
|
componentsCount: 2,
|
719
721
|
type: "Vector2",
|
720
722
|
get: (material, _index, payload) => {
|
721
|
-
const texture =
|
723
|
+
const texture = GetTexture(material, payload, textureType, textureInObject);
|
722
724
|
return new Vector2(texture?.uScale, texture?.vScale);
|
723
725
|
},
|
724
|
-
getTarget:
|
726
|
+
getTarget: GetMaterial,
|
725
727
|
set: (value, material, index, payload) => {
|
726
|
-
const texture =
|
728
|
+
const texture = GetTexture(material, payload, textureType, textureInObject);
|
727
729
|
(texture.uScale = value.x), (texture.vScale = value.y);
|
728
730
|
},
|
729
731
|
getPropertyName: [
|