Reformat code in Math libary

This commit is contained in:
Wojtek Figat
2022-05-21 20:04:12 +02:00
parent 785f8915b7
commit 2eb51f9a83
26 changed files with 103 additions and 474 deletions

View File

@@ -11,7 +11,6 @@
struct FLAXENGINE_API AABB
{
public:
int32 MinX;
int32 MaxX;
@@ -22,7 +21,6 @@ public:
int32 MaxZ;
public:
AABB()
{
MinX = MAX_int32;
@@ -49,7 +47,6 @@ public:
}
public:
int32 Width() const
{
return MaxX - MinX;
@@ -86,7 +83,6 @@ public:
}
public:
void Clear()
{
MinX = MAX_int32;
@@ -184,7 +180,6 @@ public:
}
public:
bool IsOutside(const AABB& other) const
{
return MaxX - other.MinX < 0 || MinX - other.MaxX > 0 ||

View File

@@ -11,9 +11,8 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API BoundingBox
{
DECLARE_SCRIPTING_TYPE_MINIMAL(BoundingBox);
DECLARE_SCRIPTING_TYPE_MINIMAL(BoundingBox);
public:
/// <summary>
/// A <see cref="BoundingBox"/> which represents an empty space.
/// </summary>
@@ -25,7 +24,6 @@ public:
static const BoundingBox Zero;
public:
/// <summary>
/// The minimum point of the box.
/// </summary>
@@ -37,7 +35,6 @@ public:
API_FIELD() Vector3 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -67,11 +64,9 @@ public:
}
public:
String ToString() const;
public:
/// <summary>
/// Gets the eight corners of the bounding box.
/// </summary>
@@ -152,7 +147,6 @@ public:
}
public:
static bool NearEqual(const BoundingBox& a, const BoundingBox& b)
{
return Vector3::NearEqual(a.Minimum, b.Minimum) && Vector3::NearEqual(a.Maximum, b.Maximum);
@@ -164,7 +158,6 @@ public:
}
public:
/// <summary>
/// Merges the box with a point.
/// </summary>
@@ -193,7 +186,6 @@ public:
BoundingBox MakeOffsetted(const Vector3& offset) const;
public:
FORCE_INLINE bool operator==(const BoundingBox& other) const
{
return Minimum == other.Minimum && Maximum == other.Maximum;
@@ -212,7 +204,6 @@ public:
}
public:
/// <summary>
/// Constructs a Bounding Box that fully contains the given pair of points.
/// </summary>
@@ -300,7 +291,6 @@ public:
static void Transform(const BoundingBox& box, const Matrix& matrix, BoundingBox& result);
public:
/// <summary>
/// Determines if there is an intersection between the current object and a Ray.
/// </summary>

View File

@@ -13,7 +13,6 @@
API_STRUCT(InBuild) struct FLAXENGINE_API BoundingFrustum
{
private:
Matrix _matrix;
Plane _pNear;
Plane _pFar;
@@ -23,7 +22,6 @@ private:
Plane _pBottom;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -41,11 +39,9 @@ public:
}
public:
String ToString() const;
public:
/// <summary>
/// Gets the matrix that describes this bounding frustum.
/// </summary>
@@ -194,7 +190,6 @@ public:
float GetHeightAtDepth(float depth) const;
public:
FORCE_INLINE bool operator==(const BoundingFrustum& other) const
{
return _matrix == other._matrix;
@@ -206,7 +201,6 @@ public:
}
public:
/// <summary>
/// Checks whether a point lays inside, intersects or lays outside the frustum.
/// </summary>

View File

@@ -12,16 +12,14 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API BoundingSphere
{
DECLARE_SCRIPTING_TYPE_MINIMAL(BoundingSphere);
DECLARE_SCRIPTING_TYPE_MINIMAL(BoundingSphere);
public:
/// <summary>
/// An empty bounding sphere (Center = 0 and Radius = 0).
/// </summary>
static const BoundingSphere Empty;
public:
/// <summary>
/// The center of the sphere in three dimensional space.
/// </summary>
@@ -33,7 +31,6 @@ public:
API_FIELD() float Radius;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -53,11 +50,9 @@ public:
}
public:
String ToString() const;
public:
FORCE_INLINE bool operator==(const BoundingSphere& other) const
{
return Center == other.Center && Radius == other.Radius;
@@ -69,7 +64,6 @@ public:
}
public:
static bool NearEqual(const BoundingSphere& a, const BoundingSphere& b)
{
return Vector3::NearEqual(a.Center, b.Center) && Math::NearEqual(a.Radius, b.Radius);
@@ -81,7 +75,6 @@ public:
}
public:
/// <summary>
/// Determines if there is an intersection between the current object and a Ray.
/// </summary>
@@ -175,7 +168,6 @@ public:
ContainmentType Contains(const BoundingSphere& sphere) const;
public:
/// <summary>
/// Gets the box which contains whole sphere.
/// </summary>

View File

@@ -60,7 +60,6 @@ enum class PlaneIntersectionType
class FLAXENGINE_API CollisionsHelper
{
public:
/// <summary>
/// Determines the closest point between a point and a line.
/// </summary>

View File

@@ -16,9 +16,8 @@ struct Color32;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Color
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Color);
DECLARE_SCRIPTING_TYPE_MINIMAL(Color);
public:
union
{
struct
@@ -51,7 +50,6 @@ public:
};
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -119,7 +117,6 @@ public:
explicit Color(const Color32& color);
public:
/// <summary>
/// Initializes from values in range [0;255].
/// </summary>
@@ -177,12 +174,10 @@ public:
static Color Random();
public:
String ToString() const;
String ToHexString() const;
public:
bool operator==(const Color& other) const
{
return R == other.R && G == other.G && B == other.B && A == other.A;
@@ -270,12 +265,10 @@ public:
bool HasOpacity() const;
public:
static bool NearEqual(const Color& a, const Color& b);
static bool NearEqual(const Color& a, const Color& b, float epsilon);
public:
// Get color as vector structure.
Vector3 ToVector3() const;
@@ -343,7 +336,6 @@ public:
}
public:
uint32 GetHashCode() const;
static uint32 GetHashCode(const Color& v)
@@ -352,7 +344,6 @@ public:
}
public:
static Color Transparent;
static Color AliceBlue;
static Color AntiqueWhite;

View File

