@babylonjs/core 5.33.2 → 5.34.0

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.
Files changed (70) hide show
  1. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +4 -3
  2. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  3. package/Engines/thinEngine.js +2 -2
  4. package/Engines/thinEngine.js.map +1 -1
  5. package/Lights/Shadows/shadowGenerator.js +1 -0
  6. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  7. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +4 -0
  8. package/Materials/Node/Blocks/Dual/lightBlock.js +47 -3
  9. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  10. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +6 -0
  11. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +36 -8
  12. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  13. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +2 -0
  14. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +22 -0
  15. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  16. package/Materials/Node/Blocks/Fragment/fragDepthBlock.d.ts +31 -0
  17. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +67 -0
  18. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -0
  19. package/Materials/Node/Blocks/Fragment/index.d.ts +2 -0
  20. package/Materials/Node/Blocks/Fragment/index.js +2 -0
  21. package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
  22. package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +40 -0
  23. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js +111 -0
  24. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -0
  25. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +4 -0
  26. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +50 -3
  27. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  28. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +2 -0
  29. package/Materials/Node/Blocks/PBR/reflectionBlock.js +18 -1
  30. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  31. package/Materials/Node/Blocks/biPlanarBlock.d.ts +18 -0
  32. package/Materials/Node/Blocks/biPlanarBlock.js +70 -0
  33. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -0
  34. package/Materials/Node/Blocks/index.d.ts +2 -0
  35. package/Materials/Node/Blocks/index.js +2 -0
  36. package/Materials/Node/Blocks/index.js.map +1 -1
  37. package/Materials/Node/Blocks/triPlanarBlock.d.ts +116 -0
  38. package/Materials/Node/Blocks/triPlanarBlock.js +340 -0
  39. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -0
  40. package/Materials/Node/nodeMaterial.d.ts +4 -1
  41. package/Materials/Node/nodeMaterial.js +8 -0
  42. package/Materials/Node/nodeMaterial.js.map +1 -1
  43. package/Materials/Node/nodeMaterialBlock.d.ts +2 -0
  44. package/Materials/Node/nodeMaterialBlock.js +5 -0
  45. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  46. package/Materials/Node/nodeMaterialBuildState.d.ts +2 -0
  47. package/Materials/Node/nodeMaterialBuildState.js +3 -3
  48. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  49. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +2 -1
  50. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  51. package/Materials/Node/nodeMaterialDecorator.d.ts +4 -1
  52. package/Materials/Node/nodeMaterialDecorator.js.map +1 -1
  53. package/Materials/PBR/pbrBaseMaterial.d.ts +2 -0
  54. package/Materials/PBR/pbrBaseMaterial.js +11 -0
  55. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  56. package/Materials/Textures/videoTexture.js +8 -35
  57. package/Materials/Textures/videoTexture.js.map +1 -1
  58. package/Materials/materialHelper.d.ts +7 -0
  59. package/Materials/materialHelper.js +22 -1
  60. package/Materials/materialHelper.js.map +1 -1
  61. package/Materials/shadowDepthWrapper.d.ts +4 -0
  62. package/Materials/shadowDepthWrapper.js +46 -39
  63. package/Materials/shadowDepthWrapper.js.map +1 -1
  64. package/Materials/standardMaterial.d.ts +2 -0
  65. package/Materials/standardMaterial.js +2 -0
  66. package/Materials/standardMaterial.js.map +1 -1
  67. package/package.json +1 -1
  68. package/scene.d.ts +12 -8
  69. package/scene.js +32 -27
  70. package/scene.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/core",
3
- "version": "5.33.2",
3
+ "version": "5.34.0",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",
package/scene.d.ts CHANGED
@@ -1522,18 +1522,28 @@ export declare class Scene extends AbstractScene implements IAnimatable, IClipPl
1522
1522
  * @returns the animation group or null if none found.
1523
1523
  */
1524
1524
  getAnimationGroupByName(name: string): Nullable<AnimationGroup>;
1525
+ private _getMaterial;
1525
1526
  /**
1526
1527
  * Get a material using its unique id
1527
1528
  * @param uniqueId defines the material's unique id
1529
+ * @param allowMultiMaterials determines whether multimaterials should be considered
1528
1530
  * @returns the material or null if none found.
1529
1531
  */
1530
- getMaterialByUniqueID(uniqueId: number): Nullable<Material>;
1532
+ getMaterialByUniqueID(uniqueId: number, allowMultiMaterials?: boolean): Nullable<Material>;
1531
1533
  /**
1532
1534
  * get a material using its id
1533
1535
  * @param id defines the material's Id
1536
+ * @param allowMultiMaterials determines whether multimaterials should be considered
1534
1537
  * @returns the material or null if none found.
1535
1538
  */
