diff --git a/sources/engine/Xenko.Graphics/Sprite3DBatch.cs b/sources/engine/Xenko.Graphics/Sprite3DBatch.cs index 03d0300ab..579645ce4 100644 --- a/sources/engine/Xenko.Graphics/Sprite3DBatch.cs +++ b/sources/engine/Xenko.Graphics/Sprite3DBatch.cs @@ -71,7 +71,7 @@ namespace Xenko.Graphics throw new ArgumentNullException("texture"); // Skip items with null size - if (elementSize.Length() < MathUtil.ZeroTolerance) + if (elementSize.LengthSquared() < MathUtil.ZeroTolerance) return; // Calculate the information needed to draw. diff --git a/sources/engine/Xenko.Graphics/SpriteFont.cs b/sources/engine/Xenko.Graphics/SpriteFont.cs index b5ec80ffc..6c54ec87d 100644 --- a/sources/engine/Xenko.Graphics/SpriteFont.cs +++ b/sources/engine/Xenko.Graphics/SpriteFont.cs @@ -269,7 +269,7 @@ namespace Xenko.Graphics var elementSize = new Vector2( auxiliaryScaling.X * glyph.Subrect.Width / realVirtualResolutionRatio.X, auxiliaryScaling.Y * glyph.Subrect.Height / realVirtualResolutionRatio.Y); - if (elementSize.Length() < MathUtil.ZeroTolerance) + if (elementSize.LengthSquared() < MathUtil.ZeroTolerance) return; var xShift = x; diff --git a/sources/engine/Xenko.Graphics/UIBatch.cs b/sources/engine/Xenko.Graphics/UIBatch.cs index 5119a59e7..a666c29d0 100644 --- a/sources/engine/Xenko.Graphics/UIBatch.cs +++ b/sources/engine/Xenko.Graphics/UIBatch.cs @@ -215,7 +215,7 @@ namespace Xenko.Graphics public void DrawRectangle(ref Matrix worldMatrix, ref Vector3 elementSize, ref Color color, int depthBias) { // Skip items with null size - if (elementSize.Length() < MathUtil.ZeroTolerance) + if (elementSize.LengthSquared() < MathUtil.ZeroTolerance) return; // Calculate the information needed to draw. @@ -277,7 +277,7 @@ namespace Xenko.Graphics private void DrawCube(ref Matrix worldMatrix, ref Vector3 elementSize, ref Color color, int depthBias, bool isReverse) { // Skip items with null size - if (elementSize.Length() < MathUtil.ZeroTolerance) + if (elementSize.LengthSquared() < MathUtil.ZeroTolerance) return; // Calculate the information needed to draw. @@ -331,7 +331,7 @@ namespace Xenko.Graphics if (texture == null) throw new ArgumentNullException(nameof(texture)); // Skip items with null size - if (elementSize.Length() < MathUtil.ZeroTolerance) + if (elementSize.LengthSquared() < MathUtil.ZeroTolerance) return; // Calculate the information needed to draw. diff --git a/sources/engine/Xenko.Physics/Shapes/StaticPlaneColliderShape.cs b/sources/engine/Xenko.Physics/Shapes/StaticPlaneColliderShape.cs index 9795dddd1..e1089dfae 100644 --- a/sources/engine/Xenko.Physics/Shapes/StaticPlaneColliderShape.cs +++ b/sources/engine/Xenko.Physics/Shapes/StaticPlaneColliderShape.cs @@ -40,7 +40,7 @@ namespace Xenko.Physics Matrix rotationMatrix; var oY = Vector3.Normalize(Normal); var oZ = Vector3.Cross(Vector3.UnitX, oY); - if (oZ.Length() > MathUtil.ZeroTolerance) + if (oZ.LengthSquared() > MathUtil.ZeroTolerance) { oZ.Normalize(); var oX = Vector3.Cross(oY, oZ);