@@ -16,7 +16,6 @@ struct Color;
API_STRUCT(InBuild) struct FLAXENGINE_API Color32
{
public:
union
{
struct
@@ -49,13 +48,11 @@ public:
};
public:
static Color32 Transparent;
static Color32 Black;
static Color32 White;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -82,12 +79,10 @@ public:
explicit Color32(const Vector4& c);
public:
String ToString() const;
String ToHexString() const;
public:
bool operator==(const Color32& other) const
{
return R == other.R && G == other.G && B == other.B && A == other.A;
@@ -158,7 +153,6 @@ public:
}
public:
uint32 GetAsABGR() const
{
return (R << 24) + (G << 16) + (B << 8) + A;
@@ -185,7 +179,6 @@ public:
}
public:
uint32 GetHashCode() const;
static uint32 GetHashCode(const Color32& v)
@@ -194,7 +187,6 @@ public:
}
public:
/// <summary>
/// Initializes from packed RGB value of the color and separate alpha channel value.
/// </summary>

View File

@@ -23,9 +23,8 @@ struct Matrix;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Double2
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Double2);
DECLARE_SCRIPTING_TYPE_MINIMAL(Double2);
public:
union
{
struct
@@ -46,7 +45,6 @@ public:
};
public:
// Vector with all components equal 0
static const Double2 Zero;
@@ -66,7 +64,6 @@ public:
static const Double2 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -100,49 +97,21 @@ public:
, Y(xy[1])
{
}
// Init
// @param v Int2 to use X and Y components
explicit Double2(const Int2& xy);
// Init
// @param v Int3 to use X and Y components
explicit Double2(const Int3& xyz);
// Init
// @param v Int4 to use X and Y components
explicit Double2(const Int4& xyzw);
// Init
// @param v Vector2 to use X and Y components
Double2(const Vector2& xy);
// Init
// @param v Vector3 to use X and Y components
explicit Double2(const Vector3& xyz);
// Init
// @param v Vector4 to use X and Y components
explicit Double2(const Vector4& xyzw);
// Init
// @param v Double3 to use X and Y components
explicit Double2(const Double3& xyz);
// Init
// @param v Double4 to use X and Y components
explicit Double2(const Double4& xyzw);
// Init
// @param color Color value
explicit Double2(const Color& color);
public:
String ToString() const;
public:
// Arithmetic operators with Double2
Double2 operator+(const Double2& b) const
{
@@ -272,7 +241,6 @@ public:
}
public:
static bool NearEqual(const Double2& a, const Double2& b)
{
return Math::NearEqual(a.X, b.X) && Math::NearEqual(a.Y, b.Y);
@@ -284,7 +252,6 @@ public:
}
public:
static double Dot(const Double2& a, const Double2& b)
{
return a.X * b.X + a.Y * b.Y;
@@ -396,137 +363,125 @@ public:
}
public:
// Gets a value indicting whether this instance is normalized
// Gets a value indicting whether this instance is normalized.
bool IsNormalized() const
{
return Math::IsOne(X * X + Y * Y);
}
// Gets a value indicting whether this vector is zero
// Gets a value indicting whether this vector is zero.
bool IsZero() const
{
return Math::IsZero(X) && Math::IsZero(Y);
}
// Gets a value indicting whether any vector component is zero
// Gets a value indicting whether any vector component is zero.
bool IsAnyZero() const
{
return Math::IsZero(X) || Math::IsZero(Y);
}
// Gets a value indicting whether this vector is zero
// Gets a value indicting whether this vector is zero.
bool IsOne() const
{
return Math::IsOne(X) && Math::IsOne(Y);
}
// Calculates length of the vector
// @returns Length of the vector
// Calculates length of the vector.
double Length() const
{
return Math::Sqrt(X * X + Y * Y);
}
// Calculates the squared length of the vector
// @returns The squared length of the vector
// Calculates the squared length of the vector.
double LengthSquared() const
{
return X * X + Y * Y;
}
// Calculates inverted length of the vector (1 / Length())
// Calculates inverted length of the vector (1 / length).
double InvLength() const
{
return 1. / Length();
}
// Calculates a vector with values being absolute values of that vector
// Calculates a vector with values being absolute values of that vector.
Double2 GetAbsolute() const
{
return Double2(Math::Abs(X), Math::Abs(Y));
}
// Calculates a vector with values being opposite to values of that vector
// Calculates a vector with values being opposite to values of that vector.
Double2 GetNegative() const
{
return Double2(-X, -Y);
}
/// <summary>
/// Returns average arithmetic of all the components
/// Returns the average arithmetic of all the components.
/// </summary>
/// <returns>Average arithmetic of all the components</returns>
double AverageArithmetic() const
{
return (X + Y) * 0.5;
}
/// <summary>
/// Gets sum of all vector components values
/// Gets the sum of all vector components values.
/// </summary>
/// <returns>Sum of X,Y and Z</returns>
double SumValues() const
{
return X + Y;
}
/// <summary>
/// Gets multiplication result of all vector components values
/// Gets the multiplication result of all vector components values.
/// </summary>
/// <returns>X * Y</returns>
double MulValues() const
{
return X * Y;
}
/// <summary>
/// Returns minimum value of all the components
/// Returns the minimum value of all the components.
/// </summary>
/// <returns>Minimum value</returns>
double MinValue() const
{
return Math::Min(X, Y);
}
/// <summary>
/// Returns maximum value of all the components
/// Returns the maximum value of all the components.
/// </summary>
/// <returns>Maximum value</returns>
double MaxValue() const
{
return Math::Max(X, Y);
}
/// <summary>
/// Returns true if vector has one or more components is not a number (NaN)
/// Returns true if vector has one or more components is not a number (NaN).
/// </summary>
/// <returns>True if one or more components is not a number (NaN)</returns>
bool IsNaN() const
{
return isnan(X) || isnan(Y);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity
/// Returns true if vector has one or more components equal to +/- infinity.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity</returns>
bool IsInfinity() const
{
return isinf(X) || isinf(Y);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity or NaN
/// Returns true if vector has one or more components equal to +/- infinity or NaN.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity or NaN</returns>
bool IsNanOrInfinity() const
{
return IsInfinity() || IsNaN();
}
public:
// Performs a linear interpolation between two vectors
// @param start Start vector
// @param end End vector
@@ -616,7 +571,6 @@ public:
}
public:
/// <summary>
/// Calculates the area of the triangle.
/// </summary>
@@ -625,15 +579,14 @@ public:
/// <param name="v2">The third triangle vertex.</param>
/// <returns>The triangle area.</returns>
static double TriangleArea(const Double2& v0, const Double2& v1, const Double2& v2);
/// <summary>
/// <summary>
/// Calculates the angle (in radians) between from and to. This is always the smallest value.
/// </summary>
/// <param name="from">The first vector.</param>
/// <param name="to">The second vector.</param>
/// <returns>The angle (in radians).</returns>
static double Angle(const Double2& from, const Double2& to);
};
inline Double2 operator+(double a, const Double2& b)

