@babylonjs/core 8.8.5 → 8.9.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/Animations/animatable.core.js +2 -2
- package/Animations/animatable.core.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +0 -7
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundSource.d.ts +6 -3
- package/AudioV2/abstractAudio/abstractSoundSource.js +1 -2
- package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +4 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.js +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/targetCamera.d.ts +0 -4
- package/Cameras/targetCamera.js +0 -28
- package/Cameras/targetCamera.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +3 -0
- package/Collisions/gpuPicker.js +26 -2
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +22 -15
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.d.ts +1 -0
- package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js +8 -0
- package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +5 -2
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +5 -0
- package/Engines/constants.js +5 -0
- package/Engines/constants.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js +1 -1
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.d.ts +2 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +5 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +26 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +13 -0
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +7 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +17 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +2 -0
- package/FrameGraph/frameGraph.js +2 -0
- package/FrameGraph/frameGraph.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +1 -1
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Helpers/environmentHelper.js +3 -3
- package/Helpers/environmentHelper.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +4 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.d.ts +30 -0
- package/Materials/PBR/pbrBRDFConfiguration.js +45 -0
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +0 -10
- package/Materials/PBR/pbrBaseMaterial.js +0 -13
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +0 -16
- package/Materials/PBR/pbrMaterial.decalMap.js +0 -5
- package/Materials/PBR/pbrMaterial.decalMap.js.map +1 -1
- package/Materials/PBR/pbrMaterial.js +1 -30
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +4 -4
- package/Materials/Textures/renderTargetTexture.js +3 -1
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/effectRenderer.d.ts +1 -0
- package/Materials/effectRenderer.js +3 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +7 -8
- package/Materials/shaderMaterial.js +21 -15
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.decalMap.js +0 -5
- package/Materials/standardMaterial.decalMap.js.map +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/ThinMaths/thinMath.matrix.functions.d.ts +11 -11
- package/Maths/ThinMaths/thinMath.matrix.functions.js.map +1 -1
- package/Maths/math.like.d.ts +2 -2
- package/Maths/math.like.js.map +1 -1
- package/Maths/math.vector.d.ts +23 -17
- package/Maths/math.vector.js +144 -115
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +1 -1
- package/Meshes/Node/nodeGeometry.js +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/instancedMesh.js +12 -2
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -2
- package/Meshes/mesh.js.map +1 -1
- package/Misc/minMaxReducer.js +5 -0
- package/Misc/minMaxReducer.js.map +1 -1
- package/Offline/database.d.ts +1 -1
- package/Offline/database.js +5 -5
- package/Offline/database.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +1 -1
- package/Rendering/depthPeelingRenderer.js +1 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.d.ts +1 -1
- package/Rendering/edgesRenderer.js +2 -2
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +2 -2
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/prePassEffectConfiguration.d.ts +5 -0
- package/Rendering/prePassEffectConfiguration.js.map +1 -1
- package/Rendering/prePassRenderer.js +3 -0
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.d.ts +6 -1
- package/Rendering/subSurfaceConfiguration.js +6 -1
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +15 -14
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +3 -0
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflectivity.js +2 -2
- package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +4 -4
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +6 -2
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/pbr.fragment.js +6 -2
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.d.ts +1 -0
- package/Shaders/pbr.vertex.js +12 -4
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +2 -2
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +7 -2
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +2 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.d.ts +1 -0
- package/ShadersWGSL/pbr.vertex.js +5 -2
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/assetContainer.js +13 -13
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +4 -0
- package/scene.js +21 -15
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js.map +1 -1
package/Maths/math.vector.js
CHANGED
|
@@ -1258,8 +1258,8 @@ export class Vector3 {
|
|
|
1258
1258
|
* so saves on memory rather than importing whole Spherical Class
|
|
1259
1259
|
*/
|
|
1260
1260
|
const radius = this.length();
|
|
1261
|
-
let theta = Math.acos(this.
|
|
1262
|
-
const phi = Math.atan2(this.
|
|
1261
|
+
let theta = Math.acos(this._y / radius);
|
|
1262
|
+
const phi = Math.atan2(this._z, this._x);
|
|
1263
1263
|
//makes angle 90 degs to current vector
|
|
1264
1264
|
if (theta > Math.PI / 2) {
|
|
1265
1265
|
theta -= Math.PI / 2;
|
|
@@ -1591,7 +1591,7 @@ export class Vector3 {
|
|
|
1591
1591
|
* @returns a new Vector3
|
|
1592
1592
|
*/
|
|
1593
1593
|
floor() {
|
|
1594
|
-
return new Vector3(Math.floor(this.
|
|
1594
|
+
return new Vector3(Math.floor(this._x), Math.floor(this._y), Math.floor(this._z));
|
|
1595
1595
|
}
|
|
1596
1596
|
/**
|
|
1597
1597
|
* Gets the current Vector3's fractional values and stores them in result
|
|
@@ -1599,9 +1599,9 @@ export class Vector3 {
|
|
|
1599
1599
|
* @returns the result vector
|
|
1600
1600
|
*/
|
|
1601
1601
|
fractToRef(result) {
|
|
1602
|
-
result._x = this.
|
|
1603
|
-
result._y = this.
|
|
1604
|
-
result._z = this.
|
|
1602
|
+
result._x = this._x - Math.floor(this._x);
|
|
1603
|
+
result._y = this._y - Math.floor(this._y);
|
|
1604
|
+
result._z = this._z - Math.floor(this._z);
|
|
1605
1605
|
result._isDirty = true;
|
|
1606
1606
|
return result;
|
|
1607
1607
|
}
|
|
@@ -1611,7 +1611,7 @@ export class Vector3 {
|
|
|
1611
1611
|
* @returns a new Vector3
|
|
1612
1612
|
*/
|
|
1613
1613
|
fract() {
|
|
1614
|
-
return new Vector3(this.
|
|
1614
|
+
return new Vector3(this._x - Math.floor(this._x), this._y - Math.floor(this._y), this._z - Math.floor(this._z));
|
|
1615
1615
|
}
|
|
1616
1616
|
// Properties
|
|
1617
1617
|
/**
|
|
@@ -2887,6 +2887,41 @@ Object.defineProperties(Vector3.prototype, {
|
|
|
2887
2887
|
* Vector4 class created for EulerAngle class conversion to Quaternion
|
|
2888
2888
|
*/
|
|
2889
2889
|
export class Vector4 {
|
|
2890
|
+
// ---------------------------------
|
|
2891
|
+
// Getters / setters (same pattern as Vector3)
|
|
2892
|
+
// ---------------------------------
|
|
2893
|
+
/** Gets or sets the x coordinate */
|
|
2894
|
+
get x() {
|
|
2895
|
+
return this._x;
|
|
2896
|
+
}
|
|
2897
|
+
set x(value) {
|
|
2898
|
+
this._x = value;
|
|
2899
|
+
this._isDirty = true;
|
|
2900
|
+
}
|
|
2901
|
+
/** Gets or sets the y coordinate */
|
|
2902
|
+
get y() {
|
|
2903
|
+
return this._y;
|
|
2904
|
+
}
|
|
2905
|
+
set y(value) {
|
|
2906
|
+
this._y = value;
|
|
2907
|
+
this._isDirty = true;
|
|
2908
|
+
}
|
|
2909
|
+
/** Gets or sets the z coordinate */
|
|
2910
|
+
get z() {
|
|
2911
|
+
return this._z;
|
|
2912
|
+
}
|
|
2913
|
+
set z(value) {
|
|
2914
|
+
this._z = value;
|
|
2915
|
+
this._isDirty = true;
|
|
2916
|
+
}
|
|
2917
|
+
/** Gets or sets the w coordinate */
|
|
2918
|
+
get w() {
|
|
2919
|
+
return this._w;
|
|
2920
|
+
}
|
|
2921
|
+
set w(value) {
|
|
2922
|
+
this._w = value;
|
|
2923
|
+
this._isDirty = true;
|
|
2924
|
+
}
|
|
2890
2925
|
/**
|
|
2891
2926
|
* Creates a Vector4 object from the given floats.
|
|
2892
2927
|
* @param x x value of the vector
|
|
@@ -2894,26 +2929,20 @@ export class Vector4 {
|
|
|
2894
2929
|
* @param z z value of the vector
|
|
2895
2930
|
* @param w w value of the vector
|
|
2896
2931
|
*/
|
|
2897
|
-
constructor(
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
/** [0] w value of the vector */
|
|
2905
|
-
w = 0) {
|
|
2906
|
-
this.x = x;
|
|
2907
|
-
this.y = y;
|
|
2908
|
-
this.z = z;
|
|
2909
|
-
this.w = w;
|
|
2932
|
+
constructor(x = 0, y = 0, z = 0, w = 0) {
|
|
2933
|
+
/** @internal */
|
|
2934
|
+
this._isDirty = true;
|
|
2935
|
+
this._x = x;
|
|
2936
|
+
this._y = y;
|
|
2937
|
+
this._z = z;
|
|
2938
|
+
this._w = w;
|
|
2910
2939
|
}
|
|
2911
2940
|
/**
|
|
2912
2941
|
* Returns the string with the Vector4 coordinates.
|
|
2913
2942
|
* @returns a string containing all the vector values
|
|
2914
2943
|
*/
|
|
2915
2944
|
toString() {
|
|
2916
|
-
return `{X: ${this.
|
|
2945
|
+
return `{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`;
|
|
2917
2946
|
}
|
|
2918
2947
|
/**
|
|
2919
2948
|
* Returns the string "Vector4".
|
|
@@ -2927,10 +2956,10 @@ export class Vector4 {
|
|
|
2927
2956
|
* @returns a unique hash code
|
|
2928
2957
|
*/
|
|
2929
2958
|
getHashCode() {
|
|
2930
|
-
const x = ExtractAsInt(this.
|
|
2931
|
-
const y = ExtractAsInt(this.
|
|
2932
|
-
const z = ExtractAsInt(this.
|
|
2933
|
-
const w = ExtractAsInt(this.
|
|
2959
|
+
const x = ExtractAsInt(this._x);
|
|
2960
|
+
const y = ExtractAsInt(this._y);
|
|
2961
|
+
const z = ExtractAsInt(this._z);
|
|
2962
|
+
const w = ExtractAsInt(this._w);
|
|
2934
2963
|
let hash = x;
|
|
2935
2964
|
hash = (hash * 397) ^ y;
|
|
2936
2965
|
hash = (hash * 397) ^ z;
|
|
@@ -2943,7 +2972,7 @@ export class Vector4 {
|
|
|
2943
2972
|
* @returns the resulting array
|
|
2944
2973
|
*/
|
|
2945
2974
|
asArray() {
|
|
2946
|
-
return [this.
|
|
2975
|
+
return [this._x, this._y, this._z, this._w];
|
|
2947
2976
|
}
|
|
2948
2977
|
/**
|
|
2949
2978
|
* Populates the given array from the given index with the Vector4 coordinates.
|
|
@@ -2955,10 +2984,10 @@ export class Vector4 {
|
|
|
2955
2984
|
if (index === undefined) {
|
|
2956
2985
|
index = 0;
|
|
2957
2986
|
}
|
|
2958
|
-
array[index] = this.
|
|
2959
|
-
array[index + 1] = this.
|
|
2960
|
-
array[index + 2] = this.
|
|
2961
|
-
array[index + 3] = this.
|
|
2987
|
+
array[index] = this._x;
|
|
2988
|
+
array[index + 1] = this._y;
|
|
2989
|
+
array[index + 2] = this._z;
|
|
2990
|
+
array[index + 3] = this._w;
|
|
2962
2991
|
return this;
|
|
2963
2992
|
}
|
|
2964
2993
|
/**
|
|
@@ -2977,10 +3006,10 @@ export class Vector4 {
|
|
|
2977
3006
|
* @returns the updated Vector4.
|
|
2978
3007
|
*/
|
|
2979
3008
|
addInPlace(otherVector) {
|
|
2980
|
-
this.x += otherVector.
|
|
2981
|
-
this.y += otherVector.
|
|
2982
|
-
this.z += otherVector.
|
|
2983
|
-
this.w += otherVector.
|
|
3009
|
+
this.x += otherVector._x;
|
|
3010
|
+
this.y += otherVector._y;
|
|
3011
|
+
this.z += otherVector._z;
|
|
3012
|
+
this.w += otherVector._w;
|
|
2984
3013
|
return this;
|
|
2985
3014
|
}
|
|
2986
3015
|
/**
|
|
@@ -3004,7 +3033,7 @@ export class Vector4 {
|
|
|
3004
3033
|
* @returns the resulting vector
|
|
3005
3034
|
*/
|
|
3006
3035
|
add(otherVector) {
|
|
3007
|
-
return new Vector4(this.
|
|
3036
|
+
return new Vector4(this._x + otherVector.x, this._y + otherVector.y, this._z + otherVector.z, this._w + otherVector.w);
|
|
3008
3037
|
}
|
|
3009
3038
|
/**
|
|
3010
3039
|
* Updates the given vector "result" with the result of the addition of the current Vector4 and the given one.
|
|
@@ -3013,10 +3042,10 @@ export class Vector4 {
|
|
|
3013
3042
|
* @returns result input
|
|
3014
3043
|
*/
|
|
3015
3044
|
addToRef(otherVector, result) {
|
|
3016
|
-
result.x = this.
|
|
3017
|
-
result.y = this.
|
|
3018
|
-
result.z = this.
|
|
3019
|
-
result.w = this.
|
|
3045
|
+
result.x = this._x + otherVector.x;
|
|
3046
|
+
result.y = this._y + otherVector.y;
|
|
3047
|
+
result.z = this._z + otherVector.z;
|
|
3048
|
+
result.w = this._w + otherVector.w;
|
|
3020
3049
|
return result;
|
|
3021
3050
|
}
|
|
3022
3051
|
/**
|
|
@@ -3037,7 +3066,7 @@ export class Vector4 {
|
|
|
3037
3066
|
* @returns the new vector with the result
|
|
3038
3067
|
*/
|
|
3039
3068
|
subtract(otherVector) {
|
|
3040
|
-
return new Vector4(this.
|
|
3069
|
+
return new Vector4(this._x - otherVector.x, this._y - otherVector.y, this._z - otherVector.z, this._w - otherVector.w);
|
|
3041
3070
|
}
|
|
3042
3071
|
/**
|
|
3043
3072
|
* Sets the given vector "result" with the result of the subtraction of the given vector from the current Vector4.
|
|
@@ -3046,10 +3075,10 @@ export class Vector4 {
|
|
|
3046
3075
|
* @returns result input
|
|
3047
3076
|
*/
|
|
3048
3077
|
subtractToRef(otherVector, result) {
|
|
3049
|
-
result.x = this.
|
|
3050
|
-
result.y = this.
|
|
3051
|
-
result.z = this.
|
|
3052
|
-
result.w = this.
|
|
3078
|
+
result.x = this._x - otherVector.x;
|
|
3079
|
+
result.y = this._y - otherVector.y;
|
|
3080
|
+
result.z = this._z - otherVector.z;
|
|
3081
|
+
result.w = this._w - otherVector.w;
|
|
3053
3082
|
return result;
|
|
3054
3083
|
}
|
|
3055
3084
|
/**
|
|
@@ -3061,7 +3090,7 @@ export class Vector4 {
|
|
|
3061
3090
|
* @returns new vector containing the result
|
|
3062
3091
|
*/
|
|
3063
3092
|
subtractFromFloats(x, y, z, w) {
|
|
3064
|
-
return new Vector4(this.
|
|
3093
|
+
return new Vector4(this._x - x, this._y - y, this._z - z, this._w - w);
|
|
3065
3094
|
}
|
|
3066
3095
|
/**
|
|
3067
3096
|
* Sets the given vector "result" set with the result of the subtraction of the given floats from the current Vector4 coordinates.
|
|
@@ -3073,10 +3102,10 @@ export class Vector4 {
|
|
|
3073
3102
|
* @returns result input
|
|
3074
3103
|
*/
|
|
3075
3104
|
subtractFromFloatsToRef(x, y, z, w, result) {
|
|
3076
|
-
result.x = this.
|
|
3077
|
-
result.y = this.
|
|
3078
|
-
result.z = this.
|
|
3079
|
-
result.w = this.
|
|
3105
|
+
result.x = this._x - x;
|
|
3106
|
+
result.y = this._y - y;
|
|
3107
|
+
result.z = this._z - z;
|
|
3108
|
+
result.w = this._w - w;
|
|
3080
3109
|
return result;
|
|
3081
3110
|
}
|
|
3082
3111
|
/**
|
|
@@ -3084,7 +3113,7 @@ export class Vector4 {
|
|
|
3084
3113
|
* @returns a new vector with the negated values
|
|
3085
3114
|
*/
|
|
3086
3115
|
negate() {
|
|
3087
|
-
return new Vector4(-this.
|
|
3116
|
+
return new Vector4(-this._x, -this._y, -this._z, -this._w);
|
|
3088
3117
|
}
|
|
3089
3118
|
/**
|
|
3090
3119
|
* Negate this vector in place
|
|
@@ -3103,10 +3132,10 @@ export class Vector4 {
|
|
|
3103
3132
|
* @returns the result
|
|
3104
3133
|
*/
|
|
3105
3134
|
negateToRef(result) {
|
|
3106
|
-
result.x = -this.
|
|
3107
|
-
result.y = -this.
|
|
3108
|
-
result.z = -this.
|
|
3109
|
-
result.w = -this.
|
|
3135
|
+
result.x = -this._x;
|
|
3136
|
+
result.y = -this._y;
|
|
3137
|
+
result.z = -this._z;
|
|
3138
|
+
result.w = -this._w;
|
|
3110
3139
|
return result;
|
|
3111
3140
|
}
|
|
3112
3141
|
/**
|
|
@@ -3127,7 +3156,7 @@ export class Vector4 {
|
|
|
3127
3156
|
* @returns a new vector with the result
|
|
3128
3157
|
*/
|
|
3129
3158
|
scale(scale) {
|
|
3130
|
-
return new Vector4(this.
|
|
3159
|
+
return new Vector4(this._x * scale, this._y * scale, this._z * scale, this._w * scale);
|
|
3131
3160
|
}
|
|
3132
3161
|
/**
|
|
3133
3162
|
* Sets the given vector "result" with the current Vector4 coordinates multiplied by scale (float).
|
|
@@ -3136,10 +3165,10 @@ export class Vector4 {
|
|
|
3136
3165
|
* @returns result input
|
|
3137
3166
|
*/
|
|
3138
3167
|
scaleToRef(scale, result) {
|
|
3139
|
-
result.x = this.
|
|
3140
|
-
result.y = this.
|
|
3141
|
-
result.z = this.
|
|
3142
|
-
result.w = this.
|
|
3168
|
+
result.x = this._x * scale;
|
|
3169
|
+
result.y = this._y * scale;
|
|
3170
|
+
result.z = this._z * scale;
|
|
3171
|
+
result.w = this._w * scale;
|
|
3143
3172
|
return result;
|
|
3144
3173
|
}
|
|
3145
3174
|
/**
|
|
@@ -3149,10 +3178,10 @@ export class Vector4 {
|
|
|
3149
3178
|
* @returns result input
|
|
3150
3179
|
*/
|
|
3151
3180
|
scaleAndAddToRef(scale, result) {
|
|
3152
|
-
result.x += this.
|
|
3153
|
-
result.y += this.
|
|
3154
|
-
result.z += this.
|
|
3155
|
-
result.w += this.
|
|
3181
|
+
result.x += this._x * scale;
|
|
3182
|
+
result.y += this._y * scale;
|
|
3183
|
+
result.z += this._z * scale;
|
|
3184
|
+
result.w += this._w * scale;
|
|
3156
3185
|
return result;
|
|
3157
3186
|
}
|
|
3158
3187
|
/**
|
|
@@ -3161,7 +3190,7 @@ export class Vector4 {
|
|
|
3161
3190
|
* @returns true if they are equal
|
|
3162
3191
|
*/
|
|
3163
3192
|
equals(otherVector) {
|
|
3164
|
-
return otherVector && this.
|
|
3193
|
+
return otherVector && this._x === otherVector.x && this._y === otherVector.y && this._z === otherVector.z && this._w === otherVector.w;
|
|
3165
3194
|
}
|
|
3166
3195
|
/**
|
|
3167
3196
|
* Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the given vector ones.
|
|
@@ -3171,10 +3200,10 @@ export class Vector4 {
|
|
|
3171
3200
|
*/
|
|
3172
3201
|
equalsWithEpsilon(otherVector, epsilon = Epsilon) {
|
|
3173
3202
|
return (otherVector &&
|
|
3174
|
-
WithinEpsilon(this.
|
|
3175
|
-
WithinEpsilon(this.
|
|
3176
|
-
WithinEpsilon(this.
|
|
3177
|
-
WithinEpsilon(this.
|
|
3203
|
+
WithinEpsilon(this._x, otherVector.x, epsilon) &&
|
|
3204
|
+
WithinEpsilon(this._y, otherVector.y, epsilon) &&
|
|
3205
|
+
WithinEpsilon(this._z, otherVector.z, epsilon) &&
|
|
3206
|
+
WithinEpsilon(this._w, otherVector.w, epsilon));
|
|
3178
3207
|
}
|
|
3179
3208
|
/**
|
|
3180
3209
|
* Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.
|
|
@@ -3185,7 +3214,7 @@ export class Vector4 {
|
|
|
3185
3214
|
* @returns true if equal
|
|
3186
3215
|
*/
|
|
3187
3216
|
equalsToFloats(x, y, z, w) {
|
|
3188
|
-
return this.
|
|
3217
|
+
return this._x === x && this._y === y && this._z === z && this._w === w;
|
|
3189
3218
|
}
|
|
3190
3219
|
/**
|
|
3191
3220
|
* Multiplies in place the current Vector4 by the given one.
|
|
@@ -3205,7 +3234,7 @@ export class Vector4 {
|
|
|
3205
3234
|
* @returns resulting new vector
|
|
3206
3235
|
*/
|
|
3207
3236
|
multiply(otherVector) {
|
|
3208
|
-
return new Vector4(this.
|
|
3237
|
+
return new Vector4(this._x * otherVector.x, this._y * otherVector.y, this._z * otherVector.z, this._w * otherVector.w);
|
|
3209
3238
|
}
|
|
3210
3239
|
/**
|
|
3211
3240
|
* Updates the given vector "result" with the multiplication result of the current Vector4 and the given one.
|
|
@@ -3214,10 +3243,10 @@ export class Vector4 {
|
|
|
3214
3243
|
* @returns result input
|
|
3215
3244
|
*/
|
|
3216
3245
|
multiplyToRef(otherVector, result) {
|
|
3217
|
-
result.x = this.
|
|
3218
|
-
result.y = this.
|
|
3219
|
-
result.z = this.
|
|
3220
|
-
result.w = this.
|
|
3246
|
+
result.x = this._x * otherVector.x;
|
|
3247
|
+
result.y = this._y * otherVector.y;
|
|
3248
|
+
result.z = this._z * otherVector.z;
|
|
3249
|
+
result.w = this._w * otherVector.w;
|
|
3221
3250
|
return result;
|
|
3222
3251
|
}
|
|
3223
3252
|
/**
|
|
@@ -3229,7 +3258,7 @@ export class Vector4 {
|
|
|
3229
3258
|
* @returns resulting new vector
|
|
3230
3259
|
*/
|
|
3231
3260
|
multiplyByFloats(x, y, z, w) {
|
|
3232
|
-
return new Vector4(this.
|
|
3261
|
+
return new Vector4(this._x * x, this._y * y, this._z * z, this._w * w);
|
|
3233
3262
|
}
|
|
3234
3263
|
/**
|
|
3235
3264
|
* Returns a new Vector4 set with the division result of the current Vector4 by the given one.
|
|
@@ -3237,7 +3266,7 @@ export class Vector4 {
|
|
|
3237
3266
|
* @returns resulting new vector
|
|
3238
3267
|
*/
|
|
3239
3268
|
divide(otherVector) {
|
|
3240
|
-
return new Vector4(this.
|
|
3269
|
+
return new Vector4(this._x / otherVector.x, this._y / otherVector.y, this._z / otherVector.z, this._w / otherVector.w);
|
|
3241
3270
|
}
|
|
3242
3271
|
/**
|
|
3243
3272
|
* Updates the given vector "result" with the division result of the current Vector4 by the given one.
|
|
@@ -3246,10 +3275,10 @@ export class Vector4 {
|
|
|
3246
3275
|
* @returns result input
|
|
3247
3276
|
*/
|
|
3248
3277
|
divideToRef(otherVector, result) {
|
|
3249
|
-
result.x = this.
|
|
3250
|
-
result.y = this.
|
|
3251
|
-
result.z = this.
|
|
3252
|
-
result.w = this.
|
|
3278
|
+
result.x = this._x / otherVector.x;
|
|
3279
|
+
result.y = this._y / otherVector.y;
|
|
3280
|
+
result.z = this._z / otherVector.z;
|
|
3281
|
+
result.w = this._w / otherVector.w;
|
|
3253
3282
|
return result;
|
|
3254
3283
|
}
|
|
3255
3284
|
/**
|
|
@@ -3266,16 +3295,16 @@ export class Vector4 {
|
|
|
3266
3295
|
* @returns the current updated Vector4
|
|
3267
3296
|
*/
|
|
3268
3297
|
minimizeInPlace(other) {
|
|
3269
|
-
if (other.x < this.
|
|
3298
|
+
if (other.x < this._x) {
|
|
3270
3299
|
this.x = other.x;
|
|
3271
3300
|
}
|
|
3272
|
-
if (other.y < this.
|
|
3301
|
+
if (other.y < this._y) {
|
|
3273
3302
|
this.y = other.y;
|
|
3274
3303
|
}
|
|
3275
|
-
if (other.z < this.
|
|
3304
|
+
if (other.z < this._z) {
|
|
3276
3305
|
this.z = other.z;
|
|
3277
3306
|
}
|
|
3278
|
-
if (other.w < this.
|
|
3307
|
+
if (other.w < this._w) {
|
|
3279
3308
|
this.w = other.w;
|
|
3280
3309
|
}
|
|
3281
3310
|
return this;
|
|
@@ -3286,16 +3315,16 @@ export class Vector4 {
|
|
|
3286
3315
|
* @returns the current updated Vector4
|
|
3287
3316
|
*/
|
|
3288
3317
|
maximizeInPlace(other) {
|
|
3289
|
-
if (other.x > this.
|
|
3318
|
+
if (other.x > this._x) {
|
|
3290
3319
|
this.x = other.x;
|
|
3291
3320
|
}
|
|
3292
|
-
if (other.y > this.
|
|
3321
|
+
if (other.y > this._y) {
|
|
3293
3322
|
this.y = other.y;
|
|
3294
3323
|
}
|
|
3295
|
-
if (other.z > this.
|
|
3324
|
+
if (other.z > this._z) {
|
|
3296
3325
|
this.z = other.z;
|
|
3297
3326
|
}
|
|
3298
|
-
if (other.w > this.
|
|
3327
|
+
if (other.w > this._w) {
|
|
3299
3328
|
this.w = other.w;
|
|
3300
3329
|
}
|
|
3301
3330
|
return this;
|
|
@@ -3309,10 +3338,10 @@ export class Vector4 {
|
|
|
3309
3338
|
* @returns the current updated Vector4
|
|
3310
3339
|
*/
|
|
3311
3340
|
minimizeInPlaceFromFloats(x, y, z, w) {
|
|
3312
|
-
this.x = Math.min(x, this.
|
|
3313
|
-
this.y = Math.min(y, this.
|
|
3314
|
-
this.z = Math.min(z, this.
|
|
3315
|
-
this.w = Math.min(w, this.
|
|
3341
|
+
this.x = Math.min(x, this._x);
|
|
3342
|
+
this.y = Math.min(y, this._y);
|
|
3343
|
+
this.z = Math.min(z, this._z);
|
|
3344
|
+
this.w = Math.min(w, this._w);
|
|
3316
3345
|
return this;
|
|
3317
3346
|
}
|
|
3318
3347
|
/**
|
|
@@ -3324,10 +3353,10 @@ export class Vector4 {
|
|
|
3324
3353
|
* @returns the current updated Vector4
|
|
3325
3354
|
*/
|
|
3326
3355
|
maximizeInPlaceFromFloats(x, y, z, w) {
|
|
3327
|
-
this.x = Math.max(x, this.
|
|
3328
|
-
this.y = Math.max(y, this.
|
|
3329
|
-
this.z = Math.max(z, this.
|
|
3330
|
-
this.w = Math.max(w, this.
|
|
3356
|
+
this.x = Math.max(x, this._x);
|
|
3357
|
+
this.y = Math.max(y, this._y);
|
|
3358
|
+
this.z = Math.max(z, this._z);
|
|
3359
|
+
this.w = Math.max(w, this._w);
|
|
3331
3360
|
return this;
|
|
3332
3361
|
}
|
|
3333
3362
|
/**
|
|
@@ -3336,10 +3365,10 @@ export class Vector4 {
|
|
|
3336
3365
|
* @returns the result vector
|
|
3337
3366
|
*/
|
|
3338
3367
|
floorToRef(result) {
|
|
3339
|
-
result.x = Math.floor(this.
|
|
3340
|
-
result.y = Math.floor(this.
|
|
3341
|
-
result.z = Math.floor(this.
|
|
3342
|
-
result.w = Math.floor(this.
|
|
3368
|
+
result.x = Math.floor(this._x);
|
|
3369
|
+
result.y = Math.floor(this._y);
|
|
3370
|
+
result.z = Math.floor(this._z);
|
|
3371
|
+
result.w = Math.floor(this._w);
|
|
3343
3372
|
return result;
|
|
3344
3373
|
}
|
|
3345
3374
|
/**
|
|
@@ -3347,7 +3376,7 @@ export class Vector4 {
|
|
|
3347
3376
|
* @returns a new Vector4
|
|
3348
3377
|
*/
|
|
3349
3378
|
floor() {
|
|
3350
|
-
return new Vector4(Math.floor(this.
|
|
3379
|
+
return new Vector4(Math.floor(this._x), Math.floor(this._y), Math.floor(this._z), Math.floor(this._w));
|
|
3351
3380
|
}
|
|
3352
3381
|
/**
|
|
3353
3382
|
* Gets the current Vector4's fractional values and stores them in result
|
|
@@ -3355,10 +3384,10 @@ export class Vector4 {
|
|
|
3355
3384
|
* @returns the result vector
|
|
3356
3385
|
*/
|
|
3357
3386
|
fractToRef(result) {
|
|
3358
|
-
result.x = this.
|
|
3359
|
-
result.y = this.
|
|
3360
|
-
result.z = this.
|
|
3361
|
-
result.w = this.
|
|
3387
|
+
result.x = this._x - Math.floor(this._x);
|
|
3388
|
+
result.y = this._y - Math.floor(this._y);
|
|
3389
|
+
result.z = this._z - Math.floor(this._z);
|
|
3390
|
+
result.w = this._w - Math.floor(this._w);
|
|
3362
3391
|
return result;
|
|
3363
3392
|
}
|
|
3364
3393
|
/**
|
|
@@ -3366,7 +3395,7 @@ export class Vector4 {
|
|
|
3366
3395
|
* @returns a new Vector4
|
|
3367
3396
|
*/
|
|
3368
3397
|
fract() {
|
|
3369
|
-
return new Vector4(this.
|
|
3398
|
+
return new Vector4(this._x - Math.floor(this._x), this._y - Math.floor(this._y), this._z - Math.floor(this._z), this._w - Math.floor(this._w));
|
|
3370
3399
|
}
|
|
3371
3400
|
// Properties
|
|
3372
3401
|
/**
|
|
@@ -3374,14 +3403,14 @@ export class Vector4 {
|
|
|
3374
3403
|
* @returns the length
|
|
3375
3404
|
*/
|
|
3376
3405
|
length() {
|
|
3377
|
-
return Math.sqrt(this.
|
|
3406
|
+
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
|
|
3378
3407
|
}
|
|
3379
3408
|
/**
|
|
3380
3409
|
* Returns the Vector4 squared length (float).
|
|
3381
3410
|
* @returns the length squared
|
|
3382
3411
|
*/
|
|
3383
3412
|
lengthSquared() {
|
|
3384
|
-
return this.
|
|
3413
|
+
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
|
|
3385
3414
|
}
|
|
3386
3415
|
// Methods
|
|
3387
3416
|
/**
|
|
@@ -3418,10 +3447,10 @@ export class Vector4 {
|
|
|
3418
3447
|
normalizeToRef(reference) {
|
|
3419
3448
|
const len = this.length();
|
|
3420
3449
|
if (len === 0 || len === 1.0) {
|
|
3421
|
-
reference.x = this.
|
|
3422
|
-
reference.y = this.
|
|
3423
|
-
reference.z = this.
|
|
3424
|
-
reference.w = this.
|
|
3450
|
+
reference.x = this._x;
|
|
3451
|
+
reference.y = this._y;
|
|
3452
|
+
reference.z = this._z;
|
|
3453
|
+
reference.w = this._w;
|
|
3425
3454
|
return reference;
|
|
3426
3455
|
}
|
|
3427
3456
|
return this.scaleToRef(1.0 / len, reference);
|
|
@@ -3431,14 +3460,14 @@ export class Vector4 {
|
|
|
3431
3460
|
* @returns this converted to a new vector3
|
|
3432
3461
|
*/
|
|
3433
3462
|
toVector3() {
|
|
3434
|
-
return new Vector3(this.
|
|
3463
|
+
return new Vector3(this._x, this._y, this._z);
|
|
3435
3464
|
}
|
|
3436
3465
|
/**
|
|
3437
3466
|
* Returns a new Vector4 copied from the current one.
|
|
3438
3467
|
* @returns the new cloned vector
|
|
3439
3468
|
*/
|
|
3440
3469
|
clone() {
|
|
3441
|
-
return new Vector4(this.
|
|
3470
|
+
return new Vector4(this._x, this._y, this._z, this._w);
|
|
3442
3471
|
}
|
|
3443
3472
|
/**
|
|
3444
3473
|
* Updates the current Vector4 with the given one coordinates.
|
|
@@ -3493,7 +3522,7 @@ export class Vector4 {
|
|
|
3493
3522
|
* @returns the dot product
|
|
3494
3523
|
*/
|
|
3495
3524
|
dot(otherVector) {
|
|
3496
|
-
return this.
|
|
3525
|
+
return this._x * otherVector.x + this._y * otherVector.y + this._z * otherVector.z + this._w * otherVector.w;
|
|
3497
3526
|
}
|
|
3498
3527
|
// Statics
|
|
3499
3528
|
/**
|