@babylonjs/core 6.29.1 → 6.29.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.
Files changed (127) hide show
  1. package/Debug/axesViewer.d.ts +3 -1
  2. package/Debug/axesViewer.js +14 -11
  3. package/Debug/axesViewer.js.map +1 -1
  4. package/Engines/Processors/shaderCodeInliner.js +1 -1
  5. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  6. package/Engines/WebGPU/Extensions/engine.computeShader.js +2 -10
  7. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  8. package/Engines/WebGPU/Extensions/engine.debugging.js +3 -6
  9. package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -1
  11. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  12. package/Engines/WebGPU/Extensions/engine.multiRender.js +1 -6
  13. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  14. package/Engines/WebGPU/Extensions/engine.query.js +2 -6
  15. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  16. package/Engines/WebGPU/Extensions/engine.renderTarget.js +6 -10
  17. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  18. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +1 -1
  19. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -2
  21. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  22. package/Engines/WebGPU/webgpuBundleList.js +2 -1
  23. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  24. package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -1
  25. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  26. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -1
  27. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -7
  28. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  29. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
  30. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +2 -2
  31. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  32. package/Engines/WebGPU/webgpuCacheSampler.d.ts +1 -1
  33. package/Engines/WebGPU/webgpuCacheSampler.js +5 -5
  34. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  35. package/Engines/WebGPU/webgpuClearQuad.js +2 -2
  36. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  37. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -12
  38. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  39. package/Engines/WebGPU/webgpuMaterialContext.d.ts +3 -3
  40. package/Engines/WebGPU/webgpuMaterialContext.js +14 -10
  41. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  42. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -12
  43. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  44. package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +5 -8
  45. package/Engines/WebGPU/webgpuSnapshotRendering.js +24 -33
  46. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  47. package/Engines/WebGPU/webgpuTextureHelper.d.ts +2 -1
  48. package/Engines/WebGPU/webgpuTextureHelper.js +11 -16
  49. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  50. package/Engines/constants.d.ts +2 -0
  51. package/Engines/constants.js +2 -0
  52. package/Engines/constants.js.map +1 -1
  53. package/Engines/engineCapabilities.d.ts +2 -0
  54. package/Engines/engineCapabilities.js.map +1 -1
  55. package/Engines/nativeEngine.js +1 -0
  56. package/Engines/nativeEngine.js.map +1 -1
  57. package/Engines/nullEngine.js +1 -0
  58. package/Engines/nullEngine.js.map +1 -1
  59. package/Engines/thinEngine.js +6 -2
  60. package/Engines/thinEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.d.ts +27 -32
  62. package/Engines/webgpuEngine.js +237 -317
  63. package/Engines/webgpuEngine.js.map +1 -1
  64. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +2 -2
  65. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -1
  66. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +4 -1
  67. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  68. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  69. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  70. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
  71. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  72. package/Materials/Textures/externalTexture.d.ts +4 -0
  73. package/Materials/Textures/externalTexture.js +4 -0
  74. package/Materials/Textures/externalTexture.js.map +1 -1
  75. package/Materials/Textures/internalTexture.d.ts +0 -4
  76. package/Materials/Textures/internalTexture.js.map +1 -1
  77. package/Materials/Textures/textureSampler.d.ts +4 -0
  78. package/Materials/Textures/textureSampler.js.map +1 -1
  79. package/Maths/math.path.d.ts +9 -1
  80. package/Maths/math.path.js +17 -1
  81. package/Maths/math.path.js.map +1 -1
  82. package/Maths/math.vector.d.ts +93 -0
  83. package/Maths/math.vector.js +155 -24
  84. package/Maths/math.vector.js.map +1 -1
  85. package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -0
  86. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  87. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -0
  88. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  89. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -0
  90. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  91. package/Meshes/Node/Blocks/Sources/discBlock.js +1 -0
  92. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  93. package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -0
  94. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  95. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -0
  96. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  97. package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -0
  98. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  99. package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -0
  100. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  101. package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -0
  102. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  103. package/Meshes/Node/nodeGeometryBlock.js +1 -0
  104. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  105. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +14 -0
  106. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +30 -3
  107. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  108. package/Meshes/mesh.js +5 -1
  109. package/Meshes/mesh.js.map +1 -1
  110. package/Misc/codeStringParsingTools.d.ts +2 -1
  111. package/Misc/codeStringParsingTools.js +3 -2
  112. package/Misc/codeStringParsingTools.js.map +1 -1
  113. package/Misc/greasedLineTools.d.ts +2 -1
  114. package/Misc/greasedLineTools.js +2 -0
  115. package/Misc/greasedLineTools.js.map +1 -1
  116. package/Physics/v2/Plugins/havokPlugin.js +3 -1
  117. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  118. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +2 -1
  119. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
  120. package/Rendering/prePassRenderer.js +8 -4
  121. package/Rendering/prePassRenderer.js.map +1 -1
  122. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -1
  123. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  124. package/package.json +1 -1
  125. package/Engines/WebGPU/webgpuRenderPassWrapper.d.ts +0 -13
  126. package/Engines/WebGPU/webgpuRenderPassWrapper.js +0 -18
  127. package/Engines/WebGPU/webgpuRenderPassWrapper.js.map +0 -1