View File

@@ -215,7 +215,7 @@ public:
}
/// <summary>
/// Returns average arithmetic of all the components.
/// Returns the average arithmetic of all the components.
/// </summary>
double AverageArithmetic() const
{
@@ -223,7 +223,7 @@ public:
}
/// <summary>
/// Gets sum of all vector components values.
/// Gets the sum of all vector components values.
/// </summary>
double SumValues() const
{
@@ -231,7 +231,7 @@ public:
}
/// <summary>
/// Returns minimum value of all the components.
/// Returns the minimum value of all the components.
/// </summary>
double MinValue() const
{
@@ -239,7 +239,7 @@ public:
}
/// <summary>
/// Returns maximum value of all the components.
/// Returns the maximum value of all the components.
/// </summary>
double MaxValue() const
{

View File

@@ -25,9 +25,8 @@ struct Int4;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Double4
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Double4);
DECLARE_SCRIPTING_TYPE_MINIMAL(Double4);
public:
union
{
struct
@@ -60,7 +59,6 @@ public:
};
public:
// Vector with all components equal 0
static const Double4 Zero;
@@ -86,7 +84,6 @@ public:
static const Double4 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -121,167 +118,113 @@ public:
{
}
// Init
// @param xy X and Y values in the vector
// @param z Z component value
// @param w W component value
explicit Double4(const Vector2& xy, double z, double w);
// Init
// @param xy X and Y values in the vector
// @param zw Z and W values in the vector
explicit Double4(const Vector2& xy, const Vector2& zw);
// Init
// @param xyz X, Y and Z values in the vector
// @param w W component value
explicit Double4(const Vector3& xyz, double w);
// Init
// @param xyzw Vector4 value
Double4(const Vector4& xyzw);
// Init
// @param xy X and Y values in the vector
// @param z Z component value
// @param w W component value
explicit Double4(const Int2& xy, double z, double w);
// Init
// @param xyz X, Y and Z values in the vector
// @param w W component value
explicit Double4(const Int3& xyz, double w);
// Init
// @param xyzw Int4 value
explicit Double4(const Int4& xyzw);
// Init
// @param xy X and Y values in the vector
// @param z Z component value
// @param w W component value
explicit Double4(const Double2& xy, double z, double w);
// Init
// @param xyz X, Y and Z values in the vector
// @param w W component value
explicit Double4(const Double3& xyz, double w);
// Init
// @param color Color value
explicit Double4(const Color& color);
// Init
// @param rect Rectangle value
explicit Double4(const Rectangle& rect);
public:
String ToString() const;
public:
// Gets a value indicting whether this vector is zero
// Gets a value indicting whether this vector is zero.
bool IsZero() const
{
return Math::IsZero(X) && Math::IsZero(Y) && Math::IsZero(Z) && Math::IsZero(W);
}
// Gets a value indicting whether any vector component is zero
// Gets a value indicting whether any vector component is zero.
bool IsAnyZero() const
{
return Math::IsZero(X) || Math::IsZero(Y) || Math::IsZero(Z) || Math::IsZero(W);
}
// Gets a value indicting whether this vector is one
// Gets a value indicting whether this vector is one.
bool IsOne() const
{
return Math::IsOne(X) && Math::IsOne(Y) && Math::IsOne(Z) && Math::IsOne(W);
}
/// <summary>
/// Calculates a vector with values being absolute values of that vector
/// Calculates a vector with values being absolute values of that vector.
/// </summary>
/// <returns>Absolute vector</returns>
Double4 GetAbsolute() const
{
return Double4(Math::Abs(X), Math::Abs(Y), Math::Abs(Z), Math::Abs(W));
}
/// <summary>
/// Calculates a vector with values being opposite to values of that vector
/// Calculates a vector with values being opposite to values of that vector.
/// </summary>
/// <returns>Negative vector</returns>
Double4 GetNegative() const
{
return Double4(-X, -Y, -Z, -W);
}
/// <summary>
/// Returns average arithmetic of all the components
/// Returns the average arithmetic of all the components.
/// </summary>
/// <returns>Average arithmetic of all the components</returns>
double AverageArithmetic() const
{
return (X + Y + Z + W) * 0.25;
}
/// <summary>
/// Gets sum of all vector components values
/// Gets the sum of all vector components values.
/// </summary>
/// <returns>Sum of X, Y, Z and W</returns>
double SumValues() const
{
return X + Y + Z + W;
}
/// <summary>
/// Returns minimum value of all the components
/// Returns the minimum value of all the components.
/// </summary>
/// <returns>Minimum value</returns>
double MinValue() const
{
return Math::Min(X, Y, Z, W);
}
/// <summary>
/// Returns maximum value of all the components
/// Returns the maximum value of all the components.
/// </summary>
/// <returns>Maximum value</returns>
double MaxValue() const
{
return Math::Max(X, Y, Z, W);
}
/// <summary>
/// Returns true if vector has one or more components is not a number (NaN)
/// Returns true if vector has one or more components is not a number (NaN).
/// </summary>
/// <returns>True if one or more components is not a number (NaN)</returns>
bool IsNaN() const
{
return isnan(X) || isnan(Y) || isnan(Z) || isnan(W);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity
/// Returns true if vector has one or more components equal to +/- infinity.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity</returns>
bool IsInfinity() const
{
return isinf(X) || isinf(Y) || isinf(Z) || isinf(W);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity or NaN
/// Returns true if vector has one or more components equal to +/- infinity or NaN.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity or NaN</returns>
bool IsNanOrInfinity() const
{
return IsInfinity() || IsNaN();
}
public:
// Arithmetic operators with Double4
inline Double4 operator+(const Double4& b) const
{
@@ -406,7 +349,6 @@ public:
}
public:
static bool NearEqual(const Double4& a, const Double4& b)
{
return Math::NearEqual(a.X, b.X) && Math::NearEqual(a.Y, b.Y) && Math::NearEqual(a.Z, b.Z) && Math::NearEqual(a.W, b.W);
@@ -418,7 +360,6 @@ public:
}
public:
static void Add(const Double4& a, const Double4& b, Double4& result)
{
result.X = a.X + b.X;
@@ -475,7 +416,6 @@ public:
static Double4 Ceil(const Double4& v);
public:
// Restricts a value to be within a specified range
// @param value The value to clamp
// @param min The minimum value,

View File

@@ -11,9 +11,8 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API Int2
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Int2);
DECLARE_SCRIPTING_TYPE_MINIMAL(Int2);
public:
union
{
struct
@@ -34,7 +33,6 @@ public:
};
public:
// Vector with all components equal 0
static const Int2 Zero;
@@ -48,7 +46,6 @@ public:
static const Int2 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -80,7 +77,7 @@ public:
// Init
// @param xyzw Int4 to use X and Y components
Int2(const Int4& xyzw);
// Init
// @param xy Vector2 to use X and Y components
explicit Int2(const Vector2& xy);
@@ -92,13 +89,11 @@ public:
// Init
// @param xyzw Vector4 to use X and Y components
explicit Int2(const Vector4& xyzw);
public:
public:
String ToString() const;
public:
// Arithmetic operators with Int2
Int2 operator+(const Int2& b) const
@@ -233,7 +228,6 @@ public:
}
public:
static void Add(const Int2& a, const Int2& b, Int2& result)
{
result.X = a.X + b.X;
@@ -306,7 +300,7 @@ public:
{
return X == 1 && Y == 1;
}
/// <summary>
/// Calculates a vector with values being opposite to values of that vector
/// </summary>
@@ -315,7 +309,7 @@ public:
{
return Int2(-X, -Y);
}
/// <summary>
/// Returns average arithmetic of all the components
/// </summary>
@@ -352,7 +346,6 @@ public:
return Math::Max(X, Y);
}
// Returns a vector containing the smallest components of the specified vectors
// @param a The first source vector
// @param b The second source vector

View File

@@ -6,15 +6,13 @@
#include "Engine/Core/Formatting.h"
#include "Engine/Core/Templates.h"
/// <summary>
/// Three-components vector (32 bit integer type).
/// </summary>
API_STRUCT() struct FLAXENGINE_API Int3
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Int3);
DECLARE_SCRIPTING_TYPE_MINIMAL(Int3);
public:
union
{
struct
@@ -40,7 +38,6 @@ public:
};
public:
// Vector with all components equal 0
static const Int3 Zero;
@@ -54,7 +51,6 @@ public:
static const Int3 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -95,7 +91,7 @@ public:
// @param v Vector2 to use X and Y components
// @param z Z component value
explicit Int3(const Vector2& xy, int32 z);
// Init
// @param v Vector3 to use X, Y and Z components
explicit Int3(const Vector3& xyz);
@@ -103,13 +99,11 @@ public:
// Init
// @param v Vector4 to use X and Y components
explicit Int3(const Vector4& xyzw);
public:
public:
String ToString() const;
public:
// Arithmetic operators with Int2
Int3 operator+(const Int3& b) const
@@ -244,7 +238,6 @@ public:
}
public:
static void Add(const Int3& a, const Int3& b, Int3& result)
{
result.X = a.X + b.X;
@@ -294,7 +287,6 @@ public:
}
public:
/// <summary>
/// Gets a value indicting whether this vector is zero.
/// </summary>
@@ -321,7 +313,7 @@ public:
{
return X == 1 && Y == 1 && Z == 1;
}
/// <summary>
/// Calculates a vector with values being opposite to values of that vector
/// </summary>
@@ -330,7 +322,7 @@ public:
{
return Int3(-X, -Y, -Z);
}
/// <summary>
/// Returns average arithmetic of all the components
/// </summary>
@@ -366,7 +358,7 @@ public:
{
return Math::Max(X, Y, Z);
}
// Returns a vector containing the largest components of the specified vectors
// @param a The first source vector
// @param b The second source vector