1536
- getMaterialById(id: string): Nullable<Material>;
1539
+ getMaterialById(id: string, allowMultiMaterials?: boolean): Nullable<Material>;
1540
+ /**
1541
+ * Gets a material using its name
1542
+ * @param name defines the material's name
1543
+ * @param allowMultiMaterials determines whether multimaterials should be considered
1544
+ * @returns the material or null if none found.
1545
+ */
1546
+ getMaterialByName(name: string, allowMultiMaterials?: boolean): Nullable<Material>;
1537
1547
  /**
1538
1548
  * Gets a the last added material using a given id
1539
1549
  * @param id defines the material's Id
@@ -1541,12 +1551,6 @@ export declare class Scene extends AbstractScene implements IAnimatable, IClipPl
1541
1551
  * @returns the last material with the given id or null if none found.
1542
1552
  */
1543
1553
  getLastMaterialById(id: string, allowMultiMaterials?: boolean): Nullable<Material>;
1544
- /**
1545
- * Gets a material using its name
1546
- * @param name defines the material's name
1547
- * @returns the material or null if none found.
1548
- */
1549
- getMaterialByName(name: string): Nullable<Material>;
1550
1554
  /**
1551
1555
  * Get a texture using its unique id
1552
1556
  * @param uniqueId defines the texture's unique id
package/scene.js CHANGED
@@ -2292,31 +2292,49 @@ export class Scene extends AbstractScene {
2292
2292
  }
2293
2293
  return null;
2294
2294
  }
2295
+ _getMaterial(allowMultiMaterials, predicate) {
2296
+ for (let index = 0; index < this.materials.length; index++) {
2297
+ const material = this.materials[index];
2298
+ if (predicate(material)) {
2299
+ return material;
2300
+ }
2301
+ }
2302
+ if (allowMultiMaterials) {
2303
+ for (let index = 0; index < this.multiMaterials.length; index++) {
2304
+ const material = this.multiMaterials[index];
2305
+ if (predicate(material)) {
2306
+ return material;
2307
+ }
2308
+ }
2309
+ }
2310
+ return null;
2311
+ }
2295
2312
  /**
2296
2313
  * Get a material using its unique id
2297
2314
  * @param uniqueId defines the material's unique id
2315
+ * @param allowMultiMaterials determines whether multimaterials should be considered
2298
2316
  * @returns the material or null if none found.
2299
2317
  */
2300
- getMaterialByUniqueID(uniqueId) {
2301
- for (let index = 0; index < this.materials.length; index++) {
2302
- if (this.materials[index].uniqueId === uniqueId) {
2303
- return this.materials[index];
2304
- }
2305
- }
2306
- return null;
2318
+ getMaterialByUniqueID(uniqueId, allowMultiMaterials = false) {
2319
+ return this._getMaterial(allowMultiMaterials, (m) => m.uniqueId === uniqueId);
2307
2320
  }
2308
2321
  /**
2309
2322
  * get a material using its id
2310
2323
  * @param id defines the material's Id
2324
+ * @param allowMultiMaterials determines whether multimaterials should be considered
2311
2325
  * @returns the material or null if none found.
2312
2326
  */
2313
- getMaterialById(id) {
2314
- for (let index = 0; index < this.materials.length; index++) {
2315
- if (this.materials[index].id === id) {
2316
- return this.materials[index];
2317
- }
2318
- }
2319
- return null;
2327
+ getMaterialById(id, allowMultiMaterials = false) {
2328
+ return this._getMaterial(allowMultiMaterials, (m) => m.id === id);
2329
+ }
2330
+ /**
2331
+ * Gets a material using its name
2332
+ * @param name defines the material's name
2333
+ * @param allowMultiMaterials determines whether multimaterials should be considered
2334
+ * @returns the material or null if none found.
2335
+ */
2336
+ getMaterialByName(name, allowMultiMaterials = false) {
2337
+ return this._getMaterial(allowMultiMaterials, (m) => m.name === name);
2320
2338
  }
2321
2339
  /**
2322
2340
  * Gets a the last added material using a given id
@@ -2339,19 +2357,6 @@ export class Scene extends AbstractScene {
2339
2357
  }
2340
2358
  return null;
2341
2359
  }
2342
- /**
2343
- * Gets a material using its name
2344
- * @param name defines the material's name
2345
- * @returns the material or null if none found.
2346
- */
2347
- getMaterialByName(name) {
2348
- for (let index = 0; index < this.materials.length; index++) {
2349
- if (this.materials[index].name === name) {
2350
- return this.materials[index];
2351
- }
2352
- }
2353
- return null;
2354
- }
2355
2360
  /**
2356
2361
  * Get a texture using its unique id
2357
2362
  * @param uniqueId defines the texture's unique id