@@ -412,8 +412,40 @@ export class Vector2 {
412
412
  * @returns the current updated Vector2
413
413
  */
414
414
  normalize() {
415
- Vector2.NormalizeToRef(this, this);
416
- return this;
415
+ return this.normalizeFromLength(this.length());
416
+ }
417
+ /**
418
+ * Normalize the current Vector2 with the given input length.
419
+ * Please note that this is an in place operation.
420
+ * @param len the length of the vector
421
+ * @returns the current updated Vector2
422
+ */
423
+ normalizeFromLength(len) {
424
+ if (len === 0 || len === 1.0) {
425
+ return this;
426
+ }
427
+ return this.scaleInPlace(1.0 / len);
428
+ }
429
+ /**
430
+ * Normalize the current Vector2 to a new vector
431
+ * @returns the new Vector2
432
+ */
433
+ normalizeToNew() {
434
+ const normalized = new this.constructor(0, 0);
435
+ this.normalizeToRef(normalized);
436
+ return normalized;
437
+ }
438
+ /**
439
+ * Normalize the current Vector2 to the reference
440
+ * @param reference define the Vector2 to update
441
+ * @returns the updated Vector2
442
+ */
443
+ normalizeToRef(reference) {
444
+ const len = this.length();
445
+ if (len === 0 || len === 1.0) {
446
+ return reference.copyFromFloats(this.x, this.y);
447
+ }
448
+ return this.scaleToRef(1.0 / len, reference);
417
449
  }
418
450
  /**
419
451
  * Gets a new Vector2 copied from the Vector2
@@ -423,6 +455,14 @@ export class Vector2 {
423
455
  clone() {
424
456
  return new this.constructor(this.x, this.y);
425
457
  }
458
+ /**
459
+ * Gets the dot product of the current vector and the vector "otherVector"
460
+ * @param otherVector defines second vector
461
+ * @returns the dot product (float)
462
+ */
463
+ dot(otherVector) {
464
+ return this.x * otherVector.x + this.y * otherVector.y;
465
+ }
426
466
  // Statics
427
467
  /**
428
468
  * Gets a new Vector2(0, 0)
@@ -603,9 +643,9 @@ export class Vector2 {
603
643
  * @returns a new Vector2
604
644
  */
605
645
  static Normalize(vector) {
606
- const newVector = new vector.constructor();
607
- this.NormalizeToRef(vector, newVector);
608
- return newVector;
646
+ const result = new vector.constructor();
647
+ Vector2.NormalizeToRef(vector, result);
648
+ return result;
609
649
  }
610
650
  /**
611
651
  * Normalize a given vector into a second one
@@ -615,12 +655,7 @@ export class Vector2 {
615
655
  * @returns result input
616
656
  */
617
657
  static NormalizeToRef(vector, result) {
618
- const len = vector.length();
619
- if (len === 0) {
620
- return result;
621
- }
622
- result.x = vector.x / len;
623
- result.y = vector.y / len;
658
+ vector.normalizeToRef(result);
624
659
  return result;
625
660
  }
626
661
  /**
@@ -2149,6 +2184,14 @@ export class Vector3 {
2149
2184
  static Dot(left, right) {
2150
2185
  return left._x * right._x + left._y * right._y + left._z * right._z;
2151
2186
  }
2187
+ /**
2188
+ * Returns the dot product (float) between the current vectors and "otherVector"
2189
+ * @param otherVector defines the right operand
2190
+ * @returns the dot product
2191
+ */
2192
+ dot(otherVector) {
2193
+ return this._x * otherVector._x + this._y * otherVector._y + this._z * otherVector._z;
2194
+ }
2152
2195
  /**
2153
2196
  * Returns a new Vector3 as the cross product of the vectors "left" and "right"
2154
2197
  * The cross product is then orthogonal to both "left" and "right"
@@ -3038,12 +3081,41 @@ export class Vector4 {
3038
3081
  * @returns the updated Vector4.
3039
3082
  */
3040
3083
  normalize() {
3041
- const len = this.length();
3042
- if (len === 0) {
3084
+ return this.normalizeFromLength(this.length());
3085
+ }
3086
+ /**
3087
+ * Normalize the current Vector4 with the given input length.
3088
+ * Please note that this is an in place operation.
3089
+ * @param len the length of the vector
3090
+ * @returns the current updated Vector4
3091
+ */
3092
+ normalizeFromLength(len) {
3093
+ if (len === 0 || len === 1.0) {
3043
3094
  return this;
3044
3095
  }
3045
3096
  return this.scaleInPlace(1.0 / len);
3046
3097
  }
3098
+ /**
3099
+ * Normalize the current Vector4 to a new vector
3100
+ * @returns the new Vector4
3101
+ */
3102
+ normalizeToNew() {
3103
+ const normalized = new this.constructor(0, 0, 0, 0);
3104
+ this.normalizeToRef(normalized);
3105
+ return normalized;
3106
+ }
3107
+ /**
3108
+ * Normalize the current Vector4 to the reference
3109
+ * @param reference define the Vector4 to update
3110
+ * @returns the updated Vector4
3111
+ */
3112
+ normalizeToRef(reference) {
3113
+ const len = this.length();
3114
+ if (len === 0 || len === 1.0) {
3115
+ return reference.copyFromFloats(this.x, this.y, this.z, this.w);
3116
+ }
3117
+ return this.scaleToRef(1.0 / len, reference);
3118
+ }
3047
3119
  /**
3048
3120
  * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
3049
3121
  * @returns this converted to a new vector3
@@ -3105,6 +3177,14 @@ export class Vector4 {
3105
3177
  this.x = this.y = this.z = this.w = v;
3106
3178
  return this;
3107
3179
  }
3180
+ /**
3181
+ * Returns the dot product (float) between the current vectors and "otherVector"
3182
+ * @param otherVector defines the right operand
3183
+ * @returns the dot product
3184
+ */
3185
+ dot(otherVector) {
3186
+ return this.x * otherVector.x + this.y * otherVector.y + this.z * otherVector.z + this.w * otherVector.w;
3187
+ }
3108
3188
  // Statics
3109
3189
  /**
3110
3190
  * Returns a new Vector4 set from the starting index of the given array.
@@ -3205,8 +3285,7 @@ export class Vector4 {
3205
3285
  * @returns result input
3206
3286
  */
3207
3287
  static NormalizeToRef(vector, result) {
3208
- result.copyFrom(vector);
3209
- result.normalize();
3288
+ vector.normalizeToRef(result);
3210
3289
  return result;
3211
3290
  }
3212
3291
  /**
@@ -3382,6 +3461,15 @@ export class Vector4 {
3382
3461
  static FromVector3(source, w = 0) {
3383
3462
  return new Vector4(source._x, source._y, source._z, w);
3384
3463
  }
3464
+ /**
3465
+ * Returns the dot product (float) between the vectors "left" and "right"
3466
+ * @param left defines the left operand
3467
+ * @param right defines the right operand
3468
+ * @returns the dot product
3469
+ */
3470
+ static Dot(left, right) {
3471
+ return left.dot(right);
3472
+ }
3385
3473
  }
3386
3474
  Vector4._ZeroReadOnly = Vector4.Zero();
3387
3475
  /**
@@ -3778,13 +3866,19 @@ export class Quaternion {
3778
3866
  * @returns the current updated quaternion
3779
3867
  */
3780
3868
  normalize() {
3781
- const len = this.length();
3782
- if (len === 0) {
3869
+ return this.normalizeFromLength(this.length());
3870
+ }
3871
+ /**
3872
+ * Normalize the current quaternion with the given input length.
3873
+ * Please note that this is an in place operation.
3874
+ * @param len the length of the quaternion
3875
+ * @returns the current updated Quaternion
3876
+ */
3877
+ normalizeFromLength(len) {
3878
+ if (len === 0 || len === 1.0) {
3783
3879
  return this;
3784
3880
  }
3785
- const inv = 1.0 / len;
3786
- this.scaleInPlace(inv);
3787
- return this;
3881
+ return this.scaleInPlace(1.0 / len);
3788
3882
  }
3789
3883
  /**
3790
3884
  * Normalize a copy of the current quaternion
@@ -3792,12 +3886,21 @@ export class Quaternion {
3792
3886
  * @returns the normalized quaternion
3793
3887
  */
3794
3888
  normalizeToNew() {
3889
+ const normalized = new this.constructor(0, 0, 0, 1);
3890
+ this.normalizeToRef(normalized);
3891
+ return normalized;
3892
+ }
3893
+ /**
3894
+ * Normalize the current Quaternion to the reference
3895
+ * @param reference define the Quaternion to update
3896
+ * @returns the updated Quaternion
3897
+ */
3898
+ normalizeToRef(reference) {
3795
3899
  const len = this.length();
3796
- if (len === 0) {
3797
- return this.clone();
3900
+ if (len === 0 || len === 1.0) {
3901
+ return reference.copyFromFloats(this._x, this._y, this._z, this._w);
3798
3902
  }
3799
- const inv = 1.0 / len;
3800
- return this.scale(inv);
3903
+ return this.scaleToRef(1.0 / len, reference);
3801
3904
  }
3802
3905
  /**
3803
3906
  * Returns a new Vector3 set with the Euler angles translated from the current quaternion
@@ -3868,6 +3971,14 @@ export class Quaternion {
3868
3971
  Quaternion.FromRotationMatrixToRef(matrix, this);
3869
3972
  return this;
3870
3973
  }
3974
+ /**
3975
+ * Returns the dot product (float) between the current quaternions and "other"
3976
+ * @param other defines the right operand
3977
+ * @returns the dot product
3978
+ */
3979
+ dot(other) {
3980
+ return this._x * other._x + this._y * other._y + this._z * other._z + this._w * other._w;
3981
+ }
3871
3982
  // Statics
3872
3983
  /**
3873
3984
  * Creates a new quaternion from a rotation matrix
@@ -4401,6 +4512,26 @@ export class Quaternion {
4401
4512
  result._isDirty = true;
4402
4513
  return result;
4403
4514
  }
4515
+ /**
4516
+ * Returns a new Quaternion as the normalization of the given Quaternion
4517
+ * @param quat defines the Quaternion to normalize
4518
+ * @returns the new Quaternion
4519
+ */
4520
+ static Normalize(quat) {
4521
+ const result = Quaternion.Zero();
4522
+ Quaternion.NormalizeToRef(quat, result);
4523
+ return result;
4524
+ }
4525
+ /**
4526
+ * Sets the given Quaternion "result" with the normalization of the given first Quaternion
4527
+ * @param quat defines the Quaternion to normalize
4528
+ * @param result defines the Quaternion where to store the result
4529
+ * @returns result input
4530
+ */
4531
+ static NormalizeToRef(quat, result) {
4532
+ quat.normalizeToRef(result);
4533
+ return result;
4534
+ }
4404
4535
  }
4405
4536
  /**
4406
4537
  * Class used to store matrix data (4x4)