View File

@@ -11,9 +11,8 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API Int4
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Int4);
DECLARE_SCRIPTING_TYPE_MINIMAL(Int4);
public:
union
{
struct
@@ -44,7 +43,6 @@ public:
};
public:
// Vector with all components equal 0
static const Int4 Zero;
@@ -56,9 +54,8 @@ public:
// A maximum Int4
static const Int4 Maximum;
public:
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -110,17 +107,15 @@ public:
// @param v Vector3 to use X , Y and Z components
// @param w W component value
explicit Int4(const Vector3& xyz, int32 w);
// Init
// @param v Vector to use X, Y, Z and W components
explicit Int4(const Vector4& xyzw);
public:
String ToString() const;
public:
// Arithmetic operators with Int2
Int4 operator+(const Int4& b) const
@@ -255,7 +250,6 @@ public:
}
public:
static void Add(const Int4& a, const Int4& b, Int4& result)
{
result.X = a.X + b.X;
@@ -305,9 +299,8 @@ public:
{
return Int4(a.X / b, a.Y / b, a.Z / b, a.Y / b);
}
public:
public:
/// <summary>
/// Gets a value indicting whether this vector is zero.
/// </summary>
@@ -334,7 +327,7 @@ public:
{
return X == 1 && Y == 1 && Z == 1 && W == 1;
}
/// <summary>
/// Calculates a vector with values being opposite to values of that vector
/// </summary>
@@ -343,7 +336,7 @@ public:
{
return Int4(-X, -Y, -Z, -W);
}
/// <summary>
/// Returns average arithmetic of all the components
/// </summary>
@@ -379,7 +372,7 @@ public:
{
return Math::Max(X, Y, Z, W);
}
// Returns a vector containing the largest components of the specified vectors
// @param a The first source vector
// @param b The second source vector

View File

@@ -13,9 +13,8 @@ struct Transform;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Matrix
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Matrix);
DECLARE_SCRIPTING_TYPE_MINIMAL(Matrix);
public:
union
{
struct
@@ -74,7 +73,6 @@ public:
};
public:
/// <summary>A matrix with all of its components set to zero.</summary>
static const Matrix Zero;
@@ -82,7 +80,6 @@ public:
static const Matrix Identity;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -153,11 +150,9 @@ public:
explicit Matrix(const Matrix3x3& matrix);
public:
String ToString() const;
public:
// Gets the up Vector3 of the matrix; that is M21, M22, and M23.
Vector3 GetUp() const
{
@@ -430,7 +425,6 @@ public:
float RotDeterminant() const;
public:
// Inverts the matrix.
void Invert()
{
@@ -449,7 +443,6 @@ public:
void NormalizeScale();
public:
/// <summary>
/// Decomposes a rotation matrix with the specified yaw, pitch, roll.
/// </summary>
@@ -492,7 +485,6 @@ public:
void Decompose(Vector3& scale, Matrix& rotation, Vector3& translation) const;
public:
Matrix operator*(const float scale) const
{
Matrix result;
@@ -553,7 +545,6 @@ public:
}
public:
// Calculates the sum of two matrices.
// @param left The first matrix to add.
// @param right The second matrix to add.
@@ -1141,7 +1132,6 @@ public:
static void CreateFromAxisAngle(const Vector3& axis, float angle, Matrix& result);
public:
static Vector4 TransformPosition(const Matrix& m, const Vector3& v);
static Vector4 TransformPosition(const Matrix& m, const Vector4& v);
};

View File

@@ -12,7 +12,6 @@
API_STRUCT(InBuild) struct FLAXENGINE_API Matrix3x3
{
public:
union
{
struct
@@ -50,7 +49,6 @@ public:
};
public:
/// <summary>
/// A matrix with all of its components set to zero.
/// </summary>
@@ -62,7 +60,6 @@ public:
static const Matrix3x3 Identity;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -120,11 +117,9 @@ public:
explicit Matrix3x3(const Matrix& matrix);
public:
String ToString() const;
public:
// Gets the first row in the matrix; that is M11, M12 and M13.
Vector3 GetRow1() const
{
@@ -244,7 +239,6 @@ public:
}
public:
/// <summary>
/// Inverts the Matrix3x3.
/// </summary>
@@ -267,7 +261,6 @@ public:
void NormalizeScale();
public:
/// <summary>
/// Calculates the inverse of the specified Matrix3x3.
/// </summary>
@@ -307,7 +300,6 @@ public:
}
public:
/// <summary>
/// Determines the sum of two matrices.
/// </summary>
@@ -435,7 +427,6 @@ public:
}
public:
/// <summary>
/// Creates 2D translation matrix.
/// </summary>
@@ -491,7 +482,6 @@ public:
}
public:
/// <summary>
/// Creates a rotation matrix from a quaternion
/// </summary>
@@ -512,7 +502,6 @@ public:
static void RotationQuaternion(const Quaternion& rotation, Matrix3x3& result);
public:
/// <summary>
/// Tests for equality between two objects.
/// </summary>

