@babylonjs/core 5.25.0 → 5.26.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/Audio/audioEngine.js +1 -2
- package/Audio/audioEngine.js.map +1 -1
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.d.ts +4 -1
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +17 -4
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +1 -24
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +1 -5
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +0 -18
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +3 -2
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/engine.js +3 -34
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.js +2 -14
- package/Engines/thinEngine.js.map +1 -1
- package/Gamepads/gamepadManager.js +2 -2
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Layers/layer.d.ts +7 -0
- package/Layers/layer.js +11 -0
- package/Layers/layer.js.map +1 -1
- package/Layers/layerSceneComponent.d.ts +4 -2
- package/Layers/layerSceneComponent.js +27 -11
- package/Layers/layerSceneComponent.js.map +1 -1
- package/Loading/loadingScreen.js +6 -6
- package/Loading/loadingScreen.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +1 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +3 -0
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +2 -2
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/material.js +5 -2
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.js +1 -6
- package/Materials/materialHelper.js.map +1 -1
- package/Maths/math.vector.d.ts +47 -10
- package/Maths/math.vector.js +89 -10
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/instancedMesh.js +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +1 -1
- package/Meshes/mesh.js +4 -6
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +2 -0
- package/Meshes/subMesh.js +2 -0
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/tools.d.ts +9 -0
- package/Misc/tools.js +14 -5
- package/Misc/tools.js.map +1 -1
- package/Misc/virtualJoystick.js +0 -1
- package/Misc/virtualJoystick.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +6 -0
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +8 -0
- package/Particles/baseParticleSystem.js +12 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -1
- package/Particles/gpuParticleSystem.js +12 -2
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +1 -1
- package/Particles/particleSystem.js +17 -2
- package/Particles/particleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/Rendering/renderingManager.d.ts +11 -0
- package/Rendering/renderingManager.js +55 -9
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/vertexColorMixing.js +1 -1
- package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -1
- package/Shaders/color.fragment.js +3 -2
- package/Shaders/color.fragment.js.map +1 -1
- package/Shaders/color.vertex.js +1 -1
- package/Shaders/color.vertex.js.map +1 -1
- package/Shaders/default.fragment.js +3 -3
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/default.vertex.js +1 -1
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/gpuRenderParticles.fragment.d.ts +2 -0
- package/Shaders/gpuRenderParticles.fragment.js +8 -1
- package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.d.ts +2 -0
- package/Shaders/gpuRenderParticles.vertex.js +4 -0
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/particles.fragment.d.ts +2 -0
- package/Shaders/particles.fragment.js +8 -1
- package/Shaders/particles.fragment.js.map +1 -1
- package/Shaders/particles.vertex.d.ts +2 -0
- package/Shaders/particles.vertex.js +4 -0
- package/Shaders/particles.vertex.js.map +1 -1
- package/Shaders/pbr.vertex.js +1 -1
- package/Shaders/pbr.vertex.js.map +1 -1
- package/Sprites/spriteManager.d.ts +4 -0
- package/Sprites/spriteManager.js +2 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +14 -0
- package/scene.js +37 -12
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +2 -0
- package/sceneComponent.js +2 -0
- package/sceneComponent.js.map +1 -1
package/Maths/math.vector.js
CHANGED
|
@@ -262,7 +262,7 @@ export class Vector2 {
|
|
|
262
262
|
/**
|
|
263
263
|
* Negate the current Vector2 and stores the result in the given vector "result" coordinates
|
|
264
264
|
* @param result defines the Vector3 object where to store the result
|
|
265
|
-
* @returns the
|
|
265
|
+
* @returns the result
|
|
266
266
|
*/
|
|
267
267
|
negateToRef(result) {
|
|
268
268
|
return result.copyFromFloats(this.x * -1, this.y * -1);
|
|
@@ -832,7 +832,7 @@ export class Vector3 {
|
|
|
832
832
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#6
|
|
833
833
|
* @param otherVector defines the second operand
|
|
834
834
|
* @param result defines the Vector3 object where to store the result
|
|
835
|
-
* @returns the
|
|
835
|
+
* @returns the result
|
|
836
836
|
*/
|
|
837
837
|
addToRef(otherVector, result) {
|
|
838
838
|
return result.copyFromFloats(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);
|
|
@@ -863,7 +863,7 @@ export class Vector3 {
|
|
|
863
863
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#63
|
|
864
864
|
* @param otherVector defines the second operand
|
|
865
865
|
* @param result defines the Vector3 object where to store the result
|
|
866
|
-
* @returns the
|
|
866
|
+
* @returns the result
|
|
867
867
|
*/
|
|
868
868
|
subtractToRef(otherVector, result) {
|
|
869
869
|
return this.subtractFromFloatsToRef(otherVector._x, otherVector._y, otherVector._z, result);
|
|
@@ -886,7 +886,7 @@ export class Vector3 {
|
|
|
886
886
|
* @param y defines the y coordinate of the operand
|
|
887
887
|
* @param z defines the z coordinate of the operand
|
|
888
888
|
* @param result defines the Vector3 object where to store the result
|
|
889
|
-
* @returns the
|
|
889
|
+
* @returns the result
|
|
890
890
|
*/
|
|
891
891
|
subtractFromFloatsToRef(x, y, z, result) {
|
|
892
892
|
return result.copyFromFloats(this._x - x, this._y - y, this._z - z);
|
|
@@ -914,7 +914,7 @@ export class Vector3 {
|
|
|
914
914
|
* Negate the current Vector3 and stores the result in the given vector "result" coordinates
|
|
915
915
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#37
|
|
916
916
|
* @param result defines the Vector3 object where to store the result
|
|
917
|
-
* @returns the
|
|
917
|
+
* @returns the result
|
|
918
918
|
*/
|
|
919
919
|
negateToRef(result) {
|
|
920
920
|
return result.copyFromFloats(this._x * -1, this._y * -1, this._z * -1);
|
|
@@ -945,17 +945,45 @@ export class Vector3 {
|
|
|
945
945
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#57
|
|
946
946
|
* @param scale defines the multiplier factor
|
|
947
947
|
* @param result defines the Vector3 object where to store the result
|
|
948
|
-
* @returns the
|
|
948
|
+
* @returns the result
|
|
949
949
|
*/
|
|
950
950
|
scaleToRef(scale, result) {
|
|
951
951
|
return result.copyFromFloats(this._x * scale, this._y * scale, this._z * scale);
|
|
952
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Creates a vector normal (perpendicular) to the current Vector3 and stores the result in the given vector
|
|
955
|
+
* @param result defines the Vector3 object where to store the resultant normal
|
|
956
|
+
* returns the result
|
|
957
|
+
* @hidden
|
|
958
|
+
*/
|
|
959
|
+
_getNormalToRef(result) {
|
|
960
|
+
/**
|
|
961
|
+
* Calculates the spherical coordinates of the current vector
|
|
962
|
+
* so saves on memory rather than importing whole Spherical Class
|
|
963
|
+
*/
|
|
964
|
+
const radius = this.length();
|
|
965
|
+
let theta = Math.acos(this.y / radius);
|
|
966
|
+
const phi = Math.atan2(this.z, this.x);
|
|
967
|
+
//makes angle 90 degs to current vector
|
|
968
|
+
if (theta > Math.PI / 2) {
|
|
969
|
+
theta -= Math.PI / 2;
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
theta += Math.PI / 2;
|
|
973
|
+
}
|
|
974
|
+
//Calculates resutant normal vector from spherical coordinate of perpendicular vector
|
|
975
|
+
const x = radius * Math.sin(theta) * Math.cos(phi);
|
|
976
|
+
const y = radius * Math.cos(theta);
|
|
977
|
+
const z = radius * Math.sin(theta) * Math.sin(phi);
|
|
978
|
+
result.set(x, y, z);
|
|
979
|
+
return result;
|
|
980
|
+
}
|
|
953
981
|
/**
|
|
954
982
|
* Rotates the vector using the given unit quaternion and stores the new vector in result
|
|
955
983
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#9
|
|
956
984
|
* @param q the unit quaternion representing the rotation
|
|
957
985
|
* @param result the output vector
|
|
958
|
-
* @returns the
|
|
986
|
+
* @returns the result
|
|
959
987
|
*/
|
|
960
988
|
applyRotationQuaternionToRef(q, result) {
|
|
961
989
|
const ix = q.w * this.x + q.y * this.z - q.z * this.y;
|
|
@@ -1092,7 +1120,7 @@ export class Vector3 {
|
|
|
1092
1120
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#33
|
|
1093
1121
|
* @param otherVector defines the second operand
|
|
1094
1122
|
* @param result defines the Vector3 object where to store the result
|
|
1095
|
-
* @returns the
|
|
1123
|
+
* @returns the result
|
|
1096
1124
|
*/
|
|
1097
1125
|
multiplyToRef(otherVector, result) {
|
|
1098
1126
|
return result.copyFromFloats(this._x * otherVector._x, this._y * otherVector._y, this._z * otherVector._z);
|
|
@@ -1122,7 +1150,7 @@ export class Vector3 {
|
|
|
1122
1150
|
* Example Playground https://playground.babylonjs.com/#R1F8YU#18
|
|
1123
1151
|
* @param otherVector defines the second operand
|
|
1124
1152
|
* @param result defines the Vector3 object where to store the result
|
|
1125
|
-
* @returns the
|
|
1153
|
+
* @returns the result
|
|
1126
1154
|
*/
|
|
1127
1155
|
divideToRef(otherVector, result) {
|
|
1128
1156
|
return result.copyFromFloats(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);
|
|
@@ -1484,6 +1512,31 @@ export class Vector3 {
|
|
|
1484
1512
|
const angle = Math.atan2(Vector3.Dot(v1, right), Vector3.Dot(v1, forward));
|
|
1485
1513
|
return Scalar.NormalizeRadians(angle);
|
|
1486
1514
|
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point and stores it in the ref Vector3
|
|
1517
|
+
* @param start the starting point
|
|
1518
|
+
* @param target the target point
|
|
1519
|
+
* @param ref the vector3 to store the result
|
|
1520
|
+
* @returns ref in the form (pitch, yaw, 0)
|
|
1521
|
+
*/
|
|
1522
|
+
static PitchYawRollToMoveBetweenPointsToRef(start, target, ref) {
|
|
1523
|
+
const diff = TmpVectors.Vector3[0];
|
|
1524
|
+
target.subtractToRef(start, diff);
|
|
1525
|
+
ref.y = Math.atan2(diff.x, diff.z) || 0;
|
|
1526
|
+
ref.x = Math.atan2(Math.sqrt(diff.x ** 2 + diff.z ** 2), diff.y) || 0;
|
|
1527
|
+
ref.z = 0;
|
|
1528
|
+
return ref;
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point
|
|
1532
|
+
* @param start the starting point
|
|
1533
|
+
* @param target the target point
|
|
1534
|
+
* @returns the rotation in the form (pitch, yaw, 0)
|
|
1535
|
+
*/
|
|
1536
|
+
static PitchYawRollToMoveBetweenPoints(start, target) {
|
|
1537
|
+
const ref = Vector3.Zero();
|
|
1538
|
+
return Vector3.PitchYawRollToMoveBetweenPointsToRef(start, target, ref);
|
|
1539
|
+
}
|
|
1487
1540
|
/**
|
|
1488
1541
|
* Slerp between two vectors. See also `SmoothToRef`
|
|
1489
1542
|
* Slerp is a spherical linear interpolation
|
|
@@ -2566,7 +2619,7 @@ export class Vector4 {
|
|
|
2566
2619
|
/**
|
|
2567
2620
|
* Negate the current Vector4 and stores the result in the given vector "result" coordinates
|
|
2568
2621
|
* @param result defines the Vector3 object where to store the result
|
|
2569
|
-
* @returns the
|
|
2622
|
+
* @returns the result
|
|
2570
2623
|
*/
|
|
2571
2624
|
negateToRef(result) {
|
|
2572
2625
|
return result.copyFromFloats(this.x * -1, this.y * -1, this.z * -1, this.w * -1);
|
|
@@ -3608,6 +3661,32 @@ export class Quaternion {
|
|
|
3608
3661
|
result.z = 0.25 * s;
|
|
3609
3662
|
}
|
|
3610
3663
|
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Creates the rotation quaternion needed to rotate from one Vector3 onto another Vector3
|
|
3666
|
+
* @param fromVector the starting vector
|
|
3667
|
+
* @param toVector the ending vector
|
|
3668
|
+
* @returns the rotation quaternion needed
|
|
3669
|
+
*/
|
|
3670
|
+
static RotationQuaternionFromOnto(fromVector, toVector) {
|
|
3671
|
+
const ref = Quaternion.Zero();
|
|
3672
|
+
return Quaternion.RotationQuaternionFromOntoToRef(fromVector, toVector, ref);
|
|
3673
|
+
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Creates the rotation quaternion needed to rotate from one Vector3 onto another Vector3 and stores in a result Quaternion
|
|
3676
|
+
* @param fromVector the starting vector
|
|
3677
|
+
* @param toVector the ending vector
|
|
3678
|
+
* @param result the rotation quaternion needed
|
|
3679
|
+
* @returns the result
|
|
3680
|
+
*/
|
|
3681
|
+
static RotationQuaternionFromOntoToRef(fromVector, toVector, result) {
|
|
3682
|
+
const normal = TmpVectors.Vector3[0];
|
|
3683
|
+
Vector3.CrossToRef(fromVector, toVector, normal);
|
|
3684
|
+
if (normal.equals(Vector3.ZeroReadOnly)) {
|
|
3685
|
+
fromVector._getNormalToRef(normal);
|
|
3686
|
+
}
|
|
3687
|
+
const angle = Vector3.GetAngleBetweenVectors(fromVector, toVector, normal);
|
|
3688
|
+
return Quaternion.RotationAxisToRef(normal, angle, result);
|
|
3689
|
+
}
|
|
3611
3690
|
/**
|
|
3612
3691
|
* Returns the dot product (float) between the quaternions "left" and "right"
|
|
3613
3692
|
* @param left defines the left operand
|