View File

@@ -11,7 +11,6 @@
API_STRUCT(InBuild) struct FLAXENGINE_API OrientedBoundingBox
{
public:
// Half lengths of the box along each axis.
Vector3 Extents;
@@ -19,7 +18,6 @@ public:
Matrix Transformation;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -58,11 +56,9 @@ public:
OrientedBoundingBox(Vector3 points[], int32 pointCount);
public:
String ToString() const;
public:
// Gets the eight corners of the bounding box.
void GetCorners(Vector3 corners[8]) const;
@@ -98,7 +94,6 @@ public:
void GetBoundingBox(BoundingBox& result) const;
public:
// Transforms this box using a transformation matrix.
// @param mat The transformation matrix.
void Transform(const Matrix& matrix);
@@ -127,7 +122,6 @@ public:
}
public:
FORCE_INLINE bool operator==(const OrientedBoundingBox& other) const
{
return Extents == other.Extents && Transformation == other.Transformation;
@@ -146,7 +140,6 @@ public:
}
private:
static void GetRows(const Matrix& mat, Vector3 rows[3])
{
rows[0] = Vector3(mat.M11, mat.M12, mat.M13);
@@ -155,7 +148,6 @@ private:
}
public:
/// <summary>
/// Creates the centered box (axis aligned).
/// </summary>
@@ -183,7 +175,6 @@ public:
}
public:
// Determines whether a OBB contains a point.
// @param point The point to test.
// @returns The type of containment the two objects have.

View File

@@ -10,14 +10,12 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API Plane
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Plane);
DECLARE_SCRIPTING_TYPE_MINIMAL(Plane);
public:
static const float DistanceEpsilon;
static const float NormalEpsilon;
public:
/// <summary>
/// The normal vector of the plane.
/// </summary>
@@ -29,7 +27,6 @@ public:
API_FIELD() float D;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -91,11 +88,9 @@ public:
Plane(const Vector3& point1, const Vector3& point2, const Vector3& point3);
public:
String ToString() const;
public:
/// <summary>
/// Changes the coefficients of the normal vector of the plane to make it of unit length.
/// </summary>
@@ -128,7 +123,6 @@ public:
void Shadow(const Vector4& light, Matrix& result) const;
public:
// Scales a plane by the given value
// @param scale The amount by which to scale the plane
// @param plane The plane to scale
@@ -154,7 +148,6 @@ public:
}
public:
void Translate(const Vector3& translation)
{
const Vector3 mul = Normal * translation;
@@ -176,7 +169,6 @@ public:
}
public:
static Vector3 Intersection(const Plane& inPlane1, const Plane& inPlane2, const Plane& inPlane3)
{
// intersection point with 3 planes
@@ -214,7 +206,6 @@ public:
}
public:
// Determines if there is an intersection between the current object and a point
// @param point The point to test
// @returns Whether the two objects intersected
@@ -301,7 +292,6 @@ public:
}
public:
// Scales the plane by the given scaling factor
// @param value The plane to scale
// @param scale The amount by which to scale the plane

View File

@@ -17,9 +17,8 @@ struct Matrix3x3;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Quaternion
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Quaternion);
DECLARE_SCRIPTING_TYPE_MINIMAL(Quaternion);
public:
union
{
struct
@@ -52,7 +51,6 @@ public:
};
public:
/// <summary>
/// Quaternion with all components equal 0.
/// </summary>
@@ -69,7 +67,6 @@ public:
static Quaternion Identity;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -111,11 +108,9 @@ public:
explicit Quaternion(const Vector4& value);
public:
String ToString() const;
public:
/// <summary>
/// Gets a value indicating whether this instance is equivalent to the identity quaternion.
/// </summary>
@@ -283,7 +278,6 @@ public:
void Multiply(const Quaternion& other);
public:
/// <summary>
/// Adds two quaternions.
/// </summary>
@@ -406,7 +400,6 @@ public:
}
public:
/// <summary>
/// Determines whether the specified <see cref="Quaternion" /> structures are equal.
/// </summary>
@@ -431,7 +424,6 @@ public:
}
public:
/// <summary>
/// Calculates the inverse of the specified quaternion.
/// </summary>

View File

@@ -13,9 +13,8 @@ struct Viewport;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Ray
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Ray);
DECLARE_SCRIPTING_TYPE_MINIMAL(Ray);
public:
/// <summary>
/// The position in three dimensional space where the ray starts.
/// </summary>
@@ -27,14 +26,12 @@ public:
API_FIELD() Vector3 Direction;
public:
/// <summary>
/// Identity ray (at zero origin pointing forwards).
/// </summary>
static Ray Identity;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -54,11 +51,9 @@ public:
}
public:
String ToString() const;
public:
FORCE_INLINE bool operator==(const Ray& other) const
{
return Position == other.Position && Direction == other.Direction;
@@ -80,7 +75,6 @@ public:
}
public:
/// <summary>
/// Gets a point at distance long ray.
/// </summary>
@@ -260,7 +254,6 @@ public:
}
public:
/// <summary>
/// Calculates a world space ray from 2d screen coordinates.
/// </summary>

View File

@@ -9,7 +9,7 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API Rectangle
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Rectangle);
DECLARE_SCRIPTING_TYPE_MINIMAL(Rectangle);
/// <summary>
/// The empty rectangle.
@@ -17,7 +17,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(Rectangle);
static Rectangle Empty;
public:
/// <summary>
/// Rectangle location (coordinates of the upper-left corner)
/// </summary>
@@ -29,7 +28,6 @@ public:
API_FIELD() Vector2 Size;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -58,11 +56,9 @@ public:
}
public:
String ToString() const;
public:
// Returns width of the rectangle
float GetWidth() const
{
@@ -145,7 +141,6 @@ public:
}
public:
// Offset rectangle Location point
// @param v Offset to add
// @returns Result rectangle
@@ -208,7 +203,6 @@ public:
}
public:
static bool NearEqual(const Rectangle& a, const Rectangle& b)
{
return Vector2::NearEqual(a.Location, b.Location) && Vector2::NearEqual(a.Size, b.Size);
@@ -220,7 +214,6 @@ public:
}
public:
// Checks if rectangle contains given point
// @param location Point location to check
// @returns True if point is inside rectangle's area
@@ -237,7 +230,6 @@ public:
bool Intersects(const Rectangle& value) const;
public:
// Offset rectangle position
// @param x X coordinate offset
// @param y Y coordinate offset
@@ -253,7 +245,6 @@ public:
Rectangle MakeOffsetted(const Vector2& offset) const;
public:
// Expand rectangle area in all directions by given amount
// @param toExpand Amount of units to expand a rectangle
void Expand(float toExpand);
@@ -264,7 +255,6 @@ public:
Rectangle MakeExpanded(float toExpand) const;
public:
// Scale rectangle area in all directions by given amount
// @param scale Scale value to expand a rectangle
void Scale(float scale);
@@ -275,7 +265,6 @@ public:
Rectangle MakeScaled(float scale) const;
public:
// Calculates a rectangle that contains the union of rectangle and the arbitrary point
// @param a The rectangle
// @param b The point

View File

@@ -13,7 +13,7 @@ struct Matrix;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Transform
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Transform);
DECLARE_SCRIPTING_TYPE_MINIMAL(Transform);
/// <summary>
/// The translation vector of the transform.
@@ -31,14 +31,12 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(Transform);
API_FIELD(Attributes="EditorOrder(30), Limit(float.MinValue, float.MaxValue, 0.01f)") Vector3 Scale;
public:
/// <summary>
/// An identity transform.
/// </summary>
static Transform Identity;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -83,11 +81,9 @@ public:
}
public:
String ToString() const;
public:
/// <summary>
/// Checks if transform is an identity transformation
/// </summary>
@@ -116,7 +112,6 @@ public:
}
public:
/// <summary>
/// Gets rotation matrix (from Orientation)
/// </summary>
@@ -148,7 +143,6 @@ public:
void GetWorld(Matrix& result) const;
public:
/// <summary>
/// Adds translation to this transform.
/// </summary>
@@ -250,7 +244,6 @@ public:
void WorldToLocal(const Vector3* points, int32 pointsCount, Vector3* result) const;
public:
FORCE_INLINE Transform operator*(const Transform& other) const
{
return LocalToWorld(other);
@@ -292,7 +285,6 @@ public:
}
public:
FORCE_INLINE Vector3 GetRight() const
{
return Vector3::Transform(Vector3::Right, Orientation);
@@ -312,7 +304,7 @@ public:
{
return Vector3::Transform(Vector3::Down, Orientation);
}
FORCE_INLINE Vector3 GetForward() const
{
return Vector3::Transform(Vector3::Forward, Orientation);
@@ -324,7 +316,6 @@ public:
}
public:
static Transform Lerp(const Transform& t1, const Transform& t2, float amount);
static void Lerp(const Transform& t1, const Transform& t2, float amount, Transform& result);
};

View File

@@ -11,7 +11,6 @@
struct FLAXENGINE_API Triangle
{
public:
/// <summary>
/// The first vertex.
/// </summary>
@@ -28,7 +27,6 @@ public:
Vector3 V2;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -50,14 +48,12 @@ public:
}
public:
Vector3 GetNormal() const
{
return Vector3::Normalize((V1 - V0) ^ (V2 - V0));
}
public:
// Determines if there is an intersection between the current object and a Ray
// @param ray The ray to test
// @returns Whether the two objects intersected

View File

@@ -22,9 +22,8 @@ struct Matrix;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Vector2
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Vector2);
DECLARE_SCRIPTING_TYPE_MINIMAL(Vector2);
public:
union
{
struct
@@ -45,7 +44,6 @@ public:
};
public:
// Vector with all components equal 0
static const Vector2 Zero;
@@ -65,7 +63,6 @@ public:
static const Vector2 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -90,48 +87,20 @@ public:
{
}
// Init
// @param v Int2 to use X and Y components
explicit Vector2(const Int2& xy);
// Init
// @param v Int3 to use X and Y components
explicit Vector2(const Int3& xyz);
// Init
// @param v Int4 to use X and Y components
explicit Vector2(const Int4& xyzw);
// Init
// @param v Vector3 to use X and Y components
explicit Vector2(const Vector3& xyz);
// Init
// @param v Vector4 to use X and Y components
explicit Vector2(const Vector4& xyzw);
// Init
// @param xy Double2 to use X and Y components
Vector2(const Double2& xy);
// Init
// @param xyz Double3 to use X and Y components
explicit Vector2(const Double3& xyz);
// Init
// @param xyzw Double4 to use X and Y components
explicit Vector2(const Double4& xyzw);
// Init
// @param color Color value
explicit Vector2(const Color& color);
public:
String ToString() const;
public:
// Arithmetic operators with Vector2
Vector2 operator+(const Vector2& b) const
{
@@ -261,7 +230,6 @@ public:
}
public:
static bool NearEqual(const Vector2& a, const Vector2& b)
{
return Math::NearEqual(a.X, b.X) && Math::NearEqual(a.Y, b.Y);
@@ -273,7 +241,6 @@ public:
}
public:
static float Dot(const Vector2& a, const Vector2& b)
{
return a.X * b.X + a.Y * b.Y;
@@ -385,137 +352,125 @@ public:
}
public:
// Gets a value indicting whether this instance is normalized
// Gets a value indicting whether this instance is normalized.
bool IsNormalized() const
{
return Math::IsOne(X * X + Y * Y);
}
// Gets a value indicting whether this vector is zero
// Gets a value indicting whether this vector is zero.
bool IsZero() const
{
return Math::IsZero(X) && Math::IsZero(Y);
}
// Gets a value indicting whether any vector component is zero
// Gets a value indicting whether any vector component is zero.
bool IsAnyZero() const
{
return Math::IsZero(X) || Math::IsZero(Y);
}
// Gets a value indicting whether this vector is zero
// Gets a value indicting whether this vector is zero.
bool IsOne() const
{
return Math::IsOne(X) && Math::IsOne(Y);
}
// Calculates length of the vector
// @returns Length of the vector
// Calculates the length of the vector.
float Length() const
{
return Math::Sqrt(X * X + Y * Y);
}
// Calculates the squared length of the vector
// @returns The squared length of the vector
// Calculates the squared length of the vector.
float LengthSquared() const
{
return X * X + Y * Y;
}
// Calculates inverted length of the vector (1 / Length())
// Calculates inverted length of the vector (1 / length).
float InvLength() const
{
return 1.0f / Length();
}
// Calculates a vector with values being absolute values of that vector
// Calculates a vector with values being absolute values of that vector.
Vector2 GetAbsolute() const
{
return Vector2(Math::Abs(X), Math::Abs(Y));
}
// Calculates a vector with values being opposite to values of that vector
// Calculates a vector with values being opposite to values of that vector.
Vector2 GetNegative() const
{
return Vector2(-X, -Y);
}
/// <summary>
/// Returns average arithmetic of all the components
/// Returns the average arithmetic of all the components.
/// </summary>
/// <returns>Average arithmetic of all the components</returns>
float AverageArithmetic() const
{
return (X + Y) * 0.5f;
}
/// <summary>
/// Gets sum of all vector components values
/// Gets the sum of all vector components values.
/// </summary>
/// <returns>Sum of X,Y and Z</returns>
float SumValues() const
{
return X + Y;
}
/// <summary>
/// Gets multiplication result of all vector components values
/// Gets the multiplication result of all vector components values.
/// </summary>
/// <returns>X * Y</returns>
float MulValues() const
{
return X * Y;
}
/// <summary>
/// Returns minimum value of all the components
/// Returns the minimum value of all the components.
/// </summary>
/// <returns>Minimum value</returns>
float MinValue() const
{
return Math::Min(X, Y);
}
/// <summary>
/// Returns maximum value of all the components
/// Returns the maximum value of all the components.
/// </summary>
/// <returns>Maximum value</returns>
float MaxValue() const
{
return Math::Max(X, Y);
}
/// <summary>
/// Returns true if vector has one or more components is not a number (NaN)
/// Returns true if vector has one or more components is not a number (NaN).
/// </summary>
/// <returns>True if one or more components is not a number (NaN)</returns>
bool IsNaN() const
{
return isnan(X) || isnan(Y);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity
/// Returns true if vector has one or more components equal to +/- infinity.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity</returns>
bool IsInfinity() const
{
return isinf(X) || isinf(Y);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity or NaN
/// Returns true if vector has one or more components equal to +/- infinity or NaN.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity or NaN</returns>
bool IsNanOrInfinity() const
{
return IsInfinity() || IsNaN();
}
public:
// Performs a linear interpolation between two vectors
// @param start Start vector
// @param end End vector
@@ -605,7 +560,6 @@ public:
}
public:
/// <summary>
/// Calculates the area of the triangle.
/// </summary>
@@ -614,15 +568,14 @@ public:
/// <param name="v2">The third triangle vertex.</param>
/// <returns>The triangle area.</returns>
static float TriangleArea(const Vector2& v0, const Vector2& v1, const Vector2& v2);
/// <summary>
/// <summary>
/// Calculates the angle (in radians) between from and to. This is always the smallest value.
/// </summary>
/// <param name="from">The first vector.</param>
/// <param name="to">The second vector.</param>
/// <returns>The angle (in radians).</returns>
static float Angle(const Vector2& from, const Vector2& to);
};
inline Vector2 operator+(float a, const Vector2& b)

View File

@@ -132,7 +132,6 @@ public:
{
}
explicit Vector3(const Vector2& xy, float z);
explicit Vector3(const Vector2& xy);
explicit Vector3(const Int2& xy, float z);
@@ -358,7 +357,7 @@ public:
{
return Dot(*this, b);
}
Vector3& operator+=(const Vector3& b)
{
X += b.X;
@@ -390,7 +389,7 @@ public:
Z /= b.Z;
return *this;
}
Vector3 operator+(float b) const
{
return Vector3(X + b, Y + b, Z + b);
@@ -410,7 +409,7 @@ public:
{
return Vector3(X / b, Y / b, Z / b);
}
Vector3& operator+=(float b)
{
*this = Add(*this, b);
@@ -434,7 +433,7 @@ public:
*this = Divide(*this, b);
return *this;
}
bool operator==(const Vector3& b) const
{
return X == b.X && Y == b.Y && Z == b.Z;

View File

@@ -24,9 +24,8 @@ struct Int4;
/// </summary>
API_STRUCT() struct FLAXENGINE_API Vector4
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Vector4);
DECLARE_SCRIPTING_TYPE_MINIMAL(Vector4);
public:
union
{
struct
@@ -59,7 +58,6 @@ public:
};
public:
// Vector with all components equal 0
static const Vector4 Zero;
@@ -85,7 +83,6 @@ public:
static const Vector4 Maximum;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -120,169 +117,113 @@ public:
{
}
// Init
// @param xy X and Y values in the vector
// @param z Z component value
// @param w W component value
explicit Vector4(const Vector2& xy, float z, float w);
// Init
// @param xy X and Y values in the vector
// @param zw Z and W values in the vector
// @param z Z component value
// @param w W component value
explicit Vector4(const Vector2& xy, const Vector2& zw);
// Init
// @param xyz X, Y and Z values in the vector
// @param w W component value
explicit Vector4(const Vector3& xyz, float w);
// Init
// @param xy X and Y values in the vector
// @param z Z component value
// @param w W component value
explicit Vector4(const Int2& xy, float z, float w);
// Init
// @param xyz X, Y and Z values in the vector
// @param w W component value
explicit Vector4(const Int3& xyz, float w);
// Init
// @param color Int4 value
explicit Vector4(const Int4& xyzw);
// Init
// @param xy Double2. X and Y values in the vector
// @param z Z component value
// @param w W component value
explicit Vector4(const Double2& xy, float z, float w);
// Init
// @param xyz Double3. X, Y and Z values in the vector
// @param w W component value
explicit Vector4(const Double3& xyz, float w);
// Init
// @param xyzw Double4 value
Vector4(const Double4& xyzw);
// Init
// @param color Color value
explicit Vector4(const Color& color);
// Init
// @param rect Rectangle value
explicit Vector4(const Rectangle& rect);
public:
String ToString() const;
public:
// Gets a value indicting whether this vector is zero
// Gets a value indicting whether this vector is zero.
bool IsZero() const
{
return Math::IsZero(X) && Math::IsZero(Y) && Math::IsZero(Z) && Math::IsZero(W);
}
// Gets a value indicting whether any vector component is zero
// Gets a value indicting whether any vector component is zero.
bool IsAnyZero() const
{
return Math::IsZero(X) || Math::IsZero(Y) || Math::IsZero(Z) || Math::IsZero(W);
}
// Gets a value indicting whether this vector is one
// Gets a value indicting whether this vector is one.
bool IsOne() const
{
return Math::IsOne(X) && Math::IsOne(Y) && Math::IsOne(Z) && Math::IsOne(W);
}
/// <summary>
/// Calculates a vector with values being absolute values of that vector
/// Calculates a vector with values being absolute values of that vector.
/// </summary>
/// <returns>Absolute vector</returns>
Vector4 GetAbsolute() const
{
return Vector4(Math::Abs(X), Math::Abs(Y), Math::Abs(Z), Math::Abs(W));
}
/// <summary>
/// Calculates a vector with values being opposite to values of that vector
/// Calculates a vector with values being opposite to values of that vector.
/// </summary>
/// <returns>Negative vector</returns>
Vector4 GetNegative() const
{
return Vector4(-X, -Y, -Z, -W);
}
/// <summary>
/// Returns average arithmetic of all the components
/// Returns the average arithmetic of all the components.
/// </summary>
/// <returns>Average arithmetic of all the components</returns>
float AverageArithmetic() const
{
return (X + Y + Z + W) * 0.25f;
}
/// <summary>
/// Gets sum of all vector components values
/// Gets the sum of all vector components values.
/// </summary>
/// <returns>Sum of X, Y, Z and W</returns>
float SumValues() const
{
return X + Y + Z + W;
}
/// <summary>
/// Returns minimum value of all the components
/// Returns the minimum value of all the components.
/// </summary>
/// <returns>Minimum value</returns>
float MinValue() const
{
return Math::Min(X, Y, Z, W);
}
/// <summary>
/// Returns maximum value of all the components
/// Returns the maximum value of all the components.
/// </summary>
/// <returns>Maximum value</returns>
float MaxValue() const
{
return Math::Max(X, Y, Z, W);
}
/// <summary>
/// Returns true if vector has one or more components is not a number (NaN)
/// Returns true if vector has one or more components is not a number (NaN).
/// </summary>
/// <returns>True if one or more components is not a number (NaN)</returns>
bool IsNaN() const
{
return isnan(X) || isnan(Y) || isnan(Z) || isnan(W);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity
/// Returns true if vector has one or more components equal to +/- infinity.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity</returns>
bool IsInfinity() const
{
return isinf(X) || isinf(Y) || isinf(Z) || isinf(W);
}
/// <summary>
/// Returns true if vector has one or more components equal to +/- infinity or NaN
/// Returns true if vector has one or more components equal to +/- infinity or NaN.
/// </summary>
/// <returns>True if one or more components equal to +/- infinity or NaN</returns>
bool IsNanOrInfinity() const
{
return IsInfinity() || IsNaN();
}
public:
// Arithmetic operators with Vector4
inline Vector4 operator+(const Vector4& b) const
{
@@ -407,7 +348,6 @@ public:
}
public:
static bool NearEqual(const Vector4& a, const Vector4& b)
{
return Math::NearEqual(a.X, b.X) && Math::NearEqual(a.Y, b.Y) && Math::NearEqual(a.Z, b.Z) && Math::NearEqual(a.W, b.W);
@@ -419,7 +359,6 @@ public:
}
public:
static void Add(const Vector4& a, const Vector4& b, Vector4& result)
{
result.X = a.X + b.X;
@@ -476,7 +415,6 @@ public:
static Vector4 Ceil(const Vector4& v);
public:
// Restricts a value to be within a specified range
// @param value The value to clamp
// @param min The minimum value,

View File

@@ -13,7 +13,6 @@ struct Rectangle;
API_STRUCT(InBuild) struct FLAXENGINE_API Viewport
{
public:
union
{
struct
@@ -51,7 +50,6 @@ public:
float MaxDepth;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -110,11 +108,9 @@ public:
Viewport(const Rectangle& bounds);
public:
String ToString() const;
public:
// Gets the aspect ratio used by the viewport
// @returns The aspect ratio
float GetAspectRatio() const
@@ -135,7 +131,6 @@ public:
void SetBounds(const Rectangle& bounds);
public:
bool operator==(const Viewport& other) const
{
return X == other.X && Y == other.Y && Width == other.Width && Height == other.Height && MinDepth == other.MinDepth && MaxDepth == other.MaxDepth;
@@ -147,7 +142,6 @@ public:
}
public:
// Projects a 3D vector from object space into screen space
// @param source The vector to project
// @param vp A combined WorldViewProjection matrix